code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def get_intents(self): <NEW_LINE> <INDENT> return self._intents
A getter for the response's intents. :return: A list of intents.
625941b985dfad0860c3acc3
def list_bucket_objects(self, bucket): <NEW_LINE> <INDENT> return self.client.list_objects(Bucket=bucket).get('Contents', [])
List objects stored in a bucket Args: bucket (str): Name of the bucket Returns: list: List of bucket objects
625941b97b180e01f3dc4670
def testNone(self): <NEW_LINE> <INDENT> self._populateIndex() <NEW_LINE> values = self._values <NEW_LINE> self._checkApply(self._none_req, values[-1:]) <NEW_LINE> assert None in self._index.uniqueValues('foo')
make sure None gets indexed
625941b915fb5d323cde0974
def _state_deleted(self, want, have): <NEW_LINE> <INDENT> commands = [] <NEW_LINE> if want: <NEW_LINE> <INDENT> routes = self._get_routes(want) <NEW_LINE> if not routes: <NEW_LINE> <INDENT> for w in want: <NEW_LINE> <INDENT> af = w['address_families'] <NEW_LINE> for item in af: <NEW_LINE> <INDENT> if self.afi_in_have(h...
The command generator when state is deleted :rtype: A list :returns: the commands necessary to remove the current configuration of the provided objects
625941b9287bf620b61d38d9
def recall_all_names(self): <NEW_LINE> <INDENT> if self.cont_info.newcmd_dict.get('rcn')[0]: <NEW_LINE> <INDENT> self._get_cmd_names(self.cont_info.commandsR)
recall_all_names() scans all cmdids, if the cmdid has been renamed, the rename and cmdid are logged
625941b94e4d5625662d4247
def test_case6(self): <NEW_LINE> <INDENT> bigram_combos = ["dean ovich"] <NEW_LINE> article_content = "this is an article about \ndean ovich\n" <NEW_LINE> self.assertTrue(name_bigram_present(bigram_combos, article_content))
TC6: valid case. bigram present
625941b98e7ae83300e4ae36
def __init__(self, region, api_key): <NEW_LINE> <INDENT> super(SummonerAPIClient, self).__init__(region, api_key) <NEW_LINE> self.baseURL = "https://%s.api.pvp.net/api/lol/%s/v1.4/summoner" % (region, region) <NEW_LINE> self.byNameURL = "%s/by-name" % (self.baseURL)
Create a client API for a particular region region -- string : summoner-v1.4 [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] api_key -- string : league api key
625941b97d847024c06be12b
def select_dates(dates_raw, opts, day0=None, day1=None): <NEW_LINE> <INDENT> dt_today = datetime.datetime.utcnow() <NEW_LINE> if opts['--shift']: <NEW_LINE> <INDENT> dt_today += datetime.timedelta(days=int(opts['--shift'])) <NEW_LINE> <DEDENT> season_start = datetime.datetime(*opts['season_start']) <NEW_LINE> season_en...
return a subset of the events from today+day0 to today+day1 None in day0 means begining of current ski season None in day1 means end of current ski season
625941b96aa9bd52df036c0d
def get_ts_vals(self, var_name, ts_name, period, length): <NEW_LINE> <INDENT> ts = self._time_series.get((var_name, ts_name)) <NEW_LINE> if ts is None: <NEW_LINE> <INDENT> raise TimeSeriesNotFoundError <NEW_LINE> <DEDENT> start_index = 0 <NEW_LINE> if period[0] is not None: <NEW_LINE> <INDENT> start_index = ...
Get's value of variable for specific period in ts_name timeseries and length Args: (string): var_name - name of variable (string):ts_name - timeseries name (tuple): period in timeseries (int): length of time series Return: (list): slice of time series by specific period :return:
625941b967a9b606de4a7d27
def test_laplace(counts, vectors): <NEW_LINE> <INDENT> probs = [] <NEW_LINE> count_y = [0, 0] <NEW_LINE> for count in counts: <NEW_LINE> <INDENT> prob = [] <NEW_LINE> for i in range(2): <NEW_LINE> <INDENT> denom = 1.0 * (count[i][0] + 1) + (count[i][1] + 1) <NEW_LINE> prob.append([(count[i][0] + 1) / denom, (count[i][1...
Uses maximum likelihood estimation with Laplace smoothing on training data to predict outputs for new data vectors. MLE with Laplace smoothing is computed as follows. p(input=x|output=y) = (<num examples input=x and output=y> + 1)/(<num examples output=y> + 2) The output is predicted using Naive Bayes. The output tha...
625941b97b25080760e392c5
def itkLogImageFilterIUL2IUL2_Superclass_cast(*args): <NEW_LINE> <INDENT> return _itkLogImageFilterPython.itkLogImageFilterIUL2IUL2_Superclass_cast(*args)
itkLogImageFilterIUL2IUL2_Superclass_cast(itkLightObject obj) -> itkLogImageFilterIUL2IUL2_Superclass
625941b955399d3f0558851e
def __init__( self, *, name: Optional[str] = None, display: Optional["OperationDisplay"] = None, origin: Optional[str] = None, service_specification: Optional["ServiceSpecification"] = None, **kwargs ): <NEW_LINE> <INDENT> super(Operation, self).__init__(**kwargs) <NEW_LINE> self.name = name <NEW_LINE> self.display = d...
:keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str :keyword display: Display metadata associated with the operation. :paramtype display: ~azure.mgmt.storage.v2017_10_01.models.OperationDisplay :keyword origin: The origin of operations. :paramtype origin: str :keyword service_specific...
625941b938b623060ff0ac59
def _fetch_objects(self, doc_type=None): <NEW_LINE> <INDENT> object_map = {} <NEW_LINE> for collection, dbrefs in self.reference_map.items(): <NEW_LINE> <INDENT> ref_document_cls_exists = getattr(collection, "objects", None) is not None <NEW_LINE> if ref_document_cls_exists: <NEW_LINE> <INDENT> col_name = collection._g...
Fetch all references and convert to their document objects
625941b950812a4eaa59c190
def _hp_search_setup(self, trial: Union["optuna.Trial", Dict[str, Any]]): <NEW_LINE> <INDENT> self._trial = trial <NEW_LINE> if self.hp_search_backend is None or trial is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self.hp_search_backend == HPSearchBackend.OPTUNA: <NEW_LINE> <INDENT> params = self.hp_space(...
HP search setup code
625941b9cb5e8a47e48b7919
def _tab_completion(self, verbose=True, use_disk_cache=True): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.__tab_completion <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> import sage.misc.persist <NEW_LINE> if use_disk_cache: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.__tab_completion...
Returns a list of all the commands defined in Maple and optionally (per default) store them to disk. EXAMPLES:: sage: c = maple._tab_completion(use_disk_cache=False, verbose=False) # optional - maple sage: len(c) > 100 # optional - maple True sage: 'dilog' in c # optional - maple True
625941b923e79379d52ee3d2
def init_app(self, app): <NEW_LINE> <INDENT> if not hasattr(app, 'extensions'): <NEW_LINE> <INDENT> app.extensions = dict() <NEW_LINE> <DEDENT> app.extensions['rest-api'] = self <NEW_LINE> app.config.setdefault('RESTLY_SERIALIZER', json) <NEW_LINE> app.config.setdefault('RESTLY_API_PREFIX', '/api/rest') <NEW_LINE> app....
Initializes FlaskRestAPI :param app: Flask application :type app: Flask
625941b98e71fb1e9831d618
def exportCurve(self, factor=1., nameCSV='function.csv'): <NEW_LINE> <INDENT> df = pd.DataFrame({'X':np.around(self.time*factor, decimals=0),'Y':np.around(self.func, decimals=3)}) <NEW_LINE> df.to_csv(str(nameCSV),columns=['X', 'Y'], sep=' ', index=False ,header=0) <NEW_LINE> return
Write CSV sea level file following pyReef core requirements: + 2 columns file containing time in years (1st column) and environmental parameter (2nd column), + time will be in increasing order starting at the oldest time, + past times are negative, + the separator is a space. Parameters ---------- vari...
625941b9c432627299f04aae
def getScriptArgumentParser(description, args=sys.argv): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser( description=description) <NEW_LINE> parser.add_argument('config_file', help="Valid script configuration file. This should be the path to " "the script YAML configuration file. See config_samp...
Return ArgumentParser object Args: description: Text description of application ArgumentParser will be applied to. Kwargs: args (list): list of arguments that will be parsed. The default is the sys.argv list, and should be correct for most ...
625941b9d53ae8145f87a0e1
def getVolumeSize(self): <NEW_LINE> <INDENT> manifest = sdCache.produce_manifest(self.sdUUID) <NEW_LINE> return manifest.getVSize(self.imgUUID, self.volUUID)
Return the volume size in bytes.
625941b9187af65679ca4f88
def test_empty_string(self): <NEW_LINE> <INDENT> self.assertEqual(gen_libs.pascalize(self.data_str), self.data_test)
Function: test_empty_string Description: Test with an empty string. Arguments:
625941b97cff6e4e811177f0
def to_dist_matrix(self, graph): <NEW_LINE> <INDENT> n = len(self.graph.vert_dict) <NEW_LINE> mat = [[self.dist(self.graph.get_vertex(i), self.graph.get_vertex(j)) for i in range(n)] for j in range(n)] <NEW_LINE> return mat
Returns nxn nested list from a list of length n Used as distance matrix: mat[i][j] is the distance between node i and j
625941b9d164cc6175782bb8
def testORCA_ORCA4_1_orca_from_issue_736_out(logfile): <NEW_LINE> <INDENT> assert len(logfile.data.scfvalues) == 23 <NEW_LINE> assert abs(logfile.data.scfvalues[14][0][1] - 537) < 1.0, logfile.data.scfvalues[14][0]
ORCA file with no whitespace between SCF iteration columns.
625941b945492302aab5e12b
def systemd_notify(): <NEW_LINE> <INDENT> nofity_socket = os.getenv('NOTIFY_SOCKET') <NEW_LINE> if not nofity_socket: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if nofity_socket.startswith('@'): <NEW_LINE> <INDENT> nofity_socket = '\0' + nofity_socket[1:] <NEW_LINE> <DEDENT> sock = socket.socket(socket.AF_UNIX, soc...
Notify systemd
625941b9d7e4931a7ee9dd86
def add_md(self, cvobj, committer=None, do_commit=True): <NEW_LINE> <INDENT> name = core.outputstorage.ConvertName(cvobj.metadata['id']) <NEW_LINE> self.interface.add(name.md, cvobj.data, committer=committer, do_commit=do_commit) <NEW_LINE> return True
>>> import glob >>> import shutil >>> import os.path >>> import core.basedata >>> import services.curriculumvitae >>> import utils.docprocessor.libreoffice >>> import extractor.information_explorer >>> root = "core/test" >>> name = "cv_1.doc" >>> test_path = "services/test_output" >>> DIR = 'services/test_repo' >>> svc...
625941b926068e7796caeb43
def test_sc_bird(self): <NEW_LINE> <INDENT> trex_empty = self.create_trex_object() <NEW_LINE> expected_results = pd.Series([6.637969, 77.805, 34.96289, np.nan], dtype='float') <NEW_LINE> try: <NEW_LINE> <INDENT> trex_empty.app_rates = pd.Series([[0.34, 1.384, 13.54], [0.78, 11.34, 3.54], [2.34, 1.384, 3.4], [3.]], dtyp...
unittest for function sc_bird: m_s_a_r = ((self.app_rate * self.frac_act_ing) / 128) * self.density * 10000 # maximum seed application rate=application rate*10000 risk_quotient = m_s_a_r / self.noaec_bird
625941b9460517430c393ff9
def __finishSucceed(self): <NEW_LINE> <INDENT> for p in self.rule.produces: <NEW_LINE> <INDENT> p.finishSucceed() <NEW_LINE> <DEDENT> for r in self.rule.requires: <NEW_LINE> <INDENT> r.finishRequire()
finish up finish up requires/produces on success, failures here cause the rule to fail
625941b9099cdd3c635f0ac7
def startTimerPlayer(self): <NEW_LINE> <INDENT> self.interval = 1000 <NEW_LINE> self.startTime = time.time() <NEW_LINE> self.timerPlayer.start(1000)
" Function to start a player timer with an interval of 1000.
625941b9956e5f7376d70ce4
def handle_directory_patterns(base, file_pattern): <NEW_LINE> <INDENT> splitted = base.split("/") <NEW_LINE> i = 0 <NEW_LINE> basedir = [] <NEW_LINE> for elem in splitted: <NEW_LINE> <INDENT> if re.search(is_pattern, elem): <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> basedir.append(elem) <NEW_LINE> i += 1 <NEW_LINE> ...
Directory pattern matching e.g.: base: ftp://ftp.nessus.org/pub/nessus/nessus-([\d\.]+)/src/ file_pattern: nessus-core-([\d\.]+)\.tar\.gz
625941b963d6d428bbe4435a
def merge_min_t_arrays(binned_x, binned_extra_x, extended_binned_x, induction_loc, backward_t, forward_t, debug=False): <NEW_LINE> <INDENT> merged_min_t = np.empty_like(binned_extra_x) <NEW_LINE> merged_min_t[:] = np.nan <NEW_LINE> extended_min_t = np.empty_like(extended_binned_x) <NEW_LINE> extended_min_t[:] = np.nan ...
:param binned_x: array :param binned_extra_x: array :param extended_binned_x: array :param induction_loc: :param backward_t: :param forward_t: :param debug: bool :return: array
625941b9fff4ab517eb2f2a4
def select_sheet(self, number): <NEW_LINE> <INDENT> tree = ET.parse(self.directory_to_extract_to + "xl/worksheets/sheet" + str(number) + ".xml") <NEW_LINE> self.current_root = tree.getroot() <NEW_LINE> self.current_sheet_number = number <NEW_LINE> self.current_sheet = self.get_child_by_tag(tree.getroot(), "sheetData")[...
return the root corresponding to the sheet with the parameter number
625941b99f2886367277a6fc
def list_all( self, **kwargs: Any ) -> AsyncIterable["_models.ApplicationGatewayListResult"]: <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LI...
Gets all the application gateways in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGatewayListResult or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v201...
625941b95fcc89381b1e152f
def get_freq(self, token): <NEW_LINE> <INDENT> return self.token_freq[token]
Returns the frequency the specified token has occured in the training corpus. :param token: The target token. :type token: str :return: The token's frequency. :rtype: int
625941b915baa723493c3ddd
def convergence_time(number): <NEW_LINE> <INDENT> t_average = 0.0 <NEW_LINE> data_set = DataSet(number) <NEW_LINE> for i in range(1000): <NEW_LINE> <INDENT> data_set.new_set() <NEW_LINE> w = linear_regression(data_set) <NEW_LINE> temp = pla.pla(w, data_set) <NEW_LINE> t_average = (t_average * i + temp) / (i + 1) <NEW_L...
Use LR as output for start vector of PLA algorithm. Outputs average time (1000 trials) of pla before convergence Params: Number of points in data set Return: Average time of convergence for modified PLA
625941b9d99f1b3c44c67402
def xtime(self, path, *a, **opts): <NEW_LINE> <INDENT> if a: <NEW_LINE> <INDENT> rsc = a[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rsc = self.master <NEW_LINE> <DEDENT> self.make_xtime_opts(rsc == self.master, opts) <NEW_LINE> return self.xtime_low(rsc, path, **opts)
get amended xtime as of amending, we can create missing xtime, or determine a valid value if what we get is expired (as of the volume mark expiry); way of amendig depends on @opts and on subject of query (master or slave).
625941b9435de62698dfdabf
def del_all_produits(self): <NEW_LINE> <INDENT> if self.produits.count(): <NEW_LINE> <INDENT> for vendu in self.produits.iterator(): <NEW_LINE> <INDENT> vendu.delete() <NEW_LINE> <DEDENT> self.produits.clear() <NEW_LINE> self.montant_alcool = Decimal("0") <NEW_LINE> self.montant_normal = Decimal("0") <NEW_LINE> for pai...
On supprime tous les produits
625941b9de87d2750b85fbf9
def process_frame(self, img): <NEW_LINE> <INDENT> raise NotImplementedError("subclass must implement process_frame()")
Computes the dense optical flow field for the next frame. Args: img: an m x n x 3 image Returns: an m x n x 2 array containing the optical flow vectors in Cartesian (x, y) format
625941b99c8ee82313fbb5e0
def selected_symbol_index(self): <NEW_LINE> <INDENT> return self.recent.GetNextSelected(-1)
returns index (in the list of displayed symbols) of the currently selected symbol.
625941b9379a373c97cfa9b5
def test_visualize(self): <NEW_LINE> <INDENT> import barrista.design as design <NEW_LINE> if design._draw is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> from barrista.design import ConvolutionLayer, ReLULayer <NEW_LINE> netspec = design.NetSpecification([[10, 3, 51, 51], [10]], inputs=['data', 'annotations'], ...
Test the ``visualize`` function.
625941b921bff66bcd6847c0
def copyPoolsFromSampler(self, sampler): <NEW_LINE> <INDENT> self._samplerPools = sampler._samplerPools.copy() <NEW_LINE> self._samplerPoolPriorityList = sampler._samplerPoolPriorityList.copy() <NEW_LINE> self._samplerMap = sampler._samplerMap.copy()
Clears this sampler and copies all sampler pools and their corresponding priority :param sampler: sampler to copy the sampler pools from
625941b9fb3f5b602dac34fa
def p_subsections(self, subsections): <NEW_LINE> <INDENT> self._act_on_list(subsections)
subsections : subsections subsection | subsection
625941b967a9b606de4a7d28
def make_di_problem(step_len, n_steps, damp, jitter, discount, bounds, cost_radius, actions): <NEW_LINE> <INDENT> (A,action_dim) = actions.shape <NEW_LINE> assert(action_dim == 1) <NEW_LINE> assert(actions[0] == -actions[-1]) <NEW_LINE> state_dim = 2 <NEW_LINE> trans_params = utils.kwargify(step=step_len, num_steps=n_s...
Makes a double integrator problem TODO: take in parameters
625941b9dc8b845886cb53a0
def _init_es(es, prefix, video_index, comment_index): <NEW_LINE> <INDENT> if es.indices.exists(index=video_index): <NEW_LINE> <INDENT> es.indices.delete(index=video_index) <NEW_LINE> <DEDENT> if es.indices.exists(index=comment_index): <NEW_LINE> <INDENT> es.indices.delete(index=comment_index) <NEW_LINE> <DEDENT> es.ind...
sets up blank es index and adds doc type mapping information
625941b9d486a94d0b98dfb8
def __contains__(self,obj2): <NEW_LINE> <INDENT> if(isinstance(obj2,DNA_part)): <NEW_LINE> <INDENT> if(obj2.parent==self): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif(obj2.parent==None): <NEW_LINE> <INDENT> new_obj2 = copy.copy(obj2).unclone() <NEW_LINE> uncloned_list = [copy.copy(a).unclone() for a in sel...
checks if this construct contains a certain part, or a copy of a certain part
625941b9925a0f43d2549cdf
def parse_gulp(filename, crystalStruc, path='./'): <NEW_LINE> <INDENT> gulp_lines = util.read_file(filename, path) <NEW_LINE> sysInfo = [] <NEW_LINE> atomsNotFound = True <NEW_LINE> allAtoms = dict() <NEW_LINE> i = 0 <NEW_LINE> for i, line in enumerate(gulp_lines): <NEW_LINE> <INDENT> if line.startswith('#'): <NEW_LINE...
Parses the file <line> to extract structural information, atomic potentials, and control parameters. <crystalStruc> must be initialised (with dummy cell parameters) prior to use.
625941b931939e2706e4ccdb
@pytest.mark.usefixtures("f2003_create") <NEW_LINE> @pytest.mark.parametrize('line', [ None, '', ' ', '#ifdfe', '#if', '#ifdef', '#ifdef two macros']) <NEW_LINE> def test_incorrect_if_stmt(line): <NEW_LINE> <INDENT> with pytest.raises(NoMatchError) as excinfo: <NEW_LINE> <INDENT> _ = Cpp_If_Stmt(line) <NEW_LINE> <DEDEN...
Test that incorrectly formed #if statements raise exception.
625941b950485f2cf553cc04
def crf_nll(y_true, y_pred): <NEW_LINE> <INDENT> crf, idx = y_pred._keras_history[:2] <NEW_LINE> assert not crf._outbound_nodes, 'When learn_model="join", CRF must be the last layer.' <NEW_LINE> if crf.sparse_target: <NEW_LINE> <INDENT> y_true = K.one_hot(K.cast(y_true[:, :, 0], 'int32'), crf.units) <NEW_LINE> <DEDENT>...
Usual Linear Chain CRF negative log likelihood. Used for CRF "join" mode. See `layers.CRF` for usage.
625941b915fb5d323cde0975
def combinationSum3(self, k, n): <NEW_LINE> <INDENT> if n > 9 * k: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> def __directed_combination(k, n, partial, start): <NEW_LINE> <INDENT> if k == 0 and n == 0: <NEW_LINE> <INDENT> res.append(partial) <NEW_LINE> print(res) <NEW_LINE> <DEDENT> for i in range(start, 10): <N...
:type k: int :type n: int :rtype: List[List[int]] Backtracking
625941b99b70327d1c4e0c3f
def get_location(lat, lng): <NEW_LINE> <INDENT> path = "http://nominatim.openstreetmap.org/reverse" <NEW_LINE> params = urllib.parse.urlencode({'format': 'json', 'lat': lat, 'lon': lng, 'zoom': 11}) <NEW_LINE> url = "{0}/?{1}".format(path, params) <NEW_LINE> with urllib.request.urlopen(url) as response: <NEW_LINE> <IND...
Returns a string describing the location of a given lat/lng. Example: 41.878114, -87.629798 would return "Chicago, Illinois, United States of America"
625941b9be7bc26dc91cd471
def test_product_without_images(self): <NEW_LINE> <INDENT> product_page = ProductPage(self.driver) <NEW_LINE> product_page.open(21) <NEW_LINE> expected_product_main_image = 'http://via.placeholder.com/300x300?text=%C5%BD%C3%A1dn%C3%BD%20obr%C3%A1zek' <NEW_LINE> assert product_page.product_main_image() == expected_produ...
Test place holder for a product image when product doesn't have any images
625941b9004d5f362079a1a2
def test_get_lookup_codes(self): <NEW_LINE> <INDENT> response = self.client.get( reverse("lookup-codes-all") ) <NEW_LINE> expected_languages = ProgrammingLanguage.objects.all() <NEW_LINE> expected_countries = LocationCountryCode.objects.all() <NEW_LINE> serialised = LookupCodeListSerializer( {'programming_languages': e...
This test asserts that all lookup code records added during setUp will be retrieved and serialized when making a GET request to the codes/all endpoint.
625941b9442bda511e8be291
def setParams(self, *args): <NEW_LINE> <INDENT> return _MontePython_cxx.PollsJastrow_setParams(self, *args)
setParams(PollsJastrow self, QickArray & params_)
625941b9a8ecb033257d2f42
def cog_unload(self) -> None: <NEW_LINE> <INDENT> self._init_task.cancel() <NEW_LINE> self._init_task.add_done_callback(lambda _: self.scheduler.cancel_all())
Cancel the init task and scheduled tasks.
625941b9f7d966606f6a9e73
def getRoll(self) -> float: <NEW_LINE> <INDENT> raw = self.ahrs.getRoll() <NEW_LINE> return -math.radians(raw)
Get current roll in radians (rotation around Y axis) Angles are in the interval [-pi, pi], anticlockwise positive.
625941b97cff6e4e811177f1
def spi_set_dff_16bit(): <NEW_LINE> <INDENT> pass
__NATIVE__ PmReturn_t retval = PM_RET_OK; pPmObj_t p0; uint32_t spi; /* If wrong number of args, raise TypeError */ if (NATIVE_GET_NUM_ARGS() != 1) { PM_RAISE_WITH_INFO(retval, PM_RET_EX_TYPE, "incorrect number of arguments"); return retval; } p0 = NATIVE_GET_LOCAL(0); /* If arg is not an int, raise TypeErro...
625941b93346ee7daa2b2bd5
def deploy(self, target, prefix_dir): <NEW_LINE> <INDENT> prefix_content = [ x for x in os.listdir(prefix_dir) if not os.path.join(prefix_dir, x) in self.skip_names ] <NEW_LINE> os.chdir(prefix_dir) <NEW_LINE> cmd = ['scp', '-r', '-q'] + prefix_content + [target] <NEW_LINE> subproc.monitor_process(cmd...
docstring for deploy
625941b963f4b57ef0000f8d
def distance(a,b): <NEW_LINE> <INDENT> mx_arr_a = theano.tensor.repeat(a, b.shape[0], axis=0) <NEW_LINE> mx_arr_b = theano.tensor.tile(b, (a.shape[0], 1)) <NEW_LINE> v_d = theano.tensor.sqrt(theano.tensor.sum((mx_arr_a-mx_arr_b)**2, axis=1)) <NEW_LINE> return theano.tensor.reshape(v_d, (a.shape[0], b.shape[0]))
Return a matrix of distances from a matrix of coordinates.
625941b95166f23b2e1a4fc5
def create(self, tdirNEvents, requireAllHistograms=False): <NEW_LINE> <INDENT> self._histograms = [self._createOne(self._name, i, tdirNEvent[0], tdirNEvent[1]) for i, tdirNEvent in enumerate(tdirNEvents)] <NEW_LINE> if self._fallback is not None: <NEW_LINE> <INDENT> profileX = [self._profileX]*len(self._histograms) <NE...
Create histograms from list of TDirectories
625941b97b25080760e392c6
def list_documents(self, col_id): <NEW_LINE> <INDENT> url = f"{self.base_url}/collections/{col_id}/list" <NEW_LINE> response = requests.get(url, cookies=self.login_cookie) <NEW_LINE> if response.ok: <NEW_LINE> <INDENT> return response.json() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return response.ok
Helper function to interact with TRANSKRIBUS collection endpoint to list all documents :param col_id: The ID of a TRANSKRIBUS Collection :return: A dict with the default TRANSKRIBUS API return
625941b963d6d428bbe4435b
def delete(self, table, row=None, **kw): <NEW_LINE> <INDENT> if table.endswith('*'): <NEW_LINE> <INDENT> table = table[:-1].rstrip() <NEW_LINE> <DEDENT> attnames = self.get_attnames(table) <NEW_LINE> qoid = _oid_key(table) if 'oid' in attnames else None <NEW_LINE> if row is None: <NEW_LINE> <INDENT> row = {} <NEW_LINE>...
Delete an existing row in a database table. This method deletes the row from a table. It deletes based on the primary key of the table or the OID value as munged by get() or passed as keyword. The OID will take precedence if provided. The return value is the number of deleted rows (i.e. 0 if the row did not exist a...
625941b95fdd1c0f98dc009d
def skriv_dagalmanacka(dagalma): <NEW_LINE> <INDENT> def skriv_dagalma_intern(mt): <NEW_LINE> <INDENT> skriv_mötestid(mt) <NEW_LINE> print() <NEW_LINE> <DEDENT> för_varje_möte(dagalma, skriv_dagalma_intern)
dagalmanacka ->
625941b9ad47b63b2c509df5
def price_transform(self, price): <NEW_LINE> <INDENT> if (1 == price or 2 == price): <NEW_LINE> <INDENT> return 'Economy hotel' <NEW_LINE> <DEDENT> elif (3 == price or 4 == price ): <NEW_LINE> <INDENT> return 'Commercial hotel' <NEW_LINE> <DEDENT> elif (price == 5): <NEW_LINE> <INDENT> return 'Luxury hotel'
This function tranform the parameter price to three categories: Economy hotel, Commercial hotel, Luxury hotel. Parameter: price: int Return: String: Economy hotel, Commercial hotel, Luxury hotel.
625941b91b99ca400220a91d
def __init__(__self__, resource_name, opts=None, auth_type=None, cluster_id=None, container_name=None, directory=None, mount_name=None, storage_account_name=None, token_secret_key=None, token_secret_scope=None, __props__=None, __name__=None, __opts__=None): <NEW_LINE> <INDENT> if __name__ is not None: <NEW_LINE> <INDEN...
Create a AzureBlobMount resource with the given unique name, props, and options. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource.
625941b966656f66f7cbc016
def get_state(self): <NEW_LINE> <INDENT> return self.__running
Returns running state.
625941b9aad79263cf3908a7
def test_chshell(self): <NEW_LINE> <INDENT> mock = MagicMock(return_value={'shell': 'A'}) <NEW_LINE> with patch.object(pw_user, 'info', mock): <NEW_LINE> <INDENT> self.assertTrue(pw_user.chshell('name', 'A')) <NEW_LINE> <DEDENT> mock = MagicMock(return_value=None) <NEW_LINE> with patch.dict(pw_user.__salt__, {'cmd.run'...
Test if shell given is same as previous shell
625941b95fc7496912cc37f2
def extract_label(video_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return video_name.split('_')[1] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise ValueError('Not a valid video name.')
Extract label from video file name. >>> extract_label('v_YoYo_g25_c05.avi') 'YoYo' >>> extract_label('v_Knitting_g16_c02.avi') 'Knitting'
625941b96aa9bd52df036c0e
def AcqPremRatio(): <NEW_LINE> <INDENT> pvs = InnerProj(0).PresentValue(0) <NEW_LINE> return ((pvs.PV_ExpsCommTotal(0) + pvs.PV_ExpsAcq(0)) / pvs.PV_PremIncome(0))
Ratio of PV Acquisiton Cashflows to PV Premiums. The ratio is determined by the expectation at issue.
625941b9a79ad161976cbfb2
def wall_phase2(self): <NEW_LINE> <INDENT> self.image = pygame.image.load("./Images/wall2.PNG") <NEW_LINE> self.image.set_colorkey((0,0,0)) <NEW_LINE> self.image = self.image.convert()
This method changes the image of the wall
625941b9287bf620b61d38db
def test_user_edit_page(self): <NEW_LINE> <INDENT> url = reverse('admin:core_user_change', args=[self.user.id]) <NEW_LINE> resp = self.client.get(url) <NEW_LINE> self.assertEqual(resp.status_code, 200)
Test for user edit page
625941b91f5feb6acb0c49c1
def get_metrics_data(request, project, branch, revision): <NEW_LINE> <INDENT> product_name = request.GET.get("product", "Firefox") <NEW_LINE> os_name = request.GET.get("os_name", None) <NEW_LINE> os_version = request.GET.get("os_version", None) <NEW_LINE> branch_version = request.GET.get("branch_version", None) <NEW_LI...
Apply filters and return all metrics data associated with the revision.
625941b9d8ef3951e32433aa
def roll_dice(num_rolls, dice=six_sided): <NEW_LINE> <INDENT> assert type(num_rolls) == int, 'num_rolls must be an integer.' <NEW_LINE> assert num_rolls > 0, 'Must roll at least once.' <NEW_LINE> n, sum, checker = 0, 0, False <NEW_LINE> while num_rolls: <NEW_LINE> <INDENT> num_rolls -= 1 <NEW_LINE> n = dice () <NEW_LIN...
Simulate rolling the DICE exactly NUM_ROLLS > 0 times. Return the sum of the outcomes unless any of the outcomes is 1. In that case, return 1. num_rolls: The number of dice rolls that will be made. dice: A function that simulates a single dice roll outcome.
625941b9dd821e528d63b018
@app.cli.command() <NEW_LINE> @click.option('--coverage/--no-coverage', default=False, help='Run tests under code coverage.') <NEW_LINE> def test(coverage): <NEW_LINE> <INDENT> if coverage and not os.environ.get('FLASK_COVERAGE'): <NEW_LINE> <INDENT> os.environ['FLASK_COVERAGE'] = '1' <NEW_LINE> os.execvp(sys.executabl...
Run the unittests
625941b9cad5886f8bd26e4e
def should_hide(self, row): <NEW_LINE> <INDENT> return False
row_num is for self.model(). So if there is a proxy, it is the row number in that!
625941b9ac7a0e7691ed3f46
def baseDistkm(self): <NEW_LINE> <INDENT> self.getDist(False) <NEW_LINE> self.labelStation() <NEW_LINE> self.axss.set_ylabel('Distance [km]')
Set baseline of seismograms as epicentral distance in km.
625941b932920d7e50b28039
def importDefaultGuide(self): <NEW_LINE> <INDENT> io.import_sample_template("biped.sgt")
import mgear template biped
625941b9e64d504609d746ad
def to_ipython(self, filename=None): <NEW_LINE> <INDENT> if filename is None: <NEW_LINE> <INDENT> filename = "reprep-%s.html" % str(id(self)) <NEW_LINE> <DEDENT> self.to_html(filename) <NEW_LINE> from IPython.display import display, HTML <NEW_LINE> display(HTML(open(filename).read()))
Displays in the IPython editor.
625941b9ab23a570cc24ffec
def test_helptext(self): <NEW_LINE> <INDENT> sys.argv = [''] <NEW_LINE> self.exec_module() <NEW_LINE> self.assertEqual(self.retcode, 1) <NEW_LINE> self.assertEqual(len(self.stdout), 0) <NEW_LINE> self.assertEqual(self.stderr, self.module.__doc__.split("\n")[:-1])
$ pdb_shiftres
625941b9bde94217f3682c69
def create_cluster(self, cluster_create_spec: dict): <NEW_LINE> <INDENT> uri = self._clusters_uri <NEW_LINE> response = self.do_request( uri=uri, method=shared_constants.RequestMethod.POST, accept_type='application/json', media_type='application/json', payload=cluster_create_spec) <NEW_LINE> return common_models.DefEnt...
Call create native cluster CSE server endpoint. :param dict cluster_create_spec: Cluster create specification :return: defined entity object representing the response :rtype: common_models.DefEntity
625941b9aad79263cf3908a8
def _get_chart_template(self, cr, uid, ids, field_name, arg, context=None): <NEW_LINE> <INDENT> if context is None: <NEW_LINE> <INDENT> context = {} <NEW_LINE> <DEDENT> res={} <NEW_LINE> accounts = self.browse(cr, uid, ids) <NEW_LINE> for account in accounts: <NEW_LINE> <INDENT> id = account.id <NEW_LINE> while account...
To get the chart template from an account template, we have to search recursively across its parent_id field until parent_id is null (this is the root account) then select the chart template which have 'account_root_id' pointing to the root account.
625941b9f9cc0f698b140472
def get_int_dtype(value: int): <NEW_LINE> <INDENT> if value <= np.iinfo(np.uint8).max: <NEW_LINE> <INDENT> return np.uint8 <NEW_LINE> <DEDENT> if value <= np.iinfo(np.uint16).max: <NEW_LINE> <INDENT> return np.uint16 <NEW_LINE> <DEDENT> if value <= np.iinfo(np.uint32).max: <NEW_LINE> <INDENT> return np.int32 <NEW_LINE>...
Determine appropriate bit precision for indexed image Parameters ---------- value:int number of shapes Returns ------- dtype:np.dtype apppropriate data type for index mask
625941b93539df3088e2e1b8
def test_load(self): <NEW_LINE> <INDENT> d = Dialog() <NEW_LINE> self.assertIsNotNone(d) <NEW_LINE> d = Dialog(test_kb_path) <NEW_LINE> self.assertIsNotNone(d) <NEW_LINE> self.assertRaises(Exception, lambda: Dialog(''))
Test constructing a new Dialog instance and loading a KB.
625941b97c178a314d6ef2c5
def p_stringexpression_varlist(p): <NEW_LINE> <INDENT> p[0] = Variable(p[1])
stringexpression : VAR_LIST
625941b9090684286d50eb4d
def resign (self, game): <NEW_LINE> <INDENT> if not game.opponent.adjournment: <NEW_LINE> <INDENT> Log.warn("AdjournManager.resign: no adjourned game vs %s\n" % game.opponent) <NEW_LINE> return <NEW_LINE> <DEDENT> Log.info("AdjournManager.resign: resigning adjourned game=%s\n" % game) <NEW_LINE> self.connection.client....
This is (and draw and abort) are possible even when one's opponent is not logged on
625941b9d164cc6175782bba
def textFormatter_gettext( s ): <NEW_LINE> <INDENT> return textFormatter_lookup.get( s, s )
Cleans up argparse help information
625941b98c0ade5d55d3e82c
def __init__(self, iterable=None): <NEW_LINE> <INDENT> self.head = None <NEW_LINE> self.tail = None <NEW_LINE> self.size = 0 <NEW_LINE> if iterable is not None: <NEW_LINE> <INDENT> for item in iterable: <NEW_LINE> <INDENT> self.append(item)
Initialize this linked list and append the given items if any
625941b926068e7796caeb45
def test_set_handler(self): <NEW_LINE> <INDENT> dummy_method = "dummy" <NEW_LINE> dummy_handler = "handler" <NEW_LINE> self.l2gw_ovsdb._set_handler(dummy_method, dummy_handler) <NEW_LINE> self.assertEqual(self.l2gw_ovsdb.handlers[dummy_method], dummy_handler)
Test case to test _set_handler.
625941b960cbc95b062c63b6
def __init__(self, satellite_alignment_strength=0.8, prim_gal_axis='major', **kwargs): <NEW_LINE> <INDENT> self.gal_type = 'satellites' <NEW_LINE> self._mock_generation_calling_sequence = (['assign_orientation']) <NEW_LINE> self._galprop_dtypes_to_allocate = np.dtype( [(str('galaxy_axisA_x'), 'f4'), (str('galaxy_axisA_...
Parameters ========== satellite_alignment_strength : float parameter between [-1,1] that sets the alignment strength between perfect anti-alignment and perfect alignment prim_gal_axis : string, optional string indicating which galaxy principle axis is correlated with the halo alignment axis. The options ...
625941b97c178a314d6ef2c6
def plugin_get_policy(self, context, policy): <NEW_LINE> <INDENT> cfgdb = self._get_user_cfgdb(context) <NEW_LINE> pol_info = cfgdb.policy_read(policy['id']) <NEW_LINE> return pol_info
Policy get request
625941b9956e5f7376d70ce6
def apply_filters(self,request): <NEW_LINE> <INDENT> if 'date' in self.selected_fields_constraints: <NEW_LINE> <INDENT> self.details = self.client_details.filter( date_time__range = (self.start_date,self.end_date)) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> self.details = self.client_details.filter( mode_of_payment =...
Applying selected filters.
625941b926068e7796caeb46
def add_nsa(mastercat, nsa=None, matchtolerance=10*u.arcsec, removeduplicatepgcson='ABSMAG_r'): <NEW_LINE> <INDENT> from astropy.coordinates import SkyCoord <NEW_LINE> if nsa is None: <NEW_LINE> <INDENT> nsa = load_nsa() <NEW_LINE> <DEDENT> ral, decl = mastercat['al2000'], mastercat['de2000'] <NEW_LINE> lmsk = (~ral.ma...
Parameters ---------- mastercat Output from `initial_catalog` nsa Output from `load_nsa` matchtolerance : `Angle` The distance out to look for matches when assigning PGC#s to NSA objects removeduplicatepgcson : str or None If not None, specifies what to use to remove multiple PGC #s: can be an entry...
625941b9d164cc6175782bbb
def create_client_from_settings(): <NEW_LINE> <INDENT> api_url = environ['JIRA_API_URL'] <NEW_LINE> username = environ['JIRA_USER'] <NEW_LINE> password = wf.get_password(username) <NEW_LINE> return ConcurrentJiraClient(api_url, username, password)
Get user credentials from the keychain.
625941b9d268445f265b4ce2
def test_invalid_participant_get(self): <NEW_LINE> <INDENT> self.client.login(username=self.invalid_user.username, password=self.password) <NEW_LINE> resp = self.client.get(self.endpoint, content_type='application/json') <NEW_LINE> self.assertEqual(resp.status_code, 403)
Non thread-participants can't see the participants
625941b90a366e3fb873e684
def iter_events(self, number=-1): <NEW_LINE> <INDENT> url = self._build_url('events') <NEW_LINE> return self._iter(int(number), url, Event)
Iterate over public events. :param int number: (optional), number of events to return. Default: -1 returns all available events :returns: generator of :class:`Event <github3.events.Event>`\ s
625941b99f2886367277a6fe
def shopping(family, item_prices, item_weights): <NEW_LINE> <INDENT> f_hold = [] <NEW_LINE> f_win = 0 <NEW_LINE> for person in family: <NEW_LINE> <INDENT> hold = [] <NEW_LINE> p_hold = [] <NEW_LINE> for w in range(person + 1): <NEW_LINE> <INDENT> base = [0] <NEW_LINE> hold.append(base) <NEW_LINE> <DEDENT> for i in rang...
Function to determine shopping spree items for provided family and items
625941b9627d3e7fe0d68cbb
def moveDown(self, amount, collidable ): <NEW_LINE> <INDENT> if self.rect.bottom < self.area.height: <NEW_LINE> <INDENT> self.rect.top += amount <NEW_LINE> if self.rect.collidelist(collidable) >= 0: <NEW_LINE> <INDENT> self.rect.top -= amount
move down by the given amount, avoiding collisions with the given rects
625941b94428ac0f6e5ba65f
@daemon_method <NEW_LINE> def create_account(name): <NEW_LINE> <INDENT> return wallet['obj'].create_account(name)
RPC method to create an account
625941b98da39b475bd64de4
def page_links(browser): <NEW_LINE> <INDENT> url = browser.geturl() <NEW_LINE> parsed_url = urlparse(url) <NEW_LINE> url_domain = f"{parsed_url.scheme}://{parsed_url.netloc}" <NEW_LINE> links = set() <NEW_LINE> for link in browser.links(): <NEW_LINE> <INDENT> link = make_url_absolute(link.url, url_domain) <NEW_LINE> li...
Returns all links from given page.
625941b930bbd722463cbc30
def removeWatch(self, id): <NEW_LINE> <INDENT> (nrId, key) = id.split('_') <NEW_LINE> if key in self.watches: <NEW_LINE> <INDENT> remove = lambda x: x[0] == id <NEW_LINE> self.watches[key][:] = [x for x in self.watches[key] if not remove(x)] <NEW_LINE> <DEDENT> log.error("can't remove watch - key does not exist, watchI...
remove watch specified by the given watch id
625941b915baa723493c3ddf
def n_check_glow_property(n_tex_prop): <NEW_LINE> <INDENT> nose.tools.assert_is_instance(n_tex_prop, NifFormat.NiTexturingProperty) <NEW_LINE> nose.tools.assert_equal(n_tex_prop.has_glow_texture, True)
Checks the glow settings for the NiTextureProperty
625941b9627d3e7fe0d68cbc
def hot(request): <NEW_LINE> <INDENT> context = {} <NEW_LINE> context['themes'] = getMonthHotTheme() <NEW_LINE> return render(request, 'theme/hot.html', context)
精华主题
625941b999fddb7c1c9de200
def LollipopGraph(n1, n2): <NEW_LINE> <INDENT> if n1 < 0: <NEW_LINE> <INDENT> raise ValueError("invalid graph description, n1 should be >= 0") <NEW_LINE> <DEDENT> if n2 < 0: <NEW_LINE> <INDENT> raise ValueError("invalid graph description, n2 should be >= 0") <NEW_LINE> <DEDENT> pos_dict = {} <NEW_LINE> for i in range(n...
Returns a lollipop graph with n1+n2 nodes. A lollipop graph is a path graph (order n2) connected to a complete graph (order n1). (A barbell graph minus one of the bells). PLOTTING: Upon construction, the position dictionary is filled to override the spring-layout algorithm. By convention, the complete graph will be d...
625941b9e8904600ed9f1d96