code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def parseDateTime(s): <NEW_LINE> <INDENT> if s is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> m = re.match(r'(.*?)(?:\.(\d+))?(([-+]\d{1,2}):(\d{2}))?$', str(s)) <NEW_LINE> datestr, fractional, tzname, tzhour, tzmin = m.groups() <NEW_LINE> if tzname is None: <NEW_LINE> <INDENT> tz = None <NEW_LINE> <DEDEN...
Parses the date from a string
625941dc004d5f362079a63f
def uploadrepftp(ftp, repertloc, repertftp, affiche=False): <NEW_LINE> <INDENT> repertloc = os.path.abspath(os.path.expanduser(repertloc)) <NEW_LINE> repertftp = repertftp + '/' + os.path.basename(repertloc) <NEW_LINE> if not existerepftp(ftp, repertftp): <NEW_LINE> <INDENT> if affiche: <NEW_LINE> <INDENT> print("Crée ...
uploade sur FTP les fichiers du répertoire et de ses sous-répertoires - ftp: connecteur sur une connexion FTP ouverte - repertloc: répertoire local disque (sans '' ni '/' à la fin) - repertftp: répertoire existant sur serveur FTP (sans '/' à la fin) - affiche: si True, affiche les fichiers téléchargés retourne la liste...
625941dc1b99ca400220adbf
@endpoint(route_name='favorite', request_method='DELETE', permission=unfavorite) <NEW_LINE> def unfavorite(activity, request): <NEW_LINE> <INDENT> rest_params = { 'verb': 'unfavorite', 'object': { '_id': ObjectId(activity['_id']), 'objectType': activity['objectType'], } } <NEW_LINE> newactivity = Activity.from_request(...
Unfavorite activity
625941dcf9cc0f698b140906
@APP.route("/", methods=['GET', 'POST']) <NEW_LINE> def index(): <NEW_LINE> <INDENT> return render_template('index.html')
Serve the backend
625941dc63f4b57ef000141f
def __init__(self, datastore: Datastore): <NEW_LINE> <INDENT> self.datastore = datastore
Constructs a simple datastore wrapper for loading EpaCems dataframes from datastore.
625941dc7047854f462a1713
def item_scraped(self, item, response, spider): <NEW_LINE> <INDENT> if type(item).__name__ not in ['ListingItem',]: <NEW_LINE> <INDENT> raise DropItem("Invalid item type - {}".format(type(item).__name__)) <NEW_LINE> <DEDENT> _logger = self.logger <NEW_LINE> @inlineCallbacks <NEW_LINE> def _cb(resp): <NEW_LINE> <INDENT>...
Send the scraped item to the server
625941dc66656f66f7cbc4b9
def search_channels(query: str, guild: discord.Guild, channel_type: str='tvc') -> List[discord.abc.GuildChannel]: <NEW_LINE> <INDENT> channel_types = [] <NEW_LINE> if 't' in channel_type: <NEW_LINE> <INDENT> channel_types.append(discord.TextChannel) <NEW_LINE> <DEDENT> if 'v' in channel_type: <NEW_LINE> <INDENT> channe...
Do a fuzzy search in a guild for channels. :param query: String to fuzzy search the guild channels for :param guild: Guild to search in :param channel_type: 't': TextChannel, 'v' VoiceChannel, 'c': Category Channel :return: List of up to 5 channels that match the query relatively well
625941dca8ecb033257d33d9
def solve(self): <NEW_LINE> <INDENT> self._sort() <NEW_LINE> self._solve() <NEW_LINE> self._unsort()
Solve the given system of equations.
625941dccc40096d61595c5d
def get_sample_source_list(prob_label): <NEW_LINE> <INDENT> dimensions = [5] + [100*i for i in range(1, 5+1)] <NEW_LINE> high_dims = [5] + [300*i for i in range(1, 5+1)] <NEW_LINE> low_dims = [2*d for d in range(1, 7+1)] <NEW_LINE> prob2ss = { 'gmd': [data.SSGaussMeanDiff(d=d, my=1.0) for d in high_dims], 'gvd': [data....
Return a list of SampleSource's representing the problems, each corresponding to one dimension in the list.
625941dcbe383301e01b578e
def load(self, file_name=None): <NEW_LINE> <INDENT> if file_name is None: <NEW_LINE> <INDENT> error = {"status": "Error", "result": "Not filename provided"} <NEW_LINE> raise LookupError(error['result']) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> with open(file_name, 'r') as load_file: <NEW_LINE> <INDENT> elements_loa...
Load Quantum Program Json file into the Quantum Program object. Args: file_name (str): file name and path. Returns: dict: The dictionary with the status and result of the operation Raises: LookupError: if the file_name is not correct, or reading from the file resulted in an error.
625941dc566aa707497f4872
def set_site(self, site): <NEW_LINE> <INDENT> super(RenderSidebar, self).set_site(site)
Set site.
625941dc0383005118ecf8ef
def LoadingAll () -> bool: <NEW_LINE> <INDENT> return _inLoadLoop
Whether or not a load loop is currently active. A load loop cannot start if it was triggered from inside another load loop.
625941dcab23a570cc250492
def navmesh_reset(): <NEW_LINE> <INDENT> pass
Assign a new index to every face
625941ddb57a9660fec33b95
def _parse_params(self, param_line): <NEW_LINE> <INDENT> param_line = param_line.replace(' ', '') <NEW_LINE> param_type, param_value_raw = param_line.split('=') <NEW_LINE> param_value = None <NEW_LINE> if param_type == 'layers': <NEW_LINE> <INDENT> layer_indexes = list() <NEW_LINE> for index in param_value_raw.split(',...
Identifies the parameters contained in one of the cfg file and returns them in the required format for each parameter type, e.g. as a list, an int or a float. Keyword argument: param_line -- one parsed line within a layer block
625941dd460517430c39448c
def test_fleet_check_possible_placement(self, resource): <NEW_LINE> <INDENT> fleet = resource <NEW_LINE> for direction in list(src.Fleet.Ship.Direction): <NEW_LINE> <INDENT> for key, ship in fleet.fleet.items(): <NEW_LINE> <INDENT> ship.directionality = direction <NEW_LINE> for xy in range(src.Fleet.GameRules.SIZE - 1)...
Test the check possible placement from Fleet:GeneralFleet:check_possible_placement
625941dd7047854f462a1714
def partial_update(self, request, pk=None): <NEW_LINE> <INDENT> return Response({'http_method': 'PATCH'})
Handles updating part of an objects
625941ddadb09d7d5db6ca9b
@register.filter <NEW_LINE> def row_num(y): <NEW_LINE> <INDENT> return y + 1
increments y
625941dda8370b7717052bab
def validate_author(self, author): <NEW_LINE> <INDENT> data = self.get_initial() <NEW_LINE> try: <NEW_LINE> <INDENT> lot = Lot.objects.get(pk=data['lot']) <NEW_LINE> if author == lot.lot_owner: <NEW_LINE> <INDENT> raise ValidationError(f'You cannot add bets to your lot') <NEW_LINE> <DEDENT> <DEDENT> except (Lot.DoesNot...
Check that user can't make net for own lot
625941dd3617ad0b5ed68204
def send_activation_email(self, site): <NEW_LINE> <INDENT> ctx_dict = { 'activation_key': self.activation_key, 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'subject_prefix': settings.EMAIL_SUBJECT_PREFIX, 'site': site, } <NEW_LINE> subject = render_to_string('registration/activation_email_subject.txt', ctx_dict...
Send an activation email to the user associated with this ``RegistrationProfile``. The activation email will make use of two templates: ``registration/activation_email_subject.txt`` This template will be used for the subject line of the email. Because it is used as the subject line of an email, this templ...
625941dd851cf427c661a81a
def log_user(request): <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> response = log_user_get(request) <NEW_LINE> <DEDENT> elif request.method == 'POST': <NEW_LINE> <INDENT> response = log_user_post(request) <NEW_LINE> <DEDENT> return response
Call method to log the user depending on the request \ method (GET or POST).
625941dd23e79379d52ee86e
@vcr.use_cassette('vcr_cassettes/terms/terms_importantdates.yml', filter_query_parameters=['key']) <NEW_LINE> def test_terms_importantdates(importantdates_keys): <NEW_LINE> <INDENT> uw_driver = UW_Driver() <NEW_LINE> response = uw_driver.terms_importantdates(1179) <NEW_LINE> assert isinstance(response, list) <NEW_LINE>...
Tests an API call to /terms/{term}/importantdates endpoint. term_id = 1179
625941dd0c0af96317bb84f5
def write_parameters(self, filename='parameters_rbf.prm'): <NEW_LINE> <INDENT> if not isinstance(filename, str): <NEW_LINE> <INDENT> raise TypeError("filename must be a string") <NEW_LINE> <DEDENT> output_string = "" <NEW_LINE> output_string += '\n[Radial Basis Functions]\n' <NEW_LINE> output_string += '# This section ...
This method writes a parameters file (.prm) called `filename` and fills it with all the parameters class members. Default value is parameters_rbf.prm. :param string filename: parameters file to be written out.
625941dd4f6381625f114d49
def as_fhir(obj): <NEW_LINE> <INDENT> if hasattr(obj, 'as_fhir'): <NEW_LINE> <INDENT> return obj.as_fhir() <NEW_LINE> <DEDENT> if isinstance(obj, datetime): <NEW_LINE> <INDENT> tz = getattr(obj, 'tzinfo', None) <NEW_LINE> if tz and tz != pytz.utc: <NEW_LINE> <INDENT> current_app.logger.error("Datetime export of NON-UTC...
For builtin types needing FHIR formatting help Returns obj as JSON FHIR formatted string
625941ddd7e4931a7ee9e22c
def pc_work_time_var(self): <NEW_LINE> <INDENT> return _cdma_swig.chopper_sptr_pc_work_time_var(self)
pc_work_time_var(chopper_sptr self) -> float
625941dd5166f23b2e1a5466
def _write(self, string): <NEW_LINE> <INDENT> pass
the default write behavior; do nothing let the wrappers control the behavior
625941dd38b623060ff0b0fb
def event_return(events): <NEW_LINE> <INDENT> _options = _get_options() <NEW_LINE> for event in events: <NEW_LINE> <INDENT> log.trace('Hipchat returner received event: {0}'.format(event)) <NEW_LINE> _send_message(_options.get('room_id'), event['data'], _options.get('from_name'), _options.get('api_key'), _options.get('a...
Return event data to hipchat
625941dd627d3e7fe0d6915f
def test_samp_sparse_mix_prob(hardgame, hardgame_file): <NEW_LINE> <INDENT> with stdout() as out, stderr() as err: <NEW_LINE> <INDENT> assert run( "samp", "-i", hardgame_file, "mix", "-a", "0.5", "-s", "0.5" ), err.getvalue() <NEW_LINE> <DEDENT> hardgame.mixture_from_json(json.loads(out.getvalue()))
Test sample sparse mixture probability
625941dd85dfad0860c3b169
def collect_yaml(paths): <NEW_LINE> <INDENT> file_paths = [] <NEW_LINE> for path in paths: <NEW_LINE> <INDENT> if os.path.exists(path): <NEW_LINE> <INDENT> if os.path.isdir(path): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> file_paths.extend( sorted( os.path.join(path, p) for p in os.listdir(path) if os.path.splitext(...
Collect configuration from yaml files This searches through a list of paths, expands to find all yaml or json files, and then parses each file.
625941dd21bff66bcd684c5d
@mock.patch('entrypoints.get_group_all') <NEW_LINE> def test_calls_entrypoints_creates_plugins_automaticaly(get_group_all): <NEW_LINE> <INDENT> get_group_all.return_value = [ create_entry_point_mock('T100'), create_entry_point_mock('T200'), ] <NEW_LINE> plugin_mgr = manager.PluginManager(namespace='testing.entrypoints'...
Verify that we create Plugins on instantiation.
625941dd3d592f4c4ed1d374
def gen_sentence_chain(StartMarkovNode): <NEW_LINE> <INDENT> MN=StartMarkovNode <NEW_LINE> Text=[] <NEW_LINE> while not MN.name in (".","!","?"): <NEW_LINE> <INDENT> Text.append(MN) <NEW_LINE> MN=MN.getNextRandom().get_To() <NEW_LINE> <DEDENT> Text.append(MN) <NEW_LINE> return Text
Like gen_sentence :param StartMarkovNode: :return: [MarkovNode(),...]
625941ddbe7bc26dc91cd908
def get_success_url(self, **kwargs): <NEW_LINE> <INDENT> msg = _("The email address change request was deleted.") <NEW_LINE> messages.add_message(self.request, messages.INFO, msg, fail_silently=True) <NEW_LINE> email_change_deleted.send(sender=self, request=self.request) <NEW_LINE> return reverse_lazy('change_email_cre...
Returns the URL to redirect to after an email address change request has been deleted by an user. The URL to redirect to can be customized by setting :setting:`EMAIL_CHANGE_DELETE_SUCCESS_REDIRECT_URL`.
625941dd8a43f66fc4b54370
@deterministic(plot=False) <NEW_LINE> def rate(s=switch, e=early_mean, l=late_mean): <NEW_LINE> <INDENT> out = np.empty(len(disasters_array)) <NEW_LINE> out[:s] = e <NEW_LINE> out[s:] = l <NEW_LINE> return out
Allocate appropriate mean to time series
625941ddcc0a2c11143dd19f
def problem06(n=100): <NEW_LINE> <INDENT> sum_of_squares = n * (n + 1) * (2 * n + 1) // 6 <NEW_LINE> square_of_sum = (n ** 4 + 2 * n ** 3 + n ** 2) // 4 <NEW_LINE> return square_of_sum - sum_of_squares
>>> problem06(10) 2640 >>> from helper import md5 >>> problem06() 25164150 >>> md5(_) '867380888952c39a131fe1d832246ecc'
625941dda934411ee37519a2
def load_module(module_name, path): <NEW_LINE> <INDENT> _logger.debug("load_module: importing module name %s", module_name) <NEW_LINE> spec = importlib.util.spec_from_file_location(module_name, path) <NEW_LINE> module = importlib.util.module_from_spec(spec) <NEW_LINE> spec.loader.exec_module(module) <NEW_LINE> return m...
Imports and returns a module from path for Python 3.5+.
625941dd711fe17d82542672
def test_22_upd_all(self): <NEW_LINE> <INDENT> self.brower.css_type('.layui-input.iosurl','zx02frmrbwz_pkdza_PeopleDailyController') <NEW_LINE> self.brower.css_click('.layui-btn.layui-btn-normal.submit')
编辑,输入iOS及Android地址,点击提交,提交后再次进入,确认已修改
625941dd9f2886367277ab99
def _vectorized_mahalanobis_distance2D(X, U, P): <NEW_LINE> <INDENT> diff = X[np.newaxis, :, :] - U[:, np.newaxis, :] <NEW_LINE> D = np.einsum('jik,jkl,jil->ij', diff, P, diff) <NEW_LINE> return D
Vectorized computation of two-dimensional Mahalanobis distance. Used to evaluate pdf of Gaussian mixtures. Parameters ---------- X : np.array, shape = (num_points, 2). Coordinates of points at which to evaluate density. U : np.array, shape = (num_means, 2). Coordinates of means in Gaussian mixture. P : np.ar...
625941dd566aa707497f4873
def loaded_items_done(self, g_items=None, unread_only=False): <NEW_LINE> <INDENT> unread_only = not not unread_only <NEW_LINE> self.continuation_id[unread_only] = self.g_feed.continuation <NEW_LINE> self.content_fetched[unread_only] = True <NEW_LINE> if not g_items: g_items = [] <NEW_LINE> can_have_more_unread = True <...
When g_items are created, we can create/update items here
625941dda4f1c619b28b0340
def error(): <NEW_LINE> <INDENT> ui.print_error_message('Wrong input type')
Runs print error message :return:
625941ddd8ef3951e324384c
def command_posti(bot, user, channel, args): <NEW_LINE> <INDENT> result = getstatus(args, count=1) <NEW_LINE> for line in result: <NEW_LINE> <INDENT> return bot.say(channel, line.encode("UTF-8"))
Get the latest status for a package
625941dd1f5feb6acb0c4e59
def isValid(self, s): <NEW_LINE> <INDENT> if not s: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> braList = [] <NEW_LINE> leftBraDic = {'{':'}','[':']','(':')'} <NEW_LINE> rightBraDic = {'}':'{',']':'[',')':'('} <NEW_LINE> for char in s: <NEW_LINE> <INDENT> if char in leftBraDic: <NEW_LINE> <INDENT> braList.appen...
:type s: str :rtype: bool
625941dd44b2445a339323a2
def giveReviewerLocalrole(self, state_change): <NEW_LINE> <INDENT> obj = state_change.object <NEW_LINE> owner = obj.Creator() <NEW_LINE> roles = list(obj.get_local_roles_for_userid(owner)) <NEW_LINE> roles = roles + ['Reviewer',] <NEW_LINE> obj.manage_setLocalRoles(owner, roles)
Give the object's owner the 'Reviewer' localrole.
625941dd4f88993c3716c373
def quit(self, widget=None): <NEW_LINE> <INDENT> raise widgets.ExitMainLoop()
Click handler for the Quit button.
625941dd56ac1b37e62644d8
def get_meta_data_configurations_with_http_info(self, dataset_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['dataset_id'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') ...
get_meta_data_configurations # noqa: E501 Get the all metadata configurations that exist for a user # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_meta_data_configurations_with_http_info(dataset_id, async_req...
625941ddd486a94d0b98e455
def __cmp__(self,other): <NEW_LINE> <INDENT> if len(self) < len(other): return -1 <NEW_LINE> if len(self) > len(other): return 1 <NEW_LINE> return cmp(self.bitset,other.bitset)
comparison, first be size and then by lexicographic order Intended for two Inst with the same var_count
625941dd91f36d47f21ac803
def _authenticate_service(self, pin, service_name): <NEW_LINE> <INDENT> data = { "serviceName": "%s" % service_name, "pin": "%s" % pin} <NEW_LINE> headers = self.connection.head.copy() <NEW_LINE> headers["Content-Type"] = "application/vnd.wirelesscar.ngtp.if9.AuthenticateRequest-v2+json; charset=utf-8" <NEW_LINE> retur...
Authenticate to specified service with the provided PIN
625941ddad47b63b2c50a28c
def yum_install_from_url(pkg_name, url): <NEW_LINE> <INDENT> from fabric.api import settings <NEW_LINE> from fabric.context_managers import hide <NEW_LINE> if is_package_installed(pkg_name) is False: <NEW_LINE> <INDENT> log_green("installing %s from %s" % (pkg_name, url)) <NEW_LINE> with settings(hide('warnings', 'runn...
installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package
625941dd5f7d997b87174da9
def test_invalid_mode_dtype(self): <NEW_LINE> <INDENT> station_id = '42' <NEW_LINE> prep = TripTimePreprocessor() <NEW_LINE> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> prep.set(station_id, 0)
Test passing wrong dtype in mode selection
625941dd8da39b475bd65285
def __init__(self, label=None, validators=None, filemanager = None, **kwargs): <NEW_LINE> <INDENT> self.filemanager = filemanager or FileManager() <NEW_LINE> self._should_delete = False <NEW_LINE> super(FileUploadField, self).__init__(label, validators, **kwargs)
Constructor. :param label: Display label :param validators: Validators
625941dd5510c4643540f6eb
def __init__(self, *args): <NEW_LINE> <INDENT> _math_linear.std_vector_double_swiginit(self, _math_linear.new_std_vector_double(*args))
__init__(std_vector_double self) -> std_vector_double __init__(std_vector_double self, std_vector_double other) -> std_vector_double __init__(std_vector_double self, std::vector< double >::size_type size) -> std_vector_double __init__(std_vector_double self, std::vector< double >::size_type size, std::vector< double >:...
625941ddd99f1b3c44c67898
def lemmatize(words): <NEW_LINE> <INDENT> lemmatizer = WordNetLemmatizer() <NEW_LINE> lemmas = [] <NEW_LINE> for word in words: <NEW_LINE> <INDENT> lemma = lemmatizer.lemmatize(word) <NEW_LINE> lemmas.append(lemma) <NEW_LINE> <DEDENT> return lemmas
Lemmatize verbs in list of tokenized words
625941ddadb09d7d5db6ca9c
def plot_history_alive_indiv(self, df, indiv): <NEW_LINE> <INDENT> plot_history_alive(self.bgf, int(self.individual['T']), self.sp_trans, 'OrderDate') <NEW_LINE> plt.savefig('ProbabilityAliveByHistory_Customer{}.png'.format(indiv)) <NEW_LINE> plt.close()
Plot history alive/active for single customer
625941ddf9cc0f698b140907
def equiv_alpha(ctrl, outputs={'loc'}): <NEW_LINE> <INDENT> blocks = [] <NEW_LINE> for y in ctrl.states(): <NEW_LINE> <INDENT> for block in blocks: <NEW_LINE> <INDENT> x = next(iter(block)) <NEW_LINE> if len(ctrl[x]) != len(ctrl[y]): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> labels_x = {frozenset([(key, label[ke...
compute equivalence classes. Parameters ---------- ctrl : mealy machine outputs : Tells which outputs are critical and should be kept. Given as a set of strings. Code is adapted from networkx.algorithms.minors.equivalenceclasses by Jeffry Finkelstein.
625941ddcdde0d52a9e53344
def updateValidateCount(self, ip, validate_count, speed=0): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> result = self.collection.update({'ip': ip}, { '$set': { 'is_validate': 1, 'validate_count': validate_count, 'speed': speed, 'validate_time': now() }}) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> l...
更新ip验证信息
625941dd4c3428357757c635
def show(self, **kwargs): <NEW_LINE> <INDENT> return self._get(**kwargs)
Keyword Arguments ----------------- start: string (required) Example: 2018-08-08T00:00:00Z The start of the search time period, based on the alert timestamp. ISO 8601 format is required. end: string (optional) Example: 2018-08-09T00:00:00Z The end of the search time period, based on the alert t...
625941dd30dc7b7665901c72
def friedman_features(): <NEW_LINE> <INDENT> data, target = make_friedman1(n_samples=500, n_features=10) <NEW_LINE> X_train, X_test = data[:-200], data[-200:] <NEW_LINE> y_train, y_test = target[:-200], target[-200:] <NEW_LINE> def linear_regression(feature_indices): <NEW_LINE> <INDENT> model = linear_model.LinearRegre...
Optimise and display the features for a friedman dataset using linear regression and various feature subset selection methods. :return: None
625941dd3346ee7daa2b307c
def collect_static_constants(): <NEW_LINE> <INDENT> for den in DEFS[t.S2CST_STAMP].values(): <NEW_LINE> <INDENT> STATIC_CONSTANTS[den.name] = den.sort
Fillup `STATIC_CONSTANTS` from previously collected defs. `DEFS` needs to be populated, although it may still be empty after that.
625941dd3eb6a72ae02ec7f3
def get_psp_ade_resnet50(**kwargs): <NEW_LINE> <INDENT> return get_psp('ade20k', 'resnet50', **kwargs)
Pyramid Scene Parsing Network Parameters ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The context in which to load the pretrained weights. root : str, default '~/.mxnet/models' Location for keeping the model parameters. Examples --...
625941dd097d151d1a223166
def parse(self, sensor_data): <NEW_LINE> <INDENT> dvs_events = np.frombuffer(sensor_data.raw_data, dtype=np.dtype([ ('x', np.uint16), ('y', np.uint16), ('t', np.int64), ('pol', np.bool)])) <NEW_LINE> dvs_img = np.zeros((sensor_data.height, sensor_data.width, 3), dtype=np.uint8) <NEW_LINE> dvs_img[dvs_events[:]['y'], dv...
Parses the DVSEvents into an RGB image
625941dd7cff6e4e81117c94
def cancelticket(): <NEW_LINE> <INDENT> cancelticket = Cancelticket() <NEW_LINE> answer_num = pass_captcha() <NEW_LINE> cancelticket.captcha(answer_num) <NEW_LINE> cancelticket.login() <NEW_LINE> cancelticket.auth() <NEW_LINE> querytype = input('请选择查询方式(1:按订票日期查询 2:按乘车日期查询):') <NEW_LINE> startdate = input('请输入查询起始日期(如:...
退票函数
625941dd099cdd3c635f0f68
def test_refresh(self): <NEW_LINE> <INDENT> self.assertEqual(1 + 1, 2)
Tests that server information is actually refreshed with this function.
625941dddc8b845886cb5845
def getBlockedBridgesFromSql(sql_rows): <NEW_LINE> <INDENT> blocked = {} <NEW_LINE> reachable = {} <NEW_LINE> def _shouldSkip(m1): <NEW_LINE> <INDENT> d = reachable if m1.verdict == BRIDGE_BLOCKED else blocked <NEW_LINE> maybe_conflicting = d.get(m1.fingerprint, None) <NEW_LINE> if maybe_conflicting is None: <NEW_LINE>...
Return a dictionary that maps bridge fingerprints to a list of bridges that are known to be blocked somewhere. :param list sql_rows: A list of tuples. Each tuple represents an SQL row. :rtype: dict :returns: A dictionary that maps bridge fingerprints (as strings) to a three-tuple that captures its blocking state:...
625941ddc432627299f04f56
def reverse_i(self): <NEW_LINE> <INDENT> if (self.head is None) or (self.head and self.head.next is None): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> prev = None <NEW_LINE> curr = self.head <NEW_LINE> new_head = None <NEW_LINE> while curr: <NEW_LINE> <INDENT> prev = curr <NEW_LINE> curr = curr.next <NEW_...
Iteratively reverses a list
625941ddec188e330fd5aaa8
def get_summary_protocol(self, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async'): <NEW_LINE> <INDENT> return self.get_summary_protocol_with_http_info(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.get_summary_protocol_with_http_info(**kwargs)...
get_summary_protocol # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_summary_protocol(async=True) >>> result = thread.get() :param async bool :param str operations: Specify operation(s) for which st...
625941dd596a897236089dcc
def __init__(self, root, nomfile, framefiles='', nounsfile=None, parse_fileid_xform=None, parse_corpus=None, encoding='latin1'): <NEW_LINE> <INDENT> if isinstance(framefiles, compat.string_types): <NEW_LINE> <INDENT> framefiles = find_corpus_fileids(root, framefiles) <NEW_LINE> <DEDENT> framefiles = list(framefiles) <N...
:param root: The root directory for this corpus. :param nomfile: The name of the file containing the predicate- argument annotations (relative to ``root``). :param framefiles: A list or regexp specifying the frameset fileids for this corpus. :param parse_fileid_xform: A transform that should be applied to t...
625941dd57b8e32f524837ab
def loader_setup(self, args): <NEW_LINE> <INDENT> train_sampler = DistributedSampler(self.train_data) <NEW_LINE> self.train_loader = DataLoader( self.train_data, batch_size=args.batch_size, sampler=train_sampler, num_workers=args.workers, pin_memory=args.pin_memory, drop_last=True) <NEW_LINE> logging.debug("Determining...
A distributed sampler has to be used
625941dd23849d37ff7b339c
def __getTransferClient(self): <NEW_LINE> <INDENT> if self.__transferClient: <NEW_LINE> <INDENT> return self.__transferClient <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return TransferClient(self.__serviceName, **self.__kwargs)
Get RPC client for TransferClient
625941dd01c39578d7e7514a
def testListRegex(self): <NEW_LINE> <INDENT> regex = kiwimark.LIST_REGEX = r"^([\s]*)[\*][\s]+(.*)" <NEW_LINE> m = re.search(regex, "There is no list markup here") <NEW_LINE> self.assertEqual(m, None) <NEW_LINE> m = re.search(regex, "* List entry") <NEW_LINE> self.assertNotEqual(len(m.groups()), 0) <NEW_LINE> self.asse...
Regex for list items, optionally indented by whitespace, and indicated by a single asterisk followed by whitespace and then the actual text of the item.
625941dd29b78933be1e59b6
def omp_destroy_lock(svar): <NEW_LINE> <INDENT> fomp_destroy_lock(svar)
Destroy a simple OpenMP lock. This sets the lock to an uninitialized state. Args: svar (:obj:`int`): An integer representing the lock. See Also: :meth:`wrf.omp_destroy_nest_lock`, :meth:`wrf.omp_init_lock`
625941dd4428ac0f6e5bab03
def conf_level_corr_inco(events, level): <NEW_LINE> <INDENT> corr_result = [0] * level <NEW_LINE> inco_result = [0] * level <NEW_LINE> if len(events) < 1: <NEW_LINE> <INDENT> raise Exception('events file is empty') <NEW_LINE> <DEDENT> for num in range(len(events)): <NEW_LINE> <INDENT> if np.isnan(events[num].__dict__['...
INPUTS: events: recog_events structure level: scalar value of level of confidence level available OUTPUTS: conf_level: a matrix of confidence percentage with subj for rows and levels for columns
625941dd07f4c71912b11793
def to_mwch(df): <NEW_LINE> <INDENT> if df['Age'] < 14: <NEW_LINE> <INDENT> return 'child' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return df['Sex']
Returns whether a passenger is a child and if not, just returns the gender of the passenger
625941dd004d5f362079a640
def lambda_test(p_values, df=1): <NEW_LINE> <INDENT> from scipy.stats import chi2 <NEW_LINE> assert np.max(p_values) <= 1 and np.min(p_values) >= 0, 'These do not appear to be p-values' <NEW_LINE> chi_sq_scores = chi2.ppf(1 - p_values, df) <NEW_LINE> return np.median(chi_sq_scores) / chi2.ppf(0.5, df)
Test for p-value inflation for hinting at population stratification or cryptic species. Paper: https://neurogenetics.qimrberghofer.edu.au/papers/Yang2011EJHG.pdf :param p_values: array of p-values :param df: Degrees of freedom for the Chi sq distribution :return: lambda gc
625941dd91f36d47f21ac804
def __addedLibrary(self, name): <NEW_LINE> <INDENT> for lib in self.__includes: <NEW_LINE> <INDENT> if lib.getPath() == name: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Determines if a library already added by another header :param name: path of library :type name: string :returns: true if the library already added, otherwise return false :rtype: boolean
625941dd56b00c62f0f14969
def __update_state__(self, state): <NEW_LINE> <INDENT> def __exception__(): <NEW_LINE> <INDENT> raise Exception('Can\'t transfer from ' + self.state + ' to ' + state) <NEW_LINE> <DEDENT> if state == "screen_checker": <NEW_LINE> <INDENT> if self.state == "initializing": <NEW_LINE> <INDENT> self.screen_checker = ScreenCh...
Applies given state
625941ddfb3f5b602dac39a5
def _start_continuous_evaluation(self): <NEW_LINE> <INDENT> _assert_eval_spec(self._eval_spec) <NEW_LINE> start_delay_secs = self._eval_spec.start_delay_secs <NEW_LINE> if start_delay_secs: <NEW_LINE> <INDENT> tf.compat.v1.logging.info('Waiting %f secs before starting eval.', start_delay_secs) <NEW_LINE> time.sleep(sta...
Repeatedly calls `Estimator` evaluate and export until training ends.
625941dd3cc13d1c6d3c7688
def get_scripting_id_list(self): <NEW_LINE> <INDENT> commands_info = self.get_commands_info() <NEW_LINE> menus_info = self.get_menus_info() <NEW_LINE> raw_scripting_id_list = [] <NEW_LINE> for command_info in commands_info: <NEW_LINE> <INDENT> raw_scripting_id_list.append(command_info['id']) <NEW_LINE> <DEDENT> for men...
Returns a unique list of scripting ids from the Commands and Menus info.
625941dd8e7ae83300e4b2dc
@memoize("raw: %s", time=1200) <NEW_LINE> def get_raw(files): <NEW_LINE> <INDENT> raw = [] <NEW_LINE> formatter = HtmlFormatter(noclasses=True) <NEW_LINE> max_i = 5 <NEW_LINE> for k, value in files.items(): <NEW_LINE> <INDENT> max_i -= 1 <NEW_LINE> if max_i is 0: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> gist = val...
Head to GitHub and get the raw content of the gist @param files - `files` key of the gist API response. @return: some html to embed within the description of the RSS item.
625941dd099cdd3c635f0f69
def get_latest_id(database): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> results = database.all() <NEW_LINE> <DEDENT> except Exception as exception: <NEW_LINE> <INDENT> raise DatabaseError("Query error", exception) <NEW_LINE> <DEDENT> if len(results) == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> results = ...
Get the ID of the most recent log. :param database: Database connection :type database: tinydb.database.TinyDB :return: log ID or None if none :rtype: str or unicode :raises DatabaseError if there are problems in connecting to the database
625941dd96565a6dacc8f9d9
def terminate(self): <NEW_LINE> <INDENT> self.traffic_finished = True <NEW_LINE> if self._traffic_process is not None: <NEW_LINE> <INDENT> LOG.debug("joining before terminate %s", self._traffic_process.name) <NEW_LINE> self._traffic_process.join(PROCESS_JOIN_TIMEOUT) <NEW_LINE> self._traffic_process.terminate() <NEW_LI...
After this method finishes, all traffic processes should stop. Mandatory. :return: True/False
625941dd6fece00bbac2da50
def search(self, query, mediatype=None, limit=None, fetch=False, timeout=None, verbose=False): <NEW_LINE> <INDENT> if not self._cached_connections and fetch: <NEW_LINE> <INDENT> if verbose: print("Retrieving servers", file=stderr) <NEW_LINE> _ = list(self.servers(verbose=verbose, timeout=timeout)) <NEW_LINE> servers = ...
Returns a generator of tuples: ( (PlexServer, PlexServer.search(*args, **kwargs) )
625941dd462c4b4f79d1d9df
def get_peaks_integrated_intensities(self, exp_number, scan_number, pt_list): <NEW_LINE> <INDENT> assert isinstance(exp_number, int) <NEW_LINE> assert isinstance(scan_number, int) <NEW_LINE> assert isinstance(pt_list, list) or pt_list is None <NEW_LINE> if pt_list is None: <NEW_LINE> <INDENT> status, pt_list = self.get...
Get the integrated intensities for a peak Requirements: 1. the Pts in the scan must have been merged and intensity is calculated. 2. experiment number and scan number must be integers Guarantees: get the x-y plot for intensities of all Pts. X is pt number, Y is for intensity :param exp_number: :param scan_number: :para...
625941dd4a966d76dd551321
def list_input_endpoints(kwargs=None, conn=None, call=None): <NEW_LINE> <INDENT> if call != 'function': <NEW_LINE> <INDENT> raise SaltCloudSystemExit( 'The list_input_endpoints function must be called with -f or --function.' ) <NEW_LINE> <DEDENT> if kwargs is None: <NEW_LINE> <INDENT> kwargs = {} <NEW_LINE> <DEDENT> if...
.. versionadded:: Beryllium List input endpoints associated with the deployment CLI Example: .. code-block:: bash salt-cloud -f list_input_endpoints my-azure service=myservice deployment=mydeployment
625941ddd4950a0f3b08c65a
def trailingZeroes(self, n): <NEW_LINE> <INDENT> res = 0 <NEW_LINE> while n > 0: <NEW_LINE> <INDENT> res += n // 5 <NEW_LINE> n //= 5 <NEW_LINE> <DEDENT> return res
:type n: int :rtype: int
625941dd63f4b57ef0001420
def jumpAndBackpedal(isMyNumber): <NEW_LINE> <INDENT> guess = 1 <NEW_LINE> if isMyNumber(guess) == 0: <NEW_LINE> <INDENT> return guess <NEW_LINE> <DEDENT> foundNumber = False <NEW_LINE> while not foundNumber: <NEW_LINE> <INDENT> sign = isMyNumber(guess) <NEW_LINE> if sign == -1: <NEW_LINE> <INDENT> guess *= 2 <NEW_LINE...
isMyNumber: Procedure that hides a secret number. It takes as a parameter one number and returns: * -1 if the number is less than the secret number * 0 if the number is equal to the secret number * 1 if the number is greater than the secret number returns: the secret number
625941dd30bbd722463cc0d8
def _reap_dead_workers(self): <NEW_LINE> <INDENT> if not self.is_stopping: <NEW_LINE> <INDENT> for worker in self.workers.values(): <NEW_LINE> <INDENT> if worker.failed: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if (worker.last_ping + datetime.timedelta(seconds=10)) < datetime.datetime.now(): <NEW_LINE> <INDENT>...
In effect, a worker thread which runs every ten seconds and checks for workers which are late pinging us. If there are any, invoke _investigate_worker_failure() in a deferred work item.
625941dd283ffb24f3c55c0d
def _residual(system, data, data_weight, prior, prior_weight, system_args, system_kwargs, jacobian, jacobian_args, jacobian_kwargs, reg_matrix, lm_matrix, data_indices): <NEW_LINE> <INDENT> @funtime <NEW_LINE> def residual_function(model): <NEW_LINE> <INDENT> pred = system(model,*system_args,**system_kwargs) <NEW_LINE>...
used for nonlin_lstsq
625941ddd6c5a1020814435c
def generate_frame_uuid(self): <NEW_LINE> <INDENT> frame_uuid = uuid.uuid4().hex[:8].upper() <NEW_LINE> return frame_uuid
generate unique frame IDs. This is realtively easy to do since all ID's for all motors are generated by a s ingle instance of FramePool. This is an 8-digit hexadecimal number which gives us 4,294,967,296 values before the sequence could repeat. Since each command takes ~10ms at least, it would take roughly 500 days for...
625941dd046cf37aa974d054
def seq(): <NEW_LINE> <INDENT> current_frame = inspect.currentframe().f_back <NEW_LINE> trace_string = "" <NEW_LINE> while current_frame.f_back: <NEW_LINE> <INDENT> trace_string = trace_string + current_frame.f_back.f_code.co_name <NEW_LINE> current_frame = current_frame.f_back <NEW_LINE> <DEDENT> return count...
Counts up sequentially from a number based on the current time :rtype int:
625941ddfff4ab517eb2f74d
def convertVttToSrt(self): <NEW_LINE> <INDENT> f = open(self.title + ".vtt", "r") <NEW_LINE> fh = open(self.title + ".srt", "w") <NEW_LINE> print("Creating ~ '%s.srt' ..." % (self.title)) <NEW_LINE> count = 1 <NEW_LINE> for line in f.readlines(): <NEW_LINE> <INDENT> if line[:6] == 'WEBVTT': <NEW_LINE> <INDENT> continu...
This function converts the VTT subtitle file into SRT format. Credits - http://goo.gl/XRllyy for the conversion method.
625941dd7b25080760e39767
def get_account(self): <NEW_LINE> <INDENT> return self.account
Get the account number, third BIP44 derivation number as str
625941ddf9cc0f698b140908
def evaluate(self, rollout: Rollout) -> Evaluator: <NEW_LINE> <INDENT> return QDistributionalModelEvaluator(self, rollout)
Evaluate model on a rollout
625941dd63f4b57ef0001421
def create(opt: dict, return_type: Union['tensor', 'numpy'], ) -> Union[torch.tensor, np.ndarray]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data_dict = { 'dummy': dummy, 'fake': fake }[opt['data']](**opt) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> data_dic...
Create data for a particular experiment
625941ddcc40096d61595c5e
def copy(self) -> GenericCodeBuilder: <NEW_LINE> <INDENT> builder = self.__class__.__new__(self.__class__) <NEW_LINE> builder.sections = self.sections.copy() <NEW_LINE> builder.optimization_level = self.optimization_level <NEW_LINE> return builder
copy the builder with his current state
625941ddb7558d58953c521e
def wait() : <NEW_LINE> <INDENT> global win <NEW_LINE> win.getMouse() <NEW_LINE> win.close()
Hold the display window open until the user clicks on it. After finishing a drawing, call "grid.wait()" to display it. The display will close when the user clicks on the grid display with the mouse. Args: none Returns: nothing
625941dd7c178a314d6ef773
def getWritingCredits(self): <NEW_LINE> <INDENT> return ""
Get the writing credits if present from video info tag. :return: [string] Writing credits
625941dd566aa707497f4874
def _find_disallowed_keywords(query: str) -> list: <NEW_LINE> <INDENT> disallowed = [ "alter", "call", "commit", "create", "delete", "drop", "explain", "grant", "insert", "lock", "merge", "rename", "revoke", "savepoint", "set", "rollback", "transaction", "truncate", "update", ] <NEW_LINE> query_token_set = set(token.lo...
Returns list of disallowed keywords in query if any exist. Keywords are disallowed if they can lead to modifications of the database or its settings. The disallowed keywords are: alter, call, commit, create, delete, drop, explain, grant, insert, lock, merge, rename, revoke, savepoint, set, rollback, transaction, tru...
625941ddcc40096d61595c5f
@jit_hardcore <NEW_LINE> def rotate_vector(rotation: quaternion, vector: np.ndarray, assume_normalized=False): <NEW_LINE> <INDENT> q1 = quaternion_from_scalar_and_vector(scalar=0.0, vector=vector) <NEW_LINE> return rotate_quaternion(rotation, q1, assume_normalized=assume_normalized)[1:4]
Rotate a 3D vector by the rotation stored in the Quaternion object. :param rotation: quaternion to use :param assume_normalized: assume rotation is unit quaternion :param vector: A 3-vector specified as numpy array :returns: The rotated vector returned as numpy array
625941dd097d151d1a223167
def __iter__(self) -> Iterator[str]: <NEW_LINE> <INDENT> return iter(self._stochastic_tensors)
Get an iterator of the stochastic node names.
625941dd91af0d3eaac9bd2b
def getAllTheLetters(begin='a', end='z'): <NEW_LINE> <INDENT> beginNum = ord(begin) <NEW_LINE> endNum = ord(end) <NEW_LINE> for number in xrange(beginNum, endNum+1): <NEW_LINE> <INDENT> yield chr(number)
Generates all letters a-z as strings
625941dd0383005118ecf8f1
def rcode(self): <NEW_LINE> <INDENT> return dns.rcode.from_flags(self.flags, self.ednsflags)
Return the rcode. @rtype: int
625941ddd58c6744b4257f6e
def configureEditor(self, parent_qw: QWidget, option: QStyleOptionViewItem, model_index: QModelIndex) -> QWidget: <NEW_LINE> <INDENT> cn_m = self.outlineViewObj() <NEW_LINE> key = self.key() <NEW_LINE> if key == 'eulerZ': <NEW_LINE> <INDENT> editor = QDoubleSpinBox(parent_qw) <NEW_LINE> tpb, _ = cn_m.getTwistPerBase() ...
Args: parent_qw: Description option: Description model_index: Description Returns: the widget used to edit the item specified by index for editing
625941dd15fb5d323cde0e23