text
stringlengths
78
104k
score
float64
0
0.18
def request(self, url, post=None, method="GET"): """ Make the request""" dsid = self.get_dsid() baseurl = "https://auth.api.swedbank.se/TDE_DAP_Portal_REST_WEB/api/v1/%s?dsid=%s" % ( url, dsid) if self.pch is None: self.pch = build_opener(HTTPCookieProcessor(self...
0.001996
def find_one(self, cls, id): """Required functionality.""" one = self._find(cls, {"_id": id}) if not one: return None return one[0]
0.011429
def uniprot(self, uniprotid=None, hgnc_symbol=None, hgnc_identifier=None, limit=None, as_df=False): """Method to query :class:`.models.UniProt` objects in database :param uniprotid: UniProt identifier(s) :type uniprotid: str or tuple(str) or None :param hgnc_symbol: HGNC symbol(s) ...
0.003088
def fit(self, X, y=None, **kwargs): """ The fit method is the primary drawing input for the visualization since it has both the X and y data required for the viz and the transform method does not. Parameters ---------- X : ndarray or DataFrame of shape n x m ...
0.002128
def logger_delete(self, project, logger_name): """API call: delete all entries in a logger via a DELETE request See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs/delete :type project: str :param project: ID of project containing the log entries to de...
0.003546
def get_stroke_features(recording, strokeid1, strokeid2): """Get the features used to decide if two strokes belong to the same symbol or not. Parameters ---------- recording : list A list of strokes strokeid1 : int strokeid2 : int Returns ------- list : A list o...
0.000794
def _search(self, query, fields=None, limit=50000, sampling=None): """ Perform the search and return raw rows :type query object :type fields list[str] or None :type limit int :type sampling int or None :arg sampling: Percentage of results to be returned (0,100)...
0.004762
def expand_tpm(tpm): """Broadcast a state-by-node TPM so that singleton dimensions are expanded over the full network. """ unconstrained = np.ones([2] * (tpm.ndim - 1) + [tpm.shape[-1]]) return tpm * unconstrained
0.004292
def stream_info(self) -> None: """Check and report source names, dtypes and shapes of all the streams available.""" stream_names = [stream_name for stream_name in dir(self) if 'stream' in stream_name and stream_name != 'stream_info'] logging.info('Found %s stream candidat...
0.007289
def get_bundle_registered_services(self, bundle): # type: (Any) -> List[ServiceReference] """ Retrieves the services registered by the given bundle. Returns None if the bundle didn't register any service. :param bundle: The bundle to look into :return: The references to ...
0.006522
def generate_protocol(self): """ Recreate the command stimulus (protocol) for the current sweep. It's not stored point by point (that's a waste of time and memory!) Instead it's stored as a few (x,y) points which can be easily graphed. TODO: THIS for segment in abf.ABFre...
0.011733
def _send(self, msg, buffers=None): """Sends a message to the model in the front-end.""" if self.comm is not None and self.comm.kernel is not None: self.comm.send(data=msg, buffers=buffers)
0.009217
def _import_data(sections, crumbs): """ Import the section metadata and change it to index-by-name. :param list sections: Metadata :param str pc: paleo or chron :return dict _sections: Metadata """ logger_jsons.info("enter import_data: {}".format(crumbs)) _sections = OrderedDict() t...
0.003215
def get(self, key, default=None): """Returns the value of `key` if it exists, else `default`.""" if key in self._hparam_types: # Ensure that default is compatible with the parameter type. if default is not None: param_type, is_param_list = self._hparam_types[key] type_str = 'list<%s>...
0.00999
def get_object_list_json(request): """gmn.listObjects(session[, fromDate][, toDate][, formatId] [, identifier][, replicaStatus][, start=0][, count=1000] [, f=sysmetaField ...]) → ObjectListJson GMN specific API for fast retrieval of object sysmeta elements. """ # TODO: Add to documentation ...
0.002307
def _inclusiveNamespacePrefixes(node, context, unsuppressedPrefixes): '''http://www.w3.org/TR/xml-exc-c14n/ InclusiveNamespaces PrefixList parameter, which lists namespace prefixes that are handled in the manner described by the Canonical XML Recommendation''' inclusive = [] if node.prefix: ...
0.0062
def set_display_mode(self, zoom,layout='continuous'): """Set display mode in viewer The "zoom" argument may be 'fullpage', 'fullwidth', 'real', 'default', or a number, interpreted as a percentage.""" if(zoom=='fullpage' or zoom=='fullwidth' or zoom=='real' or zoom=='def...
0.026627
def next_frame_epva(): """EPVA hparams.""" hparams = basic_deterministic_params.next_frame_basic_deterministic() hparams.video_num_input_frames = 4 hparams.video_num_target_frames = 4 hparams.bottom = { "inputs": modalities.video_raw_bottom, "targets": modalities.video_raw_targets_bottom, } hp...
0.021505
def get(cls, **kwargs): """Get a copy of the type from the cache and reconstruct it.""" data = cls._get(**kwargs) if data is None: new = cls() new.from_miss(**kwargs) return new return cls.deserialize(data)
0.007273
def fix_lamdaline(source): """Remove the last redundant token from lambda expression lambda x: return x) ^ Return string without irrelevant tokens returned from inspect.getsource on lamda expr returns """ # Using undocumented generate_tokens due to a tokenize.tokenize bug...
0.001387
def base_dtype(dtype): """Returns a non-reference `dtype` based on this `dtype`.""" dtype = tf.as_dtype(dtype) if hasattr(dtype, 'base_dtype'): return dtype.base_dtype return dtype
0.026042
def buscar_idtrafficreturn_opcvip(self, nome_opcao_txt): """Search id of Option VIP when tipo_opcao = 'Retorno de trafego' ​​ :return: Dictionary with the following structure: :: {‘trafficreturn_opt’: ‘trafficreturn_opt’: <'id'>} :raise InvalidParameterError: Environment ...
0.007353
def check_origin(self, origin: str) -> bool: """Override to enable support for allowing alternate origins. The ``origin`` argument is the value of the ``Origin`` HTTP header, the url responsible for initiating this request. This method is not called for clients that do not send this he...
0.000864
def set_fan_mode(self, mode): """ :param mode: a string one of ["on", "auto"] :return: nothing """ desired_state = {"fan_mode": mode} response = self.api_interface.set_device_state(self, { "desired_state": desired_state }) self._update_state_...
0.005831
def load_csv(self, filename, start_frame=10, max_frames=int(1e300)): '''Load marker data from a CSV file. The file will be imported using Pandas, which must be installed to use this method. (``pip install pandas``) The first line of the CSV file will be used for header information. The...
0.003743
def do_rating_by_user(parser, token): """ Retrieves the ``Vote`` cast by a user on a particular object and stores it in a context variable. If the user has not voted, the context variable will be 0. Example usage:: {% rating_by_user user on instance as vote %} """ bits...
0.009223
def multiscale_entropy(time_series, sample_length, tolerance = None, maxscale = None): """Calculate the Multiscale Entropy of the given time series considering different time-scales of the time series. Args: time_series: Time series for analysis sample_length: Bandwidth or group of points ...
0.008991
def _init_metadata(self): """stub""" super(BaseMultiChoiceFileQuestionFormRecord, self)._init_metadata() self._choice_file_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, ...
0.003067
def get_main_activity(self): """ Return the name of the main activity :rtype: string """ x = set() y = set() for i in self.xml: activities_and_aliases = self.xml[i].getElementsByTagName("activity") + \ sel...
0.004202
def server_side(func): """ Decorator to designate an API method applicable only to server-side instances. This allows us to use the same APIRequest and APIResponse subclasses on the client and server sides without too much confusion. """ def inner(*args, **kwargs): if args and hasat...
0.003802
def run_command(cmd): """ Open a child process, and return its exit status and stdout. """ child = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdin=subprocess.PIPE, stdout=subprocess.PIPE) out = [s.decode("utf-8").strip() for s in child.stdout] err = ...
0.002331
def convert_to_ReSpecTh(self, filename): """Convert ChemKED record to ReSpecTh XML file. This converter uses common information in a ChemKED file to generate a ReSpecTh XML file. Note that some information may be lost, as ChemKED stores some additional attributes. Arguments: ...
0.001928
def get_position(self): """ 获取持仓 :return: """ xq_positions = self._get_position() balance = self.get_balance()[0] position_list = [] for pos in xq_positions: volume = pos["weight"] * balance["asset_balance"] / 100 position_list.appe...
0.002286
def distance_diagonal_law(matrix, positions=None): """Compute a distance law trend using the contact averages of equal distances. Specific positions can be supplied if needed. """ n = min(matrix.shape) if positions is None: return np.array([np.average(np.diagonal(matrix, j)) for j in range(...
0.001705
def add_data_flow_view_for_model(self, data_flow_m, parent_state_m): """Creates a `DataFlowView` and adds it to the canvas The method creates a`DataFlowView` from the given `DataFlowModel `data_flow_m` and adds it to the canvas. :param DataFlowModel data_flow_m: The data flow for which a view ...
0.00813
def parse_case_snake_to_camel(snake, upper_first=True): """ Convert a string from snake_case to CamelCase. :param str snake: The snake_case string to convert. :param bool upper_first: Whether or not to capitalize the first character of the string. :return: The CamelCase version of string. :rtype: str """ sna...
0.029167
def mirror_folder(source, target, delete_orphans=True, recurse=True, ignore_list=None, _level=0, logger=None): """Mirrors a folder *source* into a target folder *target*.""" logger = logger or logging.getLogger(__name__) def expand_tree(p): tree = [] for node in Path(p).walk(): ...
0.001571
def partitionSum(M,I,T,step=None): """ INPUT PARAMETERS: M: HITRAN molecule number (required) I: HITRAN isotopologue number (required) T: temperature conditions (required) step: step to calculate temperatures (optional) OUTPUT PARAMETERS:...
0.014714
def separateKeywords(kwArgsDict): """ Look through the keywords passed and separate the special ones we have added from the legal/standard ones. Return both sets as two dicts (in a tuple), as (standardKws, ourKws) """ standardKws = {} ourKws = {} for k in kwArgsDict: if k in STA...
0.006593
def guess_lexer(_text, **options): """Guess a lexer by strong distinctions in the text (eg, shebang).""" # try to get a vim modeline first ft = get_filetype_from_buffer(_text) if ft is not None: try: return get_lexer_by_name(ft, **options) except ClassNotFound: ...
0.001404
def get_attributes(self, domain_or_name, item_name, attribute_names=None, consistent_read=False, item=None): """ Retrieve attributes for a given item in a domain. :type domain_or_name: string or :class:`boto.sdb.domain.Domain` object. :param domain_or_name: Either...
0.004342
def converter(f): """Decorator to convert value from dbus type to python type.""" @wraps(f) def wrapper(*args, **kwds): return convert(f(*args, **kwds)) return wrapper
0.005236
def mnn_correct(*datas, var_index=None, var_subset=None, batch_key='batch', index_unique='-', batch_categories=None, k=20, sigma=1., cos_norm_in=True, cos_norm_out=True, svd_dim=None, var_adj=True, compute_angle=False, mnn_order=None, svd_mode='rsvd', do_concatenate=True,...
0.002924
def _build_parser(): """ Return a command-line arguments parser. """ parser = argparse.ArgumentParser(description='Search you Azure AD contacts from mutt or the command-line.') parser.add_argument('-c', '--config', help='Specify alternative configuration file.', metavar="FILE") parser.add_argume...
0.006821
def watchdogctl(ctx, kill=False, verbose=True): """Control / check a running Sphinx autobuild process.""" tries = 40 if kill else 0 cmd = 'lsof -i TCP:{} -s TCP:LISTEN -S -Fp 2>/dev/null'.format(ctx.rituals.docs.watchdog.port) pidno = 0 pidinfo = capture(cmd, ignore_failures=True) while pidinfo...
0.003906
def is_bool(tg_type, inc_array=False): """Tells if the given tango type is boolean :param tg_type: tango type :type tg_type: :class:`tango.CmdArgType` :param inc_array: (optional, default is False) determines if include array in the list of checked types :type inc_array: :py:o...
0.001595
def random_permutation(iterable, r=None): """Return a random *r* length permutation of the elements in *iterable*. If *r* is not specified or is ``None``, then *r* defaults to the length of *iterable*. >>> random_permutation(range(5)) # doctest:+SKIP (3, 4, 0, 1, 2) This equivalent t...
0.00198
def verify_edx_resources(): """ Ensure that all necessary resources to render the view are present. """ required_methods = { 'ProgramDataExtender': ProgramDataExtender, } for method in required_methods: if required_methods[method] is None: raise NotConnectedToOpenEdX...
0.003861
def apply_filter(objs, selector, mode): '''Apply selector to transform each object in objs. This operates in-place on objs. Empty objects are removed from the list. Args: mode: either KEEP (to keep selected items & their ancestors) or DELETE (to delete selected items and their childr...
0.001129
def generic(magfile="", dir_path=".", meas_file="measurements.txt", spec_file="specimens.txt", samp_file="samples.txt", site_file="sites.txt", loc_file="locations.txt", user="", labfield=0, labfield_phi=0, labfield_theta=0, experiment="", cooling_times_list=[], sample_nc=[1, 0], site...
0.001817
def google_news_search(self,query,category_label,num=50): ''' Searches Google News. NOTE: Official Google News API is deprecated https://developers.google.com/news-search/?hl=en NOTE: Google limits the maximum number of documents per query to 100. Use multiple related queri...
0.010318
def write_raw_text_to_files(all_files, urls_path, dataset_split, tmp_dir): """Write text to files.""" def write_to_file(all_files, urls_path, tmp_dir, filename): """Write text to files.""" with io.open( os.path.join(tmp_dir, filename + ".source"), "w", encoding="utf-8") as fstory: wit...
0.014878
def delete_perf_task(task_name, auth, url): """ Function takes a str of the target task_name to be deleted and retrieves task_id using the get_perf_task function. Once the task_id has been successfully retrieved it is populated into the task_id variable and an DELETE call is made against the HPE IMC RES...
0.005356
def send_to_address(recipient_address, amount, private_key, blockchain_client=BlockchainInfoClient(), fee=STANDARD_FEE, change_address=None): """ Builds, signs, and dispatches a "send to address" transaction. """ # build and sign the tx signed_tx = make_send_to_address_tx(recipient_addre...
0.008562
def handle_special_journals(citation_elements, kbs): """format special journals (like JHEP) volume number JHEP needs the volume number prefixed with the year e.g. JHEP 0301 instead of JHEP 01 """ for el in citation_elements: if el['type'] == 'JOURNAL' and el['title'] in kbs['special_journal...
0.00182
def mean(self, axis=None, dtype=None, out=None, keepdims=False): """Compute the arithmetic mean along the specified axis. See np.mean() for details.""" if axis == -1: axis = self.ndim if axis is None: results = vectorize(mean)(self, axis, dtype, keepdims=False) ...
0.001414
def _parse_iso8601(text): """ Maybe parse an ISO8601 datetime string into a datetime. :param text: Either a ``unicode`` string to parse or any other object (ideally a ``datetime`` instance) to pass through. :return: A ``datetime.datetime`` representing ``text``. Or ``text`` if it was ...
0.001558
def do_opt(self, *args, **kwargs): """ Get and set options """ args = list(args) if not args: largest = 0 keys = [key for key in self.conf if not key.startswith("_")] for key in keys: largest = max(largest, len(key)) for key in keys...
0.0022
def skip_prepare(func): """ A convenience decorator for indicating the raw data should not be prepared. """ @wraps(func) def _wrapper(self, *args, **kwargs): value = func(self, *args, **kwargs) return Data(value, should_prepare=False) return _wrapper
0.003448
def _normalize_array(array, domain=(0, 1)): """Given an arbitrary rank-3 NumPy array, produce one representing an image. This ensures the resulting array has a dtype of uint8 and a domain of 0-255. Args: array: NumPy array representing the image domain: expected range of values in array, defaults ...
0.012249
def histogram(title, title_x, title_y, x, bins_x): """ Plot a basic histogram. """ plt.figure() plt.hist(x, bins_x) plt.xlabel(title_x) plt.ylabel(title_y) plt.title(title)
0.004587
def normalize_underscore_case(name): """Normalize an underscore-separated descriptor to something more readable. i.e. 'NAGIOS_SERVER' becomes 'Nagios Server', and 'host_components' becomes 'Host Components' """ normalized = name.lower() normalized = re.sub(r'_(\w)', lamb...
0.002247
def create_entity_dict(self): ''' Creates a dict-based entity with fixed values, using all of the supported data types. ''' entity = {} # Partition key and row key must be strings and are required entity['PartitionKey'] = 'pk{}'.format(str(uuid.uuid4()).replace('-', ''))...
0.00473
def get_names_owned_by_address( self, address ): """ Get the set of names owned by a particular address. NOTE: only works for cases where we could extract an address. """ cur = self.db.cursor() names = namedb_get_names_owned_by_address( cur, address, self.lastblock ) ...
0.020833
def connect( self, login, password, authz_id=b"", starttls=False, authmech=None): """Establish a connection with the server. This function must be used. It read the server capabilities and wraps calls to STARTTLS and AUTHENTICATE commands. :param login: username...
0.001898
def request_bytesize(self): """The size of in bytes of the bundled field elements.""" return sum(len(str(e)) for elts in self._in_deque for e in elts)
0.012048
def robust_single_linkage(X, cut, k=5, alpha=1.4142135623730951, gamma=5, metric='euclidean', algorithm='best', memory=Memory(cachedir=None, verbose=0), leaf_size=40, core_dist_n_jobs=4, **kwargs): """Perform robust single linkage cluster...
0.001264
def replace_with_text_stream(stream_name): """Given a stream name, replace the target stream with a text-converted equivalent :param str stream_name: The name of a target stream, such as **stdout** or **stderr** :return: None """ new_stream = TEXT_STREAMS.get(stream_name) if new_stream is not N...
0.007143
def get_lmv2_response(domain, username, password, server_challenge, client_challenge): """ Computes an appropriate LMv2 response based on the supplied arguments The algorithm is based on jCIFS. The response is 24 bytes, with the 16 bytes of hash concatenated with the 8 byte client client...
0.008475
def set_verbosity(verbosity): """Banana banana """ Logger._verbosity = min(max(0, WARNING - verbosity), 2) debug("Verbosity set to %d" % (WARNING - Logger._verbosity), 'logging')
0.009524
def inverse_unit_transform(self, x, **kwargs): """Go from the parameter value to the unit coordinate using the cdf. """ if len(kwargs) > 0: self.update(**kwargs) return self.distribution.cdf(x, *self.args, loc=self.loc, scale=self.scale)
0.006289
def h2i(self, pkt, seconds): """Convert the number of seconds since 1-Jan-70 UTC to the packed representation.""" if seconds is None: seconds = 0 tmp_short = (seconds >> 32) & 0xFFFF tmp_int = seconds & 0xFFFFFFFF return struct.pack("!HI", tmp_short, tmp...
0.006154
def apply(self, function): """ Applies a function on the value, the actual stored value will not change. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counte...
0.009077
def _saline(cls, T, P, S): """Eq 4""" # Check input in range of validity if T <= 261 or T > 353 or P <= 0 or P > 100 or S < 0 or S > 0.12: warnings.warn("Incoming out of bound") S_ = 0.03516504*40/35 X = (S/S_)**0.5 tau = (T-273.15)/40 pi = (P-0.1013...
0.00074
def get(self, id, seq, intf): # pylint: disable=invalid-name,redefined-builtin """Get a capture. :param id: Result ID as an int. :param seq: TestResult sequence ID as an int. :param intf: Interface name as string. :return: :class:`captures.Capture <captures.Capture>` object ...
0.005952
def is_ordered_mapping(obj): """Checks whether given object is an ordered mapping, e.g. a :class:`OrderedDict`. :return: ``True`` if argument is an ordered mapping, ``False`` otherwise """ if not (is_mapping(obj) and hasattr(obj, '__reversed__')): return False # PyPy has a bug where the...
0.001838
def text(self, text, x, y, width, height, color, font): """ See the Processing function text(): https://processing.org/reference/text_.html Consider using Pango in addition to Cairo here. """ # Helper function. def chop(word): """ Take a w...
0.00278
def scan_file(self, filename, filename_key=None): """Scans a specified file, and adds information to self.data :type filename: str :param filename: full path to file to scan. :type filename_key: str :param filename_key: key to store in self.data :returns: boolean; thou...
0.002577
def holiday_description(self): """ Return the holiday description. In case none exists will return None. """ entry = self._holiday_entry() desc = entry.description return desc.hebrew.long if self.hebrew else desc.english
0.00722
def move_to_device(obj, cuda_device: int): """ Given a structure (possibly) containing Tensors on the CPU, move all the Tensors to the specified GPU (or do nothing, if they should be on the CPU). """ if cuda_device < 0 or not has_tensor(obj): return obj elif isinstance(obj, torch.Tensor)...
0.004213
def p_mp_createClass(p): """mp_createClass : classDeclaration """ # pylint: disable=too-many-branches,too-many-statements,too-many-locals ns = p.parser.handle.default_namespace cc = p[1] try: fixedNS = fixedRefs = fixedSuper = False while not fixedNS or not fix...
0.000338
def GET_namespaces( self, path_info ): """ Get the list of all namespaces Reply all existing namespaces Reply 502 if we can't reach the server for whatever reason """ qs_values = path_info['qs_values'] offset = qs_values.get('offset', None) count = qs_valu...
0.007813
def get_epoll_events(self): """ Create a bit mask using ``EPOLL*`` family of constants. """ epoll_events = 0 if self & EVENT_READ: epoll_events |= select.EPOLLIN if self & EVENT_WRITE: epoll_events |= select.EPOLLOUT return epoll_events
0.006329
def update(self, stats, duration=3, cs_status=None, return_to_browser=False): """Update the servers' list screen. Wait for __refresh_time sec / catch key every 100 ms. stats: Dict of dict with servers stats """ # Flush...
0.007085
def p_exception(self, p): '''exception : EXCEPTION IDENTIFIER '{' field_seq '}' annotations''' p[0] = ast.Exc( name=p[2], fields=p[4], annotations=p[6], lineno=p.lineno(2) )
0.009569
def add_users_to_user_group(self, id, **kwargs): # noqa: E501 """Add multiple users to a specific user group # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.a...
0.00199
def _convert_nodelist(self, impl_nodelist): """ Convert a list of underlying implementation nodes into a list of *xml4h* wrapper nodes. """ nodelist = [ self.adapter.wrap_node(n, self.adapter.impl_document, self.adapter) for n in impl_nodelist] ret...
0.005848
def exclude_package(cls, package_name=None, recursive=False): """Excludes the given fully qualified package name from shading. :param unicode package_name: A fully qualified package_name; eg: `org.pantsbuild`; `None` for the java default (root) package. :param bool recursive...
0.005917
def patch_io_httplib(config): """ Patch the base httplib.HTTPConnection class, which is used in most HTTP libraries like urllib2 or urllib3/requests. """ # pylint: disable=import-error def start(method, url): job = get_current_job() if job: job.set_current_io({ ...
0.002211
def format_prompt(prompt=None, default=None, enable_quit=False, quit_string='q', quit_message='(enter q to Quit)'): """ Format the prompt. :param prompt: the prompt message. :param default: the default answer if user does not provide a response. :param enab...
0.007642
def maxTreeDepthDivide(rootValue, currentDepth=0, parallelLevel=2): """Finds a tree node that represents rootValue and computes the max depth of this tree branch. This function will emit new futures until currentDepth=parallelLevel""" thisRoot = shared.getConst('myTree').search(rootValue) if c...
0.001045
def string(self, string): """Load an object from a string and return the processed JSON content :return: the result of the processing step :param str string: the string to load the JSON from """ object_ = json.loads(string) return self.object(object_)
0.006667
def on(self, event): """ Returns a wrapper for the given event. Usage: @dispatch.on("my_event") def handle_my_event(foo, bar, baz): ... """ handler = self._handlers.get(event, None) if not handler: raise ValueError("U...
0.005195
def _request(self, method, identifier, key=None, value=None): """Perform request with identifier.""" params = {'id': identifier} if key is not None and value is not None: params[key] = value result = yield from self._transact(method, params) return result.get(key)
0.006329
def get_editor_buffer_for_location(self, location): """ Return the `EditorBuffer` for this location. When this file was not yet loaded, return None """ for eb in self.editor_buffers: if eb.location == location: return eb
0.006944
def train(target, dataset, cluster_spec, ctx): """Train Inception on a dataset for a number of steps.""" # Number of workers and parameter servers are infered from the workers and ps # hosts string. num_workers = len(cluster_spec.as_dict()['worker']) num_parameter_servers = len(cluster_spec.as_dict()['ps']) ...
0.011946
def _find_ancillary_vars(self, ds, refresh=False): ''' Returns a list of variable names that are defined as ancillary variables in the dataset ds. An ancillary variable generally is a metadata container and referenced from other variables via a string reference in an attribute. ...
0.001206
def cmd_split(self, line): """ Get the command associated with this input line. """ cmd, *args = line.lstrip().split(' ', 1) return self.root_command.subcommands[cmd], ' '.join(args)
0.009709
def cumulative_value(self, slip, mmax, mag_value, bbar, dbar, beta): ''' Returns the rate of events with M > mag_value :param float slip: Slip rate in mm/yr :param float mmax: Maximum magnitude :param float mag_value: Magnitude value :...
0.002509
def update_thread(cls, session, conversation, thread): """Update a thread. Args: session (requests.sessions.Session): Authenticated session. conversation (helpscout.models.Conversation): The conversation that the thread belongs to. thread (helpscout.m...
0.002424