text
stringlengths
78
104k
score
float64
0
0.18
def select_hits(hits_array, condition=None): '''Selects the hits with condition. E.g.: condition = 'rel_BCID == 7 & event_number < 1000' Parameters ---------- hits_array : numpy.array condition : string A condition that is applied to the hits in numexpr. Only if the expression evaluates...
0.003021
def sum_sp_values(self): """ return system level values (spa + spb) input: "values": { "spa": 385, "spb": 505 }, return: "values": { "0": 890 }, """ if self.values is None: ret = IdValues() ...
0.004662
def _deep_merge_dict(a, b): """Additively merge right side dict into left side dict.""" for k, v in b.items(): if k in a and isinstance(a[k], dict) and isinstance(v, dict): _deep_merge_dict(a[k], v) else: a[k] = v
0.003831
def get_pdffilepath(pdffilename): """ Returns the path for the pdf file args: pdffilename: string returns path for the plots folder / pdffilename.pdf """ return FILEPATHSTR.format( root_dir=ROOT_DIR, os_sep=os.sep, os_extsep=os.extsep, ...
0.004158
def find_column(self, input_, token): """Compute the column. Input is the input text string. token is a token instance. """ if token is None: return 0 last_cr = input_.rfind('\n', 0, token.lexpos) if last_cr < 0: last_cr = 0 column...
0.005362
def get_ceph_pools(self, sentry_unit): """Return a dict of ceph pools from a single ceph unit, with pool name as keys, pool id as vals.""" pools = {} cmd = 'sudo ceph osd lspools' output, code = sentry_unit.run(cmd) if code != 0: msg = ('{} `{}` returned {} ' ...
0.001885
def _lval_add_towards_polarity(x, polarity): """Compute the appropriate Lval "kind" for the limit of value `x` towards `polarity`. Either 'toinf' or 'pastzero' depending on the sign of `x` and the infinity direction of polarity. """ if x < 0: if polarity < 0: return Lval('toinf'...
0.002247
def writeCell(self, row, col, value): ''' write a cell ''' if self.__sheet is None: self.openSheet(super(ExcelWrite, self).DEFAULT_SHEET) self.__sheet.write(row, col, value)
0.009302
def register(self, model, values=None, instance_values=None): """ Registers a model with this group. :param values: A list of values that should be incremented \ whenever invalidate_cache is called for a instance or class \ of this type. :param instance_values: A list o...
0.002865
def update_part_with_properties(part_instance, moved_instance, name=None): """ Update the newly created part and its properties based on the original one. :param part_instance: `Part` object to be copied :type part_instance: :class:`Part` :param moved_instance: `Part` object copied :type moved_...
0.00506
def write_data(hyper_params, mode, sequence, num_threads): """ Write a tf record containing a feature dict and a label dict. :param hyper_params: The hyper parameters required for writing {"problem": {"augmentation": {"steps": Int}}} :param mode: The mode sp...
0.005435
def uploader(project, credentials=None): """The Uploader is intended for the Fine Uploader used in the web application (or similar frontend), it is not intended for proper RESTful communication. Will return JSON compatible with Fine Uploader rather than CLAM Upload XML. Unfortunately, normal digest authentication d...
0.00814
def modal(widget, parent=None, align=QtCore.Qt.AlignTop | QtCore.Qt.AlignRight, blurred=True): """ Creates a modal dialog for this overlay with the inputed widget. If the user accepts the widget, then 1 will be returned, otherwise, 0 will be returned. :param widget | <QtCore.QWidg...
0.007634
def _dig(obj, *key): """ Recursively lookup an item in a nested dictionary, using an array of indexes >>> _dig({"a":{"b":{"c":1}}}, "a", "b", "c") 1 """ key = _splice_index(*key) if len(key) == 1: return obj[key[0]] return _dig(obj[key[0]], *key[1:])
0.003378
def hierarchical_map_vals(func, node, max_depth=None, depth=0): """ node is a dict tree like structure with leaves of type list TODO: move to util_dict CommandLine: python -m utool.util_dict --exec-hierarchical_map_vals Example: >>> # ENABLE_DOCTEST >>> from utool.util_dic...
0.002808
def registerViewType(self, cls, window=None): """ Registers the inputed widget class as a potential view class. If the \ optional window argument is supplied, then the registerToWindow method \ will be called for the class. :param cls | <subclass of XView> ...
0.017606
def setData(self, index, value, role=QtCore.Qt.EditRole): """Set the data of the given index to value :param index: the index to set :type index: :class:`QtCore.QModelIndex` :param value: the value to set :param role: the role, usually edit role :type role: :data:`QtCore...
0.002882
def _html_checker(job_var, interval, status, header, _interval_set=False): """Internal function that updates the status of a HTML job monitor. Args: job_var (BaseJob): The job to keep track of. interval (int): The status check interval status (widget): HTML ipywidg...
0.000765
def emit(self): """We are finished processing one element. Emit it""" self.count += 1 # event_name = 'on_{0}'.format(self.context.subcategory.lower()) event_name = self.context.subcategory if hasattr(self.handler, event_name): getattr(self.handler, event_name)(self....
0.004739
def lsf2poly(lsf): """Convert line spectral frequencies to prediction filter coefficients returns a vector a containing the prediction filter coefficients from a vector lsf of line spectral frequencies. .. doctest:: >>> from spectrum import lsf2poly >>> lsf = [0.7842 , 1.5605 , 1.8776...
0.005711
def move_page_bottom(self): """ Move the cursor to the last item on the page. """ self.nav.page_index = self.content.range[1] self.nav.cursor_index = 0 self.nav.inverted = True
0.008929
def ratio_area_clay_total(ConcClay, material, DiamTube, RatioHeightDiameter): """Return the surface area of clay normalized by total surface area. Total surface area is a combination of clay and reactor wall surface areas. This function is used to estimate how much coagulant actually goes to the clay. ...
0.003331
def standardize_tag(tag: {str, Language}, macro: bool=False) -> str: """ Standardize a language tag: - Replace deprecated values with their updated versions (if those exist) - Remove script tags that are redundant with the language - If *macro* is True, use a macrolanguage to represent the most com...
0.002199
def user(self): """Creates a User object when requested.""" try: return self._user except AttributeError: self._user = MatrixUser(self.mxid, self.Api(identity=self.mxid)) return self._user
0.008065
def evaluate(g: Graph, schema: Union[str, ShExJ.Schema], focus: Optional[Union[str, URIRef, IRIREF]], start: Optional[Union[str, URIRef, IRIREF, START, START_TYPE]]=None, debug_trace: bool = False) -> Tuple[bool, Optional[str]]: """ Evaluate focus node `focus` in ...
0.004723
def node_style(self, node, **kwargs): ''' Modifies a node style to the dot representation. ''' if node not in self.edges: self.edges[node] = {} self.nodes[node] = kwargs
0.00905
def execute(self, program: Program): """ Execute a program on the QVM. Note that the QAM is stateful. Subsequent calls to :py:func:`execute` will not automatically reset the wavefunction or the classical RAM. If this is desired, consider starting your program with ``RESET``. ...
0.005476
def get_gene_name(cls, entry): """ get primary gene name from XML node entry :param entry: XML node entry :return: str """ gene_name = entry.find("./gene/name[@type='primary']") return gene_name.text if gene_name is not None and gene_name.text.strip() else None
0.009404
def requirement_is_installed(expr): """ Check whether a requirement is installed. :param expr: A requirement specification similar to those used in pip requirement files (a string). :returns: :data:`True` if the requirement is available (installed), :data:`False` otherwis...
0.001812
def calc_checksum(sentence): """Calculate a NMEA 0183 checksum for the given sentence. NMEA checksums are a simple XOR of all the characters in the sentence between the leading "$" symbol, and the "*" checksum separator. Args: sentence (str): NMEA 0183 formatted sentence """ if sentenc...
0.002217
def load_config(self, namespace=None, rcfile=None): """ Load file given in "rcfile". """ if namespace is None: namespace = config if namespace.scgi_url: return # already have the connection to rTorrent # Get and check config file name if not rcfi...
0.00304
def _get_ip_public(self, queue_target, url, json=False, key=None): """Request the url service and put the result in the queue_target.""" try: response = urlopen(url, timeout=self.timeout).read().decode('utf-8') except Exception as e: logger.debug("IP plugin - Cannot open ...
0.004405
def notify_batch_pending(self, batch): """Adds a Batch id to the pending cache, with its transaction ids. Args: batch (str): The id of the pending batch """ txn_ids = {t.header_signature for t in batch.transactions} with self._lock: self._pending.add(batc...
0.003824
def to_native(self, value): """Return the value as a dict, raising error if conversion to dict is not possible""" if isinstance(value, dict): return value elif isinstance(value, six.string_types): native_value = json.loads(value) if isinstance(native_value, di...
0.008584
def get(self, cid1, cid2, annotator_id): '''Retrieve a relation label from the store. ''' t = (cid1, cid2, annotator_id) for k, v in self.kvl.scan(self.TABLE, (t, t)): return self._label_from_kvlayer(k, v)
0.008032
def __create_proper_names_lexicon(self, docs): """ Moodustab dokumendikollektsiooni põhjal pärisnimede sagedussõnastiku (mis kirjeldab, mitu korda iga pärisnimelemma esines); """ lemmaFreq = dict() for doc in docs: for word in doc[WORDS]: # 1) Leia...
0.006873
def MoveEndpointByRange(self, srcEndPoint: int, textRange: 'TextRange', targetEndPoint: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTextRange::MoveEndpointByRange. Move one endpoint of the current text range to the specified endpoint of a second text range. ...
0.006772
def requestCertificateForAddress(self, fromAddress, sharedSecret): """ Connect to the authoritative server for the domain part of the given address and obtain a certificate signed by the root certificate for that domain, then store that certificate in my local certificate storage...
0.001793
def get_stp_brief_info_output_last_instance_instance_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_brief_info = ET.Element("get_stp_brief_info") config = get_stp_brief_info output = ET.SubElement(get_stp_brief_info, "output") ...
0.003419
def nplnpt(linpt, lindir, point): """ Find the nearest point on a line to a specified point, and find the distance between the two points. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/nplnpt_c.html :param linpt: Point on a line :type linpt: 3-Element Array of floats :param lindi...
0.001091
def tab_rowstack(ListOfTabArrays, mode='nulls'): """ "Vertical stacking" of tabarrays, e.g. adding rows. Wrapper for :func:`tabular.spreadsheet.rowstack` that deals with the coloring and returns the result as a tabarray. Method calls:: data = tabular.spreadsheet.rowstack(ListOfTabArrays,...
0.002193
def append(self, parent, content): """ Select an appender and append the content to parent. @param parent: A parent node. @type parent: L{Element} @param content: The content to append. @type content: L{Content} """ appender = self.default for a in...
0.004264
def purge_all(user=None, fast=False): """ Remove all calculations of the given user """ user = user or getpass.getuser() if os.path.exists(datadir): if fast: shutil.rmtree(datadir) print('Removed %s' % datadir) else: for fname in os.listdir(datadir...
0.005929
def bpmn_diagram_to_png(bpmn_diagram, file_name): """ Create a png picture for given diagram :param bpmn_diagram: an instance of BPMNDiagramGraph class, :param file_name: name of generated file. """ g = bpmn_diagram.diagram_graph graph = pydotplus.Dot() for node in g.nodes(data=True): ...
0.005842
def plot_mv_grid_topology(self, technologies=False, **kwargs): """ Plots plain MV grid topology and optionally nodes by technology type (e.g. station or generator). Parameters ---------- technologies : :obj:`Boolean` If True plots stations, generators, etc. i...
0.002079
def Terminate(self): """ Close all open connections Loop though all the connections and commit all queries and close all the connections. This should be called at the end of your application. @author: Nick Verbeck @since: 5/12/2008 """ self.lock.acquire() try: for bucket in self.connectio...
0.055644
def from_offset(cls, chunk_type, stream_rdr, offset): """ Return an _IHDRChunk instance containing the image dimensions extracted from the IHDR chunk in *stream* at *offset*. """ px_width = stream_rdr.read_long(offset) px_height = stream_rdr.read_long(offset, 4) r...
0.005525
def assemble_amplicon_skesa(self): """ Run skesa to assemble genomes """ with progressbar(self.metadata) as bar: for sample in bar: # Initialise variables sample[self.analysistype].skesa_outdir = os.path.join( sample[self.an...
0.004913
def load_tar_lzma_data(tlfile): """Load example sinogram data from a .tar.lzma file""" tmpname = extract_lzma(tlfile) # open tar file fields_real = [] fields_imag = [] phantom = [] parms = {} with tarfile.open(tmpname, "r") as t: members = t.getmembers() members.sort(ke...
0.00077
def fovray(inst, raydir, rframe, abcorr, observer, et): """ Determine if a specified ray is within the field-of-view (FOV) of a specified instrument at a given time. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/fovray_c.html :param inst: Name or ID code string of the instrument. :ty...
0.000818
def _connect(self): """Connect to Squid Proxy Manager interface.""" if sys.version_info[:2] < (2,6): self._conn = httplib.HTTPConnection(self._host, self._port) else: self._conn = httplib.HTTPConnection(self._host, self._port, ...
0.011561
def ip(self): ''' a method to retrieve the ip of system running docker :return: string with ip address of system ''' if self.localhost.os.sysname == 'Windows' and float(self.localhost.os.release) < 10: sys_cmd = 'docker-machine ip %s' % self.vbox ...
0.008621
def get_event_buffer(self, dag_ids=None): """ Returns and flush the event buffer. In case dag_ids is specified it will only return and flush events for the given dag_ids. Otherwise it returns and flushes all :param dag_ids: to dag_ids to return events for, if None returns all ...
0.002653
def fetch(self, method, url, data=None, expected_status_code=None): """Prepare the headers, encode data, call API and provide data it returns """ kwargs = self.prepare_request(method, url, data) log.debug(json.dumps(kwargs)) response = getattr(requests, method.lower())(ur...
0.00304
def genOutputs(self, code, match): """Return a list out template outputs based on the triggers found in the code and the template they create. """ out = sorted((k, match.output(m)) for (k, m) in self.collectTriggers(match.match, code).items()) out = list(ma...
0.005525
def process_npdu(self, npdu): """encode NPDUs from the network service access point and send them to the proxy.""" if _debug: ProxyServiceNetworkAdapter._debug("process_npdu %r", npdu) # encode the npdu as if it was about to be delivered to the network pdu = PDU() npdu.encode(pd...
0.00601
def _tables_line(args): """Implements the BigQuery tables magic used to display tables in a dataset. The supported syntax is: %bigquery tables -p|--project <project_id> -d|--dataset <dataset_id> Args: args: the arguments following '%bigquery tables'. Returns: The HTML rendering for the list ...
0.013301
def run(self): """ Downloads, unzips and installs chromedriver. If a chromedriver binary is found in PATH it will be copied, otherwise downloaded. """ chromedriver_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'chromedriver_binary') chromedriver_filename ...
0.005516
def spit_config(self, conf_file=None, firstwordonly=False): """Write a config_file based on this instance. conf_file: str (or Falseish) If conf_file is Falseish, write the file to the directory where self.filename sits, if self is not already associated with such a f...
0.001147
def get_system_config_dir(): """Returns system config location. E.g. /etc/dvc.conf. Returns: str: path to the system config directory. """ from appdirs import site_config_dir return site_config_dir( appname=Config.APPNAME, appauthor=Config.APPAUTHOR ...
0.006154
def url(self): """ We will always check if this song file exists in local library, if true, we return the url of the local file. .. note:: As netease song url will be expired after a period of time, we can not use static url here. Currently, we assume that the ...
0.002581
def ystep(self): r"""Minimise Augmented Lagrangian with respect to :math:`\mathbf{y}`. """ self.Y[..., 0:-1] = sp.prox_l2( self.AX[..., 0:-1] + self.U[..., 0:-1], (self.lmbda/self.rho)*self.Wtvna, axis=self.saxes) self.Y[..., -1] = sp.prox_l1( ...
0.004975
def do_handshake(self): """Start the SSL handshake. This method only needs to be called if this transport was created with *do_handshake_on_connect* set to False (the default is True). The handshake needs to be synchronized between the both endpoints, so that SSL record level d...
0.002421
def monitor(self, msg, transformer=lambda _: _, unpack=False): """Decorator that sends a notification to all listeners when the wrapped function returns, optionally reporting said function's return value(s). msg : str Message to send to all listeners. If the message is a ...
0.001123
def query(cls, project=None, names=None, metadata=None, origin=None, tags=None, offset=None, limit=None, dataset=None, api=None, parent=None): """ Query ( List ) files, requires project or dataset :param project: Project id :param names: Name list :par...
0.001804
def validate(self, raise_unsupported=False): """ Checks if the Entry instance includes all the required fields of its type. If ``raise_unsupported`` is set to ``True`` it will also check for potentially unsupported types. If a problem is found, an InvalidStructure exception is r...
0.005007
def info_available(*names, **kwargs): ''' Return the information of the named package available for the system. refresh force a refresh if set to True (default). If set to False it depends on zypper if a refresh is executed or not. root operate on a different root direc...
0.001704
def using(_other, **kwargs): """ Callback that processes the match with a different lexer. The keyword arguments are forwarded to the lexer, except `state` which is handled separately. `state` specifies the state that the new lexer will start in, and can be an enumerable such as ('root', 'inli...
0.001778
def generate_seviri_file(seviri, platform_name): """Generate the pyspectral internal common format relative response function file for one SEVIRI """ import h5py filename = os.path.join(seviri.output_dir, "rsr_seviri_{0}.h5".format(platform_name)) sat_name = platfor...
0.000671
def show_vcs_output_vcs_nodes_vcs_node_info_node_swbd_number(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_vcs = ET.Element("show_vcs") config = show_vcs output = ET.SubElement(show_vcs, "output") vcs_nodes = ET.SubElement(output, ...
0.003185
def _handle_datapath(self, inport, packet): ''' Handle single packet on the data plane. ''' inport = self._switchyard_net.port_by_name(inport) portnum = inport.ifnum log_info("Processing packet: {}->{}".format(portnum, packet)) actions = None for tnum,t i...
0.003052
def _get_envs(self): ''' Pull the file server environments out of the master options ''' envs = set(['base']) if 'pillar_roots' in self.opts: envs.update(list(self.opts['pillar_roots'])) return envs
0.007752
def load(cls, path): """Create a new MLPipeline from a JSON specification. The JSON file format is the same as the one created by the `to_dict` method. Args: path (str): Path of the JSON file to load. Returns: MLPipeline: A new MLPipeline instan...
0.005769
def post(self, path, data=None, json_data=None, params=None): """Perform POST request""" r = requests.post(url=self.url + path, data=data, json=json_data, params=params, timeout=self.timeout) try: r.raise_for_status() except requests.exceptions.HTTPError: raise Sw...
0.009259
def recon_err(data, F, W): """Calcuate reconstruction error Parameters ---------- data : 2D array True data to recover. F : 2D array HTFA factor matrix. W : 2D array HTFA weight matrix. Returns ------- float Returns root mean squared recon...
0.011834
def filter(self, date=None, regroup=False, ignored=None, pushed=None, unmapped=None, current_workday=None): """ Return the entries as a dict of {:class:`datetime.date`: :class:`~taxi.timesheet.lines.Entry`} items. `date` can either be a single :class:`datetime.date` object to filter onl...
0.002373
def inject_instance(self, classkey=None, allow_override=False, verbose=VERBOSE_CLASS, strict=True): """ Injects an instance (self) of type (classkey) with all functions registered to (classkey) call this in the __init__ class function Args: self: the class instance ...
0.002513
def samaccountname(self, base_dn, distinguished_name): """Retrieve the sAMAccountName for a specific DistinguishedName :param str base_dn: The base DN to search within :param list distinguished_name: The base DN to search within :param list attributes: Object attributes to populate, def...
0.003901
def propagate(w, b, X, Y): """ Implement the cost function and its gradient for the propagation Arguments: w weights, a numpy array of size (dim, 1) b bias, a scalar X data of size (dim, number of examples) Y true "label" vector of size (1, number of examples) R...
0.001021
def _tree(domain, tld=False): ''' Split out a domain in its parents Leverages tldextract to take the TLDs from publicsuffix.org or makes a valiant approximation of that :param domain: dc2.ams2.example.com :param tld: Include TLD in list :return: [ 'dc2.ams2.example.com', 'ams2.example.com'...
0.003012
def get_activities_by_genus_type(self, activity_genus_type): """Gets an ``ActivityList`` corresponding to the given activity genus ``Type`` which does not include activities of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known activities or a...
0.002649
def fetch_uri(self, directory, uri): """ Use ``urllib.urlretrieve`` to download package to file in sandbox dir. @param directory: directory to download to @type directory: string @param uri: uri to download @type uri: string @returns: 0 = success or 1 for faile...
0.003342
def currency(money): """ Фильтр валюты. Форматирует цену в соответствии с установленным количеством знаков после запятой, а также добавлеят символ валюты. :param money: :return: """ decimals = getattr(settings, 'MIDNIGHT_CATALOG_DECIMALS', 2) money = round(float(money), decimals) sym...
0.003503
def p_statement(self, program): """ statement : decl | quantum_op ';' | format ';' | ignore | quantum_op error | format error """ if len(program) > 2: if program[2] != ...
0.004057
def tabText(self, tab): """ allow index or tab widget instance""" if not isinstance(tab, int): tab = self.indexOf(tab) return super(FwTabWidget, self).tabText(tab)
0.01005
def _drop_hstore_unique(self, model, field, keys): """Drops a UNIQUE constraint for the specified hstore keys.""" name = self._unique_constraint_name( model._meta.db_table, field, keys) sql = self.sql_hstore_unique_drop.format(name=self.quote_name(name)) self.execute(sql)
0.006309
def ensure_token(self, auth, name, username=None): """ Ensures the existence of a token with the specified name for the specified user. Creates a new token if none exists. If no user is specified, uses user authenticated by ``auth``. :param auth.Authentication auth: authenticati...
0.004452
def DiffAnyObjects(self, oldObj, newObj, isObjLink=False): """Diff any two Objects""" if oldObj == newObj: return True if not oldObj or not newObj: __Log__.debug('DiffAnyObjects: One of the objects is unset.') return self._looseMatch oldObjInstance = oldObj newOb...
0.020031
def iter_open(cls, name=None, interface_class=None, interface_subclass=None, interface_protocol=None, serial_number=None, port_path=None, default_timeout_ms=None): """Find and yield locally connected devices that match. Note that devices are opened (and interfaces claimd) as the...
0.008442
def walk_dirs(path, include=None, include_ext=None, exclude=None, exclude_ext=None, recursion=True, file_only=False, use_default_pattern=True, patterns=None): """ path directory path resursion True will extract all sub module of mod """ default_exclude = ['.svn', '_svn', '.git'] ...
0.004255
def get_client_ip(self): """Return the client IP from the environment.""" if self.client_ip: return self.client_ip try: client = os.environ.get('SSH_CONNECTION', os.environ.get('SSH_CLIENT')) self.client_ip = client.split(...
0.005357
def _ParsePlistKeyValue(self, knowledge_base, name, value): """Parses a plist key value. Args: knowledge_base (KnowledgeBase): to fill with preprocessing information. name (str): name of the plist key. value (str): value of the plist key. """ if not knowledge_base.GetValue('operating_...
0.004556
def complete_restore( self, location_name, operation_id, last_backup_name, custom_headers=None, raw=False, polling=True, **operation_config): """Completes the restore operation on a managed database. :param location_name: The name of the region where the resource is located. ...
0.003666
async def remove(self, *instances, using_db=None) -> None: """ Removes one or more of ``instances`` from the relation. """ db = using_db if using_db else self.model._meta.db if not instances: raise OperationalError("remove() called on no instances") through_ta...
0.006522
def nsx_controller_connection_addr_method(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") nsx_controller = ET.SubElement(config, "nsx-controller", xmlns="urn:brocade.com:mgmt:brocade-tunnels") name_key = ET.SubElement(nsx_controller, "name") name...
0.004862
def register(self, subject, avro_schema): """ POST /subjects/(string: subject)/versions Register a schema with the registry under the given subject and receive a schema id. avro_schema must be a parsed schema from the python avro library Multiple instances of the same s...
0.001908
def get_angle_between(self, other): """Returns the smallest angle between this vector and the given other vector.""" # The scalar product is the sum of the squares of the # magnitude times the cosine of the angle - so normalizing the # vectors first means the scalar product is ju...
0.003831
def add_annotation( self, subj: URIRef, pred: URIRef, obj: Union[Literal, URIRef], a_p: URIRef , a_o: Union[Literal, URIRef], ) -> BNode: """ Adds annotation to rdflib graph. The annotation axiom will filled in if this is a...
0.007807
def _ssl_agent(self): """ Get a Twisted Agent that performs Client SSL authentication for Koji. """ # Load "cert" into a PrivateCertificate. certfile = self.lookup(self.profile, 'cert') certfile = os.path.expanduser(certfile) with open(certfile) as certfp: ...
0.002364
def get_organization(self, **kwargs): """Get the organization to which the user belongs Returns: dictionary of the response """ resp = self._get(self._u(self._ORGANIZATION_ENDPOINT_SUFFIX), **kwargs) resp.raise_for_status() return res...
0.006098