text
stringlengths
78
104k
score
float64
0
0.18
def _pdf_guess_version(input_file, search_window=1024): """Try to find version signature at start of file. Not robust enough to deal with appended files. Returns empty string if not found, indicating file is probably not PDF. """ with open(input_file, 'rb') as f: signature = f.read(search...
0.002347
def import_translations(request, language): """ Importa las traducciones a partir de un archivo PO. Ten en cuenta que el archivo PO ha de ser generado desde esta aplicación, de forma que los comentarios sirvan como id de traducción (lo metemos nosotros en la exportación). """ def _import_po_file(uploadedfile, la...
0.036364
def as_child(cls, global_config, parent=None): '''Run a single job in a child process. This method never returns; it always calls :func:`sys.exit` with an error code that says what it did. ''' try: setproctitle('rejester worker') random.seed() # otherwi...
0.001618
def adapt(self, all_ouputs: AllOutputs) -> DataPacket: """Adapt inputs for the transformer included in the step. Args: all_ouputs: Dict of outputs from parent steps. The keys should match the names of these steps and the values should be their respective outp...
0.00304
def get_objective_admin_session_for_objective_bank(self, objective_bank_id=None): """Gets the OsidSession associated with the objective admin service for the given objective bank. arg: objectiveBankId (osid.id.Id): the Id of the objective bank return: (osid.learning.O...
0.003037
def top_x_bleu(query_dic, mark, x=1): """ Calculate the top x average bleu value predictions ranking by item, x default is set above :param query_dic: dict, key is qid, value is (item, bleu) tuple list, which will be ranked by 'item' as key :param mark:string, which indicates which method is evaluat...
0.004605
def is_token_valid(self, token): """ Checks validity of a given token :param token: Access or refresh token """ try: _tinfo = self.handler.info(token) except KeyError: return False if is_expired(int(_tinfo['exp'])) or _tinfo['black_liste...
0.002653
def fate(name): """Download and return a path to a sample from the FFmpeg test suite. Data is handled by :func:`cached_download`. See the `FFmpeg Automated Test Environment <https://www.ffmpeg.org/fate.html>`_ """ return cached_download('http://fate.ffmpeg.org/fate-suite/' + name, ...
0.007673
def wrap_file(file_like_obj): """Wrap a file like object in an async stream wrapper. Files generated with `open()` may be one of several types. This convenience function retruns the stream wrapped in the most appropriate wrapper for the type. If the stream is already wrapped it is returned unaltere...
0.000921
def upload_large_items(self): """ Upload files that were too large. """ for local_file, parent in self.large_items: if local_file.need_to_send: self.process_large_file(local_file, parent)
0.008097
def route(rule=None, **kwargs): """ This decorator defines custom route for both class and methods in the view. It behaves the same way as Flask's @app.route on class: It takes the following args - rule: the root route of the endpoint - decorators: a list of decorators t...
0.001656
def _find_best_root(self, covariation=True, force_positive=True, slope=0, **kwarks): ''' Determine the node that, when the tree is rooted on this node, results in the best regression of temporal constraints and root to tip distances. Parameters ---------- infer_gtr : b...
0.009585
def this_week_day(base_date, weekday): """ Finds coming weekday """ day_of_week = base_date.weekday() # If today is Tuesday and the query is `this monday` # We should output the next_week monday if day_of_week > weekday: return next_week_day(base_date, weekday) start_of_this_week...
0.001984
def setup_menus(): '''setup console menus''' global TopMenu TopMenu.add(MPMenuSubMenu('Display', items=[MPMenuItem('Map', 'Map', '# map'), MPMenuItem('Save Graph', 'Save', '# save'), MPMenuItem('Reload Graphs', 'R...
0.0053
def register(linter): """ Registering additional checkers. """ # add all of the checkers register_checkers(linter) # register any checking fiddlers try: from pylint_django.augmentations import apply_augmentations apply_augmentations(linter) except ImportError: # ...
0.001805
def assemble_request(method, params=tuple(), id=0): """serialize JSON-RPC-Request :Parameters: - method: the method-name (str/unicode) - params: the parameters (list/tuple) - id: if id=None, this results in a Notification :Returns: | {"method": "...", "...
0.00225
def resultsFor( self, ps ): """Retrieve a list of all results associated with the given parameters. :param ps: the parameters :returns: a list of results, which may be empty""" k = self._parametersAsIndex(ps) if k in self._results.keys(): # filter out pending job ids...
0.012712
def _generate_examples(self, archive): """Generate Cats vs Dogs images and labels given a directory path.""" num_skipped = 0 for fname, fobj in archive: res = _NAME_RE.match(fname) if not res: # README file, ... continue label = res.group(1).lower() if tf.compat.as_bytes("JF...
0.00955
def draw_boundary_images(glf, glb, v, f, vpe, fpe, camera): """Assumes camera is set up correctly, and that glf has any texmapping on necessary.""" glf.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glb.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); # Figure out which edges are on pairs of differ...
0.012265
def prettify_metrics(metrics: List[Tuple[str, float]], precision: int = 4) -> OrderedDict: """Prettifies the dictionary of metrics.""" prettified_metrics = OrderedDict() for key, value in metrics: value = round(value, precision) prettified_metrics[key] = value return prettified_metrics
0.006289
def threadpool_map(task, args, message, concurrency, batchsize=1, nargs=None): """ Helper to map a function over a range of inputs, using a threadpool, with a progress meter """ import concurrent.futures njobs = get_njobs(nargs, args) show_progress = bool(message) batches = grouper(batchsi...
0.005046
def vis_init(self): ''' Sends the state of the BTC at the time the visualizer connects, initializing it. ''' init_dict = {} init_dict['kind'] = 'init' assert len(self.want_file_pos) == len(self.heads_and_tails) init_dict['want_file_pos'] = self.want_file_p...
0.003922
def dispatch_query(self, msg): """Route registration requests and queries from clients.""" try: idents, msg = self.session.feed_identities(msg) except ValueError: idents = [] if not idents: self.log.error("Bad Query Message: %r", msg) retur...
0.004409
def lowstrip(term): """Convert to lowercase and strip spaces""" term = re.sub('\s+', ' ', term) term = term.lower() return term
0.013986
def _is_path(s): """Return whether an object is a path.""" if isinstance(s, string_types): try: return op.exists(s) except (OSError, ValueError): return False else: return False
0.004219
def clear_schema(self): """Clear all gauged data""" execute = self.cursor.execute execute('TRUNCATE TABLE gauged_data') execute('TRUNCATE TABLE gauged_keys') execute('TRUNCATE TABLE gauged_writer_history') execute('TRUNCATE TABLE gauged_cache') execute('TRUNCATE T...
0.00542
def has_constant_expr(expr): """ Report whether a model expression has constant specific term. That is, a term explicitly specying whether the model should or should not include a constant. (e.g. '+ 1' or '- 1'.) Parameters ---------- expr : str Model expression to check. Retur...
0.001595
def extract_intervals(text, repeat=False, sort=True): """ >>> extract_intervals("1,2,3") [1, 2, 3] >>> extract_intervals("1,2,5-10") [1, 2, 5, 6, 7, 8, 9, 10] >>> extract_intervals("1,2,5-10,3") [1, 2, 3, 5, 6, 7, 8, 9, 10] >>> extract_intervals("1,2,5-10,6,7") [1, 2, 5, 6, 7, 8, 9, ...
0.001221
def parse_reports(self): """ Find Picard BaseDistributionByCycleMetrics reports and parse their data """ # Set up vars self.picard_baseDistributionByCycle_data = dict() self.picard_baseDistributionByCycle_samplestats = dict() # Go through logs and find Metrics base_dist_files = self.find_log_f...
0.006725
def split_name(name): """Extracts pieces of name from full name string. Full name can have one of these formats: <NAME_TEXT> | /<NAME_TEXT>/ | <NAME_TEXT> /<NAME_TEXT>/ | /<NAME_TEXT>/ <NAME_TEXT> | <NAME_TEXT> /<NAME_TEXT>/ <NAME_TEXT> <NAME_TEXT> can include almos...
0.000901
def readline(self, timeout): """ Read a line from the socket. We assume no data is pending after the line, so it's okay to attempt large reads. """ buf = self.__remainder while not '\n' in buf: buf += self._read_timeout(timeout) n = buf.index('\n') ...
0.006369
def delete(self): """Delete the customer payment profile remotely and locally""" response = delete_payment_profile(self.customer_profile.profile_id, self.payment_profile_id) response.raise_if_error() return super(CustomerPaymentProfile, self).del...
0.006154
def parse_second_row(row, url): """ Static method that parses a given table row element by using helper methods `Parser.parse_category_subcategory_and_or_quality`, `Parser.parse_torrent_link` and scrapping torrent's category, subcategory, quality, language, user, user url, torrent link, size, ...
0.005814
def _progenitor_setup(self,progenitor,leading,useTMHessian): """The part of the setup relating to the progenitor's orbit""" #Progenitor orbit: Calculate actions, frequencies, and angles for the progenitor self._progenitor= progenitor() #call to get new Orbit # Make sure we do not use phy...
0.020418
def _set_fru(self, v, load=False): """ Setter method for fru, mapped from YANG variable /system_monitor_mail/fru (container) If this variable is read-only (config: false) in the source YANG file, then _set_fru is considered as a private method. Backends looking to populate this variable should d...
0.006427
def cipher_block (self, state): """Perform AES block cipher on input""" # PKCS7 Padding state=state+[16-len(state)]*(16-len(state))# Fails test if it changes the input with += self._add_round_key(state, 0) for i in range(1, self._Nr): self._sub_bytes(state) ...
0.010657
def E(self,*args,**kwargs): """ NAME: E PURPOSE: calculate the energy INPUT: t - (optional) time at which to get the energy (can be Quantity) pot= Potential instance or list of such instances vo= (Object-wide default) physical...
0.016393
def _ConvertMapFieldValue(self, value, message, field): """Convert map field value for a message map field. Args: value: A JSON object to convert the map field value. message: A protocol message to record the converted data. field: The descriptor of the map field to be converted. Raises:...
0.004826
def find_element(self, search): ''' DOM_performSearch(self, query, includeUserAgentShadowDOM) Python Function: DOM_performSearch Domain: DOM Method name: performSearch WARNING: This function is marked 'Experimental'! Parameters: 'query' (type: string) -...
0.03462
def delete_char(event): " Delete character before the cursor. " deleted = event.current_buffer.delete(count=event.arg) if not deleted: event.cli.output.bell()
0.005618
def get_template_debug(template_name, error): ''' This structure is what Django wants when errors occur in templates. It gives the user a nice stack trace in the error page during debug. ''' # This is taken from mako.exceptions.html_error_template(), which has an issue # in Py3 where files get l...
0.002048
def best_four_point(self): """ 判斷買點或賣點 :rtype: tuple :returns: (bool, str) """ buy = self.best_four_point_to_buy() sell = self.best_four_point_to_sell() if buy: return True, buy elif sell: return False, sell retur...
0.006135
def determine_convergence(xs, ys, name, tol=0.0001, extra='', verbose=False, mode='extra', plots=True): """ test it and at which x_value dy(x)/dx < tol for all x >= x_value, conv is true is such a x_value exists. """ if len(xs) != len(ys): raise RuntimeError('the range of x and y are not equal')...
0.001924
def close(self): """ Close the web socket connection and stop processing results. If the connection is still open, a WebSocket close message will be sent to the peer. """ if not self.connected: return self.connected = False if self.handler.wfile.closed: return if select.select([], [self.handler....
0.038031
def strip_suffix(s, suffix, strict=False): """Removes the suffix, if it's there, otherwise returns input string unchanged. If strict is True, also ensures the suffix was present""" if s.endswith(suffix): return s[: len(s) - len(suffix)] elif strict: raise WimpyError("string doesn't end w...
0.005797
def probe(cls, resource, enable, disable, test, host, interval, http_method, http_response, threshold, timeout, url, window): """ Set a probe for a webaccelerator """ params = { 'host': host, 'interval': interval, 'method': http_method, 'resp...
0.003333
def discrete(self, vertices, scale=1.0): """ Discretize into a world- space path. Parameters ------------ vertices: (n, dimension) float Points in space scale : float Size of overall scene for numerical comparisons Returns -----------...
0.003984
def _options_to_dict(df): """Make a dictionary to print.""" kolums = ["k1", "k2", "value"] d = df[kolums].values.tolist() dc = {} for x in d: dc.setdefault(x[0], {}) dc[x[0]][x[1]] = x[2] return dc
0.004219
def splunk(cmd, user='admin', passwd='changeme'): """Authenticated call to splunk""" return sudo('/opt/splunkforwarder/bin/splunk {c} -auth {u}:{p}' .format(c=cmd, u=user, p=passwd))
0.004854
def compress_waveform(htilde, sample_points, tolerance, interpolation, precision, decomp_scratch=None, psd=None): """Retrieves the amplitude and phase at the desired sample points, and adds frequency points in order to ensure that the interpolated waveform has a mismatch with the full ...
0.000342
def is_byte_range_valid(start, stop, length): """Checks if a given byte content range is valid for the given length. .. versionadded:: 0.7 """ if (start is None) != (stop is None): return False elif start is None: return length is None or length >= 0 elif length is None: ...
0.002375
def buildLegend(legend=None, text=None, regex=None, key=lambda v: v): ''' Helper method to build or extend a legend from a text. The given regex will be used to find legend inside the text. :param dict legend: Initial legend data :param str text: Text from which should legend information ex...
0.001083
def collapseCycles(self): """Create a graph with cycles collapsed. Collapse modules participating in a cycle to a single node. """ # This algorithm determines Strongly Connected Components. Look it up. # It is adapted to suit our data structures. # Phase 0: prepare the ...
0.002141
def team_absent(name, profile="github", **kwargs): ''' Ensure a team is absent. Example: .. code-block:: yaml ensure team test is present in github: github.team_absent: - name: 'test' The following parameters are required: name This is the name o...
0.00148
def generate_df(js_dict, naming, value="value"): """Decode JSON-stat dict into pandas.DataFrame object. Helper method \ that should be called inside from_json_stat(). Args: js_dict(OrderedDict): OrderedDict with data in JSON-stat format, \ previously deserialized into a...
0.000963
def update_cell(self, row, col): """ Function that computes the update for one cell in the Game of Life """ # compute number of living neighbors neighbors = self.eight_neighbors(row, col) living_neighbors = 0 for neighbor in neighbors: if not self.is_e...
0.008078
def make_pydot_graph(layers, output_shape=True, verbose=False): """ :parameters: - layers : list List of the layers, as obtained from lasagne.layers.get_all_layers - output_shape: (default `True`) If `True`, the output shape of each layer will be displayed. - verb...
0.000444
def write_metadata(self, symbol, metadata, prune_previous_version=True, **kwargs): """ Write 'metadata' under the specified 'symbol' name to this library. The data will remain unchanged. A new version will be created. If the symbol is missing, it causes a write with empty data (None, pic...
0.006512
def canintersect(self, other): ''' Intersection is not well-defined for all pairs of multipliers. For example: {2,3} & {3,4} = {3} {2,} & {1,7} = {2,7} {2} & {5} = ERROR ''' return not (self.max < other.min or other.max < self.min)
0.039216
def get_rewritten_query(self): """Returns rewritten query or None (if any) """ rewrittenQuery = self._extract(_PartitionedQueryExecutionInfo.RewrittenQueryPath) if rewrittenQuery is not None: # Hardcode formattable filter to true for now rewrittenQuery = rewritte...
0.011933
def forward(self, x): """Feed-forward the model.""" return self.layers(x * (self._filter * self.fs_filter).expand_as(x))
0.011905
def sadd(self, key, member, *members): """Add one or more members to a set.""" return self.execute(b'SADD', key, member, *members)
0.013699
def readBatchTupleQuotes(self, symbols, start, end): ''' read batch quotes as tuple to save memory ''' if end is None: end=sys.maxint ret={} session=self.getReadSession()() try: symbolChunks=splitListEqually(symbols, 100) ...
0.015519
def download(url, path, kind='file', progressbar=True, replace=False, timeout=10., verbose=True): """Download a URL. This will download a file and store it in a '~/data/` folder, creating directories if need be. It will also work for zip files, in which case it will unzip all of the files ...
0.000597
def flow2rgb(flow, color_wheel=None, unknown_thr=1e6): """Convert flow map to RGB image. Args: flow (ndarray): Array of optical flow. color_wheel (ndarray or None): Color wheel used to map flow field to RGB colorspace. Default color wheel will be used if not specified. unkno...
0.000593
def set_group_mask(self, group_mask=ALL_GROUPS): """ Set the group mask that the Crazyflie belongs to :param group_mask: mask for which groups this CF belongs to """ self._send_packet(struct.pack('<BB', self.COMMAND_SET_GROUP_MASK, ...
0.00554
def set_sound_mode_dict(self, sound_mode_dict): """Set the matching dictionary used to match the raw sound mode.""" error_msg = ("Syntax of sound mode dictionary not valid, " "use: OrderedDict([('COMMAND', ['VALUE1','VALUE2'])])") if isinstance(sound_mode_dict, dict): ...
0.002101
def _setup_language_variables(self, lang: str): # pylint: disable=no-self-use """Check for language availability and presence of tagger files. :param lang: The language argument given to the class. :type lang: str :rtype : dict """ assert lang in TAGGERS.keys(), \ ...
0.003996
def _export(dataset_input, dataset_output, random_index_column, path, column_names=None, byteorder="=", shuffle=False, selection=False, progress=None, virtual=True, sort=None, ascending=True): """ :param DatasetLocal dataset: dataset to export :param str path: path for file :param lis[str] column_names:...
0.003722
def parse_options(): """ Parse command line arguments. Returns: options, args """ parser = argparse.ArgumentParser(description='Video downloader by radzak.', prog='RTVdownloader') urls_group = parser.add_mutually_exclusive_group(required=True) u...
0.002516
def writefits(self,fname,clobber=True, trimzero=True, binned=True, hkeys=None): """Like :meth:`pysynphot.spectrum.SourceSpectrum.writefits` but with ``binned=True`` as default. """ spectrum.CompositeSourceSpectrum.writefits(self,fname, ...
0.01083
def sync(self): """ Syncs the information for this settings out to the file system. """ if self._customFormat: self._customFormat.save(self.fileName()) else: super(XSettings, self).sync()
0.007752
def unzip_unicode(output, version): """Unzip the Unicode files.""" unzipper = zipfile.ZipFile(os.path.join(output, 'unicodedata', '%s.zip' % version)) target = os.path.join(output, 'unicodedata', version) print('Unzipping %s.zip...' % version) os.makedirs(target) for f in unzipper.namelist()...
0.004706
def _pop_digits(char_list): """Pop consecutive digits from the front of list and return them Pops any and all consecutive digits from the start of the provided character list and returns them as a list of string digits. Operates on (and possibly alters) the passed list. :param list char_list: a li...
0.001486
def from_json(payload): """ Build an object from a JSON dictionary. @param payload: a JSON dictionary which key/value pairs represent the members of the Python object to build, or ``None``. @return: an instance ``Object`` with members built from the key/value ...
0.005285
def _AnalyzeDataStream(self, mediator, file_entry, data_stream_name): """Analyzes the contents of a specific data stream of a file entry. The results of the analyzers are set in the parser mediator as attributes that are added to produced event objects. Note that some file systems allow directories to ...
0.004414
def create_project(self, name=None, project_id=None, path=None): """ Create a project and keep a references to it in project manager. See documentation of Project for arguments """ if project_id is not None and project_id in self._projects: return self._projects[pro...
0.003868
def omit(self, *props): """ Omits selected parameters from this Parameters and returns the rest as a new Parameters object. :param props: keys to be omitted from copying over to new Parameters. :return: a new Parameters object. """ result = Parameters(self) for ...
0.007792
def forward(self, x): """Feed-forward the model.""" for i in self.noise: i.data.normal_() self.generated_variables = [self.blocks[i]( th.cat([x, self.noise[i]], 1)) for i in range(self.cols)] return self.generated_variables
0.007143
def allow_event_stream(self, **kwargs): """ Allow the user of this token to access their event stream. """ scope = ScopeURI('stream', 'subscribe', {'path': '/2010-04-01/Events'}) if kwargs: scope.add_param('params', urlencode(kwargs, doseq=True)) self.capabil...
0.005831
def item_handle(loc, tokens): """Process trailers.""" out = tokens.pop(0) for i, trailer in enumerate(tokens): if isinstance(trailer, str): out += trailer elif len(trailer) == 1: if trailer[0] == "$[]": out = "_coconut.functools.partial(_coconut_igetit...
0.003618
def next(self): """Returns unicode string from the last line until the beginning of file. Gets exhausted if:: * already reached the beginning of the file on previous iteration * the file got closed When it gets exhausted, it closes the file handler. """ ...
0.006572
def plot_median_freq_evol(time_signal, signal, time_median_freq, median_freq, activations_begin, activations_end, sample_rate, file_name=None): """ ----- Brief ----- Graphical representation of the EMG median power frequency evolution time series. ----------- Descr...
0.005282
def include(self, target): """ Determine if a given value is included in the array or object using `is`. """ if self._clean.isDict(): return self._wrap(target in self.obj.values()) else: return self._wrap(target in self.obj)
0.006757
def graph_to_svg(graph): """ Turn a networkx graph into an SVG string, using graphviz dot. Parameters ---------- graph: networkx graph Returns --------- svg: string, pictoral layout in SVG format """ import tempfile import subprocess with tempfile.NamedTemporaryFile() ...
0.002088
def get_driver_script(name, name2=None): # noqa: E501 """Retrieve the contents of a script Retrieve the contents of a script # noqa: E501 :param name2: Get status of a driver with this name :type name2: str :param name: The script name. :type name: str :rtype: Response """ respon...
0.003012
def _process_response(self, response, marker_elems=None): """ Helper to process the xml response from AWS """ body = response.read() #print body if '<Errors>' not in body: rs = ResultSet(marker_elems) h = handler.XmlHandler(rs, self) xm...
0.00655
def set_id(self, dxid=None, name=None, alias=None): ''' :param dxid: App ID :type dxid: string :param name: App name :type name: string :param alias: App version or tag :type alias: string :raises: :exc:`~dxpy.exceptions.DXError` if *dxid* and some other i...
0.003489
def get_panels(self): """Returns the Panel instances registered with this dashboard in order. Panel grouping information is not included. """ all_panels = [] panel_groups = self.get_panel_groups() for panel_group in panel_groups.values(): all_panels.extend(pa...
0.005618
def _try_parse_datetime(time_str, fmts): ''' A helper function that attempts to parse the input time_str as a date. Args: time_str (str): A string representing the time fmts (list): A list of date format strings Returns: datetime: Returns a datetime object if parsed properly,...
0.00189
def chunkWidgets(self, group): ''' chunk the widgets up into groups based on their sizing hints ''' ui_groups = [] subgroup = [] for index, item in enumerate(group['items']): if getin(item, ['options', 'full_width'], False): ui_groups.append(subgroup) ...
0.002959
def compile(schema, pointer, context, scope=None): """ Compiles schema with `JSON Schema`_ draft-04. :param schema: obj to compile :type schema: Mapping :param pointer: uri of the schema :type pointer: Pointer, str :param context: context of this schema :type context: Context .. _`...
0.000101
def from_frame_summary(cls, f): """ :param FrameSummary f: :rtype: DummyFrame """ return cls(filename=f.filename, lineno=f.lineno, name=f.name, f_locals=f.locals)
0.014851
def process_forever(self, timeout=0.2): """Run an infinite loop, processing data from connections. This method repeatedly calls process_once. Arguments: timeout -- Parameter to pass to process_once. """ # This loop should specifically *not* be mutex-locked. ...
0.003284
def mutual_information(X, Y, base=2): """Calculates the mutual information between two variables, I(X;Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the mutual information Y: array-like (# samples) An array of values for...
0.004418
def unsubscribe(id_or_symbols): """ 取消订阅合约行情。取消订阅会导致合约池内合约的减少,如果当前合约池中没有任何合约,则策略直接退出。 :param id_or_symbols: 标的物 :type id_or_symbols: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] """ current_universe = Environment.get_instance().get_universe() if isinstance(...
0.002257
def _connect(self): """ Attemps connection to the server """ self.logger.info("Attempting connection to %s:%s", self.server[0], self.server[1]) try: self._open_socket() peer = self.sock.getpeername() self.logger.info("Connected to %s", str(...
0.002342
def _merge_tops_merge_all(self, tops): ''' Merge the top files into a single dictionary ''' def _read_tgt(tgt): match_type = None states = [] for item in tgt: if isinstance(item, dict): match_type = item ...
0.002423
def open_session(self): """ Open tensorflow session. Exposed for memory management. """ with self._graph.as_default(): init = tf.initialize_all_variables() self._sess = tf.Session() self._sess.run(init)
0.007874
def put(self, id): """ Update a revision by ID :param id: BSON id :return: """ collection_name = self.request.headers.get("collection") if not collection_name: self.raise_error(400, "Missing a collection name header") self.client = BaseAsyn...
0.004843