code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def get_poloniex_markets(): <NEW_LINE> <INDENT> ret = urllib.request.urlopen("https://poloniex.com/public?command=returnTicker") <NEW_LINE> _t = json.loads(ret.read()) <NEW_LINE> return [(each, _t.get(each).get('id')) for each in _t]
Returns list of tuples, each tuple is (currencyPair, pairID)
625941f18c0ade5d55d3ef6d
def _choose_cachefile(self, directory, backend_id, backend_epoch): <NEW_LINE> <INDENT> cache_file = None <NEW_LINE> cache_epoch = 2 <NEW_LINE> cache_file = "%s.bin" % backend_id <NEW_LINE> absfilename = os.path.join(directory, cache_file) <NEW_LINE> self._logger.info("absfilename: %s", absfilename) <NEW_LINE> if os.pat...
try to find the best cachefile available using: self._client_config, self._info modfying: self._cachefile returning: cachefile, cachefile_epoch
625941f163b5f9789fde7693
def log_stream_events(self) -> List[LogEvent]: <NEW_LINE> <INDENT> log_util = AwsLogUtil() <NEW_LINE> log_stream_name = self.log_stream_name() <NEW_LINE> events = log_util.get_log_events( group_name=CLOUDWATCH_LOG_GROUP, stream_name=log_stream_name ) <NEW_LINE> return events
Return all log events for this job. Returns: events: All log events, to date.
625941f1a05bb46b383ecdc9
def onClick(self, item, mainW): <NEW_LINE> <INDENT> roomNum = self.roomSchedule.iloc[item.row()].name[0:4] <NEW_LINE> time = self.roomSchedule.iloc[item.row()].index[item.column()] <NEW_LINE> maxLen = sum(1 for t in self.roomSchedule.iloc[item.row()][item.column():item.column() + 4] if type(t) is not str) <NEW_LINE> as...
Triggers when the user selects a timeslot from the schedule. Asks for confirmation and calculates the maximum length of a booking for the timeslot.
625941f19b70327d1c4e1385
def addTheorem(self, id, th_type): <NEW_LINE> <INDENT> th = Theorem(id,self.current_anchor, th_type) <NEW_LINE> self.theorems_manager.addTheorem(th) <NEW_LINE> self.current_anchor = th
Adding a theorem also as anchor
625941f1f8510a7c17cf9cae
@pytest.fixture( scope="function", params=[ exception.PushFailedError("some message", 128, b"error", "someurl"), exception.CloneFailedError("some message", 128, b"error", "someurl"), exception.GitError("some message", 128, b"error"), plug.PlatformError("some message"), ], ) <NEW_LINE> def command_all_raise_mock(command...
Mock of _repobee.command where all functions raise expected exceptions (i.e. those caught in _sys_exit_on_expected_error)
625941f171ff763f4b549c43
def persist(memory_buffer): <NEW_LINE> <INDENT> cdata = memory_buffer._cdata() <NEW_LINE> lib.pmem_persist(cdata, len(memory_buffer))
Make any cached changes to a range of pmem persistent. :param memory_buffer: the MemoryBuffer object.
625941f1be383301e01b5a27
def speakMisspelledIndicator(self, obj, offset): <NEW_LINE> <INDENT> if _settingsManager.getSetting('speakMisspelledIndicator'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> text = obj.queryText() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> charAndOffsets = text.getTextAtOf...
Speaks an announcement indicating that a given word is misspelled. Arguments: - obj: An accessible which implements the accessible text interface. - offset: Offset in the accessible's text for which to retrieve the attributes.
625941f1b7558d58953c54b4
@pytest_asyncio.fixture(scope="module") <NEW_LINE> def tusd(pytestconfig, xprocess): <NEW_LINE> <INDENT> host = "0.0.0.0" <NEW_LINE> port = "8080" <NEW_LINE> basepath = "/files/" <NEW_LINE> executable = pytestconfig.rootdir.join("/tusd") <NEW_LINE> class Starter(ProcessStarter): <NEW_LINE> <INDENT> pattern = "You can n...
Start the tusd (tus.io reference implementation) and yield the upload URL. Assumes that the tusd executable is located in the pytest rootdir.
625941f1cad5886f8bd27585
def snmp_enable(handle, community=None, sys_contact=None, sys_location=None, descr=None, is_set_snmp_secure=None): <NEW_LINE> <INDENT> from ucsmsdk.mometa.comm.CommSnmp import CommSnmpConsts <NEW_LINE> dn = "sys/svc-ext/snmp-svc" <NEW_LINE> mo = handle.query_dn(dn) <NEW_LINE> if not mo: <NEW_LINE> <INDENT> raise ValueE...
Enables SNMP. Args: handle (UcsHandle) community (string): community sys_contact (string): sys_contact sys_location (string): sys_location descr (string): descr policy_owner (string): policy_owner is_set_snmp_secure (string): "yes" or "no" Returns: CommSnmp: Managed object Raises: ...
625941f14c3428357757c8d1
@app.route("/buy", methods=["GET", "POST"]) <NEW_LINE> @login_required <NEW_LINE> def buy(): <NEW_LINE> <INDENT> if request.method=="POST": <NEW_LINE> <INDENT> symbol = request.form.get('symbol') <NEW_LINE> shares = int(request.form.get('shares')) <NEW_LINE> quote = lookup(symbol) <NEW_LINE> id=session['user_id'] <NEW_...
Buy shares of stock.
625941f1293b9510aa2c383d
def register_model(model: str, cls, menu_title: str = None, menu_weight: int = 0, menu_icon: str = 'fa fas fa-tags', menu_sid: str = 'taxonomy', menu_roles: Union[str, list, tuple] = ('admin', 'dev'), menu_permissions: Union[str, list, tuple] = None): <NEW_LINE> <INDENT> if model in _models: <NEW_LINE> <INDENT> raise R...
Register a taxonomy model
625941f123e79379d52eeb09
def run(self): <NEW_LINE> <INDENT> super(ExpressvennTool, self).run() <NEW_LINE> self._create_venn_table() <NEW_LINE> self.end()
运行
625941f1462c4b4f79d1dc7c
def _GetObjectGroupTerm(self, term, filter_name, verbose=True): <NEW_LINE> <INDENT> return ObjectGroupTerm(term, filter_name, verbose=verbose)
Returns an ObjectGroupTerm object.
625941f1ac7a0e7691ed466e
def singularize (self, word) : <NEW_LINE> <INDENT> rules = [ ['(?i)(quiz)zes$' , '\\1'], ['(?i)(matr)ices$' , '\\1ix'], ['(?i)(vert|ind)ices$' , '\\1ex'], ['(?i)^(ox)en' , '\\1'], ['(?i)(alias|status)es$' , '\\1'], ['(?i)([octop|vir])i$' , '\\1us'], ['(?i)(cris|ax|test)es$' , '\\1is'], ['(?i)(shoe)s$' , '\\1'], ['(?i)(...
Singularizes English nouns.
625941f163d6d428bbe44a9e
def cert_type_oid(self): <NEW_LINE> <INDENT> if self.pub_cert is None: <NEW_LINE> <INDENT> raise ValueError("Public key should be loaded for fetch cert type.") <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> for ext in self.pub_cert.extensions: <NEW_LINE> <INDENT> if ext.oid.dotted_string == '2.5.29.32': <NEW_LINE> <INDEN...
Get cert type p = PinkSign(pubkey_path="/some/path/signCert.der") print p.cert_type_oid() # "1.2.410.200005.1.1.4"
625941f1a219f33f34628f0e
def test_read(self): <NEW_LINE> <INDENT> with DicomFile(TEST_FILE, 'rb') as fp: <NEW_LINE> <INDENT> assert not fp.parent.closed <NEW_LINE> assert "ct_small.dcm" in fp.name.lower() <NEW_LINE> assert fp.read(2) == b'\x49\x49'
Test the function
625941f1aad79263cf390ff7
def _get_activated_tasks(self, my_task, destination): <NEW_LINE> <INDENT> task = destination._find_ancestor(self.thread_starter) <NEW_LINE> return self.thread_starter._get_activated_tasks(task, destination)
Returns the list of tasks that were activated in the previous call of execute(). Only returns tasks that point towards the destination task, i.e. those which have destination as a descendant. my_task -- the task of this TaskSpec destination -- the child task
625941f1796e427e537b0b78
def _check_is_editable(self,cr,uid,ids,fieldname,arg,context=None): <NEW_LINE> <INDENT> res = {} <NEW_LINE> user = self.pool.get('res.users').browse(cr, uid, uid, context=context) <NEW_LINE> ocs_role = None <NEW_LINE> regex = "^ocs_idu\.group_ocs_outsourced_(.*)$" <NEW_LINE> for grp in user.groups_id: <NEW_LINE> <INDEN...
Check if current user can edit the PQR based on status and group. Used this options instead of attributes with some logic in the view useful just in web mode no in XMLRPC. cannot use object level permissions as all roles need to add messages and for that requires update permission on crm.claim
625941f13539df3088e2e8f9
def price(x, a=200, b=10, d=10, t=np.linspace(1,10,10)): <NEW_LINE> <INDENT> p = (a - b * x) * d / (d + t) <NEW_LINE> return p
Returns the price given a demand x and time t See equation 4 above
625941f10c0af96317bb8794
def __init__(self, fph, test_ph, tph): <NEW_LINE> <INDENT> self.fph, self.test_ph, self.tph = fph, test_ph, tph
fph : file created by liblinear test_ph: testData
625941f16e29344779a62bbe
def __on_about_activate(self, action, param): <NEW_LINE> <INDENT> builder = Gtk.Builder() <NEW_LINE> builder.add_from_resource("/org/gnome/Lollypop/AboutDialog.ui") <NEW_LINE> about = builder.get_object("about_dialog") <NEW_LINE> about.set_transient_for(App().window) <NEW_LINE> about.connect("response", self.__on_about...
Setup about dialog @param action as Gio.SimpleAction @param param as GLib.Variant
625941f115baa723493c4527
def states_from_swaps(self, input, swaps): <NEW_LINE> <INDENT> A = copy.copy(input) <NEW_LINE> states = [tuple(A)] <NEW_LINE> for s in swaps: <NEW_LINE> <INDENT> self.swap(A, s) <NEW_LINE> states.append(tuple(A)) <NEW_LINE> <DEDENT> return states
Constructs a sequence of states from sequence of swaps and an input.
625941f18a43f66fc4b5460c
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <...
Returns the model properties as a dict
625941f194891a1f4081c059
def subindustry_totals(self,cycle=DEFAULT_CYCLE): <NEW_LINE> <INDENT> return self._get_url_json('aggregates/industries/subindustry_totals.json', cycle=cycle)
Return totals for all subindustries in a given cycle
625941f13617ad0b5ed684a4
def find_factors(param: int) -> List[int]: <NEW_LINE> <INDENT> result = [1] <NEW_LINE> if param > 1: <NEW_LINE> <INDENT> for i in range(2, param+1): <NEW_LINE> <INDENT> if param % i == 0: <NEW_LINE> <INDENT> result += [i] <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return result
Args: param (int): non-negative integer Returns: List[int]: a list of factors of param Note: param is assumed to be positive, if param is zero or negative, function returns [1] 'factors_flask.py' module performs argument checking and calls find_factors only with positive integer arguments
625941f1236d856c2ad44d90
def task_list(self, access_token, type, filter, last_id, num): <NEW_LINE> <INDENT> self.send_task_list(access_token, type, filter, last_id, num) <NEW_LINE> return self.recv_task_list()
Parameters: - access_token - type - filter - last_id - num
625941f160cbc95b062c6af1
def is_followed_by(self, user): <NEW_LINE> <INDENT> return self.followers.filter_by(follower_id=user.id).first() is not None
验证是否被user关注 :param user: 待验证用户 :return: True or False
625941f150812a4eaa59c8c9
@pytest.mark.parametrize( "ip_add,ip_type", [ ("10.1.1", "неправильный"), ("10.a.2.a", "неправильный"), ("10.1.1.1.1", "неправильный"), ("10.1.1.", "неправильный"), ("300.1.1.1", "неправильный"), ("30,1.1.1.1", "неправильный"), ], ) <NEW_LINE> def test_task_wrong_ip(capsys, monkeypatch, ip_add, ip_type): <NEW_LINE> <IN...
Проверка работы задания при вводе multicast адреса
625941f1a4f1c619b28b05d8
def get_page_info(url, page_num): <NEW_LINE> <INDENT> base_url = 'http://www.indeed.co.in' <NEW_LINE> page_job_descriptions = [] <NEW_LINE> start_num = str(page_num * 10) <NEW_LINE> page_url = ''.join([url, '&start=', start_num]) <NEW_LINE> print('Getting page: ' + page_url) <NEW_LINE> html_page = requests.get(page_url...
This function takes a URL and a page number as arguments, combines them into a new URL for search, and returns a two-dimensional list, where each value of the list is a one-dimensional list that contains a set of words appearing in one job Ad of this page. url: string, a base URL before the page number page_num: int, ...
625941f1b830903b967e9eb2
def _conv_sentence_features(self): <NEW_LINE> <INDENT> with tf.variable_scope("pick_sentence"): <NEW_LINE> <INDENT> self.rand_unif_init = tf.random_uniform_initializer(-self._hps.rand_unif_init_mag, self._hps.rand_unif_init_mag,seed=123) <NEW_LINE> self.trunc_norm_init = tf.truncated_normal_initializer(stddev=self._hps...
build network to pick useful sentence from all sentence of article :return:
625941f1d4950a0f3b08c8f4
def retrieveCollection(self,collName,lastTimeStamp,count=5): <NEW_LINE> <INDENT> feeds=[] <NEW_LINE> logger.debug('arg is collName = %s & limit = %s',collName,count) <NEW_LINE> coll = self.db[collName] <NEW_LINE> cursor = coll.find({'created_time': { '$lt': lastTimeStamp } },{'_id':0,'contributors':0,'truncated':0,'in_...
by passing the collection name fetch recent feeeds. Query the database
625941f1d58c6744b425820b
def get_runbook_data(self, runbook_version_id): <NEW_LINE> <INDENT> url = self.base_uri + "/automationAccounts/" + self.account_id + "/runbooks/" + runbook_version_id + "?api-version=" + self.protocol_version <NEW_LINE> response = self.issue_request(self.httpClient.get(url)) <NEW_LINE> if response.status_c...
Gets the runbook definition of the given runbook_version_id. Args: runbook_version_id: string, the runbook version id. Returns: A dictionary containing the runbook's details. Note: The output list is of the following format: { "n...
625941f16fece00bbac2dcf3
def callHandlers(self, record): <NEW_LINE> <INDENT> c = self <NEW_LINE> found = 0 <NEW_LINE> while c: <NEW_LINE> <INDENT> for hdlr in c.handlers: <NEW_LINE> <INDENT> found = found + 1 <NEW_LINE> if record.levelno >= hdlr.level: <NEW_LINE> <INDENT> hdlr.handle(record) <NEW_LINE> <DEDENT> <DEDENT> if not c.propagate: <NE...
Pass a record to all relevant handlers. Loop through all handlers for this logger and its parents in the logger hierarchy. If no handler was found, output a one-off error message to sys.stderr. Stop searching up the hierarchy whenever a logger with the "propagate" attribute set to zero is found - that will be the last...
625941f1379a373c97cfb0f4
def account_request_email(name): <NEW_LINE> <INDENT> subject = "New account request from {}".format(name) <NEW_LINE> body = "{} has requested a dashboard account. Please log in to review " "this request".format(name) <NEW_LINE> try: <NEW_LINE> <INDENT> dest_url = url_for('users.manage_users', _external=True) ...
Notify admins that a new user is requesting dashboard access. Args: name (:obj:`str`): The real name of the user requesting an account
625941f121a7993f00bc82a8
def states_to_check(self, required_relations=None): <NEW_LINE> <INDENT> if required_relations is None: <NEW_LINE> <INDENT> required_relations = self.required_relations <NEW_LINE> <DEDENT> return super(NovaCellControllerCharm, self).states_to_check( required_relations=required_relations)
Override the default states_to_check() for the assess_status functionality so that, if we have to have an HSM relation, then enforce it on the assess_status() call. If param required_relations is not None then it overrides the instance/class variable self.required_relations. :param required_relations: [list of state ...
625941f144b2445a3393263f
def should_be_in_operation(self): <NEW_LINE> <INDENT> return True
Should always be on
625941f126068e7796caf295
def bytes_to_symbols(l): <NEW_LINE> <INDENT> if len(l)==0: <NEW_LINE> <INDENT> return t <NEW_LINE> <DEDENT> p='' <NEW_LINE> for i in range(len(l)): <NEW_LINE> <INDENT> assert type(l[i])== int and l[i]<(2**8) <NEW_LINE> b = bin(l[i]) <NEW_LINE> s = b[2:] <NEW_LINE> s= (8-len(s))*'0'+s <NEW_LINE> p=p+s <NEW_LINE> <DEDENT...
Takes (at most) three bytes of data in input and returns the corresponding bas64 symbols. :param l: list of at most three bytes :return: Four base64 symbols (or ‘=’) corresponding to the data given in input :type return: str :UC: len(data) <= 3 :examples: >>> bytes_to_symbols([5]) 'BQ==' >>> bytes_to_symbols([4, 163]) ...
625941f1442bda511e8be9bd
def set_player_character(character): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if not isinstance(character, characters.Character): <NEW_LINE> <INDENT> raise Exception("error! invalid 'unit' parameter") <NEW_LINE> <DEDENT> elif not character in globals_.units_in_game: <NEW_LINE> <INDENT> raise Exception("error! given...
Sets a character to be controllable by the player. Parameters: 'character' - one of the game's characters
625941f16aa9bd52df037355
def test_internal_error_after_shutdown(self): <NEW_LINE> <INDENT> self.server.shutdown() <NEW_LINE> self.assertTrue(self.shutdown) <NEW_LINE> self.assertTrue(self.response.finished) <NEW_LINE> called = [] <NEW_LINE> self.patch(self.server, 'shutdown', lambda: called.append(1)) <NEW_LINE> failure = Failure(ValueError(se...
Test for getting internal errors after shutdown.
625941f18a349b6b435e8720
def __init__(self, name, target, monitor_port=None, community='private', version=2, oid='.1', output_path='./output', fuzz_count=100, timeout=1, nic=None, logger=None): <NEW_LINE> <INDENT> super(SnmpTarget, self).__init__(name, logger) <NEW_LINE> self._target = target <NEW_LINE> self._monitor_port = monitor_port <NEW_L...
:param name: Name of target :param target: IP address of target :param monitor_port: Tcp port used to check target alive :param community: Snmp community with write privilege, default:'private' :param version: Snmp version only support version 1 and 2 :param oid: Snmp scan start oid, default: '.1' :param output_path: P...
625941f10383005118ecfb8e
def main(variables={}): <NEW_LINE> <INDENT> v = variables <NEW_LINE> v["shared_dir"] = get_path(v["M_SHARED"]) <NEW_LINE> v["module_dir"] = get_path( str(v["shared_dir"] / v["M_MODULE_SHORT"])) <NEW_LINE> v["config_file"] = get_path( str(v["module_dir"] / v["M_CONFIG_NAME"])) <NEW_LINE> v["state_file"] = get_path( str(...
Handle plan method.
625941f101c39578d7e753e9
def run_once(to_remove): <NEW_LINE> <INDENT> purge_dataset(to_remove)
run only once the first time
625941f1046cf37aa974d2ef
def __init__(self, *args): <NEW_LINE> <INDENT> this = _vamsi_scram_swig.new_scram_cc_sptr(*args) <NEW_LINE> try: self.this.append(this) <NEW_LINE> except: self.this = this
__init__(boost::shared_ptr<(gr::vamsi_scram::scram_cc)> self) -> scram_cc_sptr __init__(boost::shared_ptr<(gr::vamsi_scram::scram_cc)> self, scram_cc p) -> scram_cc_sptr
625941f171ff763f4b549c44
def getcomponentdetails(self, product, component, force_refresh=False): <NEW_LINE> <INDENT> d = self.getcomponentsdetails(product, force_refresh) <NEW_LINE> return d[component]
Get details for a single component. Returns a dict with the following keys: description, initialowner, initialqacontact, initialcclist
625941f11b99ca400220b062
@card.command("list") <NEW_LINE> def list(): <NEW_LINE> <INDENT> click.echo("Create cards from the current membership list")
Generate cards from membership list.
625941f1d99f1b3c44c67b32
def test_index_view(client): <NEW_LINE> <INDENT> response = client.get(reverse('main-index')) <NEW_LINE> assert response.status_code == 200 <NEW_LINE> assert b"Hi, I'm {{ cookiecutter.project_name }}" in response.content
Verify the index view is as expected
625941f13317a56b8693a1f7
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.header is None: <NEW_LINE> <INDENT> self.header = std_msgs.msg.Header() <NEW_LINE> <DEDENT> if self.status is None: <NEW_LINE> <INDENT> self.status = actionlib_msgs.msg.GoalStatus() <NEW_LINE> <DEDENT> if self.feedback is None: <NEW_LINE> ...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941f182261d6c526aba56
def test_add_user_duplicate_email(self): <NEW_LINE> <INDENT> headers = self.get_token_header() <NEW_LINE> with self.client: <NEW_LINE> <INDENT> response = self.client.post( '/users', data=json.dumps({ 'username': 'ben', 'email': 'ben@ben.org', 'password': '123456' }), content_type='application/json', headers=headers ) ...
Ensure error is thrown if the email already exists.
625941f14e4d5625662d497d
def demo_Weave(): <NEW_LINE> <INDENT> a = np.arange(0, 10000000, 1.0) <NEW_LINE> cpp_sum(a) <NEW_LINE> start = time.clock() <NEW_LINE> for i in range(100): <NEW_LINE> <INDENT> cpp_sum(a) <NEW_LINE> <DEDENT> print('Cpp_sum time:', (time.clock() - start)) <NEW_LINE> start = time.clock() <NEW_LINE> for i in range(100): <N...
Weave could embed some C++ program on python, this block of code coule run faster. This part of code can't not run on python, because weave can't import. This problem will be solved later.
625941f1099cdd3c635f1206
def convertstore(self, inputstore, templatefile=None, **kwargs): <NEW_LINE> <INDENT> if templatefile is None: <NEW_LINE> <INDENT> outputstore = poxliff.PoXliffFile(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> outputstore = poxliff.PoXliffFile(templatefile, **kwargs) <NEW_LINE> <DEDENT> filename = inputstore....
converts a .po file to .xlf format
625941f107d97122c4178e47
def testDisconnectCleanup(self): <NEW_LINE> <INDENT> d = self.iq.send() <NEW_LINE> xs = self.xmlstream <NEW_LINE> xs.connectionLost("Closed by peer") <NEW_LINE> self.assertFailure(d, ConnectionLost) <NEW_LINE> return d
Test if deferreds for iq's that haven't yet received a response have their errback called on stream disconnect.
625941f1ab23a570cc250735
def _input_date_str(self, cr, uid, ids, field_name, arg, context): <NEW_LINE> <INDENT> res = {} <NEW_LINE> for id in ids: <NEW_LINE> <INDENT> res.setdefault(id, '') <NEW_LINE> <DEDENT> for rec in self.browse(cr, uid, ids, context=context): <NEW_LINE> <INDENT> if rec.input_date: <NEW_LINE> <INDENT> res[rec.id] = rec.inp...
字符串入库日期
625941f13317a56b8693a1f8
def get_cell_coverage(facility_id): <NEW_LINE> <INDENT> CELL_COVERAGE_URL = 'https://www.recreation.gov/api/ratingreview/aggregate?location_type=Campground&location_id={facility_id}' <NEW_LINE> logger.debug("Querying cell coverage for facility {}".format(facility_id)) <NEW_LINE> time.sleep(config.SECONDS_BETWEEN_REQUES...
Get the aggregated ratings of cell coverage by reviewers
625941f13346ee7daa2b331f
def _ActionOff(self): <NEW_LINE> <INDENT> self.currentTask['keywordsList'] = [] <NEW_LINE> self.currentTask['keywordsListAdd'] = [] <NEW_LINE> self.currentTask['netLinksList'] = [] <NEW_LINE> self.currentTask['doorLinksList'] = [] <NEW_LINE> self.currentTask['doorLinksList'] = self.doorgen.pageLinksList[:] <NEW_LINE> s...
Значения по умолчанию
625941f13eb6a72ae02eca9c
def test_for_tagged_in(self): <NEW_LINE> <INDENT> tag = O2OTag.objects.tag(self.tagger, self.tagged, self.tagged_in) <NEW_LINE> tag1 = O2OTag.objects.tag(self.tagger1, self.tagged, self.tagged_in) <NEW_LINE> tags = O2OTag.objects.for_tagged_in(self.tagged_in) <NEW_LINE> self.assertListEqual([tag, tag1], list(tags))
Test for_tagged_in method. Get all tags where `MyModel` has been used as `tagged_in`.
625941f1d10714528d600298
def partScoreFromSystemScore(self, systemScore): <NEW_LINE> <INDENT> systemStream = systemScore.getElementsByClass('System') <NEW_LINE> partDictById = {} <NEW_LINE> for thisSystem in systemStream: <NEW_LINE> <INDENT> systemOffset = systemScore.elementOffset(thisSystem) <NEW_LINE> partStream = thisSystem.getElementsByCl...
Take a :class:`~music21.stream.Score` object which is organized by Systems and return a new `Score` object which is organized by Parts.
625941f16fece00bbac2dcf4
def get_file(self): <NEW_LINE> <INDENT> f = self._file <NEW_LINE> if f: <NEW_LINE> <INDENT> return self._file.data <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None
Return the file content it has been loaded Returns ------- str or None the file content, if it exists None else
625941f131939e2706e4d410
def threshold(self, lv, hv, sl, sh): <NEW_LINE> <INDENT> print('WARNING - This method is not yet implemented!') <NEW_LINE> return None
Unimplemented
625941f14527f215b584ca00
def _init(self): <NEW_LINE> <INDENT> if self._initted or not self.hg_root: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if 'extensions.hgsubversion' in self.hgrc: <NEW_LINE> <INDENT> svn_info = execute([self._exe, 'svn', 'info'], ignore_errors=True) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> svn_info = None <NEW_L...
Initialize the client.
625941f1d268445f265b541d
def get_question(self, index): <NEW_LINE> <INDENT> quiz = self.get_quiz() <NEW_LINE> try: <NEW_LINE> <INDENT> return { "cuetime": quiz[index][0], "question": quiz[index][1].question, "kind": quiz[index][1].kind, "options": quiz[index][1].options, "answer": quiz[index][1].answer, "explanation": quiz[index][1].explanatio...
Return data relevant for each refresh of the quiz form.
625941f1cdde0d52a9e535e6
def Reduced_Mass(m1, m2): <NEW_LINE> <INDENT> return m1*m2/(m1+m2)
Calculates the reduced mass for a two particle system.
625941f18e7ae83300e4b57d
@app.route('/mdd', methods=['GET']) <NEW_LINE> def get_destination(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> result = destination_parser() <NEW_LINE> head = result[0] <NEW_LINE> hot_poi_result = result[1]['hot_list_result'] <NEW_LINE> season_recommend = result[2]['season_recommend'] <NEW_LINE> add_destination(str...
目的地页面的抓取 :return:
625941f150485f2cf553d34a
def __new__(cls, bed_data: list, pool_loc: int, max_pool: int = None): <NEW_LINE> <INDENT> pools = bed_data[pool_loc] <NEW_LINE> if not max_pool: <NEW_LINE> <INDENT> return object.__new__(cls) <NEW_LINE> <DEDENT> if max_pool: <NEW_LINE> <INDENT> if len(pools) > max_pool: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDE...
Verify the need to create an Amplicon object :param list bed_data: is the line in the .bed file corresponding to the amplicon :param int pool_loc: location of pool data in bed_data :param int max_pool: maximum number of origin pools allowed for a valid target :return: None or cls
625941f1d18da76e23532a8c
def __get_conn(): <NEW_LINE> <INDENT> return libvirt.open("qemu:///system")
Connects to the libvirt daemon for qemu/kvm
625941f19b70327d1c4e1386
@cache <NEW_LINE> def cmap(data, use_sns=True, robust=True): <NEW_LINE> <INDENT> data = np.atleast_1d(data) <NEW_LINE> if data.dtype == 'bool': <NEW_LINE> <INDENT> return plt.get_cmap('gray_r') <NEW_LINE> <DEDENT> data = data[np.isfinite(data)] <NEW_LINE> if robust: <NEW_LINE> <INDENT> min_p, max_p = 2, 98 <NEW_LINE> <...
Get a default colormap from the given data. If the data is boolean, use a black and white colormap. If the data has both positive and negative values, use a diverging colormap ('coolwarm'). Otherwise, use a sequential map: either cubehelix or 'OrRd'. Parameters ---------- data : np.ndarray Input data use_sns :...
625941f123e79379d52eeb0a
@pytest.fixture(scope="session") <NEW_LINE> def splunk_docker_compose(request, docker_services, tmp_path_factory): <NEW_LINE> <INDENT> LOGGER.info("Starting docker_service=splunk") <NEW_LINE> fn = os.path.join( tmp_path_factory.getbasetemp().parent, "pytest_splunk_env_docker_compose.lock" ) <NEW_LINE> with FileLock(str...
Splunk docker depends on lovely-pytest-docker to create the docker instance of Splunk this may be changed in the future. docker-compose.yml in the project root must have a service "splunk" exposing port 8000 and 8089 Returns: dict: Details of the splunk instance including host, port, username & password.
625941f107f4c71912b11a33
def set_references(self, position = [], orientation = []): <NEW_LINE> <INDENT> import numpy <NEW_LINE> hoomd.util.print_status_line(); <NEW_LINE> enlist = hoomd.hpmc.data._param.ensure_list; <NEW_LINE> self.cpp_compute.setReferences(enlist(position), enlist(orientation));
Reset the reference positions or reference orientations. Args: position (list): list of positions to restrain each particle. orientation (list): list of orientations to restrain each particle. Example:: mc = hpmc.integrate.sphere(seed=415236); lattice = hpmc.field.lattice_field(mc=mc, position=fcc_la...
625941f1a8370b7717052e4c
def test_api_create_punch_fail(app, client): <NEW_LINE> <INDENT> api_dummy_punch(app, client) <NEW_LINE> r = post( client, path="/api/new/punch", json=dict( user_id=666, punch_type="out", ), ) <NEW_LINE> assert 400 == r.status_code <NEW_LINE> assert "User (id=666) does not exist!" == r.json["message"] <NEW_LINE> r = po...
Punch creation API fail tests.
625941f1287bf620b61d400e
def create_situation(): <NEW_LINE> <INDENT> bb = dtos.SituationPlayerDetails( name="BB", stack=180, contributed=0, left_to_act=True, range_raw='JJ+,TsTh,ThTd,TdTc,9s9d,9h9c,8s8c,7s7h,6h6d,AQs+,AsJs,AhJh,AdTd,AcTc,Kh9h,Kc9c,Kh8h,Kd8d,Ks7s,Kd7d,Kd6d,Kc6c,Ks5s,Kc5c,Qs7s,Qh7h,Qs6s,Qd6d,Qh5h,Qc5c,Js7s,Jd7d,Th7h,Td7d,9h6h,9c...
3bet flop, BTN opens 3bb, BB raises to 10bb, BTN calls. Aggressor out of position.
625941f173bcbd0ca4b2c624
def TIMIT_test_feed_epoch(*args): <NEW_LINE> <INDENT> data_path_8k = find_dataset(__test8k(__TIMIT_file)) <NEW_LINE> data_path_up = find_dataset(__test_up(__TIMIT_file)) <NEW_LINE> data_mask_path=find_dataset(__test_mask(__TIMIT_file)) <NEW_LINE> data_con_path=find_dataset(__test_con(__TIMIT_file)) <NEW_LINE> files=[] ...
See: TIMIT_train_feed_epoch
625941f116aa5153ce362a27
def uniquePathsWithObstacles(self, grid): <NEW_LINE> <INDENT> if not grid: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if grid[0][0] == 1: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> dp = [[0] * len(grid[0]) for _ in xrange(0 ,len(grid))] <NEW_LINE> dp[0][0] = 1 if grid[0][0] == 0 else 0 <NEW_LINE> for i in x...
:type obstacleGrid: List[List[int]] :rtype: int
625941f1283ffb24f3c55ea9
def New(*args, **kargs): <NEW_LINE> <INDENT> obj = itkConfidenceConnectedImageFilterID3IUL3.__New_orig__() <NEW_LINE> import itkTemplate <NEW_LINE> itkTemplate.New(obj, *args, **kargs) <NEW_LINE> return obj
New() -> itkConfidenceConnectedImageFilterID3IUL3 Create a new object of the class itkConfidenceConnectedImageFilterID3IUL3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the firs...
625941f1d53ae8145f87a813
def create(self, name=''): <NEW_LINE> <INDENT> self._documents[name] = SyiDocument(self._connection_manager) <NEW_LINE> return self._documents[name]
Create a document.
625941f160cbc95b062c6af2
def get_ranking(league): <NEW_LINE> <INDENT> ranking = {} <NEW_LINE> url = "http://api.football-data.org/v1/soccerseasons/" + str(league) + "/leagueTable" <NEW_LINE> api_key = "" <NEW_LINE> headers = {'X-Auth-Token': api_key} <NEW_LINE> try: <NEW_LINE> <INDENT> r = requests.get(url, headers=headers) <NEW_LINE> <DEDENT>...
Utilisation de l'api http://api.football-data.org/ pour récupérer le classement d'un championnat
625941f1be8e80087fb211e6
def setUp(self): <NEW_LINE> <INDENT> challenge_mgr.init() <NEW_LINE> self.user = test_utils.setup_user(username="user", password="changeme") <NEW_LINE> test_utils.set_competition_round() <NEW_LINE> challenge_mgr.register_page_widget("home", "quests") <NEW_LINE> challenge_mgr.register_page_widget("profile", "my_achievem...
setup
625941f1be8e80087fb211e7
def connexion_changeDir_upload(self,diskfile,path): <NEW_LINE> <INDENT> connex = ftp.FTP(self.address) <NEW_LINE> if len(self.user)==0 and len(self.password)==0 : <NEW_LINE> <INDENT> connex.login() <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> connex.login(self.user,self.password) <NEW_LINE> <DEDENT> n = len(self.list...
connexion au ftp changement de répertoire poste le fichier diskfile sur le ftp diskfile (chaine de caractères) est le nom du fichier à uploader path (chaine de caractères) : répertoire du fichier
625941f107f4c71912b11a34
def test_create_cost_entry_pricing(self): <NEW_LINE> <INDENT> table_name = AWS_CUR_TABLE_MAP['pricing'] <NEW_LINE> table = getattr(self.report_schema, table_name) <NEW_LINE> pricing_id = self.processor._create_cost_entry_pricing(self.row, self.accessor) <NEW_LINE> self.accessor.commit() <NEW_LINE> self.assertIsNotNone(...
Test that a cost entry pricing id is returned.
625941f1d4950a0f3b08c8f5
def load_flatland_environment_from_file(file_name: str, load_from_package: str = None, obs_builder_object: ObservationBuilder = None) -> RailEnv: <NEW_LINE> <INDENT> if obs_builder_object is None: <NEW_LINE> <INDENT> obs_builder_object = TreeObsForRailEnv( max_depth=2, predictor=ShortestPathPredictorForRailEnv(max_dept...
Parameters ---------- file_name : str The pickle file. load_from_package : str The python module to import from. Example: 'env_data.tests' This requires that there are `__init__.py` files in the folder structure we load the file from. obs_builder_object: ObservationBuilder The obs builder for the `RailE...
625941f116aa5153ce362a28
def delete(self, **kwargs): <NEW_LINE> <INDENT> logging.debug("DELETE {url}".format(url=kwargs["url"])) <NEW_LINE> r = requests.delete(**kwargs) <NEW_LINE> r.raise_for_status() <NEW_LINE> return r
Sends a DELETE request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response
625941f1d58c6744b425820c
def print_puzzle(self): <NEW_LINE> <INDENT> for i, row in enumerate(self.puzzle): <NEW_LINE> <INDENT> txt = '' <NEW_LINE> for j, el in enumerate(row): <NEW_LINE> <INDENT> if el == 0: <NEW_LINE> <INDENT> if i % 2 == 0 and j % 2 == 0: <NEW_LINE> <INDENT> txt += ' ' <NEW_LINE> <DEDENT> elif i % 2 == 0 and j % 2 > 0: <NEW...
For tests: prints current puzzle. :return: None
625941f199fddb7c1c9de93c
def getPlotItem(self): <NEW_LINE> <INDENT> if self._item is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> item = self._item() <NEW_LINE> if item is None: <NEW_LINE> <INDENT> self._item = None <NEW_LINE> <DEDENT> return item
Returns the item focused by the profile manager. :rtype: ~silx.gui.plot.items.Item
625941f1097d151d1a223405
def gaussianGradient(img, scale, sqrt = True): <NEW_LINE> <INDENT> if img.channels > 1: <NEW_LINE> <INDENT> return colorGradient(img, scale, sqrt) <NEW_LINE> <DEDENT> grad = vigra.filters.gaussianGradient(img, scale) <NEW_LINE> if sqrt: <NEW_LINE> <INDENT> gm = vigra.filters.gaussianGradientMagnitude(img, scale) <NEW_L...
Return (gm, grad) tuple, which is either the result of `colorGradient`, or of the usual `vigra.gaussianGradient` family for single-band images.
625941f101c39578d7e753ea
def mail_admins(subject, message, fail_silently=False, connection=None): <NEW_LINE> <INDENT> if not settings.ADMINS: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> EmailMessage('%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS], connection=connection).send...
Sends a message to the admins, as defined by the ADMINS setting.
625941f171ff763f4b549c45
def delegate_to_callable(fn, err_msg=None): <NEW_LINE> <INDENT> def outer_wrapper(f): <NEW_LINE> <INDENT> def inner_wrapper(*args, **kwargs): <NEW_LINE> <INDENT> obj = fn() <NEW_LINE> if obj is None: <NEW_LINE> <INDENT> raise Exception('Delegate object not available. Err: {}'.format(err_msg)) <NEW_LINE> <DEDENT> if not...
Delegate a call of the same name to the object returned by the fn() invocation. Useful for lazy initializers and functions that return a common singleton. Can be used to hoist a singleton objects functions to module level Example usage: singleton = None class A(object): def test(): return 'abc' def get_single...
625941f14a966d76dd5515c4
def encrypt_data( localised_key: bytes, engine_id: bytes, engine_boots: int, engine_time: int, data: bytes, ) -> EncryptionResult: <NEW_LINE> <INDENT> des_key = localised_key[:8] <NEW_LINE> pre_iv = localised_key[8:] <NEW_LINE> local_salt = next(SALTPOT) <NEW_LINE> salt = (engine_boots & 0xff).to_bytes(4, "big") + (loc...
See https://tools.ietf.org/html/rfc3414#section-1.6
625941f10383005118ecfb8f
def test_update_move_to_top(): <NEW_LINE> <INDENT> mocked_api = MagicMock() <NEW_LINE> mocked_api.post.return_value = {'id': 1, 'text': 'hey'} <NEW_LINE> response = Update(api=mocked_api, raw_response={'id': 1}).move_to_top() <NEW_LINE> mocked_api.post.assert_called_once_with(url='updates/1/move_to_top.json') <NEW_LINE...
Test move_to_top implementation
625941f1baa26c4b54cb16c8
def check_resource_update(rsrc, template_id, resource_data, engine_id, timeout): <NEW_LINE> <INDENT> if rsrc.action == resource.Resource.INIT: <NEW_LINE> <INDENT> rsrc.create_convergence(template_id, resource_data, engine_id, timeout) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rsrc.update_convergence(template_id, re...
Create or update the Resource if appropriate.
625941f138b623060ff0b39c
def fit_event(self, x, y): <NEW_LINE> <INDENT> [xs, sxs, sigmas] = find_known_lines(self.linelist, self.ll, self.spec, self.options) <NEW_LINE> self.foundlines = xs <NEW_LINE> self.foundlinesig = sxs <NEW_LINE> mask = (np.isfinite(sxs)) <NEW_LINE> local_linelist=self.linelist[mask] <NEW_LINE> xs = xs[mask] <NEW_LINE> s...
Fit Chebyshev polynomial to predicted line locations
625941f1f548e778e58cdb2f
def isothermal_bulk_modulus(self, pressure, temperature, volume, params): <NEW_LINE> <INDENT> T_0 = params['T_0'] <NEW_LINE> K_T = bm.bulk_modulus(volume, params) + self._thermal_bulk_modulus(temperature, volume, params) - self._thermal_bulk_modulus(T_0, volume, params) <NEW_LINE> return K_T
Returns isothermal bulk modulus [Pa] as a function of pressure [Pa], temperature [K], and volume [m^3]. EQ B8
625941f126238365f5f0f425
def calc_lead_time(supply_point, year=None, month=None): <NEW_LINE> <INDENT> deliveries = SupplyPointStatus.objects.filter( supply_point=supply_point, status_type__in=[SupplyPointStatusTypes.DELIVERY_FACILITY, SupplyPointStatusTypes.DELIVERY_DISTRICT], status_value=SupplyPointStatusValues.RECEIVED ).order_by("-status_d...
The days elapsed from the day they respond "submitted" to the day they respond "delivered". Only include the last period for now
625941f13539df3088e2e8fa
def _solve_cg(lap_sparse, B, tol): <NEW_LINE> <INDENT> lap_sparse = lap_sparse.tocsc() <NEW_LINE> X = [] <NEW_LINE> for i in range(len(B)): <NEW_LINE> <INDENT> x0 = cg(lap_sparse, -B[i].todense(), tol=tol)[0] <NEW_LINE> X.append(x0) <NEW_LINE> <DEDENT> X = np.array(X) <NEW_LINE> X = np.argmax(X, axis=0) <NEW_LINE> retu...
Solves lap_sparse X_i = B_i for each phase i, using the conjugate gradient method. For each pixel, the label i corresponding to the maximal X_i is returned.
625941f185dfad0860c3b40c
def update_room_name(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> response = self.client.api.get_room_name(self.room_id) <NEW_LINE> if "name" in response and response["name"] != self.name: <NEW_LINE> <INDENT> self.name = response["name"] <NEW_LINE> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return...
Updates self.name and returns True if room name has changed.
625941f130c21e258bdfaa53
def add_contents_of_row(matrix): <NEW_LINE> <INDENT> result = np.sum(matrix, axis=1) <NEW_LINE> return result
adds the contents of each row, returning a new matrix
625941f12ae34c7f2600d6df
def test_isfile(): <NEW_LINE> <INDENT> schema = vol.Schema(cv.isfile) <NEW_LINE> with tempfile.NamedTemporaryFile() as fp: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> for value in ('invalid', None, -1, 0, 80000, fp.name): <NEW_LINE> <INDENT> with pytest.raises(vol.Invalid): <NEW_LINE> <INDENT> schema(value) <NEW_LINE>...
Validate that the value is an existing file.
625941f1cad5886f8bd27587
def add_key_to_lexicon( lexicon: dict[str, str], curr_string: str, index: int, last_match_id: str ) -> None: <NEW_LINE> <INDENT> lexicon.pop(curr_string) <NEW_LINE> lexicon[curr_string + "0"] = last_match_id <NEW_LINE> if math.log2(index).is_integer(): <NEW_LINE> <INDENT> for curr_key in lexicon: <NEW_LINE> <INDENT> le...
Adds new strings (curr_string + "0", curr_string + "1") to the lexicon
625941f14c3428357757c8d3
def get_private_key(self, container_ref): <NEW_LINE> <INDENT> container = self.barbican.containers.get(container_ref) <NEW_LINE> return container.private_key.payload
Retrieves key from certificate manager. :param string container_ref: Reference to key stored in a certificate manager. :returns string: Key data. This method MUST be implemented, in agent-compliant cert managers.
625941f1090684286d50f29e
@app.route('/deleteSubscriptions', methods=['POST']) <NEW_LINE> def method_4(): <NEW_LINE> <INDENT> data = request.get_json() <NEW_LINE> user_id = data['user_id'] <NEW_LINE> sub_id = data['subscription_id'] <NEW_LINE> with psycopg2.connect(dbname='', user='', password='', host='127.0.0.1') as conn: <NEW_LINE> <INDENT> ...
API --- tags: - Return table of currency stats parameters: - name: to delete in: body type: json description: dict {user_id:, subscription_id:[list]} responses: 499: description: Bad key in dict 400: description: Bad request 200: description: OK 500: description: INTERNAL SERVER ...
625941f145492302aab5e878
def test_field_type_searcheditable(self): <NEW_LINE> <INDENT> self.default_expected_hsl['type'] = 'searcheditable' <NEW_LINE> self.field.type = FormFieldType.SEARCH_EDITABLE <NEW_LINE> self.assertDictEqual(self.field.to_hsl(),self.default_expected_hsl)
verify that Field type searcheditable is updated in the hsl
625941f10a366e3fb873edcf
def send_keys(self, include: List[str] = [], exclude: List[str] = []) -> None: <NEW_LINE> <INDENT> def worker(m: nixops.backends.GenericMachineState) -> None: <NEW_LINE> <INDENT> if not should_do(m, include, exclude): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> m.send_keys() <NEW_LINE> <DEDENT> nixops.parallel.run_t...
Send encryption keys to machines.
625941f1091ae35668667503