code stringlengths 1 18.2k |
|---|
async def peer(client: Client, peer_signed_raw: str) -> ClientResponse: """ POST a Peer signed raw document :param client: Client to connect to the api :param peer_signed_raw: Peer signed raw document :return: """ return await client.post(MODULE + '/peering/peers', {'peer': peer_signed_raw}, rtype=RESPONSE_AIOHTTP) |
def check_optical(disk): ''' Try to determine if a device is optical technology. Needs improvement. ''' dev = disk.dev if dev.startswith('sr') or ('cd' in dev): return True elif disk.fmt in optical_fs: return True else: return None |
def check_removable(dev, opts): ''' Removable drives can be identified under /sys. ''' try: # get parent device from sys filesystem, look from right. :-/ parent = os.readlink(f'/sys/class/block/{dev}').rsplit("/", 2)[1] with open(f'/sys/block/{parent}/removable') as f: return f.read() == '1\n' except IndexError as err:... |
def decode_mntp(mntp): ''' Mount point strings have a unique encoding for whitespace. :-/ https://stackoverflow.com/a/13576641/450917 https://stackoverflow.com/a/6117124/450917 ''' import re replacements = { r'\\040': ' ', r'\\011': '\t', r'\\012': '\n', r'\\134': '\\', } pattern = re.compile('|'.join(replacements.keys... |
def get_label_map(opts): ''' Find volume labels from filesystem and return in dict format. ''' results = {} try: for entry in os.scandir(diskdir): target = normpath(join(diskdir, os.readlink(entry.path))) decoded_name = entry.name.encode('utf8').decode('unicode_escape') results[target] = decoded_name if opts.debug: pri... |
def get_diskinfo(opts, show_all=False, local_only=False): ''' Returns a list holding the current disk info. Stats are divided by the outputunit. ''' disks = [] outunit = opts.outunit label_map = get_label_map(opts) # get mount info try: with open(mntfname) as infile: lines = infile.readlines() lines.sort() except IOErr... |
if show_all: if is_tmpfs: disk.isram = True else: # skip these: if (is_img or is_tmpfs or mntp == '/boot/efi'): continue break # found a useful entry, stop here else: # no-break, nothing was found continue # skip this one disk.dev = dev disk.fmt = fmt disk.mntp = mntp = decode_mntp(mntp) if '\\' in mntp else mntp disk.... |
disk.pcnt = disk.oused / disk.ocap * 100 if mntops.startswith('rw'): # read only disk.rw = True elif mntops.startswith('ro'): disk.rw = False else: disk.rw = not bool(stat.f_flag & os.ST_RDONLY) disks.append(disk) if show_all: # look at /dev/disks again for the unmounted for devname in label_map: dev = basename(devname... |
def get_meminfo(opts): ''' Returns a dictionary holding the current memory info, divided by the ouptut unit. If mem info can't be read, returns None. ''' meminfo = MemInfo() outunit = opts.outunit try: with open(memfname) as infile: lines = infile.readlines() except IOError: return None for line in lines: # format: 'Me... |
outunit) cache = meminfo.cached + meminfo.buffers meminfo.used = meminfo.memtotal - meminfo.memfree - cache meminfo.swapused = (meminfo.swaptotal - meminfo.swapcached - meminfo.swapfree) return meminfo |
def timeit(func): """ Simple decorator to time functions :param func: function to decorate :type func: callable :return: wrapped function :rtype: callable """ @wraps(func) def _wrapper(*args, **kwargs): start = time.time() result = func(*args, **kwargs) elapsed = time.time() - start LOGGER.info('%s took %s seconds to c... |
def setConnStringForWindows(): """ Set Conn String for Windiws Windows has a different way of forking processes, which causes the @worker_process_init.connect signal not to work in "CeleryDbConnInit" """ global _dbConnectString from peek_platform.file_config.PeekFileConfigABC import PeekFileConfigABC from peek_platform... |
def prefetchDeclarativeIds(Declarative, count) -> Optional[Iterable[int]]: """ Prefetch Declarative IDs This function prefetches a chunk of IDs from a database sequence. Doing this allows us to preallocate the IDs before an insert, which significantly speeds up : * Orm inserts, especially those using inheritance * When... |
def install_gem(gemname, version=None, conservative=True, ri=False, rdoc=False, development=False, format_executable=False, force=False, gem_source=None): """Install a ruby gem.""" cmdline = ['gem', 'install'] if conservative: cmdline.append('--conservative') if ri: cmdline.append('--ri') else: cmdline.append('--no-ri'... |
def is_installed(gemname, version=None): """Check if a gem is installed.""" cmdline = ['gem', 'list', '-i', gemname] if version: cmdline.extend(['-v', version]) try: subprocess.check_output(cmdline, shell=False) return True except (OSError, subprocess.CalledProcessError) as err: if err.returncode == 1: return False els... |
def merge_links_from(self, other_node, merge_same_value_targets=False): """ Merge links from another node with ``self.link_list``. Copy links from another node, merging when copied links point to a node which this already links to. Args: other_node (Node): The node to merge links from merge_same_value_targets (bool): W... |
in self.link_list: if merge_same_value_targets: if other_link.target.value == existing_link.target.value: existing_link.weight += other_link.weight break else: if other_link.target == existing_link.target: existing_link.weight += other_link.weight break else: self.add_link(other_link.target, other_link.weight) |
def find_link(self, target_node): """ Find the link that points to ``target_node`` if it exists. If no link in ``self`` points to ``target_node``, return None Args: target_node (Node): The node to look for in ``self.link_list`` Returns: Link: An existing link pointing to ``target_node`` if found None: If no such link e... |
def add_link(self, targets, weight): """ Add link(s) pointing to ``targets``. If a link already exists pointing to a target, just add ``weight`` to that link's weight Args: targets (Node or list[Node]): node or nodes to link to weight (int or float): weight for the new link(s) Returns: None Example: >>> node_1 = Node('... |
weight)) |
def add_link_to_self(self, source, weight): """ Create and add a ``Link`` from a source node to ``self``. Args: source (Node): The node that will own the new ``Link`` pointing to ``self`` weight (int or float): The weight of the newly created ``Link`` Returns: None Example: >>> node_1 = Node('One') >>> node_2 = Node('T... |
def add_reciprocal_link(self, target, weight): """ Add links pointing in either direction between ``self`` and ``target``. This creates a ``Link`` from ``self`` to ``target`` and a ``Link`` from ``target`` to ``self`` of equal weight. If ``target`` is a list of ``Node`` 's, repeat this for each one. Args: target (Node ... |
weight) |
def remove_links_to_self(self): """ Remove any link in ``self.link_list`` whose ``target`` is ``self``. Returns: None Example: >>> node_1 = Node('One') >>> node_1.add_link(node_1, 5) >>> node_1.remove_links_to_self() >>> len(node_1.link_list) 0 """ self.link_list = [link for link in self.link_list if link.target != sel... |
def compile(self, source_code, post_treatment=''.join): """Compile given source code. Return object code, modified by given post treatment. """ # read structure structure = self._structure(source_code) values = self._struct_to_values(structure, source_code) # create object code, translated in targeted language obj_code... |
def _initialize_tables(self): """Create tables for structure and values, word->vocabulary""" # structure table self.table_struct, self.idnt_struct_size = self._create_struct_table() # values table self.table_values, self.idnt_values_size = self._create_values_table() |
def _structure(self, source_code): """return structure in ACDP format.""" # define cutter as a per block reader def cutter(seq, block_size): for index in range(0, len(seq), block_size): lexem = seq[index:index+block_size] if len(lexem) == block_size: yield self.table_struct[seq[index:index+block_size]] return tuple(cut... |
def _next_lexem(self, lexem_type, source_code, source_code_size): """Return next readable lexem of given type in source_code. If no value can be found, the neutral_value will be used""" # define reader as a lexem extractor def reader(seq, block_size): identificator = '' for char in source_code: if len(identificator) ==... |
def _next_condition_lexems(self, source_code, source_code_size): """Return condition lexem readed in source_code""" # find three lexems lexems = tuple(( self._next_lexem(LEXEM_TYPE_COMPARISON, source_code, source_code_size), self._next_lexem(LEXEM_TYPE_OPERATOR , source_code, source_code_size), self._next_lexem(LEXEM_T... |
def _string_to_int(self, s): """Read an integer in s, in Little Indian. """ base = len(self.alphabet) return sum((self._letter_to_int(l) * base**lsb for lsb, l in enumerate(s) )) |
def _struct_to_values(self, structure, source_code): """Return list of values readed in source_code, according to given structure. """ # iterate on source code until all values are finded # if a value is not foundable, # (ie its identificator is not in source code) # it will be replaced by associated neutral value iter... |
def _create_struct_table(self): """Create table identificator->vocabulary, and return it with size of an identificator""" len_alph = len(self.alphabet) len_vocb = len(self.voc_structure) identificator_size = ceil(log(len_vocb, len_alph)) # create list of lexems num2alph = lambda x, n: self.alphabet[(x // len_alph**n) %... |
def _create_values_table(self): """Create table lexem_type->{identificator->vocabulary}, and return it with sizes of an identificator as lexem_type->identificator_size""" # number of existing character, and returned dicts len_alph = len(self.alphabet) identificators_table = {k:{} for k in self.voc_values.keys()} identi... |
voc in zip_id_voc: identificators_table[lexem_type][''.join(idt)] = voc # return all return identificators_table, identificators_sizes |
def addDesktopResource(self, pluginSubPath: bytes, resource: BasicResource) -> None: """ Add Site Resource Add a cusotom implementation of a served http resource. :param pluginSubPath: The resource path where you want to serve this resource. :param resource: The resource to serve. :return: None """ pluginSubPath = plug... |
def check_arg_types(funcname, *args): """Raise TypeError if not all items of `args` are same string type.""" hasstr = hasbytes = False for arg in args: if isinstance(arg, str): hasstr = True elif isinstance(arg, bytes): hasbytes = True else: raise TypeError('{0}() argument must be str or bytes, not {1}' .format(funcnam... |
def posix_commonpath(paths): """Given a sequence of POSIX path names, return the longest common sub-path.""" if not paths: raise ValueError('commonpath() arg is an empty sequence') check_arg_types('commonpath', *paths) if isinstance(paths[0], bytes): sep = b'/' curdir = b'.' else: sep = '/' curdir = '.' split_paths = [... |
def nt_commonpath(paths): # pylint: disable=too-many-locals """Given a sequence of NT path names, return the longest common sub-path.""" from ntpath import splitdrive if not paths: raise ValueError('commonpath() arg is an empty sequence') check_arg_types('commonpath', *paths) if isinstance(paths[0], bytes): sep = b'\\'... |
!= 1: raise ValueError("Paths don't have the same drive") drive, path = splitdrive(paths[0].replace(altsep, sep)) common = path.split(sep) common = [c for c in common if c and c != curdir] split_paths = [[c for c in s if c and c != curdir] for s in split_paths] s_min = min(split_paths) s_max = max(split_paths) for i, r... |
def comments(self, limit=None): """GETs comments to this thing. :param limit: max number of comments to return """ return self._reddit._limit_get(self.permalink, limit=limit)[1] |
def distinguish(self, how=True): """Distinguishes this thing (POST). Calls :meth:`narwal.Reddit.distinguish`. :param how: either True, False, or 'admin' """ return self._reddit.distinguish(self.name, how=how) |
def next_listing(self, limit=None): """GETs next :class:`Listing` directed to by this :class:`Listing`. Returns :class:`Listing` object. :param limit: max number of entries to get :raise UnsupportedError: raised when trying to load more comments """ if self.after: return self._reddit._limit_get(self._path, params={'aft... |
def prev_listing(self, limit=None): """GETs previous :class:`Listing` directed to by this :class:`Listing`. Returns :class:`Listing` object. :param limit: max number of entries to get """ if self.before: return self._reddit._limit_get(self._path, eparams={'before': self.before}, limit=limit or self._limit) else: raise ... |
def hot(self, limit=None): """GETs hot links from this subreddit. Calls :meth:`narwal.Reddit.hot`. :param limit: max number of links to return """ return self._reddit.hot(self.display_name, limit=limit) |
def new(self, limit=None): """GETs new links from this subreddit. Calls :meth:`narwal.Reddit.new`. :param limit: max number of links to return """ return self._reddit.new(self.display_name, limit=limit) |
def top(self, limit=None): """GETs top links from this subreddit. Calls :meth:`narwal.Reddit.top`. :param limit: max number of links to return """ return self._reddit.top(self.display_name, limit=limit) |
def controversial(self, limit=None): """GETs controversial links from this subreddit. Calls :meth:`narwal.Reddit.controversial`. :param limit: max number of links to return """ return self._reddit.controversial(self.display_name, limit=limit) |
def comments(self, limit=None): """GETs newest comments from this subreddit. Calls :meth:`narwal.Reddit.comments`. :param limit: max number of links to return """ return self._reddit.comments(self.display_name, limit=limit) |
def submit_link(self, title, url): """Submit link to this subreddit (POST). Calls :meth:`narwal.Reddit.submit_link`. :param title: title of submission :param url: url submission links to """ return self._reddit.submit_link(self.display_name, title, url) |
def submit_text(self, title, text): """Submit self text submission to this subreddit (POST). Calls :meth:`narwal.Reddit.submit_text`. :param title: title of submission :param text: self text """ return self._reddit.submit_text(self.display_name, title, text) |
def moderators(self, limit=None): """GETs moderators for this subreddit. Calls :meth:`narwal.Reddit.moderators`. :param limit: max number of items to return """ return self._reddit.moderators(self.display_name, limit=limit) |
def flair(self, name, text, css_class): """Sets flair for `user` in this subreddit (POST). Calls :meth:`narwal.Reddit.flairlist`. :param name: name of the user :param text: flair text to assign :param css_class: CSS class to assign to flair text """ return self._reddit.flair(self.display_name, name, text, css_class) |
def flairlist(self, limit=1000, after=None, before=None): """GETs flairlist for this subreddit. Calls :meth:`narwal.Reddit.flairlist`. :param limit: max number of items to return :param after: full id of user to return entries after :param before: full id of user to return entries *before* """ return self._reddit.flair... |
def contributors(self, limit=None): """GETs contributors for this subreddit. Calls :meth:`narwal.Reddit.contributors`. :param limit: max number of items to return """ return self._reddit.contributors(self.display_name, limit=limit) |
def reply(self, text): """POSTs reply to message with own message. Returns posted message. URL: ``http://www.reddit.com/api/comment/`` :param text: body text of message """ data = { 'thing_id': self.name, 'id': '#commentreply_{0}'.format(self.name), 'text': text, } j = self._reddit.post('api', 'comment', data=data) try... |
def overview(self, limit=None): """GETs overview of user's activities. Calls :meth:`narwal.Reddit.user_overview`. :param limit: max number of items to get """ return self._reddit.user_overview(self.name, limit=limit) |
def comments(self, limit=None): """GETs user's comments. Calls :meth:`narwal.Reddit.user_comments`. :param limit: max number of comments to get """ return self._reddit.user_comments(self.name, limit=limit) |
def submitted(self, limit=None): """GETs user's submissions. Calls :meth:`narwal.Reddit.user_submitted`. :param limit: max number of submissions to get """ return self._reddit.user_submitted(self.name, limit=limit) |
def message(self, subject, text): """Compose a message to this user. Calls :meth:`narwal.Reddit.compose`. :param subject: subject of message :param text: body of message """ return self._reddit.compose(self.name, subject, text) |
def catches(exc, handler=re_raise): ''' Function decorator. Used to decorate function that handles exception class exc. An optional exception handler can be passed as a second argument. This exception handler shall have the signature handler(exc, message, traceback). ''' if not __CHECKING__: return lambda f: f def wrap... |
def throws(exc): ''' throws(exc)(func) -> func' Function decorator. Used to decorate a function that raises exc. ''' if not __CHECKING__: return lambda f: f def wrap(f): def call(*args, **kwd): res = f(*args, **kwd) # raise UncheckedExceptionError if exc is not automatically # registered by a function decorated with @c... |
def locked(self): """Context generator for `with` statement, yields thread-safe connection. :return: thread-safe connection :rtype: pydbal.connection.Connection """ conn = self._get_connection() try: self._lock(conn) yield conn finally: self._unlock(conn) |
def query(self, sql, *args, **kwargs): """Executes an SQL SELECT query and returns rows generator. :param sql: query to execute :param args: parameters iterable :param kwargs: parameters iterable :return: rows generator :rtype: generator """ with self.locked() as conn: for row in conn.query(sql, *args, **kwargs): yield... |
def execute(self, sql, *args, **kwargs): """Executes an SQL INSERT/UPDATE/DELETE query with the given parameters and returns the number of affected rows. :param sql: statement to execute :param args: parameters iterable :param kwargs: parameters iterable :return: number of affected rows :rtype: int """ with self.locked... |
def fetch(self, sql, *args, **kwargs): """Executes an SQL SELECT query and returns the first row or `None`. :param sql: statement to execute :param args: parameters iterable :param kwargs: parameters iterable :return: the first row or `None` """ with self.locked() as conn: return conn.query(sql, *args, **kwargs).fetch(... |
def fetch_all(self, sql, *args, **kwargs): """Executes an SQL SELECT query and returns all selected rows. :param sql: statement to execute :param args: parameters iterable :param kwargs: parameters iterable :return: all selected rows :rtype: list """ with self.locked() as conn: return conn.query(sql, *args, **kwargs).f... |
def fetch_column(self, sql, *args, **kwargs): """Executes an SQL SELECT query and returns the first column of the first row or `None`. :param sql: statement to execute :param args: parameters iterable :param kwargs: parameters iterable :return: the first row of the first column or `None` """ with self.locked() as conn:... |
def insert(self, table, values): """Inserts a table row with specified data. :param table: the expression of the table to insert data into, quoted or unquoted :param values: a dictionary containing column-value pairs :return: last inserted ID """ with self.locked() as conn: return conn.insert(table, values) |
def update(self, table, values, identifier): """Updates a table row with specified data by given identifier. :param table: the expression of the table to update quoted or unquoted :param values: a dictionary containing column-value pairs :param identifier: the update criteria; a dictionary containing column-value pairs... |
def delete(self, table, identifier): """Deletes a table row by given identifier. :param table: the expression of the table to update quoted or unquoted :param identifier: the delete criteria; a dictionary containing column-value pairs :return: the number of affected rows :rtype: int """ with self.locked() as conn: retu... |
def ensure_bytes(data: Union[str, bytes]) -> bytes: """ Convert data in bytes if data is a string :param data: Data :rtype bytes: """ if isinstance(data, str): return bytes(data, 'utf-8') return data |
def ensure_str(data: Union[str, bytes]) -> str: """ Convert data in str if data are bytes :param data: Data :rtype str: """ if isinstance(data, bytes): return str(data, 'utf-8') return data |
def xor_bytes(b1: bytes, b2: bytes) -> bytearray: """ Apply XOR operation on two bytes arguments :param b1: First bytes argument :param b2: Second bytes argument :rtype bytearray: """ result = bytearray() for i1, i2 in zip(b1, b2): result.append(i1 ^ i2) return result |
def _simple_dispatch(self, name, params): """ Dispatch method """ # Normalize parameters if params: if isinstance(params, (list, tuple)): params = [jabsorb.from_jabsorb(param) for param in params] else: params = {key: jabsorb.from_jabsorb(value) for key, value in params.items()} # Dispatch like JSON-RPC return super(Ja... |
def kompile(src, raw=False, filename='<compiler>', loader=None, **kwargs): ''' Creates a new class based on the supplied template, and returnsit. class Template(object): def __call__(self, context): return ''.join(self._iterator(context)) def _iterator(self, context): return map(str, self._root(context) def _root(self,... |
'parent': parser.parent, 'ContextScope': ContextScope, } eval(code, g) klass = g['Template'] if raw: return klass return klass() |
def calculate_checksum(source_string): """ A port of the functionality of in_cksum() from ping.c Ideally this would act on the string as a series of 16-bit ints (host packed), but this works. Network data is big-endian, hosts are typically little-endian """ countTo = (int(len(source_string) / 2)) * 2 sum = 0 count = 0 ... |
odd length loByte = source_string[len(source_string) - 1] sum += ord(loByte) sum &= 0xffffffff # Truncate sum to 32 bits (a variance from ping.c, which # uses signed ints, but overflow is unlikely in ping) sum = (sum >> 16) + (sum & 0xffff) # Add high 16 bits to low 16 bits sum += (sum >> 16) # Add carry from above (if... |
def signal_handler(self, signum, frame): """ Handle print_exit via signals. """ self.print_exit() print("\n(Terminated with signal %d)\n" % (signum)) sys.exit(0) |
def header2dict(self, names, struct_format, data): """ Unpack the raw received IP and ICMP header information to a dict. """ unpacked_data = struct.unpack(struct_format, data) return dict(zip(names, unpacked_data)) |
def do(self): """ Send one ICMP ECHO_REQUEST and receive the response until self.timeout. """ try: # One could use UDP here, but it's obscure current_socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname("icmp")) except socket.error as (errno, msg): if errno == 1: # Operation not permitted - Add... |
delay: self.max_time = delay return PingSuccess(delay, ip, packet_size, ip_header, icmp_header) else: return PingTimeout(self.destination) |
def send_one_ping(self, current_socket): """ Send one ICMP ECHO_REQUEST. """ # Header is type (8), code (8), checksum (16), id (16), sequence (16) checksum = 0 # Make a dummy header with a 0 checksum. header = struct.pack( "!BBHHH", ICMP_ECHO, 0, checksum, self.own_id, self.seq_number ) padBytes = [] startVal = 0x42 fo... |
0, checksum, self.own_id, self.seq_number ) packet = header + data send_time = default_timer() try: current_socket.sendto(packet, (self.destination, 1)) # Port number is irrelevant for ICMP except socket.error as e: print("General failure (%s)" % (e.args[1])) current_socket.close() return return send_time |
def receive_one_ping(self, current_socket): """ Receive the ping from the socket. timeout = in ms. """ timeout = self.timeout / 1000.0 while True: # Loop while waiting for packet or timeout select_start = default_timer() inputready, outputready, exceptready = select.select([current_socket], [], [], timeout) select_dura... |
timeout - select_duration if timeout <= 0: return None, 0, 0, 0, 0 |
def get_link(self, peer): """ Retrieves the link to the given peer """ for access in peer.accesses: if access.type == 'mqtt': break else: # No MQTT access found return None # Get server access tuple server = (access.server.host, access.server.port) with self.__lock: try: # Get existing link return self._links[server] e... |
def exit(exit_code=0): r"""A function to support exiting from exit hooks. Could also be used to exit from the calling scripts in a thread safe manner. """ core.processExitHooks() if state.isExitHooked and not hasattr(sys, 'exitfunc'): # The function is called from the exit hook sys.stderr.flush() sys.stdout.flush() os.... |
def getDigestableArgs(Argv): r"""Splits the given Argv into *Args and **KwArgs. """ first_kwarg_pos = 0 for arg in Argv: if KWARG_VALIDATOR.search(arg): break else: first_kwarg_pos += 1 for arg in Argv[first_kwarg_pos:]: # ensure that the kwargs are valid if not KWARG_VALIDATOR.search(arg): raise HandledException('Coul... |
def listMemberHelps(TargetGroup): r"""Gets help on a group's children. """ Members = [] for Member in TargetGroup.Members.values(): # get unique children (by discarding aliases) if Member not in Members: Members.append(Member) Ret = [] for Member in Members: Config = Member.Config Ret.append(('%s%s' % (Config['name'], ... |
def getTypeStr(_type): r"""Gets the string representation of the given type. """ if isinstance(_type, CustomType): return str(_type) if hasattr(_type, '__name__'): return _type.__name__ return '' |
def reconfigArg(ArgConfig): r"""Reconfigures an argument based on its configuration. """ _type = ArgConfig.get('type') if _type: if hasattr(_type, '__ec_config__'): # pass the ArgConfig to the CustomType: _type.__ec_config__(ArgConfig) if not 'type_str' in ArgConfig: ArgConfig['type_str'] = (_type.__name__ if isinstanc... |
def gatherInput(**Config): r"""Helps to interactively get user input. """ _type = Config.get('type') while True: try: got = raw_input('%s: ' % getLabel(Config)) except EOFError: got = None if not got and 'default' in Config: return Config['default'] try: return _type(got) if _type else got except ValueError as e: err(s... |
def getTaskHelp(_Task): r"""Gets help on the given task member. """ Ret = [] for k in ['name', 'desc']: v = _Task.Config.get(k) if v is not None: Ret.append('%s: %s' % (k, v)) Args = _Task.Args if Args: Ret.append('\nArgs:') for argName, Arg in Args.items(): Ret.append(' %s: %s' % (argName, Arg.get('desc', Arg['type_st... |
def restart_in_venv(venv, base, site_packages, args): """ Restart this script using the interpreter in the given virtual environment """ if base and not os.path.isabs(venv) and not venv.startswith('~'): base = os.path.expanduser(base) # ensure we have an abs basepath at this point: # a relative one makes no sense (or d... |
python = os.path.join(venv, 'bin', 'python.exe') else: python = os.path.join(venv, 'bin', 'python') if not os.path.exists(python): python = venv if not os.path.exists(python): raise BadCommand('Cannot find virtual environment interpreter at %s' % python) base = os.path.dirname(os.path.dirname(python)) file = os.path.jo... |
async def history(client: Client, pubkey: str) -> dict: """ Get transactions history of public key :param client: Client to connect to the api :param pubkey: Public key :return: """ return await client.get(MODULE + '/history/%s' % pubkey, schema=HISTORY_SCHEMA) |
async def process(client: Client, transaction_signed_raw: str) -> ClientResponse: """ POST a transaction raw document :param client: Client to connect to the api :param transaction_signed_raw: Transaction signed raw document :return: """ return await client.post(MODULE + '/process', {'transaction': transaction_signed_r... |
async def sources(client: Client, pubkey: str) -> dict: """ GET transaction sources :param client: Client to connect to the api :param pubkey: Public key :return: """ return await client.get(MODULE + '/sources/%s' % pubkey, schema=SOURCES_SCHEMA) |
async def blocks(client: Client, pubkey: str, start: int, end: int) -> dict: """ GET public key transactions history between start and end block number :param client: Client to connect to the api :param pubkey: Public key :param start: Start from block number :param end: End to block number :return: """ return await cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.