code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def filter_image_files(file_list): <NEW_LINE> <INDENT> return [f for f in file_list if is_image(f)]
filters and keeps only image files
625941e776d4e153a657ef91
def create_short_link(response_short_link): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> short_link = response_short_link.json()['link'] <NEW_LINE> return short_link <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return
It creates short link.
625941e7b545ff76a8914273
def post_list(request): <NEW_LINE> <INDENT> posts = Post.objects.filter(published_date__lte=timezone.now() ).order_by('-published_date') <NEW_LINE> postsOrdered = Post.objects.filter(published_date__lte=timezone.now() ).order_by('-views') <NEW_LINE> top5 = [] <NEW_LINE> for post in postsOrdered: <NEW_LINE> <INDENT> top...
Create a view that will return a list of Posts that were published prior to'now' and render them to the 'blogposts.html' template
625941e7a4f1c619b28b048d
def test_can_drag_icon_below_bfb(self): <NEW_LINE> <INDENT> self.ensure_calc_icon_not_in_launcher() <NEW_LINE> calc = self.process_manager.start_app("Calculator") <NEW_LINE> calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) <NEW_LINE> bfb_icon = self.unity.launcher.model.get_bfb_icon() <NEW_L...
Application icons must be draggable to below the BFB.
625941e7cdde0d52a9e53494
def list(self, stack_id): <NEW_LINE> <INDENT> url = '/stacks/%s/resources' % stack_id <NEW_LINE> return self._list(url, "resources")
Get a list of resources. :rtype: list of :class:`Resource`
625941e7a8ecb033257d352a
def _get_p_label(self, s): <NEW_LINE> <INDENT> return ['p' + s]
return self._p_label with additional string `s`.
625941e79f2886367277ace8
@define_command("caret-browsing-backward-word") <NEW_LINE> def left_word(ctx): <NEW_LINE> <INDENT> call_js(ctx, "CaretBrowsing.move('backward', 'word');")
Move the caret one word backward.
625941e782261d6c526ab904
def __call__(self, query, key, value, mask=None): <NEW_LINE> <INDENT> if mask is not None: <NEW_LINE> <INDENT> mask = mask[:, self.xp.newaxis, ...] <NEW_LINE> <DEDENT> batch_size = len(query) <NEW_LINE> query, key, value = [self.project(linear, x, batch_size) for linear, x in zip(self.linears, (query, key, value))] <NE...
Perform attention on the value array, using the query and key parameters for calculating the attention mask. :param query: matrix of shape (batch_size, num_timesteps, transformer_size) that is used for attention mask calculation :param key: matrix of shape (batch_size, num_timesteps, transformer_size) that is used for ...
625941e7fbf16365ca6f662b
def mutate(self, chromosome_to_call, bit_to_flip): <NEW_LINE> <INDENT> if self.full[chromosome_to_call][bit_to_flip] == 0: <NEW_LINE> <INDENT> self.full[chromosome_to_call][bit_to_flip] = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.full[chromosome_to_call][bit_to_flip] = 0
Flips a bit to its opposite. Will not determine randomness of procedure
625941e7e8904600ed9f2392
def CopelandWinner(profile, alpha=0.5): <NEW_LINE> <INDENT> elecType = profile.getElecType() <NEW_LINE> if elecType != "soc" and elecType != "toc": <NEW_LINE> <INDENT> print("ERROR: unsupported profile type") <NEW_LINE> exit() <NEW_LINE> <DEDENT> copelandscores = getCopelandScores(profile, alpha) <NEW_LINE> winner = ma...
Returns an integer that represents the winning candidate given an election profile. Tie-breaking rule: numerically increasing order :ivar Profile profile: A Profile object that represents an election profile.
625941e7090684286d50f14a
def configure_system(layout_mode, run_mode, manager_path): <NEW_LINE> <INDENT> os.environ["COLONY_LAYOUT_MODE"] = layout_mode <NEW_LINE> os.environ["COLONY_RUN_MODE"] = run_mode <NEW_LINE> os.environ["COLONY_HOME"] = manager_path <NEW_LINE> library_path = manager_path + "/colony/libs" <NEW_LINE> library_path = os.path....
Configures the system for the given attributes. :type layout_mode: String :param layout_mode: The layout mode to configure the system. :type run_mode: String :param run_mode: The run mode to configure the system. :type manager_path: String :param manager_path: The manager path to configure the system.
625941e760cbc95b062c69a2
def scrape_sports_reference(): <NEW_LINE> <INDENT> scraper = Scraper(use_VPN=False, encoding='utf-8', crawl_delay=3) <NEW_LINE> start_date = datetime.datetime(year=2017, month=1, day=1) <NEW_LINE> end_date = datetime.datetime.now() <NEW_LINE> date = deepcopy(start_date) <NEW_LINE> one_day = datetime.timedelta(days=1) <...
Scrape gamesheets and boxscores from sports-reference. Specify date range with while loop. Sample gamesheet: http://www.sports-reference.com/cbb/boxscores/index.cgi?month=02&day=03&year=2017 Sample boxscore: http://www.sports-reference.com/cbb/boxscores/2017-02-03-ball-state.html Box scores are linked via t...
625941e7596a897236089f19
def activate(self): <NEW_LINE> <INDENT> self.isActive = 1 <NEW_LINE> self.createTime = self.model.schedule.steps <NEW_LINE> self.dueTime = self.batchCreateTime + self.qosRequired <NEW_LINE> self.estimFinishTime = self.dueTime <NEW_LINE> self.competitorEnv = self.model.rsu[self.rsu].nrActiveBids <NEW_LINE> self.updateRe...
helper function called from Vehicle._activateBids in Vehicle.step
625941e75fdd1c0f98dc0694
def sublattice(base): <NEW_LINE> <INDENT> n = base.ndim <NEW_LINE> row,dat = [],[] <NEW_LINE> for i in range(len(base.SUBS)): <NEW_LINE> <INDENT> row.append(i) <NEW_LINE> dat.append(base.SUBS[i]) <NEW_LINE> <DEDENT> return csc_matrix((dat,(row,row)),shape=(n,n))
This function returns a matrix with 1's in the sublattice "sublattice" positions
625941e716aa5153ce3628d6
def init2( self, input_tube, output_tubes, num_workers, disable_result, do_stop_task, ): <NEW_LINE> <INDENT> super(UnorderedWorker, self).__init__() <NEW_LINE> self._tube_task_input = input_tube <NEW_LINE> self._tubes_result_output = output_tubes <NEW_LINE> self._num_workers = num_workers <NEW_LINE> self._disable_resul...
Create *num_workers* worker objects with *input_tube* and an iterable of *output_tubes*. The worker reads a task from *input_tube* and writes the result to *output_tubes*.
625941e782261d6c526ab905
def freq_units(units): <NEW_LINE> <INDENT> d = {"thz": FreqUnits(1, "THz"), "ev": FreqUnits(const.value("hertz-electron volt relationship") * const.tera, "eV"), "mev": FreqUnits(const.value("hertz-electron volt relationship") * const.tera / const.milli, "meV"), "ha": FreqUnits(const.value("hertz-hartree relationship") ...
Returns conversion factor from THz to the requred units and the label in the form of a namedtuple Accepted values: thz, ev, mev, ha, cm-1, cm^-1
625941e7377c676e91272605
def determine_differences(self): <NEW_LINE> <INDENT> self.difference = self.blocked_stats['median'] - self.median <NEW_LINE> self.conf_bl = self.blocked_stats['high'] - self.blocked_stats['low'] <NEW_LINE> self.diff_ci_hi = self.blocked_stats['high'] - self.median <NEW_LINE> self.conf_unbl = np.max(self.unblocked_stats...
Prep work for determining the corrections ... Figure out first the differences!
625941e7e64d504609d74c9e
def _hill_compare(a, b): <NEW_LINE> <INDENT> if a.symbol == b.symbol: <NEW_LINE> <INDENT> a = a.isotope if isisotope(a) else 0 <NEW_LINE> b = b.isotope if isisotope(b) else 0 <NEW_LINE> return cmp(a, b) <NEW_LINE> <DEDENT> elif a.symbol in ("C", "H"): <NEW_LINE> <INDENT> if b.symbol in ("C", "H"): <NEW_LINE> <INDENT> r...
Compare elements in standard order.
625941e74428ac0f6e5bac54
def __str__(self): <NEW_LINE> <INDENT> return ''.join(self.description)
String representing the object. :returns: a string describing the Exception :rtype: str
625941e763f4b57ef000156b
def delete_by_index(user_defined_list): <NEW_LINE> <INDENT> del user_defined_list[0] <NEW_LINE> del user_defined_list[3] <NEW_LINE> del user_defined_list[3] <NEW_LINE> return user_defined_list
Description: this function is define for delete specific index element Parameter: user_defined_list (list) : user defined list Return: user_defined_list (list) : list after delete element
625941e7046cf37aa974d1a2
def get_data_loader_mask_and_im_and_rect( file_list, mask_list, rect_list, batch_size, train, new_size=None, height=256, width=256, num_workers=4, crop=True, ): <NEW_LINE> <INDENT> dataset = MyDatasetRect(file_list, mask_list, rect_list, new_size, height, width) <NEW_LINE> loader = DataLoader( dataset=dataset, batch_si...
Masks and images lists-based data loader with transformations (horizontal flip, resizing, random crop, normalization are handled) Arguments: file_list {str list} -- list of images filenames mask_list {str list} -- list of masks filenames batch_size {int} -- batch size train {bool} -- training Keyword ...
625941e7498bea3a759b9f0c
@login_required <NEW_LINE> def delete_donation(request, donation_id): <NEW_LINE> <INDENT> to_delete = Donation.objects.get(id=donation_id) <NEW_LINE> donor_id = to_delete.donor.id <NEW_LINE> to_delete.delete() <NEW_LINE> return redirect("edit-donor", donor_id=donor_id)
Deletes a donation from the database Keyword arguments: donation_id -- The primary key of the donation to delete Returns a view of a page used to edit the donor
625941e7bde94217f368324b
def test_create_component_with_car(): <NEW_LINE> <INDENT> car, component = create_component_with_car() <NEW_LINE> assert version_uuid(component.uid)
Создание машины, а затем компонента с привязкой к этой машине.
625941e78c0ade5d55d3ee1d
def get_host_port_db(address): <NEW_LINE> <INDENT> host = port = dbname = None <NEW_LINE> if '/' in address: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> host, dbname = address.split('/') <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> error('Invalid address "%s"' % address, EFAULT) <NEW_LINE> <DEDENT> else:...
:param address: the address, possible values are: foo foo database on local machine (IPv4 connection) 192.169.0.5/foo foo database on 192.168.0.5 machine 192.169.0.5:9999/foo foo database on 192.168.0.5 machine on port 9999 "[::1]:9999/foo" foo database on ::1 machine on po...
625941e7cc40096d61595dad
def list_files(bucketName): <NEW_LINE> <INDENT> files = bucket.list_blobs() <NEW_LINE> fileList = [file.name for file in files if '.' in file.name] <NEW_LINE> return fileList
List all files in GCP bucket.
625941e75e10d32532c5f384
def Createdumpwindow(*args): <NEW_LINE> <INDENT> return _ollyapi2.Createdumpwindow(*args)
Createdumpwindow(wchar_t * title, ulong base, ulong size, wchar_t * path, ulong dumptype, ulong sel0, ulong sel1, wchar_t * strname) -> HWND
625941e7b830903b967e9d65
def initialise_datasets(self, date_object, user_id, status): <NEW_LINE> <INDENT> if status != '200': <NEW_LINE> <INDENT> self.__init_list_or_append( self.total_errors_by_date, date_object, user_id) <NEW_LINE> self.__init_list_or_append( self.total_errors_by_user, user_id, date_object) <NEW_LINE> <DEDENT> self.__init_li...
Initialies the data sets based on th date objects, user id and status. The following objects are initialised: 1. total number of requests per a given date 2. total number of requests per user 3. total number of error requests per a given date 4. total number of error requests per user id Args: date_object: date ...
625941e78e71fb1e9831dc06
def test_distaz(self): <NEW_LINE> <INDENT> client = Client() <NEW_LINE> result = client.distaz(stalat=1.1, stalon=1.2, evtlat=3.2, evtlon=1.4) <NEW_LINE> self.assertAlmostEqual(result['distance'], 2.09554) <NEW_LINE> self.assertAlmostEqual(result['backazimuth'], 5.46946) <NEW_LINE> self.assertAlmostEqual(result['azimut...
Tests distance and azimuth calculation between two points on a sphere.
625941e723e79379d52ee9bd
def close_camera_feed(self) -> None: <NEW_LINE> <INDENT> if self._camera_feed_task: <NEW_LINE> <INDENT> self._enabled = False <NEW_LINE> self._camera_feed_task.cancel() <NEW_LINE> future = self.conn.run_coroutine(self._camera_feed_task) <NEW_LINE> future.result() <NEW_LINE> self._camera_feed_task = None
Cancel camera feed task.
625941e7bf627c535bc1362e
def __init__(self, port): <NEW_LINE> <INDENT> super().__init__(port) <NEW_LINE> super().initialize() <NEW_LINE> print(self.idn()) <NEW_LINE> self.TIMEOUT = 20 <NEW_LINE> V = Q_(1, 'V') <NEW_LINE> Hz = Q_(1, 'Hz') <NEW_LINE> self.func = 'SIN' <NEW_LINE> self.freq = 550e3 * Hz <NEW_LINE> self.ampl = 5 * V <NEW_LINE> self...
initialization of the class
625941e716aa5153ce3628d7
def form_omega_mat_general(omega,chi,wedge): <NEW_LINE> <INDENT> phi_x = n.array([[1, 0 , 0 ], [0, n.cos(chi), -n.sin(chi)], [0, n.sin(chi), n.cos(chi)]]) <NEW_LINE> phi_y = n.array([[ n.cos(wedge), 0, n.sin(wedge)], [0 , 1, 0 ], [-n.sin(wedge), 0, n.cos(wedge)]]) <NEW_LINE> Om = form...
Calc Omega rotation matrix having an omega angle of "omega" INPUT: omega,chi and wedge (in radians) OUTPUT: Omega rotation matrix
625941e73539df3088e2e7aa
def get_manager(self): <NEW_LINE> <INDENT> if self._plugin is None: <NEW_LINE> <INDENT> raise bliss.saga.Exception(bliss.saga.Error.NoSuccess, "Object not bound to a plugin") <NEW_LINE> <DEDENT> return self._plugin.storage_resource_get_manager(self)
Return the associated resource manager object. The returned manager is the one which created or reconnected to the resource:: # obtain a handle to a suitable resource and print it's id rm1 = saga.resource.Manager(url) sr = rm.create_storage(sd) rm2 = sr.get_manager() assert(rm1 == rm2)
625941e7bde94217f368324c
def Arc_Len_C3V(vec1, vec2): <NEW_LINE> <INDENT> c_theta = Dot_C3V(vec1, vec2) <NEW_LINE> s_theta_vec = [0.0, 0.0, 0.0] <NEW_LINE> Cross_C3V(vec1, vec2, s_theta_vec) <NEW_LINE> s_theta = Hypot_C3V(s_theta_vec) <NEW_LINE> theta = arctan2(s_theta, c_theta) <NEW_LINE> return theta
Computes the arc length of the great circle connecting unit vectors vec1 and vec2.
625941e7236d856c2ad44c3f
def try_to_fix_boundary_cell(self,bad_cell,bdry_points,verbose=False): <NEW_LINE> <INDENT> for bdry_point in bdry_points: <NEW_LINE> <INDENT> n_cells = len( self.pnt2cells(bdry_point) ) <NEW_LINE> angle = self.boundary_angle(bdry_point) <NEW_LINE> if verbose: <NEW_LINE> <INDENT> print("Angle at boundary point %i is %g"...
look for ways to fix a boundary cell with a bad angle.
625941e7f9cc0f698b140a56
def selecting_a_representative_for_an_interval(begin, end, the_set): <NEW_LINE> <INDENT> save_tuple = None <NEW_LINE> the_min = float('inf') <NEW_LINE> for t in the_set: <NEW_LINE> <INDENT> if begin <= t[0] <= end: <NEW_LINE> <INDENT> if t[1] < the_min: <NEW_LINE> <INDENT> save_tuple = t <NEW_LINE> the_min = t[1] <NEW_...
In this function, we will go through the_set and for each value 'a' between 'begin' and 'end' (begin <= a <= end), we will save the state with the smallest b
625941e72eb69b55b151cd14
def run(): <NEW_LINE> <INDENT> traci.vehicle.changeLane("follower", 0, 200) <NEW_LINE> step = 0 <NEW_LINE> while step < 500: <NEW_LINE> <INDENT> traci.simulationStep() <NEW_LINE> if step == 10: <NEW_LINE> <INDENT> requestToC(ToC_vehicle, timeTillMRM) <NEW_LINE> t = traci.simulation.getTime() <NEW_LINE> print("Requested...
execute the TraCI control loop
625941e7187af65679ca557f
def get_repositories(github_username: str) -> list: <NEW_LINE> <INDENT> return github_request('GET', f'/users/{github_username}/repos').json()
Returns repositories @param github_username: A GitHub user's username @return: a list of repositories
625941e7293b9510aa2c36f0
def is_leaf(cluster): <NEW_LINE> <INDENT> return len(cluster) == 1
кластер является листом, если его длина = 1
625941e750485f2cf553d1fb
def test_get_details_filter_name(self): <NEW_LINE> <INDENT> extra_fixture = self.get_fixture(id=_gen_uuid(), name='new name! #123', size=20) <NEW_LINE> db_api.image_create(self.context, extra_fixture) <NEW_LINE> extra_fixture = self.get_fixture(id=_gen_uuid(), name='new name! #123') <NEW_LINE> db_api.image_create(self....
Tests that the /images/detail registry API returns list of public images that have a specific name
625941e78da39b475bd653d8
def method_handler(request, response): <NEW_LINE> <INDENT> METHOD = { "GET": get_handler, "POST": post_handler, "HEAD": head_handler, "DELETE": delete_handler, "PUT": put_handler, "OPTIONS": options_handler } <NEW_LINE> handler = METHOD[request["method"]] <NEW_LINE> return handler(request, response)
METHOD Handler call respective method handler
625941e756b00c62f0f14abb
def reset(self): <NEW_LINE> <INDENT> self.command_stack = [] <NEW_LINE> self.scripts = set() <NEW_LINE> self.watches = [] <NEW_LINE> self.watching = False <NEW_LINE> self.explicit_transaction = False
Reset back to empty pipeline.
625941e7cb5e8a47e48b7f03
def attributes(grammar, invisible=False): <NEW_LINE> <INDENT> if type(grammar) == attr.Class and (invisible or grammar.name[0] != "_"): <NEW_LINE> <INDENT> yield grammar <NEW_LINE> <DEDENT> elif type(grammar) == tuple: <NEW_LINE> <INDENT> for e in grammar: <NEW_LINE> <INDENT> for a in attributes(e, invisible): <NEW_LIN...
Iterates all attributes of a grammar.
625941e71d351010ab855f7a
def consoliate_and_sort_taxonomy(genus_species_taxid): <NEW_LINE> <INDENT> answer = [] <NEW_LINE> genera_with_species = set() <NEW_LINE> with_taxid = set() <NEW_LINE> for genus, species, taxid in sorted(genus_species_taxid, reverse=True): <NEW_LINE> <INDENT> assert genus <NEW_LINE> if species: <NEW_LINE> <INDENT> gener...
Remove any redundant entries, returns new sorted list. Drops zero taxid entries if has matching non-zero entry. Drops genus only entries if have species level entries. Note ignoring the TaxID here - would need to know the parent/child relationship to confirm the genus we're removing does have species level children i...
625941e7ec188e330fd5abf5
def get_json(self): <NEW_LINE> <INDENT> return json.loads(self.get_data().decode('utf8'))
:return: json object
625941e75fc7496912cc3ddd
def getIdsNotEqualList(self, *args): <NEW_LINE> <INDENT> return _MEDCouplingRemapper.DataArrayInt_getIdsNotEqualList(self, *args)
getIdsNotEqualList(self, int valsBg, int valsEnd) -> DataArrayInt getIdsNotEqualList(self, PyObject obj) -> DataArrayInt 1
625941e763b5f9789fde7545
def decodeString(self, s): <NEW_LINE> <INDENT> self.s = list(s) <NEW_LINE> self.index = 0 <NEW_LINE> res = [] <NEW_LINE> while self.index < len(s): <NEW_LINE> <INDENT> res.append(self.helper(self.index)) <NEW_LINE> self.index += 1 <NEW_LINE> <DEDENT> return ''.join(res)
:type s: str :rtype: str
625941e75510c4643540f838
def test_agent_edit(self): <NEW_LINE> <INDENT> response = self.client.post('/accounts/login', {'username': self.username, 'password': self.password }) <NEW_LINE> self.assertRedirects(response, '/') <NEW_LINE> response = self.client.get(reverse('services_agent_edit', args=[self.agent.id])) <NEW_LINE> self.assertEquals(r...
Test page with login at /services/agent/edit/<agent_id>
625941e7bd1bec0571d90a8e
def filter_traceback(fn): <NEW_LINE> <INDENT> if sys.version_info.major != 3 or sys.version_info.minor < 7: <NEW_LINE> <INDENT> return fn <NEW_LINE> <DEDENT> def error_handler(*args, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if not is_traceback_filtering_enabled(): <NEW_LINE> <INDENT> return fn(*args, **k...
Decorator to filter out TF-internal stack trace frames in exceptions. Raw TensorFlow stack traces involve many internal frames, which can be challenging to read through, while not being actionable for end users. By default, TensorFlow filters internal frames in most exceptions that it raises, to keep stack traces shor...
625941e792d797404e3045eb
def get_wallets_transactions(data): <NEW_LINE> <INDENT> coin = data["coin"] <NEW_LINE> wid = data["wid"] <NEW_LINE> limit = data["limit"] <NEW_LINE> page = data["page"] <NEW_LINE> io = data["io"] <NEW_LINE> url = base_url + "{0}/wallets/transactions".format(coin) <NEW_LINE> header = { "X-Wid": wid } <NEW_LINE> header.u...
查询交易列表(分页)
625941e760cbc95b062c69a3
def rebin(self, parameter): <NEW_LINE> <INDENT> if len(self.data.data) % parameter != 0: <NEW_LINE> <INDENT> raise ValueError("Invalid rebin parameter: {}, nbins: {}".format( parameter, len(self.data.data))) <NEW_LINE> <DEDENT> retval = self.copy() <NEW_LINE> energy = retval.energy <NEW_LINE> energy.lo = energy.lo[0::p...
Rebin. Parameters ---------- parameter, int Number of bins to merge Returns ------- rebinned_spectrum : `~gammapy.spectrum.CountsSpectrum` Rebinned spectrum
625941e7de87d2750b8601f6
def load_posts(cli, size, fake): <NEW_LINE> <INDENT> nb_avg_posts_in_topic = size * 10 <NEW_LINE> cli.stdout.write(u"Nombres de messages à poster en moyenne dans un sujet : {}".format(nb_avg_posts_in_topic)) <NEW_LINE> tps1 = time.time() <NEW_LINE> nb_topics = Topic.objects.count() <NEW_LINE> if nb_topics == 0: <NEW_LI...
Load posts
625941e771ff763f4b549af3
@pytest.mark.parametrize('nodes, result', PATH_SHORTER_PARAMS) <NEW_LINE> def test_b_f_shorter_path(nodes, result, four_node_five_edge_graph_path): <NEW_LINE> <INDENT> g = four_node_five_edge_graph_path <NEW_LINE> assert g.b_f_shortest_path(nodes[0], nodes[1]) == result
Third test for b_f shortest path with shorter paths.
625941e7167d2b6e31218ff4
def get_subtypes(mode): <NEW_LINE> <INDENT> return [s.strip() for s in open(settings.get('subtypes', mode), encoding='utf-8').readlines() if s]
Read all subtypes for this mode from file
625941e7b830903b967e9d66
def ensure_call(curr, call): <NEW_LINE> <INDENT> id_ = call['runtime_id'] <NEW_LINE> if id_ not in curr.children: <NEW_LINE> <INDENT> curr.children[id_] = CallNode(_copy_call(call), OrderedDict(), curr) <NEW_LINE> <DEDENT> return curr.children[id_]
Returns an existing entry of call or create a new one.
625941e78a43f66fc4b544c0
def preprocess(image, output_height=224, output_width=224): <NEW_LINE> <INDENT> image = tf.image.resize_images(image, [output_height, output_width], method=1) <NEW_LINE> image.set_shape([output_height, output_width, 3]) <NEW_LINE> image = tf.to_float(image) <NEW_LINE> return tf.image.per_image_standardization(_mean_ima...
Preprocesses the given image for evaluation. Args: image: A `Tensor` representing an image of arbitrary size. output_height: The height of the image after preprocessing. output_width: The width of the image after preprocessing. resize_side: The smallest side of the image for aspect-preserving resizing. Return...
625941e763d6d428bbe44950
def getHostByName(self, name, *args): <NEW_LINE> <INDENT> self.countByNameStat[name] += 1 <NEW_LINE> self.requestsStat += 1 <NEW_LINE> key = (name,) + args <NEW_LINE> if key in self._cache: <NEW_LINE> <INDENT> if isinstance(self._cache[key], Failure): <NEW_LINE> <INDENT> del self._cache[key] <NEW_LINE> <DEDENT> elif ti...
Gets a host by name.
625941e7656771135c3ebcd3
def ResetMetrics(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
Missing associated documentation comment in .proto file.
625941e7ff9c53063f47c651
def show_status(self) -> str: <NEW_LINE> <INDENT> status = "```\n Setup || " + self.list_periods(True) <NEW_LINE> status += ("\n\t Looping : " + ("On" if self.repeat else "Off")) <NEW_LINE> status += ("\n\t Countdown: " + ("On" if self.countdown else "Off")) <NEW_LINE> status += "\n Status || " <NEW_LINE>...
Show the timer's status, including the setup, time, and users subscribed. :return: The status of the timer.
625941e792d797404e3045ec
def __call__(self, terrain: Terrain): <NEW_LINE> <INDENT> arr = numpy.array(terrain._heightmap, dtype='float32') <NEW_LINE> depth, mode, dtype = self.bitdepth <NEW_LINE> mult_arr = numpy.multiply(arr, depth) <NEW_LINE> return Image.fromarray(numpy.array(mult_arr, dtype=dtype), mode)
Export the terrain to a ``PIL.Image`` instance. :param terrain: Terrain object to be exported. :returns: ``PIL.Image`` instance containing the greyscale image.
625941e78e05c05ec3eea7d8
def generate_reports(self): <NEW_LINE> <INDENT> self.c.execute("select OrderId from orders where VmStatus <> 'T'") <NEW_LINE> for row in self.c.fetchall(): <NEW_LINE> <INDENT> self.generate_report_by_id(int(row['OrderId']))
generate reports for all orders
625941e756b00c62f0f14abc
def to_basic_block(self): <NEW_LINE> <INDENT> return _howto_swig.ofdm_serializer_vcc_sptr_to_basic_block(self)
to_basic_block(ofdm_serializer_vcc_sptr self) -> basic_block_sptr
625941e7a934411ee3751af4
def update2db(conn, dict, table_name, primary_key): <NEW_LINE> <INDENT> cur = conn.cursor() <NEW_LINE> sql = __update_sql(dict, table_name, primary_key) <NEW_LINE> try: <NEW_LINE> <INDENT> cur.execute(sql) <NEW_LINE> conn.commit() <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> conn.rollback() <NEW_LINE>...
将prod的数据更新到数据库,先试用insert来更新,如果报错pymysql.err.IntegrityError,改用update来更新
625941e70c0af96317bb8647
def krzywa(self, qp, p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y, xsize): <NEW_LINE> <INDENT> p0 = QtCore.QPointF(p0x*xsize, p0y*xsize) <NEW_LINE> p1 = QtCore.QPointF(p1x*xsize, p1y*xsize) <NEW_LINE> p2 = QtCore.QPointF(p2x*xsize, p2y*xsize) <NEW_LINE> p3 = QtCore.QPointF(p3x*xsize, p3y*xsize) <NEW_LINE> cubicPath = QtGui.Q...
wyrysowanie krzywej. Parametrami sa wspolrzedne punktow, przez ktore przechodzi krzywa
625941e7d6c5a102081444ae
@app.route("/connection/ssh/endsession/") <NEW_LINE> def oldentriesendsession(): <NEW_LINE> <INDENT> isodate = datetime.now().isoformat().replace(":",""). replace("-","").split('.')[0] <NEW_LINE> lentries = logentry.Logentry.query.filter( logentry.Logentry.pid is None).all() <NEW_LINE> if not lentrie...
Force old entries without PID to be noted as closed
625941e7d8ef3951e324399d
def update(self, interval, world): <NEW_LINE> <INDENT> myShip = self.myEmpire.myGalaxy.ships[self.myShipID] <NEW_LINE> self.setMyPosition(myShip) <NEW_LINE> world.move(self, self.posX, self.posY, self.facing) <NEW_LINE> self.graphicsObject.setState(self.posX, self.posY, self.facing) <NEW_LINE> return self.alive
maintain captain position in world
625941e730c21e258bdfa902
def _add_ineq_constraint(self, lhs, rel, rhs, name=None, scope=None, linear=False): <NEW_LINE> <INDENT> if rel == '=': <NEW_LINE> <INDENT> msg = "Equality constraints are not supported on this driver" <NEW_LINE> self.parent.raise_exception(msg, ValueError) <NEW_LINE> <DEDENT> if not isinstance(lhs, basestring): <NEW_LI...
Adds an inequality constraint as three strings; a left-hand side, a comparator ('<','>','<=', or '>='), and a right-hand side.
625941e721a7993f00bc8157
def stats(self): <NEW_LINE> <INDENT> res = {} <NEW_LINE> db = self._collection.database <NEW_LINE> conn = db.connection <NEW_LINE> res['sharding'] = {} <NEW_LINE> try: <NEW_LINE> <INDENT> sharding = conn.config.databases.find_one({'_id': db.name}) <NEW_LINE> if sharding: <NEW_LINE> <INDENT> res['sharding'].update(shard...
Return storage statistics about the library Returns ------- dictionary of storage stats
625941e7d8ef3951e324399e
def __init__(self, name = "", index = 0, dimX = 0.0, dimY = 0.0, pivotX = 0.0, pivotY = 0.0, massCenterX = 0.0, massCenterY = 0.0, area = 0.0, isRawPart = False, isLabelPart = False): <NEW_LINE> <INDENT> self._map = {"PartName" : "name", "DimX" : "dimX", "DimY" : "dimY", "PivotX" : "pivotX", "PivotY" : "pivotY", "MassC...
Constructor
625941e71b99ca400220af13
def read_user(str): <NEW_LINE> <INDENT> pieces = str.split() <NEW_LINE> return { 'first': pieces[0], 'last': pieces[1], 'username': pieces[5], 'custID': pieces[3], 'password': pieces[7], 'rank': 0, 'total': 0 }
str -> dict
625941e7097d151d1a2232b7
def not_implemented(**kargs): <NEW_LINE> <INDENT> out('Not implemented command %(RED)s%(BLINK)s%(command)s', **kargs)
Comando não implementado até o momento.
625941e730dc7b7665901dc1
def configureDBCluster(self): <NEW_LINE> <INDENT> functionName = self.configureDBCluster.__name__ <NEW_LINE> helpers.entrylog(log, functionName, locals()) <NEW_LINE> sensorToCollectorMap = database.getSensorToCollectorMap() <NEW_LINE> log.info("Registering collector database servers as shards") <NEW_LINE> cnodes = set(...
Function to configure the mongo db setup for an experiment. This is an internal function called by the bootstrap process.
625941e7bf627c535bc1362f
def _find_fire_sources(self): <NEW_LINE> <INDENT> filepath = self._get_fds_file_path() <NEW_LINE> fds_values = extract_line_by_regexp(filepath, FDSDataSource.F_SRC_REGEXP) <NEW_LINE> self._fire_sources = [] <NEW_LINE> for coords in fds_values: <NEW_LINE> <INDENT> start = np.array([float(coords[0]), float(coords[2])]) <...
Finds fire sources. Creates list of fire sources represented by their diagonals.
625941e730dc7b7665901dc2
def __init__(self, start, end, decay_factor): <NEW_LINE> <INDENT> self.name = 'ext_schedule' <NEW_LINE> assert start > 0 <NEW_LINE> assert end > start <NEW_LINE> self.start = start <NEW_LINE> self.end = end <NEW_LINE> self.decay_factor = decay_factor <NEW_LINE> self.count = 0
.. todo:: WRITEME
625941e7a8ecb033257d352b
def test_flow_10(self): <NEW_LINE> <INDENT> subcontractor_contact = self.env['res.partner'].create({ 'name': 'Test children subcontractor contact', 'parent_id': self.subcontractor_partner1.id, }) <NEW_LINE> picking_form = Form(self.env['stock.picking']) <NEW_LINE> picking_form.picking_type_id = self.env.ref('stock.pick...
Receipts from a children contact of a subcontractor are properly handled.
625941e7379a373c97cfafa7
def makeRecombinationRegions(regions): <NEW_LINE> <INDENT> beg = [i.b for i in regions] <NEW_LINE> end = [i.e for i in regions] <NEW_LINE> weights = [i.w for i in regions] <NEW_LINE> from .fwdpp_extensions import RecombinationRegions <NEW_LINE> return RecombinationRegions(beg, end, weights)
Convert user input into :class:`~fwdpy11.fwdpp_extensions.RecombinationRegions` :param neutral: A list of :class:`fwdpy11.regions.Region` objects. :param selected: A list of :class:`fwdpy11.regions.Sregion` objects. :rtype: :class:`fwdpy11.fwdpp_extensions.MutationRegions` .. note:: Used by various "evolve" func...
625941e7b545ff76a8914275
def __init__(self, searchstring, searchparts, ignorecase=False, useregexp=False, invertmatch=False, keeptranslations=False, accelchar=None, encoding='utf-8', max_matches=0): <NEW_LINE> <INDENT> if isinstance(searchstring, six.text_type): <NEW_LINE> <INDENT> self.searchstring = searchstring <NEW_LINE> <DEDENT> else: <NE...
builds a checkfilter using the given checker
625941e7d18da76e2353293b
@sts_client("elbv2") <NEW_LINE> def get_all_elbs_v2(**kwargs): <NEW_LINE> <INDENT> elbs = [] <NEW_LINE> try: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> response = _get_elbs_v2(**kwargs) <NEW_LINE> elbs += _filter_ignored_elbsv2(response["LoadBalancers"], **kwargs) <NEW_LINE> if not response.get("NextMarker"): ...
Fetches all elbs for a given account/region :param kwargs: :return:
625941e7fff4ab517eb2f89f
def _DrainJob(self, job_ref): <NEW_LINE> <INDENT> apitools_client = self.context[commands.DATAFLOW_APITOOLS_CLIENT_KEY] <NEW_LINE> dataflow_messages = self.context[commands.DATAFLOW_MESSAGES_MODULE_KEY] <NEW_LINE> request = dataflow_messages.DataflowProjectsJobsUpdateRequest( projectId=job_ref.projectId, jobId=job_ref....
Drains a job. Args: job_ref: resources.Resource, The reference to the job to drain.
625941e75fdd1c0f98dc0695
def test_game_description(self): <NEW_LINE> <INDENT> self.assertTrue(halflife.get_game_description(), 'game description invalid') <NEW_LINE> self.assertTrue(halflife.get_game_description(original=True), 'original game description invalid')
Game description valid
625941e7d486a94d0b98e5a7
def sync_token(token, secret, session=requests, timestamp=None): <NEW_LINE> <INDENT> secret_hex = binascii.b2a_hex(secret).decode('ascii') <NEW_LINE> if timestamp is None: <NEW_LINE> <INDENT> timestamp = int(time.time()) <NEW_LINE> <DEDENT> if token.get('counter') is not None: <NEW_LINE> <INDENT> otp1 = hotp(secret_hex...
Sync the generated token. This will fail for a TOTP token if performed less than 2 periods after the last sync or check.
625941e7d268445f265b52cf
def update(self, post_id, **kwargs): <NEW_LINE> <INDENT> post = self.read(post_id) <NEW_LINE> post.update(**kwargs) <NEW_LINE> self.file_system.write(post_id, PostModel.encode(post)) <NEW_LINE> return post
Update file of article. :param string post_id: :param kwargs: :return dict:
625941e7be383301e01b58dd
def loadimage(self, filename): <NEW_LINE> <INDENT> return pygame.image.load(filename)
loading image
625941e73eb6a72ae02ec949
def citireAdiacenta(): <NEW_LINE> <INDENT> ladi=[[]] <NEW_LINE> while(True): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> n=citesteInt("introdu numarul de noduri:") <NEW_LINE> validatorNr(n) <NEW_LINE> break <NEW_LINE> <DEDENT> except ValueError as ex: <NEW_LINE> <INDENT> print(ex) <NEW_LINE> <DEDENT> <DEDENT> matriceA...
Functie care genereaza in memorie si returneaza o lista de liste fiind echivalentul unei matrici de adiacenta Lista 0 din lista "mama" va fi echivalentul liniei nr 1 din matricea de adiacenta si tot asa Date de intrare: --- Date de iesire: matriceAdiacenta - lista de liste reprezentand o matrice de adiacenta
625941e767a9b606de4a8317
def getScenariosPath(self): <NEW_LINE> <INDENT> return self.scenarios_path
Gets the scenarios folder path :return: String with the scenarios project path
625941e707f4c71912b118e5
def main(): <NEW_LINE> <INDENT> model = 'mlp' <NEW_LINE> saved_model = None <NEW_LINE> class_limit = 3 <NEW_LINE> seq_length = 40 <NEW_LINE> load_to_memory = True <NEW_LINE> batch_size = 32 <NEW_LINE> nb_epoch = 30 <NEW_LINE> if model in ['conv_3d', 'c3d', 'lrcn']: <NEW_LINE> <INDENT> data_type = 'images' <NEW_LINE> im...
These are the main training settings. Set each before running this file.
625941e70383005118ecfa42
def getStartTs(self): <NEW_LINE> <INDENT> return None
Return the time of events this source is producing. + For live sources this will be None, meaning "use the present time". THis can be fed straight into HORSEYTIEM.override(). + For historical sources with a specified start time, return that time. + For historical sources with no specified start time, peek at first ...
625941e760cbc95b062c69a4
def UserMemberInfoUpdate(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
修改用户会员表信息
625941e763d6d428bbe44951
def test_call_fileout(): <NEW_LINE> <INDENT> infile = "merged_pcr_dupes_spurious.bed" <NEW_LINE> outfile = "merged_pcr_dupes_spurious_filtered.bed" <NEW_LINE> env.run( bindir_rel + "rm_spurious_events.py", datadir_rel + infile, "--outfile", outfile ) <NEW_LINE> assert(cmp( testdir + outfile, datadir + "merged_pcr_dupes...
Call rm_spurious_events.py with infile and outfile.
625941e716aa5153ce3628d8
def save(self, commit=True): <NEW_LINE> <INDENT> if self.id is None: <NEW_LINE> <INDENT> session.add(self) <NEW_LINE> <DEDENT> if commit: <NEW_LINE> <INDENT> session.commit() <NEW_LINE> session.flush() <NEW_LINE> <DEDENT> return self
Alias to save or update object :param commit: Boolean to commit or only add object at session Usage example: class Food(Model): id = Column(Integer, primary_key=True) name = Column(String(60)) price = Column(Float(precision=2)) palmito = Food(name='Palmito', price=10.9) palmito.save(...
625941e782261d6c526ab907
def get_usercode(service: ServiceCall) -> None: <NEW_LINE> <INDENT> node_id = service.data.get(const.ATTR_NODE_ID) <NEW_LINE> lock_node = network.nodes[node_id] <NEW_LINE> code_slot = service.data.get(ATTR_CODE_SLOT) <NEW_LINE> for value in lock_node.get_values( class_id=const.COMMAND_CLASS_USER_CODE ).values(): <NEW_L...
Get a usercode at index X on the lock.
625941e7e64d504609d74ca0
def main(args=None, mux=tools.mux): <NEW_LINE> <INDENT> args = parser.parse_args(args) <NEW_LINE> tools.setup_logging() <NEW_LINE> with proto.apdu_error_responder(): <NEW_LINE> <INDENT> apdu = proto.CommandAPDUAuthenticate.from_stream( sys.stdin.buffer) <NEW_LINE> <DEDENT> if (args.key_handle_hash is not None and args....
Main routine of ``u2f.Register`` qrexec call
625941e7b5575c28eb68e465
def get_dataset(dataset_root): <NEW_LINE> <INDENT> global POSSIBLE_PHONEME_CODES <NEW_LINE> with open(dataset_root / 'all_possible_phoneme_codes.pkl', 'rb') as f: <NEW_LINE> <INDENT> POSSIBLE_PHONEME_CODES = pickle.load(f) <NEW_LINE> <DEDENT> dataset = LJSpeech(dataset_root) <NEW_LINE> NUM_VAL_SAMPLES = 100 <NEW_LINE> ...
Load the dataset and split it for training and validation. Also, initialize `lj_speech.POSSIBLE_PHONEME_CODES`. dataset_root: str or pathlib.Path Path to a directory with .json and .npy files. return: train_dataset: torch.utils.data.Dataset A subset of a LJSpeech instance. val_dataset: torch.utils...
625941e7377c676e91272607
def does_topic_with_name_exist(topic_name): <NEW_LINE> <INDENT> if not isinstance(topic_name, str): <NEW_LINE> <INDENT> raise utils.ValidationError('Name should be a string.') <NEW_LINE> <DEDENT> existing_topic = topic_fetchers.get_topic_by_name(topic_name) <NEW_LINE> return existing_topic is not None
Checks if the topic with provided name exists. Args: topic_name: str. The topic name. Returns: bool. Whether the the topic name exists. Raises: Exception. Topic name is not a string.
625941e7adb09d7d5db6cbed
def save_report(db): <NEW_LINE> <INDENT> today = date.today() <NEW_LINE> donors = sorted_list(db) <NEW_LINE> print('Saving a copy to local disk....') <NEW_LINE> for donor in donors: <NEW_LINE> <INDENT> letter = form_letter(donor[0][0], donor[1][0]) <NEW_LINE> user_file = "{}.{}.txt".format(donor[0][0], today) <NEW_LINE...
Generate a thank you letter for each donor and write to individual files on disk. :param db: donor database :return: None
625941e729b78933be1e5b07
def wordBreak(self, s, wordDict): <NEW_LINE> <INDENT> match = [0] <NEW_LINE> for i in xrange(1, len(s)+1): <NEW_LINE> <INDENT> for j in reversed(match): <NEW_LINE> <INDENT> if s[j:i] in wordDict: <NEW_LINE> <INDENT> match.append(i) <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return match[-1] == len(s)
:type s: str :type wordDict: Set[str] :rtype: bool
625941e7be383301e01b58de
def broken_routes(routes: dict) -> bool: <NEW_LINE> <INDENT> for node in routes: <NEW_LINE> <INDENT> if routes[node]: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Check if the routes are broken; looking for an empty list. :type routes: dict :param routes: List of the connected nodes. :rtype: bool :return: True if the routes are broken otherwise false
625941e75e10d32532c5f386
def setCaption(self, caption): <NEW_LINE> <INDENT> raise NotImplementedError
Sets the Caption.
625941e74c3428357757c786
def get_bucket_url(self, bucket_name): <NEW_LINE> <INDENT> return "http://{}.{}".format( bucket_name, util.get_endpoint(self.get_bucket_location(bucket_name)).host )
Get the website url for this bucekt.
625941e794891a1f4081bf0c
def test_to_repo_objects(self): <NEW_LINE> <INDENT> repo_list = get_repos(self.config_dict_expanded) <NEW_LINE> for repo_dict in repo_list: <NEW_LINE> <INDENT> r = Repo(**repo_dict) <NEW_LINE> self.assertIsInstance(r, BaseRepo) <NEW_LINE> self.assertIn('name', r) <NEW_LINE> self.assertEqual(r['name'], repo_dict['name']...
:py:obj:`dict` objects into Repo objects.
625941e74f6381625f114e9c
@command <NEW_LINE> def wiki(msginfo): <NEW_LINE> <INDENT> UA = "JiyuuBot/1 (http://github.com/JiyuuProject/JiyuuBot; bob@bob131.so) BasedOnRequests/%s" % requests.__version__ <NEW_LINE> query = " ".join(msginfo['msg'].split()[1:]) <NEW_LINE> searchresult = requests.get("https://en.wikipedia.org/w/api.php?action=query&...
.wiki <query> - searches Wikipedia for a query
625941e7460517430c3945da