code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
@deprecated_args(number='total', step=None) <NEW_LINE> def SearchPageGenerator(query, total=None, namespaces=None, site=None): <NEW_LINE> <INDENT> if site is None: <NEW_LINE> <INDENT> site = pywikibot.Site() <NEW_LINE> <DEDENT> for page in site.search(query, total=total, namespaces=namespaces): <NEW_LINE> <INDENT> yiel...
Yield pages from the MediaWiki internal search engine. @param total: Maximum number of pages to retrieve in total @type total: int @param site: Site for generator results. @type site: L{pywikibot.site.BaseSite}
625941e4379a373c97cfaf51
def do_gml_dump(self, line): <NEW_LINE> <INDENT> ofile = filename+".gml" <NEW_LINE> nx.write_gml(G, ofile) <NEW_LINE> print("[*] %s written!"%ofile)
Creates output as GML of access graph
625941e4c4546d3d9de72e42
def get_size_date_of_file(db_file): <NEW_LINE> <INDENT> file_date = time.ctime(os.path.getctime(db_file)) <NEW_LINE> file_date = file_date.split(' ')[2] + '.' + file_date.split(' ')[1] + '.' + file_date.split(' ')[4] <NEW_LINE> file_size = os.stat(db_file).st_size <NEW_LINE> final_size = 0 <NEW_LINE> return file_date, ...
Gets file size and date.
625941e4eab8aa0e5d26df64
def print_header(title): <NEW_LINE> <INDENT> print("") <NEW_LINE> print(title) <NEW_LINE> print('=' * 80)
Print a beautifull header
625941e457b8e32f524838a8
def __init__(self, name, default_amount, location, order_location, unavailable_color): <NEW_LINE> <INDENT> self.list.append(self) <NEW_LINE> self.name = name <NEW_LINE> self.default_amount = default_amount <NEW_LINE> self.location = location <NEW_LINE> self.order_location = order_location <NEW_LINE> self.unavailable_co...
:param name: name of ingredient :type name: str :param default_amount: starting amount of ingredient :type default_amount: int :param location: coordinates of the use button for ingredient :type location: tuple :param order_location: coordinates of the order button for ingredient :type order_location: tuple :param unav...
625941e4596a897236089ec6
def default_costmatrix(numstates, dtype=np.int): <NEW_LINE> <INDENT> return np.logical_not(np.identity(numstates)).astype(float)
a square array with zeroes along the diagonal, ones elsewhere
625941e494891a1f4081beb6
def offset_clear(): <NEW_LINE> <INDENT> pass
Clear strip offsets from the start and end frames
625941e401c39578d7e75246
def create_library(self, library_name): <NEW_LINE> <INDENT> e = OutputManager2.create_library(self.dir_path, library_name) <NEW_LINE> if isinstance(e, Error): <NEW_LINE> <INDENT> return e
Creates a new library :param library_name: str - library name :return: None
625941e466656f66f7cbc5b7
def rotate(g,angle): <NEW_LINE> <INDENT> phi = angle <NEW_LINE> go = g.copy() <NEW_LINE> x,y,z = [],[],[] <NEW_LINE> c,s = np.cos(phi), np.sin(phi) <NEW_LINE> for (ix,iy,iz) in zip(g.x,g.y,g.z): <NEW_LINE> <INDENT> x.append(c*ix + s*iy) <NEW_LINE> y.append(-s*ix + c*iy) <NEW_LINE> z.append(iz) <NEW_LINE> <DEDENT> go.x ...
Rotates a geometry
625941e48e05c05ec3eea782
def GET(self): <NEW_LINE> <INDENT> web.header('X-Frame-Options', 'SAMEORIGIN') <NEW_LINE> web.header('X-Content-Type-Options', 'nosniff') <NEW_LINE> web.header('X-XSS-Protection', '1') <NEW_LINE> if not session.validate_session(): <NEW_LINE> <INDENT> raise web.seeother('/login') <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN...
Handles the loading of the 'Edit Module Preclusions' page.
625941e4e5267d203edce0a2
@command('run') <NEW_LINE> def install(config): <NEW_LINE> <INDENT> package = "elasticsearch" <NEW_LINE> version = "6.3.2" <NEW_LINE> executable = "{}-{}/bin/elasticsearch".format(package, version) <NEW_LINE> os.execl(executable, executable)
run elastic search in current directory
625941e4283ffb24f3c55d08
def jsonify(self): <NEW_LINE> <INDENT> data = [] <NEW_LINE> for node in self.nodes: <NEW_LINE> <INDENT> data.append(node.jsonify()) <NEW_LINE> <DEDENT> return data
Get the network in json format. :return: The network as a dict in json format.
625941e456b00c62f0f14a66
def STGAR(self): <NEW_LINE> <INDENT> data = { 's_request': 'STGAR', 's_submit': self.semester['submit'], } <NEW_LINE> self.get_nonce(self.url["semester"]) <NEW_LINE> return self.submit(self.url["registration"], data, "POST")
Get access to registration
625941e4dc8b845886cb5941
def test_composite_adapter_init_with_adapters(self, dummy_param): <NEW_LINE> <INDENT> dimension_addition = DimensionAddition(dummy_param) <NEW_LINE> dimension_deletion = DimensionDeletion(dummy_param) <NEW_LINE> composite_adapter = CompositeAdapter(dimension_addition, dimension_deletion) <NEW_LINE> assert len(composite...
Test initialization of :class:`kleio.core.evc.adapters.CompositeAdapter` with valid adapters
625941e4b7558d58953c5316
def update(self, person): <NEW_LINE> <INDENT> cursor = self._cnx.cursor() <NEW_LINE> print(person.get_creation_date()) <NEW_LINE> command = "UPDATE person " + "SET creation_date=%s, name=%s, google_id=%s, role_id=%s WHERE person_id=%s" <NEW_LINE> data = (person.get_creation_date(), person.get_name(), person.get_google_...
Wiederholtes Schreiben eines Objekts in die Datenbank. :param person
625941e450812a4eaa59c728
def isPalindrome(self, s): <NEW_LINE> <INDENT> new_s = [] <NEW_LINE> for char in s: <NEW_LINE> <INDENT> if char.isalpha() or char.isdigit(): <NEW_LINE> <INDENT> new_s.append(char.lower()) <NEW_LINE> <DEDENT> <DEDENT> length = len(new_s) <NEW_LINE> half_length = length // 2 <NEW_LINE> for i in range(half_length): <NEW_L...
:type s: str :rtype: bool
625941e4442bda511e8be81d
def is_special_view(view): <NEW_LINE> <INDENT> return view.window() and view.id() != view.window().active_view().id()
Determine if the current view is a special view. Special views are mostly referring to panels. They are different from normal views in that they cannot be the active_view of their windows, therefore their ids shouldn't be equal to the current view id.
625941e4a05bb46b383ecc29
def existing_url(module): <NEW_LINE> <INDENT> url_base = "/axapi/v3/partition/{partition_name}/shared-vlan" <NEW_LINE> f_dict = {} <NEW_LINE> f_dict["partition_name"] = module.params["partition_name"] <NEW_LINE> return url_base.format(**f_dict)
Return the URL for an existing resource
625941e44f88993c3716c46e
def fibonnaci_prob(): <NEW_LINE> <INDENT> def fib_i(n): <NEW_LINE> <INDENT> if n <= 1: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> ret = [0,1] <NEW_LINE> for i in range(n-1): <NEW_LINE> <INDENT> ret.append(ret[-2] + ret[-1]) <NEW_LINE> <DEDENT> return ret[-1] <NEW_LINE> <DEDENT> def fib_r(n): <NEW_LINE> <INDENT> i...
Implement a Fibonnaci Sequence in three different ways: - Recursively - Dynamically (Using Memoization to store results) - Iteratively
625941e4ec188e330fd5aba2
def get_genre_details(self, genre_id): <NEW_LINE> <INDENT> g = self.__db.genres.find_one({"_id": ObjectId(genre_id)}) <NEW_LINE> return Genre.from_mongo_result(g)
Get the details of a genre. :param genre_id: The object id of the genre to be retrieved. :returns: An object of type Genre containing the genre.
625941e456ac1b37e62645d3
def scipy_slsqp(project,x0=None,xb=None,its=100,grads=True): <NEW_LINE> <INDENT> from scipy.optimize import fmin_slsqp <NEW_LINE> if x0 is None: x0 = [] <NEW_LINE> if xb is None: xb = [] <NEW_LINE> func = obj_f <NEW_LINE> f_eqcons = con_ceq <NEW_LINE> f_ieqcons = con_cieq <NEW_LINE> if project.conf...
result = scipy_slsqp(project,x0=[],xb=[],its=100) Runs the Scipy implementation of SLSQP with an SU2 project Inputs: project - an SU2 project x0 - optional, initial guess xb - optional, design variable bounds its - max outer iterations, default 100 Outputs: result - the outputs from...
625941e47b25080760e39862
def get_played_indexes(player, board): <NEW_LINE> <INDENT> indexes = [] <NEW_LINE> for counter, value in enumerate(list(board)): <NEW_LINE> <INDENT> if value == player: <NEW_LINE> <INDENT> indexes.append(counter) <NEW_LINE> <DEDENT> <DEDENT> return set(indexes)
Get indexes of played positions of a player.
625941e4187af65679ca552b
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, QualityIndicator): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict()
Returns true if both objects are equal
625941e4091ae35668667362
def get_silenced(self, rule: Rule, silence_key=None) -> Optional[tuple]: <NEW_LINE> <INDENT> cache_key = silence_key or '_silence' <NEW_LINE> if cache_key in rule.data.silence_cache: <NEW_LINE> <INDENT> return rule.data.silence_cache[cache_key] <NEW_LINE> <DEDENT> if self.mode in ['debug', 'test']: <NEW_LINE> <INDENT> ...
Look up whether the rule and silence key exists.
625941e4287bf620b61d3e6c
def chunker(seq, size): <NEW_LINE> <INDENT> return (seq[pos:pos + size] for pos in xrange(0, len(seq), size))
Return a generator which breaks *seq* in to *size*-length chunks.
625941e4d53ae8145f87a673
def get_max_matches_per_player( position="all", season=CURRENT_SEASON, gameweek=NEXT_GAMEWEEK, dbsession=None ): <NEW_LINE> <INDENT> players = list_players( position=position, season=season, gameweek=gameweek, dbsession=dbsession ) <NEW_LINE> max_matches = 0 <NEW_LINE> for p in players: <NEW_LINE> <INDENT> num_match = ...
can be used e.g. in bpl_interface.get_player_history_df to help avoid a ragged dataframe.
625941e4be8e80087fb21048
def test_zipcode_with_more_than_5_digits(self): <NEW_LINE> <INDENT> actual = finding_political_donors_by_date_and_by_zip.is_zip_valid('100216') <NEW_LINE> expected = True <NEW_LINE> self.assertEqual(expected, actual)
Test to see if zipcode more than 5 digits is considered valid
625941e47cff6e4e81117d91
def t_GT(t): <NEW_LINE> <INDENT> t.value = Operator_Token( '>' ) <NEW_LINE> return t
>
625941e44e696a04525c9858
def cmdExit(args, flags, context): <NEW_LINE> <INDENT> if args and not type(args[0]) is int: <NEW_LINE> <INDENT> raise ArgumentError("The argument supplied is of incorrect type.") <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> sys.exit(args[0]) <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> sys.exit(0)
Exit shell
625941e4f548e778e58cd98a
def usergroups_list(self, **kwargs) -> Union[Future, SlackResponse]: <NEW_LINE> <INDENT> return self.api_call("usergroups.list", http_verb="GET", params=kwargs)
List all User Groups for a team
625941e4a17c0f6771cbe45a
def _CaptureEnvironmentLabels(self): <NEW_LINE> <INDENT> if 'labels' not in self.breakpoint: <NEW_LINE> <INDENT> self.breakpoint['labels'] = {} <NEW_LINE> <DEDENT> if callable(breakpoint_labels_collector): <NEW_LINE> <INDENT> for (key, value) in six.iteritems(breakpoint_labels_collector()): <NEW_LINE> <INDENT> self._St...
Captures information about the environment, if possible.
625941e4435de62698dfe058
@cache_definition <NEW_LINE> def DefineSort2Elements(T: Kind, cmp_component: Callable[[DefineCircuitKind], Kind] = id): <NEW_LINE> <INDENT> class _Sort2Elements(Circuit): <NEW_LINE> <INDENT> name = "Sort2Elements_T{}".format(cleanName(str(T))) <NEW_LINE> IO = ['I0', In(T), 'I1', In(T), 'O0', Out(T), 'O1', Out(T)] + Clo...
Given two elements each of type T, emit the smaller one on O0 and the larger one on O1. cmp_component is a function that selects the components of each T to compare. Smaller and larger is determined by < on the flattened bits of each elements. Note that the T passed to this operator just the Magma type each clock cycl...
625941e466656f66f7cbc5b8
def apply_maps_to_modelform_fields(fields, maps, default_options=None, default_template=None, default_field_class=None): <NEW_LINE> <INDENT> if default_field_class is None: <NEW_LINE> <INDENT> default_field_class = MapField <NEW_LINE> <DEDENT> map_field_names = (name for name,field in fields.iteritems() if isinstance(f...
Rearranges fields to match those defined in ``maps``. ``maps`` is a list of [field_list, options_dict] pairs. For each pair, a new map field is created that contans all the fields in ``field_list``.
625941e4fb3f5b602dac3aa3
def make_data_provider(self, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError("Not implemented.")
Creates DataProvider instance for this input pipeline. Additional keyword arguments are passed to the DataProvider.
625941e463f4b57ef0001519
def category_from_parents(self, parents): <NEW_LINE> <INDENT> from sage.structure.parent import Parent <NEW_LINE> assert(all(isinstance(parent, Parent) for parent in parents)) <NEW_LINE> return self.category_from_categories(tuple(set(parent.category() for parent in parents)))
Return the category of `F(A,B,...)` for `A,B,...` parents. INPUT: - self: a functor F - parents: a list (or iterable) of parents. EXAMPLES:: sage: E = CombinatorialFreeModule(QQ, ["a", "b", "c"]) sage: tensor.category_from_parents((E, E, E)) Category of tensor products of modules with basis over Ratio...
625941e4d8ef3951e3243949
def list_methods(self): <NEW_LINE> <INDENT> return self._methods
list_methods.
625941e43539df3088e2e756
def _handle_object_tracks(self, frame, contours): <NEW_LINE> <INDENT> objects_found = self._find_objects_in_binary_image(contours) <NEW_LINE> if objects_found is None: <NEW_LINE> <INDENT> self._end_current_tracks() <NEW_LINE> return <NEW_LINE> <DEDENT> if len(self.tracks) == 0: <NEW_LINE> <INDENT> self.tracks = [Object...
analyzes objects in a single _frame and tries to add them to previous tracks
625941e4f7d966606f6aa414
def flow(self, x, y=None, target_label=0, meta_label=None, batch_size=32, shuffle=True, seed=None, save_to_dir=None, save_prefix='', save_format='png', subset=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> y = y.copy() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> import copy <NEW_LINE> y = copy.deepcopy(y) <NEW...
Takes numpy data & label arrays, and generates batches of augmented/normalized data. # Arguments x: data. Should have rank 4. In case of grayscale data, the channels axis should have value 1, and in case of RGB data, it should have value 3. y: labels. batch_size: int (de...
625941e463d6d428bbe448fc
def getAPIprefix() -> str: <NEW_LINE> <INDENT> prefixes = ["https://lookup.dbpedia.org/api/search/PrefixSearch?QueryString=", "http://lookup.dbpedia.org/api/search/PrefixSearch?QueryString=", "https://lookup.dbpedia.org/api/prefix?query=", "http://lookup.dbpedia.org/api/prefix?query=", "http://akswnc7.informatik.uni-le...
Detect functioning DBpedia lookup API
625941e42c8b7c6e89b35bc9
def find_executable(executable): <NEW_LINE> <INDENT> for path in os.environ.get('PATH', '').split(os.pathsep): <NEW_LINE> <INDENT> path = os.path.abspath(path) <NEW_LINE> executable_path = os.path.join(path, executable) <NEW_LINE> if os.path.isfile(executable_path): <NEW_LINE> <INDENT> return executable_path
Scan PATH for an executable.
625941e421a7993f00bc8102
def getBestRevision(self, proxy, lang=None): <NEW_LINE> <INDENT> language_revs = proxy._getLanguageRevisions() <NEW_LINE> languages = language_revs.keys() <NEW_LINE> languages_count = len(languages) <NEW_LINE> if languages_count == 0: <NEW_LINE> <INDENT> return None, None <NEW_LINE> <DEDENT> if lang == 'default': <NEW_...
Get the best language and revision for a proxy. Returns lang, rev. A priority is made for the language : - Use the 'lang' parameter (can be 'default') - Use a REQUEST or SESSION override set on that proxy - Use the translation_service selected language - Use the portal default language - Use the proxy defaul...
625941e426068e7796caf0f0
def domain(resource, res_config): <NEW_LINE> <INDENT> DOMAIN[resource] = res_config
Register domain resource
625941e401c39578d7e75247
def get_bias_towards(self, on="hate"): <NEW_LINE> <INDENT> df = self.get_labelled_comments(on) <NEW_LINE> support = df.notna().sum(axis=1) <NEW_LINE> return df.sum(axis=1, skipna=True) / support
Get bias towards positive class Arguments: --------- on: "string" Must be one of - hate - MUJER - LGBTI - RACISMO - POBREZA - DISCAPACIDAD - POLITICA - ASPECTO - CRIMINAL - OTROS
625941e4090684286d50f0f7
def _init_encoder(self,): <NEW_LINE> <INDENT> if not self.encode_include_input: <NEW_LINE> <INDENT> self.encoder_input_dims = self.nDims[:-1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.encoder_input_dims = [ii for ii in self.nDims[:-1] ] <NEW_LINE> self.encoder_input_dims[0] += self.Us_all[0].shape[1] <NEW_LINE...
Init encoder
625941e4090684286d50f0f6
def phi_1(time, omega, tau): <NEW_LINE> <INDENT> return np.ones(len(time))
Returns 1 for all times; sets the coarse detail in the wavelet transform. Note that the parameters omega and tau have no use here; we only include them to loop over the basis functions. Parameters ---------- time : array-like Times of observations omega : float angular frequency in radians per unit time. tau...
625941e45510c4643540f7e5
@register.inclusion_tag('friendship/templatetags/sent_requests.html') <NEW_LINE> def sent_requests(user): <NEW_LINE> <INDENT> return {'sent_requests': Friend.objects.sent_requests(user)}
Inclusion tag to display sent requests
625941e4aad79263cf390e53
def to_cnf(expr): <NEW_LINE> <INDENT> bexpr = ensure_bexpr(expr) <NEW_LINE> return BooleanExpression(bexpr.tree.to_cnf())
Convert an expression to conjunctive normal form (CNF). This transformation only guarantees to produce an equivalent form of the passed expression in conjunctive normal form; the transformed expression may be an inefficent representation of the passed expression. :param expr: The expression to transform. :type expr: ...
625941e44e696a04525c9859
def on_channel_open(self, channel): <NEW_LINE> <INDENT> log.info('Channel opened') <NEW_LINE> self.channel = channel <NEW_LINE> self.add_on_channel_close_callback() <NEW_LINE> self.create_bindings()
Callback invoked when a new channel has been opened. :param channel: the newly created channel :type channel: :class:`pika.channel.Channel`
625941e4f7d966606f6aa415
def get_company_by_title(self, title, chat_id=1): <NEW_LINE> <INDENT> call = self.bx24.call('crm.company.list', {'FILTER': {'>=TITLE': title}}, {'SELECT': ['ID', 'TITLE']}) <NEW_LINE> result = call['result'] <NEW_LINE> message = '' <NEW_LINE> for item in result: <NEW_LINE> <INDENT> message += '[send=/cmp '+item['ID']+'...
Ищет подхоящие комании по названию :param title: company title :param chat_id: user or chat ID :return: message in chat
625941e4b7558d58953c5317
def run_topographic_residual_correction(self, step_name): <NEW_LINE> <INDENT> geom_file = ut.check_loaded_dataset(self.workDir, print_msg=False)[2] <NEW_LINE> fnames = self.get_timeseries_filename(self.template, self.workDir)[step_name] <NEW_LINE> in_file = fnames['input'] <NEW_LINE> out_file = fnames['output'] <NEW_LI...
step - correct_topography Topographic residual (DEM error) correction (optional).
625941e4ac7a0e7691ed44d0
def aStarSearch(problem, heuristic): <NEW_LINE> <INDENT> from util import PriorityQueue <NEW_LINE> from game import Directions <NEW_LINE> import heapq <NEW_LINE> path = [] <NEW_LINE> action = [] <NEW_LINE> relation = {} <NEW_LINE> priQueue = PriorityQueue() <NEW_LINE> startState = problem.getStartState() <NEW_LINE> now...
Search the node that has the lowest combined cost and heuristic first.
625941e4097d151d1a223263
def correct_url(self, url: str) -> str: <NEW_LINE> <INDENT> if "http://" not in url: <NEW_LINE> <INDENT> if "https://" not in url: <NEW_LINE> <INDENT> url = "http://%s" % url <NEW_LINE> <DEDENT> <DEDENT> _url_split = url.split("/") <NEW_LINE> if len(_url_split) < 5: <NEW_LINE> <INDENT> raise URLError('Unknown URL forma...
Perform the necessary steps to correct the supplied _url so the parser can work with it
625941e47c178a314d6ef871
def update_action_features(self, belief_state, action_track, action): <NEW_LINE> <INDENT> self.all_features[action] = self.calc_features(belief_state, action_track, action)
Update to a single bandit's feature, used when self or opponent pull it.
625941e42ae34c7f2600d53c
def get_name(self, ip_addr, port): <NEW_LINE> <INDENT> if not self.active: <NEW_LINE> <INDENT> return ip_addr <NEW_LINE> <DEDENT> for ip_port, name in self.proxy_db.items(): <NEW_LINE> <INDENT> if ip_port == (ip_addr, port): <NEW_LINE> <INDENT> return '%s(%s)' % (ip_addr, name) <NEW_LINE> <DEDENT> <DEDENT> return ip_ad...
Method used by the tcpiplib printing to associate ip:port to a switch name Args: ip_addr: IP address port: TCP port
625941e4167d2b6e31218fa0
def low_pass_filter(w, w0, n=100): <NEW_LINE> <INDENT> rv = 1.0 / (1.0 + np.exp((w-w0)/n) + 1E-6) <NEW_LINE> rv = rv + rv[::-1] <NEW_LINE> return rv
gets Fourier high-pass filter. Symmetric for Fourier domain
625941e4a8ecb033257d34d7
def create_temp_file(file_name): <NEW_LINE> <INDENT> if os.path.getsize(file_name) > 97867090: <NEW_LINE> <INDENT> num_temp_file = 0 <NEW_LINE> while True: <NEW_LINE> <INDENT> if os.path.exists(file_name + '.tmp' + str(num_temp_file) + '.iq'): <NEW_LINE> <INDENT> num_temp_file += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
Функция создает новый временный файл для демодулятора и аозвращает его имя.
625941e492d797404e304597
def add_request(criteria='', file_type='', requester=None, content_type='', description='', language=None, tz=None): <NEW_LINE> <INDENT> if language is None: <NEW_LINE> <INDENT> language = translation.get_language() <NEW_LINE> <DEDENT> if tz is None: <NEW_LINE> <INDENT> tz = timezone.get_current_timezone_name() <NEW_LI...
Add a file request. :param criteria: the criteria that should be used to compose the file :type criteria: str :param file_type: the type of file to generate, e.g. "report-a" or "report-b" :type file_type: str :param requester: the instance of the user performing the requester :param content_type: the content or mime t...
625941e4cc40096d61595d5b
def load_diabetes_final_table_for_prescription(trial_id, test_ratio=0.2): <NEW_LINE> <INDENT> df = pd.read_pickle(get_base_path() + '/preprocessed_data/presription_shared/diabetes.p') <NEW_LINE> prescription_columns = ['prescription_oral', 'prescription_injectable'] <NEW_LINE> hist_pres_columns = ['hist_prescription_or...
load preprocess diabetes data :param trial_id: trial id :param test_ratio: ratio of test data :return: train_all_x, train_all_y, train_all_z, train_all_u, test_x, test_y, test_z, test_u
625941e4adb09d7d5db6cb98
def setsebools(pairs, persist=False): <NEW_LINE> <INDENT> if not isinstance(pairs, dict): <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> if persist: <NEW_LINE> <INDENT> cmd = 'setsebool -P ' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> cmd = 'setsebool ' <NEW_LINE> <DEDENT> for boolean, value in pairs.items(): <NEW...
Set the value of multiple booleans CLI Example:: salt '*' selinux.setsebools '{virt_use_usb: on, squid_use_tproxy: off}'
625941e49b70327d1c4e11e3
def get_date_range(df_source): <NEW_LINE> <INDENT> high = df_source.max()['scheduled_day'] <NEW_LINE> low = df_source.min()['scheduled_day'] <NEW_LINE> return (low, high)
return oldest and most recent date
625941e4cad5886f8bd273e5
def __init__(self): <NEW_LINE> <INDENT> self.SecurityService = None <NEW_LINE> self.MonitorService = None <NEW_LINE> self.AutomationService = None
:param SecurityService: 开启云安全服务。若不指定该参数,则默认开启云安全服务。 :type SecurityService: :class:`tencentcloud.batch.v20170312.models.RunSecurityServiceEnabled` :param MonitorService: 开启云监控服务。若不指定该参数,则默认开启云监控服务。 :type MonitorService: :class:`tencentcloud.batch.v20170312.models.RunMonitorServiceEnabled` :param AutomationService: 开启云自动...
625941e491f36d47f21ac902
def __handle_open_option(self, value, create): <NEW_LINE> <INDENT> if value is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> value = conv_to_unicode(value, sys.stdin.encoding) <NEW_LINE> db_path = self.__deduce_db_path(value) <NEW_LINE> if db_path: <NEW_LINE> <INDENT> if not self.check_db(db_path, self.forc...
Handle the "-O" or "--open" and "-C" or "--create" options. Only Family trees or a dir with a family tree can be opened. If create is True, then create the tree if it doesn't exist.
625941e44c3428357757c731
def set_difficulty(self, level): <NEW_LINE> <INDENT> self.level = level <NEW_LINE> self.speed = { 1:1, 2:2, 3:5, 4:10 }[level]
Set serpent speed.
625941e40a50d4780f6672a1
def load_and_prepare_data(): <NEW_LINE> <INDENT> data_training = pickle.load( open(DATASET_TRAINING, "rb" ) ) <NEW_LINE> print(len(data_training)) <NEW_LINE> data_training = prepare_input(data_training) <NEW_LINE> data_dev= pickle.load( open(DATASET_DEV, "rb" ) ) <NEW_LINE> print(len(data_dev)) <NEW_LINE> data_dev= pre...
Load data, and split training and validation set :return: train and dev (validation) list
625941e4d486a94d0b98e552
def class_days(self, klass): <NEW_LINE> <INDENT> daymap = self.class_days_periods[klass] <NEW_LINE> weektags = [] <NEW_LINE> for day in self.days: <NEW_LINE> <INDENT> dayperiods = daymap[day] <NEW_LINE> daytags = [] <NEW_LINE> for p in self.periods: <NEW_LINE> <INDENT> daytags.append("1" if dayperiods[p] else "0") <NEW...
Return a "timeoff" entry for the given class.
625941e423849d37ff7b3498
def ListDirectory(self, path): <NEW_LINE> <INDENT> path = self._NormalizeDirectoryPath(path) <NEW_LINE> url = self._ToFileURL('dir', {}) <NEW_LINE> resp = shared.Fetch(self.access_key, url, method='GET') <NEW_LINE> if resp.status_code != httplib.OK: <NEW_LINE> <INDENT> shared.e('{0} status code during HTTP GET on {1}' ...
List the current directory or tree contents. Args: path: The directory path to list or '' to access the entire tree. Returns: A list of files in the specified directory or tree.
625941e4bd1bec0571d90a3a
def _plot_figure(self, data_): <NEW_LINE> <INDENT> _x = data_.get('x', array([])) <NEW_LINE> _y = array(data_.get('y', [array([])])) <NEW_LINE> _type = data_.get('type') <NEW_LINE> _x_ref = data_.get('x_ref', 0) <NEW_LINE> _y_ref = data_.get('y_ref', 100) <NEW_LINE> if not _type: <NEW_LINE> <INDENT> raise ValueError("p...
plot payoff curve using given data :param data_: a dict consists with x (numpy array) and y (numpy array) in same dimension
625941e415baa723493c4384
def append(self, key, value): <NEW_LINE> <INDENT> self._container.append(key, value) <NEW_LINE> self._save()
Append a value to a list responding to a key. Keys: "user.email" means root [ "user" ] [ "email" ] This method is thread safe.
625941e4bd1bec0571d90a3b
def _compute_K(s, t, k, l, K_prime): <NEW_LINE> <INDENT> K_val = 0 <NEW_LINE> for m in xrange(len(s)+1): <NEW_LINE> <INDENT> if min(len(s[:m]), len(t)) < k: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> K_val += l**2 * sum([K_prime[k-1][len(s[:m])-1][j] for j in _find_all_char_indices(s[m-1], t)]) <NEW_LINE> <DEDENT...
Compute and return the K in a recursive manner using precomputed K'
625941e491af0d3eaac9be28
def dispatch_queue_metrics(queue, vhost): <NEW_LINE> <INDENT> vhost_name = PLUGIN_CONFIG['collectd_host'] <NEW_LINE> for name in QUEUE_STATS: <NEW_LINE> <INDENT> values = list((queue.get(name, 0),)) <NEW_LINE> dispatch_values(values, vhost_name, 'queues', queue['name'], 'rabbitmq_%s' % name) <NEW_LINE> <DEDENT> for nam...
Dispatches queue metrics for queue in vhost
625941e407f4c71912b11891
def get_next_color(self): <NEW_LINE> <INDENT> self.colour_ix += 1 <NEW_LINE> if self.colour_ix >= len(self.colors): self.colour_ix = 0 <NEW_LINE> color = self.colors[self.colour_ix] <NEW_LINE> return color
Gets the next color in list self.colors. If it gets to the end then it starts from beginning
625941e4d4950a0f3b08c755
def make_dir(outputdirname): <NEW_LINE> <INDENT> if not os.path.exists(outputdirname): <NEW_LINE> <INDENT> os.makedirs(outputdirname) <NEW_LINE> <DEDENT> return
making file if not already present
625941e492d797404e304598
def __init__(self, _configuration=None, **kwargs): <NEW_LINE> <INDENT> if _configuration is None: <NEW_LINE> <INDENT> _configuration = Configuration() <NEW_LINE> <DEDENT> self._configuration = _configuration <NEW_LINE> self._contacts = None <NEW_LINE> self._end_position = None <NEW_LINE> self._next_uri = None <NEW_LINE...
ContactGetResponse - a model defined in Swagger
625941e4009cb60464c637ba
def p_terms_list(t): <NEW_LINE> <INDENT> t[0] = [t[2]]
terms : SQOPEN factor SQCLOSE
625941e4009cb60464c637bb
def _generate_combustion_module(self): <NEW_LINE> <INDENT> if self.initialization_object: <NEW_LINE> <INDENT> obj = CombustionObject(**self.initialization_object.combustion_parameters) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> warnings.warn("Set the CombustionObject to None, not representative object. \n") <NEW_LIN...
_generate_combustion_module calls the constructor of the Combustion class and initializes it :return: Combustion object
625941e4d6c5a1020814445a
def login(self, user, password='test123'): <NEW_LINE> <INDENT> self.client.login(username=user.username, password=password)
Performs a login for the given user. By convention we always use ``test123`` in our test fixutres. When you create your users with the UserFactory, that password will be set by default. If you must you can provide a password to this method in order to override the ``test123`` default. :param user: A ``User`` instanc...
625941e4d8ef3951e324394a
def pick_sf_b(): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> sf1 = np.random.choice(SFACTORS, 1)[0] <NEW_LINE> sf2 = np.random.choice(SFACTORS, 1)[0] <NEW_LINE> bw1 = np.random.choice(BANDWIDTHS, 1)[0] <NEW_LINE> bw2 = np.random.choice(BANDWIDTHS, 1)[0] <NEW_LINE> if is_orthogonal(sf1, bw1, sf2, bw2): <NEW_LINE...
Generates orthogonal pair of (SF, B) :return: Two orthogonal (SF, B) pairs
625941e4be383301e01b588a
def pairwise_metric_groups(args_dict_1, args_dict_2, metric): <NEW_LINE> <INDENT> raise NotImplementedError()
For when there are two separate groups to compare
625941e48a349b6b435e857f
def scrape(args): <NEW_LINE> <INDENT> from trajectory.models import University, Department, Course <NEW_LINE> from trajectory.models.meta import session <NEW_LINE> import logging <NEW_LINE> import os <NEW_LINE> from importlib import import_module <NEW_LINE> log = logging.getLogger("root") <NEW_LINE> log.info("Selected ...
Routes scraping to the appropriate scraper module.
625941e471ff763f4b549a9f
def start(self): <NEW_LINE> <INDENT> self.logger.info('Start capturing') <NEW_LINE> if self.runner: <NEW_LINE> <INDENT> if not self.runner.is_running: <NEW_LINE> <INDENT> self.runner.start() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> message = 'Calling start() before stop() has been called. Data up to this point wil...
Start capturing. configure() must have been called before
625941e424f1403a92600f6f
def _exec_device_function(self, device_function): <NEW_LINE> <INDENT> self.clear_last_error() <NEW_LINE> result = False <NEW_LINE> for r in range(PyKasaAdapterThread.RETRY_COUNT): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._loop.run_until_complete(device_function()) <NEW_LINE> result = True <NEW_LINE> <DEDENT> e...
Execute a device function with retries :param device_function: The function to be executed :return:
625941e43eb6a72ae02ec8f4
def update_status(**kw): <NEW_LINE> <INDENT> import json <NEW_LINE> if _out_dir: <NEW_LINE> <INDENT> status = dict( (k, v) for k, v in kw.items() if k in ('start_time', 'end_time', 'exit_code', 'pid') ) <NEW_LINE> _log('Updating the status:\n{0}'.format(json.dumps(status))) <NEW_LINE> with open(os.path.join(_out_dir, '...
This function will updates process stats Args: kwargs - Process configuration details Returns: None
625941e4d18da76e235328e7
def GetNumberOfThreads(): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> for t in threading.enumerate(): <NEW_LINE> <INDENT> i+=1 <NEW_LINE> <DEDENT> return i
Gets the number of active threads
625941e41b99ca400220aebf
def post_process(self, collapsed_cube, data_result, coords, **kwargs): <NEW_LINE> <INDENT> cubes = iris.cube.CubeList() <NEW_LINE> if self._arg not in kwargs: <NEW_LINE> <INDENT> msg = '{} aggregator requires the mandatory keyword argument {!r}.' <NEW_LINE> raise ValueError(msg.format(self.name(), self._arg)) <NEW_LINE...
Process the result from :func:`iris.analysis.Aggregator.aggregate`. Args: * collapsed_cube: A :class:`iris.cube.Cube`. * data_result: Result from :func:`iris.analysis.Aggregator.aggregate` * coords: The one or more coordinates that were aggregated over. Kwargs: * This function is intended to be used in ...
625941e45fdd1c0f98dc0642
def __enter__(self): <NEW_LINE> <INDENT> return self
Allow use of filesystem as a context manager.
625941e44e4d5625662d47df
def test_retr(self): <NEW_LINE> <INDENT> sessions = {} <NEW_LINE> users = {'test': HiveUser('test', 'test')} <NEW_LINE> authenticator = Authenticator(users) <NEW_LINE> Session.authenticator = authenticator <NEW_LINE> options = {'enabled': 'True', 'port': 0, 'banner': 'Test Banner', 'max_attempts': 3, 'syst_type': 'Test...
Tests the FTP RETR command
625941e43cc13d1c6d3c7785
def generate_random_bytes(n): <NEW_LINE> <INDENT> return os.urandom(int(n))
Pulled out for testing purposes
625941e4627d3e7fe0d6925e
def _get_query_common_lineages(query_hitids, dpcofg, threshold=1,): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for query, top_hits in query_hitids: <NEW_LINE> <INDENT> top_lineages = [dpcofg[id] for id in top_hits] <NEW_LINE> result[query] = get_common_lineage(top_lineages, threshold=threshold) <NEW_LINE> <DEDENT> retu...
return {query: common_lineage} - dpcofg: {seq_id: [domain,phylum, c, o, f, g]}
625941e4e5267d203edce0a4
def _spi_synth(data, word_size, clock_freq, cpol=0, cpha=0, lsb_first=True, idle_start=0.0, word_interval=0.0, idle_end=0.0): <NEW_LINE> <INDENT> t = 0.0 <NEW_LINE> clk = cpol <NEW_LINE> data_io = 0 <NEW_LINE> cs = 1 <NEW_LINE> half_bit_period = 1.0 / (2.0 * clock_freq) <NEW_LINE> yield ((t, clk),(t, data_io),(t, cs)) ...
Core SPI sunthesizer This is a generator function.
625941e463b5f9789fde74f2
def grad2rad(x): <NEW_LINE> <INDENT> return x * pi / 200
returns x (grad) in radians
625941e4cc0a2c11143dd29e
def get_executable_names(self): <NEW_LINE> <INDENT> names = {runner.get_executable_name() for runner in self.queue} <NEW_LINE> names.discard(None) <NEW_LINE> return sorted(names)
Return a list for all executables that would be run, without actually running them.
625941e4283ffb24f3c55d0a
def getCompartmentIdSpeciesIsIn (self, speciesId): <NEW_LINE> <INDENT> sp = self.model.getSpecies(speciesId) <NEW_LINE> if sp != None: <NEW_LINE> <INDENT> return sp.getCompartment() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise Exception ('Species Id:' + speciesId + ' does not exist in the model')
Returns the compartment Id that the species givenin th argument is in.
625941e46aa9bd52df0371b3
def run(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> os.system(self.limpiar) <NEW_LINE> self.desplegarMenu() <NEW_LINE> eleccion = input("SELECCIONE UNA OPCIÓN: ") <NEW_LINE> accion = self.opciones.get(eleccion) <NEW_LINE> if accion: <NEW_LINE> <INDENT> accion() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDEN...
Es el método principal del programa.
625941e4fb3f5b602dac3aa4
def export_media_as_tsv_file(self, params, context=None): <NEW_LINE> <INDENT> return self._client.call_method( 'FBAFileUtil.export_media_as_tsv_file', [params], self._service_ver, context)
:param params: instance of type "ExportParams" (input and output structure functions for standard downloaders) -> structure: parameter "input_ref" of String :returns: instance of type "ExportOutput" -> structure: parameter "shock_id" of String
625941e445492302aab5e6d4
def _run(self, task, response): <NEW_LINE> <INDENT> self._reset() <NEW_LINE> if isinstance(response, dict): <NEW_LINE> <INDENT> response = rebuild_response(response) <NEW_LINE> <DEDENT> process = task.get('process', {}) <NEW_LINE> callback = process.get('callback', '__call__') <NEW_LINE> if not hasattr(self, callback):...
Finding callback specified by `task['callback']` raising status error for it if needed.
625941e4004d5f362079a73d
def __init__(self, URL, name): <NEW_LINE> <INDENT> self._URL = URL <NEW_LINE> self._name = name <NEW_LINE> self._offset = 0
:param URL: something to stick in the href for the user to click :param name: the name of the day eg "Mother's Day"
625941e47d847024c06be6cc
def build_vocab(sentences): <NEW_LINE> <INDENT> print("Starting vocabulary") <NEW_LINE> word_counts = Counter(itertools.chain(*sentences)) <NEW_LINE> vocabulary_inv = [x[0] for x in word_counts.most_common()] <NEW_LINE> vocabulary = {x: i for i, x in enumerate(vocabulary_inv)} <NEW_LINE> print("Vocabulary done!") <NEW_...
Builds a vocabulary mapping from word to index based on the sentences. Returns vocabulary mapping and inverse vocabulary mapping.
625941e485dfad0860c3b268
def test_person_consent_form_edit(self): <NEW_LINE> <INDENT> session = self.get_session() <NEW_LINE> admin_session = self.get_session('admin') <NEW_LINE> cf_filename, cf_bytes = self.gen_test_pdf() <NEW_LINE> admin_session.create_country_generic() <NEW_LINE> admin_session.create_country('DEF', 'Test Second Country') <N...
Test consent forms uploaded after person creation time.
625941e48e05c05ec3eea785
def add(self, product, quantity=1, update_quantity=False): <NEW_LINE> <INDENT> product_id = str(product.id) <NEW_LINE> if product_id not in self.cart: <NEW_LINE> <INDENT> self.cart[product_id] = {'quantity': 0, 'price': str(product.price)} <NEW_LINE> <DEDENT> if update_quantity: <NEW_LINE> <INDENT> self.cart[product_id...
Add a product to the cart or update quantity.
625941e4656771135c3ebc80
def simple_norm(data, stretch='linear', power=1.0, asinh_a=0.1, min_cut=None, max_cut=None, min_percent=None, max_percent=None, percent=None, clip=True): <NEW_LINE> <INDENT> if percent is not None: <NEW_LINE> <INDENT> interval = PercentileInterval(percent) <NEW_LINE> <DEDENT> elif min_percent is not None or max_percent...
Return a Normalization class that can be used for displaying images with Matplotlib. This function enables only a subset of image stretching functions available in `~astropy.visualization.mpl_normalize.ImageNormalize`. This function is used by the ``astropy.visualization.scripts.fits2bitmap`` script. Parameters ----...
625941e4091ae35668667364