code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
@app.route('/manga/create', methods=['POST']) <NEW_LINE> def post_create(): <NEW_LINE> <INDENT> req_data = request.get_json() <NEW_LINE> print('This is the request itself \n', req_data) <NEW_LINE> name = req_data['name'] <NEW_LINE> chapter = req_data['chapter'] <NEW_LINE> site = req_data['site'] <NEW_LINE> print('\nThe...
Create endpoint, writes to the database user's new entry
625941f3bde94217f36833e5
def test_6_a_1(self): <NEW_LINE> <INDENT> game = self.create_game() <NEW_LINE> self.clear_units(game) <NEW_LINE> self.set_units(game, 'ENGLAND', 'F NTH') <NEW_LINE> self.set_orders(game, 'ENGLAND', 'F NTH - PIC') <NEW_LINE> self.process(game) <NEW_LINE> assert self.check_results(game, 'F NTH', VOID) <NEW_LINE> assert s...
6.A.1 TEST CASE, MOVING TO AN AREA THAT IS NOT A NEIGHBOUR Check if an illegal move (without convoy) will fail. England: F North Sea - Picardy Order should fail.
625941f363b5f9789fde76e0
def get_info_from_files(files,keys_dict,wdir=''): <NEW_LINE> <INDENT> all_info=[] <NEW_LINE> for fname in files: <NEW_LINE> <INDENT> this_info={} <NEW_LINE> hdr = pf.getheader(fname,ext=0) <NEW_LINE> try: <NEW_LINE> <INDENT> hdr2 = pf.getheader(fname,ext=1) <NEW_LINE> if hdr2['EXTNAME'].strip() != 'MVCO': <NEW_LINE> <I...
Loop through a list of files, store the value of each header keyword. wdir is used only to truncate the folder name from the file name In the future it may be possible to use fitsio to read the headers of .fits.Z and .fits.gz files, but for now only .fits is supported
625941f3b545ff76a891440f
def exp(self): <NEW_LINE> <INDENT> return self.post.exp()
** Transforms an expression into a form consistent with Z3 solver. ** Computes the exp value of the postcondition.
625941f3a219f33f34628f5a
def stations_csv(self, delimiter=","): <NEW_LINE> <INDENT> import csv <NEW_LINE> csvfile = StringIO() <NEW_LINE> headers = ["station_id", "date_start", "date_end", "geo_lon", "geo_lat", "height", "name"] <NEW_LINE> writer = csv.writer(csvfile, delimiter=delimiter, quoting=csv.QUOTE_MINIMAL) <NEW_LINE> writer.writerow(h...
Return stations list as CSV
625941f3b7558d58953c5500
def iterfileinfo(self, what=("all",)): <NEW_LINE> <INDENT> if self.nfiles() == 0: <NEW_LINE> <INDENT> yield from [] <NEW_LINE> <DEDENT> if "all" in what: <NEW_LINE> <INDENT> what = self.rpmfileiter.keys() <NEW_LINE> <DEDENT> yield from zip_longest(*(self.rpmfileiter[k](self) for k in what))
Return an iterator that yields tuples of each of the rpmfile fields listed in `what`. If what == ("all",) then you get all fields - but you probably want iterrpmfiles(), which yields sensible rpmfile objects.
625941f30a366e3fb873ee1a
def close(self): <NEW_LINE> <INDENT> if self.fd: <NEW_LINE> <INDENT> os.close(self.fd) <NEW_LINE> self.fd = None <NEW_LINE> self._pec = 0
Close the i2c connection.
625941f382261d6c526abaa3
def clean_name(line): <NEW_LINE> <INDENT> name = line[len('CREATE TABLE '):-1] <NEW_LINE> assert len(name.split('].[')) == 2 <NEW_LINE> name = name.replace(']', '') <NEW_LINE> name = name.replace('[', '') <NEW_LINE> name = name.replace('.', '_') <NEW_LINE> return name
fonction pour trouver le nom d'une table au sein de la ligne idoine
625941f3cc40096d61595f47
def test_statsAnswerWithNoClients(self): <NEW_LINE> <INDENT> self.yam._endpoints['fake:1'].failure = FakeError() <NEW_LINE> self.yam._endpoints['fake:2'].failure = FakeError() <NEW_LINE> self.yam.connect() <NEW_LINE> self.assertEqual(len(self.flushLoggedErrors(FakeError)), 2) <NEW_LINE> d = self.yam.stats() <NEW_LINE> ...
If there are no clients available, stats immediately fires with an empty dict.
625941f3f9cc0f698b140bf0
def create_tender_question_eu(self): <NEW_LINE> <INDENT> response = self.app.post_json('/tenders/{}/questions'.format(self.tender_id), {'data': {'title': 'question title', 'description': 'question description', 'author': self.test_bids_data[0]['tenderers'][0]} }) <NEW_LINE> self.assertEqual(response.status, '201 Create...
Create question with many posible ways
625941f34e696a04525c9a48
def ask_user_whether_to_do_another_state(): <NEW_LINE> <INDENT> check_another_state = input("Would you like to see another state? " "Enter Y (yes) or N (no): ").upper() <NEW_LINE> while check_another_state not in ['Y','N']: <NEW_LINE> <INDENT> check_another_state = input("Sorry, invalid r...
After completing the activity for the first state, this function will allow the user to say whether they would like to see another state.
625941f3f548e778e58cdb7a
def make_samples_h(output_path): <NEW_LINE> <INDENT> output = list() <NEW_LINE> custom_envs = [env for env in get_env_names() if env not in bleep_envs] <NEW_LINE> for i, env in enumerate(custom_envs): <NEW_LINE> <INDENT> if i == 0: <NEW_LINE> <INDENT> output.append(f"#ifdef {env.upper()}") <NEW_LINE> <DEDENT> else: <NE...
generates samples.h to include all custom environments
625941f3099cdd3c635f1252
def tearDown(self): <NEW_LINE> <INDENT> for p in self.player, self.observer: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> p.destroy() <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass
Disconnect the player and observer from their respective transports.
625941f3498bea3a759ba0a7
def reset_coverage(self): <NEW_LINE> <INDENT> utils.save_coverage([], self.coverage_file)
Cleans coverage from previous runs
625941f326238365f5f0f470
def _PrintEventHeader(self, event_object, descriptions, exclude_timestamp): <NEW_LINE> <INDENT> format_string = self._GetFormatString(event_object) <NEW_LINE> self._output_writer.Write(u'Key information.\n') <NEW_LINE> if not exclude_timestamp: <NEW_LINE> <INDENT> for description in descriptions: <NEW_LINE> <INDENT> se...
Writes a list of strings that contains a header for the event. Args: event_object: event object (instance of event.EventObject). descriptions: list of strings describing the value of the header timestamp. exclude_timestamp: boolean. If it is set to True the method will not in...
625941f391f36d47f21acaf3
def get_osd_device_path(osd_lv, lvs, device_type): <NEW_LINE> <INDENT> osd_lv = lvs.get(lv_tags={'ceph.type': 'block'}) <NEW_LINE> uuid_tag = 'ceph.%s_uuid' % device_type <NEW_LINE> device_uuid = osd_lv.tags.get(uuid_tag) <NEW_LINE> if not device_uuid: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> device_lv = lvs...
``device_type`` can be one of ``db``, ``wal`` or ``block`` so that we can query ``lvs`` (a ``Volumes`` object) and fallback to querying the uuid if that is not present. Return a path if possible, failing to do that a ``None``, since some of these devices are optional
625941f34d74a7450ccd47bf
def test_polymorphism(self): <NEW_LINE> <INDENT> program = connection.Program() <NEW_LINE> program['name'] = "test_program_service" <NEW_LINE> program.save() <NEW_LINE> workflow = connection.Workflow() <NEW_LINE> workflow['name'] = "test_workflow_service" <NEW_LINE> workflow.save() <NEW_LINE> service = connection.Servi...
test that the instance of the correct service subclass is retrieved when querying
625941f332920d7e50b287cf
def onedim(x): <NEW_LINE> <INDENT> return len(x.shape) == 1
>>> x = np.array([1, 2, 3]) >>> onedim(x) True >>> x = np.array([[1, 2, 3], [4, 5, 6]]) >>> onedim(x) False
625941f3851cf427c661ab03
def _create_stats_dict_from_values( total_sum_w: float, total_sum_w2: float, total_sum_wx: float, total_sum_wx2: float ) -> Dict[str, float]: <NEW_LINE> <INDENT> return { "_total_sum_w": total_sum_w, "_total_sum_w2": total_sum_w2, "_total_sum_wx": total_sum_wx, "_total_sum_wx2": total_sum_wx2, }
Create a statistics dictionary from the provided set of values. This is particularly useful for ensuring that the dictionary values are created uniformly. Args: total_sum_w: Total sum of the weights (ie. the frequencies). total_sum_w2: Total sum of the weights squared (ie. sum of Sumw2 array). total_sum_w...
625941f3925a0f43d254a477
def test_shoppinglist_deletion_fails_given_list_doesnt_exist(self): <NEW_LINE> <INDENT> tkn = create_and_login_user(self.client) <NEW_LINE> create_list_and_add_item(self.client, tkn) <NEW_LINE> res1 = self.client.delete( '/shoppinglists/2', headers={ 'Content': 'Application/x-www-form-urlencoded', 'Authorization': tkn ...
Test API can delete an existing shopping list
625941f34d74a7450ccd47c0
@cli.command() <NEW_LINE> @click.argument('service') <NEW_LINE> @click.argument('config') <NEW_LINE> def install(service, config): <NEW_LINE> <INDENT> print('Setting up service [{}] for config [{}]...'.format(service, config)) <NEW_LINE> settings, error = load_settings(service, config) <NEW_LINE> if error is not None: ...
Install systemd service
625941f315fb5d323cde1113
def english_tokenzier(text: str): <NEW_LINE> <INDENT> TOKENIZER = ToktokTokenizer().tokenize <NEW_LINE> return TOKENIZER(text)
return english tokenized list. >>> english_tokenzier("Hello World") ['Hello', 'World'] >>> english_tokenzier("Keyboard Shortcuts Keyboard shortcuts are available for common actions and site navigation.") ['Keyboard', 'Shortcuts', 'Keyboard', 'shortcuts', 'are', 'available', 'for', 'common', 'actions', 'and', 'site', '...
625941f3d58c6744b4258257
def setup(self): <NEW_LINE> <INDENT> logger.info('Setting up VASP calculation, write input file ...') <NEW_LINE> if self.write_poscar: <NEW_LINE> <INDENT> self.writer.write_structure(self.crystal, filename='POSCAR', magnetic=self.magnetic) <NEW_LINE> logger.info('POSCAR written') <NEW_LINE> <DEDENT> else: <NEW_LINE> <I...
This methods set up a VASP calculation for a given crystal, including writing out the POTCAR, INCAR and KPOINT files
625941f3fff4ab517eb2fa3a
def GetOutsideValue(self): <NEW_LINE> <INDENT> return _itkMaskImageFilterPython.itkMaskImageFilterICVF33IUL3ICVF33_GetOutsideValue(self)
GetOutsideValue(self) -> itkCovariantVectorF3
625941f3a4f1c619b28b0624
def register_team_list(self, body): <NEW_LINE> <INDENT> httpretty.register_uri( httpretty.GET, '{url}orgs/{org}/teams'.format( url=self.URL, org=self.ORG, ), body=body )
Team listing API.
625941f37b25080760e39a4f
def cube(img, vox): <NEW_LINE> <INDENT> imgc = np.copy(img) <NEW_LINE> sh = imgc.shape <NEW_LINE> d = len(sh) <NEW_LINE> phys_dims = sh * vox <NEW_LINE> if pad: <NEW_LINE> <INDENT> i = np.argmax(phys_dims) <NEW_LINE> p = [(0, 0)]*d <NEW_LINE> p[i] = (pad, pad) <NEW_LINE> imgc = np.pad(imgc, p, mode='constant') <NEW_LIN...
Adjust dimensions such that field of view is a cube Cube is with respect to the physical units, not number of voxels
625941f3004d5f362079a928
def decrypt_message(self): <NEW_LINE> <INDENT> perm_scores = {} <NEW_LINE> permutations = get_permutations('aeiou') <NEW_LINE> for perm in permutations: <NEW_LINE> <INDENT> valid_words = 0 <NEW_LINE> transp_dict = self.build_transpose_dict(perm) <NEW_LINE> possible_text = self.apply_transpose(transp_dict) <NEW_LINE> po...
Attempt to decrypt the encrypted message Idea is to go through each permutation of the vowels and test it on the encrypted message. For each permutation, check how many words in the decrypted text are valid English words, and return the decrypted message with the most English words. If no good permutations are found...
625941f3de87d2750b860394
def _step(self, action): <NEW_LINE> <INDENT> assert self.action_space.contains(action) <NEW_LINE> self.observation[self.vessel] = 0 <NEW_LINE> self.move_vessel(action) <NEW_LINE> done = False <NEW_LINE> self.reward = -1 <NEW_LINE> self.step_count += 1 <NEW_LINE> v = self.vessel <NEW_LINE> d = self.destination <NEW_LINE...
Run one timestep of the environment's dynamics. Accepts an action and returns a tuple (observation, reward, done, info). # Arguments action (object): An action provided by the environment. # Returns observation (object): Agent's observation of the current environment. reward (float) : Amount of reward retur...
625941f376d4e153a657f12c
def read_kmer_infos( *, path: typing.Optional[typing.Union[str, pathlib.Path]] = None, stream: typing.Optional[typing.TextIO] = None ) -> typing.List[KmerInfo]: <NEW_LINE> <INDENT> if bool(path) == bool(stream): <NEW_LINE> <INDENT> raise ValueError("Exactly one of path and stream must be provided") <NEW_LINE> <DEDENT> ...
Load kmer infos from the given file.
625941f355399d3f05588cb3
def _preprocess_for_transliteration(text): <NEW_LINE> <INDENT> text = read.filters.process_crlf(text) <NEW_LINE> text = read.filters.normalize_nfkc(text) <NEW_LINE> text = read.filters.remove_control_characters(text) <NEW_LINE> text = read.filters.process_html(text) <NEW_LINE> text = read.filters.remove_verse_numbers(t...
Clean up text before transliterating.
625941f332920d7e50b287d0
def hamiltonian_film(hin,nz=10): <NEW_LINE> <INDENT> h = hin.copy() <NEW_LINE> h = multicell.supercell_hamiltonian(h,nsuper=[1,1,nz]) <NEW_LINE> hopout = [] <NEW_LINE> for i in range(len(h.hopping)): <NEW_LINE> <INDENT> if abs(h.hopping[i].dir[2])<0.1: <NEW_LINE> <INDENT> hopout.append(h.hopping[i]) <NEW_LINE> <DEDENT>...
Return the Hamiltonian of a film
625941f392d797404e304787
def _expand_eqs_deprecated(eqs): <NEW_LINE> <INDENT> def expand_eq(eq): <NEW_LINE> <INDENT> if eq.is_Equality: <NEW_LINE> <INDENT> eq = eq.lhs - eq.rhs <NEW_LINE> <DEDENT> return eq.expand() <NEW_LINE> <DEDENT> return [expand_eq(eq) for eq in eqs]
Use expand to cancel nonlinear terms. This approach matches previous behaviour of linsolve but should be deprecated.
625941f3004d5f362079a929
def in_between(self, first, second): <NEW_LINE> <INDENT> if self.in_same_row(first) and self.in_same_row(second): <NEW_LINE> <INDENT> return first.x < self.x < second.x or first.x > self.x > second.x <NEW_LINE> <DEDENT> if self.in_same_column(first) and self.in_same_column(second): <NEW_LINE> <INDENT> return first.y < ...
Tests if this block lies in between the other two blocks, and if they are all in the same row, column, or diagonal. :param Block first: The first block for the test :param Block second: The second block for the test
625941f38c0ade5d55d3efbb
def test_edit_files(self): <NEW_LINE> <INDENT> downloads_directory = self.api.downloads_directory <NEW_LINE> entries = downloads_directory.list() <NEW_LINE> delete_entries(entries) <NEW_LINE> uploaded_file = self.api.upload(TEST_UPLOAD_FILE) <NEW_LINE> assert isinstance(uploaded_file, File) <NEW_LINE> time.sleep(5) <NE...
Move files from downloads directory to its parent directory
625941f39f2886367277ae82
def get_instance(self, payload): <NEW_LINE> <INDENT> return UseCaseInstance(self._version, payload, )
Build an instance of UseCaseInstance :param dict payload: Payload response from the API :returns: twilio.rest.messaging.v1.use_case.UseCaseInstance :rtype: twilio.rest.messaging.v1.use_case.UseCaseInstance
625941f316aa5153ce362a73
def getStatusOff(self): <NEW_LINE> <INDENT> list = DisplayList() <NEW_LINE> list.add('Nao','Não Precisa') <NEW_LINE> list.add('Solicitado', 'Solicitado') <NEW_LINE> list.add('EmProducao','Em produção') <NEW_LINE> list.add('Pronto', 'Pronto') <NEW_LINE> return list
Retorna a lista de status de Off
625941f376d4e153a657f12d
def ok(self, shorttext, longtext=[], perfdata=[]): <NEW_LINE> <INDENT> self._printnagios('OK', 0, shorttext, longtext, perfdata)
Exit Python returning OK status to Nagios. Arguments: 1 -- short text giving status information. longtext -- list of strings of further status information. perfdata -- list of strings of performance data
625941f3c4546d3d9de73034
def check_token_expired(data): <NEW_LINE> <INDENT> if 'outErro' in data: <NEW_LINE> <INDENT> if data['outErro'] == 'Unauthorized': <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Verifica se o token expirou a partir do json de retorno
625941f3bf627c535bc137ca
def subtract(num_list): <NEW_LINE> <INDENT> total = num_list[0] <NEW_LINE> for num in num_list: <NEW_LINE> <INDENT> total -= num <NEW_LINE> <DEDENT> return total
Return the second number subtracted from the first.
625941f310dbd63aa1bd319c
def shingle_generator(doc_generator, size=DEFAULT_SHINGLE_SIZE, type=ShingleType.K_SHINGLES): <NEW_LINE> <INDENT> if not ShingleType.is_valid(type): <NEW_LINE> <INDENT> raise ValueError('%s is not a valid shingle type. Valid types are "w-shingles or k-shingles. Please use ShinglesType.' % type) <NEW_LINE> <DEDENT> if t...
Generator a set of shingles from each given document returned by the document generator. :param doc_generator: generator that returns documents as strings :param size: size of w-shingles or k-shingles :param type: determines the type of shingles to create. (valid values => w-shingles or k-shingles) :return: generator t...
625941f3435de62698dfe248
def sort_areas(Areas): <NEW_LINE> <INDENT> A=np.zeros(np.size(Areas)) <NEW_LINE> MAX = max(Areas) <NEW_LINE> for i in range(len(A)): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> A[i] = Areas[Areas==MAX] <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> A[i:i+len(Areas[Areas==MAX])] = Areas[Areas==MAX] <NEW_LIN...
Parameters ---------- Returns ------- References ---------- Examples --------
625941f3d99f1b3c44c67b7d
def p_expression_dice(t): <NEW_LINE> <INDENT> t[0] = t[1]
expression : DICE
625941f350485f2cf553d397
def set_outline_color(self, *color): <NEW_LINE> <INDENT> self.__outline_color=Vec4(*color) <NEW_LINE> self.geom.set_shader_input('outline_color', self.__outline_color)
Sets text outline color (rgba)
625941f33317a56b8693a243
def dump_state(self): <NEW_LINE> <INDENT> d = {} <NEW_LINE> for key, thing in self.things.items(): <NEW_LINE> <INDENT> d[thing.name] = thing.quantity <NEW_LINE> <DEDENT> return d
extract the things and values
625941f3a8370b7717052e98
def _z0test(self, type, z0): <NEW_LINE> <INDENT> if type in (S, T): <NEW_LINE> <INDENT> if z0 is None: <NEW_LINE> <INDENT> z0 = 50.0 <NEW_LINE> <DEDENT> <DEDENT> elif z0 is not None: <NEW_LINE> <INDENT> raise ValueError("the specified n-port representation (%s) does " "not require a reference impedance" % type) <NEW_LI...
Verify whether a normalizing impedance may be specified for the given n-port parameter type :param type: n-port parameter type :type type: :data:`Z`, :data:`Y`, :data:`S`, :data:`T`, :data:`G`, :data:`H` or :data:`ABCD` :param z0: normalizing impedance :type z0: :class:`float`
625941f39f2886367277ae83
def search_next(self, obj): <NEW_LINE> <INDENT> if 'meta' in obj and 'next' in obj['meta'] and obj['meta']['next'] != None: <NEW_LINE> <INDENT> uri = self.api_url % obj['meta']['next'] <NEW_LINE> header, content = self._http_uri_request(uri) <NEW_LINE> resp = json.loads(content) <NEW_LINE> if not self._is_http_response...
Takes the dictionary that is returned by 'search' or 'search_next' function and gets the next batch of results Args: obj: dictionary returned by the 'search' or 'search_next' function Returns: A dictionary with a data returned by the server Raises: HttpException with the error message from the server
625941f316aa5153ce362a74
def switch_to_frame(self, by, locator): <NEW_LINE> <INDENT> self.loger.info('info:switching to iframe "{}"'.format(locator)) <NEW_LINE> if by.lower() in self.byDic: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> WD(self.driver, self.outTime). until(ec.frame_to_be_available_and_switch_to_it((self.byDic[...
判断frame是否存在,存在就跳到frame :param by: 元素定位方式 :param locator: 元素定位值 :return:
625941f31d351010ab856115
def initialVar(self): <NEW_LINE> <INDENT> ggv.lang_use = ggv.langIds[ggv.langs.index(ggv.personSetList[0])] <NEW_LINE> if ggv.lang_use == 'mn': <NEW_LINE> <INDENT> cgv.CHARSET.append('iso-8859-2') <NEW_LINE> <DEDENT> elif ggv.lang_use in ['ug','kk','ky']: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> ggv.keyword_use = g...
:为后续程序与语言相关的变量赋值 :如,搜索引擎列表的排列,关键字的填补等
625941f34e4d5625662d49c9
def _zeros(ftype, *dims): <NEW_LINE> <INDENT> shape = _dims2shape(*dims) <NEW_LINE> objs = [ftype.box(0) for _ in range(_volume(shape))] <NEW_LINE> return farray(objs, shape, ftype)
Return a new farray filled with zeros.
625941f3cad5886f8bd275d3
def set_custom_exc(self, exc_tuple, handler): <NEW_LINE> <INDENT> if not isinstance(exc_tuple, tuple): <NEW_LINE> <INDENT> raise TypeError("The custom exceptions must be given as a tuple.") <NEW_LINE> <DEDENT> def dummy_handler(self, etype, value, tb, tb_offset=None): <NEW_LINE> <INDENT> print('*** Simple custom except...
set_custom_exc(exc_tuple, handler) Set a custom exception handler, which will be called if any of the exceptions in exc_tuple occur in the mainloop (specifically, in the run_code() method). Parameters ---------- exc_tuple : tuple of exception classes A *tuple* of exception classes, for which to call the defined ...
625941f373bcbd0ca4b2c670
def elev2stroke2(ts_elev, sr): <NEW_LINE> <INDENT> N = len(ts_elev) <NEW_LINE> HS = np.ones(N)*1e12 <NEW_LINE> for n in range(N//1024, N//32): <NEW_LINE> <INDENT> f = n*sr/N*(1 - 2/N) + 1/(sr*N) <NEW_LINE> omega = 2*pi*f <NEW_LINE> kh = water_depth*dispsolver(omega, water_depth, decimals=1) <NEW_LINE> HS[n] = (4*sinh(k...
Converts a random elevation time series to piston stroke time series HS=(4*sinh(x)/x)*((x*sinh(x)-cosh(x)+1)/(sinh(2*x)+2*x));
625941f3bd1bec0571d90c2a
def doUpdate(self): <NEW_LINE> <INDENT> dlg = InstallUpdateDialog(None, -1, app=self.app)
Should be called from suggestUpdate (separate dialog to ask user whether they want to)
625941f35510c4643540f9cf
def test_input_range_quantity(): <NEW_LINE> <INDENT> valid = ("auto", 2e-9, 2e-8, 2e-7, 2e-6, 2e-5, 2e-4, 2e-3) <NEW_LINE> newval = 2e-9 <NEW_LINE> quant = u.Quantity(newval, u.A) <NEW_LINE> with expected_protocol( ik.keithley.Keithley485, [f"R{valid.index(newval)}X"], [] ) as inst: <NEW_LINE> <INDENT> inst.input_range...
Set input range with a given value from list.
625941f37d43ff24873a32a0
def t_OP_GREATER_OR_EQUAL(self, t): <NEW_LINE> <INDENT> t.value = "OP_GREATER_OR_EQUAL" <NEW_LINE> return t
>=
625941f3377c676e912727a1
@tf_export("size", v1=[]) <NEW_LINE> @dispatch.add_dispatch_support <NEW_LINE> def size_v2(input, out_type=dtypes.int32, name=None): <NEW_LINE> <INDENT> return size(input, name, out_type)
Returns the size of a tensor. Returns a 0-D `Tensor` representing the number of elements in `input` of type `out_type`. Defaults to tf.int32. For example: >>> t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]) >>> tf.size(t) <tf.Tensor: shape=(), dtype=int32, numpy=12> Args: input: A `Tensor` or `S...
625941f3a05bb46b383ece16
def quo(f, g, auto=True): <NEW_LINE> <INDENT> dom, per, F, G = f._unify(g) <NEW_LINE> retract = False <NEW_LINE> if auto and dom.has_Ring and not dom.has_Field: <NEW_LINE> <INDENT> F, G = F.to_field(), G.to_field() <NEW_LINE> retract = True <NEW_LINE> <DEDENT> if hasattr(f.rep, 'quo'): <NEW_LINE> <INDENT> q = F.quo(G) ...
Computes polynomial quotient of ``f`` by ``g``. Examples ======== >>> from sympy import Poly >>> from sympy.abc import x >>> Poly(x**2 + 1, x).quo(Poly(2*x - 4, x)) Poly(1/2*x + 1, x, domain='QQ') >>> Poly(x**2 - 1, x).quo(Poly(x - 1, x)) Poly(x + 1, x, domain='ZZ')
625941f385dfad0860c3b458
def evaluate_intents(intent_results, errors_filename, confmat_filename, intent_hist_filename): <NEW_LINE> <INDENT> from sklearn.metrics import confusion_matrix <NEW_LINE> from sklearn.utils.multiclass import unique_labels <NEW_LINE> import matplotlib.pyplot as plt <NEW_LINE> num_examples = len(intent_results) <NEW_LINE...
Creates a confusion matrix and summary statistics for intent predictions. Log samples which could not be classified correctly and save them to file. Creates a confidence histogram which is saved to file. Wrong and correct prediction confidences will be plotted in separate bars of the same histogram plot. Only considers...
625941f30c0af96317bb87e2
def has_two_tds(elem): <NEW_LINE> <INDENT> tr = elem.name == "tr" <NEW_LINE> td = elem.find_all("td") <NEW_LINE> has_two = len(td) == 2 <NEW_LINE> return tr and has_two
.
625941f3d6c5a1020814464b
def printProgressBar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█', printEnd="\r"): <NEW_LINE> <INDENT> percent = 100 * (iteration / float(total)) <NEW_LINE> percent = f'{percent:.{2}f}' <NEW_LINE> filledLength = int(length * iteration // total) <NEW_LINE> bar = fill * filledLength + '-' * (l...
Function to display a progress bar printProgressBar( i + 1, lon.shape[0]-1, prefix = 'Calculating DESIS swath coordinates:', suffix = 'Complete ', length = 70) Parameters: iteration: Current iteration value total: Total iteration value prefix: Prefix text suffix: ...
625941f34428ac0f6e5badf3
def upload_data_from_file(self): <NEW_LINE> <INDENT> global path_to_file <NEW_LINE> path_to_file = QFileDialog.getOpenFileName(self, 'Открыть файл', '', "Text Files (*.txt)")[0] <NEW_LINE> if path_to_file: <NEW_LINE> <INDENT> file = open(path_to_file, 'r') <NEW_LINE> data = file.read() <NEW_LINE> self.plainTextEdit.app...
загружаем данные из файла :return: pass
625941f33539df3088e2e946
def action(self): <NEW_LINE> <INDENT> response = "" <NEW_LINE> if 'selftext' in self._links.keys(): <NEW_LINE> <INDENT> response += "Submission Links: \n\n" <NEW_LINE> if len(self._links['selftext'])==0: <NEW_LINE> <INDENT> response += "None \n\n\n" <NEW_LINE> <DEDENT> for i,link in enumerate(self._links['selftext']): ...
Respond to post with all links
625941f331939e2706e4d45c
def __init__(self, successful=None, files_in_zip=None, directories_in_zip=None): <NEW_LINE> <INDENT> self._successful = None <NEW_LINE> self._files_in_zip = None <NEW_LINE> self._directories_in_zip = None <NEW_LINE> self.discriminator = None <NEW_LINE> if successful is not None: <NEW_LINE> <INDENT> self.successful = su...
ZipExtractResponse - a model defined in Swagger
625941f3ac7a0e7691ed46bb
def filter_empty(X, y): <NEW_LINE> <INDENT> non_empty_indices = [idx for idx, article in enumerate(X) if len(article) > 0] <NEW_LINE> X = pd.Series([X[idx] for idx in non_empty_indices]) <NEW_LINE> y = pd.Series([y[idx] for idx in non_empty_indices]) <NEW_LINE> return X, y, non_empty_indices
Filter out all empty articles
625941f363f4b57ef0001702
def deriv(spec,h): <NEW_LINE> <INDENT> der_spec =[[i[0],0] for i in spec] <NEW_LINE> length=len(spec) <NEW_LINE> for i in range(3,length-3): <NEW_LINE> <INDENT> der_spec[i][1]=(-1*spec[i-3][1]+9*spec[i-2][1]-45*spec[i-1][1]+45*spec[i+1][1]-9*spec[i+2][1]+1*spec[i+3][1])/(60*h) <NEW_LINE> <DEDENT> for i in range(0,3): <...
calculate first derivative of function 'spec' using the central finite difference method up to 6th order, and for the first 3 and last 3 grid points the forward/backward finite difference method up to 2nd order. ...as used in f77-program and suggested by Zanazzi-Jona...
625941f3236d856c2ad44dde
def changed(self): <NEW_LINE> <INDENT> if not self._labels: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> labelROI = self.labelROI() <NEW_LINE> result = (labelROI == self._labels[0]) <NEW_LINE> for l in self._labels[1:]: <NEW_LINE> <INDENT> result |= (labelROI == l) <NEW_LINE> <DEDENT> return result
Return mask array with changed pixels set to True.
625941f3e1aae11d1e74a2b9
def testV1alpha1VirtualMachineSnapshotContentSpec(self): <NEW_LINE> <INDENT> pass
Test V1alpha1VirtualMachineSnapshotContentSpec
625941f3d10714528d6002e6
def uuid_8(): <NEW_LINE> <INDENT> s = uuid_32() <NEW_LINE> result = '' <NEW_LINE> for i in range(0, 8): <NEW_LINE> <INDENT> sub = s[i * 4: i * 4 + 4] <NEW_LINE> x = int(sub, 16) <NEW_LINE> result += CHAR_SET[x % 0x3E] <NEW_LINE> <DEDENT> return result
返回8字符的UUID字符串(非进制) 3FNWjtlD :return:
625941f34e696a04525c9a49
def changeTool(self): <NEW_LINE> <INDENT> if self.number and self.tool: <NEW_LINE> <INDENT> self.tooltable.setTool(self.number, self.tool)
changes a given tool
625941f3379a373c97cfb142
def setVoltage(self, voltage, wait=True): <NEW_LINE> <INDENT> if self.cachedMode() != self.MODE_VOLTAGE: <NEW_LINE> <INDENT> raise RuntimeError('Not in voltage mode') <NEW_LINE> <DEDENT> if abs(voltage) > self.MAX_VOLTAGE*1.01: <NEW_LINE> <INDENT> raise ValueError('Voltage out of range: %g' % voltage) <NEW_LINE> <DEDEN...
Sets the voltage value. This method can only be used when in voltage mode. The voltage values must be within the power supply acceptable range and also within the configured limit values. See also: :meth:`setMode`, :meth:`setVoltageLimits` Parameters ---------- voltage : `float` The desired voltage value
625941f3bde94217f36833e6
def format_image_name(image_name, image_tag): <NEW_LINE> <INDENT> parts = image_name.rsplit('/', 1) <NEW_LINE> if ':' in parts[-1]: <NEW_LINE> <INDENT> click.echo('Please use --version param to specify tag') <NEW_LINE> image_name = image_name.rsplit(':', 1)[0] <NEW_LINE> <DEDENT> if not image_tag: <NEW_LINE> <INDENT> c...
Format image name using image tag
625941f3283ffb24f3c55ef5
def expire(self): <NEW_LINE> <INDENT> if self.state not in OK_TO_EXPIRE or not self._lock: <NEW_LINE> <INDENT> raise UnexpectedStateException("Unable to expire lock {} because state is {}".format(self.id, self.state)) <NEW_LINE> <DEDENT> self.state = STATE_EXPIRING <NEW_LINE> self.backend.release(self._lock) <NEW_LINE>...
Explicitly expire a lock. Similar to release, but uses different states to be explicit as to what happened.
625941f30fa83653e46575b2
@register.tag <NEW_LINE> def sortbyattr(parser, token): <NEW_LINE> <INDENT> parts = token.split_contents() <NEW_LINE> if len(parts)<5: <NEW_LINE> <INDENT> raise template.TemplateSyntaxError('sortbyattr takes at least 5 arguments') <NEW_LINE> <DEDENT> elif parts[-2] != 'as': <NEW_LINE> <INDENT> raise template.TemplateSy...
Sort the provide list by the attribute(s) of its elements {% sortbyattr alist attr1.name attr2.name as sortedlist %} Will compare alist[0].attr1.name with alist[1].attr1.name then compare alist[0].attr2.name with alist[1].attr2.name
625941f3dd821e528d63b79f
def on_switch_mean_vector_state_set(self, switch, state): <NEW_LINE> <INDENT> self.changes.append(lambda: self.layer.set_draw_mean_vector(state))
Queues up a new state for the drawing of the mean vector linear. When the state of the Switch is changed the new state is queued in the list of changes. True means that a linear is drawn for the mean direction of the dataset. False means that it is not drawn.
625941f350812a4eaa59c916
def gen_report(zap, api_key, alerts, reporttype, report_file, force=False): <NEW_LINE> <INDENT> if os.path.isfile(report_file) and force: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.remove(report_file) <NEW_LINE> <DEDENT> except IOError as e: <NEW_LINE> <INDENT> print('Unable to remove {0}'.format(report_file)) <NE...
generates a report in `reporttype` :param reporttype: html or xml
625941f32ae34c7f2600d72b
def request_path(self, path, params=None): <NEW_LINE> <INDENT> if path.startswith("/"): <NEW_LINE> <INDENT> path = path[1:] <NEW_LINE> <DEDENT> url = URL("http://local") if self.scheme == "unix" else self._uri <NEW_LINE> url = url.with_path(path) <NEW_LINE> if params: <NEW_LINE> <INDENT> url = url.with_query(params) <N...
Return a string suitable for a request. :param str path: the path for the request. :param dict params: an optional dict with querystring parameters.
625941f3ec188e330fd5ad8d
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, Endpoint): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
625941f3d8ef3951e3243b39
def __init__(self, chart_scale=15, plot_orientation=None): <NEW_LINE> <INDENT> self.chart_scale = chart_scale <NEW_LINE> self.plot_orientation = plot_orientation <NEW_LINE> sns.set(rc=style.rc_grey) <NEW_LINE> if plot_orientation == "tall": <NEW_LINE> <INDENT> chart_width = self.chart_scale * 0.7 <NEW_LINE> chart_heigh...
Documentation: --- Description: Initialize PrettierPlot and dynamically set chart size and shap. --- Parameters: chart_scale : float or int, default=15 Chart proportionality control. Determines relative size of figure size, axis labels, chart title, tick labels, ...
625941f3462c4b4f79d1dccb
def __call__(self, request:HTTPRequest) -> HTTPResponse: <NEW_LINE> <INDENT> data_in = request.content <NEW_LINE> with self._lock: <NEW_LINE> <INDENT> data_out = self._processor.process(data_in) <NEW_LINE> <DEDENT> headers = HTTPResponseHeaders() <NEW_LINE> headers.set_content_type(self._processor.output_type) <NEW_LIN...
Process content obtained from a client. If successful, send the returned data back to the client.
625941f394891a1f4081c0a8
def spi_read_16(self, MessageType): <NEW_LINE> <INDENT> outArray = [self.SPI_Address, MessageType, 0, 0, 0, 0] <NEW_LINE> reply = self.spi_transfer_array(outArray) <NEW_LINE> if(reply[3] == 0xA5): <NEW_LINE> <INDENT> return int((reply[4] << 8) | reply[5]), self.SUCCESS <NEW_LINE> <DEDENT> return 0, self.SPI_ERROR
Read a 16-bit value over SPI Keyword arguments: MessageType -- the SPI message type Returns touple: value, error
625941f35f7d997b87175099
def get_X(p): <NEW_LINE> <INDENT> bias = d.DiracDistribution(1) <NEW_LINE> X = [bias] + [d.RademacherDistribution() for _ in range(p)] <NEW_LINE> return X
List of features marginal distribution
625941f3ad47b63b2c50a57b
def removeLineFeed(text): <NEW_LINE> <INDENT> k = text.replace('\r','').replace('\n','').replace('\t',' ') <NEW_LINE> return k
去除换行 tab键
625941f36aa9bd52df0373a4
def test_invalid_cryptographic_usage_mask(self): <NEW_LINE> <INDENT> kwargs = {'cryptographic_usage_mask': 'invalid'} <NEW_LINE> self.assertRaisesRegex( TypeError, "Cryptographic usage mask must be an integer.", payloads.CheckResponsePayload, **kwargs ) <NEW_LINE> payload = payloads.CheckResponsePayload() <NEW_LINE> ar...
Test that a TypeError is raised when an invalid value is used to set the cryptographic usage mask of a Check response payload.
625941f3bde94217f36833e7
def contains(self, x, y, coord_type): <NEW_LINE> <INDENT> func = self.get_dbus_method("contains", dbus_interface=ATSPI_COMPONENT) <NEW_LINE> return func(x, y, UInt32(coord_type))
@return True if the specified point lies within the Component's bounding box, False otherwise.
625941f34f88993c3716c65c
def reverse(self, x): <NEW_LINE> <INDENT> xstr = str(x) <NEW_LINE> newstr = '' <NEW_LINE> if xstr[0] == '-': <NEW_LINE> <INDENT> newstr += '-' <NEW_LINE> for i in range(len(xstr)-1): <NEW_LINE> <INDENT> newstr += xstr[len(xstr)-1-i] <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> for i in range(len(xstr)): <NEW_...
:type x: int :rtype: int
625941f3bf627c535bc137cb
def write_data(db: dict, record_id: int, data_name: str, data): <NEW_LINE> <INDENT> if not db['db'].keys(): <NEW_LINE> <INDENT> db['db'][str(record_id)] = {} <NEW_LINE> <DEDENT> elif str(record_id) not in db['db']: <NEW_LINE> <INDENT> db['db'][str(record_id)] = {} <NEW_LINE> <DEDENT> if not db['db'][str(record_id)].key...
Write data for a given record_id
625941f397e22403b379d598
def update_z(self, beam, fields, h, step=1.): <NEW_LINE> <INDENT> self.kick_p(beam, fields, h, k=2, sign=1, step=0.5 * step) <NEW_LINE> self.update_q(beam, h, k=2, step=step) <NEW_LINE> self.kick_p(beam, fields, h, k=2, sign=-1, step=0.5 * step)
Perform the map for y consisting of a half kick, drift, then half kick Arguments: beam (olive.particles.beam.Beam): an Olive object containing beam information fields (olive.fields.field.Field): an Olive object containing field information h (Float): step size in units cm step (Float): Fraction of a st...
625941f363d6d428bbe44aed
def mean_reciprocal_rank(y_true, y_pred, k): <NEW_LINE> <INDENT> def mrr(actual, predict, k): <NEW_LINE> <INDENT> if len(predict)>k: <NEW_LINE> <INDENT> predict = predict[:k] <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> rank = 1./(predict.index(actual)+1) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> rank = 0 <NEW_LI...
Mean Reciprocal Rank Args: y_true: pd.Series, ground truth (correct) labels. y_pred: pd.Series, predicted values, as returned by a rank. k: int, top k predict values. Returns: mean reciprocal rank k values.
625941f37b180e01f3dc4deb
def makeSplashLogo(): <NEW_LINE> <INDENT> border = 16 <NEW_LINE> xw, yw = 512 + 16, 512 + 16 <NEW_LINE> pix = QtGui.QPixmap(xw, yw) <NEW_LINE> pix.fill() <NEW_LINE> p = QtGui.QPainter(pix) <NEW_LINE> logo = QtGui.QPixmap(QtGui.QImage('resources/icon_256.png')) <NEW_LINE> p.drawPixmap(xw / 2 - logo.width() / 2, yw / 2 -...
Make a splash screen logo.
625941f38e05c05ec3eea976
def get_term_timeout(): <NEW_LINE> <INDENT> return random.random() * 0.150 + 0.150
Return term timeout (between 150 and 300 ms).
625941f3507cdc57c63072e6
def month_1thday_lasday(date=None): <NEW_LINE> <INDENT> if date is None: <NEW_LINE> <INDENT> date = today_date() <NEW_LINE> <DEDENT> tdate = datetime.datetime.strptime(date, "%Y%m%d") <NEW_LINE> day_begin = '%d%02d01' % (tdate.year, tdate.month) <NEW_LINE> wday, monthRange = calendar.monthrange(tdate.year, tdate.month)...
返回指定日期所在月的第一天和最后一天的日期 date没有输入则是当前月,date格式为yyyymmddd,其他格式目前不支持
625941f3b7558d58953c5503
def configurationChanged(self, *args, **kwargs): <NEW_LINE> <INDENT> pass
QNetworkConfigurationManager.configurationChanged[QNetworkConfiguration] [signal]
625941f3956e5f7376d71467
def read_structure_field(self, addr_or_name, struct_name, field): <NEW_LINE> <INDENT> size = self.sizeof("(({0} *)0)->{1}".format(struct_name, field)) <NEW_LINE> virt = self.resolve_virt(addr_or_name) <NEW_LINE> if size == 4: <NEW_LINE> <INDENT> return self.read_u32(virt + self.field_offset(struct_name, field)) <NEW_LI...
reads a 4 or 8 byte field from a structure
625941f3ad47b63b2c50a57c
def read_data(path): <NEW_LINE> <INDENT> data = None <NEW_LINE> ensure_file_existence(path, True) <NEW_LINE> with open(path, 'rb') as input_file: <NEW_LINE> <INDENT> data = load(input_file) <NEW_LINE> <DEDENT> return data
Reads a pickled data file at the specified path, and returns the data retrieved. Args: path: A string containing the path to the pickled file. Returns: Data stored in the pickled file.
625941f329b78933be1e5ca1
def disable(self): <NEW_LINE> <INDENT> self.gpio.setup(self._emitter_pin, self.gpio.OUT) <NEW_LINE> self.gpio.output(self._emitter_pin, False) <NEW_LINE> time.sleep(self._write_delay)
Disable the line follower by turning off its IR LEDs.
625941f385dfad0860c3b459
def isAdditiveNumber(self, num: str) -> bool: <NEW_LINE> <INDENT> pass
put solution here
625941f396565a6dacc8fcc5
def push(self, new_msg): <NEW_LINE> <INDENT> target = new_msg.target or self.users <NEW_LINE> for user_id in target: <NEW_LINE> <INDENT> self.users[user_id].ws.write_message(json.dumps(new_msg.to_dict()))
This is a callback function for message queue variable Push new messages back to current users in this room if any message available.
625941f350812a4eaa59c917
def pick_n_per_patient(df, num): <NEW_LINE> <INDENT> if num == 0: <NEW_LINE> <INDENT> return df <NEW_LINE> <DEDENT> min_count = df.groupby("study")["path"].count().min() <NEW_LINE> if num > min_count: <NEW_LINE> <INDENT> raise ValueError("num is greater than minimum count of images per patient: {}".format( min_count ))...
Create a sub dataset that pick first n images from each patient. Will return error if num is greater than the minial count :param df: dataframe to process :param num: number of images to pick from each patient. if set to 0, then pick all. :return: trimmed dataframe
625941f3460517430c394770
def add_cache_buster(config, spec, cache_buster): <NEW_LINE> <INDENT> pass
Add a new cache buster to a particular set of assets
625941f3b5575c28eb68e602
def generate_and_assign_classifier(model, arch, hidden_units): <NEW_LINE> <INDENT> if arch == 'densenet121': <NEW_LINE> <INDENT> input_units = 1024 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> input_units = 25088 <NEW_LINE> <DEDENT> new_ff_classifier = nn.Sequential(OrderedDict([ ('fc1', nn.Linear(input_units, hidden_...
Create a new classifier to be used with a pretrained model. PARAMETERS: model <Torchvision.Models> - Pretrained model arch <String> - Model architecture hidden_units <Int> - Desired number of nodes in hidden layer RETURN: model <Torchvision.Models> - Pretrained model with new classifier
625941f33c8af77a43ae3da4
def get_invoices_values(self, inv): <NEW_LINE> <INDENT> res = super().get_invoices_values(inv) <NEW_LINE> if inv.reinvoice_commercial: <NEW_LINE> <INDENT> res.update(user_id=inv.reinvoice_commercial.id) <NEW_LINE> <DEDENT> return res
Add the commercial to the new associated invoice in order to get the right agents when we recompute it after the reinvoice wizard is done
625941f36fece00bbac2dd42