code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def private_current(self, user): <NEW_LINE> <INDENT> if not self.current_group: <NEW_LINE> <INDENT> self.msg(user, 'There is no current group being discussed.') <NEW_LINE> return <NEW_LINE> <DEDENT> self.msg(user, 'The current group on the plate is: {0}'.format(self.current_group.name)) <NEW_LINE> self._report_on_group... | Spit out information about the current group. | 625941f2bf627c535bc137a2 |
def post(self, request, project, plugin_id): <NEW_LINE> <INDENT> plugin = self._get_plugin(plugin_id) <NEW_LINE> if request.DATA.get('test') and plugin.is_testable(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> test_results = plugin.test_configuration(project) <NEW_LINE> <DEDENT> except Exception as exc: <NEW_LINE> <I... | Enable plugin, Test plugin or Reset plugin values | 625941f2bd1bec0571d90c02 |
def test_honeypot_value_string(self): <NEW_LINE> <INDENT> request = _get_POST_request() <NEW_LINE> settings.HONEYPOT_VALUE = '(test string)' <NEW_LINE> request.POST[settings.HONEYPOT_FIELD_NAME] = settings.HONEYPOT_VALUE <NEW_LINE> resp = verify_honeypot_value(request, None) <NEW_LINE> self.assertEquals(resp, None) | test that verify_honeypot_value succeeds when HONEYPOT_VALUE is a string | 625941f2498bea3a759ba080 |
def _context_url(GET, fileid=None): <NEW_LINE> <INDENT> fileid = str(fileid) if fileid else None <NEW_LINE> ig_ws = get_ignore_ws(fileid, GET) <NEW_LINE> ln_ctx = (get_line_ctx(fileid, GET) or 3) * 2 <NEW_LINE> params = defaultdict(list) <NEW_LINE> _update_with_GET(params, GET) <NEW_LINE> if fileid is None: <NEW_LINE> ... | Generates url for context lines
:param fileid: | 625941f25e10d32532c5f4f8 |
@login_required <NEW_LINE> def edit_entry(request, entry_id): <NEW_LINE> <INDENT> entry = Entry.objects.get(id=entry_id) <NEW_LINE> if request.method != 'POST': <NEW_LINE> <INDENT> form = EntryForm(instance=entry) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> form = EntryForm(instance=entry, data=request.POST) <NEW_LIN... | Edit entry | 625941f2be383301e01b5a4d |
def associate_name(self, line, name, loop=False, reverse=False): <NEW_LINE> <INDENT> x1, y1 = line.begin.pos_x, line.begin.pos_y <NEW_LINE> x2, y2 = line.end.pos_x, line.end.pos_y <NEW_LINE> d = line.get_length() <NEW_LINE> if abs(x1 - x2) < 1e-3: <NEW_LINE> <INDENT> dx = 0.015 <NEW_LINE> dy = -0.01 <NEW_LINE> <DEDENT>... | ADD the EPS code associate to the name of the particle. Place it near
to the center of the line. | 625941f2dd821e528d63b777 |
def breadthFirstSearch(problem): <NEW_LINE> <INDENT> initialNode = problem.getStartState() <NEW_LINE> fringe = util.Queue() <NEW_LINE> fringe.push((initialNode, [])) <NEW_LINE> exploredSet = [] <NEW_LINE> while not (fringe.isEmpty()): <NEW_LINE> <INDENT> coordinates, steps = fringe.pop() <NEW_LINE> if problem.isGoalSta... | Search the shallowest nodes in the search tree first. | 625941f2097d151d1a223429 |
def f_regex_num_all(exec_f, indata, str_srs_extract_num): <NEW_LINE> <INDENT> if exec_f: <NEW_LINE> <INDENT> import pandas as pd <NEW_LINE> import numpy as np <NEW_LINE> import re <NEW_LINE> df_temp = indata.copy() <NEW_LINE> srs_num_all = df_temp[str_srs_extract_num].astype('str').str.findall('(\d+)').explode() <NEW_L... | This function takes a DataFrame, and column name as string, and parses out ALL MATCHES of characters, [a-ö], [A-Ö], [&/()&/)¤], etc....
NOTE: This function is not optimized for big data volumes. | 625941f238b623060ff0b3c0 |
def to_np_value(self, dtype="i8"): <NEW_LINE> <INDENT> val = self.to_ntp64() <NEW_LINE> return np.fromstring(val, dtype=dtype) | Returns 64bit NTPv4 representation as i8 value. | 625941f215baa723493c454d |
def convert_map_cell_to_point(map_grid, cell): <NEW_LINE> <INDENT> origin = map_grid.info.origin.position <NEW_LINE> resolution = map_grid.info.resolution <NEW_LINE> return cell[0] + int(origin.x / resolution), cell[1] + int(origin.y / resolution) | @type map_grid: OccupancyGrid
@type cell: (int, int) | 625941f26fece00bbac2dd19 |
def test_rec_sta_lta_python(self): <NEW_LINE> <INDENT> nsta, nlta = 5, 10 <NEW_LINE> c2 = recursive_sta_lta_py(self.data, nsta, nlta) <NEW_LINE> self.assertAlmostEqual(c2[99], 0.80810165) <NEW_LINE> self.assertAlmostEqual(c2[100], 0.75939449) <NEW_LINE> self.assertAlmostEqual(c2[101], 0.91763978) <NEW_LINE> self.assert... | Test case for python version of recursive_sta_lta | 625941f2aad79263cf39101d |
def _process_change(self, payload, user, repo, repo_url, event, codebase=None): <NEW_LINE> <INDENT> changes = [] <NEW_LINE> refname = payload['ref'] <NEW_LINE> project = payload['repository']['name'] <NEW_LINE> match = re.match(r"^refs/(heads|tags)/(.+)$", refname) <NEW_LINE> if not match: <NEW_LINE> <INDENT> log.msg("... | Consumes the JSON as a python object and actually starts the build.
:arguments:
payload
Python Object that represents the JSON sent by GitLab Service
Hook. | 625941f263b5f9789fde76b9 |
def load_config(): <NEW_LINE> <INDENT> config = None <NEW_LINE> config_file = find_config_file() <NEW_LINE> if config_file is None: <NEW_LINE> <INDENT> raise AntShellError("can not find config file!") <NEW_LINE> <DEDENT> file_type = get_config_type(config_file) <NEW_LINE> if file_type == INI_TYPE: <NEW_LINE> <INDENT> t... | 加载配置文件 | 625941f20a366e3fb873edf3 |
def URLsToTSV(source_urls, output, source_name=None, mode='a'): <NEW_LINE> <INDENT> with open(output, mode) as url_file: <NEW_LINE> <INDENT> if mode=='w': <NEW_LINE> <INDENT> url_file.write('url\tsource\n') <NEW_LINE> <DEDENT> if source_name: <NEW_LINE> <INDENT> for url in source_urls: <NEW_LINE> <INDENT> url_file.writ... | Add source URLs to full dataset compilation. | 625941f2d7e4931a7ee9e4f3 |
@login_required <NEW_LINE> @app.route('/register', methods=['GET', 'POST']) <NEW_LINE> def register(): <NEW_LINE> <INDENT> if g.user.role_id != 100: <NEW_LINE> <INDENT> return redirect('/home') <NEW_LINE> <DEDENT> form = RegisterForm() <NEW_LINE> if form.validate_on_submit(): <NEW_LINE> <INDENT> user = User.query.filte... | Register page | 625941f2167d2b6e31219168 |
def change_population(self, trade_success): <NEW_LINE> <INDENT> self.population_yesterday = self.population <NEW_LINE> if trade_success: <NEW_LINE> <INDENT> self.population += round(self.population * 0.01) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.population -= round(self.population * 0.002) | Change the population based off the trade | 625941f2956e5f7376d7143e |
def calculate_energy(frame): <NEW_LINE> <INDENT> energy = np.int64(0) <NEW_LINE> with np.errstate(over='ignore'): <NEW_LINE> <INDENT> for i in range(len(frame)): <NEW_LINE> <INDENT> energy += frame[i]**2 <NEW_LINE> <DEDENT> energy = math.sqrt(energy / len(frame)) <NEW_LINE> <DEDENT> return energy | Calculates the energy of a signal
:param frame: frame of a discrete signal
:return: the energy of the frame | 625941f294891a1f4081c07f |
def __str__(self): <NEW_LINE> <INDENT> return self.title | Return the Article's title | 625941f2009cb60464c63980 |
def plotMany(self, data): <NEW_LINE> <INDENT> for k, v in data.iteritems(): <NEW_LINE> <INDENT> self.plot(k,v) | 一次渲染多个数据 | 625941f2bf627c535bc137a3 |
def loadSC(self, scPath): <NEW_LINE> <INDENT> exists = os.path.isfile(scPath) <NEW_LINE> if exists: <NEW_LINE> <INDENT> with open(scPath, encoding="utf8") as scFile: <NEW_LINE> <INDENT> scContent = scFile.read() <NEW_LINE> <DEDENT> scContent = scContent.replace("\ufeff", "", 1) <NEW_LINE> rews, cats, rules = map("\n".j... | Load the rewrites, categories and rules from a file, if it exists. | 625941f2187af65679ca56f3 |
def getMaxBufferSize(self): <NEW_LINE> <INDENT> return self._maxBufferSize | Returns the maximum internal buffer size for responses, which
corresponds to total length (in bytes) of the serialised protobuf
objects. This will always be less than the size of JSON output. | 625941f226068e7796caf2bb |
def clean_stacks(self, stackids): <NEW_LINE> <INDENT> n_rows = self.executemany('DELETE FROM ztf_stacks WHERE stackid=?', [[i] for i in stackids]) <NEW_LINE> n_files = self.clean_stale_files() <NEW_LINE> self.db.commit() <NEW_LINE> return n_rows, n_files | Remove stacks from table and archive.
Parameters
----------
stackids : array-like of int
Stack IDs to remove.
Returns
-------
n_rows, n_files : int
Number of rows and files removed. | 625941f2796e427e537b0b9e |
def __init__(self, config_path, limit_task=None): <NEW_LINE> <INDENT> logging.basicConfig(format=LOG_FORMAT) <NEW_LINE> self.config_path = config_path <NEW_LINE> try: <NEW_LINE> <INDENT> global_file = open(self.config_path, "r") <NEW_LINE> <DEDENT> except Exception as exc: <NEW_LINE> <INDENT> raise DiasUsageError("Fail... | Construct the config loader.
Parameters
----------
config_path : str
Full path to YAML config file.
limit_task : :class:`Task` or `None`
If this is not `None`, only the config of the given task is loaded.
Default: `None`. | 625941f2a17c0f6771cbe622 |
@login_required <NEW_LINE> @mission_is_member <NEW_LINE> def image_get_full(request, image_id, mission_user): <NEW_LINE> <INDENT> image = get_object_or_404(GeoImage, pk=image_id, mission=mission_user.mission) <NEW_LINE> return FileResponse(open(f'images/full/{image.pk}.data', 'rb'), filename=f'original-{image.pk}.{imag... | Return the full sized version of the image | 625941f27b180e01f3dc4dc3 |
def produce(self, *args, **kwargs): <NEW_LINE> <INDENT> new_plugins = [] <NEW_LINE> for p in self._plugins: <NEW_LINE> <INDENT> r = p(*args, **kwargs) <NEW_LINE> new_plugins.append(r) <NEW_LINE> <DEDENT> return PluginManager(new_plugins) | Produce a new set of plugins, treating the current set as plugin
factories. | 625941f2099cdd3c635f122b |
def substitute(self, **kwargs): <NEW_LINE> <INDENT> newrange = substitute(self.range_, **kwargs) <NEW_LINE> if self.rangevar in kwargs: <NEW_LINE> <INDENT> del kwargs[self.rangevar] <NEW_LINE> <DEDENT> newarg = substitute(self.expr, **kwargs) <NEW_LINE> return Prod(newarg, **{self.rangevar: newrange}) | Substitute in arg but not rangevar. | 625941f2b830903b967e9ed8 |
def write_bdf(self, out_filename=None, encoding=None, size=8, is_double=False, interspersed=False, enddata=None, close=True): <NEW_LINE> <INDENT> out_filename = self._output_helper(out_filename, interspersed, size, is_double) <NEW_LINE> self.log.debug('---starting BDF.write_bdf of %s---' % out_filename) <NEW_LINE> enco... | Writes the BDF.
Parameters
----------
out_filename : varies; default=None
str - the name to call the output bdf
file - a file object
StringIO() - a StringIO object
None - pops a dialog
encoding : str; default=None -> system specified encoding
the unicode encoding
latin1, and ... | 625941f2566aa707497f4b33 |
def test_feature_selection_target_binary_features_binary(self, minimal_p_value_for_unsignificant_features, binary_feature, binary_target_not_related): <NEW_LINE> <INDENT> p_value = target_binary_feature_binary_test(binary_feature, binary_target_not_related) <NEW_LINE> assert minimal_p_value_for_unsignificant_features <... | Test if the p_value returned by target_binary_feature_binary_test is
large enough for highly unsignificant features. | 625941f224f1403a92601134 |
def read_csv(filename): <NEW_LINE> <INDENT> with open(filename, 'r') as csv_file: <NEW_LINE> <INDENT> csv_reader = csv.reader(csv_file) <NEW_LINE> for rows in csv_reader: <NEW_LINE> <INDENT> yield rows | ead csv file
:param filename:
:return: | 625941f22ae34c7f2600d704 |
def get_group_id(self): <NEW_LINE> <INDENT> return self.data.id | Get an ID of the group.
:return: a string with the ID | 625941f23eb6a72ae02ecac1 |
def findpeak(indata, ismax=False, interval=10, threshold=0.1, reverse=False): <NEW_LINE> <INDENT> indexs = [] <NEW_LINE> if reverse: <NEW_LINE> <INDENT> indata = -1*indata <NEW_LINE> indexs = [0,len(indata)-1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> indata = np.clip(indata, np.max(indata)*threshold, np.max(indata... | return:indexs | 625941f2e76e3b2f99f3add5 |
def update_matrix(self, flat_matrix, action, nox): <NEW_LINE> <INDENT> new_score = flat_matrix[0][ action ] + nox <NEW_LINE> flat_matrix[ 0, action ] = new_score <NEW_LINE> if new_score == 5: <NEW_LINE> <INDENT> self.score += 1 <NEW_LINE> self.reward += 1 <NEW_LINE> self.update_valid_actions( action ) <NEW_LINE> <DED... | based on action, nox, and current flat matrix, update for the next state | 625941f26aa9bd52df03737b |
def netstat(content): <NEW_LINE> <INDENT> result = [] <NEW_LINE> for line in content: <NEW_LINE> <INDENT> line_array = _remove_empty(line.split(' ')) <NEW_LINE> l_host, l_port = _convert_ip_port(line_array[1]) <NEW_LINE> r_host, r_port = _convert_ip_port(line_array[2]) <NEW_LINE> tcp_id = line_array[0] <NEW_LINE> state... | Esta funcion devuelve una lista de conexiones tcp de equipos linux | 625941f2566aa707497f4b34 |
def plot_bev(velo_array, label_list = None, map_height=800, window_name='GT'): <NEW_LINE> <INDENT> intensity = np.zeros((velo_array.shape[0], velo_array.shape[1], 3)) <NEW_LINE> val = 1 - velo_array[::-1, :, :-1].max(axis=2) <NEW_LINE> intensity[:, :, 0] = val <NEW_LINE> intensity[:, :, 1] = val <NEW_LINE> intensity[:,... | Plot a Birds Eye View Lidar and Bounding boxes (Using OpenCV!)
The heading of the vehicle is marked as a red line
(which connects front right and front left corner)
:param velo_array: a 2d velodyne points
:param label_list: a list of numpy arrays of shape [4, 2], which corresponds to the 4 corners' (x, y)
The corn... | 625941f25fc7496912cc3f51 |
def predict(self, x_predict): <NEW_LINE> <INDENT> assert x_predict.ndim == 1, '数据集必须得是一纬的' <NEW_LINE> assert self.a_ is not None and self.b_ is not None, 'must fit before predict!' <NEW_LINE> return np.array([self._predict(x) for x in x_predict]) | 给定待预测数据集,返回表示x_predict的结果向量
:param x_predict: 向量
:return: | 625941f23eb6a72ae02ecac2 |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, CampaignPushContent): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict() | Returns true if both objects are equal | 625941f2a219f33f34628f34 |
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> combined_kwargs = CAPABILITIES.copy() <NEW_LINE> combined_kwargs.update(kwargs) <NEW_LINE> NI_DAQmx.__init__(self, *args, **combined_kwargs) | Class for NI-USB-6343 | 625941f28e05c05ec3eea94d |
@pytest.mark.django_db <NEW_LINE> def test_notes_list_POST_201(rest_client, user, note): <NEW_LINE> <INDENT> rest_client.force_authenticate(user=user) <NEW_LINE> url = reverse('notes-list') <NEW_LINE> data = {} <NEW_LINE> data['owner'] = user.id <NEW_LINE> data['title'] = 'one' <NEW_LINE> data['note'] = 'two' <NEW_LINE... | note owner can post new note | 625941f226068e7796caf2bc |
def sanity_check(self): <NEW_LINE> <INDENT> pass | Allow subclasses to do sanity checking of arguments. | 625941f2cdde0d52a9e5360c |
def test_media_image_proxy(self): <NEW_LINE> <INDENT> fake_picture_data = 'test.test' <NEW_LINE> class MockResponse(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.status = 200 <NEW_LINE> self.headers = {'Content-Type': 'sometype'} <NEW_LINE> <DEDENT> @asyncio.coroutine <NEW_LINE> def read(self): <N... | Test the media server image proxy server . | 625941f2cc0a2c11143dd465 |
def runTest(self): <NEW_LINE> <INDENT> self._tester.go_to_admin("Logging") <NEW_LINE> tc.find('trac.log') <NEW_LINE> tc.formvalue('modlog', 'log_type', 'file') <NEW_LINE> tc.formvalue('modlog', 'log_file', 'trac.log2') <NEW_LINE> tc.formvalue('modlog', 'log_level', 'INFO') <NEW_LINE> tc.submit() <NEW_LINE> tc.find('sel... | Turn logging back on. | 625941f267a9b606de4a848a |
def response_add(self, request, obj, post_url_continue=None): <NEW_LINE> <INDENT> obj.save() <NEW_LINE> return super(ReverseModelAdmin, self).response_add(request,obj, post_url_continue=None) | The response_add() is overridden to save the main object. | 625941f2d4950a0f3b08c91a |
def remove_active_rel_pattern ( self, context ): <NEW_LINE> <INDENT> print ( "Call to: \"remove_active_rel_pattern\"" ) <NEW_LINE> if len(self.release_pattern_list) > 0: <NEW_LINE> <INDENT> pat = self.release_pattern_list[self.active_release_pattern_index] <NEW_LINE> if pat: <NEW_LINE> <INDENT> pat.remove_properties(co... | Remove the active release pattern from the list of release pattern | 625941f224f1403a92601135 |
def get_form(self, *args: List[str]): <NEW_LINE> <INDENT> for i in args: <NEW_LINE> <INDENT> if isinstance(i, Person): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif isinstance(i, Tense): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif isinstance(i, Number): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif isinst... | :param args:
:return: | 625941f2442bda511e8be9e3 |
def load_train_images(self): <NEW_LINE> <INDENT> return self.decode_idx3_ubyte(self.train_image_path) | TRAINING SET IMAGE FILE (train-images-idx3-ubyte):
[offset] [type] [value] [description]
0000 32 bit integer 0x00000803(2051) magic number
0004 32 bit integer 60000 number of images
0008 32 bit integer 28 number of rows
0012 32 bit integer 28 ... | 625941f2e8904600ed9f250b |
def export_hdf5(hdf5_filename, numpy_data): <NEW_LINE> <INDENT> hdf5_filename = os.path.expanduser(hdf5_filename) <NEW_LINE> if os.path.exists(hdf5_filename): <NEW_LINE> <INDENT> print("File {0} already exists, stopping...".format(hdf5_filename)) <NEW_LINE> return False <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> h = ... | Export a numpy array to a HDF5 file.
Arguments:
hdf5_filename: A filename to which to save the HDF5 data
numpy_data: The numpy array to save to HDF5
Returns:
String. The expanded filename that now holds the HDF5 data | 625941f2b5575c28eb68e5da |
def login(self, username: str, password: str, retries: int = 1) -> bool: <NEW_LINE> <INDENT> for _ in range(retries): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.ssh_client.connect( self.ssh_target, self.ssh_port, timeout=SSH_TIMEOUT, banner_timeout=SSH_TIMEOUT, username=username, password=password, look_for_keys... | Login to SSH server
:param str username: SSH account username
:param str password: SSH account password
:param int retries: number of login retries
:return bool: True if login was successful, False otherwise | 625941f257b8e32f52483a73 |
def remove_user_from_group(self, user_name, group_name): <NEW_LINE> <INDENT> res = self.__make_ocs_request( 'DELETE', self.OCS_SERVICE_CLOUD, 'users/' + user_name + '/groups', data={'groupid': group_name} ) <NEW_LINE> if res.status_code == 200: <NEW_LINE> <INDENT> tree = ET.fromstring(res.text) <NEW_LINE> self.__check_... | Removes a user from a group.
:param user_name: name of user to be removed
:param group_name: name of group user is to be removed from
:returns: True if user removed
:raises: ResponseError in case an HTTP error status was returned | 625941f2f548e778e58cdb54 |
def __init__(self, x, y, mass, step_mean, diversion, angle, meta): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.age = 0 <NEW_LINE> self.mass = mass <NEW_LINE> self.metabolic_cost = (0.14 * self.mass ** 0.751) * (3600 - 150) <NEW_LINE> self.time_move = 150 <NEW_LINE> self.velocity = 0.30 * self.m... | initialisation | 625941f20a366e3fb873edf4 |
def load_input(file): <NEW_LINE> <INDENT> with open(file, "r") as f: <NEW_LINE> <INDENT> lines = f.readlines() <NEW_LINE> <DEDENT> raw = [line.split() for line in lines] <NEW_LINE> inputs = [] <NEW_LINE> for record in raw: <NEW_LINE> <INDENT> min, max = [int(n) for n in record[0].split("-")] <NEW_LINE> letter = record[... | Load input into named tuple
(min, max, letter, password) | 625941f2fbf16365ca6f67a5 |
def get_user_permissions(self, user, vhost=None, ssl_auth=None): <NEW_LINE> <INDENT> ssl_auth = ssl_auth if ssl_auth is not None else self.is_ssl <NEW_LINE> vhost = vhost if vhost else self.rmq_config.virtual_host <NEW_LINE> url = '/api/permissions/{vhost}/{user}'.format(vhost=vhost, user=user) <NEW_LINE> try: <NEW_LIN... | Get permissions (configure, read, write) for the user
:param user: user
:param password: password
:param vhost: virtual host
:param ssl_auth: Flag for SSL connection
:return: | 625941f2dc8b845886cb5b0b |
def check_item(self, row_num, col_num): <NEW_LINE> <INDENT> if self._maze[row_num][col_num] not in [' ','P','E','x']: <NEW_LINE> <INDENT> p_idx = self.find_player_idx() <NEW_LINE> [pr_idx, pc_idx] =p_idx <NEW_LINE> self._maze[pr_idx][pc_idx] =' ' <NEW_LINE> self.player.pickup_item(self._maze[row_num][col_num]) <NEW_LIN... | Using row_num and col_num as arguemnts, checks if the player
is touching the item. If the item is touch the player, the player
will pick up the item.
Args:
row_num(int): The x-coordinate
col_num(int): The y-coordinate
Return:
backpack(list): Stores items | 625941f229b78933be1e5c79 |
def __init__(self): <NEW_LINE> <INDENT> self.head = None <NEW_LINE> self.tail = None | in new list there must be head = tail = None | 625941f2435de62698dfe221 |
def abort(): <NEW_LINE> <INDENT> pass | Abort the job.
| 625941f2925a0f43d254a451 |
def list_files(files): <NEW_LINE> <INDENT> to_delete = list() <NEW_LINE> for file_ in files: <NEW_LINE> <INDENT> if file_.find(".txt") != -1: <NEW_LINE> <INDENT> if file_.find("_") != -1: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> to_delete.append(file_) <NEW_LINE> <DEDENT> <DEDENT> else: <N... | Creates the List of Files needed | 625941f2a8370b7717052e71 |
def test_user_language_preference_fr_from_en_it_from_fr_fr_entry( admin_user, langstring_body, test_adminuser_webrequest, user_language_preference_fr_mtfrom_en, user_language_preference_it_mtfrom_fr, it_from_fr_langstring_entry, langstring_entry_values, en_from_fr_locale, test_session, it_from_fr_locale): <NEW_LINE> <I... | Body: fr, it-x-mtfrom-fr, en-x-mtfrom-fr
User Language Preference: {en-to-fr: explicit, fr-to-it}
Expect: fr-x-mtfrom-en | 625941f232920d7e50b287a9 |
def render(self, name, value, attrs=None): <NEW_LINE> <INDENT> return render_to_string("forms/widgets/checkbox_input.html", { "label": self.label, "field": self.field, "rendered_checkbox": super(CheckboxInput, self).render( name, value, attrs) }) | Render the CheckboxInput. | 625941f226238365f5f0f44a |
def __init__(self): <NEW_LINE> <INDENT> self.content_type = CONTENT_TYPE <NEW_LINE> self.root = ROOT <NEW_LINE> self.headers_obj = HmcHeaders.HmcHeaders("uom") | initializes root and content-type | 625941f2627d3e7fe0d69426 |
def configuration_job_properties_values_create(self, id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('callback'): <NEW_LINE> <INDENT> return self.configuration_job_properties_values_create_with_http_info(id, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (dat... | Create a job property value
Creates a job property value.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.confi... | 625941f2d53ae8145f87a838 |
def assert_not_almost_equal(first, second, places=None, msg=None, delta=None, extras=None): <NEW_LINE> <INDENT> _call_unittest_assertion(_pyunit_proxy.assertNotAlmostEqual, first, second, places=places, msg=msg, delta=delta, extras=extras) | Asserts that first is not almost equal to second.
Args:
first: The first value to compare.
second: The second value to compare.
places: How many decimal places to take into account for comparison.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most ... | 625941f2009cb60464c63981 |
def test_get_row_index(self): <NEW_LINE> <INDENT> source = ListSource( data=[ ('first', 111), ('second', 222), ('third', 333), ], accessors=['val1', 'val2'] ) <NEW_LINE> for i, row in enumerate(source): <NEW_LINE> <INDENT> self.assertEqual(i, source.index(row)) <NEW_LINE> <DEDENT> with self.assertRaises(ValueError): <N... | You can get the index of any row within a list source | 625941f21f5feb6acb0c511d |
def register_models(self, app_label, *models): <NEW_LINE> <INDENT> for model in models: <NEW_LINE> <INDENT> model_name = model._meta.object_name.lower() <NEW_LINE> model_dict = self.app_models.setdefault(app_label, SortedDict()) <NEW_LINE> if model_name in model_dict: <NEW_LINE> <INDENT> fname1 = os.path.abspath(upath(... | Register a set of models as belonging to an app. | 625941f2d10714528d6002bf |
def test_cli_missing_field(svl_script_template): <NEW_LINE> <INDENT> completed = subprocess.run( ["svl", svl_script_template("invalid_plot_field.svl"), "--no-browser"], check=False, stdout=subprocess.PIPE, ) <NEW_LINE> assert completed.returncode == 1 <NEW_LINE> assert "Data processing error:" in completed.stdout.decod... | Tests that the command line interface correctly exits 1 with the proper
error message when a script has a plot with an invalid field. | 625941f26fb2d068a760f67b |
def change_rate(filename, ratio): <NEW_LINE> <INDENT> sample_rate, data = sc_wav.read(filename) <NEW_LINE> sample_rate *= ratio <NEW_LINE> sc_wav.write(CHANGE_RATE_FILE_NAME, int(sample_rate), data) | This function changes the duration of an audio file by keeping the same samples,
but changing the sample rate written in the file header. The new audio file will
be saved in a new file called change_rate.wav
:param filename: a string representing the path to a WAV file
:param ratio: a positive float64 representing the ... | 625941f25510c4643540f9a9 |
def step(self, vars, target): <NEW_LINE> <INDENT> batch_size, vars_size = vars.shape <NEW_LINE> vars_pos_concat = [] <NEW_LINE> vars_neg_concat = [] <NEW_LINE> epsilon_concat = [] <NEW_LINE> for _ in range(self.num_samples): <NEW_LINE> <INDENT> epsilon = self.vanilla_sample(batch_size, vars_size) <NEW_LINE> epsilon = e... | :param epoch: number of current iteration
:param vars: variables to be optimized
:param target: the target function w.r.t vars to be minimized
:param verbal: whether to output debug strings
:return: estimated grad | 625941f23d592f4c4ed1d631 |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, PreviewFile): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ | Returns true if both objects are equal | 625941f2c4546d3d9de7300e |
@show.command() <NEW_LINE> @click.argument( 'directory', type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True), default=None, required=False ) <NEW_LINE> @click.option( '--token', '-t', show_envvar=True, type=click.STRING, default=None, help="Specify the git provider access token that will be used ... | Command that will retrieve the project repository information from the projects configured GIT repository. | 625941f28a43f66fc4b54633 |
def test_one_left_merge(check_ranges, accounts, nft): <NEW_LINE> <INDENT> nft.transferRange(accounts[4], 1, 5000, {"from": accounts[1]}) <NEW_LINE> nft.transferRange(accounts[1], 10001, 10002, {"from": accounts[2]}) <NEW_LINE> check_ranges([(5000, 10002)], [(10002, 20001)], [(20001, 30001)], [(1, 5000)]) | one nft, touch left, merge | 625941f221bff66bcd684f21 |
def wait_to_load_loading_indicator(driver): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> loading_element = driver.find_elements_by_class_name("spanLoadingText") <NEW_LINE> for item in loading_element: <NEW_LINE> <INDENT> if item.is_displayed(): <NEW_LINE> <INDENT> if ite... | Wait to load an element | 625941f23346ee7daa2b3346 |
def test_non_mutation_2d(): <NEW_LINE> <INDENT> x = np.array( [ [ True, False, True, True, ], [ False, True, True, True, ], [ False, True, True, True, ], [ True, True, True, True, ], [ False, True, True, True, ],], dtype=bool) <NEW_LINE> compare_scipy_edt(x) | This example helped debug the error
caused by reading/writing to the same array. | 625941f2460517430c394749 |
def _get_broadcast_items(self, ids, include_archived_repo=False): <NEW_LINE> <INDENT> query = { 'query': { 'filtered': { 'filter': { 'bool': { 'must': {'term': {'genre.name': BROADCAST_GENRE}}, 'should': [ {'terms': {'broadcast.master_id': ids}}, {'terms': {'broadcast.takes_package_id': ids}} ] } } } } } <NEW_LINE> req... | Get the broadcast items for the master_id and takes_package_id
:param list ids: list of item ids
:param include_archived_repo True if archived repo needs to be included in search, default is False
:return list: list of broadcast items | 625941f256ac1b37e6264798 |
def is_readable(self): <NEW_LINE> <INDENT> return self._socket is not None and not self._eof and ( self._state in ("connected", "closing") or self._state == "tls-handshake" and self._tls_state == "want_read") | :Return: `True` when the I/O channel can be read | 625941f2be8e80087fb2120c |
def data_to_send_ex(self, domain): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> data = self.data_to_send(domain) <NEW_LINE> if data is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not len(data): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> for output_config in self.config['output']: <NEW_LINE> <INDENT> source_i... | Redefine this for a low level control of data you want to generate
to send to other domains
Should return:
[
[source_id, binary_data],
...
] | 625941f215fb5d323cde10ed |
def test_rm_user_not_in_grp(self): <NEW_LINE> <INDENT> usrmgr = self.__get_dummy_object() <NEW_LINE> config = {"foogroup": {"unverified": ["@foouser"]}} <NEW_LINE> self.__set_config(usrmgr, config) <NEW_LINE> with patch.object(usrmgr, "_UserManager__load_config"), patch.object(usrmgr, "_UserManager__save... | Test rm user if the user is not in passed group | 625941f24a966d76dd5515ea |
def today(self): <NEW_LINE> <INDENT> self.get_query_set().today() | A proxy method for the extra ``today`` method that is provided by the
``EmotionQuerySet`` subclass. | 625941f25fcc89381b1e1c99 |
def render_header(self): <NEW_LINE> <INDENT> return JoinedCell(*[c.render_header() for c in self.columns], tablesep=self.options.get("tablesep", " ")) | Returns a Cell formed by joining all the column headers. | 625941f2090684286d50f2c4 |
def stop_horizontal_move(self): <NEW_LINE> <INDENT> self.change_x = 0 <NEW_LINE> if not self.isShooting: <NEW_LINE> <INDENT> if self.change_y < 0: <NEW_LINE> <INDENT> self.direction = "U" <NEW_LINE> <DEDENT> if self.change_y > 0: <NEW_LINE> <INDENT> self.direction = "D" | Called when user lets off the keyboard | 625941f2a4f1c619b28b05ff |
def connect(mei_fd): <NEW_LINE> <INDENT> return mei.connect(mei_fd, UUID) | Connect to dynamic MKHI client | 625941f25fc7496912cc3f52 |
def check_authorization(predicate, environ): <NEW_LINE> <INDENT> msg = 'repoze.what.authorize is deprecated for forward compatibility ' 'with repoze.what v2; use ' 'Predicate.check_authorization(environ) instead' <NEW_LINE> warn(msg, DeprecationWarning, stacklevel=2) <NEW_LINE> if predicate is not Non... | Verify if the current user really can access the requested source.
:param predicate: The predicate to be evaluated.
:param environ: The WSGI environment.
:raise NotAuthorizedError: If it the predicate is not met.
.. deprecated:: 1.0.4
Use :meth:`repoze.what.predicates.Predicate.check_authorization`
instead.
... | 625941f2ec188e330fd5ad67 |
@pytest.mark.parametrize( "use_colors, expected", [ pytest.param(None, None, id="use_colors_not_provided"), pytest.param("invalid", None, id="use_colors_invalid_value"), pytest.param(True, True, id="use_colors_enabled"), pytest.param(False, False, id="use_colors_disabled"), ], ) <NEW_LINE> def test_log_config_default( ... | Test that one can specify the use_colors option when using the default logging
config. | 625941f230c21e258bdfaa79 |
def __init__(self, *args): <NEW_LINE> <INDENT> this = _gsm.new_gsm_burst_ff_sptr(*args) <NEW_LINE> try: self.this.append(this) <NEW_LINE> except: self.this = this | __init__(self) -> gsm_burst_ff_sptr
__init__(self, p) -> gsm_burst_ff_sptr | 625941f226238365f5f0f44b |
def to_data(self): <NEW_LINE> <INDENT> return self.data | Return the data dict that represents the mesh, and from which it can
be reconstructed. | 625941f27cff6e4e81117f5a |
def poly_energies(samples_like: SamplesLike, poly: Union[Polynomial, BinaryPolynomial]) -> np.ndarray: <NEW_LINE> <INDENT> return BinaryPolynomial(poly, 'SPIN').energies(samples_like) | Calculates energy of samples from a higher order polynomial.
Args:
samples_like:
A collection of raw samples. `samples-like` is an extension of
NumPy's array_like structure. See :func:`.as_samples`.
poly:
Either a polynomial, as a dict of form `{term: bias, ...}`, where `term`
... | 625941f2d6c5a10208144624 |
def set_scan_direction(self, value): <NEW_LINE> <INDENT> core.las.LASPoint_SetScanDirection(self.handle, value) | Sets the scan direction as an integer for the point | 625941f223849d37ff7b365f |
def GetParams(self, manager, proto): <NEW_LINE> <INDENT> params = {} <NEW_LINE> config = self.services[manager]["protos"][proto] <NEW_LINE> for key, val in config.iteritems(): <NEW_LINE> <INDENT> if not key.startswith('param-'): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> name = key[len('param-'):] <NEW_LINE> valu... | Returns a dict of paramters for the given proto on the given manager.
The keys will be the parameters names, and the values a tuple of (dbus
type, default value, flags). If no default value is specified, the
second item in the tuple will be None. | 625941f2fb3f5b602dac3c6f |
def on_about_application_button_clicked(self, about_application_button): <NEW_LINE> <INDENT> self.main_window_handlers.show_about_dialog() | Shows the about Render Watch dialog.
:param about_application_button: Button that emitted the signal. | 625941f238b623060ff0b3c2 |
def rename_user(self, name: str): <NEW_LINE> <INDENT> logger.info('Called rename_user()') <NEW_LINE> logger.debug('GET on /profile to get user\'s ID') <NEW_LINE> r = requests.get('https://trackobot.com/profile', auth=self._auth) <NEW_LINE> user_id = r.text.split('edit_user_',1)[1].split('"')[0] <NEW_LINE> logger.debug(... | Rename your user to something else.
:param str name: The new display name
:return: None | 625941f28da39b475bd65551 |
def monspecConvertEntityType(monspecType): <NEW_LINE> <INDENT> entityTypes = ["app","srv","pg","host","pgi"] <NEW_LINE> entityTypesAlternative = ["APPLICATION", "SERVICE", "PROCESS_GROUP", "HOST", "PROCESS_GROUP_INSTANCE"] <NEW_LINE> return entityTypes[operator.indexOf(entityTypesAlternative, monspecType)] | converts things like SERVICE into srv to be used when calling the commmand line options of dtcli | 625941f27d43ff24873a327a |
def test_oscan_amp_stack_sum(): <NEW_LINE> <INDENT> task = bias.OscanAmpStackSummaryTask() <NEW_LINE> if RUN_TASKS: <NEW_LINE> <INDENT> task.run(**SUMMARY_OPTIONS) | Test the OscanAmpStackSummaryTask | 625941f2c432627299f0521f |
def set_test_params(self): <NEW_LINE> <INDENT> self.setup_clean_chain = True <NEW_LINE> self.num_nodes = 1 <NEW_LINE> self.extra_args = [['-staking=1', '-debug=net', '-zulgstake']] * self.num_nodes | Setup test environment
:param:
:return: | 625941f20383005118ecfbb5 |
def count(self, time_val): <NEW_LINE> <INDENT> if np.isscalar(time_val): <NEW_LINE> <INDENT> return sum(1 for x in self.trajectories if x.is_alive(time_val)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> temp = np.zeros(np.shape(time_val)) <NEW_LINE> for index in np.ndindex(np.shape(time_val)): <NEW_LINE> <INDENT> temp... | Count of particles alive at time_val. Can take numpy vec input. | 625941f23617ad0b5ed684cb |
def _create_dialog(self): <NEW_LINE> <INDENT> title = _("%(title)s - Gramps") % {'title': _("Edit Tags")} <NEW_LINE> top = Gtk.Dialog(title) <NEW_LINE> top.set_default_size(360, 400) <NEW_LINE> top.set_modal(True) <NEW_LINE> top.vbox.set_spacing(5) <NEW_LINE> columns = [('', -1, 300), (' ', -1, 25, TOGGLE, True, None),... | Create a dialog box to select tags. | 625941f22ae34c7f2600d705 |
def _indent(text): <NEW_LINE> <INDENT> return "\n".join( "\t" + line for line in text.splitlines() ) | Returns text with a tab inserted in the front of each line. | 625941f2009cb60464c63982 |
def print_to_N(): <NEW_LINE> <INDENT> n = int(input('Enter value: ')) <NEW_LINE> for i in range(0, n): <NEW_LINE> <INDENT> print('Hello world') | Write a program that prints on the console the numbers from 1 to N.
The number N should be read from the standard input.
:return: | 625941f2a05bb46b383ecdf1 |
def input_supplier(self, supplier): <NEW_LINE> <INDENT> self.send_keys(self.supplier_loc, supplier) | 输入重要供应商 | 625941f2187af65679ca56f5 |
def about_qt(self, output): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> subprocess.call( 'python {}/core/UI/qt.py'.format(os.getcwd()), shell=True) <NEW_LINE> output.append("Open About Qt") <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> output.append(str(e)) | Getting the path of the current directory then
run qt.py in 'core/UI/qt.py' | 625941f2796e427e537b0ba0 |
def make_and_add_summaries(summary_writer, tags_and_values, step): <NEW_LINE> <INDENT> for tag_value in tags_and_values: <NEW_LINE> <INDENT> tag, value = tag_value <NEW_LINE> summary_str = make_summary(tag, float(value)) <NEW_LINE> summary_writer.add_summary(summary_str, global_step=step) | Make multiple summaries and add them to the writer. | 625941f2a8ecb033257d36a0 |
def getItemByLikeName(self,itemname,up,down,quality,type,ziduan,guize,page,counts,characterid=0): <NEW_LINE> <INDENT> flist,count=dbconsignment.getItemByLikeItemName(itemname, up, down, quality, type, ziduan, guize, page, counts, characterid) <NEW_LINE> if not flist: <NEW_LINE> <INDENT> return {'data':None,'count':0} <... | 搜索寄卖物品 (模糊查询)
@param itemname: int 物品名称 模糊查询
@param up: int 物品等级上限 最大90 最小1
@param down: int 物品等级下限 最大90 最小1
@param quality: int 物品品质 1灰 2白 3绿 4蓝 5紫 6橙 7红
@param type: int 物品类型
@param ziduan: string 排序字段 name,levelRequire,addtime,price
@param guize: int 排序规则 1正序 2倒序
@param page: int 当前页数
@param counts: int 每页... | 625941f215baa723493c4550 |
def scale_union_of_intervals( ranges: sympy.Union, scalar: Union[int, float] ) -> sympy.Union: <NEW_LINE> <INDENT> scaled_intervals = [ scale_interval(interval=interval, scalar=scalar) for interval in ranges.args ] <NEW_LINE> return sympy.Union(*scaled_intervals) | Scale up union of several intervals by multiplying by a scalar.
Used for converting the units of a UnitRange. | 625941f25510c4643540f9aa |
def __str__(self): <NEW_LINE> <INDENT> return '{} Labour Breakdown'.format(self.labour.full_title) | Returns string repsentation of the LabourBreakdown model | 625941f2627d3e7fe0d69427 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.