code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def compute_addresses(self, data): <NEW_LINE> <INDENT> todo = [] <NEW_LINE> todo.extend(self.definition) <NEW_LINE> while todo: <NEW_LINE> <INDENT> address = todo.pop() <NEW_LINE> if address == '': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> host_ip = to_ip_address(to_unicode(address)) <NE...
Convert all aliases to structured ip addresses or networks
625941e4596a897236089ec3
def get(self): <NEW_LINE> <INDENT> return self.dbClient.sgetOne(self.useful_proxy_name)[0]
从可用代理池中获取一个可用代理 :return: one useful proxy
625941e4566aa707497f496b
def GetMin(Data: TGenericSequence, *, SkipFrames: int = 1, DoCheck: bool = True) -> TReal: <NEW_LINE> <INDENT> _CheckPositiveInteger(SkipFrames) <NEW_LINE> if DoCheck: <NEW_LINE> <INDENT> Result = min(_ExtractMeans(Data, SkipFrames = SkipFrames + 1)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> Result = Data[0] <NEW_L...
Calculates the minimum value of a mixed sequence of real numbers and the measurements with uncertainty. Computation speed is O(N), unless the passed sequence is already sorted in ascending order sequence of real numbers, which is indicated by the keyword argument DoCheck = False, in which case the calculation speed is ...
625941e47047854f462a180d
def four_squares(n): <NEW_LINE> <INDENT> n = ZZ(n) <NEW_LINE> if n <= 0: <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> z = ZZ.zero() <NEW_LINE> return (z, z, z, z) <NEW_LINE> <DEDENT> raise ValueError("%s is not a sum of 4 squares"%n) <NEW_LINE> <DEDENT> if n.nbits() <= 32: <NEW_LINE> <INDENT> from sage.rings impo...
Write the integer `n` as a sum of four integer squares. INPUT: - ``n`` -- an integer OUTPUT: a tuple `(a,b,c,d)` of non-negative integers such that `n = a^2 + b^2 + c^2 + d^2` with `a <= b <= c <= d`. EXAMPLES:: sage: four_squares(3) (0, 1, 1, 1) sage: four_squares(13) (0, 0, 2, 3) sage: four_s...
625941e46fb2d068a760f4ab
def show(self): <NEW_LINE> <INDENT> self._pbar.show() <NEW_LINE> self._process_events()
Show the dialog and process any events.
625941e4ad47b63b2c50a387
def get_json_objects(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open('contacts.json', 'r') as f: <NEW_LINE> <INDENT> return json.loads(f.read()) <NEW_LINE> <DEDENT> <DEDENT> except IOError: <NEW_LINE> <INDENT> print("File could not be found") <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> prin...
Return contact objects from JSON
625941e4009cb60464c637b7
def Psi_LM(X,Y,theta): <NEW_LINE> <INDENT> n = tf.cast(tf.shape(X)[0],tf.float32) <NEW_LINE> e = tf.square(tf.squeeze(Y,1) - tf.einsum('ij,j->i',X,theta)) <NEW_LINE> log_likelihood = -0.5*n*tf.log(2*math.pi) - 0.5*tf.reduce_sum(e) <NEW_LINE> return -log_likelihood
\psi(X,Y,Θ) = \psi(X,Y,eta) = 0.5\cdotn\cdotlog(2\pi) + 0.5 \cdot \sum_i(Y_i-X_ieta)^2
625941e476d4e153a657ef3a
def generateDisambiguation(self, piece, destination): <NEW_LINE> <INDENT> if self.updateMoveValues: <NEW_LINE> <INDENT> pieces = self.getPiecesThatCanMoveToLocation(piece.piece, destination, "") <NEW_LINE> pieces.remove(piece) <NEW_LINE> if len(pieces) > 0: <NEW_LINE> <INDENT> fileAndRank = piece.position <NEW_LINE> ot...
If required, based upon instance variable, generate the disambiguation string
625941e455399d3f05588abe
def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.voltage = None <NEW_LINE> self.current = None <NEW_LINE> self.power = None
Create a new Rail with the specified rail
625941e4d268445f265b5277
def read_configfile(path): <NEW_LINE> <INDENT> json_data = open(path) <NEW_LINE> return json.load(json_data)
Parses a JSON configfile at path and then returns it
625941e423e79379d52ee967
def actionButton(self): <NEW_LINE> <INDENT> self.unitBouton.currentIndexChanged.connect(self.unit) <NEW_LINE> self.val_nbr_step.editingFinished.connect(self.stepChange) <NEW_LINE> self.val_ini.editingFinished.connect(self.stepChange) <NEW_LINE> self.val_fin.editingFinished.connect(self.stepChange) <NEW_LINE> self.val_s...
buttons action setup
625941e48e7ae83300e4b3d6
def test_get_field_data_types(self): <NEW_LINE> <INDENT> field_data_types = { 'a': 'categorical', 'b': 'integer' } <NEW_LINE> ht = HyperTransformer(field_data_types=field_data_types) <NEW_LINE> out = ht.get_field_data_types() <NEW_LINE> assert out == {'a': 'categorical', 'b': 'integer'}
Test the ``get_field_data_types`` method. This method should return the ``field_data_types`` attribute. Output: - Dict mapping fields to data types.
625941e4091ae3566866735f
def get_config_sensor(self, number: int) -> dict: <NEW_LINE> <INDENT> response = self.call_api(Command.GET_CONFIG_SENSOR, {UrlParam.NUMBER: number}) <NEW_LINE> return self._get_node_value(response, Node.SENSOR)
:param number: number of the sensor :return: the configuration of the specific sensor
625941e4be383301e01b5886
def test_value_is_8(): <NEW_LINE> <INDENT> assert generate_prime_number(8) == [2, 2, 2]
if the input is 8, return list [2, 2, 2]
625941e41f037a2d8b946605
def custom_port(command): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if '--' in command: <NEW_LINE> <INDENT> port = int(command.replace('--', '')) <NEW_LINE> if port < 1 or port > 65535: <NEW_LINE> <INDENT> print('Please enter port in valid range [1 - 65535]') <NEW_LINE> sys.exit(0) <NEW_LINE> <DEDENT> return port <N...
Returns the custom port if the command and port are valid
625941e4dd821e528d63b5ae
def get(self): <NEW_LINE> <INDENT> return self.request().get()
Gets the ThreadsCollectionPage Returns: :class:`ThreadsCollectionPage<microsoft.msgraph.request.threads_collection.ThreadsCollectionPage>`: The ThreadsCollectionPage
625941e40c0af96317bb85f0
def makeKaons(name, KAON_PIDK, KAON_MinPT) : <NEW_LINE> <INDENT> _code = " ( 'K+' == ABSID ) & " "( %(KAON_PIDK)s < PIDK - PIDpi) & (PT > %(KAON_MinPT)s *MeV)" % locals() <NEW_LINE> _kaonFilter = FilterDesktop (Code = _code ) <NEW_LINE> return Selection (name, Algorithm = _kaonFilter, RequiredSelections = [StdLoos...
Create kaons for Dplus->K*MuNu
625941e4c4546d3d9de72e40
def write_duplicate_json(formatted_duplicate_container): <NEW_LINE> <INDENT> with open('duplicate_hosts.json', 'w') as file: <NEW_LINE> <INDENT> file.write(json.dumps(formatted_duplicate_container))
Write formatted_duplicate_computers to disk as JSON
625941e41d351010ab855f23
def indexes(y, thres=0.3, min_dist=1): <NEW_LINE> <INDENT> if isinstance(y, np.ndarray) and np.issubdtype(y.dtype, np.unsignedinteger): <NEW_LINE> <INDENT> raise ValueError("y must be signed") <NEW_LINE> <DEDENT> thres = thres * (np.max(y) - np.min(y)) + np.min(y) <NEW_LINE> min_dist = int(min_dist) <NEW_LINE> dy = np....
Peak detection routine. Finds the numeric index of the peaks in *y* by taking its first order difference. By using *thres* and *min_dist* parameters, it is possible to reduce the number of detected peaks. *y* must be signed. Parameters ---------- y : ndarray (signed) 1D amplitude data to search for peaks. thres :...
625941e4eab8aa0e5d26df62
def connect2(self, credsFileDir=None): <NEW_LINE> <INDENT> if credsFileDir: <NEW_LINE> <INDENT> fileName = os.path.join(credsFileDir, self.connParamsFile) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> fileName = os.path.join(os.path.dirname(__file__), self.connParamsFile) <NEW_LINE> <DEDENT> fh = open(fileName, 'r') <N...
populates the class variables that are used to connect to the database. Going to create our own dsn in memory and then use it. Allows us to define a connection with server / port / instance name
625941e45f7d997b87174ea4
def _apply_deviate(self: "SchemaNode", stmt: Statement, sctx: SchemaContext) -> None: <NEW_LINE> <INDENT> arg = stmt.argument <NEW_LINE> if arg == "not-supported": <NEW_LINE> <INDENT> self.delete() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for subst in stmt.substatements: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT...
Apply **deviate** statement to the receiver.
625941e4baa26c4b54cb1524
def create_joint(space, b1, b2, px, py, lim1, lim2): <NEW_LINE> <INDENT> b1_b2 = pymunk.PivotJoint(b1, b2, (px, py)) <NEW_LINE> b1_b2.collide_bodies = False <NEW_LINE> space.add(b1_b2) <NEW_LINE> b1_b2_limit = pymunk.RotaryLimitJoint(b1, b2, lim1, lim2) <NEW_LINE> space.add(b1_b2_limit) <NEW_LINE> return b1_b2
b1, b2: Body objects px, py: (float) Pivot point in world coordinates lim1, lim2: (float) joint rotation limits (radians)
625941e43cc13d1c6d3c7780
def dfComparing(*args): <NEW_LINE> <INDENT> comparedDf = args[0] <NEW_LINE> for i in range(1, len(args)): <NEW_LINE> <INDENT> targetData = args[i] <NEW_LINE> comparedDf = np.maximum(comparedDf, targetData) <NEW_LINE> <DEDENT> return comparedDf
数据值比较函数 支持多个相同的数据结构比较 返回比较后数据结构
625941e466673b3332b9249a
def pop(self): <NEW_LINE> <INDENT> self._stack.pop()
Remove the top item
625941e421bff66bcd684d57
def apply_derivT(self, arg, result): <NEW_LINE> <INDENT> gamma = self.Gamma * 1e-1 <NEW_LINE> ind = np.argmax(self.min-gamma) <NEW_LINE> fmax = self.min - gamma[ind] <NEW_LINE> dfmax_dgamma = np.zeros(gamma.shape[0]) <NEW_LINE> dfmax_dgamma[ind] = -1.0 <NEW_LINE> deriv = dfmax_dgamma + 1/self.rho * 1/np.sum(...
Compute min slope KS function derivatives wrt flight path angle. Adjoint mode.
625941e44e4d5625662d47db
def test_get_variation__forced_bucketing(self): <NEW_LINE> <INDENT> self.assertTrue(self.optimizely.set_forced_variation('test_experiment', 'test_user', 'variation')) <NEW_LINE> self.assertEqual( 'variation', self.optimizely.get_forced_variation('test_experiment', 'test_user'), ) <NEW_LINE> variation_key = self.optimiz...
Test that the expected forced variation is called for a valid experiment and attributes
625941e4cdde0d52a9e5343e
def n_machine_transitions(n=3): <NEW_LINE> <INDENT> trnstns, durtn = state_change_times(n) <NEW_LINE> rows = len(trnstns) <NEW_LINE> out = pd.DataFrame(columns=['start', 'end', 'down_vms']) <NEW_LINE> out['down_vms'] = np.cumsum(trnstns['status'])[:rows-1] <NEW_LINE> out['start'] = np.array(trnstns['time'][:rows-1]) <N...
Converts the transition data for the individual machines into the transition data for the entire system. Here, states are defined as the number of machines down at any given time.
625941e467a9b606de4a82c0
def test_linkedpages(spider, depth_middleware, mock_response, depth2_request): <NEW_LINE> <INDENT> request_generator = generate_crawl_js_and_css_requests() <NEW_LINE> mock_response.request = depth2_request <NEW_LINE> remaining_requests = depth_middleware.process_spider_output( mock_response, request_generator, spider) ...
Ensure only JS requests are not filtered when linked from level 2 html pages
625941e456b00c62f0f14a64
def UUIDPrinter(valobj, *_args): <NEW_LINE> <INDENT> char_array = valobj.GetChildMemberWithName("_uuid").GetChildAtIndex(0) <NEW_LINE> raw_bytes = [x.GetValueAsUnsigned() for x in char_array] <NEW_LINE> uuid_hex_bytes = [hex(b)[2:].zfill(2) for b in raw_bytes] <NEW_LINE> return str(uuid.UUID("".join(uuid_hex_bytes)))
Print the UUID's hex string value.
625941e415baa723493c4381
def _correct_keywords(self, **kwargs): <NEW_LINE> <INDENT> search_types_dict = self.search_types_dict <NEW_LINE> for key in kwargs: <NEW_LINE> <INDENT> if self._re_state.match(key): <NEW_LINE> <INDENT> state_abbrev = kwargs[key] <NEW_LINE> kwargs[key] = 'NA:US:' + state_abbrev <NEW_LINE> <DEDENT> elif self._re_country....
Internal method to loop through and correct keyword arguments.
625941e4ab23a570cc25058f
def iigmtauvz(n0,dind,m0,mind,pl,tk,ist,h0,omegam,omegal,ekev,z): <NEW_LINE> <INDENT> return astrofor.qrx_iigmtauvz(n0,dind,m0,mind,pl,tk,ist,h0,omegam,omegal,ekev,z)
X-ray optical depth of ionized IGM gas vs. redshift Args: n0: number density cm-3 at z=0 dind: density index wrt z+1 m0: metalicity log[X/H] at z=0 mind: metalicity log[X/H] index wrt z pl: powerlaw index of continuum spectrum tk: temperature Kelvin ist: ionization st...
625941e41d351010ab855f24
def test_rows_update_geom_spatial_table(self): <NEW_LINE> <INDENT> import copy <NEW_LINE> from geopackage._wkb import dumps, loads, load, dump <NEW_LINE> data = [ {"song": "Midnight Mary", "artist": "Joey Powers", "Shape": point}, { "song": "What Kind of Fool", "artist": "The Murmaids", "Shape": dumps(obj=point, big_en...
tests the spatial insert on an attribute table
625941e438b623060ff0b1f6
def read_group(fname): <NEW_LINE> <INDENT> i=0 <NEW_LINE> groupi = [] <NEW_LINE> with open(fname) as f: <NEW_LINE> <INDENT> for line in f: <NEW_LINE> <INDENT> if i > 5: <NEW_LINE> <INDENT> if ('Perm #:') in line: <NEW_LINE> <INDENT> groupi.append(list(map(int, line.split()[4::]))) <NEW_LINE> <DEDENT> else: <NEW_LINE> <...
Reads the symmetry group in from the 'rot_perms' styled group output by enum.x. Args: fname (str): Path to the file to read the group from. Returns: group (numpy ndarray): The symmetry group.
625941e4d99f1b3c44c67990
def test_authorize_revoke_security_group_cidr_v6(self): <NEW_LINE> <INDENT> self.expect_http() <NEW_LINE> self.mox.ReplayAll() <NEW_LINE> security_group_name = "".join(random.choice("sdiuisudfsdcnpaqwertasd") for x in range(random.randint(4, 8))) <NEW_LINE> group = self.ec2.create_security_group(security_group_name, 't...
Test that we can add and remove CIDR based rules to a security group for IPv6
625941e4460517430c394583
def explain_filtered_local(self, x_explain: Union[pd.Series, pd.DataFrame, np.ndarray], cols: List[str], n_cols: Optional[int] = None) -> List[Dict[str, float]]: <NEW_LINE> <INDENT> return [ self._filter_and_limit_dict(sample_importance_dict, cols, n_cols) for sample_importance_dict in self.explain_local(x_explain) ]
same as `explain_local` but applying a filter on each explanation on the features
625941e44527f215b584c85b
def cdn_path( self, effects: Optional[Union[str, ImageTransformation]] = None ): <NEW_LINE> <INDENT> transformation = ImageTransformation(effects) <NEW_LINE> path = transformation.path(self.uuid) <NEW_LINE> return path
Returns CDN path with applied effects. Usage example:: >>> >>> file = File('a771f854-c2cb-408a-8c36-71af77811f3b') >>> file.cdn_path() a771f854-c2cb-408a-8c36-71af77811f3b/ >>> file.cdn_path('effect/flip/-/effect/mirror/') a771f854-c2cb-408a-8c36-71af77811f3b/-/effect/flip/-/effect/mirror/ >>>...
625941e47b180e01f3dc4bfe
def test_cache_featured_review(self): <NEW_LINE> <INDENT> post = Post.objects.featured_review() <NEW_LINE> self.assertEqual(post, None) <NEW_LINE> post = Post() <NEW_LINE> post.title = "first post" <NEW_LINE> post.permalink = "first-post" <NEW_LINE> post.body = "post first post" <NEW_LINE> post.user = self.u1 <NEW_LINE...
test cache invalidate for featured review
625941e430c21e258bdfa8aa
@Issue(3742) <NEW_LINE> def status_nested_wc_old_format(sbox): <NEW_LINE> <INDENT> sbox.build(read_only = True) <NEW_LINE> wc_dir = sbox.wc_dir <NEW_LINE> os.mkdir(os.path.join(wc_dir, 'subdir')) <NEW_LINE> os.mkdir(os.path.join(wc_dir, 'subdir', '.svn')) <NEW_LINE> svntest.main.file_append(os.path.join(wc_dir, 'subdir...
status on wc with nested old-format wc
625941e4711fe17d8254276b
def scalar_summary(x, summary_name, collections=None): <NEW_LINE> <INDENT> if isinstance(x, tf.Tensor): <NEW_LINE> <INDENT> collections = [tf.GraphKeys.SUMMARIES, 'scalar_summaries'] + collections if collections is not None else [] <NEW_LINE> return tf.summary.scalar(summary_name, x, collections) <NEW_LINE> <DEDENT> el...
Builds a scalar summary If x is a tf.Tensor it creates the summary operation to track x If x is a scalar it creates the tf.Summary object to be written be a summary writer If x is a list, tuple or dict a tf.Summary object is created for each element. The key or index is used for naming Parameters ---------- x : tf....
625941e4460517430c394584
def show(self): <NEW_LINE> <INDENT> self.VALUE_STR.set(str(self.value.magnitude)) <NEW_LINE> try: <NEW_LINE> <INDENT> base_config = justbytes.BaseConfig(**self.BASE.get()) <NEW_LINE> value_config = justbytes.ValueConfig(**self.VALUE.get()) <NEW_LINE> digits_config = justbytes.DigitsConfig(**self.DIGITS.get()) <NEW_LINE...
Show the resulting string.
625941e410dbd63aa1bd2fab
@pytest.mark.parametrize('gp_by', GROUP_BY, ids=['vm_tag']) <NEW_LINE> @pytest.mark.parametrize('interval', INTERVAL) <NEW_LINE> @pytest.mark.parametrize('graph_type', HOST_GRAPHS) <NEW_LINE> def test_tagwise(candu_db_restore, interval, graph_type, gp_by, host): <NEW_LINE> <INDENT> view = navigate_to(host, 'candu') <NE...
Tests for grouping host graphs by VM tag for hourly and Daily intervals prerequisites: * DB from an appliance on which C&U is enabled * DB should have C&U data collection enabled for Tag category * DB should have a VM tagged with proper tag category Steps: * Navigate to Host Utilization Page * Sel...
625941e4091ae35668667360
def dialogue_command(): <NEW_LINE> <INDENT> ap = renpy.arguments.ArgumentParser(description="Generates or updates translations.") <NEW_LINE> ap.add_argument("--text", help="Output the dialogue as plain text, instead of a tab-delimited file.", dest="text", action="store_true") <NEW_LINE> ap.add_argument("--strings", hel...
The dialogue command. This updates dialogue.txt, a file giving all the dialogue in the game.
625941e44527f215b584c85c
def setEdgeFlags(self): <NEW_LINE> <INDENT> if self.vt.nSpace_global == 2: <NEW_LINE> <INDENT> self.edgeFlags = numpy.array([1,2,4,0,2,5,0,1,3],'i') <NEW_LINE> <DEDENT> elif self.vt.nSpace_global == 3: <NEW_LINE> <INDENT> self.edgeFlags = numpy.array([1,2,3,5,6,8, 0,2,3,6,7,9, 0,1,3,4,8,9, 0,1,2,4,5,7],'i') <NEW_LINE> ...
This function sets the edge flags for the bdm2 loops
625941e450812a4eaa59c727
def cleanLink(s): <NEW_LINE> <INDENT> dirty_stuff = ["\"", "\\", "*", "'", "-", "#", ";", "<", ">", "+", "%"] <NEW_LINE> for suff in dirty_stuff: <NEW_LINE> <INDENT> if s.find(suff) >= 0: <NEW_LINE> <INDENT> s = s.replace(suff, "") <NEW_LINE> <DEDENT> <DEDENT> return s.decode('utf-8')
清洗文件分享链接
625941e4046cf37aa974d14d
def p_statement_3(self, p ) : <NEW_LINE> <INDENT> pass
statement : iterationPhrase
625941e47cff6e4e81117d8e
def setup_app(command, conf, vars): <NEW_LINE> <INDENT> load_environment(conf.global_conf, conf.local_conf) <NEW_LINE> Base.metadata.create_all(bind=Session.bind)
Place any commands to setup fadeben here
625941e4be8e80087fb21046
def _add_g_to_next_values(g, v_next, f_w): <NEW_LINE> <INDENT> v_next_for_eval = v_next[:, np.newaxis] <NEW_LINE> v_next_x_idx = f_w.ravel().astype(int) <NEW_LINE> v_next_y_idx = np.zeros(len(v_next_x_idx)).astype(int) <NEW_LINE> v_next = v_next_for_eval[v_next_x_idx, v_next_y_idx] <NEW_LINE> v_next = v_next.reshape(g....
:param g: stage cost for state x and input u; g.shape = [n, m] :param v_next: next time period costs for state x; v_next.shape = [n] :param f_w: value at n, m is next state idx given curr state n, input m; f_w.shape = [n, m] :return: current state value [n, m]
625941e423849d37ff7b3495
def filter(self, record): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> passed_traces = record.__dict__.get('trace', set()) <NEW_LINE> if len(passed_traces) == 0: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> filtered_traces = self._enabled_traces.intersection(passed_traces) <NEW_LINE> if len(filtered_traces) > 0: <N...
:param record: :return:
625941e4a79ad161976cc54f
def find_cache_dir(): <NEW_LINE> <INDENT> cwd = os.path.abspath(__file__) <NEW_LINE> path_index = cwd.find('NEEShubloader') <NEW_LINE> cache_dir = '%sNEEShubloader/bin/cache' % (cwd[:path_index],) <NEW_LINE> if not os.path.exists(cache_dir): <NEW_LINE> <INDENT> os.makedirs(cache_dir) <NEW_LINE> <...
This looks for the "cache" folder under the NEEShubloader. If it exists, it simply returns it's location on the system. If it doesn't exist it also creates the directory.
625941e4e1aae11d1e74a0c4
def __parseSelectorText(self, selectorText): <NEW_LINE> <INDENT> new = {'wellformed': True, 'last-S': False, 'name': 0, 'first': 0, 'lr': 0} <NEW_LINE> def _char(expected, seq, token, tokenizer=None): <NEW_LINE> <INDENT> val = self._tokenvalue(token) <NEW_LINE> if not new['last-S'] and expected in ['page', ': or EOF'] ...
Parse `selectorText` which may also be a list of tokens and returns (selectorText, seq). see _setSelectorText for details
625941e4462c4b4f79d1dad8
def bin2int(binstr): <NEW_LINE> <INDENT> return int(binstr, 2)
Convert a binary string to an integer.
625941e4b545ff76a891421e
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, ConfigurationParameterMatch): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941e44d74a7450ccd45cd
def thanksPageVocabulary(self): <NEW_LINE> <INDENT> propsTool = getToolByName(self, 'portal_properties') <NEW_LINE> siteProperties = getattr(propsTool, 'site_properties') <NEW_LINE> defaultPageTypes = siteProperties.getProperty('default_page_types') <NEW_LINE> tpages = [('', _(u'vocabulary_none_text', u'None')), ] <NEW...
returns a DisplayList of contained page-ish documents
625941e4f9cc0f698b140a01
def reset(self): <NEW_LINE> <INDENT> self.ship = Ship() <NEW_LINE> self.asteroids = [] <NEW_LINE> self.saucers = [] <NEW_LINE> self.round = 0 <NEW_LINE> self.lives = 3 <NEW_LINE> self.score = 0 <NEW_LINE> self.hud = HUD() <NEW_LINE> self.saucer_timer = 0 <NEW_LINE> self.extra_life_counter = 0 <NEW_LINE> self.start_new_...
Start a new game.
625941e47d847024c06be6c9
def show(self, id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('callback'): <NEW_LINE> <INDENT> return self.show_with_http_info(id, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.show_with_http_info(id, **kwargs) <NEW_LINE> return data
Show a single Metadata This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.show(id, callback=callback_function) :...
625941e4fbf16365ca6f65d5
def __init__(self, parent = None): <NEW_LINE> <INDENT> pass
void KNumInput.__init__(QWidget parent = None)
625941e42c8b7c6e89b35bc7
@route() <NEW_LINE> @defer.inlineCallbacks <NEW_LINE> def rescue_er_lang_god(p, req): <NEW_LINE> <INDENT> cid, = req <NEW_LINE> user = g_UserMgr.getUser(cid) <NEW_LINE> if not user: <NEW_LINE> <INDENT> log.error('Can not find user. cid: {0}.'.format( cid )) <NEW_LINE> defer.returnValue( CONNECTION_LOSE ) <NEW_LINE> <DE...
解除二郎神封印
625941e43eb6a72ae02ec8f1
def time_to_sec(self, time_): <NEW_LINE> <INDENT> time_ = time_.split(':') <NEW_LINE> return ((int(time_[0]) * 60 * 60) + (int(time_[1]) * 60) + int(time_[2]))
time_ is a string of the format HH:MM:SS
625941e47d43ff24873a30ad
def list_note_attachments(self, note): <NEW_LINE> <INDENT> return self.list_note_version_attachments(note, 0)
List attachments of note. :type note: dict :rtype: list
625941e48c0ade5d55d3edc7
def send_message(self, mto: JID, mbody: Optional[str] = None, msubject: Optional[str] = None, mtype: Optional[MessageTypes] = None, mhtml: Optional[str] = None, mfrom: OptJidStr = None, mnick: Optional[str] = None): <NEW_LINE> <INDENT> self.make_message(mto, mbody, msubject, mtype, mhtml, mfrom, mnick).send()
Create, initialize, and send a new :class:`~.Message` stanza. :param mto: The recipient of the message. :param mbody: The main contents of the message. :param msubject: Optional subject for the message. :param mtype: The message's type, such as ``'chat'`` or ``'groupchat'``. :param mhtml: Optional HTML b...
625941e4cad5886f8bd273e2
def __str__(self): <NEW_LINE> <INDENT> msg = "Received query syntax error for {0:s}".format(self.uri) <NEW_LINE> if self.message: <NEW_LINE> <INDENT> msg += ": {0:s}".format(self.message) <NEW_LINE> <DEDENT> return msg
Convert the exception to a string. Returns: str: String equivalent of the exception.
625941e401c39578d7e75245
def __init__(self, env): <NEW_LINE> <INDENT> blogname, year, index = env.docname.rsplit('/', 3) <NEW_LINE> if index != 'index': <NEW_LINE> <INDENT> raise Exception( "Allowed only in /<blogname>/<year>/index.rst files") <NEW_LINE> <DEDENT> self.blogname = blogname <NEW_LINE> self.year = int(year) <NEW_LINE> self.days = ...
:docname: the name of the document containing the `main_blogindex` directive :starting_year: all years before this year will be pruned
625941e4b7558d58953c5315
def trigger(self): <NEW_LINE> <INDENT> pass
Main API trigger features
625941e4a219f33f34628d6e
def from_datastore(entity): <NEW_LINE> <INDENT> if not entity: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if isinstance(entity, builtin_list): <NEW_LINE> <INDENT> entity = entity.pop() <NEW_LINE> <DEDENT> question = {} <NEW_LINE> question['id'] = entity.key.id() <NEW_LINE> question['description'] = entity.desc...
Translates Datastore results into the format expected by the application. Datastore typically returns: [Entity{key: (kind, id), prop: val, ...}] This returns: {id: id, prop: val, ...}
625941e4b57a9660fec33c93
def __init__(self, env_spec, mode="train", squash=True, bijector_config=None, reparameterize=False, observations_preprocessor=None, fix_h_on_reset=False, q_function=None, n_map_action_candidates=100, name="lsp_policy"): <NEW_LINE> <INDENT> Serializable.quick_init(self, locals()) <NEW_LINE> self._env_spec = env_spec <NE...
Initialize LatentSpacePolicy. Args: env_spec (`rllab.EnvSpec`): Specification of the environment to create the policy for. bijector_config (`dict`): Parameter configuration for bijector. squash (`bool`): If True, squash the action samples between -1 and 1 with tanh. n_map_action_candida...
625941e431939e2706e4d26e
def register(self, plugin): <NEW_LINE> <INDENT> assert issubclass(plugin, ContentPlugin), "The plugin must inherit from `ContentPlugin`" <NEW_LINE> assert plugin.model, "The plugin has no model defined" <NEW_LINE> assert issubclass(plugin.model, ContentItem), "The plugin model must inherit from `ContentItem`" <NEW_LINE...
Make a plugin known to the CMS. :param plugin: The plugin class, deriving from :class:`ContentPlugin`. :type plugin: :class:`ContentPlugin` The plugin will be instantiated once, just like Django does this with :class:`~django.contrib.admin.ModelAdmin` classes. If a plugin is already registered, this will raise a :cla...
625941e43539df3088e2e755
def to_json(self, filename=None, complete=False): <NEW_LINE> <INDENT> data = self.to_dict(complete=complete) <NEW_LINE> if filename is None: <NEW_LINE> <INDENT> return json.dumps(data) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> with open(filename, "w") as f: <NEW_LINE> <INDENT> json.dump(data, f)
Write genotype-phenotype map to json file. If no filename is given returns
625941e4187af65679ca552a
def multihead_attention(query, memory, bias, key_size, value_size, output_size, num_heads, keep_prob=None, data_format="NHWC", attention_function="dot_product", summaries=False, image_shapes=None, dtype=None, scope=None): <NEW_LINE> <INDENT> if key_size % num_heads != 0: <NEW_LINE> <INDENT> raise ValueError("Key size (...
Multihead scaled-dot-product attention with input/output transformations. Args: query: a Tensor with shape [batch, length_q, channels] if data_format is `NHWC`, [batch, channels, length_q] if data_format is `NCHW` memory: a Tensor with shape [batch, length_m, channels] if data_format...
625941e4167d2b6e31218f9e
def do_nothing(): <NEW_LINE> <INDENT> pass
As the name implies, does nothing. This is used as the default callback for the timer.
625941e4a8ecb033257d34d5
def create_body_dict(name, schema): <NEW_LINE> <INDENT> body_dict = {} <NEW_LINE> if schema: <NEW_LINE> <INDENT> body_dict['in'] = 'body' <NEW_LINE> body_dict['name'] = name <NEW_LINE> body_dict['schema'] = schema <NEW_LINE> body_dict['description'] = name + 'body object' <NEW_LINE> body_dict['required'] = True <NEW_LI...
Create a body description from the name and the schema.
625941e4e1aae11d1e74a0c5
def get_master_mongo_conn(): <NEW_LINE> <INDENT> MONGO_URI = 'mongodb://saran:Saran1!@ds141165-a0.mlab.com:41165/chefd-ingredients-research' <NEW_LINE> client = pymongo.MongoClient(MONGO_URI) <NEW_LINE> db = client.get_default_database() <NEW_LINE> return db
Gets mongo db connection to chefd-ingredients-research
625941e4be383301e01b5887
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.connection_factory = ConnectionFactory(*args, **kwargs)
:param args: :param kwargs:
625941e4236d856c2ad44be9
def on_forward(self, current_page): <NEW_LINE> <INDENT> return current_page + 1
Called to find out what page to go to next.
625941e44c3428357757c72f
def on_message(self, json_data): <NEW_LINE> <INDENT> state = json_data.get("state", {}).get("reported", {}) <NEW_LINE> if self.new_state_filter(state): <NEW_LINE> <INDENT> self.schedule_update_ha_state()
Update state on message change.
625941e48e71fb1e9831dbb1
def all_items(histogram_in): <NEW_LINE> <INDENT> total = 0 <NEW_LINE> for item in histogram_in: <NEW_LINE> <INDENT> total += histogram_in[item] <NEW_LINE> <DEDENT> return total
Calculates the total number of items in the text.
625941e4cad5886f8bd273e3
@override_style() <NEW_LINE> def plot_cvd_simulation_Machado2009( RGB: ArrayLike, deficiency: Union[ Literal["Deuteranomaly", "Protanomaly", "Tritanomaly"], str ] = "Protanomaly", severity: Floating = 0.5, M_a: Optional[ArrayLike] = None, **kwargs: Any, ) -> Tuple[plt.Figure, plt.Axes]: <NEW_LINE> <INDENT> M_a = cast( ...
Perform colour vision deficiency simulation on given *RGB* colourspace array using *Machado et al. (2009)* model. Parameters ---------- RGB *RGB* colourspace array. deficiency Colour blindness / vision deficiency type. severity Severity of the colour vision deficiency in domain [0, 1]. M_a Anomalous tr...
625941e4498bea3a759b9eb8
def is_negative(self): <NEW_LINE> <INDENT> return (self._num < 0)
------------------------------------------------------- Is self less than 0? ------------------------------------------------------- Postconditions: returns - True if the fraction corresponding to self is < 0, False otherwise. Note: This method is provided for convenience as it requires less overhead t...
625941e4cc40096d61595d59
def dist_to_coord(rhos, grid=(1,1)): <NEW_LINE> <INDENT> grid = _normalize_grid(grid,2) <NEW_LINE> is_single_image = rhos.ndim == 3 <NEW_LINE> if is_single_image: <NEW_LINE> <INDENT> rhos = np.expand_dims(rhos,0) <NEW_LINE> <DEDENT> assert rhos.ndim == 4 <NEW_LINE> rhos = np.reshape(rhos,(rhos.shape[0], rhos.shape[1], ...
convert from polar to cartesian coordinates for a single image (3-D array) or multiple images (4-D array)
625941e430dc7b7665901d6c
def __init__(self, parent: Union[WebDriver, WebElement], url: str, **options): <NEW_LINE> <INDENT> self._url = url <NEW_LINE> self._parent = parent <NEW_LINE> self._options = options
>>> assert Page(object, 'http://google.com').url == 'http://google.com' >>> class TestPage(Page): ... __path__ = '/test/{param}' >>> assert TestPage( ... object, 'http://google.com', path={'param': 'one'}, ... ).url == 'http://google.com/test/one' >>> assert TestPage(object, '').parent == object >>> assert 'te...
625941e407d97122c4178c9e
def run_watcher(): <NEW_LINE> <INDENT> WATCHER_DELAY = 2 <NEW_LINE> root_path = settings.rootpath <NEW_LINE> cash_files = {} <NEW_LINE> cash_words = {} <NEW_LINE> while True: <NEW_LINE> <INDENT> modified, cash_files = detect_modified_files(root_path, cash_files) <NEW_LINE> cash_words = process(modified, cash_words) <NE...
Запускает наблюдателя, который следит за изменениями необходимых файлов и запускает перевод
625941e421bff66bcd684d58
def add_resource(self, a_file): <NEW_LINE> <INDENT> afile = File(a_file) <NEW_LINE> resource = self.resource_from_path(afile) <NEW_LINE> if resource: <NEW_LINE> <INDENT> logger.debug("Resource exists at [%s]" % resource.relative_path) <NEW_LINE> return resource <NEW_LINE> <DEDENT> if not afile.is_descendant_of(self.sou...
Adds a file to the parent node. Also adds to to the hashtable of path to resource associations for quick lookup.
625941e4bd1bec0571d90a38
def testRaise(self): <NEW_LINE> <INDENT> future = threadpool.FutureResult() <NEW_LINE> try: <NEW_LINE> <INDENT> future.execute(self._raise_call, None, None) <NEW_LINE> <DEDENT> except ValueError as ex: <NEW_LINE> <INDENT> exception = ex <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.fail("Execute didn't propagate t...
Tests the traversal of an exception
625941e48e71fb1e9831dbb2
def find_signed_rpms_in_main_copies(self, rpm_info_list, sigkeys): <NEW_LINE> <INDENT> sigkeys = [i.lower() for i in sigkeys] <NEW_LINE> signed = [] <NEW_LINE> unsigned = [] <NEW_LINE> def _find_signed_rpm_in_main_copies(rpm_info, matches_by_rpm_id): <NEW_LINE> <INDENT> path = self._get_rpm_path(rpm_info, None) <NEW_LI...
Find signed RPMs in main copies. Main (unsigned) copies of RPMs are typically unsigned. They can be signed in rare situations such as imported signed 3rd party packages. In such case re-use existing signature rather than sign the RPMs again. :param rpm_info_list: List of koji rpm_info dictionaries :type rpm_info_lis...
625941e4377c676e912725b1
def new_dni(fake, dnis): <NEW_LINE> <INDENT> dni = None <NEW_LINE> while True: <NEW_LINE> <INDENT> dni = str(fake.random_int(min=10000000, max=99999999)) + fake.random_letter().upper() <NEW_LINE> if dnis.count(dni) == 0: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> return dni
Obtiene una DNI no existente en el conjunto de entrada. :param fake: Instancia de Faker.Factory (Factory) :param dnis: Instancia de lista (list) :return: DNI (str)
625941e43d592f4c4ed1d46c
def scale(self, factor): <NEW_LINE> <INDENT> self.xmin *= factor <NEW_LINE> self.ymin *= factor <NEW_LINE> self.xmax *= factor <NEW_LINE> self.ymax *= factor
Scale all coordinate values by multiplying by factor
625941e4b57a9660fec33c94
def openspectrumfile(self): <NEW_LINE> <INDENT> print("Open file dialog...") <NEW_LINE> filedialog = QtWidgets.QFileDialog(self) <NEW_LINE> filedialog.setWindowTitle('Load spectrum file') <NEW_LINE> filedialog.setNameFilters(self.filterslist) <NEW_LINE> if self.selectedfiltername is not None: <NEW_LINE> <INDENT> filedi...
Adds entries to the list in the main window which correspond to traces saved in the parsed file
625941e47047854f462a180f
def instantiate(self, selector): <NEW_LINE> <INDENT> structure_parameters = self._element.values.parameters.structure_parameters <NEW_LINE> my_default = { "setup": { "radius": 20, "radius_sky": 200, "lats" : 50, "longs" : 50 }, "gates" : {} } <NEW_LINE> counter = 0 <NEW_LINE> self._element.values.parameters.structure_p...
force set values: - set values to brick size - set values for gates
625941e4566aa707497f496d
def list(self, instance): <NEW_LINE> <INDENT> return self._list("/instances/%s/databases" % base.getid(instance), "databases")
Get a list of all Databases from the instance. :rtype: list of :class:`Database`.
625941e491f36d47f21ac901
def _del_all_attr(self): <NEW_LINE> <INDENT> for one_attribute in ATTR_COLLECTED_ITER.keys(): <NEW_LINE> <INDENT> attr = getattr(self, one_attribute) <NEW_LINE> del attr <NEW_LINE> <DEDENT> for one_attribute in ATTRS_COLLECTED_ONCE.keys(): <NEW_LINE> <INDENT> attr = getattr(self, one_attribute) <NEW_LINE> del attr
After saving the results, delete attribute classes.
625941e4d4950a0f3b08c753
def is_exit_policy_reject(self): <NEW_LINE> <INDENT> ep = self.exitpolicy[0] <NEW_LINE> return len(self.exitpolicy) == 1 and (ep.ip, ep.netmask, ep.port_low, ep.port_high) == (0, 0, 0, 0xffff)
Returns True if this router's exit policy is one line: reject *:*.
625941e492d797404e304596
def test_fk5_equinox_and_epoch_j2000_0_to_fk4_equinox_and_epoch_b1950_0(): <NEW_LINE> <INDENT> pos = SkyCoord('12h22m54.899s 15d49m20.57s', frame='fk5') <NEW_LINE> actual = pos.transform_to('fk4') <NEW_LINE> expected = SkyCoord('12h20m22.935s 16d05m58.024s', frame='fk4') <NEW_LINE> distance = actual.separation(expected...
http://phn.github.io/pytpm/conversions.html#fk5-equinox-and-epoch-j2000-0-to-fk4-equinox-and-epoch-b1950-0
625941e455399d3f05588ac1
def _internal_prep_message(realm, sender, addressee, content): <NEW_LINE> <INDENT> if len(content) > MAX_MESSAGE_LENGTH: <NEW_LINE> <INDENT> content = content[0:3900] + "\n\n[message was too long and has been truncated]" <NEW_LINE> <DEDENT> if realm is None: <NEW_LINE> <INDENT> raise RuntimeError("None is not a valid r...
Create a message object and checks it, but doesn't send it or save it to the database. The internal function that calls this can therefore batch send a bunch of created messages together as one database query. Call do_send_messages with a list of the return values of this method.
625941e48da39b475bd65383
def test_parse_composed(self): <NEW_LINE> <INDENT> def test_expression(string, composed): <NEW_LINE> <INDENT> assert_equal(compose(expressions.parse(string)), composed) <NEW_LINE> <DEDENT> for string, composed in self._expressions_composed: <NEW_LINE> <INDENT> yield test_expression, string, composed
Parse and compose a valid expression with formatting variations.
625941e4091ae35668667361
def assertQEqual(self, left, right): <NEW_LINE> <INDENT> self.assertIsInstance(left, models.Q) <NEW_LINE> self.assertIsInstance(right, models.Q) <NEW_LINE> left_str = str(left) <NEW_LINE> right_str = str(right) <NEW_LINE> self.assertEqual(left_str, right_str)
Assert `Q` objects are equal by ensuring that their unicode outputs are equal (crappy but good enough)
625941e48a349b6b435e857d
def deactivate_all_actions(self): <NEW_LINE> <INDENT> self.device_toolbar.deactivate_all() <NEW_LINE> self.popup_menu.deactivate_all()
Deactivate all partition-based buttons/menu items
625941e45e10d32532c5f330
def _build_dicts_python(self, python_dict): <NEW_LINE> <INDENT> invalid = [] <NEW_LINE> str_to_int_dict = {} <NEW_LINE> int_to_str_dict = {} <NEW_LINE> key_list = list(python_dict.keys()) <NEW_LINE> value_list = list(python_dict.values()) <NEW_LINE> if isinstance(key_list[0], (str, bytes)): <NEW_LINE> <INDENT> string_l...
Categoricals can be initialized with a dictionary of string to integer or integer to string. Python dictionaries accept multiple types for their keys, so the dictionaries need to check types as they're being constructed.
625941e432920d7e50b285de
def test_no_partial_name_match(data): <NEW_LINE> <INDENT> finder = PackageFinder([data.find_links], [], session=PipSession()) <NEW_LINE> req = install_req_from_line("gmpy") <NEW_LINE> found = finder.find_requirement(req, False) <NEW_LINE> assert found.url.endswith("gmpy-1.15.tar.gz"), found
Finder requires the full project name to match, not just beginning.
625941e482261d6c526ab8b0
def test_E_ajax_modify_user(self): <NEW_LINE> <INDENT> uri = "/user/ajax_modify_user" <NEW_LINE> url = self.url + uri <NEW_LINE> cookie = {"token": TOKEN} <NEW_LINE> paramter = {"uid": "3096", "name": "michael", "role_id": "9", "level_id": "21", "department_id": "", "birthday": "", "phone": "15212344321", "avatar_id": ...
修改用户帐号信息,部门ID无效
625941e4099cdd3c635f1063
def info(self): <NEW_LINE> <INDENT> return {'crit': self.criterion.place_type.desc, 'points': self.points, 'cl_match': self.cl_match, 'match_time': self.match_time, 'match_time_str': self.match_time_str, 'num_matches': self.num_matches, 'top_five': None if self.top_five is None else pickle.loads(self.top_five), 'latlon...
Return dictionary of object's key attributes for delivery to user display
625941e473bcbd0ca4b2c480
def commit(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.session.commit() <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> self.session.rollback() <NEW_LINE> raise
Commit a session transaction but rollback if an error occurs. This helps ensure that the session is not left in an unstable state.
625941e444b2445a3393249d