code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def generate_ef(self): <NEW_LINE> <INDENT> new_ef = random.random() * 2 * self._variation <NEW_LINE> new_ef = new_ef - self._variation <NEW_LINE> self._cur_rate = new_ef <NEW_LINE> self._ef_history.append(new_ef)
Generate a new ef number
625941ce4f88993c3716c19c
def test_update_article_template(self): <NEW_LINE> <INDENT> pass
Test case for update_article_template Update an article template
625941ce7cff6e4e81117abb
def resolve_data(self, data): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.data = data[self.name] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise DataAccessException("Node {0} cannot find name {1} in " "submission data.".format(self._attr_name, self.name))
This method links data from form submission back to Nodes. HTML form data is represented by a dictionary that is keyed by the 'name' attribute of the form element. Since most Nodes only render a single form element, and the default set_identifiers generates a single 'name' attribute for the Node then this function atte...
625941ce26068e7796caee15
def ConversionDecimal (numero): <NEW_LINE> <INDENT> numero=list(numero) <NEW_LINE> numero.reverse() <NEW_LINE> decimal=0 <NEW_LINE> for i in range(len(numero)): <NEW_LINE> <INDENT> decimal += int(numero[i])*2**i <NEW_LINE> <DEDENT> return decimal
Funcion que convierte un valor binario en decimal Parametros: -numero: Numro expresado en base 2 Return: Valor decimal
625941ce56b00c62f0f1478f
def _unc_check_enabled() -> bool: <NEW_LINE> <INDENT> if not ON_WINDOWS: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> import winreg <NEW_LINE> wval = None <NEW_LINE> try: <NEW_LINE> <INDENT> key = winreg.OpenKey( winreg.HKEY_CURRENT_USER, r"software\microsoft\command processor" ) <NEW_LINE> wval, wtype = winreg...
Check whether CMD.EXE is enforcing no-UNC-as-working-directory check. Check can be disabled by setting {HKCU, HKLM}/SOFTWARE\Microsoft\Command Processor\DisableUNCCheck:REG_DWORD=1 Returns: True if `CMD.EXE` is enforcing the check (default Windows situation) False if check is explicitly disabled.
625941ce498bea3a759b9be4
def get_mapping(self): <NEW_LINE> <INDENT> return self.mapping
gets the character to character mapping currently being used by the object :return: dict containing character to charcter mapping for characters a-z
625941cee76e3b2f99f3a940
def p_break_instr(self, p): <NEW_LINE> <INDENT> p[0] = AST.Break()
break_instr : BREAK ';'
625941ce60cbc95b062c6679
def comparable_from_actual(actual): <NEW_LINE> <INDENT> if actual is None: <NEW_LINE> <INDENT> return actual <NEW_LINE> <DEDENT> if isinstance(actual, ObjectMap): <NEW_LINE> <INDENT> comparable = {} <NEW_LINE> for k, v in actual.__dict__.items(): <NEW_LINE> <INDENT> if k in {"_attrs", "plugin_name"}: <NEW_LINE> <INDENT...
Return something comparable give the return of a modeler's process.
625941cec432627299f04d7b
def __get_flask_server_params__(): <NEW_LINE> <INDENT> server_name = utils.get_env_var_setting('FLASK_SERVER_NAME', settings.DEFAULT_FLASK_SERVER_NAME) <NEW_LINE> server_port = utils.get_env_var_setting('FLASK_SERVER_PORT', settings.DEFAULT_FLASK_SERVER_PORT) <NEW_LINE> flask_debug = utils.get_env_var_setting('FLASK_DE...
Returns connection parameters of the Flask application :return: Tripple of server name, server port and debug settings
625941ce50485f2cf553ced0
def elw_status_of_floating_per_basic_asset(self): <NEW_LINE> <INDENT> data = { "bld": "dbms/MDC/STAT/standard/MDCSTAT09401", "elwRghtTpKindCd": self.search_type, "elwUlyTpCd": self.basic_asset, "trdDd": self.date, } <NEW_LINE> return self.update_requested_data(data)
기초자산별 상장현황[13311]
625941cea219f33f34628a9f
def test_display_html_comment(self): <NEW_LINE> <INDENT> self.context['comment'] = "<p>Unescaped <b>comment HTML</b></p>" <NEW_LINE> self.context['comment_prompt'] = "<p>Prompt <b>prompt HTML</b></p>" <NEW_LINE> self.context['text'] = "<p>Unescaped <b>text</b></p>" <NEW_LINE> xml = self.render_to_xml(self.context) <NEW...
Test that HTML comment and comment prompt render.
625941ce4f88993c3716c19d
def get_dialing_query(survey, type): <NEW_LINE> <INDENT> if type == 1: <NEW_LINE> <INDENT> return "select contacttime, responsecode " "from {sname} order by contacttime".format(sname=get_sample_name(survey)) <NEW_LINE> <DEDENT> elif type == 2: <NEW_LINE> <INDENT> return "select contactdatetime, responsest...
@param survey: Имя проекта @param type: Тип запроса - КонтактЛог или Сэмпл
625941ce5f7d997b87174bce
def _dsigma(creg, hypo_depth): <NEW_LINE> <INDENT> out = creg['cd0'] <NEW_LINE> dp0 = creg['dp0'] <NEW_LINE> if hypo_depth > dp0: <NEW_LINE> <INDENT> out += creg['cd1'] * (min(hypo_depth, creg['dp1']) - dp0) <NEW_LINE> <DEDENT> return 10 ** out
Hypocentre depth factor.
625941cecb5e8a47e48b7bdf
def return_arr(array): <NEW_LINE> <INDENT> if array == "HEX_4BIT_ARR": <NEW_LINE> <INDENT> return HEX_4BIT_ARR <NEW_LINE> <DEDENT> elif array == "HEX_CHARS_ARR": <NEW_LINE> <INDENT> return HEX_CHARS_ARR <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("Array not known")
return array from module I don't know how not to make it hardcoded
625941ced8ef3951e3243673
def reset_points(self, change): <NEW_LINE> <INDENT> self.game_rules.points = change
Helper function to reset the points to 100.
625941ce4a966d76dd551145
def minimize(self, problem, verbose=False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> problem.check() <NEW_LINE> try: <NEW_LINE> <INDENT> particleCloud = [] <NEW_LINE> for i in range(1, self.popSize+1): <NEW_LINE> <INDENT> particleCloud.append( Particle(i, problem.initSol, problem.lb, problem.ub, self.w, self.c1, se...
minimizes the defined problem instance after checking it for plausibility.
625941ce4d74a7450ccd42f9
def freespace(self, d): <NEW_LINE> <INDENT> return self.uniform_media(d)
Free space propagation ABCD matrix for a Gaussian beam Input d - [m], distance to propagate through free space Output ABCD - [m], ABCD matrix for beam propagation through free space a distance d
625941ceb57a9660fec339b9
@job <NEW_LINE> def get_project(project_code): <NEW_LINE> <INDENT> url = ''.join([settings.OPENLDAP_HOST, 'project/', project_code, '/']) <NEW_LINE> headers = {'Cache-Control': 'no-cache'} <NEW_LINE> try: <NEW_LINE> <INDENT> response = requests.get( url, headers=headers, timeout=5, ) <NEW_LINE> response.raise_for_statu...
Get an existing OpenLDAP project. Args: project_code (str): Project code - required
625941cead47b63b2c50a0b5
def status(output=True): <NEW_LINE> <INDENT> client = salt.client.get_local_client(__opts__['conf_file']) <NEW_LINE> minions = client.cmd('*', 'test.ping', timeout=__opts__['timeout']) <NEW_LINE> key = salt.key.Key(__opts__) <NEW_LINE> keys = key.list_keys() <NEW_LINE> ret = {} <NEW_LINE> ret['up'] = sorted(minions) <N...
Print the status of all known salt minions CLI Example: .. code-block:: bash salt-run manage.status
625941ce377c676e912722de
def process_request(self, request): <NEW_LINE> <INDENT> if request.method not in ('GET', 'HEAD', 'OPTIONS', 'TRACE'): <NEW_LINE> <INDENT> jwt_user = authentication.JWTAuthentication().authenticate(request) <NEW_LINE> if jwt_user: <NEW_LINE> <INDENT> request.user = jwt_user[0] <NEW_LINE> <DEDENT> if hasattr(request, 'us...
Processes request
625941cea17c0f6771cbe186
def process_poi(potential_poi, radius, p_lat, p_lon, p_lon_min, p_lon_max): <NEW_LINE> <INDENT> out_dict = [] <NEW_LINE> for poi in potential_poi: <NEW_LINE> <INDENT> if p_lon_min < poi.lon < p_lon_max: <NEW_LINE> <INDENT> dist = distance_between_points(p_lat, p_lon, poi.lat, poi.lon) <NEW_LINE> if dist < radius: <NEW_...
Finds all poi given in the array potential_poi in the given radius of a point :param potential_poi: a list of POI :param radius: the requested radius :param p_lat: latitude of the point :param p_lon: longitude of the point :param p_lon_min: minimum longitude :param p_lon_max: maximum longitude :return: a list of tuples...
625941ce63d6d428bbe44625
def fileUnzip(self): <NEW_LINE> <INDENT> buf = "" <NEW_LINE> fdr = open(self.key_file, "r") <NEW_LINE> content_lines = fdr.read().splitlines() <NEW_LINE> fdr.close() <NEW_LINE> self.cdToDefaultDir() <NEW_LINE> for l in content_lines: <NEW_LINE> <INDENT> if l.startswith(self.header): <NEW_LINE> <INDENT> filename = l[len...
docstring for fileUnzip
625941ce1f5feb6acb0c4c86
def build_data(self): <NEW_LINE> <INDENT> data = {} <NEW_LINE> data['intent'] = self.intent <NEW_LINE> data['payer'] = {'payment_method': self.method} <NEW_LINE> data['redirect_urls'] = { 'return_url': self.return_url, 'cancel_url': self.cancel_url, } <NEW_LINE> data['transactions'] = [{ 'amount': { 'total': self.price...
Build data for express checkout method
625941ceb57a9660fec339ba
def write_frame(frame, name, con, flavor='sqlite', if_exists='fail', **kwargs): <NEW_LINE> <INDENT> warnings.warn("write_frame is deprecated, use to_sql", FutureWarning) <NEW_LINE> index = kwargs.pop('index', False) <NEW_LINE> return to_sql(frame, name, con, flavor=flavor, if_exists=if_exists, index=index, **kwargs)
DEPRECATED - use to_sql Write records stored in a DataFrame to a SQL database. Parameters ---------- frame : DataFrame name : string con : DBAPI2 connection flavor : {'sqlite', 'mysql'}, default 'sqlite' The flavor of SQL to use. if_exists : {'fail', 'replace', 'append'}, default 'fail' - fail: If table exist...
625941ce0fa83653e46570f0
def is_post_request(self): <NEW_LINE> <INDENT> return self.type == 'POST'
Determines if the request is a 'POST' Request
625941ce71ff763f4b5497c1
def beta_choose(N): <NEW_LINE> <INDENT> x = int( np.random.beta(1, 8) * N+1 ) <NEW_LINE> if x > 0: <NEW_LINE> <INDENT> x -= 1 <NEW_LINE> <DEDENT> return x
Use an almost-Beta function to select an integer on [0, N]
625941ce07f4c71912b115b8
def setTimeTolerance(self, *args): <NEW_LINE> <INDENT> return _MEDCouplingRemapper.MEDCouplingFieldDouble_setTimeTolerance(self, *args)
setTimeTolerance(self, double val) 1
625941cedc8b845886cb566b
def initialize_port(self): <NEW_LINE> <INDENT> self.port = simpy.Container(self.env)
Initializes a Port object with a simpy.Container of scour protection material.
625941ce498bea3a759b9be5
def write_file(path, text): <NEW_LINE> <INDENT> path.write_text(text, "utf-8") <NEW_LINE> return True
Write `text` value into py.path.local file path.
625941ce3d592f4c4ed1d1a3
@pytest.fixture(scope="session", autouse=True) <NEW_LINE> def clean_up_files(): <NEW_LINE> <INDENT> yield <NEW_LINE> if os.path.exists(settings.MEDIA_ROOT): <NEW_LINE> <INDENT> shutil.rmtree(settings.MEDIA_ROOT)
Fixture that removes the media root folder after the suite has finished running, effectively deleting any files that were created by factories over the course of the test suite.
625941ce5fdd1c0f98dc0369
def simplify_source(source, tags=("style", "svg", "script")): <NEW_LINE> <INDENT> doc = BeautifulSoup(source, features="html.parser") <NEW_LINE> for tag in tags: <NEW_LINE> <INDENT> for element in doc.select(tag): <NEW_LINE> <INDENT> element.decompose() <NEW_LINE> <DEDENT> <DEDENT> return doc.decode("utf-8").strip()
Given HTML source, deletes the specified tags to make the source code smaller
625941cedd821e528d63b2de
def test_config_not_valid_service_names(self): <NEW_LINE> <INDENT> assert not _setup_component(self.hass, shell_command.DOMAIN, { shell_command.DOMAIN: { 'this is invalid because space': 'touch bla.txt' } })
Test if config contains invalid service names.
625941ce23849d37ff7b31c5
def afterSetUp(self): <NEW_LINE> <INDENT> self.login('manager') <NEW_LINE> self.wftool = wftool = getToolByName(self.portal, 'portal_workflow') <NEW_LINE> sections = self.portal.sections <NEW_LINE> wftool.invokeFactoryFor(sections, 'Section', 'subs') <NEW_LINE> self.section = sections.subs <NEW_LINE> self.ptool = ptool...
Create structure of sections with containers.
625941ce07d97122c41789c2
@pytest.fixture <NEW_LINE> def app(): <NEW_LINE> <INDENT> app = create_app(TestingConfig) <NEW_LINE> with app.app_context(): <NEW_LINE> <INDENT> from app.model.task import Task <NEW_LINE> db.create_all() <NEW_LINE> <DEDENT> yield app <NEW_LINE> with app.app_context(): <NEW_LINE> <INDENT> db.drop_all()
Create and configure a new app instance for each test.
625941ce5fc7496912cc3ab4
def make_training_graph(graph, test_node, n): <NEW_LINE> <INDENT> new_graph = graph <NEW_LINE> neighbors = sorted(new_graph.neighbors(test_node)) <NEW_LINE> while n > 0: <NEW_LINE> <INDENT> new_graph.remove_edge(test_node, neighbors[n-1]) <NEW_LINE> n -= 1 <NEW_LINE> <DEDENT> return new_graph
To make a training graph, we need to remove n edges from the graph. As in lecture, we'll assume there is a test_node for which we will remove some edges. Remove the edges to the first n neighbors of test_node, where the neighbors are sorted alphabetically. E.g., if 'A' has neighbors 'B' and 'C', and n=1, then the edge ...
625941cecb5e8a47e48b7be0
def doevents(self): <NEW_LINE> <INDENT> for event in pygame.event.get(): <NEW_LINE> <INDENT> if event.type == pygame.QUIT: <NEW_LINE> <INDENT> self.exited = True <NEW_LINE> <DEDENT> elif event.type == pygame.MOUSEMOTION: <NEW_LINE> <INDENT> if pygame.mouse.get_pressed()[0] == 1: <NEW_LINE> <INDENT> self.graphics.drag_s...
handle pygame events
625941ce3317a56b86939d8d
def allow_empty(repo, message): <NEW_LINE> <INDENT> repo.call('commit', '--allow-empty', '-m', message)
Create a new commit from the contents of the index, which may be empty. :repo: supports 'call' :message: the string message for the commit :returns: None
625941ced268445f265b4fa3
def fit( self, n_epoch, X, Y, n_class, batch_size=None, shuffle=False, accumulate_grad=True, X_val=None, Y_val=None, val_window=30, val_batch_size=300, write_to=None, end=None, keep_grad=False, verbose=True, ): <NEW_LINE> <INDENT> assert len(n_epoch) >= self._layer_counter <NEW_LINE> self._compile() <NEW_LINE> self._fi...
Train the model on some data. Parameters ---------- n_epoch : iterable of ints The number of epochs for each layer. The first integer matches the layer closest to input and so on. At least one integer should be provided for each layer. O...
625941ce656771135c3eb9a5
def is_element_present(self, selector, by=By.CSS_SELECTOR): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.driver.find_element(by=by, value=selector) <NEW_LINE> return True <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> return False
Searches for the specified element by the given selector. Returns whether the element object if the element is present on the page. @Params selector - the locator that is used (required) by - the method to search for hte locator (Default- By.CSS_SELECTOR) @returns Boolean Whether the element is present
625941ceaad79263cf390b77
def game_board_full(self): <NEW_LINE> <INDENT> return '-' not in self.board
Returns True if game board is full, otherwise returns False.
625941ced268445f265b4fa4
def EndInvoke(self,result): <NEW_LINE> <INDENT> pass
EndInvoke(self: SelectedCellsChangedEventHandler,result: IAsyncResult)
625941ce6e29344779a62748
def _parse_line(self, csv_fields): <NEW_LINE> <INDENT> top_grup, modName, objectStr = csv_fields[:3] <NEW_LINE> longid = self._coerce_fid(modName, objectStr) <NEW_LINE> top_grup_sig = str_to_sig(top_grup) <NEW_LINE> attrs = self.sig_stats_attrs[top_grup_sig] <NEW_LINE> eid_or_next = 3 + self._called_from_patcher <NEW_L...
Reads stats from specified text file.
625941ce442bda511e8be54e
def fetch_ID(self, element, xpath2ID, ndtype=None): <NEW_LINE> <INDENT> namespaces = { 'tei': "http://www.tei-c.org/ns/1.0", 'xml': "http://www.w3.org/XML/1998/namespace", 'geonames': 'http://www.geonames.org/', 'gnd': 'http://d-nb.info/gnd/' } <NEW_LINE> result = { 'xpath': xpath2ID, 'fetched_id': None, 'element': ele...
takes a place node, a xpath pointing to a norm data ID/LINK, and optional a normdata type and returns * a dict with ** the passed in params, ** the fetched normdata ID (as URL!), ** and a "status" bool indicating if the xpath hit something (True) or not (False)
625941ce73bcbd0ca4b2c1ac
def merge_cookies(cookiejar, cookies): <NEW_LINE> <INDENT> if not isinstance(cookiejar, cookiejar.CookieJar): <NEW_LINE> <INDENT> raise ValueError('You can only merge into CookieJar') <NEW_LINE> <DEDENT> if isinstance(cookies, dict): <NEW_LINE> <INDENT> cookiejar = cookiejar_from_dict( cookies, cookiejar=cookiejar, ove...
Add cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar
625941cefb3f5b602dac37c9
def get_credential_report_dict(): <NEW_LINE> <INDENT> CFN.generate_credential_report() <NEW_LINE> time.sleep(5) <NEW_LINE> report = CFN.get_credential_report() <NEW_LINE> report = report['get_credential_report_response']['get_credential_report_result']['content'] <NEW_LINE> report = base64.b64decode(report) <NEW_LINE> ...
Returns the IAM credential report as a python dictionary using the IAM username as a key.
625941ced164cc6175782e84
def rowwise_corr(A,B): <NEW_LINE> <INDENT> A_error = np.subtract(A, A.mean(axis = 1)[:,None]) <NEW_LINE> B_error = np.subtract(B, B.mean(axis = 1)[:,None]) <NEW_LINE> ssA = np.square(A_centered).sum(axis = 1) <NEW_LINE> ssB = np.square(B_centered).sum(axis = 1) <NEW_LINE> corr_coeff = np.divide(np.dot(A_centered,B_cent...
Returns the rowwise Pearson product-moment correlation coefficient of a 2-D array and a 1-D vector Parameters ---------- A : 2-D array_like 2-dimensional array. B : 1-D array_like 1-dimensional vector. Returns ------- corr_coeff : 1-D array_like Vector of rowwise correlation coeffecients between A and...
625941ce71ff763f4b5497c2
def __init__(self, size=6, hash_type='additive'): <NEW_LINE> <INDENT> hash_types = {'additive': self._additive, 'elf': self._elf} <NEW_LINE> if hash_type not in hash_types: <NEW_LINE> <INDENT> raise ValueError("Hashing type doesn't exist") <NEW_LINE> <DEDENT> self.hash_type = hash_types[hash_type] <NEW_LINE> self.size ...
Instantiate empty hash table.
625941ce435de62698dfdd83
def db_test_data(): <NEW_LINE> <INDENT> u1 = User(uname='lemongrab') <NEW_LINE> u2 = User(uname='bubblegum') <NEW_LINE> u3 = User(uname='marceline') <NEW_LINE> u4 = User(uname='simon') <NEW_LINE> p1 = Post(title="One million years dungeon", content="One million years dungeon", user=u1, created=datetime.utcnow()) <NEW_L...
Create sample data for test database.
625941ce7d847024c06be3f2
def rotate(self, matrix): <NEW_LINE> <INDENT> n = len(matrix) <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> for j in range(i+1,n): <NEW_LINE> <INDENT> matrix[i][j],matrix[j][i] = matrix[j][i],matrix[i][j] <NEW_LINE> <DEDENT> <DEDENT> for i in range(n): <NEW_LINE> <INDENT> for j in range(n//2): <NEW_LINE> <INDENT> m...
:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
625941ce507cdc57c6306e11
def compute_distances_no_loops(self, X): <NEW_LINE> <INDENT> num_test = X.shape[0] <NEW_LINE> num_train = self.X_train.shape[0] <NEW_LINE> dists = np.zeros((num_test, num_train)) <NEW_LINE> dot_mat = np.dot(self.X_train, X.T) <NEW_LINE> dot_mat *= -2 <NEW_LINE> train_sum = np.sum(self.X_train**2, axis=1) <NEW_LINE> tes...
Compute the distance between each test point in X and each training point in self.X_train using no explicit loops. Input / Output: Same as compute_distances_two_loops
625941ce8da39b475bd650aa
def cb(self, theta): <NEW_LINE> <INDENT> waterMat = self.tilt(theta) <NEW_LINE> waterMasses = waterMat * self.ds ** 3 * 1000 <NEW_LINE> waterMass = 1000 <NEW_LINE> return np.array([np.sum(self.X * waterMasses) / waterMass, np.sum(self.Y * waterMasses) / waterMass, np.sum(self.Z * waterMasses) / waterMass])
Returns the center of bouyancy
625941ce1f037a2d8b946334
def init(self, style, dims, color, multipage, config): <NEW_LINE> <INDENT> raise FormatError("not implemented.")
Init the instance.
625941cecc0a2c11143dcfc7
def demonstrate_list_methods(): <NEW_LINE> <INDENT> l1 = ["Because the Night", "Patti Smith", 1978, True] <NEW_LINE> l1.append("Bruce Springsteen") <NEW_LINE> print(l1) <NEW_LINE> print() <NEW_LINE> l1.insert(2, "Easter") <NEW_LINE> print(l1) <NEW_LINE> print() <NEW_LINE> easter = l1.pop(2) <NEW_LINE> print('Popped:', ...
Using append(), insert(), remove(), pop(), extend(), count(), index(), reverse(), len(),... Also, "in" and "not in" operators can be used to search lists for the occurrence of a given element.
625941ce5fdd1c0f98dc036a
@Event('server_cvar') <NEW_LINE> def _server_cvar(game_event): <NEW_LINE> <INDENT> if GunGameStatus.MATCH is GunGameMatchStatus.UNLOADING: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> cvarname = game_event['cvarname'] <NEW_LINE> cvarvalue = game_event['cvarvalue'] <NEW_LINE> if cvarname == order_file.name: <NEW_LINE>...
Set the weapon order value if the ConVar is for the weapon order.
625941ce8a43f66fc4b5419b
def get_repo_info_dict(): <NEW_LINE> <INDENT> data = {} <NEW_LINE> repo_path = get_local_repo_path() <NEW_LINE> if not repo_path: <NEW_LINE> <INDENT> return data <NEW_LINE> <DEDENT> data['path'] = repo_path <NEW_LINE> data['url'] = get_origin_url() <NEW_LINE> data['branch'] = get_branch_name() <NEW_LINE> data['branch_d...
Return a dict of info about the repo
625941ce66656f66f7cbc2e2
def is_semi_regular(self, domain=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> domain = self._domain_gap(domain) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self._gap_().IsSemiRegular(domain).bool()
Returns ``True`` if ``self`` acts semi-regularly on ``domain``. A group $G$ acts semi-regularly on a set $S$ if the point stabilizers of $S$ in $G$ are trivial. ``domain`` is optional and may take several forms. See examples. EXAMPLES:: sage: G = PermutationGroup([[(1,2,3,4)]]) sage: G.is_semi_regular() ...
625941ce63b5f9789fde721c
def create_update_firewallrule(self): <NEW_LINE> <INDENT> self.log("Creating / Updating the MySQL firewall rule instance {0}".format(self.name)) <NEW_LINE> try: <NEW_LINE> <INDENT> response = self.mysql_client.firewall_rules.create_or_update(resource_group_name=self.resource_group, server_name=self.server_name, firewal...
Creates or updates MySQL firewall rule with the specified configuration. :return: deserialized MySQL firewall rule instance state dictionary
625941ced7e4931a7ee9e054
def test_update_port_add_additional_ip(self): <NEW_LINE> <INDENT> with self.subnet() as subnet: <NEW_LINE> <INDENT> with self.port(subnet=subnet) as port: <NEW_LINE> <INDENT> data = {'port': {'admin_state_up': False, 'fixed_ips': [{'subnet_id': subnet['subnet']['id']}, {'subnet_id': subnet['subnet']['id']}]}} <NEW_LINE...
Test update of port with additional IP.
625941ce31939e2706e4cfa0
def not_found(response): <NEW_LINE> <INDENT> return response.status_code in [404, 401]
Response wasn't found
625941ce10dbd63aa1bd2cda
def main(_): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description=None) <NEW_LINE> parser.add_argument('-v', '--verbose', action='count', dest='verbosity', default=0, help='Set verbosity.') <NEW_LINE> parser.add_argument('--task', default=0, type=int, help='Task index') <NEW_LINE> parser.add_argument('--job...
Setting up Tensorflow for data parallel work
625941ce6aa9bd52df036edb
def _rect_on_view_python(self, elem_geometry: Optional[QRect]) -> QRect: <NEW_LINE> <INDENT> if elem_geometry is None: <NEW_LINE> <INDENT> geometry = self._elem.geometry() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> geometry = elem_geometry <NEW_LINE> <DEDENT> rect = QRect(geometry) <NEW_LINE> frame = cast(Optional[Q...
Python implementation for rect_on_view.
625941ce187af65679ca5255
def _add_attribute_type(self, key, label, default_value=None): <NEW_LINE> <INDENT> if len(self.attrs) == 0: <NEW_LINE> <INDENT> self.attrs[key] = [default_value, label, 0] <NEW_LINE> return <NEW_LINE> <DEDENT> idx = max([item[2] for item in self.attrs.values()]) + 1 <NEW_LINE> self.attrs[key] = [default_value, label, i...
Adds a new type of attribute to the list of attributes understood by this query. Meant to be used by the constructors in derived classes.
625941cebe383301e01b55bc
def _merge_metadata(self, source, target, keys=None): <NEW_LINE> <INDENT> self.__log.call(source, target, keys=keys) <NEW_LINE> if keys is None: <NEW_LINE> <INDENT> keys = list(source.keys()) <NEW_LINE> <DEDENT> for key in keys: <NEW_LINE> <INDENT> value = source[key] <NEW_LINE> if key not in target: <NEW_LINE> <INDENT...
Merge *source[field]* values into *target[field]*. :arg dict source: metadata being merged from :arg dict target: metadata being merged into :keyword list keys: specific keys to merge (if not specified, **all** keys from *source* are merged into *target*)
625941cecad5886f8bd27110
def IsName(self, szNameBuf, lHashVal): <NEW_LINE> <INDENT> pass
IsName(self: ITypeLib2, szNameBuf: str, lHashVal: int) -> bool Indicates whether a passed-in string contains the name of a type or member described in the library. szNameBuf: The string to test. lHashVal: The hash value of szNameBuf. Returns: true if szNameBuf was found in the type libr...
625941ce379a373c97cfac7c
def write_row(out, periods, options, max_cols): <NEW_LINE> <INDENT> if len(periods) == 0: <NEW_LINE> <INDENT> raise ValueError("cannot write an empty row.") <NEW_LINE> <DEDENT> tr = "\t\t\t<tr>\n" <NEW_LINE> _tr = "\t\t\t</tr>\n" <NEW_LINE> empty_cell = "\t\t\t\t<td>&nbsp;</td>\n" <NEW_LINE> empties = max_cols - len(pe...
Write one row of periods to the HTML file.
625941cef548e778e58cd6b4
def transform(self, X, y=None, copy=True): <NEW_LINE> <INDENT> check_is_fitted(self, 'mixing_') <NEW_LINE> X = check_array(X, copy=copy) <NEW_LINE> if self.whiten: <NEW_LINE> <INDENT> X -= self.mean_ <NEW_LINE> <DEDENT> return fast_dot(X, self.components_.T)
Recover the sources from X (apply the unmixing matrix). Parameters ---------- X : array-like, shape (n_samples, n_features) Data to transform, where n_samples is the number of samples and n_features is the number of features. copy : bool (optional) If False, data passed to fit are overwritten. Defaults to...
625941ced99f1b3c44c676c5
def memo_memoize_to_file(fname): <NEW_LINE> <INDENT> if not REBUILD_ALL_CACHES: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cache = json.load(open(fname,'r')) <NEW_LINE> <DEDENT> except (IOError, ValueError): <NEW_LINE> <INDENT> cache = {} <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> cache = {} <NEW_LINE> <D...
Memoization decorator maker for functions taking a single argument Takes a filename to which the memoization may be cached to disk If REBUILD_ALL_CACHES is True, does not load from caches
625941ce1f5feb6acb0c4c87
def get_biz_tax(w, Y, L, K, p, method): <NEW_LINE> <INDENT> if method == 'SS': <NEW_LINE> <INDENT> delta_tau = p.delta_tau[-1] <NEW_LINE> tau_b = p.tau_b[-1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> delta_tau = p.delta_tau[:p.T] <NEW_LINE> tau_b = p.tau_b[:p.T] <NEW_LINE> <DEDENT> business_revenue = tau_b * (Y - w...
Finds total business income tax revenue. .. math:: R_{t}^{b} = \tau_{t}^{b}(Y_{t} - w_{t}L_{t}) - \tau_{t}^{b}\delta_{t}^{\tau}K_{t}^{\tau} Args: r (array_like): real interest rate Y (array_like): aggregate output L (array_like): aggregate labor demand K (array_like): aggregate capital demand ...
625941ce507cdc57c6306e12
def calculate(self): <NEW_LINE> <INDENT> raise NotImplementedError( 'A transform.Transform subtype must implement a calculate method')
T.calculate() Calculate the internal numpy matrix.
625941ceab23a570cc2502b9
@register.simple_tag(takes_context=True) <NEW_LINE> def get_translate_url(context, obj): <NEW_LINE> <INDENT> if not isinstance(obj, Translation): <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> if context['user'].profile.translate_mode == Profile.TRANSLATE_ZEN: <NEW_LINE> <INDENT> name = 'zen' <NEW_LINE> <DEDENT> els...
Get translate URL based on user preference.
625941cebe7bc26dc91cd736
def _MarkLinesToFormat(uwlines, lines): <NEW_LINE> <INDENT> if lines: <NEW_LINE> <INDENT> for uwline in uwlines: <NEW_LINE> <INDENT> uwline.disable = True <NEW_LINE> <DEDENT> for start, end in sorted(lines): <NEW_LINE> <INDENT> for uwline in uwlines: <NEW_LINE> <INDENT> if uwline.lineno > end: <NEW_LINE> <INDENT> break...
Skip sections of code that we shouldn't reformat.
625941ced7e4931a7ee9e055
def zadd(self, name, *args, **kwargs): <NEW_LINE> <INDENT> if len(args) % 2 != 0: <NEW_LINE> <INDENT> raise redis.RedisError("ZADD requires an equal number of " "values and scores") <NEW_LINE> <DEDENT> zset = self._db.setdefaultnonstring(name, {}) <NEW_LINE> added = 0 <NEW_LINE> for score, value in zip(*[args[i::2] for...
Set any number of score, element-name pairs to the key ``name``. Pairs can be specified in two ways: As *args, in the form of: score1, name1, score2, name2, ... or as **kwargs, in the form of: name1=score1, name2=score2, ... The following example would add four values to the 'my-key' key: redis.zadd('my-key', 1.1, 'n...
625941ce30dc7b7665901a9d
def accept_message(self, receiver: str, message: Tuple[str, str]) -> None: <NEW_LINE> <INDENT> print('sending message: "%s" to %s...' % (message, receiver))
Sends message off to another system ...
625941ce0a50d4780f666fc9
def MEAN(list1, n): <NEW_LINE> <INDENT> return sum(list1[-n:])/n
need:(list,number) return:number 序列 list 过去 n 天均值
625941ce7b25080760e39590
def main(): <NEW_LINE> <INDENT> parser = get_args_parser() <NEW_LINE> args = parser.parse_args() <NEW_LINE> print(args) <NEW_LINE> if args.img_sheet is None: <NEW_LINE> <INDENT> img_path_list = [ './data/hico/images/test2015/HICO_test2015_00000001.jpg', './data/hoia/images/test/test_000000.png', ] <NEW_LINE> <DEDENT> e...
python3 test_on_images.py --dataset_file=hico --backbone=resnet50 --batch_size=1 --log_dir=./ --model_path=your_model_path --img_sheet=your_image_sheet_file
625941ced18da76e2353260d
def obterTodosDeputados(self, **kwargs): <NEW_LINE> <INDENT> return self.runThroughAllPages(**kwargs)
Obtém todos os deputados da atual legislatura Se não forem fornecidos parâmetros de filtro, somente serão retornados os deputados *em exercício no momento da requisição*. Exemplo:: for pagina in dep.obterTodosDeputados(ordenarPor='nome'): for deputado in pagina: print(deputado) :para...
625941ce10dbd63aa1bd2cdb
def p_statement_break(p): <NEW_LINE> <INDENT> p[0] = BreakStatement()
statement : BREAK
625941ce91f36d47f21ac62a
def connect_JSON(config): <NEW_LINE> <INDENT> testnet = config.get('testnet', '0') <NEW_LINE> testnet = (int(testnet) > 0) <NEW_LINE> if not 'rpcport' in config: <NEW_LINE> <INDENT> config['rpcport'] = 51475 if testnet else 51020 <NEW_LINE> <DEDENT> connect = "http://%s:%s@127.0.0.1:%s"%(config['rpcuser'], config['rpcp...
Connect to a startlife JSON-RPC server
625941ce099cdd3c635f0d92
def turnaround_time(): <NEW_LINE> <INDENT> average = 0 <NEW_LINE> for pid, times in conf.turnaroud_times.items(): <NEW_LINE> <INDENT> average += times[1]-times[0] <NEW_LINE> <DEDENT> print('Average Turnaround Time: %.2f' % (average/len(conf.turnaroud_times))) <NEW_LINE> conf.outfile.write('Average Turnaround Time: %.2f...
Calculates and print/write the average turnaround time. :return:
625941ce442bda511e8be54f
def delete_file_in_gcs(gcs_path, project = None): <NEW_LINE> <INDENT> bucket_name = gcs_path.split('/')[2] <NEW_LINE> if project is None: <NEW_LINE> <INDENT> storage_client = storage.Client() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> storage_client = storage.Client(project = project) <NEW_LINE> <DEDENT> bucket = st...
Deleta arquivo no GCP Args: gcs_path: caminho completo no GCP para deleção project: nome do projeto no GCP, se None, projeto será o default
625941ce287bf620b61d3b9b
def index(args): <NEW_LINE> <INDENT> if args["<item_index>"]: <NEW_LINE> <INDENT> val:str = args["<item_index>"] <NEW_LINE> if val.isdigit() and int(val) > 0: <NEW_LINE> <INDENT> return int(val) - 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError(f"{val} 需要为一个大于0的整数。") <NEW_LINE> <DEDENT> <DEDENT> elif a...
index <item_index> | word <keyword>
625941ce26068e7796caee17
def _populatePools(self): <NEW_LINE> <INDENT> pools = self.pools <NEW_LINE> poolCount = self.poolCount <NEW_LINE> participants = self.participants <NEW_LINE> for i in range(1,poolCount+1): <NEW_LINE> <INDENT> pools.append(Pool(i)) <NEW_LINE> <DEDENT> modifier = 1 <NEW_LINE> j=0 <NEW_LINE> for i in range(self.totalEntri...
Fills the pools with participants based on rank and school. Pre: self.poolMax and self.poolCount assigned Post: self.pools are assign participants
625941ce4f88993c3716c19e
def channel_pair_selected_callback(self, channels): <NEW_LINE> <INDENT> self.get_view('ChannelView').select(channels)
Callback when the user clicks on a pair in the SimilarityMatrixView.
625941ce4c3428357757c45f
def list_lb_nodes(self, lb_id): <NEW_LINE> <INDENT> url = "%s/loadbalancers/%s/nodes" % (self.api_user_url, lb_id) <NEW_LINE> request_result = self.__get(url, headers=self.api_headers, verify=False) <NEW_LINE> return json.loads(request_result.text)
Get list of nodes for the specified lb_id
625941cec4546d3d9de72b6c
def GetYouTubeVideoEntry(self, uri=None, video_id=None): <NEW_LINE> <INDENT> if uri is None and video_id is None: <NEW_LINE> <INDENT> raise YouTubeError('You must provide at least a uri or a video_id ' 'to the GetYouTubeVideoEntry() method') <NEW_LINE> <DEDENT> elif video_id and not uri: <NEW_LINE> <INDENT> uri = '%s/%...
Retrieve a YouTubeVideoEntry. Either a uri or a video_id must be provided. Args: uri: An optional string representing the URI of the entry that is to be retrieved. video_id: An optional string representing the ID of the video. Returns: A YouTubeVideoFeed if successfully retrieved. Raises: YouTubeError...
625941ce7d43ff24873a2dd8
def process(self, instance): <NEW_LINE> <INDENT> joints = cmds.ls(instance, type='joint', long=True) <NEW_LINE> invalid = [] <NEW_LINE> for joint in joints: <NEW_LINE> <INDENT> if is_visible(joint, displayLayer=False): <NEW_LINE> <INDENT> invalid.append(joint) <NEW_LINE> <DEDENT> <DEDENT> if invalid: <NEW_LINE> <INDENT...
Process all the nodes in the instance 'objectSet'
625941cea219f33f34628aa1
def get_installed_version(): <NEW_LINE> <INDENT> plist_data = plistlib.readPlist('/Applications/Dropbox.app/Contents/Info.plist') <NEW_LINE> return re.sub(r'[^0-9.]+','',plist_data['CFBundleShortVersionString'].strip())
Returns the current installed version by parsing Dropbox's client Info.plist
625941ce9b70327d1c4e0f0d
def stop(self) -> None: <NEW_LINE> <INDENT> self.interrupted.set()
Releases the lock when signalled via an interrupt.
625941cee8904600ed9f2065
def __matmul__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, Operator): <NEW_LINE> <INDENT> return NotImplemented <NEW_LINE> <DEDENT> from pymor.operators.constructions import ConcatenationOperator <NEW_LINE> if isinstance(other, ConcatenationOperator): <NEW_LINE> <INDENT> return NotImplemented <NEW_LINE> ...
Concatenation of two operators.
625941ce9f2886367277a9c5
def SetSpareLoadValue(self,row,column,idLoadParameter,value): <NEW_LINE> <INDENT> pass
SetSpareLoadValue(self: PanelScheduleView,row: int,column: int,idLoadParameter: ElementId,value: float) Sets the value of the apparent load parameter for a spare row: A row where the valid spare is column: A column where the valid spare is idLoadParameter: One of 4 valid load parameters: RBS_ELEC_APPARENT_LOA...
625941ce57b8e32f524835d2
def generate_output(self): <NEW_LINE> <INDENT> if not self._generator_function: <NEW_LINE> <INDENT> raise NotImplementedError( "`generator_function` not implemented in %s", self ) <NEW_LINE> <DEDENT> return self._generator_function()
Calls the `_generator_function` function. Raises: NotImplementedError: If the `_generator_function` is not defined.
625941ce1d351010ab855c54
def __init__( self, start_index: int, end_index: int, source_index: int, dest_index: int ) -> None: <NEW_LINE> <INDENT> self.start_index = start_index <NEW_LINE> self.end_index = end_index <NEW_LINE> self.source_index = source_index <NEW_LINE> self.dest_index = dest_index
Initializer for the SuffixEdge class. :param start_index: Starting index in source string :param end_index: End index in source string :param source_index: Edge source node :param dest_index: Edge destination node
625941ce5f7d997b87174bcf
def forward_pass_train(self, X): <NEW_LINE> <INDENT> X = np.array(X, ndmin=2) <NEW_LINE> X = np.reshape(X, (-1, self.input_nodes)) <NEW_LINE> hidden_inputs = np.dot(X, self.weights_input_to_hidden) <NEW_LINE> hidden_outputs = self.activation_function(hidden_inputs) <NEW_LINE> final_inputs = np.dot(hidden_outputs, self....
Implement forward pass here Arguments --------- X: features batch
625941ceb57a9660fec339bb
@spice_error_check <NEW_LINE> def insrti(item: Union[Iterable[int], int], inset: SpiceCell) -> None: <NEW_LINE> <INDENT> assert isinstance(inset, stypes.SpiceCell) <NEW_LINE> if hasattr(item, "__iter__"): <NEW_LINE> <INDENT> for i in item: <NEW_LINE> <INDENT> libspice.insrti_c(ctypes.c_int(i), ctypes.byref(inset)) <NEW...
Insert an item into an integer set. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/insrti_c.html :param item: Item to be inserted. :param inset: Insertion set.
625941ce293b9510aa2c33cd
def get_all_classes(): <NEW_LINE> <INDENT> return inspect.getmembers( sys.modules[__name__], lambda member: inspect.isclass(member) and member.__module__ == __name__)
Python introspection return name and reference to all classes in module
625941ce8e05c05ec3eea4ad
def start_arm(self, data, arm_name, n_bootstrapped_samples): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.n_bootstrapped_samples = n_bootstrapped_samples <NEW_LINE> self.data_values = data[["collected_during", "billed_during"]].values <NEW_LINE> self.collected = data[["collected_during"]].values <NEW_LINE> self...
This method is used to initialise the object with the data associated with a specific experimental arm. It sets various attributes of the object with these data fields. Parameters: :arg1 data(dataframe): DF with columns "collected_during", and "billed_during" and "total_due" - "billed_during" is reduced after a disco...
625941cea17c0f6771cbe188
def turn_on_command(self): <NEW_LINE> <INDENT> if self.get_power_status() != 'active': <NEW_LINE> <INDENT> self.send_req_ircc(self.get_command_code('TvPower')) <NEW_LINE> self.bravia_req_json("sony/system", self._jdata_build("setPowerStatus", {"status": "true"}))
Turn the media player on using command. Only confirmed working on Android. Can be used when WOL is not available.
625941cefbf16365ca6f62fd
def total_flux(F, A = None): <NEW_LINE> <INDENT> if issparse(F): <NEW_LINE> <INDENT> return sparse.tpt.total_flux(F, A = A) <NEW_LINE> <DEDENT> elif isdense(F): <NEW_LINE> <INDENT> return dense.tpt.total_flux(F, A = A) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise _type_not_supported
Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks. Parameters ---------- F : (M, M) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer state labels for set A (reactant) Returns ------- F : flo...
625941ce63d6d428bbe44627
def _reversed(self): <NEW_LINE> <INDENT> super(FlippedReducedPermutation, self)._reversed() <NEW_LINE> self._flips[0].reverse() <NEW_LINE> self._flips[1].reverse()
Reverses the permutation TESTS: :: sage: p = iet.Permutation('a b c d','c d b a',reduced=True,flips='a') sage: p -a b c d c d b -a sage: p._reversed() sage: p a b c -d -d c a b sage: p._reversed() sage: p -a b c d c d b -a :: sage: p = iet.Gener...
625941ce1f5feb6acb0c4c88
def spiral_corners(): <NEW_LINE> <INDENT> size = 0 <NEW_LINE> n = 1 <NEW_LINE> yield (n,) <NEW_LINE> while True: <NEW_LINE> <INDENT> size += 2 <NEW_LINE> nums = [] <NEW_LINE> for _ in range(4): <NEW_LINE> <INDENT> n += size <NEW_LINE> nums.append(n) <NEW_LINE> <DEDENT> yield tuple(nums)
37 36 35 34 33 32 31 38 17 16 15 14 13 30 39 18 5 4 3 12 29 40 19 6 1 2 11 28 41 20 7 8 9 10 27 42 21 22 23 24 25 26 43 44 45 46 47 48 49 >>> import itertools >>> list(itertools.islice(spiral_corners(), 4)) [(1,), (3, 5, 7, 9), (13, 17, 21, 25), (31, 37, 43, 49)]
625941cede87d2750b85feca