text
stringlengths
78
104k
score
float64
0
0.18
def _remove_esc_chars(self, raw_message): """ Removes any escape characters from the message :param raw_message: a list of bytes containing the un-processed data :return: a message that has the escaped characters appropriately un-escaped """ message = [] escape_ne...
0.004615
def consult_error_hook(self, item_session: ItemSession, error: BaseException): '''Return scripting action when an error occured.''' try: return self.hook_dispatcher.call( PluginFunctions.handle_error, item_session, error) except HookDisconnected: return Ac...
0.006024
def _parse_kraken_output(out_dir, db, data): """Parse kraken stat info comming from stderr, generating report with kraken-report """ in_file = os.path.join(out_dir, "kraken_out") stat_file = os.path.join(out_dir, "kraken_stats") out_file = os.path.join(out_dir, "kraken_summary") kraken_cm...
0.001715
def ensure_resource_data(self, update_data=False): """Retrieves data from OneView and updates resource object. Args: update_data: Flag to update resource data when it is required. """ # Check for unique identifier in the resource data if not any(key in self.data for ...
0.002398
def fetch_url(src, dst): """ Fetch file from URL src and save it to dst. """ # we do not use the nicer sys.version_info.major # for compatibility with Python < 2.7 if sys.version_info[0] > 2: import urllib.request class URLopener(urllib.request.FancyURLopener): def h...
0.00107
def MakeDestinationKey(directory, filename): """Creates a name that identifies a database file.""" return utils.SmartStr(utils.JoinPath(directory, filename)).lstrip("/")
0.017341
def decode_html_entities(s): """ Replaces html entities with the character they represent. >>> print(decode_html_entities("&lt;3 &amp;")) <3 & """ parser = HTMLParser.HTMLParser() def unesc(m): return parser.unescape(m.group()) return re.sub(r'(&[^;]+;)', unesc, ensure_...
0.003021
def unixtime(cdf_time, to_np=False): # @NoSelf """ Encodes the epoch(s) into seconds after 1970-01-01. Precision is only kept to the nearest microsecond. If to_np is True, then the values will be returned in a numpy array. """ import datetime time_list = CDFepo...
0.007223
def _resolve_to_field_class(self, names, scope): """Resolve the names to a class in fields.py, resolving past typedefs, etc :names: TODO :scope: TODO :ctxt: TODO :returns: TODO """ switch = { "char" : "Char", "int" : "Int",...
0.010916
def submit(self, info, *flags): """Finish recording and upload or save the report. This closes the `Stats` object, no further methods should be called. The report is either saved, uploaded or discarded, depending on configuration. If uploading is enabled, previous reports might be ...
0.001079
def get_column(self, field, components=None, computed_type='for_observations'): """ TODO: add documentation return a dictionary for a single column, with component as keys and the column array as values :parameter str field: name of the mesh columnname :parameter compon...
0.004147
def last_month(): """ Return start and end date of this month. """ since = TODAY + delta(day=1, months=-1) until = since + delta(months=1) return Date(since), Date(until)
0.009901
def parse_qs(qs, keep_blank_values=0, strict_parsing=0, keep_attr_order=True): """ Kind of like urlparse.parse_qs, except returns an ordered dict. Also avoids replicating that function's bad habit of overriding the built-in 'dict' type. Taken from below with modification: <https://bitbucket.org...
0.00177
def view(cloudpath, hostname="localhost", port=DEFAULT_PORT): """Start a local web app on the given port that lets you explore this cutout.""" def handler(*args): return ViewerServerHandler(cloudpath, *args) myServer = HTTPServer((hostname, port), handler) print("Neuroglancer server listening to http://{}:...
0.016393
def is_address_guard(self, address): """ Determines if an address belongs to a guard page. @note: Returns always C{False} for kernel mode addresses. @type address: int @param address: Memory address to query. @rtype: bool @return: C{True} if the address belon...
0.003003
def CreateClientPool(n): """Create n clients to run in a pool.""" clients = [] # Load previously stored clients. try: certificates = [] with open(flags.FLAGS.cert_file, "rb") as fd: # Certificates are base64-encoded, so that we can use new-lines as # separators. for l in fd: c...
0.014727
def _gen_labels_columns(self, list_columns): """ Auto generates pretty label_columns from list of columns """ for col in list_columns: if not self.label_columns.get(col): self.label_columns[col] = self._prettify_column(col)
0.006969
def default_logging(grab_log=None, # '/tmp/grab.log', network_log=None, # '/tmp/grab.network.log', level=logging.DEBUG, mode='a', propagate_network_logger=False): """ Customize logging output to display all log messages except grab network logs. ...
0.003517
def read_identifiables(self, cls, sdmxobj, offset=None): ''' If sdmxobj inherits from dict: update it with modelized elements. These must be instances of model.IdentifiableArtefact, i.e. have an 'id' attribute. This will be used as dict keys. If sdmxobj does not inherit fr...
0.0025
def get_tunnel_statistics_output_tunnel_stat_rx_bytes(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_tunnel_statistics = ET.Element("get_tunnel_statistics") config = get_tunnel_statistics output = ET.SubElement(get_tunnel_statistics, "output...
0.003466
def get_arg_name(self, param): """ gets the argument name used in the command table for a parameter """ if self.current_command in self.cmdtab: for arg in self.cmdtab[self.current_command].arguments: for name in self.cmdtab[self.current_command].arguments[arg].options_list: ...
0.009709
def read_csv_as_integer(csv_name, integer_columns, usecols=None): """Returns a DataFrame from a .csv file stored in /data/raw/. Converts columns specified by 'integer_columns' to integer. """ csv_path = os.path.join(DATA_FOLDER, csv_name) csv = pd.read_csv(csv_path, low_memory=False, usecols=usecols...
0.001949
def get(vals, key, default_val=None): """ Returns a dictionary value """ val = vals for part in key.split('.'): if isinstance(val, dict): val = val.get(part, None) if val is None: return default_val else: return default_val retu...
0.003067
def deletegroup(self, group_id): """ Deletes an group by ID :param group_id: id of the group to delete :return: True if it deleted, False if it couldn't. False could happen for several reasons, but there isn't a good way of differentiating them """ request = requests.del...
0.007692
def getDwordAtOffset(self, offset): """ Returns a C{DWORD} from a given offset. @type offset: int @param offset: The offset to get the C{DWORD} from. @rtype: L{DWORD} @return: The L{DWORD} obtained at the given offset. """ return datatyp...
0.015625
def paint(self, painter, option, index): """Paint text""" icon_rect = QtCore.QRectF(option.rect).adjusted(3, 3, -3, -3) icon_rect.setWidth(14) icon_rect.setHeight(14) icon_color = colors["idle"] icon = icons[index.data(model.Type)] if index.data(model.Type) == ...
0.001147
def add_layer_from_env(self): """This function creates a new layer, gets a list of all the current attributes, and attempts to find matching environment variables with the prefix of FJS\_. If matches are found it sets those attributes in the new layer. """ self.add_layer(...
0.005703
def rename_script(rename=None): # noqa: E501 """Rename a script Rename a script # noqa: E501 :param rename: The data needed to save this script :type rename: dict | bytes :rtype: Response """ if connexion.request.is_json: rename = Rename.from_dict(connexion.request.get_json()) #...
0.002786
def num_taps(sample_rate, transitionwidth, gpass, gstop): """Returns the number of taps for an FIR filter with the given shape Parameters ---------- sample_rate : `float` sampling rate of target data transitionwidth : `float` the width (in the same units as `sample_rate` of the tra...
0.001185
def isVisible(self): """ Returns whether or not this connection is visible. If either node it is connected to is hidden, then it should be as well. :return <bool> """ in_node = self.inputNode() out_node = self.outputNode() if in_node and not...
0.008475
def deprecated(message): # pragma: no cover """ Raise a `DeprecationWarning` when wrapped function/method is called. Borrowed from https://stackoverflow.com/a/48632082/866026 """ def deprecated_decorator(func): """Deprecation decorator.""" @wraps(func) def deprecated_func...
0.001475
def before_render(self): """Before template render hook """ super(BatchFolderContentsView, self).before_render() if self.context.portal_type == "BatchFolder": self.request.set("disable_border", 1)
0.008299
def get_specification_info(self, obj): """Returns the info for a Specification """ info = self.get_base_info(obj) results_range = obj.getResultsRange() info.update({ "results_range": results_range, "sample_type_uid": obj.getSampleTypeUID(), "s...
0.00139
def sub_path(self): """The path of the partition source, excluding the bundle path parts. Includes the revision. """ try: return os.path.join(*(self._local_parts())) except TypeError as e: raise TypeError( "Path failed for partition {} :...
0.005063
def __new_argv(self, *new_pargs, **new_kargs): """Calculate new argv and extra_argv values resulting from adding the specified positional and keyword arguments.""" new_argv = self.argv.copy() new_extra_argv = list(self.extra_argv) for v in new_pargs: arg_name = None...
0.008423
def _expand_alternates(self, phonetic): """Expand phonetic alternates separated by |s. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code """ alt_start =...
0.001873
def fibonacci_approx(n): r""" approximate value (due to numerical errors) of fib(n) using closed form expression Args: n (int): Returns: int: the n-th fib number CommandLine: python -m utool.util_alg fibonacci_approx Example: >>> # DISABLE_DOCTEST ...
0.001527
def threat(self, name, **kwargs): """Add Threat data to Batch object Args: name (str): The name for this Group. date_added (str, kwargs): The date timestamp the Indicator was created. xid (str, kwargs): The external id for this Group. Returns: ob...
0.006849
def get_all_snapshots(self): """ This method returns a list of all Snapshots. """ data = self.get_data("snapshots/") return [ Snapshot(token=self.token, **snapshot) for snapshot in data['snapshots'] ]
0.007246
def save(self, *args, **kwargs): """ This save method protects against two processesses concurrently modifying the same object. Normally the second save would silently overwrite the changes from the first. Instead we raise a ConcurrentModificationError. """ cls = self.__c...
0.004415
def playSound(folder, name=""): """ as easy as that """ try: if not name: onlyfiles = [ f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f)) ] name = random.choice(onlyfiles) subprocess.call(["afplay", folder...
0.004651
def predict_interval(self, X, percentile, nsamples=200, likelihood_args=(), multiproc=True): """ Predictive percentile interval (upper and lower quantiles). Parameters ---------- X : ndarray (N*,d) array query input dataset (N* samples, D dim...
0.001502
def linkify(buildroot, s, memoized_urls): """Augment text by heuristically finding URL and file references and turning them into links. :param string buildroot: The base directory of the project. :param string s: The text to insert links into. :param dict memoized_urls: A cache of text to links so repeated sub...
0.014841
def add_distinguished_name(list_name, item_name): ''' Adds a distinguished name to a distinguished name list. list_name(str): The name of the specific policy distinguished name list to append to. item_name(str): The distinguished name to append. CLI Example: .. code-block:: bash sal...
0.004292
def cleanup(self): """DataFlowKernel cleanup. This involves killing resources explicitly and sending die messages to IPP workers. If the executors are managed (created by the DFK), then we call scale_in on each of the executors and call executor.shutdown. Otherwise, we do nothing, and ...
0.003814
def derive_logger(self, logger): """ Return a child of `logger` specific for this instance. This is called after :attr:`client` has been set, from the constructor. The child name is calculated by the default implementation in a way specific for aioxmpp services; it is not meant ...
0.002959
def vm_reconfig_task(vm, device_change): """ Create Task for VM re-configure :param vm: <vim.vm obj> VM which will be re-configure :param device_change: :return: Task """ config_spec = vim.vm.ConfigSpec(deviceChange=device_change) task = vm.ReconfigVM_Task...
0.005666
def console_from_file(filename: str) -> tcod.console.Console: """Return a new console object from a filename. The file format is automactially determined. This can load REXPaint `.xp`, ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files. Args: filename (Text): The path to the file, as a s...
0.002041
def unit_tangent(self, T): """returns the unit tangent vector of the Path at T (centered at the origin and expressed as a complex number). If the tangent vector's magnitude is zero, this method will find the limit of self.derivative(tau)/abs(self.derivative(tau)) as tau approaches T."""...
0.004902
def fail(self, key, **kwargs): """ A helper method that simply raises a validation error. """ try: msg = self.error_messages[key] except KeyError: class_name = self.__class__.__name__ msg = MISSING_ERROR_MESSAGE.format(class_name=class_name, ke...
0.004386
def get_classes(self): """ Returns all Java Classes from the DEX objects as an array of DEX files. """ for idx, digest in enumerate(self.analyzed_vms): dx = self.analyzed_vms[digest] for vm in dx.vms: filename = self.analyzed_digest[digest] ...
0.005348
def _compute_iso_line(self): """ compute LineVisual vertices, connects and color-index """ level_index = [] connects = [] verts = [] # calculate which level are within data range # this works for now and the existing examples, but should be tested # thoro...
0.001294
def QA_fetch_stock_day(code, start, end, format='numpy', frequence='day', collections=DATABASE.stock_day): """'获取股票日线' Returns: [type] -- [description] 感谢@几何大佬的提示 https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/#return-the-specified-fields-and-the-id-field-on...
0.0047
def load_commands(cli, manage_dict): """Loads the commands defined in manage file""" namespaced = manage_dict.get('namespaced') # get click commands commands = manage_dict.get('click_commands', []) for command_dict in commands: root_module = import_string(command_dict['module']) gro...
0.000412
async def reseed_apply(self) -> DIDInfo: """ Replace verification key with new verification key from reseed operation. Raise WalletState if wallet is closed. :return: DIDInfo with new verification key and metadata for DID """ LOGGER.debug('Wallet.reseed_apply >>>') ...
0.007028
def create(cls, cards, custom_headers=None): """ :type user_id: int :param cards: The cards that need to be updated. :type cards: list[object_.CardBatchEntry] :type custom_headers: dict[str, str]|None :rtype: BunqResponseCardBatch """ if custom_headers i...
0.002913
def set_extractor_processor_inputs(self, extractor_processors, sub_output=None): """Instead of specifying fields in the source document to rename for the extractor, allows the user to specify ExtractorProcessors that are executed earlier in the chain and ge...
0.001944
def iiif_image_handler(prefix=None, identifier=None, path=None, config=None, klass=None, auth=None, **args): """Handler for IIIF Image Requests. Behaviour for case of a non-authn or non-authz case is to return 403. """ if (not auth or degraded_request(identifier) or auth.imag...
0.001918
def resolve_network_cidr(ip_address): ''' Resolves the full address cidr of an ip_address based on configured network interfaces ''' netmask = get_netmask_for_address(ip_address) return str(netaddr.IPNetwork("%s/%s" % (ip_address, netmask)).cidr)
0.003704
def normalize_query(query): """Normalize query: sort params by name, remove params without value. >>> normalize_query('z=3&y=&x=1') 'x=1&z=3' """ if query == '' or len(query) <= 2: return '' nquery = unquote(query, exceptions=QUOTE_EXCEPTIONS['query']) params = nquery.split('&') ...
0.001842
def DrainTaskSchedulerQueueForClient(self, client, max_count=None): """Drains the client's Task Scheduler queue. 1) Get all messages in the client queue. 2) Sort these into a set of session_ids. 3) Use data_store.DB.ResolvePrefix() to query all requests. 4) Delete all responses for retransmitted me...
0.007896
def _handle_exists(self, node, scope, ctxt, stream): """Handle the exists unary operator :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ res = fields.Int() try: self._handle_node(node.expr, scope, ctxt, stream) ...
0.004566
def _format_axes(axes, shape): """ Format target axes given an array shape """ if isinstance(axes, int): axes = (axes,) elif isinstance(axes, list) or hasattr(axes, '__iter__'): axes = tuple(axes) if not isinstance(axes, tuple): raise V...
0.006981
def count(self): """ count: get number of nodes in tree Args: None Returns: int """ total = len(self.children) for child in self.children: total += child.count() return total
0.008
def overlap(r1: 'Rectangle', r2: 'Rectangle'): """ Overlapping rectangles overlap both horizontally & vertically """ h_overlaps = (r1.left <= r2.right) and (r1.right >= r2.left) v_overlaps = (r1.bottom >= r2.top) and (r1.top <= r2.bottom) return h_overlaps and v_overlaps
0.00627
def escape_grouped_arguments(s): """Prepares a string for the shell (on Windows too!) Only for use on grouped arguments (passed as a string to Popen) """ if s is None: return None # Additional escaping for windows paths if os.name == "nt": s = "{}".format(s.replace("\\", "\\\\"...
0.00271
def ProjectHomeRelative(self): """ Returns the :attr:`ProjectHome` relative to :attr:`FileName` directory. """ return os.path.relpath(self.ProjectHome, os.path.dirname(self.FileName))
0.013953
def make_qq_plot(kev, obs, mdl, unit, key_text): """Make a quantile-quantile plot comparing events and a model. *kev* A 1D, sorted array of event energy bins measured in keV. *obs* A 1D array giving the number or rate of events in each bin. *mdl* A 1D array giving the modeled number o...
0.001042
def get_credentials(self): """Get read-only credentials. Returns: class: Read-only credentials. """ return ReadOnlyCredentials( self.access_token, self.client_id, self.client_secret, self.refresh_token )
0.007117
def _avg(value1, value2, weight): """Returns the weighted average of two values and handles the case where one value is None. If both values are None, None is returned. """ if value1 is None: return value2 if value2 is None: return value1 retur...
0.00831
def remove_plugin(self, f): """Remvoing a deleted plugin. Args: f: the filepath for the plugin. """ if f.endswith('.py'): plugin_name = os.path.splitext(os.path.basename(f))[0] print '- %s %sREMOVED' % (plugin_name, color.Red) print '\t%sN...
0.007042
def scale(arr, mn=0, mx=1): """ Apply min-max scaling (normalize) then scale to (mn,mx) """ amn = arr.min() amx = arr.max() # normalize: arr = (arr - amn) / (amx - amn) # scale: if amn != mn or amx != mx: arr *= mx - mn arr += mn return arr
0.003333
def get(self, channel): """Read single ADC Channel""" checked_channel = self._check_channel_no(channel) self.i2c.write_raw8(checked_channel | self._dac_enabled) reading = self.i2c.read_raw8() reading = self.i2c.read_raw8() return reading / 255.0
0.016892
def _new_from_xml(cls, xmlnode): """Create a new `Option` object from an XML element. :Parameters: - `xmlnode`: the XML element. :Types: - `xmlnode`: `libxml2.xmlNode` :return: the object created. :returntype: `Option` """ label = from_ut...
0.002778
def draw_polygon_with_info(ax, polygon, off_x=0, off_y=0): """Draw one of the natural neighbor polygons with some information.""" pts = np.array(polygon)[ConvexHull(polygon).vertices] for i, pt in enumerate(pts): ax.plot([pt[0], pts[(i + 1) % len(pts)][0]], [pt[1], pts[(i + 1) % len(...
0.004032
def _update_limits_from_api(self): """ Query Lambda's DescribeLimits API action, and update limits with the quotas returned. Updates ``self.limits``. """ logger.debug("Updating limits for Lambda from the AWS API") if len(self.limits) == 2: return self....
0.002058
def get_sorted_proposal_list(self): """Return a list of `CodeAssistProposal`""" proposals = {} for proposal in self.proposals: proposals.setdefault(proposal.scope, []).append(proposal) result = [] for scope in self.scopepref: scope_proposals = proposals.ge...
0.003378
def parse_error(self, tup_tree): """ Parse the tuple for an ERROR element: :: <!ELEMENT ERROR (INSTANCE*)> <!ATTLIST ERROR CODE CDATA #REQUIRED DESCRIPTION CDATA #IMPLIED> """ self.check_node(tup_tree, 'ERROR', ('CODE',...
0.002933
def _cost_func(x, kernel_options, tuning_options, runner, results, cache): """ Cost function used by minimize """ error_time = 1e20 logging.debug('_cost_func called') logging.debug('x: ' + str(x)) x_key = ",".join([str(i) for i in x]) if x_key in cache: return cache[x_key] #snap v...
0.005398
def ImportFile(store, filename, start): """Import hashes from 'filename' into 'store'.""" with io.open(filename, "r") as fp: reader = csv.Reader(fp.read()) i = 0 current_row = None product_code_list = [] op_system_code_list = [] for row in reader: # Skip first row. i += 1 i...
0.01636
def init_app(self, app, config_prefix='MONGOALCHEMY'): """This callback can be used to initialize an application for the use with this MongoDB setup. Never use a database in the context of an application not initialized that way or connections will leak.""" self.config_prefix = config_p...
0.007886
def parse_html(html, cleanup=True): """ Parses an HTML fragment, returning an lxml element. Note that the HTML will be wrapped in a <div> tag that was not in the original document. If cleanup is true, make sure there's no <head> or <body>, and get rid of any <ins> and <del> tags. """ if cl...
0.004141
def create_process(cmd, root_helper=None, addl_env=None, log_output=True): """Create a process object for the given command. The return value will be a tuple of the process object and the list of command arguments used to create it. """ if root_helper: cmd = shlex.split(root_helper) + cmd ...
0.001486
def select_warp_gates(self, shift): """Select all warp gates.""" action = sc_pb.Action() action.action_ui.select_warp_gates.selection_add = shift return action
0.005714
def scan_pressures(cryst, lo, hi, n=5, eos=None): ''' Scan the pressure axis from lo to hi (inclusive) using B-M EOS as the volume predictor. Pressure (lo, hi) in GPa ''' # Inverse B-M EOS to get volumes from pressures # This will work only in limited pressure range p>-B/B'. # Warning! R...
0.000983
def _get_snmpv3(self, oid): """ Try to send an SNMP GET operation using SNMPv3 for the specified OID. Parameters ---------- oid : str The SNMP OID that you want to get. Returns ------- string : str The string as part of the value ...
0.003756
def generate_msg(filename, msg, key, value): """ Generate a message for the output log indicating the file/association will not be processed as the characteristics of the data are known to be inconsistent with alignment. """ log.info('Dataset ' + filename + ' has (keyword = value) of (' + k...
0.007634
def battery_status_send(self, id, battery_function, type, temperature, voltages, current_battery, current_consumed, energy_consumed, battery_remaining, force_mavlink1=False): ''' Battery information id : Battery ID (uint8_t) battery...
0.00652
def check_int(val): r"""Check if input value is an int or a np.ndarray of ints, if not convert. Parameters ---------- val : any Input value Returns ------- int or np.ndarray of ints Examples -------- >>> from modopt.base.types import check_int >>> a = np.arange(5)....
0.001138
def map_coordinates(data, coordinates, interpolation="linear", mode='constant'): """ Map data to new coordinates by interpolation. The array of coordinates is used to find, for each point in the output, the corresponding coordinates in the input. should correspond to scipy.ndima...
0.00579
def format_year(year): """ Format the year value of the ``YearArchiveView``, which can be a integer or date object. This tag is no longer needed, but exists for template compatibility. It was a compatibility tag for Django 1.4. """ if isinstance(year, (date, datetime)): # Django 1.5...
0.003899
def createNetwork(dataSource): """Create the Network instance. The network has a sensor region reading data from `dataSource` and passing the encoded representation to an Identity Region. :param dataSource: a RecordStream instance to get data from :returns: a Network instance ready to run """ network = ...
0.016695
def to_internal_filter(self, attribute_profile, external_attribute_names): """ Converts attribute names from external "type" to internal :type attribute_profile: str :type external_attribute_names: list[str] :type case_insensitive: bool :rtype: list[str] :param ...
0.004484
def check_time_extrator(self): """将抽取得时间转换为date标准时间格式 Keyword arguments: string -- 含有时间的文本,str类型 Return: release_time -- 新闻发布时间 """ if self.year_check and self.month_check and self.day_check: time = str(self.year) + '-' + ...
0.004274
def schedule_enabled(): ''' Check the status of automatic update scheduling. :return: True if scheduling is enabled, False if disabled :rtype: bool CLI Example: .. code-block:: bash salt '*' softwareupdate.schedule_enabled ''' cmd = ['softwareupdate', '--schedule'] ret = ...
0.002151
def migrate_data(ignore: Sequence[str], new_data_path: str, old_data_path: str): """ Copy everything in the app data to the root of the main data part :param ignore: A list of files that should be ignored in the root of /data :param new_data_path: Where the new data partit...
0.000685
def external_system_identifiers(endpoint): """Populate the ``external_system_identifiers`` key. Also populates the ``new_record`` key through side effects. """ @utils.flatten @utils.for_each_value def _external_system_identifiers(self, key, value): new_recid = maybe_int(value.get('d')) ...
0.0016
def _parse_float_vec(vec): """ Parse a vector of float values representing IBM 8 byte floats into native 8 byte floats. """ dtype = np.dtype('>u4,>u4') vec1 = vec.view(dtype=dtype) xport1 = vec1['f0'] xport2 = vec1['f1'] # Start by setting first half of ieee number to first half of...
0.000452
def copy_file(self, from_path, to_path): """ Copy file. """ if not op.exists(op.dirname(to_path)): self.make_directory(op.dirname(to_path)) shutil.copy(from_path, to_path) logging.debug('File copied: {0}'.format(to_path))
0.007519
def build_for_contour_tree(self, contour_tree, negate=False): """ A helper function that will reduce duplication of data by reusing the parent contour tree's parameters and data """ if self.debug: tree_type = "Join" if negate: tree_type = "Spli...
0.002278