code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def set_AppKey(self, value): <NEW_LINE> <INDENT> super(DeleteDatastoreInputSet, self)._set_input('AppKey', value)
Set the value of the AppKey input for this Choreo. ((required, string) The App Key provided by Dropbox (AKA the OAuth Consumer Key).)
625941d98c3a87329515864c
def make_plots(allsmc,dates,keys): <NEW_LINE> <INDENT> fig=plt.figure() <NEW_LINE> color_vals=[(1,0,0),(0,1,0),(0,0,1),(1,1,0),(1,0,1),(0,1,1), (0.5,1,0),(0.5,0,1),(0,0.5,1),(1,0.5,0),(1,0,0.5),(0,1,0.5), (0.5,0.5,0),(0.5,0,0.5),(0,0.5,0.5),(0.5,0.5,0),(0.5,0,0.5),(0,0.5,0.5)] <NEW_LINE> for i in range(len(keys[:,0])):...
make output pdf plots
625941d973bcbd0ca4b2c305
def __checkTransitions(env): <NEW_LINE> <INDENT> epsilon = 0.0000001 <NEW_LINE> for s in range(0,env.numStates): <NEW_LINE> <INDENT> for a in range(0,env.numActions): <NEW_LINE> <INDENT> if s in env.terminalStates: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> sumProbs = 0 <NEW_LINE> for sprime in range(0,env.numSta...
Checks if transitions add up to 1 for each state-action pair, returns False.
625941d960cbc95b062c67d3
def gen_task(self, space_id): <NEW_LINE> <INDENT> url = '/email/contact/task/space/{space_id}'.format(space_id=space_id) <NEW_LINE> return self.transport.get(url=url)
Generate an email address to allow a user to create a space task. Endpoints: /email/contact/task/space/[space id]
625941d9046cf37aa974cfd5
def get_local_ips(local_ips=None, count=2): <NEW_LINE> <INDENT> if local_ips is None: <NEW_LINE> <INDENT> local_ips = create_local_ips(count) <NEW_LINE> <DEDENT> return mock.Mock(side_effect=local_ips)
Get an iterable Mock object with a list of faked local ips. If local ip list is provided, then initialize the Mock object with the list. Otherwise create one. :param List local_ips: A list of FakeResource objects faking local ips :param int count: The number of local ips to fake :return: An iterable Mock ...
625941d95f7d997b87174d29
def GenTemp(root="obj-"): <NEW_LINE> <INDENT> global _GT_NAMES_ <NEW_LINE> if root in _GT_NAMES_.keys(): <NEW_LINE> <INDENT> _GT_NAMES_[root]+=1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> _GT_NAMES_[root]=0 <NEW_LINE> <DEDENT> return "%s%d" % (root, _GT_NAMES_[root])
Generates a new unique name based on the given root
625941d967a9b606de4a8147
def upload_query_strategy(self, strategy_path): <NEW_LINE> <INDENT> query = gql(USER_PAID_QUERY_FRAGMENT) <NEW_LINE> params = { "id": self._user_id, } <NEW_LINE> res = self._client.execute(query, params) <NEW_LINE> if (not res["user"][0]["isPaid"]): <NEW_LINE> <INDENT> print("You must be a paid user to upload a YAML fi...
upload a qs before an experiment is run. if the user has created an experiment for manual al, then the user will have to upload a qs at every loop. if the user has created an experiment for regular al, then the user will have to upload a qs at the beginning. if the user is using auto al, then the user does not have to ...
625941d9090684286d50ef77
def testInboxes(self): <NEW_LINE> <INDENT> self.addAnonymousFile([ "@ @@home @@inbox EVERY 3-5 days", "@ Google Keep @@inbox EVERY day", " (LASTDONE 2013-09-11 09:30)", "@ Email @@inbox EVERY 2-3 days", " (LASTDONE 2013-09-11 09:40)", "@ @@work @@inbox EVERY 3-7 days", ]) <NEW_LINE> now = datetime.datetime(2013, 9, 1...
'Inbox' items appear in Inboxes().
625941d9460517430c39440f
def assign_rep(rep_id, genome_id, rep_is_bacteria, genome_is_bacteria, bac_seqs, ar_seqs, species, gtdb_taxonomy, genome_aa_count, trusted_user_genomes, aai_threshold, min_matches, assigned_representative, cur_aai): <NEW_LINE> <INDENT> if rep_is_bacteria != genome_is_bacteria: <NEW_LINE> <INDENT> return assigned_repres...
Detering if genome should be assigned to a representative.
625941d9956e5f7376d710fb
def error(msg): <NEW_LINE> <INDENT> print(msg, file=sys.stderr) <NEW_LINE> sys.exit(1)
Top-level error
625941d985dfad0860c3b0eb
def __init__(self, url='', credentials=None, get_credentials=True, http=None, model=None, log_request=False, log_response=False, credentials_args=None, default_global_params=None, additional_http_headers=None): <NEW_LINE> <INDENT> url = url or self.BASE_URL <NEW_LINE> super(SourcerepoV1, self).__init__( url, credential...
Create a new sourcerepo handle.
625941d966656f66f7cbc43c
def load_multi_wallet(self, wallet_file='wallet.json'): <NEW_LINE> <INDENT> self.wallet_file = None <NEW_LINE> self.address = None <NEW_LINE> self._wallet = None <NEW_LINE> self._wallet = BismuthMultiWallet(wallet_file, verbose=self.verbose) <NEW_LINE> if len(self._wallet._data["addresses"]) == 0: <NEW_LINE> <INDENT> s...
Tries to load the wallet file :param wallet_file: string, a wallet.json file
625941d9ad47b63b2c50a20d
def removeDuplicates(self, nums): <NEW_LINE> <INDENT> n = 0 <NEW_LINE> r = 0 <NEW_LINE> rn = 0 <NEW_LINE> for i in range(0, len(nums)): <NEW_LINE> <INDENT> if r != nums[i]: <NEW_LINE> <INDENT> n += 1 <NEW_LINE> r = nums[i] <NEW_LINE> nums[i-rn:i] = nums[i] <NEW_LINE> rn = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT...
:type nums: List[int] :rtype: int
625941d997e22403b379d22a
def user(msg): <NEW_LINE> <INDENT> return msg._client.users[msg._get_user_id()]['name']
Get the user who sent a message
625941d92eb69b55b151cb41
def sqlerror(self, error): <NEW_LINE> <INDENT> log.err('sqlite error') <NEW_LINE> error.printTraceback()
docstring here
625941d9a17c0f6771cbe2df
def get_mirbase_precursor(self): <NEW_LINE> <INDENT> precursor = Xref.objects.filter(accession__external_id=self.accession.external_id, accession__feature_name='precursor_RNA'). first() <NEW_LINE> if precursor: <NEW_LINE> <INDENT> return precursor.upi.upi <NEW_LINE> <DEDENT> else: <NEW_L...
miRBase mature products and precursors share the same external MI* identifier.
625941d916aa5153ce362707
def PostInitLayout(self): <NEW_LINE> <INDENT> pass
All node displays have been created and the AUI perspective activated.
625941d93317a56b86939ee3
def addProxy(self, host, type='http'): <NEW_LINE> <INDENT> proxy = request.ProxyHandler({type: host}) <NEW_LINE> self.__opener.add_handler(proxy)
''设置代理
625941d90a366e3fb873eaab
def exit_actions(self): <NEW_LINE> <INDENT> pass
What the explorer does as it stops exploring
625941d97b25080760e396e8
def __init__( self, *, value: List["DedicatedHost"], next_link: Optional[str] = None, **kwargs ): <NEW_LINE> <INDENT> super(DedicatedHostListResult, self).__init__(**kwargs) <NEW_LINE> self.value = value <NEW_LINE> self.next_link = next_link
:keyword value: Required. The list of dedicated hosts. :paramtype value: list[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] :keyword next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this URI to fetch the next page of dedicated hosts. :paramtype next_link: str
625941d923e79379d52ee7f1
def load_words(): <NEW_LINE> <INDENT> WORDLIST_FILENAME="words.txt" <NEW_LINE> inFile=open(WORDLIST_FILENAME, 'r', 0) <NEW_LINE> line = inFile.readline() <NEW_LINE> word_list=string.split(line) <NEW_LINE> return word_list
Ye function kaafi jayada words ko load karne mai help karega
625941d9cc0a2c11143dd120
def RenewDelegationToken(self, req): <NEW_LINE> <INDENT> self.send_RenewDelegationToken(req) <NEW_LINE> return self.recv_RenewDelegationToken()
Parameters: - req
625941d999fddb7c1c9de620
def test_parse_netifs_missing(self): <NEW_LINE> <INDENT> invalid_config = { } <NEW_LINE> self.assertRaisesRegex( CloubedConfigurationException, "netifs section of domain test_name is missing", self.domain_conf._ConfigurationDomain__parse_netifs, invalid_config)
ConfigurationDomain.__parse_netifs() should raise CloubedConfigurationException when the netifs section is missing
625941d9baa26c4b54cb13ad
def post(self, request, kit_pk, item_pk, quantity, *args, **kwargs): <NEW_LINE> <INDENT> status = 200 <NEW_LINE> msgs = [] <NEW_LINE> field_name = 'quantity-%d' % int(item_pk) <NEW_LINE> form = AddKitItemsForm( data={ 'selected_kit': kit_pk, field_name: quantity } ) <NEW_LINE> if not form.is_valid(): <NEW_LINE> <INDENT...
If successful, returns text message about it.
625941d9d268445f265b50fe
def p_eraCuadruplo(p): <NEW_LINE> <INDENT> global parametrosNum <NEW_LINE> parametrosNum = 1 <NEW_LINE> cuadruplos.append(cuadruplo(len(cuadruplos), 'Era',getFunctionById(p[-1]).dir , None , None))
eraCuadruplo :
625941d98a349b6b435e8403
def __repr__(cls): <NEW_LINE> <INDENT> return f"{cls.__module__}.{cls.__qualname__}"
repr(cls)
625941d932920d7e50b28462
def namify(root_uri): <NEW_LINE> <INDENT> root_uri = unidecode.unidecode(urllib.unquote(root_uri).decode('utf-8')) <NEW_LINE> generic_domains = set(['localhost', 'herokuapp', 'appspot']) <NEW_LINE> urlp = urlparse.urlparse(fix_scheme(root_uri)) <NEW_LINE> formatargs = collections.defaultdict(list) <NEW_LINE> netloc = u...
Turns a root uri into a less noisy representation that will probably make sense in most circumstances. Used by Navigator's __repr__, but can be overridden if the Navigator is created with a 'name' parameter.
625941d93617ad0b5ed68186
def convertXLS2XML(self, xls_filename=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import win32com.client <NEW_LINE> xlXMLSpreadsheet = 46 <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> print('import win32com error!') <NEW_LINE> return False <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> excel_app = w...
Сконвертировать XLS файл в XML. Конвертация будет происходить только при установленном Excel. :return: True - все нормально сконвертировалось, False - ошибка.
625941d9cdde0d52a9e532c5
def maxProfit(self, prices): <NEW_LINE> <INDENT> if not prices: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> lens = len(prices) <NEW_LINE> if lens <2: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> buys =[0 for i in range(lens)] <NEW_LINE> sell =[0 for i in range(lens)] <NEW_LINE> buys[0] =-prices[0] <NEW_LINE> b...
:type prices: List[int] :rtype: int
625941d9b545ff76a89140a5
def finish( self, request: http.HttpRequest, payload: SessionPayload, schedule_item: models.ScheduledOperation = None, ) -> Optional[http.HttpResponse]: <NEW_LINE> <INDENT> s_item_id = payload.pop('schedule_id', None) <NEW_LINE> schedule_item = None <NEW_LINE> if s_item_id: <NEW_LINE> <INDENT> if not schedule_item: <NE...
Finalize the creation of a scheduled operation. All required data is passed through the payload. :param request: Request object received :param schedule_item: ScheduledOperation item being processed. If None, it has to be extracted from the information in the payload. :param payload: Dictionary with all the required ...
625941d9435de62698dfdedd
def begin_create_or_update( self, resource_group_name, network_interface_name, parameters, **kwargs ): <NEW_LINE> <INDENT> polling = kwargs.pop('polling', True) <NEW_LINE> cls = kwargs.pop('cls', None) <NEW_LINE> lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) <NEW_LINE> cont_token = kwargs....
Creates or updates a network interface. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_interface_name: The name of the network interface. :type network_interface_name: str :param parameters: Parameters supplied to the create or update network interface operati...
625941d9a934411ee3751924
def del_edge(self, src_or_list, dst=None, index=None): <NEW_LINE> <INDENT> if isinstance( src_or_list, (list, tuple)): <NEW_LINE> <INDENT> if dst is not None and isinstance(dst, int): <NEW_LINE> <INDENT> index = dst <NEW_LINE> <DEDENT> src, dst = src_or_list <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> src, dst = src_...
Delete an edge from the graph. Given an edge's (source, destination) node names all matching edges(s) will be deleted if 'index' is not specified or set to None. If there are several matching edges and 'index' is given, only the edge in that position will be deleted. 'index' should be an integer specifying the positi...
625941d9dd821e528d63b437
def fork_github_repo(self): <NEW_LINE> <INDENT> driver = self.driver <NEW_LINE> self.login_into_github() <NEW_LINE> self.__logger.debug("forking repository : %s/%s..." % (self.__config["gitHub"]['starterRepository']["owner"], self.__config["gitHub"]['starterRepository']["owner"])) <NEW_LINE> if not self.is_element_pres...
Fork the GitHub starter repository
625941d926068e7796caef71
def GetToken(self): <NEW_LINE> <INDENT> res = requests.post(self.authurl, data={"apikey": self.apikey}) <NEW_LINE> response = json.loads(res.text) <NEW_LINE> try: <NEW_LINE> <INDENT> token = response['token'] <NEW_LINE> return token <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> print("Invalid API key\n\nKey:...
Parse response token from Whetstone server to make API calls.
625941d9293b9510aa2c3523
@condition <NEW_LINE> def github_gfonts_ttFont(ttFont, license): <NEW_LINE> <INDENT> if not license: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> from fontbakery.utils import download_file <NEW_LINE> from fontTools.ttLib import TTFont <NEW_LINE> from urllib.request import HTTPError <NEW_LINE> LICENSE_DIRECTORY =...
Get a TTFont object of a font downloaded from Google Fonts git repository.
625941d955399d3f05588945
def __init__(self, data, model, budget, quality): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.model = model <NEW_LINE> self.budget = budget <NEW_LINE> self.quality = quality <NEW_LINE> self.accuracy = 0.0 <NEW_LINE> self.questions_asked = 0 <NEW_LINE> self.values = np.zeros((len(self.data.predict_x)))
The constructor sets the class members values according to what has been inputted. :param data: The data object that contains training, testing and prediction data. :param model: A base model that new models will use to copy parameters from. :param budget: The amount of questions that can be asked by the system. :...
625941d997e22403b379d22b
def test_load_by_id(self): <NEW_LINE> <INDENT> mock_dao = mock.MagicMock() <NEW_LINE> mock_dao.get_by_id.return_value = {'id': 1, 'first_name': 'Adam', 'last_name': 'Anderson'} <NEW_LINE> user = UserModel(mock_dao) <NEW_LINE> user.load_by_id(1) <NEW_LINE> self.assertEqual(user.id, 1) <NEW_LINE> self.assertEqual(user.fi...
It loads a model instance by its ID
625941d991f36d47f21ac784
def cetdatetime_to_timestamp(_cetdatetime): <NEW_LINE> <INDENT> return utc_to_timestamp(cet_to_utc(cet.localize(_cetdatetime)))
input _cetdatetime must not be offset-aware/tz-aware
625941d9796e427e537b0857
def __init__(self): <NEW_LINE> <INDENT> HOST = 'userread' <NEW_LINE> HOST = 'karttur' <NEW_LINE> secrets = netrc.netrc() <NEW_LINE> dbuser, account, dbuserpswd = secrets.authenticators( HOST ) <NEW_LINE> dbuserpswd = b64encode(dbuserpswd.encode()) <NEW_LINE> query = {'db':'postgres','user':dbuser,'pswd':dbuserpswd} <NE...
The constructor connects to the database
625941d96fece00bbac2d9d1
def test_roundtrips(): <NEW_LINE> <INDENT> conn = connect() <NEW_LINE> now = datetime.datetime.now() <NEW_LINE> conn.addTriple('<http:object>', '<http:bool>', True) <NEW_LINE> conn.addTriple('<http:object>', '<http:str>', 'Me') <NEW_LINE> conn.addTriple('<http:object>', '<http:int>', 1234) <NEW_LINE> conn.addTriple('<h...
Test round-tripping of Python values.
625941d9a05bb46b383ecab0
def _get_latest_weather_activity_in_xml( self, lon, lat ): <NEW_LINE> <INDENT> path = 'http://api.openweathermap.org/data/2.5/weather?' 'mode=xml&lat=%f&lon=%f&appid=52c86a71c2d91476335ddaf0738e2987' % (float(lat),float(lon)) <NEW_LINE> req = urllib.urlopen( path ) <NEW_LINE> data = req.read(...
Get the weather of the area where the earthquake occured. Data is returned in a XML format. JSON format. input - lon --> longitude lat --> latitude output - 0 --> Failure 1 --> Pass
625941d90a366e3fb873eaac
@app.route('/') <NEW_LINE> def hello(): <NEW_LINE> <INDENT> return send_from_directory('', 'index.html')
Another Comment
625941d9f548e778e58cd80f
def test_animation_scale_1b(self): <NEW_LINE> <INDENT> scale = 1.0 <NEW_LINE> out = setup_animation( scale, istep=None, animate_scale=True, animate_phase=False, animate_time=False, icase_disp=42, icase_start=None, icase_end=None, icase_delta=None, time=1.0, animation_profile='0 to scale to 0', fps=10) <NEW_LINE> phases...
0 to scale to 0
625941d95f7d997b87174d2a
def force_clean(self, caller=True): <NEW_LINE> <INDENT> obj_key = NAME_TO_KEY[self.__class__.__name__] <NEW_LINE> if caller: <NEW_LINE> <INDENT> self.to_graph_objs(caller=False) <NEW_LINE> <DEDENT> del_keys = [key for key in self if str(key) not in INFO[obj_key]] <NEW_LINE> for key in del_keys: <NEW_LINE> <INDENT> if (...
Attempts to convert to graph_objs and call force_clean() on values. Calling force_clean() on a Layout will ensure that the object is valid and may be sent to plotly. This process will also remove any entries that end up with a length == 0. Careful! This will delete any invalid entries *silently*. This method differs...
625941d9e1aae11d1e749f49
def gumbel_softmax(log_probs, temperature, hard=False): <NEW_LINE> <INDENT> y = gumbel_softmax_sample(log_probs, temperature) <NEW_LINE> if hard: <NEW_LINE> <INDENT> y_hard = torch.cuda.FloatTensor(y.size()).zero_() <NEW_LINE> y_hard.scatter_(1, y.max(1)[1].data, 1) <NEW_LINE> y = (y_hard - y).detach() + y <NEW_LINE> <...
Sample from the Gumbel-Softmax distribution and optionally discretize. Input: log_probs: (batch_size, n_class) unnormalized log-probs temperature: non-negative scalar hard: if True, take argmax, but differentiate w.r.t. soft sample y Output: (batch_size, n_class) sample from the Gumbel-Softmax distribut...
625941d91f037a2d8b94648e
def mean_scores(scores): <NEW_LINE> <INDENT> num = len(scores) <NEW_LINE> classifiers_num = len(scores[0][0]) <NEW_LINE> scores_matrix = np.zeros((classifiers_num + 1, num)) <NEW_LINE> for idx, score in enumerate(scores): <NEW_LINE> <INDENT> that_class_scores, that_super_score = score <NEW_LINE> scores_matrix[0, idx] =...
returns mean score and its standard deviation for every model and for supermodel :param scores: list of tuples, :return:
625941d99c8ee82313fbba05
def is_huffman_leaf(tree): <NEW_LINE> <INDENT> return not is_leaf(tree) and is_leaf(branches(tree)[0])
Whether this Huffman tree is a Huffman leaf.
625941d9711fe17d825425f6
def _get_test(self, obj, name, module, globs, source_lines): <NEW_LINE> <INDENT> if isinstance(obj, str): <NEW_LINE> <INDENT> docstring = obj <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if obj.__doc__ is None: <NEW_LINE> <INDENT> docstring = '' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> do...
Return a DocTest for the given object, if it defines a docstring; otherwise, return None.
625941d90fa83653e465724a
def connect(self): <NEW_LINE> <INDENT> if 'SAPIENTA_MQ_USER' in self.config: <NEW_LINE> <INDENT> logging.info("Using authentication username: %s", self.config['SAPIENTA_MQ_USER']) <NEW_LINE> auth = pika.credentials.PlainCredentials( self.config['SAPIENTA_MQ_USER'], self.config['SAPIENTA_MQ_PASS']) <NEW_LINE> <DEDENT> e...
Connect the MQ client to the broker
625941d9b57a9660fec33b17
def use_market(self, market): <NEW_LINE> <INDENT> self._market = market
Sets the Market this Brain should use to make decisions.
625941d99b70327d1c4e1066
def document_details(self): <NEW_LINE> <INDENT> document = Document.query.filter(Document.document_id == self.data[0]).first() <NEW_LINE> return (document.document_type, document.document_primary_key)
Return the posting's document type and document_primary_key.
625941d992d797404e30441b
def predict(self, coordinates): <NEW_LINE> <INDENT> check_is_fitted(self, ["coef_"]) <NEW_LINE> easting, northing = n_1d_arrays(coordinates, 2) <NEW_LINE> shape = np.broadcast(*coordinates[:2]).shape <NEW_LINE> data = np.zeros(easting.size, dtype=easting.dtype) <NEW_LINE> combinations = polynomial_power_combinations(se...
Evaluate the polynomial trend on the given set of points. Requires a fitted estimator (see :meth:`~verde.Trend.fit`). Parameters ---------- coordinates : tuple of arrays Arrays with the coordinates of each data point. Should be in the following order: (easting, northing, vertical, ...). Only easting and n...
625941d996565a6dacc8f95b
def UnitsByMagnitude(suggested_binary_size_scales=None): <NEW_LINE> <INDENT> scale_items = sorted(six.iteritems(scales), key=lambda value: (value[1], value[0])) <NEW_LINE> if suggested_binary_size_scales is None: <NEW_LINE> <INDENT> return [key + type_abbr for key, _ in scale_items] <NEW_LINE> <DEDENT> return [key + ty...
Returns a list of the units in scales sorted by magnitude.
625941d9e76e3b2f99f3aa98
def match_main(self, text, pattern, loc): <NEW_LINE> <INDENT> if text == None or pattern == None: <NEW_LINE> <INDENT> raise ValueError("Null inputs. (match_main)") <NEW_LINE> <DEDENT> loc = max(0, min(loc, len(text))) <NEW_LINE> if text == pattern: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> elif not text: <NEW_LI...
Locate the best instance of 'pattern' in 'text' near 'loc'. Args: text: The text to search. pattern: The pattern to search for. loc: The location to search around. Returns: Best match index or -1.
625941d9498bea3a759b9d3f
def get_meta_volume(self,total=False): <NEW_LINE> <INDENT> if(total): <NEW_LINE> <INDENT> return self.dim(split=False)*np.prod(self.vol,axis=0,dtype=None,out=None) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> mol = np.ones(self.dim(split=True),dtype=self.vol.dtype,order='C') <NEW_LINE> return self.calc_weight(mol,powe...
Calculates the meta volumes. The meta volumes are the volumes associated with each component of a field, taking into account field components that are not explicitly included in the array of field values but are determined by symmetry conditions. In the case of an :py:class:`rg_space`, the meta volumes are simply the ...
625941d9f8510a7c17cf998e
def rad_to_deg(rad): <NEW_LINE> <INDENT> return degrees(rad)
радианы >> градусы
625941d9bde94217f368307f
def get_third_party_platform_name(ctx, waf_platform_key): <NEW_LINE> <INDENT> if waf_platform_key not in PLATFORM_TO_3RD_PARTY_SUBPATH: <NEW_LINE> <INDENT> ctx.fatal('Platform {} does not have a mapped sub path for 3rd Party Static Libraries in {}/wscript'.format(waf_platform_key, ctx.path.abspath())) <NEW_LINE> <DEDEN...
Get the third party platform name for a waf platform name :param ctx: The current context :param waf_platform_key: The waf platform key :return:
625941d9d58c6744b4257eef
def prepare_normalized_title(self, obj): <NEW_LINE> <INDENT> return self._normalize_multilang_field(obj, self.normalized_title.model_attr)
Prepare multi-language field to normalize its content :param obj: photo instance :return: normalized string
625941d98e7ae83300e4b25e
def get_child_class(self): <NEW_LINE> <INDENT> if self.child_class: <NEW_LINE> <INDENT> return models.get_model(*self.child_class.rsplit('.', 1)) <NEW_LINE> <DEDENT> return models.get_model('geo', 'region')
Returns child class
625941d9b830903b967e9b99
def _validate_and_download_bigrams(fdir): <NEW_LINE> <INDENT> if os.path.exists(BI_DATA_FILE): <NEW_LINE> <INDENT> print('Bi - gram files are prepared') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print('Coping bi - gram files') <NEW_LINE> bi_path = _files.join_path(fdir, BT_TEXT) <NEW_LINE> shutil.copy2(bi_path, DAT...
Validates and downloads bigram files
625941d9ec188e330fd5aa2c
def add_metric(self, category, counter, instance, value, log_event=False): <NEW_LINE> <INDENT> if log_event: <NEW_LINE> <INDENT> from azurelinuxagent.common.version import AGENT_NAME <NEW_LINE> message = "Metric {0}/{1} [{2}] = {3}".format(category, counter, instance, value) <NEW_LINE> _log_event(AGENT_NAME, "METRIC", ...
Create and save an event which contains a telemetry event. :param str category: The category of metric (e.g. "cpu", "memory") :param str counter: The specific metric within the category (e.g. "%idle") :param str instance: For instanced metrics, the instance identifier (filesystem name, cpu core#, etc.) :param value: V...
625941d92ae34c7f2600d3c1
def write(self, obj): <NEW_LINE> <INDENT> if obj.virtuel: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> template = self.curtemp <NEW_LINE> for i in template: <NEW_LINE> <INDENT> if i.startswith('='): <NEW_LINE> <INDENT> val = obj.attributs.get(i[1], '') <NEW_LINE> self.fichier.write('"'+val+'" ') <NEW_LINE> <DED...
ecrit un objet
625941d930bbd722463cc059
def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(SelectableGrid, self).__init__(**kwargs) <NEW_LINE> keyboard = Window.request_keyboard(None, self) <NEW_LINE> keyboard.bind(on_key_down=self.select_with_key_down, on_key_up=self.select_with_key_up) <NEW_LINE> self.cols=1 <NEW_LINE> self.initiate_widgets(**kwargs)
Use the initialize method to bind to the keyboard to enable keyboard interaction e.g. using shift and control for multi-select.
625941d9f7d966606f6aa298
@tf_export('image.rgb_to_grayscale') <NEW_LINE> def rgb_to_grayscale(images, name=None): <NEW_LINE> <INDENT> with ops.name_scope(name, 'rgb_to_grayscale', [images]) as name: <NEW_LINE> <INDENT> images = ops.convert_to_tensor(images, name='images') <NEW_LINE> orig_dtype = images.dtype <NEW_LINE> flt_image = convert_imag...
Converts one or more images from RGB to Grayscale. Outputs a tensor of the same `DType` and rank as `images`. The size of the last dimension of the output is 1, containing the Grayscale value of the pixels. Args: images: The RGB tensor to convert. The last dimension must have size 3 and should contain RGB valu...
625941d9cc40096d61595be0
def close(self): <NEW_LINE> <INDENT> assert self._file is not None <NEW_LINE> self._file.close() <NEW_LINE> self._file = None
Close the file
625941d976e4537e8c351905
def climbStairs(self, n): <NEW_LINE> <INDENT> result = 0 <NEW_LINE> n1 = 1 <NEW_LINE> n2 = 2 <NEW_LINE> if(n==1): <NEW_LINE> <INDENT> return n1 <NEW_LINE> <DEDENT> elif(n==2): <NEW_LINE> <INDENT> return n2 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for i in range(2,n): <NEW_LINE> <INDENT> result = n1+n2 <NEW_LINE> n...
:type n: int :rtype: int
625941d9d6c5a102081442dd
def updateStud(self,Stud): <NEW_LINE> <INDENT> if Stud not in self._elems: <NEW_LINE> <INDENT> raise RepoError("inexistent element!") <NEW_LINE> <DEDENT> for x in range(len(self._elems)): <NEW_LINE> <INDENT> if self._elems[x] == Stud: <NEW_LINE> <INDENT> self._elems[x] = Stud <NEW_LINE> return
functie care innoieste atributele obiectului stud
625941d98e05c05ec3eea607
def test_share_lock(): <NEW_LINE> <INDENT> class PseudoStore: <NEW_LINE> <INDENT> points = {'point_1': SettingPoint('lol'), 'point_2': SettingPoint('kek', shared_lock_with=('point_1', )), 'point_3': SettingPoint('cheburek')} <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> for name, point in self.points.items(): <NEW...
Проверяем, что объекты блокировок действительно шарятся.
625941d93c8af77a43ae3a33
def add_type(self, block_type): <NEW_LINE> <INDENT> self.blocks[block_type.name] = block_type
:param block_type: :type block_type: BlockType
625941d97cff6e4e81117c16
def __init__(self, graph, command=None): <NEW_LINE> <INDENT> self.graph=graph <NEW_LINE> self.return_command=command <NEW_LINE> self.widgets = {} <NEW_LINE> cget = graph.legend_cget <NEW_LINE> self.widgets['top'] = t = Pmw.Dialog(parent=graph, command=self.commands, buttons=('OK', 'Apply','Quit'), title='BltConfigureLe...
Inputs: graph: A Pmw.Blt.Graph instance command: An optional callback function that will be called each time the legend is modified. The callback will be called as: command()
625941d991af0d3eaac9bcac
@user_passes_test(is_company, login_url="/") <NEW_LINE> def post_job(request): <NEW_LINE> <INDENT> if request.method == "POST": <NEW_LINE> <INDENT> form = PostJobForm(request.POST) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> user = Profile.objects.get(pk=request.user.id) <NEW_LINE> job_post = JobPost(company=use...
Renders the postjob form on GET; processes the postjob form on POST :param request: The http request containing user information or extra arguments :type request: HttpRequest :return: the rendered JobForm or a redirect to the company's dashboard :rtype: HttpResponse
625941d97d43ff24873a2f32
def _decompose_column(self, circuit, q, diag, remaining_isometry, column_index): <NEW_LINE> <INDENT> n = int(np.log2(self.params[0].shape[0])) <NEW_LINE> for s in range(n): <NEW_LINE> <INDENT> self._disentangle(circuit, q, diag, remaining_isometry, column_index, s)
Decomposes the column with index column_index.
625941d9b7558d58953c51a1
def __init__(self, running=None, terminated=None, waiting=None): <NEW_LINE> <INDENT> self._running = None <NEW_LINE> self._terminated = None <NEW_LINE> self._waiting = None <NEW_LINE> self.discriminator = None <NEW_LINE> if running is not None: <NEW_LINE> <INDENT> self.running = running <NEW_LINE> <DEDENT> if terminate...
V1ContainerState - a model defined in Swagger
625941d97b180e01f3dc4a8a
def removeCaret(contentData, modificationFlag): <NEW_LINE> <INDENT> startTime = datetime.now() <NEW_LINE> modificationFlag = True <NEW_LINE> if debugFlag: <NEW_LINE> <INDENT> print("\t[!] Removed Carets - %s: %s" % (modificationFlag, datetime.now() - startTime)) <NEW_LINE> <DEDENT> return contentData.replace("^", ""), ...
Removes Caret which can be used as obfuscation to break strings apart. Args: contentData: "$v^a^r=^'EXAMPLE'^" modificationFlag: Boolean Returns: contentData: "$var='EXAMPLE'" modificationFlag: Boolean
625941d956ac1b37e626445d
def kick(self, kickedByRoom): <NEW_LINE> <INDENT> if kickedByRoom: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> print("\nYou can't kick the fishing rod.")
Try to kick the object
625941d98da39b475bd65207
def test_load_exception(self): <NEW_LINE> <INDENT> undefined = 'undefined' <NEW_LINE> with self.assertRaises(ReporterError) as context: <NEW_LINE> <INDENT> Reporter.load(undefined,'test.local', {}) <NEW_LINE> self.assertTrue('Unable to get reporter `{plugin}`'.format(plugin=undefined) in context.exception) <NEW_LINE> s...
Reporter.load() exception test
625941d9507cdc57c6306f71
def generate_header(self): <NEW_LINE> <INDENT> return self.impl.generate_header()
Generate details related to TCI that go in the config file header.
625941d9167d2b6e31218e26
def clean(self): <NEW_LINE> <INDENT> nb_par = 0 <NEW_LINE> buffer = '' <NEW_LINE> data = self.data <NEW_LINE> data = data.replace('\n', ' ') <NEW_LINE> data = data.replace('\t', ' ') <NEW_LINE> data = data.replace('\r', ' ') <NEW_LINE> for c in data: <NEW_LINE> <INDENT> if c == '(': <NEW_LINE> <INDENT> nb_par += 1 <NEW...
Une clause par ligne, séparation des token par un espace (ou la fin de ligne le cas échéant).
625941d93cc13d1c6d3c760a
def launch(context, service_id, every=2000): <NEW_LINE> <INDENT> return ChannelStats(context=context, service_id=service_id, every=every)
Initialize the module.
625941d93d592f4c4ed1d2fa
def __init__(self, feedback_email=None): <NEW_LINE> <INDENT> self.__discriminator_value = None <NEW_LINE> self.feedback_email = feedback_email
Beta test meta-data. :param feedback_email: Email address for providing feedback. :type feedback_email: (optional) str
625941d9fff4ab517eb2f6ce
def sort(numbers): <NEW_LINE> <INDENT> quick_sort(numbers, 0, len(numbers)-1)
call quick sort specifying init and end
625941d94e696a04525c96dd
def p_for_logic(p): <NEW_LINE> <INDENT> if(len(p) == 2): <NEW_LINE> <INDENT> p[0] = Node("for_logic", [p[1]]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> leaf2 = create_children("TOK_semi", p[2]) <NEW_LINE> p[0] = Node("for_logic", [p[1], leaf2, p[3]])
for_logic : for_update | for_update TOK_semi for_logic
625941d97c178a314d6ef6f4
def __str__(self): <NEW_LINE> <INDENT> outstr = ["\n<%s: %s %d features>" % (self.__class__, self.name, len(self.features))] <NEW_LINE> return "\n".join(outstr)
Return a formatted string with information about the feature set.
625941d973bcbd0ca4b2c307
def concat_images(images, check_affines=True): <NEW_LINE> <INDENT> n_imgs = len(images) <NEW_LINE> img0 = images[0] <NEW_LINE> is_filename = False <NEW_LINE> if not hasattr(img0, 'get_data'): <NEW_LINE> <INDENT> img0 = load(img0) <NEW_LINE> is_filename = True <NEW_LINE> <DEDENT> i0shape = img0.shape <NEW_LINE> affine =...
Concatenate images in list to single image, along last dimension Parameters ---------- images : sequence sequence of ``SpatialImage`` or of filenames\s check_affines : {True, False}, optional If True, then check that all the affines for `images` are nearly the same, raising a ``ValueError`` otherwise. Defaul...
625941d956b00c62f0f148ec
def compile(self, gen_opt=None, dis_opt=None, gen_lr=3e-4, dis_lr=3e-4, lambda_a=10.0, lambda_b=10.0, lambda_identity=0.5, lambda_gan=1.0): <NEW_LINE> <INDENT> self.d_a = self.compile_training_d(self.d_a, opt=dis_opt, lr=dis_lr) <NEW_LINE> self.d_b = self.compile_training_d(self.d_b, opt=dis_opt, lr=dis_lr) <NEW_LINE> ...
Compile generators and discriminators for training. :param gen_opt: Optimizer instance for generator. If None, Adam is used with learning rate specified by gen_lr. :param dis_opt: Optimizer instance for discriminator. If None, Adam is used with learning rate specified by dis_lr. :param gen_lr: Learning rate fo...
625941d9de87d2750b860026
def get_dest_name(src: str, i: int, dest: str, prefix: str) -> str: <NEW_LINE> <INDENT> index = str(i).zfill(2) <NEW_LINE> filename = os.path.split(src)[-1] <NEW_LINE> name, ext = os.path.splitext(filename) <NEW_LINE> return os.path.join(dest, f'{prefix}{name}-{index}{ext}')
Format for destination file filename. Args: src - Source filename i - Index of current file dest - Destination directory prefix - Prefix for this file
625941d9e8904600ed9f21c1
def levelOrder(self, root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> q = [root] <NEW_LINE> result = [] <NEW_LINE> while q: <NEW_LINE> <INDENT> currentLevel = [] <NEW_LINE> nextLevel = [] <NEW_LINE> for node in q: <NEW_LINE> <INDENT> currentLevel.append(node.val) <NEW_LINE> for ...
:type root: Node :rtype: List[List[int]]
625941d985dfad0860c3b0ed
def output_csv(items, filepath): <NEW_LINE> <INDENT> def write_rows(writer, items): <NEW_LINE> <INDENT> for item in items: <NEW_LINE> <INDENT> writer.writerow({ 'Title': item['title'], 'Views': item['page_views_count'], 'Likes': item['likes_count'], 'Stocks': item['stocks_count'], 'Id': item['id'] }) <NEW_LINE> <DEDENT...
csvに整形して標準出力に出力する。 ファイル名が指定された場合はファイルに出力する。 :param items: :param filepath: :return:
625941d9ad47b63b2c50a210
def fit_transform(X, Y, fit=fit, *args): <NEW_LINE> <INDENT> return transform(Y, *fit(X, Y, *args))
Return Y superposed on X. @type X: (n,3) numpy.array @type Y: (n,3) numpy.array @type fit: function @rtype: (n,3) numpy.array
625941d9a17c0f6771cbe2e1
def __init__(self, thresh=.0, fraction=.0, dataset=None): <NEW_LINE> <INDENT> self.feature = 'none' <NEW_LINE> self.fraction = fraction <NEW_LINE> self.thresh = thresh <NEW_LINE> self.section = self.get_section(dataset) <NEW_LINE> self.name = f'{self.feature}-{self.thresh}-{self.fraction}'
:param thresh: threshold, frame with diff above which will be sent :param fraction: only support first and second, force the fraction :param dataset: for loading external config
625941d9aad79263cf390cd6
def test_unicode_2(self, exec2): <NEW_LINE> <INDENT> ustr = 'u"ááá"' <NEW_LINE> x = r'\xe1\xe1\xe1' <NEW_LINE> exec2(ustr, x)
Test for cell with input u"ááá". Input u"ááá" in an actual cell causes latin1 encoding to appear enclosed by u"...", inside a unicode string in the message to sage_server. (So there are two u's in the displayed message in the log.) Code part of logged input message to sage_server: u'code': u'u"\xe1\xe1\xe1"\n' Stdout...
625941d95510c4643540f670
def __wait_for_helm_to_fail(self, timeout): <NEW_LINE> <INDENT> seconds_to_sleep = 1 <NEW_LINE> output = self.__helm.status("lostromos-nemo") <NEW_LINE> self.assertNotIn( "STATUS: FAILED", output.decode("utf-8"), "Helm release is FAILED but did not wait for the timeout" ) <NEW_LINE> self.assertNotIn("STATUS: DEPLOYED",...
Wait for the helm timeout to be reached and verify the release is marked as failed :return:
625941d96e29344779a628a2
def inline_html(self, html): <NEW_LINE> <INDENT> self.count_1('html', html) <NEW_LINE> return 'A' * len(html)
Process inline HTML
625941d910dbd63aa1bd2e34
def set_lambert_ticks(ax,xskip=10.,yskip=10.,x_thickness=14,y_thickness=14): <NEW_LINE> <INDENT> extent = list(ax.get_extent(ccrs.PlateCarree())) <NEW_LINE> extent_rounded = [round(val/10.0) * 10 for val in extent] <NEW_LINE> if extent_rounded[0] == extent_rounded[1]: <NEW_LINE> <INDENT> extent_rounded[0] -=10 <NEW_LIN...
PROBLEMS HERE.... extent_rounded doesn't match the real extent but if the extent is less than a skip increment then it becomes all messed up. labels are inconsistent. Not sure why it plots sometimes and not othertimes. I want to be able to have gridlines on set increments like at 5N,10N,15N,20N or 10N,20N,30N. Gridline...
625941d98e05c05ec3eea608
def findRedundantConnection(self, edges: List[List[int]]) -> List[int]: <NEW_LINE> <INDENT> import collections <NEW_LINE> self.g = collections.defaultdict(list) <NEW_LINE> lines_sort = list() <NEW_LINE> for m, n in edges: <NEW_LINE> <INDENT> self.g[m].append(n) <NEW_LINE> self.g[n].append(m) <NEW_LINE> <DEDENT> self._c...
:type edges: List[List[int]] :rtype: List[int]
625941d9cdde0d52a9e532c6
def main(stdscr): <NEW_LINE> <INDENT> game = Game(stdscr) <NEW_LINE> board = Board() <NEW_LINE> game.start(board)
Play a Tic Tac Toe game.
625941d907f4c71912b11716
def _launchModule_solveForAction_Hybrid_MTLPolicyGD(self, desired_loc_land, model_dynamics, mtl_policy, options={}): <NEW_LINE> <INDENT> prefix_info = 'catapult/solveForAction_Hybrid_MTLPolicyGD:' <NEW_LINE> self._launchModule_solveForAction_Hybrid_MTLPolicyGD_iteration = 0 <NEW_LINE> pos_target_h_candidates = mtl_poli...
Hybrid action optimizer with gradient descent starting from initial guesses suggested by multilinear policy approximators and select the best candidate.
625941d957b8e32f5248372e
def __exit__(self, exc_type, exc_value, traceback): <NEW_LINE> <INDENT> self.close()
To support using the `with` statement.
625941d94527f215b584c6e6
def combinationSum2(candidates, target): <NEW_LINE> <INDENT> res = [] <NEW_LINE> candidates.sort() <NEW_LINE> def find(x, d_list, target): <NEW_LINE> <INDENT> if 0 == target: <NEW_LINE> <INDENT> res.append(d_list) <NEW_LINE> return <NEW_LINE> <DEDENT> for i in range(x, len(candidates)): <NEW_LINE> <INDENT> if i > x and...
40. 组合总和2 思路:排序+dfs+范围剪枝+已经计算的值略过 :type candidates: List[int] :type target: int :rtype: List[List[int]]
625941d9b545ff76a89140a7
def p_expression_func_call(self, t): <NEW_LINE> <INDENT> current_scope = self.type_scope_stack.get_current_scope() <NEW_LINE> func_return_type = current_scope.get_variable_type(t[1]) <NEW_LINE> t[0] = ast.FuncCall(func_name=t[1], args=t[3], type=func_return_type)
expression : NAME LPAREN args_list RPAREN
625941d95510c4643540f671