code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def list_shares(self, detailed=False, params=None): <NEW_LINE> <INDENT> uri = 'shares/detail' if detailed else 'shares' <NEW_LINE> uri += '?%s' % urllib.urlencode(params) if params else '' <NEW_LINE> resp, body = self.get(uri) <NEW_LINE> return resp, self._parse_resp(body)
Get list of shares w/o filters.
625941d9435de62698dfdedf
def assert_server_group_gone(self, srv_grp_id): <NEW_LINE> <INDENT> server_group = None <NEW_LINE> server_groups = self.nova_client.server_groups.list() <NEW_LINE> for sg in server_groups: <NEW_LINE> <INDENT> if sg.id == srv_grp_id: <NEW_LINE> <INDENT> server_group = sg <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> if ...
Ensure that the server group is no longer present.
625941d926068e7796caef73
def createIndex(self): <NEW_LINE> <INDENT> return COCO.createIndex(self)
Didn't change the original method, just call super
625941d9a934411ee3751926
def __app_draw_grid__(self, x=10, y=10): <NEW_LINE> <INDENT> width, height = (self.app_cols * self.app_col_size, self.app_rows * self.app_row_size) <NEW_LINE> for i in range(x, width, x): <NEW_LINE> <INDENT> self.canvas.create_line(i, 0, i, height, fill="#222222") <NEW_LINE> <DEDENT> for i in range(x, height, y): <NEW_...
draw a grid of the automata universe
625941d93539df3088e2e5dd
def query(self, query, max_results=None, timeout=0, dry_run=False): <NEW_LINE> <INDENT> logging.debug('Executing query: %s' % query) <NEW_LINE> query_data = { 'query': query, 'timeoutMs': timeout * 1000, 'dryRun': dry_run, 'maxResults': max_results, } <NEW_LINE> return self._submit_query_job(query_data)
Submit a query to BigQuery. Args: query: BigQuery query string. max_results: maximum number of rows to return per page of results. timeout: how long to wait for the query to complete, in seconds, before the request times out and returns. dry_run: if True, the query isn't actually run. A va...
625941d901c39578d7e750cd
def flushCache(self): <NEW_LINE> <INDENT> if len(self.disconnectedCache) == 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.log.info("Flushing cache...") <NEW_LINE> pipeline = self.redis.pipeline() <NEW_LINE> for key, data in self.disconnectedCache.iteritems(): <NEW_LINE> <INDENT> self.log.debug(" * Flushing {}"...
Flush the disconnectedCache if there's anything in it, unless it fails then keep as is.
625941d90383005118ecf874
def soa(self, zone, forceincr=False): <NEW_LINE> <INDENT> z = self._zl.zones[zone.upper()] <NEW_LINE> z.fetch() <NEW_LINE> (r, serial) = z.soa(forceincr, dyn=self.dyn) <NEW_LINE> self.dyn.execute() <NEW_LINE> return r, serial
Update SOA serial for zone if necessary or forceincr is True.
625941d9dd821e528d63b43a
def resource_providers(lib, argv, modifiers): <NEW_LINE> <INDENT> modifiers.ensure_only_supported() <NEW_LINE> if argv: <NEW_LINE> <INDENT> raise CmdLineInputError() <NEW_LINE> <DEDENT> providers = lib.resource_agent.list_ocf_providers() <NEW_LINE> if providers: <NEW_LINE> <INDENT> print("\n".join(providers)) <NEW_LINE...
Options: no options
625941d963d6d428bbe44781
def submit_bulk_course_email(request, course_key, email_id): <NEW_LINE> <INDENT> email_obj = CourseEmail.objects.get(id=email_id) <NEW_LINE> to_option = email_obj.to_option <NEW_LINE> task_type = 'bulk_course_email' <NEW_LINE> task_class = send_bulk_course_email <NEW_LINE> task_input = {'email_id': email_id, 'to_option...
Request to have bulk email sent as a background task. The specified CourseEmail object will be sent be updated for all students who have enrolled in a course. Parameters are the `course_key` and the `email_id`, the id of the CourseEmail object. AlreadyRunningError is raised if the same recipients are already being e...
625941d901c39578d7e750ce
def handle_lanai_tuner_channel_select(call): <NEW_LINE> <INDENT> tuner_station = hass.states.get("input_select.gr_radio_stations").state <NEW_LINE> tuner_station = float(tuner_station.partition(" ")[0]) * 100 <NEW_LINE> tuner_station = hex(int(tuner_station))[2:] <NEW_LINE> send_udp_command("c4.mt.tbfreq2 00 " + str(tu...
Select input source.
625941d915baa723493c4209
def DeleteAttributes(self, subject, attributes, start=None, end=None, sync=True, token=None): <NEW_LINE> <INDENT> _ = sync <NEW_LINE> self.security_manager.CheckDataStoreAccess(token, [subject], "w") <NEW_LINE> if not attributes: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> for attribute in attributes: <NEW_LINE> <IN...
Remove some attributes from a subject.
625941d98a43f66fc4b542f5
def p_resource(self, p): <NEW_LINE> <INDENT> p[0] = Resource(p[2], type=p[1], initializer=p[4])
resource : type variable_declarator_id '=' variable_initializer
625941d90a366e3fb873eaae
def query_plugin(context, iface): <NEW_LINE> <INDENT> pass
Query an adapter that adapts context and request. Store it All request variable must set properlyfor future use.
625941d94d74a7450ccd4456
def getIDList(): <NEW_LINE> <INDENT> return _getUniversal(tc.ID_LIST, "")
getIDList() -> list(string) Returns a list of ids of all multi-entry/multi-exit (e3) detectors within the scenario.
625941d9cc0a2c11143dd123
def get_time(self): <NEW_LINE> <INDENT> if self._systime is None: <NEW_LINE> <INDENT> now = self._time <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> now = clock.time() - self._systime + self._time <NEW_LINE> <DEDENT> return now
Current master clock time.
625941d9c432627299f04eda
def assign(self, *args): <NEW_LINE> <INDENT> return _DataModel.DataUsed_assign(self, *args)
assign(DataUsed self, Object other) -> bool
625941d95fdd1c0f98dc04c6
def p_primary_expression(p): <NEW_LINE> <INDENT> if p[1] == '(': <NEW_LINE> <INDENT> p[0] = p[2] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = p[1]
primary_expression : identifier | constant | string_literal | '(' expression ')'
625941d9c4546d3d9de72cc8
def generate_payload(item, event_schema=None): <NEW_LINE> <INDENT> if isinstance(item[0], str): <NEW_LINE> <INDENT> payload = [item] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> payload = item <NEW_LINE> <DEDENT> event = [generate_relationship(rel) for rel in payload] <NEW_LINE> if event_schema: <NEW_LINE> <INDENT> js...
Generate event payload.
625941d9dc8b845886cb57c8
def beenPressed(self, buttonName): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if buttonName in self.buttonIndex: <NEW_LINE> <INDENT> buttonIndex = self.buttonIndex[buttonName] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> buttonIndex = int(buttonName) <NEW_LINE> <DEDENT> if self.wasPressedMap[buttonIndex]: <NEW_LINE>...
Returns True if the button specified by name or index has been pressed since the last beenPressed call. Used in conjunction with updateState. Throws ValueError if the button name or index cannot be found.
625941d930c21e258bdfa731
def test_unpacks_lists_and_dicts_with_initvars(self) -> None: <NEW_LINE> <INDENT> @type_checked_constructor() <NEW_LINE> @dataclasses.dataclass <NEW_LINE> class Friend: <NEW_LINE> <INDENT> a: int <NEW_LINE> b: int <NEW_LINE> <DEDENT> @type_checked_constructor() <NEW_LINE> @dataclasses.dataclass <NEW_LINE> class Hello: ...
InitVar check parsing must take place before Lists and Dicts This test ensures that unpacking of lists and dicts happens correctly in the presence of InitVars
625941d9e64d504609d74ad2
def __veja(soup): <NEW_LINE> <INDENT> news = [] <NEW_LINE> links = soup.find( 'section', class_='block most-read dark').find_all('a', class_='card') <NEW_LINE> for link in links: <NEW_LINE> <INDENT> title = link.h2.text <NEW_LINE> news.append(dict(title=title, link=replace_original_link_with_outline_call(link['href']))...
Gets the most read news from the Veja page :param soup: the BeautifulSoup object :return: a list with the most read news from the Veja Page
625941d956ac1b37e626445e
def getGraphicsContext(self, *args): <NEW_LINE> <INDENT> return _osgGA.GUIEventAdapter_getGraphicsContext(self, *args)
getGraphicsContext(GUIEventAdapter self) -> GraphicsContext getGraphicsContext(GUIEventAdapter self) -> GraphicsContext
625941d9e1aae11d1e749f4c
def ears_off(self): <NEW_LINE> <INDENT> self.leds.off("EarLeds")
turn the ears on
625941d907d97122c4178b22
def sum_of_diagonals_bst(root, diag): <NEW_LINE> <INDENT> if root is not None: <NEW_LINE> <INDENT> sum_of_diagonals_bst(root.left, diag+1) <NEW_LINE> diagonals_sum[diag] += root.data <NEW_LINE> sum_of_diagonals_bst(root.right, diag)
sum the values of the nodes in the diagonals update the diagonal count with each traversal to left append the value of the node corresponding to diagonal count in dict
625941d92c8b7c6e89b35a52
def __init__(self, context): <NEW_LINE> <INDENT> super(CollectingState, self).__init__(context) <NEW_LINE> self._ops_list = [] <NEW_LINE> self._inner_state = "init"
Saves the reordering context. :param context: The reordering context. :type context: opscontext.OpsContext
625941d90a50d4780f667126
def items(self): <NEW_LINE> <INDENT> for _key in self._order: <NEW_LINE> <INDENT> yield _key, self._data.value(_key)
迭代器 :return:
625941d9f8510a7c17cf9990
def __init__(self, tracking_id=None, status='Ok', payload=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_LINE> self._tracking_i...
PortfolioCurrenciesResponse - a model defined in OpenAPI
625941d9004d5f362079a5c5
def test_create_token_no_user(self): <NEW_LINE> <INDENT> payload = { 'email': 'test@test.com', 'password': 'testpass', 'name': 'Test name' } <NEW_LINE> res = self.client.post(TOKEN_URL, payload) <NEW_LINE> self.assertNotIn('token', res.data) <NEW_LINE> self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
Test that token is not created if user doesn`t exist
625941d9f7d966606f6aa299
def CheckInputFromValidContext(op, input_op): <NEW_LINE> <INDENT> op_ctxt = op._get_control_flow_context() <NEW_LINE> input_ctxt = GetOutputContext(input_op) <NEW_LINE> valid = False <NEW_LINE> if not input_ctxt: <NEW_LINE> <INDENT> valid = True <NEW_LINE> <DEDENT> elif op_ctxt is input_ctxt: <NEW_LINE> <INDENT> valid ...
Returns whether `input_op` can be used from `op`s context. Conceptually, only inputs from op's while context or any ancestor while context (including outside of any context) are valid. In practice, there are many other edge cases as well. Args: op: Operation input_op: Operation Raises: ValueError: if input_op ...
625941d9287bf620b61d3cf5
def add_station(self, this_station): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.station_settings.append(this_station) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> return
Adds a station configuration to the list of stations.
625941d9bde94217f3683081
def testIllegalBitsream3(self): <NEW_LINE> <INDENT> dec = decoder.decoderCreator({}, {}) <NEW_LINE> dec.instrPattern += [([1, None], 0)] <NEW_LINE> dec.computeIllegalBistreams() <NEW_LINE> self.assertEqual(2, len(dec.instrPattern)) <NEW_LINE> self.assert_([1, None] in [i[0] for i in dec.instrPattern]) <NEW_LINE> self.a...
Tests the computation of the negation of the union of the valid bitstrings
625941d9adb09d7d5db6ca21
def myAtoi(self, strs): <NEW_LINE> <INDENT> if not str: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> first = True <NEW_LINE> start = end = 0 <NEW_LINE> for i in range(len(strs)): <NEW_LINE> <INDENT> if first and strs[i] == ' ': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if first and strs[i] in '+-0123456789':...
:type str: str :rtype: int
625941d98e7ae83300e4b260
def userInfoDownload(): <NEW_LINE> <INDENT> global userInfoPath <NEW_LINE> conn=pymysql.connect(host='121.42.180.122', user='xinger', passwd='ShZh_forex_4', db='jfinalbbs',charset='utf8') <NEW_LINE> cur = conn.cursor(pymysql.cursors.DictCursor) <NEW_LINE> cur.execute("select * from user") <NEW_LINE> row=cur.fetchall() ...
下载用户信息 :return:
625941d982261d6c526ab735
def _crop_colorbar(cbar, cbar_vmin, cbar_vmax): <NEW_LINE> <INDENT> if (cbar_vmin is None) and (cbar_vmax is None): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> cbar_tick_locs = cbar.locator.locs <NEW_LINE> if cbar_vmax is None: <NEW_LINE> <INDENT> cbar_vmax = cbar_tick_locs.max() <NEW_LINE> <DEDENT> if cbar_vmin is ...
Crop a colorbar to show from cbar_vmin to cbar_vmax. Used when symmetric_cbar=False is used.
625941d915fb5d323cde0da5
def dictMerge(a, b): <NEW_LINE> <INDENT> for (k, v) in b.items(): <NEW_LINE> <INDENT> if isinstance(v, collections.abc.Mapping): <NEW_LINE> <INDENT> a[k] = dictMerge(a.get(k, {}), v) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> a[k] = v <NEW_LINE> <DEDENT> <DEDENT> return a
Recursively merges the contents of two dict objects This function is similar to the built-in dict.update() method, but instead of clobbering the contents of one dictionary with another, it recursively combines dictionaries. The result is a dictionary containing the combined contents of the arguments. If both dictiona...
625941d9a219f33f34628bf9
def cancel_rental(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cancel_url = f'{BASE_URL}/rentals/cancel.json' <NEW_LINE> logger.info(f'POST - {cancel_url}') <NEW_LINE> r = requests.delete( cancel_url, headers=HEADERS ) <NEW_LINE> if r.status_code >= 200 and r.status_code < 400: <NEW_LINE> <INDENT> logger.info(f'Succ...
Cancel the current active rental.
625941d9d10714528d5fff78
def test_methods(self): <NEW_LINE> <INDENT> hyp_obj = self._child_cls( sentinel.system_name, sentinel.host_name, sentinel.user, sentinel.passwd, sentinel.parameters ) <NEW_LINE> methods = [ ('login', ()), ('logoff', ()), ('reboot', (None, None,)), ('set_boot_device', (None, None,)), ('start', (None, None, None, None,))...
Testcase to exercise all the methods and attributes of the class. Since this is an abstract class we just validate if NotImplementError is raised after a call to each method. Args: None Raises: AssertionError: if hypervisor object does not raise NotImplementedError for the called methods
625941d93617ad0b5ed68189
def testTemplatedEmail(self): <NEW_LINE> <INDENT> pass
Test TemplatedEmail
625941d98c3a87329515864f
def __init__(self, top, minX=-10, minY=-10, maxX=10, maxY=10): <NEW_LINE> <INDENT> self.__top = top <NEW_LINE> self.__Frame = Frame(self.__top, width=WIDTH_SCREEN+OUT_SIZE, height=HEIGHT_SCREEN+OUT_SIZE, bd=1, bg='#aaa') <NEW_LINE> self.__Frame.pack() <NEW_LINE> self.__width_screen = WIDTH_SCREEN <NEW_LINE> self.__heig...
Init a graph Expects a gui object and graph limits
625941d95fc7496912cc3c11
def _build_lambda_bundle(settings): <NEW_LINE> <INDENT> venv_dir = tempfile.mkdtemp() <NEW_LINE> try: <NEW_LINE> <INDENT> print("Creating virtualenv %s" % venv_dir) <NEW_LINE> make_virtualenv(venv_dir) <NEW_LINE> print("Installing pypicloud into virtualenv") <NEW_LINE> pip = os.path.join(venv_dir, "bin", "pip") <NEW_LI...
Build the lambda bundle
625941d9d6c5a102081442df
def setLocalControl(self): <NEW_LINE> <INDENT> self.write("CONF:REM OFF")
Sets the instrument in local control mode
625941d976d4e153a657edc5
def rarity_for(self, name): <NEW_LINE> <INDENT> if name not in self.rarity_mapping: <NEW_LINE> <INDENT> self._read_page(name) <NEW_LINE> <DEDENT> return self.rarity_mapping[name]
Return the rarity for the specified item, property, or ingredient. name -- name of the item, property, or ingredient.
625941d9711fe17d825425f9
def function_name(f): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return f.func_name <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return "%s.%s" % (f.im_class, f.im_func.func_name) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> return f.__c...
Returns the given name of a function (or callable object).
625941d9de87d2750b860027
def __str__(self): <NEW_LINE> <INDENT> rst = '' <NEW_LINE> rst += '{:<30s}: {:}\n'.format('pvname', self.pvname) <NEW_LINE> rst += '{:<30s}: {:}\n'.format('is_scalar', self.is_scalar) <NEW_LINE> rst += '{:<30s}: {:}\n'.format('is_paused', self.is_paused) <NEW_LINE> rst += '{:<30s}: {:}\n'.format('is_connected', self.is...
.
625941d9377c676e9127243b
@pytest.mark.parametrize("region1, region2, peak", [(2900.0, 2940.0, 2920.0)]) <NEW_LINE> def test_marker_in_calibrated_spectrum(region1, region2, peak): <NEW_LINE> <INDENT> spectra.ApplyCalibration("0", [0, 2]) <NEW_LINE> test_mark(region1, region2, peak)
Set Marker in calibrated spectrum Marker should be appear at the right position relative to spectrum
625941d9925a0f43d254a10c
def __init__(self, width, height, area, origin, identifier): <NEW_LINE> <INDENT> self.id = identifier <NEW_LINE> self.area = area <NEW_LINE> self.width = width <NEW_LINE> self.height = height <NEW_LINE> self.origin = origin <NEW_LINE> self.gates = dict() <NEW_LINE> self.gateArea = 0 <NEW_LINE> self.cohesion = 0 <NEW_LI...
origin is an array of two coordinates: (x, y)
625941d9167d2b6e31218e28
def split_reading_into_days(start, end, usage): <NEW_LINE> <INDENT> total_secs = (end - start).total_seconds() <NEW_LINE> next_day = start.replace(hour=0, minute=0, second=0) + timedelta(days=1) <NEW_LINE> fd_secs = (next_day - start).total_seconds() <NEW_LINE> fd_usage = usage * (fd_secs / total_secs) <NEW_LINE> yiel...
Split a single reading into even daily readings
625941d90fa83653e465724d
@pytest.mark.long_running <NEW_LINE> @pytest.mark.ignore_stream("5.3") <NEW_LINE> @pytest.mark.uncollectif(lambda provider: provider.type != 'openstack') <NEW_LINE> def test_unpause( setup_provider_funcscope, provider, testing_instance, soft_assert, verify_vm_paused): <NEW_LINE> <INDENT> testing_instance.wait_for_vm_st...
Tests instance unpause Metadata: test_flag: power_control, provision
625941d938b623060ff0b080
def beta_create_Combiner_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): <NEW_LINE> <INDENT> request_deserializers = { ('seldon.protos.Combiner', 'Aggregate'): SeldonMessageList.FromString, } <NEW_LINE> response_serializers = { ('seldon.protos.Combiner', 'Aggregate'): SeldonMess...
The Beta API is deprecated for 0.15.0 and later. It is recommended to use the GA API (classes and functions in this file not marked beta) for all further purposes. This function was generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0
625941d95166f23b2e1a53ec
@pytest.fixture <NEW_LINE> def it_tutorial_po(settings, italian_tutorial, system): <NEW_LINE> <INDENT> return _require_store(italian_tutorial, settings.POOTLE_TRANSLATION_DIRECTORY, 'tutorial.po')
Require the /it/tutorial/tutorial.po store.
625941d963f4b57ef00013a6
def evolve(self, order): <NEW_LINE> <INDENT> for i in range(self.kept_per_gen, self.num_elements): <NEW_LINE> <INDENT> self.objects[order[i]] = self.cross(order)
Given the order (in terms of decreasing fitness) of the elements, causes the remaining elements per generation to reproduce new elements to take the place of the ones that were removed.
625941d945492302aab5e559
def calculate_final_inclusion(data, opts): <NEW_LINE> <INDENT> def can_include_desc(desc): <NEW_LINE> <INDENT> if desc.can_include is None: <NEW_LINE> <INDENT> if desc.include_rule == "no": <NEW_LINE> <INDENT> desc.can_include = False <NEW_LINE> <DEDENT> elif desc.include_rule == "yes" or desc.include_rule == "if_neede...
calculate_final_inclusion() calculates which descriptions will be included in the output library. An object with include_rule="never" is never included. An object with include_rule="yes" is included if its requirements can be included. An object with include_rule="if_needed" is included if an object to be incl...
625941d94e4d5625662d4668
def outer_processing(interleaved_bits, super_frame_start, rate): <NEW_LINE> <INDENT> coded_bits,first_sync_byte_seq_num = outer_deinterleaver( interleaved_bits, super_frame_start, rate) <NEW_LINE> derandomized_bit_array = outer_decoder(coded_bits, first_sync_byte_seq_num) <NEW_LINE> return bit_packer(derandomized_bit_a...
Deinterleaves, decodes, and 'de-randomizes' bit stream
625941d9435de62698dfdee0
def is_running(self): <NEW_LINE> <INDENT> if not self.pid: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> os.waitpid(self.pid, os.WNOHANG) <NEW_LINE> <DEDENT> except OSError as value: <NEW_LINE> <INDENT> print("Hatari PID %d had exited in the meanwhile:\n\t%s" % (self.pid, value)) <NEW_LI...
is_running() -> bool, True if Hatari is running, False otherwise
625941d94f88993c3716c2f9
def __init__(self,x,y): <NEW_LINE> <INDENT> self.x=x <NEW_LINE> self.y=y
Simple Constructor for initializing all arguments.
625941d95e10d32532c5f1ba
def findFrameInfo(self, context_id, address, done): <NEW_LINE> <INDENT> raise NotImplementedError("Abstract method")
Retrieve stack tracing commands for given instruction address in a context memory. @param context_id - exacutable context ID. @param address - instruction address. @param done - call back interface called when operation is completed. @return - pending command handle.
625941d91d351010ab855daf
def service_running(service): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> output = subprocess.check_output( ['service', service, 'status'], stderr=subprocess.STDOUT).decode('UTF-8') <NEW_LINE> <DEDENT> except subprocess.CalledProcessError: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ...
Determine whether a system service is running
625941d9de87d2750b860028
def total_count(self) -> int: <NEW_LINE> <INDENT> return sum(self.counts)
Returns the sum of the counts in all the buckets.
625941d960cbc95b062c67d7
def AddAutoscalersToMigs(migs_iterator, project, compute, http, batch_url, fail_when_api_not_supported=True): <NEW_LINE> <INDENT> migs = list(migs_iterator) <NEW_LINE> zone_names = set([path_simplifier.Name(mig['zone']) for mig in migs]) <NEW_LINE> autoscalers = {} <NEW_LINE> for zone_name in zone_names: <NEW_LINE> <IN...
Add Autoscaler to each IGM object if autoscaling is enabled for it.
625941d9956e5f7376d710ff
def compose(transducers): <NEW_LINE> <INDENT> retval = None <NEW_LINE> for tr in transducers: <NEW_LINE> <INDENT> if retval == None: <NEW_LINE> <INDENT> retval = HfstTransducer(tr) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> retval.compose(tr) <NEW_LINE> <DEDENT> <DEDENT> retval.minimize() <NEW_LINE> return retval
Return a composition of *transducers*.
625941d9e8904600ed9f21c3
def conv2d(conv_input, conv_filter, is_backprop=False, name=None): <NEW_LINE> <INDENT> return Conv2dOperation( conv_input, conv_filter, is_backprop, name=name).outputs[0]
conv2d.
625941d9a934411ee3751927
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, ProvidersNis): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941d997e22403b379d22e
def get_config_file(): <NEW_LINE> <INDENT> cp = ConfigParser() <NEW_LINE> cp.read(get_config_file_path()) <NEW_LINE> return cp
Get config file. Returns ------- ConfigParser Instance of the configuration parser.
625941d9b7558d58953c51a4
def respond_to_keywords(self): <NEW_LINE> <INDENT> since_id = self.get_last_since_id() <NEW_LINE> results = api.search(q=self.search_query, since_id = since_id,lang='en', tweet_mode='extended') <NEW_LINE> for tweet in reversed(results): <NEW_LINE> <INDENT> if tweet._json['in_reply_to_status_id'] is not None or tweet.us...
This function searches for tweets having certain keywords in it and respond to them
625941d95fdd1c0f98dc04c7
def initialize(organization_name=None, application_name=None, version=None, message=None): <NEW_LINE> <INDENT> app = QSingleApplication() <NEW_LINE> if organization_name: <NEW_LINE> <INDENT> app.setOrganizationName(organization_name) <NEW_LINE> <DEDENT> if application_name: <NEW_LINE> <INDENT> app.setApplicationName(ap...
If you're feeling particularly lazy, this function will handle all the initialization for you and return a :class:`QSingleApplication` instance. :rtype: QSingleApplication
625941d916aa5153ce36270b
def _GetArmVersion(arch): <NEW_LINE> <INDENT> if arch == 'armeabi': <NEW_LINE> <INDENT> return 6 <NEW_LINE> <DEDENT> elif arch == 'armeabi-v7a': <NEW_LINE> <INDENT> return 7 <NEW_LINE> <DEDENT> elif arch in ['arm64-v8a', 'x86', 'x86_64']: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rai...
Returns arm_version for the GN build with the given architecture.
625941d90a366e3fb873eaaf
def step(self, policy, scenario_input): <NEW_LINE> <INDENT> self.happy = 0 <NEW_LINE> self.happytype0 = 0 <NEW_LINE> self.happytype1 = 0 <NEW_LINE> self.empty = 0 <NEW_LINE> self.type0agents = 0 <NEW_LINE> self.type1agents = 0 <NEW_LINE> self.movementQuotaCount = 0 <NEW_LINE> self.movement = 0 <NEW_LINE> self.movementt...
Run one step of the model. If All agents are happy, halt the model. Note on the eveness paramater calculation: It cannot be performed in the step function of the agents as then it would not take consider periods of time during which the agents are still moving, making the parameter calculation inaccurate.
625941d9d486a94d0b98e3da
def loadSrv(self, pkg, cls): <NEW_LINE> <INDENT> key = (pkg, 'srv', cls) <NEW_LINE> try: <NEW_LINE> <INDENT> module = self._moduleCache[key] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> module = self._loadModule(*key) <NEW_LINE> self._moduleCache[key] = module <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> re...
Get the service class matching the string pair. This method uses a internal cache; therefore, changes on the filesystem will be ignored once the class is loaded into the cache. @param pkg: Package name from where the class should be loaded. @type pkg: str @param cls: Class name of the message class which...
625941d9d6c5a102081442e0
def startStreamUpdater(self): <NEW_LINE> <INDENT> if self.getConfig("plugin_eddn") is not 0: <NEW_LINE> <INDENT> self.__streamUpdater.append(elite.loader.eddn.newClient(self))
Start this only from a gui or other running instances and not in single run scripts
625941d9a79ad161976cc3d9
def link_fallbacks(self): <NEW_LINE> <INDENT> def link(ancestor): <NEW_LINE> <INDENT> def linkto(current): <NEW_LINE> <INDENT> current.fallback_state_nr = ancestor.nr <NEW_LINE> for child in current.insn_out.values(): <NEW_LINE> <INDENT> if current.conclusions: <NEW_LINE> <INDENT> link(current, child) <NEW_LINE> <DEDEN...
After adding all insns, back-link all states to their most recent ancestors that had at least one conclusion
625941d9a219f33f34628bfa
def sys_stdout_guess_tty_columns_os(hint): <NEW_LINE> <INDENT> showing = None <NEW_LINE> fd = None <NEW_LINE> if hasattr(hint, "fileno"): <NEW_LINE> <INDENT> streaming = hint <NEW_LINE> fd = streaming.fileno() <NEW_LINE> <DEDENT> elif hasattr(hint, "startswith"): <NEW_LINE> <INDENT> if hint.startswith(os.sep): <NEW_LIN...
Try "os.get_terminal_size", and slap back "shutil.get_terminal_size" pushing (80, 24)
625941d94f6381625f114ccf
def __init__ (self, id=None, name=None, binding=None, metadata=None): <NEW_LINE> <INDENT> super(NodeSAP, self).__init__(id=id, type=Node.SAP, name=name, metadata=metadata) <NEW_LINE> self.binding = binding <NEW_LINE> self.placement_criteria = ()
Init. :param id: optional id :type id: str or int :param name: optional name :type name: str :param binding: interface binding :type binding: str :param metadata: metadata related to Node :type metadata: dict :return: None
625941d98e05c05ec3eea60a
def getLatitude(self): <NEW_LINE> <INDENT> return self.station['Zem.sirka']
:return: latitude of station
625941d9c432627299f04edb
def _parse_rest_of_l_value_expression( self, l_value: LValueExpression, lexer: TigerLexer ) -> Union[LValueExpression, AssignmentExpression]: <NEW_LINE> <INDENT> raise NotImplementedError("TODO")
lValue → id | subscript | fieldExp subscript → lValue [ exp ] fieldExp → lValue . id The base case for l-values is an identifier, which is also the left-most token in the expression. This makes it pretty pretty easy to spot a new l-value starting (`a.`, `a[`), but then it may nest indefinitely (e.g. `a.b[c].d`). The ...
625941d9cdde0d52a9e532c9
def message_search_get_domain(self, cr, uid, ids, context=None): <NEW_LINE> <INDENT> initial_domain = super(res_users, self).message_search_get_domain(cr, uid, ids, context=context) <NEW_LINE> custom_domain = [] <NEW_LINE> for user in self.browse(cr, uid, ids, context=context): <NEW_LINE> <INDENT> if custom_domain: <NE...
Override of message_search_get_domain for partner discussion page. The purpose is to add messages directly sent to user using @user_login.
625941d93617ad0b5ed6818a
def searchbyno(self, name): <NEW_LINE> <INDENT> pattern = re.compile(str(name)) <NEW_LINE> result = {} <NEW_LINE> for i in self.__allstockno: <NEW_LINE> <INDENT> query = re.search(pattern, str(i)) <NEW_LINE> if query: <NEW_LINE> <INDENT> query.group() <NEW_LINE> result[i] = self.__allstockno[i] <NEW_LINE> <DEDENT> <DED...
搜尋股票代碼 :param str name: 欲搜尋的字串 :rtype: list
625941d9b545ff76a89140a9
def test_prog_rom(self): <NEW_LINE> <INDENT> prefix = 'NES\x1a' <NEW_LINE> suffix = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' <NEW_LINE> for i in range(0, 256): <NEW_LINE> <INDENT> header, prog_rom, chr_rom = read_header(prefix + struct.pack('B', i) + suffix) <NEW_LINE> self.assertEqual(header['...
Ensure all possible prog rom sizes work.
625941d93539df3088e2e5df
def get_names(self): <NEW_LINE> <INDENT> attrs = dir(self.__class__) <NEW_LINE> attrs.extend(self.get_cmd_list()) <NEW_LINE> return attrs
Overides Cmd.get_names in order to pull in awsli commands
625941d9293b9510aa2c3527
def test_2(self): <NEW_LINE> <INDENT> temp_method = ps7.RectangularRoom.getRandomPosition <NEW_LINE> random_state = random.getstate() <NEW_LINE> def custom_method(*args): <NEW_LINE> <INDENT> test = random.getstate() != random_state <NEW_LINE> msg = ('In the Robot class you need to define ' + 'the direction before the p...
-Check if the first tile is cleaned -Check if the direction is being defined before position -Check if the direction is being returned as an integer
625941d999cbb53fe6792e7a
def max_noutput_items(self): <NEW_LINE> <INDENT> return _channels_swig.selective_fading_model_sptr_max_noutput_items(self)
max_noutput_items(selective_fading_model_sptr self) -> int
625941d91f037a2d8b946491
def test_create_token_for_user(self): <NEW_LINE> <INDENT> payload = { "email": "hippolyte.leveque@gmail.com", "password": "testpass", } <NEW_LINE> create_user(**payload) <NEW_LINE> res = self.client.post(TOKEN_URL, payload) <NEW_LINE> self.assertIn("token", res.data) <NEW_LINE> self.assertEqual(res.status_code, status....
Test that a token is created for the user
625941d90383005118ecf876
def inference(input_data, data_format, input_utt_lens, dtype=tf.float32): <NEW_LINE> <INDENT> assert data_format in ["NCHW", "NHWC"], "only support nchw or nhwc yet" <NEW_LINE> INFERENCE_DTYPE = dtype <NEW_LINE> feat = cbr_combine(input_data, data_format) <NEW_LINE> seq_lens = get_seq_lens(input_utt_lens) <NEW_LINE> rn...
inference return logits, seq_lens
625941d93eb6a72ae02ec777
def _absolute_path(path, relative_to=None): <NEW_LINE> <INDENT> if path and os.path.isabs(path): <NEW_LINE> <INDENT> return path <NEW_LINE> <DEDENT> if path and relative_to is not None: <NEW_LINE> <INDENT> _abspath = os.path.join(relative_to, path) <NEW_LINE> if os.path.isfile(_abspath): <NEW_LINE> <INDENT> log.debug( ...
Return an absolute path. In case ``relative_to`` is passed and ``path`` is not an absolute path, we try to prepend ``relative_to`` to ``path``and if that path exists, return that one
625941d9d53ae8145f87a500
def iterelements(self): <NEW_LINE> <INDENT> return (c for c in self if isinstance(c, XElement));
Returns all the element children of this node, skipping all others
625941d997e22403b379d22f
def __setitem__(self, idx, value): <NEW_LINE> <INDENT> assert(isinstance(idx, int)) <NEW_LINE> idx = self._normalize_idx(idx) <NEW_LINE> if(self.length == 0 or idx >= self.length): <NEW_LINE> <INDENT> raise IndexError <NEW_LINE> <DEDENT> banana = self.head.next <NEW_LINE> for i in range(idx): <NEW_LINE> <INDENT> banana...
Implements `self[idx] = x`
625941d901c39578d7e750d0
def system_hostname(system): <NEW_LINE> <INDENT> return system['sysinfo']['hostName']
Get a system's host name from the system info
625941d945492302aab5e55a
def min_elem_matrix(matrix): <NEW_LINE> <INDENT> min_elem = matrix[0][0] <NEW_LINE> for row in matrix: <NEW_LINE> <INDENT> for elem in row: <NEW_LINE> <INDENT> if elem < min_elem: <NEW_LINE> <INDENT> min_elem = elem <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return print(f'The minimum element of the matrix is {min_elem}')
this function takes a matrix as input and returns its maximum element :param matrix: :return: minimum element
625941d9c432627299f04edc
def get_pool_stats(self): <NEW_LINE> <INDENT> req = "" <NEW_LINE> LOG.debug("Get pool %s fsprops", self.pool) <NEW_LINE> resp = self.rproxy.pool_request('GET', req) <NEW_LINE> if not resp["error"] and resp["code"] == 200: <NEW_LINE> <INDENT> return resp["data"] <NEW_LINE> <DEDENT> self._general_error(req, resp)
get_pool_stats. GET /pools/<string:poolname> :param pool_name: :return: { "data": { "available": "24433164288", "status": 24, "name": "Pool-0", "scan": { "errors": 0, "repaired": "0", "start_time": 1463476815, "state": "finished", "end_time": 1463476820, "type": "s...
625941d9f8510a7c17cf9991
def _match_epa_params(self, resource_info, request_params): <NEW_LINE> <INDENT> result = False <NEW_LINE> result = self._match_vm_flavor(getattr(request_params, 'vm_flavor'), getattr(resource_info, 'vm_flavor')) <NEW_LINE> if result == False: <NEW_LINE> <INDENT> self.log.debug("VM Flavor mismatched") <NEW_LINE> return ...
Match EPA attributes Arguments: resource_info: Protobuf GI object RwcalYang.FlavorInfoItem() Following attributes would be accessed - vm_flavor - guest_epa - host_epa - host_aggregate request_params: Protobuf GI object Rwca...
625941d9377c676e9127243c
def test_get_hardware_pipette_with_back_compat() -> None: <NEW_LINE> <INDENT> pipette_config = create_pipette_config( "p300_single_gen2", back_compat_names=["p300_single"], ) <NEW_LINE> attached_pipettes: Dict[HwMount, PipetteDict] = { HwMount.LEFT: pipette_config, HwMount.RIGHT: cast(PipetteDict, {}), } <NEW_LINE> sub...
It maps a pipette ID to a config given the HC's attached pipettes. In this test, the hardware config specs "p300_single_gen2", and the loaded pipette name in state is "p300_single," which is is allowed.
625941d96aa9bd52df037039
def parse_line(self, line): <NEW_LINE> <INDENT> self.clear() <NEW_LINE> self.preprocessor.process_line(line) <NEW_LINE> self.lexer.load(self.preprocessor.result()) <NEW_LINE> self.next_token = self.lexer.get_token() <NEW_LINE> if self.match_noget(TokenType.TYPE): <NEW_LINE> <INDENT> mast = self._parse_decl() <NEW_LINE>...
Parse simple expression & statement. Returns the AST. Notice: Only part before semicolon ';' is parsed.
625941d994891a1f4081bd3e
def test_list(self): <NEW_LINE> <INDENT> clear_db() <NEW_LINE> s1 = Server.create(server_id=None, tenant_id=1, name='name1', status='ready') <NEW_LINE> s2 = Server.create(server_id=None, tenant_id=1, name='name2', status='scheduled') <NEW_LINE> Server.create(server_id=None, tenant_id=2, name='name3', status='ready') <N...
list of servers
625941d9b5575c28eb68e296
def test_component_identity(self): <NEW_LINE> <INDENT> class ComponentA(Component): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> c1 = ComponentA(self.compmgr) <NEW_LINE> c2 = ComponentA(self.compmgr) <NEW_LINE> self.assertIs(c1, c2, 'Expected same component instance') <NEW_LINE> c2 = self.compmgr[ComponentA] <NEW_LINE>...
Make sure instantiating a component multiple times just returns the same instance again.
625941d9a4f1c619b28b02c8
def search( self, text ): <NEW_LINE> <INDENT> url = self.base_url + '/edsapi/publication/Search?query=#{text}&resultsperpage=20&pagenumber=1&sort=relevance&highlight=n&includefacets=y&view=brief&autosuggest=n' <NEW_LINE> req_headers = self.prep_headers() <NEW_LINE> req_params = self.prep_params( text ) <NEW_LINE> r = r...
Handles authentication if necessary, then runs search.
625941d926068e7796caef76
def disconnect_chat(message, code): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> room = Room.objects.get(code=code) <NEW_LINE> <DEDENT> except Room.DoesNotExist: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> Group(room.group_name).discard(message.reply_channel)
Removes the user from the room group when they disconnect. Channels will auto-cleanup eventually, but it can take a while, and having old entries cluttering up your group will reduce performance.
625941d992d797404e30441f
def get_hyperlinks(self): <NEW_LINE> <INDENT> return self.hyperlinks
Return the list of hyperlinks.
625941d99c8ee82313fbba0a
def reverseBetween(self, head, m, n): <NEW_LINE> <INDENT> counter = 1; <NEW_LINE> curr = head <NEW_LINE> prev =None <NEW_LINE> while counter<m: <NEW_LINE> <INDENT> prev = curr <NEW_LINE> curr = curr.next <NEW_LINE> counter += 1 <NEW_LINE> <DEDENT> first = curr <NEW_LINE> last = curr <NEW_LINE> curr = curr.next <NEW_LIN...
:type head: Send the first node of the LL :type m: int Start index from where to reverse :type n: int End index from where to reverse :rtype: ListNode Returns the head of the new LL
625941d99f2886367277ab20
def pre_namespace_read(self, resource_id): <NEW_LINE> <INDENT> pass
Method called before namespace is read
625941d98e7ae83300e4b261
def main(): <NEW_LINE> <INDENT> VolShell().run()
A convenience function for constructing and running the :class:`CommandLine`'s run method.
625941d93c8af77a43ae3a36
@gpu_wrapper <NEW_LINE> def construct_cnn_L3_nomelspec(**kwargs): <NEW_LINE> <INDENT> vision_model, x_i, y_i = construct_cnn_L3_orig_inputbn_vision_model() <NEW_LINE> audio_model, x_a, y_a = construct_cnn_L3_nomelspec_audio_model(**kwargs) <NEW_LINE> m = L3_merge_audio_vision_models(vision_model, x_i, audio_model, x_a,...
Constructs a model that replicates that used in Look, Listen and Learn Relja Arandjelovic and (2017). Look, Listen and Learn. CoRR, abs/1705.08168, . Returns ------- model: L3 CNN model (Type: keras.models.Model) inputs: Model inputs (Type: list[keras.layers.Input]) outputs: Model outputs (Ty...
625941d90a50d4780f667128