INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Returns Transaction Logging or Recovery Status.
def getXlogStatus(self): """Returns Transaction Logging or Recovery Status. @return: Dictionary of status items. """ inRecovery = None if self.checkVersion('9.0'): inRecovery = self._simpleQuery("SELECT pg_is_in_recovery();") cur = self._conn...
Returns status of replication slaves.
def getSlaveStatus(self): """Returns status of replication slaves. @return: Dictionary of status items. """ info_dict = {} if self.checkVersion('9.1'): cols = ['procpid', 'usename', 'application_name', 'client_addr', 'client_port...
Establish connection to MySQL Database.
def _connect(self): """Establish connection to MySQL Database.""" if self._connParams: self._conn = MySQLdb.connect(**self._connParams) else: self._conn = MySQLdb.connect('')
Returns list of supported storage engines.
def getStorageEngines(self): """Returns list of supported storage engines. @return: List of storage engine names. """ cur = self._conn.cursor() cur.execute("""SHOW STORAGE ENGINES;""") rows = cur.fetchall() if rows: return [row[0].low...
Returns value of Run - time Database Parameter key.
def getParam(self, key): """Returns value of Run-time Database Parameter 'key'. @param key: Run-time parameter name. @return: Run-time parameter value. """ cur = self._conn.cursor() cur.execute("SHOW GLOBAL VARIABLES LIKE %s", key) row = cur.f...
Returns dictionary of all run - time parameters.
def getParams(self): """Returns dictionary of all run-time parameters. @return: Dictionary of all Run-time parameters. """ cur = self._conn.cursor() cur.execute("SHOW GLOBAL VARIABLES") rows = cur.fetchall() info_dict = {} for row in rows...
Returns number of processes discriminated by state.
def getProcessStatus(self): """Returns number of processes discriminated by state. @return: Dictionary mapping process state to number of processes. """ info_dict = {} cur = self._conn.cursor() cur.execute("""SHOW FULL PROCESSLIST;""") rows = cur...
Returns number of processes discriminated by database name.
def getProcessDatabase(self): """Returns number of processes discriminated by database name. @return: Dictionary mapping database name to number of processes. """ info_dict = {} cur = self._conn.cursor() cur.execute("""SHOW FULL PROCESSLIST;""") ...
Returns list of databases.
def getDatabases(self): """Returns list of databases. @return: List of databases. """ cur = self._conn.cursor() cur.execute("""SHOW DATABASES;""") rows = cur.fetchall() if rows: return [row[0] for row in rows] else: ...
Computes probability of a word being recalled ( in the appropriate recall list ) given its presentation position
def spc_helper(egg, match='exact', distance='euclidean', features=None): """ Computes probability of a word being recalled (in the appropriate recall list), given its presentation position Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or ...
Query Apache Tomcat Server Status Page in XML format and return the result as an ElementTree object.
def _retrieve(self): """Query Apache Tomcat Server Status Page in XML format and return the result as an ElementTree object. @return: ElementTree object of Status Page XML. """ url = "%s://%s:%d/manager/status" % (self._proto, self._host, self._port) pa...
Return JVM Memory Stats for Apache Tomcat Server.
def getMemoryStats(self): """Return JVM Memory Stats for Apache Tomcat Server. @return: Dictionary of memory utilization stats. """ if self._statusxml is None: self.initStats() node = self._statusxml.find('jvm/memory') memstats = {} i...
Return dictionary of Connector Stats for Apache Tomcat Server.
def getConnectorStats(self): """Return dictionary of Connector Stats for Apache Tomcat Server. @return: Nested dictionary of Connector Stats. """ if self._statusxml is None: self.initStats() connnodes = self._statusxml.findall('connector') co...
Loads eggs fried eggs ands example data
def load(filepath, update=True): """ Loads eggs, fried eggs ands example data Parameters ---------- filepath : str Location of file update : bool If true, updates egg to latest format Returns ---------- data : quail.Egg or quail.FriedEgg Data loaded from di...
Loads pickled egg
def load_fegg(filepath, update=True): """ Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg """ try: ...
Loads pickled egg
def load_egg(filepath, update=True): """ Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg """ try: ...
Function that loads sql files generated by autoFR Experiment
def loadEL(dbpath=None, recpath=None, remove_subs=None, wordpool=None, groupby=None, experiments=None, filters=None): ''' Function that loads sql files generated by autoFR Experiment ''' assert (dbpath is not None), "You must specify a db file or files." assert (recpath is not None), "You must ...
Loads example data
def load_example_data(dataset='automatic'): """ Loads example data The automatic and manual example data are eggs containing 30 subjects who completed a free recall experiment as described here: https://psyarxiv.com/psh48/. The subjects studied 8 lists of 16 words each and then performed a free rec...
Retrieve values for graphs.
def retrieveVals(self): """Retrieve values for graphs.""" fs = FSinfo(self._fshost, self._fsport, self._fspass) if self.hasGraph('fs_calls'): count = fs.getCallCount() self.setGraphVal('fs_calls', 'calls', count) if self.hasGraph('fs_channels'): count ...
Implements Munin Plugin Auto - Configuration Option.
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ fs = FSinfo(self._fshost, self._fsport, self._fspass) return fs is not None
Solve the sparse linear system Ax = b where b may be a vector or a matrix.
def spsolve(A, b): """Solve the sparse linear system Ax=b, where b may be a vector or a matrix. Parameters ---------- A : ndarray or sparse matrix The square matrix A will be converted into CSC or CSR form b : ndarray or sparse matrix The matrix or vector representing the right hand...
Solve linear equation A x = b for x
def solve(self, b): """ Solve linear equation A x = b for x Parameters ---------- b : ndarray Right-hand side of the matrix equation. Can be vector or a matrix. Returns ------- x : ndarray Solution to the matrix equation ...
Solve linear equation of the form A X = B. Where B and X are sparse matrices.
def solve_sparse(self, B): """ Solve linear equation of the form A X = B. Where B and X are sparse matrices. Parameters ---------- B : any scipy.sparse matrix Right-hand side of the matrix equation. Note: it will be converted to csc_matrix via `.tocsc()`....
Computes recall matrix given list of presented and list of recalled words
def recall_matrix(egg, match='exact', distance='euclidean', features=None): """ Computes recall matrix given list of presented and list of recalled words Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach to compute recal...
Retrieve values for graphs.
def retrieveVals(self): """Retrieve values for graphs.""" net_info = NetstatInfo() if self.hasGraph('netstat_conn_status'): stats = net_info.getTCPportConnStatus(include_listen=True) for fname in ('listen', 'established', 'syn_sent', 'syn_recv', ...
Parses FreePBX configuration file/ etc/ amportal for user and password for Asterisk Manager Interface.
def _parseFreePBXconf(self): """Parses FreePBX configuration file /etc/amportal for user and password for Asterisk Manager Interface. @return: True if configuration file is found and parsed successfully. """ amiuser = None amipass = None if os.pa...
Parses Asterisk configuration file/ etc/ asterisk/ manager. conf for user and password for Manager Interface. Returns True on success.
def _parseAsteriskConf(self): """Parses Asterisk configuration file /etc/asterisk/manager.conf for user and password for Manager Interface. Returns True on success. @return: True if configuration file is found and parsed successfully. """ if os.path.isfile(confF...
Connect to Asterisk Manager Interface.
def _connect(self): """Connect to Asterisk Manager Interface.""" try: if sys.version_info[:2] >= (2,6): self._conn = telnetlib.Telnet(self._amihost, self._amiport, connTimeout) else: self._conn = telne...
Send action to Asterisk Manager Interface. @param action: Action name @param attrs: Tuple of key - value pairs for action attributes. @param chan_vars: Tuple of key - value pairs for channel variables.
def _sendAction(self, action, attrs=None, chan_vars=None): """Send action to Asterisk Manager Interface. @param action: Action name @param attrs: Tuple of key-value pairs for action attributes. @param chan_vars: Tuple of key-value pairs for channel variables. """...
Read and parse response from Asterisk Manager Interface. @return: Dictionary with response key - value pairs.
def _getResponse(self): """Read and parse response from Asterisk Manager Interface. @return: Dictionary with response key-value pairs. """ resp_dict= dict() resp_str = self._conn.read_until("\r\n\r\n", connTimeout) for line in resp_str.split("\r\n"): ...
Read and parse Asterisk Manager Interface Greeting to determine and set Manager Interface version.
def _getGreeting(self): """Read and parse Asterisk Manager Interface Greeting to determine and set Manager Interface version. """ greeting = self._conn.read_until("\r\n", connTimeout) mobj = re.match('Asterisk Call Manager\/([\d\.]+)\s*$', greeting) if mobj: ...
Query Asterisk Manager Interface for Asterisk Version to configure system for compatibility with multiple versions. CLI Command - core show version
def _initAsteriskVersion(self): """Query Asterisk Manager Interface for Asterisk Version to configure system for compatibility with multiple versions . CLI Command - core show version """ if self._ami_version > util.SoftwareVersion('1.0'): cmd = "core show ve...
Login to Asterisk Manager Interface.
def _login(self): """Login to Asterisk Manager Interface.""" self._sendAction("login", ( ("Username", self._amiuser), ("Secret", self._amipass), ("Events", "off"), )) resp = self._getResponse() if resp.get("Response") == "Success": ...
Send Action to Asterisk Manager Interface to execute CLI Command. @param command: CLI command to execute. @return: Command response string.
def executeCommand(self, command): """Send Action to Asterisk Manager Interface to execute CLI Command. @param command: CLI command to execute. @return: Command response string. """ self._sendAction("Command", ( ("Command", command), )) ...
Query Asterisk Manager Interface to initialize internal list of loaded modules. CLI Command - core show modules
def _initModuleList(self): """Query Asterisk Manager Interface to initialize internal list of loaded modules. CLI Command - core show modules """ if self.checkVersion('1.4'): cmd = "module show" else: cmd = "show modules" ...
Query Asterisk Manager Interface to initialize internal list of available applications. CLI Command - core show applications
def _initApplicationList(self): """Query Asterisk Manager Interface to initialize internal list of available applications. CLI Command - core show applications """ if self.checkVersion('1.4'): cmd = "core show applications" else: ...
Query Asterisk Manager Interface to initialize internal list of supported channel types. CLI Command - core show applications
def _initChannelTypesList(self): """Query Asterisk Manager Interface to initialize internal list of supported channel types. CLI Command - core show applications """ if self.checkVersion('1.4'): cmd = "core show channeltypes" else: ...
Returns True if mod is among the loaded modules.
def hasModule(self, mod): """Returns True if mod is among the loaded modules. @param mod: Module name. @return: Boolean """ if self._modules is None: self._initModuleList() return mod in self._modules
Returns True if app is among the loaded modules.
def hasApplication(self, app): """Returns True if app is among the loaded modules. @param app: Module name. @return: Boolean """ if self._applications is None: self._initApplicationList() return app in self._applications
Returns True if chan is among the supported channel types.
def hasChannelType(self, chan): """Returns True if chan is among the supported channel types. @param app: Module name. @return: Boolean """ if self._chantypes is None: self._initChannelTypesList() return chan in self._chantypes
Query Asterisk Manager Interface for defined codecs. CLI Command - core show codecs
def getCodecList(self): """Query Asterisk Manager Interface for defined codecs. CLI Command - core show codecs @return: Dictionary - Short Name -> (Type, Long Name) """ if self.checkVersion('1.4'): cmd = "core show codecs" else: ...
Query Asterisk Manager Interface for Channel Stats. CLI Command - core show channels
def getChannelStats(self, chantypes=('dahdi', 'zap', 'sip', 'iax2', 'local')): """Query Asterisk Manager Interface for Channel Stats. CLI Command - core show channels @return: Dictionary of statistics counters for channels. Number of active channels for each channel type. ...
Query Asterisk Manager Interface for SIP/ IAX2 Peer Stats. CLI Command - sip show peers iax2 show peers @param chantype: Must be sip or iax2. @return: Dictionary of statistics counters for VoIP Peers.
def getPeerStats(self, chantype): """Query Asterisk Manager Interface for SIP / IAX2 Peer Stats. CLI Command - sip show peers iax2 show peers @param chantype: Must be 'sip' or 'iax2'. @return: Dictionary of statistics counters for VoIP Peer...
Query Asterisk Manager Interface for SIP/ IAX2 Channel/ Codec Stats. CLI Commands - sip show channels iax2 show channnels @param chantype: Must be sip or iax2. @param codec_list: List of codec names to parse. ( Codecs not in the list are summed up to the other count. ) @return: Dictionary of statistics counters for Act...
def getVoIPchanStats(self, chantype, codec_list=('ulaw', 'alaw', 'gsm', 'g729')): """Query Asterisk Manager Interface for SIP / IAX2 Channel / Codec Stats. CLI Commands - sip show channels iax2 show channnels @param chantype: M...
Query Asterisk Manager Interface for Conference Room Stats. CLI Command - meetme list
def getConferenceStats(self): """Query Asterisk Manager Interface for Conference Room Stats. CLI Command - meetme list @return: Dictionary of statistics counters for Conference Rooms. """ if not self.hasConference(): return None if self.checkVersion...
Query Asterisk Manager Interface for Voicemail Stats. CLI Command - voicemail show users
def getVoicemailStats(self): """Query Asterisk Manager Interface for Voicemail Stats. CLI Command - voicemail show users @return: Dictionary of statistics counters for Voicemail Accounts. """ if not self.hasVoicemail(): return None if self.checkVers...
Query Asterisk Manager Interface for Trunk Stats. CLI Command - core show channels
def getTrunkStats(self, trunkList): """Query Asterisk Manager Interface for Trunk Stats. CLI Command - core show channels @param trunkList: List of tuples of one of the two following types: (Trunk Name, Regular Expression) (Trunk ...
Query Asterisk Manager Interface for Queue Stats. CLI Command: queue show
def getQueueStats(self): """Query Asterisk Manager Interface for Queue Stats. CLI Command: queue show @return: Dictionary of queue stats. """ if not self.hasQueue(): return None info_dict = {} if self.checkVersion('1.4'): ...
Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show stats
def getFaxStatsCounters(self): """Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show stats @return: Dictionary of fax stats. """ if not self.hasFax(): return None info_dict = {} cmdresp = self.executeComma...
Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show sessions
def getFaxStatsSessions(self): """Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show sessions @return: Dictionary of fax stats. """ if not self.hasFax(): return None info_dict = {} info_dict['total'] = 0 ...
Retrieve values for graphs.
def retrieveVals(self): """Retrieve values for graphs.""" for iface in self._ifaceList: if self._reqIfaceList is None or iface in self._reqIfaceList: if (self.graphEnabled('wanpipe_traffic') or self.graphEnabled('wanpipe_errors')): sta...
A function to simulate a list
def simulate_list(nwords=16, nrec=10, ncats=4): """A function to simulate a list""" # load wordpool wp = pd.read_csv('data/cut_wordpool.csv') # get one list wp = wp[wp['GROUP']==np.random.choice(list(range(16)), 1)[0]].sample(16) wp['COLOR'] = [[int(np.random.rand() * 255) for i in range(3)] ...
Retrieve values for graphs.
def retrieveVals(self): """Retrieve values for graphs.""" if self._genStats is None: self._genStats = self._dbconn.getStats() if self._genVars is None: self._genVars = self._dbconn.getParams() if self.hasGraph('mysql_connections'): self.setGraphVal('my...
Utility method to check if a storage engine is included in graphs.
def engineIncluded(self, name): """Utility method to check if a storage engine is included in graphs. @param name: Name of storage engine. @return: Returns True if included in graphs, False otherwise. """ if self._engines is None: self._engin...
Get disk space usage.
def getSpaceUse(self): """Get disk space usage. @return: Dictionary of filesystem space utilization stats for filesystems. """ stats = {} try: out = subprocess.Popen([dfCmd, "-Pk"], stdout=subprocess.PIPE).communic...
Retrieve values for graphs.
def retrieveVals(self): """Retrieve values for graphs.""" stats = self._dbconn.getDatabaseStats() databases = stats.get('databases') totals = stats.get('totals') if self.hasGraph('pg_connections'): limit = self._dbconn.getParam('max_connections') ...
Connects via a RS - 485 to Ethernet adapter.
def connect(self, host, port): """Connects via a RS-485 to Ethernet adapter.""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((host, port)) self._reader = sock.makefile(mode='rb') self._writer = sock.makefile(mode='wb')
Process data ; returns when the reader signals EOF. Callback is notified when any data changes.
def process(self, data_changed_callback): """Process data; returns when the reader signals EOF. Callback is notified when any data changes.""" # pylint: disable=too-many-locals,too-many-branches,too-many-statements while True: byte = self._reader.read(1) while Tr...
Sends a key.
def send_key(self, key): """Sends a key.""" _LOGGER.info('Queueing key %s', key) frame = self._get_key_event_frame(key) # Queue it to send immediately following the reception # of a keep-alive packet in an attempt to avoid bus collisions. self._send_queue.put({'frame': f...
Returns a set containing the enabled states.
def states(self): """Returns a set containing the enabled states.""" state_list = [] for state in States: if state.value & self._states != 0: state_list.append(state) if (self._flashing_states & States.FILTER) != 0: state_list.append(States.FILTER...
Returns True if the specified state is enabled.
def get_state(self, state): """Returns True if the specified state is enabled.""" # Check to see if we have a change request pending; if we do # return the value we expect it to change to. for data in list(self._send_queue.queue): desired_states = data['desired_states'] ...
Set the state.
def set_state(self, state, enable): """Set the state.""" is_enabled = self.get_state(state) if is_enabled == enable: return True key = None desired_states = [{'state': state, 'enabled': not is_enabled}] if state == States.FILTER_LOW_SPEED: if no...
Decorates a function by tracing the begining and end of the function execution if doTrace global is True
def trace(function, *args, **k) : """Decorates a function by tracing the begining and end of the function execution, if doTrace global is True""" if doTrace : print ("> "+function.__name__, args, k) result = function(*args, **k) if doTrace : print ("< "+function.__name__, args, k, "->", result) return result
url = QtCore. QUrl ( http:// maps. google. com/ maps/ geo/ ) url. addQueryItem ( q location ) url. addQueryItem ( output csv ) url. addQueryItem ( sensor false )
def geocode(self, location) : url = QtCore.QUrl("http://maps.googleapis.com/maps/api/geocode/xml") url.addQueryItem("address", location) url.addQueryItem("sensor", "false") """ url = QtCore.QUrl("http://maps.google.com/maps/geo/") url.addQueryItem("q", location) url.addQueryItem("output", "csv") url.add...
Force a correlation matrix on a set of statistically distributed objects. This function works on objects in - place. Parameters ---------- params: array An array of of uv objects. corrmat: 2d - array The correlation matrix to be imposed
def correlate(params, corrmat): """ Force a correlation matrix on a set of statistically distributed objects. This function works on objects in-place. Parameters ---------- params : array An array of of uv objects. corrmat : 2d-array The correlation matrix to b...
Induce a set of correlations on a column - wise dataset Parameters ---------- data: 2d - array An m - by - n array where m is the number of samples and n is the number of independent variables each column of the array corresponding to each variable corrmat: 2d - array An n - by - n array that defines the desired correl...
def induce_correlations(data, corrmat): """ Induce a set of correlations on a column-wise dataset Parameters ---------- data : 2d-array An m-by-n array where m is the number of samples and n is the number of independent variables, each column of the array corresponding ...
Plots a scatterplot matrix of subplots. Usage: plotcorr ( X ) plotcorr (... plotargs =... ) # e. g. r * bo etc. plotcorr (... full =... ) # e. g. True or False plotcorr (... labels =... ) # e. g. [ label1 label2... ] Each column of X is plotted against other columns resulting in a ncols by ncols grid of subplots with t...
def plotcorr(X, plotargs=None, full=True, labels=None): """ Plots a scatterplot matrix of subplots. Usage: plotcorr(X) plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc. plotcorr(..., full=...) # e.g., True or False plotc...
Calculate the lower triangular matrix of the Cholesky decomposition of a symmetric positive - definite matrix.
def chol(A): """ Calculate the lower triangular matrix of the Cholesky decomposition of a symmetric, positive-definite matrix. """ A = np.array(A) assert A.shape[0] == A.shape[1], "Input matrix must be square" L = [[0.0] * len(A) for _ in range(len(A))] for i in range(len(A)): ...
A generic method to make GET requests to the OpenDNS Investigate API on the given URI.
def get(self, uri, params={}): '''A generic method to make GET requests to the OpenDNS Investigate API on the given URI. ''' return self._session.get(urljoin(Investigate.BASE_URL, uri), params=params, headers=self._auth_header, proxies=self.proxies )
A generic method to make POST requests to the OpenDNS Investigate API on the given URI.
def post(self, uri, params={}, data={}): '''A generic method to make POST requests to the OpenDNS Investigate API on the given URI. ''' return self._session.post( urljoin(Investigate.BASE_URL, uri), params=params, data=data, headers=self._auth_header, ...
Convenience method to call get () on an arbitrary URI and parse the response into a JSON object. Raises an error on non - 200 response status.
def get_parse(self, uri, params={}): '''Convenience method to call get() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.get, uri, params)
Convenience method to call post () on an arbitrary URI and parse the response into a JSON object. Raises an error on non - 200 response status.
def post_parse(self, uri, params={}, data={}): '''Convenience method to call post() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.post, uri, params, data)
Get the domain status and categorization of a domain or list of domains. domains can be either a single domain or a list of domains. Setting labels to True will give back categorizations in human - readable form.
def categorization(self, domains, labels=False): '''Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more de...
Get the cooccurrences of the given domain.
def cooccurrences(self, domain): '''Get the cooccurrences of the given domain. For details, see https://investigate.umbrella.com/docs/api#co-occurrences ''' uri = self._uris["cooccurrences"].format(domain) return self.get_parse(uri)
Get the related domains of the given domain.
def related(self, domain): '''Get the related domains of the given domain. For details, see https://investigate.umbrella.com/docs/api#relatedDomains ''' uri = self._uris["related"].format(domain) return self.get_parse(uri)
Get the Security Information for the given domain.
def security(self, domain): '''Get the Security Information for the given domain. For details, see https://investigate.umbrella.com/docs/api#securityInfo ''' uri = self._uris["security"].format(domain) return self.get_parse(uri)
Get the RR ( Resource Record ) History of the given domain or IP. The default query type is for A records but the following query types are supported:
def rr_history(self, query, query_type="A"): '''Get the RR (Resource Record) History of the given domain or IP. The default query type is for 'A' records, but the following query types are supported: A, NS, MX, TXT, CNAME For details, see https://investigate.umbrella.com/docs/a...
Gets whois information for a domain
def domain_whois(self, domain): '''Gets whois information for a domain''' uri = self._uris["whois_domain"].format(domain) resp_json = self.get_parse(uri) return resp_json
Gets whois history for a domain
def domain_whois_history(self, domain, limit=None): '''Gets whois history for a domain''' params = dict() if limit is not None: params['limit'] = limit uri = self._uris["whois_domain_history"].format(domain) resp_json = self.get_parse(uri, params) return res...
Gets the domains that have been registered with a nameserver or nameservers
def ns_whois(self, nameservers, limit=DEFAULT_LIMIT, offset=DEFAULT_OFFSET, sort_field=DEFAULT_SORT): '''Gets the domains that have been registered with a nameserver or nameservers''' if not isinstance(nameservers, list): uri = self._uris["whois_ns"].format(nameservers) p...
Searches for domains that match a given pattern
def search(self, pattern, start=None, limit=None, include_category=None): '''Searches for domains that match a given pattern''' params = dict() if start is None: start = datetime.timedelta(days=30) if isinstance(start, datetime.timedelta): params['start'] = int...
Return an object representing the samples identified by the input domain IP or URL
def samples(self, anystring, limit=None, offset=None, sortby=None): '''Return an object representing the samples identified by the input domain, IP, or URL''' uri = self._uris['samples'].format(anystring) params = {'limit': limit, 'offset': offset, 'sortby': sortby} return self.get_par...
Return an object representing the sample identified by the input hash or an empty object if that sample is not found
def sample(self, hash, limit=None, offset=None): '''Return an object representing the sample identified by the input hash, or an empty object if that sample is not found''' uri = self._uris['sample'].format(hash) params = {'limit': limit, 'offset': offset} return self.get_parse(uri, pa...
Gets the AS information for a given IP address.
def as_for_ip(self, ip): '''Gets the AS information for a given IP address.''' if not Investigate.IP_PATTERN.match(ip): raise Investigate.IP_ERR uri = self._uris["as_for_ip"].format(ip) resp_json = self.get_parse(uri) return resp_json
Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS.
def prefixes_for_asn(self, asn): '''Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS.''' uri = self._uris["prefixes_for_asn"].format(asn) resp_json = self.get_parse(uri) return resp_json
Get the domain tagging timeline for a given uri. Could be a domain ip or url. For details see https:// docs. umbrella. com/ investigate - api/ docs/ timeline
def timeline(self, uri): '''Get the domain tagging timeline for a given uri. Could be a domain, ip, or url. For details, see https://docs.umbrella.com/investigate-api/docs/timeline ''' uri = self._uris["timeline"].format(uri) resp_json = self.get_parse(uri) retu...
Absolute value
def abs(x): """ Absolute value """ if isinstance(x, UncertainFunction): mcpts = np.abs(x._mcpts) return UncertainFunction(mcpts) else: return np.abs(x)
Inverse cosine
def acos(x): """ Inverse cosine """ if isinstance(x, UncertainFunction): mcpts = np.arccos(x._mcpts) return UncertainFunction(mcpts) else: return np.arccos(x)
Inverse hyperbolic cosine
def acosh(x): """ Inverse hyperbolic cosine """ if isinstance(x, UncertainFunction): mcpts = np.arccosh(x._mcpts) return UncertainFunction(mcpts) else: return np.arccosh(x)
Inverse sine
def asin(x): """ Inverse sine """ if isinstance(x, UncertainFunction): mcpts = np.arcsin(x._mcpts) return UncertainFunction(mcpts) else: return np.arcsin(x)
Inverse hyperbolic sine
def asinh(x): """ Inverse hyperbolic sine """ if isinstance(x, UncertainFunction): mcpts = np.arcsinh(x._mcpts) return UncertainFunction(mcpts) else: return np.arcsinh(x)
Inverse tangent
def atan(x): """ Inverse tangent """ if isinstance(x, UncertainFunction): mcpts = np.arctan(x._mcpts) return UncertainFunction(mcpts) else: return np.arctan(x)
Inverse hyperbolic tangent
def atanh(x): """ Inverse hyperbolic tangent """ if isinstance(x, UncertainFunction): mcpts = np.arctanh(x._mcpts) return UncertainFunction(mcpts) else: return np.arctanh(x)
Ceiling function ( round towards positive infinity )
def ceil(x): """ Ceiling function (round towards positive infinity) """ if isinstance(x, UncertainFunction): mcpts = np.ceil(x._mcpts) return UncertainFunction(mcpts) else: return np.ceil(x)
Cosine
def cos(x): """ Cosine """ if isinstance(x, UncertainFunction): mcpts = np.cos(x._mcpts) return UncertainFunction(mcpts) else: return np.cos(x)
Hyperbolic cosine
def cosh(x): """ Hyperbolic cosine """ if isinstance(x, UncertainFunction): mcpts = np.cosh(x._mcpts) return UncertainFunction(mcpts) else: return np.cosh(x)
Convert radians to degrees
def degrees(x): """ Convert radians to degrees """ if isinstance(x, UncertainFunction): mcpts = np.degrees(x._mcpts) return UncertainFunction(mcpts) else: return np.degrees(x)
Exponential function
def exp(x): """ Exponential function """ if isinstance(x, UncertainFunction): mcpts = np.exp(x._mcpts) return UncertainFunction(mcpts) else: return np.exp(x)
Calculate exp ( x ) - 1
def expm1(x): """ Calculate exp(x) - 1 """ if isinstance(x, UncertainFunction): mcpts = np.expm1(x._mcpts) return UncertainFunction(mcpts) else: return np.expm1(x)
Absolute value function
def fabs(x): """ Absolute value function """ if isinstance(x, UncertainFunction): mcpts = np.fabs(x._mcpts) return UncertainFunction(mcpts) else: return np.fabs(x)