code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def batchnorm_forward(x, gamma, beta, bn_param): <NEW_LINE> <INDENT> mode = bn_param['mode'] <NEW_LINE> eps = bn_param.get('eps', 1e-5) <NEW_LINE> momentum = bn_param.get('momentum', 0.9) <NEW_LINE> N, D = x.shape <NEW_LINE> running_mean = bn_param.get('running_mean', np.zeros(D, dtype=x.dtype)) <NEW_LINE> running_var ... | Forward pass for batch normalization.
During training the sample mean and (uncorrected) sample variance are
computed from minibatch statistics and used to normalize the incoming data.
During training we also keep an exponentially decaying running mean of the
mean and variance of each feature, and these averages are us... | 625941e76e29344779a62a73 |
def connect(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> rc = sdb.nd_connect(self._node, self._client) <NEW_LINE> pysqldb._raise_if_error("Failed to connect", rc) <NEW_LINE> <DEDENT> except SDBBaseError: <NEW_LINE> <INDENT> raise | Connect to the current node.
Exceptions:
pysqldb.error.SDBBaseError | 625941e7287bf620b61d3ec4 |
def update( db_session: Session, *, trigger_type: TriggerTypeDB, trigger_type_in: TriggerTypeUpdate ) -> TriggerTypeDB: <NEW_LINE> <INDENT> trigger_data = jsonable_encoder(trigger_type) <NEW_LINE> update_data = trigger_type_in.dict(exclude_unset=True) <NEW_LINE> for field in trigger_data: <NEW_LINE> <INDENT> if field i... | [summary]
Arguments:
db_session {Session} -- SQLAlchemy Session object
trigger {TriggerTypeDB} -- TriggerTypeDB object
trigger_type_in {TriggerTypeUpdate} -- TriggerTypeDB object values to override
Returns:
TriggerTypeDB -- Returns a TriggerTypeDB object | 625941e756b00c62f0f14ac0 |
@pytest.fixture <NEW_LINE> def infra_vms_pg(home_page_logged_in): <NEW_LINE> <INDENT> return _submenu(home_page_logged_in, 'Infrastructure', 'Virtual Machines') | Navigate to Infrastructure -> Virtual Machines page and return it | 625941e7566aa707497f49c6 |
def post(self, request): <NEW_LINE> <INDENT> user = request.POST.get('user') <NEW_LINE> pwd = request.POST.get('pwd') <NEW_LINE> obj = models.UserInfo.objects.filter(name=user, pwd=pwd).first() <NEW_LINE> if obj: <NEW_LINE> <INDENT> request.session['user_info'] = {'id': obj.id, 'name': obj.name, 'uid': obj.uid} <NEW_LI... | 用户登录
登录成功后重定向到 /bind/ 路由下,引导用户关注微信公众号并授权
:param request:
:return: | 625941e75fcc89381b1e1b26 |
def generator_handler(self, meth): <NEW_LINE> <INDENT> for x in meth: <NEW_LINE> <INDENT> pass | Loop over generators methods
I'm using this method to help with large list sizes. Shouldn't be
needed but you never know.
args:
meth: The method we're running | 625941e7e1aae11d1e74a11f |
def OnPaint(self, element_type, paint_buffer, **_): <NEW_LINE> <INDENT> if element_type == cef.PET_VIEW: <NEW_LINE> <INDENT> image = Image.frombuffer( 'RGBA', (self.__width, self.__height), paint_buffer.GetString(mode="rgba", origin="top-left"), 'raw', 'BGRA' ) <NEW_LINE> mode = image.mode <NEW_LINE> rmask = gmask = bm... | Using the pixel data from CEF's offscreen rendering
the data is converted by PIL into a SDL2 surface
which can then be rendered as a SDL2 texture. | 625941e7aad79263cf390eab |
def testOnlyNonexisentFields(self): <NEW_LINE> <INDENT> response = json_response(self.test_client.get(r"/api/q?date=20140602&field=foo"), 400) | should throw error if only nonexistent fields specified | 625941e723e79379d52ee9c2 |
def to_vcf_header(self): <NEW_LINE> <INDENT> lines = [BCFGenericHeaderRecord('fileformat', self.vcf_version)] <NEW_LINE> for r in self.header_records: <NEW_LINE> <INDENT> if r.tag == 'fileformat': <NEW_LINE> <INDENT> lines = [] <NEW_LINE> <DEDENT> <DEDENT> for r in self.header_records: <NEW_LINE> <INDENT> lines.append(... | Return multi-line string with VCF header representation | 625941e796565a6dacc8fb2e |
def h2oas_list(): <NEW_LINE> <INDENT> iris = h2o.import_file(path=pyunit_utils.locate("smalldata/iris/iris_wheader.csv")) <NEW_LINE> res1 = h2o.as_list(iris, use_pandas=False) <NEW_LINE> assert_is_type(res1, list) <NEW_LINE> res1 = list(zip(*res1)) <NEW_LINE> assert abs(float(res1[0][9]) - 4.4) < 1e-10 and abs(float(re... | Python API test: h2o.as_list(data, use_pandas=True, header=True)
Copied from pyunit_frame_as_list.py | 625941e763b5f9789fde754a |
def _query_frame_set(self, value): <NEW_LINE> <INDENT> self._query_frame = self._prep_frame(value) | Set query sequence reading frame (PRIVATE). | 625941e7379a373c97cfafaa |
def Query(self, table, hash_key, range_operator, callback, attributes, limit=None, consistent_read=False, count=False, scan_forward=True, excl_start_key=None): <NEW_LINE> <INDENT> raise NotImplementedError() | Queries a range of values by 'hash_key' and 'range_operator'.
'range_operator' is of type RangeOperator (see named tuple above;
if None, selects all values). 'attributes' is a list of
attributes to query, limit is an upper limit on the number of
results. If True, 'count' will return just a count of items, but
no actual... | 625941e7a934411ee3751af8 |
def on_movement(self, event): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if not event.xdata: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> x = round(event.xdata) <NEW_LINE> y = event.ydata <NEW_LINE> coords = '(%d, %.2f)' % (x, y) <NEW_LINE> evt = custom_event(coords=coords) <NEW_LINE> wx.PostEvent(self.Parent.Paren... | displays cursor coordinates in the status bar. wx.PostEvent throws an
interrupt that is caught in ASPresentation class frame | 625941e7167d2b6e31218ff9 |
def wait_connect(): <NEW_LINE> <INDENT> for _ in range(1, 50): <NEW_LINE> <INDENT> if CONNECTED: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> time.sleep(3) <NEW_LINE> <DEDENT> return False | Вместо асинхронной реализации - просто ждем, когда произойдет коннект | 625941e7d8ef3951e32439a2 |
def modify_chr(chr_id): <NEW_LINE> <INDENT> if chr_id[0] not in ["C", "c", "J", "G"]: <NEW_LINE> <INDENT> chr_id = "chr{0}".format(chr_id) <NEW_LINE> <DEDENT> return(chr_id) | Take a bare chromosome name and prefix "chr" to it, except if it's one of
the weird ones. | 625941e73617ad0b5ed6835a |
def _clean(self, arg): <NEW_LINE> <INDENT> if arg == 'all': <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> path = self.job.path <NEW_LINE> absfiles = [opj(path, f) for f in self.files] <NEW_LINE> childnames = [child.name for child in self.job] if hasattr(self.job, 'children') else [] <NEW_LINE> if arg in ['none', [], N... | Clean the job folder. *arg* should be a string or a list of strings. See |cleaning| for details. | 625941e75510c4643540f83d |
def stop_nodes(self): <NEW_LINE> <INDENT> for node in self.nodes: <NEW_LINE> <INDENT> node.stop_node() <NEW_LINE> <DEDENT> for node in self.nodes: <NEW_LINE> <INDENT> node.wait_until_stopped() | Stop multiple wificoind test nodes | 625941e738b623060ff0b251 |
def forward(self): <NEW_LINE> <INDENT> X_node = self.inbound_nodes[0] <NEW_LINE> input_value = X_node.value <NEW_LINE> self.value = self._sigmoid(input_value) | Perform the sigmoid function and set the value. | 625941e7097d151d1a2232bb |
def check_freq_phone(phone): <NEW_LINE> <INDENT> key_name = "suoping:wait:%s" % phone <NEW_LINE> if db.redis.get(key_name): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True | 检验请求发送频率 | 625941e715fb5d323cde0f7a |
def load_preprocess_metadata(source_list, preprocessors=None): <NEW_LINE> <INDENT> transformers = TransformManager(preprocessors) <NEW_LINE> for source in source_list: <NEW_LINE> <INDENT> for dataset_type in ['train', 'valid']: <NEW_LINE> <INDENT> input_paths = source[dataset_type] <NEW_LINE> source[dataset_type] = [] ... | This function loads the metadata file (as a file) and then performs preprocessing
on the metadata. The data is then stored in the source list instead of the path.
:param source_list: The sources list to preprocess.
:param preprocessors: The preprocessors to use.
:return: | 625941e785dfad0860c3b2c0 |
def test_find_folders(self): <NEW_LINE> <INDENT> fake_folders = [] <NEW_LINE> min_value = 0 <NEW_LINE> max_value = 10 <NEW_LINE> iterations = fake.pyint(min_value=min_value, max_value=max_value) <NEW_LINE> root = self.test_folder <NEW_LINE> for iteration in range(iterations): <NEW_LINE> <INDENT> fake_folder_name = fake... | Ensures the `find_folders()` method returns all the folders in a given directory. | 625941e7379a373c97cfafab |
def neutralize_v3(mol): <NEW_LINE> <INDENT> pat_v3.Match(mol) <NEW_LINE> for match in pat_v3.GetMapList(): <NEW_LINE> <INDENT> atom = mol.GetAtom(match[0]) <NEW_LINE> chg = atom.GetFormalCharge() <NEW_LINE> hcount = atom.GetImplicitHCount() <NEW_LINE> atom.SetFormalCharge(0) <NEW_LINE> atom.SetImplicitHCount(hcount - c... | Neutralize charges of +1 or -1 | 625941e70c0af96317bb864c |
def resposta_elemento(res, n): <NEW_LINE> <INDENT> if not (0 <= n < len(res)): <NEW_LINE> <INDENT> raise ValueError("resposta_elemento: argumentos invalidos") <NEW_LINE> <DEDENT> return res[n] | resposta_elemento : resposta x int -> tuplo(string, coordenada)
resposta_elemento(res, n) devolve o enesimo elemento da resposta res | 625941e7b545ff76a8914279 |
def save(self, table, obj): <NEW_LINE> <INDENT> pass | Save document data to database. | 625941e77d847024c06be724 |
def fast(maze): <NEW_LINE> <INDENT> return [] | Runs suboptimal search algorithm for part 5.
@param maze: The maze to execute the search on.
@return path: a list of tuples containing the coordinates of each state in the computed path | 625941e755399d3f05588b1b |
def load_history(self): <NEW_LINE> <INDENT> self.history = [] <NEW_LINE> try: <NEW_LINE> <INDENT> for entry in self.wiki.git_wiki.get_walker( paths=[self.physical_path.encode('utf-8')]): <NEW_LINE> <INDENT> self.history.append(ArticleHistoryEntry(self, entry.commit)) <NEW_LINE> <DEDENT> <DEDENT> except KeyError as e: <... | Load our commit history. | 625941e776d4e153a657ef97 |
def restoreElementsFromTuples(self, streamObj): <NEW_LINE> <INDENT> if hasattr(streamObj, '_storedElementOffsetTuples'): <NEW_LINE> <INDENT> for e, offset in streamObj._storedElementOffsetTuples: <NEW_LINE> <INDENT> if offset != 'end': <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> streamObj.coreInsert(offset, e) <NEW_LI... | Take a Stream with elements and offsets stored in
a list of tuples (element, offset or 'end') at
_storedElementOffsetTuples
and restore it to the ._elements and ._endElements lists
in the proper locations:
>>> s = stream.Measure()
>>> s._elements, s._endElements
([], [])
>>> n1 = note.Note("C#")
>>> n2 = note.Note("... | 625941e76fece00bbac2dba8 |
def test_two_past_questions(self): <NEW_LINE> <INDENT> create_question(question_text="Past question 1.", days=-30) <NEW_LINE> create_question(question_text="Past question 2.", days=-5) <NEW_LINE> response = self.client.get(reverse('polls:index')) <NEW_LINE> self.assertQuerysetEqual( response.context['latest_question_li... | The questions index page may display multiple questions. | 625941e7e1aae11d1e74a120 |
def get_ticker_info(ticker): <NEW_LINE> <INDENT> with open(os.path.dirname(os.path.abspath(__file__)) + "/raw_data.json") as f: <NEW_LINE> <INDENT> lines = json.load(f) <NEW_LINE> <DEDENT> for match, values in lines.items(): <NEW_LINE> <INDENT> if match == ticker: <NEW_LINE> <INDENT> ticker_info = {'ticker': ticker, 'c... | Takes in a stock ticker string and returns a dict of urls and text
describing those urls. | 625941e7cdde0d52a9e5349a |
def test_is_initial_text(error_text="You should modify the file"): <NEW_LINE> <INDENT> path = sys.argv[-1] <NEW_LINE> text = get_initial_text(path) <NEW_LINE> file_text = get_file_text(path) <NEW_LINE> if file_text.strip() == text.strip(): <NEW_LINE> <INDENT> failed(error_text) <NEW_LINE> <DEDENT> else: <NEW_LINE> <IND... | Checks that file was modified | 625941e71f5feb6acb0c4fad |
def post(self, img_path, caption): <NEW_LINE> <INDENT> self.__driver.get(self.main_url) <NEW_LINE> sleep(5) <NEW_LINE> self.close_all_popups() <NEW_LINE> menu_item = self.__driver.find_element_by_xpath("//div[@role='menuitem']") <NEW_LINE> menu_item.click() <NEW_LINE> sleep(3) <NEW_LINE> self.__upload_a_file('//*[@id="... | This function is used to post on instagram
:param img_path: image path
:param caption: caption
:return: None | 625941e7a934411ee3751af9 |
def Clone(self): <NEW_LINE> <INDENT> pass | Clone(self: DoubleKeyFrameCollection) -> DoubleKeyFrameCollection
Creates a modifiable clone of this System.Windows.Media.Animation.DoubleKeyFrameCollection,
making deep copies of this object's values. When copying dependency properties,this method
copies resource references and data bindings (but they might... | 625941e724f1403a92600fc7 |
def calculate_inert_gas_pressure_compartment(p_begin, pp_gasmix, t_exposure, halftime, depth): <NEW_LINE> <INDENT> p_depth = depth_to_atm(depth) <NEW_LINE> p_gasmix = pp_gasmix * p_depth <NEW_LINE> return p_begin + (p_gasmix - p_begin) * (1 - 2 ** (- t_exposure / halftime)) | Calculates pressure of inert gas in compartment
WARNING -- This formula assumes the descent is instant. Averaging is necessary for more realistic values
:param p_begin: Inert gas pressure in the compartment before the exposure (atm)
:param pp_gasmix: Partial pressure of the inert gas breathed by the diver
:param t_exp... | 625941e74a966d76dd551478 |
def format(number, pageCount): <NEW_LINE> <INDENT> zeros=len(str(pageCount))-len(str(int(number))) <NEW_LINE> return "0"*zeros+str(number)+FILETYPE | Takes page [number] and returns the corresponding filename.
Default: Images are sorted by sequential numbers with the same number of chars.
- Modify this method to insert images in a custom order. | 625941e74f88993c3716c4c7 |
def confirm_action(self, msgboxHeading, msgboxText): <NEW_LINE> <INDENT> if not self.game.is_finished(): <NEW_LINE> <INDENT> answer = messagebox.askyesno(msgboxHeading, msgboxText) <NEW_LINE> return answer <NEW_LINE> <DEDENT> return True | Critical actions need to be confirmed. This functions creates a
message box to ask the user whether he is sure to continue.
This will only happen if game is not finished, otherwise the action
can continue (because a finished game is not supposed to be critical). | 625941e7187af65679ca5584 |
def overlay_peaks(self, ax): <NEW_LINE> <INDENT> mask = np.flip(self.peaks.T, axis=0) <NEW_LINE> mask = np.ma.masked_where((np.flip(self.peaks.T, axis=0) == 0.0), mask) <NEW_LINE> ax.imshow(mask, cmap=cm.Greys, extent=self.extent, vmin=0, vmax=1) <NEW_LINE> if self.grey_cb is True: <NEW_LINE> <INDENT> sm = plt.cm.Scala... | Overlay the number of peaks. Transparent if 1 or 0 peaks, or increasingly black if multi-peak solutions are frequent.
:param ax: **matplotlib** axis object
:return: ax | 625941e77b25080760e398bb |
def generate_tac(self, tac_id, device_key): <NEW_LINE> <INDENT> endpoint = TACEndpoint.GENERATE_TAC.value.format(id=tac_id) <NEW_LINE> headers = self._copy_headers() <NEW_LINE> headers['deviceKey'] = device_key <NEW_LINE> return self._post(url=self._build_url(endpoint), headers=headers) | POST /v3/tac/{id}/generate
:param str tac_id: path parameter
:param str device_key: header
:return: Response object
:rtype: requests.Response | 625941e7a4f1c619b28b0493 |
def restore_task(tid): <NEW_LINE> <INDENT> LOGGER.info("restore task %s state to pending" % tid) <NEW_LINE> return 0 | Restore task state to pending | 625941e77c178a314d6ef8cb |
def some_name_matches(self, entity): <NEW_LINE> <INDENT> return bool(self.first_matching_name(entity)) | Returns true if there is some name somewhere in self that fuzzily
matches some name somewhere in the given entity. | 625941e782261d6c526ab90a |
def main(filename='morph.swc'): <NEW_LINE> <INDENT> class Cell: <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return 'neuron' <NEW_LINE> <DEDENT> <DEDENT> cell = Cell() <NEW_LINE> load_swc(filename, cell) <NEW_LINE> return cell | demo test program | 625941e7956e5f7376d712d0 |
def getCertOption(cert, optionName): <NEW_LINE> <INDENT> if optionName in CERT_ATTRS: <NEW_LINE> <INDENT> return CERT_ATTRS[optionName] <NEW_LINE> <DEDENT> return CERT_ATTRS[cert][optionName] | Return a given option of a given certificate, taken from CERT_ATTRS
:param cert: effectively, path to the certificate in question
:param optionName: name of the options
:returns: the option | 625941e7d10714528d60014c |
def stop(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.threadLock.release() <NEW_LINE> self.running = False <NEW_LINE> <DEDENT> except AttributeError as ex: <NEW_LINE> <INDENT> pass | !
Notify reporter about program exit. | 625941e7e5267d203edce0fb |
def __init__(self, value_dict: dict, value_count_dict: dict = {}, Unit_Analyzer=None, align_dict={}, main_unit_dict={}, bucket_num=10): <NEW_LINE> <INDENT> if bucket_num <= 2: <NEW_LINE> <INDENT> raise BucketAssignError("bucket_num should be greater than 2") <NEW_LINE> <DEDENT> self._v... | @param {dict} value_dict:
保存的数值字典
要保证value_dict, value_count_dict中的所有value均已对齐
_bucket_comp form:
{
"attr1": {
(bucket_id, min, max): <counter>,
(bucket_id, min, max): <counter>,
...
},
"attr2": <same above>,
"attr3": <same above>,
... | 625941e7bd1bec0571d90a93 |
def get_file_datetime(list_of_files): <NEW_LINE> <INDENT> file_datetime = pd.DataFrame() <NEW_LINE> file_datetime.insert(0, 'Item', [path_to_file for path_to_file in list_of_files]) <NEW_LINE> file_datetime.insert(1, 'Results', [time.ctime(os.path.getmtime(path_to_file)) for path_to_file in list_of_files]) <NEW_LINE> r... | Parameters:
list_of_files: List; the files for which datetimes are required.
Returns:
A DataFrame of input files (full path) and corresponding datetimes (date stamps) for those files. | 625941e7090684286d50f150 |
def equals_and_hash_expected_difference_test(): <NEW_LINE> <INDENT> bi_builder_C = _create_build_info_builder() <NEW_LINE> module_builder_C = Module.Builder( id=Id( group_id="defend.against.fruit", artifact_id="pointy-stick", version="5.2"), properties={'ape', 'lets swing'}) <NEW_LINE> bi_builder_C.add_module(module_bu... | quick check to make sure I am not causing problems by feeding a dict
to frozenset. | 625941e7be383301e01b58e1 |
def get_identification(self): <NEW_LINE> <INDENT> id_parameter = self.query("*IDN?").split(",") <NEW_LINE> id_list = {'manufacturer': id_parameter[0], 'model': id_parameter[1], 'serial number': id_parameter[2], 'firmware version': id_parameter[3]} <NEW_LINE> return id_list | Returns instrument's identification parameters.
Returns:
id (list):
List defining instrument's manufacturer, model, instrument serial, firmware version | 625941e7d268445f265b52d3 |
def test_change_game(self): <NEW_LINE> <INDENT> game = Game() <NEW_LINE> game.gametype_id = 1 <NEW_LINE> game.title = "Sorry" <NEW_LINE> game.description = "Not sorry" <NEW_LINE> game.number_of_players = 4 <NEW_LINE> game.gamer_id = 1 <NEW_LINE> game.save() <NEW_LINE> data = { "gameTypeId": 1, "title": "Sorry", "descri... | Ensure we can change an existing game. | 625941e7cad5886f8bd2743d |
def _extract(self, body, record_dict): <NEW_LINE> <INDENT> matches = [m for m in re.finditer('[A-Z]', body)] <NEW_LINE> return matches[1].start() | Finds the start index of the second capitalised word. | 625941e7e64d504609d74ca4 |
def generateDtmfTones(self,phoneNumber,toneDuration): <NEW_LINE> <INDENT> return self._rpc("generateDtmfTones",phoneNumber,toneDuration) | generateDtmfTones(
String phoneNumber,
Integer toneDuration[optional, default 100]: duration of each tone in milliseconds)
Generate DTMF tones for the given phone number. | 625941e763d6d428bbe44955 |
def _set_draggable_person(self, eventbox, person_handle): <NEW_LINE> <INDENT> self._set_draggable(eventbox, person_handle, DdTargets.PERSON_LINK, 'gramps-person') | Register the given eventbox as a drag_source with given person_handle | 625941e76aa9bd52df03720c |
def covid_handle(covid_data): <NEW_LINE> <INDENT> global areaName, newCasesToday, cumCasesToday, newCasesYesterday, cumDeathsYesterday, newDeathsYesterday <NEW_LINE> covid_today = covid_data[0] <NEW_LINE> covid_yesterday = covid_data[1] <NEW_LINE> areaName = covid_today['areaName'] <NEW_LINE> newCasesToday = covid_toda... | This function creates global varibales containing COVID
data from today and yesterday in order to create daily briefings | 625941e744b2445a339324f7 |
def __init__(self, cards = None, mr = 0.0): <NEW_LINE> <INDENT> self.module = bridge() <NEW_LINE> if cards is None: <NEW_LINE> <INDENT> self.cards = list(range(0,52)) <NEW_LINE> random.shuffle(self.cards) <NEW_LINE> hand.drawcount += self.cardsinhand <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.mutate(cards, mr) ... | constructor allows initialization from scratch
or from a parent hand | 625941e7b5575c28eb68e469 |
def __call__(self): <NEW_LINE> <INDENT> raise NotImplementedError | Return the current value of the diagnostic represented by this
:class:`LogQuantity` or None if no value is available.
This is only called if the invocation interval calls for it. | 625941e77b180e01f3dc4c59 |
def parallel_tfa_lcdir(lcdir, templateinfo, lcfileglob=None, timecols=None, magcols=None, errcols=None, lcformat='hat-sql', lcformatdir=None, interp='nearest', sigclip=5.0, mintemplatedist_arcmin=10.0, nworkers=NCPUS, maxworkertasks=1000): <NEW_LINE> <INDENT> if isinstance(templateinfo,str) and os.path.exists(templatei... | This applies TFA in parallel to all LCs in a directory.
Parameters
----------
lcdir : str
This is the directory containing the light curve files to process..
templateinfo : dict or str
This is either the dict produced by `tfa_templates_lclist` or the pickle
produced by the same function.
lcfileglob : st... | 625941e745492302aab5e72c |
def __init__(self, url, port=8090, api_path='/', verify_ssl=False, **kwargs): <NEW_LINE> <INDENT> sandboxapi.SandboxAPI.__init__(self, **kwargs) <NEW_LINE> if not url: <NEW_LINE> <INDENT> url = '' <NEW_LINE> <DEDENT> if url.startswith('http://') or url.startswith('https://'): <NEW_LINE> <INDENT> self.api_url = url <NEW... | Initialize the interface to Cuckoo Sandbox API with host and port.
:type url: str
:param url: Cuckoo API URL. (Currently treated as host if not a fully formed URL -
this will be removed in a future version.)
:type port: int
:param port: DEPRECATED! Use fully formed url instead. Wil... | 625941e7e64d504609d74ca5 |
def get_collection_id(session_id): <NEW_LINE> <INDENT> url = "https://transkribus.eu/TrpServer/rest/collections/list" <NEW_LINE> querystring = {"JSESSIONID": session_id} <NEW_LINE> response = requests.request("GET", url, params=querystring) <NEW_LINE> json_file = json.loads(response.text) <NEW_LINE> collection_id = '' ... | Request Trankribus API to list collections accessible for current user and retrieve id of targeted collection.
:param session_id: session id for authentication.
:type session_id: string
:return: numerical id for targeted collection.
:rtype: integer | 625941e726068e7796caf14a |
def matrixReshape(self, nums, r, c): <NEW_LINE> <INDENT> if len(nums) * len(nums[0]) < r * c: <NEW_LINE> <INDENT> return nums <NEW_LINE> <DEDENT> matrix, temp = [], [] <NEW_LINE> for num in nums: <NEW_LINE> <INDENT> for n in num: <NEW_LINE> <INDENT> if len(temp) == c: <NEW_LINE> <INDENT> if len(matrix) == r: <NEW_LINE>... | :type nums: List[List[int]]
:type r: int
:type c: int
:rtype: List[List[int]] | 625941e7be7bc26dc91cda5c |
def pop_field(self, length): <NEW_LINE> <INDENT> field = self.head(length) <NEW_LINE> del self[self.len - length:] <NEW_LINE> return field | Remove the first set of transmitted or received bits from a bitstring
and return it. | 625941e7627d3e7fe0d692b6 |
def _prepare_lines(original_lines): <NEW_LINE> <INDENT> new_original_lines = [] <NEW_LINE> for original_line in original_lines: <NEW_LINE> <INDENT> new_original_lines.append(original_line + '\n') <NEW_LINE> <DEDENT> return new_original_lines | # Adds the line breaks to each original line. | 625941e7046cf37aa974d1a8 |
def getActuatorName(self, axisNo): <NEW_LINE> <INDENT> name = ctypes.create_string_buffer(20) <NEW_LINE> ANC.getActuatorName(self.device, axisNo, ctypes.byref(name)) <NEW_LINE> return name.value.decode('utf-8') | Get the name of the currently selected actuator
Parameters
axisNo Axis number (0 ... 2)
Returns
name Name of the actuator | 625941e763f4b57ef0001571 |
def test_perform_single_migration_not_found(self): <NEW_LINE> <INDENT> with self.assertRaises(ModuleNotFoundException): <NEW_LINE> <INDENT> _perform_single_migration( "up", self.model, migration=self.bad_migration, **kwargs ) | Ensure that a bad migration argument raises an error | 625941e7ac7a0e7691ed4529 |
def isPowerOfTwo(self, n): <NEW_LINE> <INDENT> if n < 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return bin(n).count("1") == 1 | :type n: int
:rtype: bool | 625941e70a50d4780f6672fa |
def test_redirect_params_common(self): <NEW_LINE> <INDENT> response = self.client.get(reverse('addons.contribute', args=[592]), follow=True) <NEW_LINE> redirect_url = response.redirect_chain[0][0] <NEW_LINE> assert(re.search('business=([^&]+)', redirect_url)) <NEW_LINE> common_params = {'bn': r'-AddonID592', 'business'... | Test for the common values that do not change based on type,
Check that they have expected values | 625941e7d58c6744b42580c3 |
def convert_to_v2(self) -> None: <NEW_LINE> <INDENT> self._convert_version(2) | Sets this PSBT to version 2 | 625941e7377c676e9127260c |
def OnMouseLeave(self,*args): <NEW_LINE> <INDENT> pass | OnMouseLeave(self: UIElement,e: MouseEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.MouseLeave�attached event
is raised on this element. Implement this method to add class handling for this
event.
e: The System.Windows.Input.MouseEventArgs that contains the event data. | 625941e7d268445f265b52d4 |
def islistable(obj): <NEW_LINE> <INDENT> return isinstance(obj, (list, tuple, set)) | Return True is obj is listable. | 625941e7a05bb46b383ecc82 |
def set_options(self, options=None): <NEW_LINE> <INDENT> self.options = options if options else None <NEW_LINE> if not self.options: <NEW_LINE> <INDENT> if self.logger: self.logger.error('Unable to set_options') <NEW_LINE> else: print('ERROR: Unable to set_options') | Set command line argument options | 625941e7ff9c53063f47c656 |
def predict(self, Xi_star, t_star, W_star): <NEW_LINE> <INDENT> Xi_star = Xi_star.float().to(self.device) <NEW_LINE> Xi_star.requires_grad = True <NEW_LINE> loss, X_star, Y_star, Y0_pred = self.loss_function( t_star, W_star, Xi_star) <NEW_LINE> return X_star, Y_star | Make a prediction | 625941e74c3428357757c78a |
def read_boolean(self, d=None, c=1): <NEW_LINE> <INDENT> return self.read_numeric(self.LVint8, c) | Read LabVIEW boolean data type.
Parameters
----------
d : None, optional
Boolean data type. This parameter is actually ignored, only kept to
have the same number of arguments on all basic read_* functions.
Internally `self.LVint8` is used.
c : int, optional
Data count.
Default is 1.
Returns
------... | 625941e76fece00bbac2dba9 |
def fix_at_image_scales(setup): <NEW_LINE> <INDENT> catalog = api.portal.get_tool('portal_catalog') <NEW_LINE> query = {} <NEW_LINE> query['object_provides'] = 'plone.app.contenttypes.behaviors.richtext.IRichText' <NEW_LINE> results = catalog(**query) <NEW_LINE> log.info('There are {0} in total, stating migration...'.f... | Run this in Plone 5.x
| 625941e7462c4b4f79d1db34 |
def coreGuardBeforeAddElement(self, element, *, checkRedundancy=True): <NEW_LINE> <INDENT> if element is self: <NEW_LINE> <INDENT> raise StreamException('this Stream cannot be contained within itself') <NEW_LINE> <DEDENT> if not isinstance(element, Music21Object): <NEW_LINE> <INDENT> if isinstance(element, StreamIterat... | Before adding an element, this method performs
important checks on that element.
Used by:
- :meth:`~music21.stream.Stream.insert`
- :meth:`~music21.stream.Stream.append`
- :meth:`~music21.stream.Stream.storeAtEnd`
- `Stream.__init__()`
Returns None or raises a StreamException
>>> s = stream.Stream()
>>> s.c... | 625941e78e71fb1e9831dc0c |
def _register_rpc_events(self): <NEW_LINE> <INDENT> def disconnected(details): <NEW_LINE> <INDENT> if details: <NEW_LINE> <INDENT> if "error" in details: <NEW_LINE> <INDENT> self.error(details["message"]) <NEW_LINE> <DEDENT> if "info" in details: <NEW_LINE> <INDENT> self.log(details.info) <NEW_LINE> <DEDENT> <DEDENT> s... | Register rpc events. | 625941e750812a4eaa59c782 |
def test_goto_gang_change_apogee_fails_domeflat(self): <NEW_LINE> <INDENT> myGlobals.actorState.survey = sopActor.APOGEE <NEW_LINE> self.cmd.failOn = 'apogee expose time=50.0 object=DomeFlat' <NEW_LINE> sopTester.updateModel('apogee', TestHelper.apogeeState['B_open']) <NEW_LINE> sopTester.updateModel('mcp', TestHelper.... | Tests shutter open, FFS close, expose -> fail. | 625941e791f36d47f21ac95c |
def get_style_css(ctx, node, embed=True, fontsize=-1): <NEW_LINE> <INDENT> style = [] <NEW_LINE> if not node: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if fontsize in [-1, 2]: <NEW_LINE> <INDENT> if 'sz' in node.rpr: <NEW_LINE> <INDENT> size = int(node.rpr['sz']) / 2 <NEW_LINE> if ctx.options['embed_fontsize']: <N... | Returns as string defined CSS for this node.
Defined CSS can be different if it is embeded or no. When it is embeded styling
for bold,italic and underline will not be defined with CSS. In that case we
use defined tags <b>,<i>,<u> from the content.
:Args:
- ctx (:class:`Context`): Context object
- node (:class:`o... | 625941e7925a0f43d254a2e0 |
def _plot_average_risk_dynamics(*args, **kwargs): <NEW_LINE> <INDENT> return plot_average_risk_dynamics(*args, **kwargs) | Wrapper for plot_average_risk_dynamics() for compatibility. | 625941e72eb69b55b151cd1a |
def generate_deploy_code(self, key: str) -> str: <NEW_LINE> <INDENT> full_path = f"{self.api_version}/model/{self._path}/{key}/deploy" <NEW_LINE> json = self.api_manager.post(full_path, None).json() <NEW_LINE> if 'code' in json: <NEW_LINE> <INDENT> return json.get('code') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> r... | Initiate the deploy process of the entity
with the matching key
:return code as a string | 625941e74e4d5625662d4837 |
def get_attributes(self): <NEW_LINE> <INDENT> return self.__class__.ATTRIBUTES.keys() | return list of DTD defined attribute names.
| 625941e7a8370b7717052d02 |
def get_app() -> MyApp(): <NEW_LINE> <INDENT> return wx.GetApp() | get wx.App that this application use | 625941e74f88993c3716c4c8 |
@pytest.fixture <NEW_LINE> def ensure_clean(bsfile, bsfile_fail): <NEW_LINE> <INDENT> bs_org = bsfile['organisation'] <NEW_LINE> bs_image_names = image_names(bsfile) <NEW_LINE> fail_org = bsfile_fail['organisation'] <NEW_LINE> fail_image_names = image_names(bsfile_fail) <NEW_LINE> full_names = full_image_names(bs_image... | Make sure the images in the boatswain file
do not exist without using any boatswain
functionality
Also do not remove any exisisting containers
or images on the system | 625941e7a79ad161976cc5ab |
def test_site_actor_generator(self): <NEW_LINE> <INDENT> site_actor = SiteActor( protoform=Protoform("B"), site=Site("pY")) <NEW_LINE> nugget = KamiGraph() <NEW_LINE> nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene <NEW_LINE> (gene_id, site_id, region_id, _) = self.generator.generate_sit... | Test generation of graph components for a SiteActor object. | 625941e7eab8aa0e5d26dfbf |
def pubIDusesAllKeywords(keywords): <NEW_LINE> <INDENT> keywords= keywords.split(',') <NEW_LINE> publicationID_in_keywords_publication = db.session.query(Keywords_publication.publication_id, func.count(Keywords_publication.publication_id) == len(keywords)) .filter(or_((Keywords_publication.keyword_id == keyW) fo... | This function returns a List of all publicationIDs which have all keywords provided by the api.
After the query collected all publications which have at least one of the provided keywords, we count the occurence of the publicationsIDs. If these occure as often,
as the amount of keywords provided, we know that a Publica... | 625941e7b57a9660fec33cef |
def __init__( self, content, start_x, start_y, end_x, end_y, font_dict): <NEW_LINE> <INDENT> self.content = content <NEW_LINE> self.start_x = start_x <NEW_LINE> self.start_y = start_y <NEW_LINE> self.end_x = end_x <NEW_LINE> self.end_y = end_y <NEW_LINE> self.font_dict = font_dict <NEW_LINE> self.width = self.end_x - s... | 文本框中包含文本[内容,宽度,高度,start_x,start_y,end_x,end_y,font_dict]
| 625941e7a17c0f6771cbe4b4 |
def insertar_chip(self, chip): <NEW_LINE> <INDENT> self.lista_chips.append(chip) | Insertamos un chip al final de la lista
chip: chip a insertar | 625941e7956e5f7376d712d1 |
@function_timer <NEW_LINE> def most_active_resources(df): <NEW_LINE> <INDENT> df_bytes_used = df .groupby('request_uri') .agg({'bytes_used':{'total_bytes': 'sum'}}) .bytes_used <NEW_LINE> df_bytes_used['request_uri'] = df_bytes_used.index <NEW_LINE> df_bytes_used = df_bytes_used.sort_values(['total... | most_active_resources: top 10 resources by total bytes_used
input:
pd.DataFrame df - a pandas dataframe containing all the data we want to process | 625941e7099cdd3c635f10be |
def parse_vasprun( self ): <NEW_LINE> <INDENT> self.vasprun_filename = match_filename( 'vasprun.xml' ) <NEW_LINE> if not self.vasprun_filename: <NEW_LINE> <INDENT> raise FileNotFoundError( 'Could not find vasprun.xml or vasprun.xml.gz file' ) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> self.vasprun = Vasprun( self.vas... | Read in `vasprun.xml` as a pymatgen Vasprun object.
Args:
None
Returns:
None
None:
If the vasprun.xml is not well formed this method will catch the ParseError
and set self.vasprun = None. | 625941e7f548e778e58cd9e5 |
def request(self, method, target, params=None, data=None): <NEW_LINE> <INDENT> r = self.session.request(method, self._build_full_url(target), params=params, data=data, headers=self.headers, auth=self._build_auth()) <NEW_LINE> data = r.json() if r.content else None <NEW_LINE> if r.status_code >= 400: <NEW_LINE> <INDENT>... | An internal method that send request to server.
It is exposed if you need to make API calls not implemented in this
library or if you need to debug requests.
:param str method: An HTTP method (e.g. 'GET' or 'POST').
:param str target: The target URL with leading slash (e.g. '/datastreams').
:param dict params: A dicti... | 625941e7baa26c4b54cb1580 |
def test_secred_essage(self): <NEW_LINE> <INDENT> User.objects.create(username="test", password="test") <NEW_LINE> saved_secred_message = SecredMessage.objects.all() <NEW_LINE> self.assertFalse(saved_secred_message.count(), 0) <NEW_LINE> secred_message = SecredMessage.objects.create( user = User.objects.get(username="t... | user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='usersend')
username = models.CharField(max_length=30)
yourname = models.CharField(max_length=30)
nickname = models.CharField(max_length=30, null=True)
text = models.CharField(max_length=1000)
image = models.ImageField(upload_to='images',blank=True, ... | 625941e7293b9510aa2c36f7 |
def decode_payload(payload): <NEW_LINE> <INDENT> data = json.loads(payload.decode('utf-8'), separator=([':', ','])) <NEW_LINE> return data | Takes a byte array and converts it into an object using ``json.loads``
Args:
payload (bytearray): An array of bytes to decode and convert into an object.
Returns:
dict/list: A dictionary or list object depending on the JSON that was encoded | 625941e71d351010ab855f80 |
def resnext29_32x4d_svhn(num_classes=10, **kwargs): <NEW_LINE> <INDENT> return get_resnext_cifar(num_classes=num_classes, blocks=29, cardinality=32, bottleneck_width=4, model_name="resnext29_32x4d_svhn", **kwargs) | ResNeXt-29 (32x4d) model for SVHN from 'Aggregated Residual Transformations for Deep Neural Networks,'
http://arxiv.org/abs/1611.05431.
Parameters:
----------
num_classes : int, default 10
Number of classification classes.
pretrained : bool, default False
Whether to load the pretrained weights for model.
root ... | 625941e7a17c0f6771cbe4b5 |
def lpr_data(year=None): <NEW_LINE> <INDENT> year = du.get_year() if year is None else year <NEW_LINE> lab = ct.SHIBOR_TYPE['LPR'] <NEW_LINE> lab = lab.encode('utf-8') if ct.PY3 else lab <NEW_LINE> try: <NEW_LINE> <INDENT> df = pd.read_excel(ct.SHIBOR_DATA_URL % (ct.P_TYPE['http'], ct.DOMAINS['shibor'], ct.PAGES['dw'],... | 获取贷款基础利率(LPR)
Parameters
------
year:年份(int)
Return
------
date:日期
1Y:1年贷款基础利率 | 625941e74c3428357757c78b |
def gen_run_incoming_tasks(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> msg = yield self.in_orders.queue_local_jobs.get() <NEW_LINE> tsk = msg.uows <NEW_LINE> success = self.do_work(tsk) <NEW_LINE> print('KTO KTO ?', self.connected_nodes) <NEW_LINE> self.out_orders.wrong_jobs.put(msg) <NEW_LINE> if succes... | Task managing generator, where node reply to sender node if job was done successfully | 625941e763b5f9789fde754b |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, EndpointPaginationResponse): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ | Returns true if both objects are equal | 625941e74e696a04525c98b3 |
def get_expected_response(request_msg, result): <NEW_LINE> <INDENT> msg = json.loads(request_msg) <NEW_LINE> return { 'jsonrpc': '2.0', 'result': result, 'id': msg['id'], } | Return a response based on response message and expected result of
Modbus master. | 625941e760cbc95b062c69a9 |
def compute_elastic_stiffness_matrix(self): <NEW_LINE> <INDENT> coef = (self.__eModulus * self.__area) / self.get_length() <NEW_LINE> a = outer(self.n1.get_position()-self.n2.get_position(), self.n1.get_position()-self.n2.get_position()) <NEW_LINE> b = outer(self.n1.get_position()-self.n2.get_position(), self.n2.get_po... | "Computes special case of tangential matrix | 625941e78c0ade5d55d3ee24 |
def test_close(self): <NEW_LINE> <INDENT> if not unittest.source: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> phdi_handle = pyphdi.handle() <NEW_LINE> with self.assertRaises(IOError): <NEW_LINE> <INDENT> phdi_handle.close() | Tests the close function. | 625941e771ff763f4b549af9 |
def __init__(self, app, text): <NEW_LINE> <INDENT> pass | __control = Label(app, text, "#00D", "#ff0")
def pack(self):
self__comtrol.pack(ipadx=1, ipady=1, padx=2, pady=3, side="top") | 625941e7b830903b967e9d6c |
def is_temporary(self) -> bool: <NEW_LINE> <INDENT> return False | 如果为True,相应的控件将在窗口关闭时删除,并且不会记忆其位置。如果为False,则相应的控件不会被删除,且其位置将被记忆。
默认返回False。 | 625941e73d592f4c4ed1d4c7 |
def test_default_declaration_generation(self): <NEW_LINE> <INDENT> line_color = LineColor() <NEW_LINE> self.assertEqual(line_color.to_str(), "\tlinecolor = rgb(0.00,0.00,0.00);\n") | Tests the generation of a line color declaration with
no parameters | 625941e76e29344779a62a75 |
def setBugSupervisor(self): <NEW_LINE> <INDENT> self._setBugSupervisorDataNone() | Establish a bug supervisor for this target. | 625941e7dd821e528d63b60b |
def main(): <NEW_LINE> <INDENT> global SDRANGEL_API_PORT <NEW_LINE> global OTHER_DICT <NEW_LINE> global DELAY <NEW_LINE> global FREQ_SYNC <NEW_LINE> global LIMERFE_DEVICE <NEW_LINE> addr, port, SDRANGEL_API_PORT, DELAY, FREQ_SYNC, OTHER_DICT, LIMERFE_DEVICE = getInputOptions() <NEW_LINE> print(f'main: starting: SDRange... | This is the main routine | 625941e79f2886367277acef |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.