Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def audio_send_stream(self, httptype=None, channel=None, path_file=None, encode=None): if httptype is None or channel is None: raise RuntimeError("Requires htttype and channel") file_audio = { 'file'...
[ "\n Params:\n\n path_file - path to audio file\n channel: - integer\n httptype - type string (singlepart or multipart)\n\n singlepart: HTTP content is a continuos flow of audio packets\n multipart: HTTP content type is multipart/x-mixed-replace, ...
Please provide a description of the function:def audio_stream_capture(self, httptype=None, channel=None, path_file=None): if httptype is None and channel is None: raise RuntimeError("Requires htttype and channel") ret = self.command( 'audio....
[ "\n Params:\n\n path_file - path to output file\n channel: - integer\n httptype - type string (singlepart or multipart)\n\n singlepart: HTTP content is a continuos flow of audio packets\n multipart: HTTP content type is multipart/x-mixed-replace,...
Please provide a description of the function:def approvecommittee(ctx, members, account): pprint(ctx.peerplays.approvecommittee(members, account=account))
[ " Approve committee member(s)\n " ]
Please provide a description of the function:def disapprovecommittee(ctx, members, account): pprint(ctx.peerplays.disapprovecommittee(members, account=account))
[ " Disapprove committee member(s)\n " ]
Please provide a description of the function:def getkey(ctx, pubkey): click.echo(ctx.peerplays.wallet.getPrivateKeyForPublicKey(pubkey))
[ " Obtain private key in WIF format\n " ]
Please provide a description of the function:def listkeys(ctx): t = PrettyTable(["Available Key"]) t.align = "l" for key in ctx.peerplays.wallet.getPublicKeys(): t.add_row([key]) click.echo(t)
[ " List all keys (for all networks)\n " ]
Please provide a description of the function:def listaccounts(ctx): t = PrettyTable(["Name", "Key", "Owner", "Active", "Memo"]) for key in ctx.blockchain.wallet.getPublicKeys(True): for account in ctx.blockchain.wallet.getAccountsFromPublicKey(key): account = Account(account) ...
[ " List accounts (for the connected network)\n " ]
Please provide a description of the function:def importaccount(ctx, account, role): from peerplaysbase.account import PasswordKey password = click.prompt("Account Passphrase", hide_input=True) account = Account(account, peerplays_instance=ctx.peerplays) imported = False if role == "owner": ...
[ " Import an account using an account password\n " ]
Please provide a description of the function:def sports(ctx): sports = Sports(peerplays_instance=ctx.peerplays) click.echo(pretty_print(sports, ctx=ctx))
[ " [bookie] List sports " ]
Please provide a description of the function:def eventgroups(ctx, sport): sport = Sport(sport, peerplays_instance=ctx.peerplays) click.echo(pretty_print(sport.eventgroups, ctx=ctx))
[ " [bookie] List event groups for a sport\n\n :param str sport: Sports id\n " ]
Please provide a description of the function:def events(ctx, eventgroup): eg = EventGroup(eventgroup, peerplays_instance=ctx.peerplays) click.echo(pretty_print(eg.events, ctx=ctx))
[ " [bookie] List events for an event group\n\n :param str eventgroup: Event Group id\n " ]
Please provide a description of the function:def bmgs(ctx, event): eg = Event(event, peerplays_instance=ctx.peerplays) click.echo(pretty_print(eg.bettingmarketgroups, ctx=ctx))
[ " [bookie] List betting market groups for an event\n\n :param str event: Event id\n " ]
Please provide a description of the function:def bettingmarkets(ctx, bmg): bmg = BettingMarketGroup(bmg, peerplays_instance=ctx.peerplays) click.echo(pretty_print(bmg.bettingmarkets, ctx=ctx))
[ " [bookie] List betting markets for bmg\n\n :param str bmg: Betting market id\n " ]
Please provide a description of the function:def rules(ctx): rules = Rules(peerplays_instance=ctx.peerplays) click.echo(pretty_print(rules, ctx=ctx))
[ " [bookie] List all rules\n " ]
Please provide a description of the function:def rule(ctx, rule): rule = Rule(rule, peerplays_instance=ctx.peerplays) t = PrettyTable([ "id", "name", ]) t.align = "l" t.add_row([ rule["id"], "\n".join(["{}: {}".format(v[0], v[1]) for v in rule["name"]]), ]) ...
[ " [bookie] Show a specific rule\n\n :param str bmg: Betting market id\n " ]
Please provide a description of the function:def list(ctx, sport): from .ui import maplist2dict from tqdm import tqdm from treelib import Node, Tree tree = Tree() tree.create_node("sports", "root") def formatname(o): if "name" in o: name = o.get("name") elif "de...
[ " [bookie] list the entire thing\n " ]
Please provide a description of the function:def rpc(ctx, call, arguments, api): try: data = list(eval(d) for d in arguments) except: data = arguments ret = getattr(ctx.peerplays.rpc, call)(*data, api=api) pprint(ret)
[ " Construct RPC call directly\n \\b\n You can specify which API to send the call to:\n\n peerplays rpc --api bookie get_matched_bets_for_bettor 1.2.0\n\n You can also specify lists using\n\n peerplays rpc get_objects \"['2.0.0', '2.1.0']\"\n\n " ]
Please provide a description of the function:def assets(ctx): "List Assets" MAX_ASSET = 100000 assets = [] for i in range(0, MAX_ASSET): try: assets.append(Asset("1.3.{}".format(i))) except AssetDoesNotExistsException: break assetTable = PrettyTable() ...
[]
Please provide a description of the function:def info(ctx, objects): if not objects: t = PrettyTable(["Key", "Value"]) t.align = "l" info = ctx.peerplays.rpc.get_dynamic_global_properties() for key in info: t.add_row([key, info[key]]) click.echo(t.get_string(...
[ " Obtain all kinds of information\n " ]
Please provide a description of the function:def fees(ctx): from peerplaysbase.operationids import getOperationNameForId chain = Blockchain(peerplays_instance=ctx.peerplays) feesObj = chain.chainParameters().get("current_fees") fees = feesObj["parameters"] t = PrettyTable(["Operation", "Type"...
[ " List fees\n " ]
Please provide a description of the function:def create_account( self, account_name, registrar=None, referrer="1.2.0", referrer_percent=50, owner_key=None, active_key=None, memo_key=None, password=None, additional_owner_keys=[], add...
[ " Create new account on PeerPlays\n\n The brainkey/password can be used to recover all generated keys\n (see `peerplaysbase.account` for more details.\n\n By default, this call will use ``default_account`` to\n register a new name ``account_name`` with all keys being\n ...
Please provide a description of the function:def disallow( self, foreign, permission="active", account=None, threshold=None, **kwargs ): if not account: if "default_account" in self.config: account = self.config["default_account"] if not account: ...
[ " Remove additional access to an account by some other public\n key or account.\n\n :param str foreign: The foreign account that will obtain access\n :param str permission: (optional) The actual permission to\n modify (defaults to ``active``)\n :param str a...
Please provide a description of the function:def approvewitness(self, witnesses, account=None, **kwargs): if not account: if "default_account" in self.config: account = self.config["default_account"] if not account: raise ValueError("You need to provide a...
[ " Approve a witness\n\n :param list witnesses: list of Witness name or id\n :param str account: (optional) the account to allow access\n to (defaults to ``default_account``)\n " ]
Please provide a description of the function:def approvecommittee(self, committees, account=None, **kwargs): if not account: if "default_account" in self.config: account = self.config["default_account"] if not account: raise ValueError("You need to provid...
[ " Approve a committee\n\n :param list committees: list of committee member name or id\n :param str account: (optional) the account to allow access\n to (defaults to ``default_account``)\n " ]
Please provide a description of the function:def sport_create(self, names, account=None, **kwargs): assert isinstance(names, list) if not account: if "default_account" in self.config: account = self.config["default_account"] if not account: raise ...
[ " Create a sport. This needs to be **proposed**.\n\n :param list names: Internationalized names, e.g. ``[['de', 'Foo'],\n ['en', 'bar']]``\n :param str account: (optional) the account to allow access\n to (defaults to ``default_account``)\n " ]
Please provide a description of the function:def sport_update(self, sport_id, names=[], account=None, **kwargs): assert isinstance(names, list) if not account: if "default_account" in self.config: account = self.config["default_account"] if not account: ...
[ " Update a sport. This needs to be **proposed**.\n\n :param str sport_id: The id of the sport to update\n :param list names: Internationalized names, e.g. ``[['de', 'Foo'],\n ['en', 'bar']]``\n :param str account: (optional) the account to allow access\n ...
Please provide a description of the function:def sport_delete(self, sport_id="0.0.0", account=None, **kwargs): if not account: if "default_account" in config: account = config["default_account"] if not account: raise ValueError("You need to prov...
[ " Remove a sport. This needs to be **proposed**.\n\n :param str sport_id: Sport ID to identify the Sport to be deleted\n\n :param str account: (optional) Account used to verify the operation\n " ]
Please provide a description of the function:def event_group_create(self, names, sport_id="0.0.0", account=None, **kwargs): assert isinstance(names, list) if not account: if "default_account" in self.config: account = self.config["default_account"] if not acc...
[ " Create an event group. This needs to be **proposed**.\n\n :param list names: Internationalized names, e.g. ``[['de', 'Foo'],\n ['en', 'bar']]``\n :param str sport_id: Sport ID to create the event group for\n (defaults to *relative* id ``0.0.0``)\n :pa...
Please provide a description of the function:def event_group_update( self, event_group_id, names=[], sport_id="0.0.0", account=None, **kwargs ): assert isinstance(names, list) if not account: if "default_account" in self.config: account = self.config["def...
[ " Update an event group. This needs to be **proposed**.\n\n :param str event_id: Id of the event group to update\n :param list names: Internationalized names, e.g. ``[['de', 'Foo'],\n ['en', 'bar']]``\n :param str sport_id: Sport ID to create the event group for\n ...
Please provide a description of the function:def eventgroup_delete(self, event_group_id="0.0.0", account=None, **kwargs): if not account: if "default_account" in config: account = config["default_account"] if not account: raise ValueError("You need to pro...
[ " Delete an eventgroup. This needs to be **propose**.\n\n :param str event_group_id: ID of the event group to be deleted\n\n :param str account: (optional) Account used to verify the operation" ]
Please provide a description of the function:def event_create( self, name, season, start_time, event_group_id="0.0.0", account=None, **kwargs ): assert isinstance(season, list) assert isinstance( start_time, datetime ), "start_time needs to be a `datetime.datetim...
[ " Create an event. This needs to be **proposed**.\n\n :param list name: Internationalized names, e.g. ``[['de', 'Foo'],\n ['en', 'bar']]``\n :param list season: Internationalized season, e.g. ``[['de',\n 'Foo'], ['en', 'bar']]``\n :param str event_group...
Please provide a description of the function:def event_update( self, event_id, name=None, season=None, start_time=None, event_group_id=None, status=None, account=None, **kwargs ): assert isinstance(season, list) assert ...
[ " Update an event. This needs to be **proposed**.\n\n :param str event_id: Id of the event to update\n :param list name: Internationalized names, e.g. ``[['de', 'Foo'],\n ['en', 'bar']]``\n :param list season: Internationalized season, e.g. ``[['de',\n ...
Please provide a description of the function:def event_update_status(self, event_id, status, scores=[], account=None, **kwargs): if not account: if "default_account" in self.config: account = self.config["default_account"] if not account: raise ValueError...
[ " Update the status of an event. This needs to be **proposed**.\n\n :param str event_id: Id of the event to update\n :param str status: Event status\n :param list scores: List of strings that represent the scores of a\n match (defaults to [])\n :param str a...
Please provide a description of the function:def betting_market_rules_create(self, names, descriptions, account=None, **kwargs): assert isinstance(names, list) assert isinstance(descriptions, list) if not account: if "default_account" in self.config: account ...
[ " Create betting market rules\n\n :param list names: Internationalized names, e.g. ``[['de', 'Foo'],\n ['en', 'bar']]``\n :param list descriptions: Internationalized descriptions, e.g.\n ``[['de', 'Foo'], ['en', 'bar']]``\n :param str account: (optional...
Please provide a description of the function:def betting_market_rules_update( self, rules_id, names, descriptions, account=None, **kwargs ): assert isinstance(names, list) assert isinstance(descriptions, list) if not account: if "default_account" in self.config: ...
[ " Update betting market rules\n\n :param str rules_id: Id of the betting market rules to update\n :param list names: Internationalized names, e.g. ``[['de', 'Foo'],\n ['en', 'bar']]``\n :param list descriptions: Internationalized descriptions, e.g.\n ``...
Please provide a description of the function:def betting_market_group_create( self, description, event_id="0.0.0", rules_id="0.0.0", asset=None, delay_before_settling=0, never_in_play=False, resolution_constraint="exactly_one_winner", account=None,...
[ " Create an betting market. This needs to be **proposed**.\n\n :param list description: Internationalized list of descriptions\n :param str event_id: Event ID to create this for (defaults to\n *relative* id ``0.0.0``)\n :param str rule_id: Rule ID to create this with ...
Please provide a description of the function:def betting_market_group_update( self, betting_market_group_id, description=None, event_id=None, rules_id=None, status=None, account=None, **kwargs ): if not account: if "default...
[ " Update an betting market. This needs to be **proposed**.\n\n :param str betting_market_group_id: Id of the betting market group\n to update\n :param list description: Internationalized list of descriptions\n :param str event_id: Event ID to create this for\n ...
Please provide a description of the function:def betting_market_create( self, payout_condition, description, group_id="0.0.0", account=None, **kwargs ): assert isinstance(payout_condition, list) if not account: if "default_account" in self.config: account...
[ " Create an event group. This needs to be **proposed**.\n\n :param list payout_condition: Internationalized names, e.g.\n ``[['de', 'Foo'], ['en', 'bar']]``\n :param list description: Internationalized descriptions, e.g.\n ``[['de', 'Foo'], ['en', 'bar']]``\n ...
Please provide a description of the function:def betting_market_update( self, betting_market_id, payout_condition, description, group_id="0.0.0", account=None, **kwargs ): assert isinstance(payout_condition, list) if not account: ...
[ " Update an event group. This needs to be **proposed**.\n\n :param str betting_market_id: Id of the betting market to update\n :param list payout_condition: Internationalized names, e.g.\n ``[['de', 'Foo'], ['en', 'bar']]``\n :param list description: Internationalized...
Please provide a description of the function:def betting_market_resolve( self, betting_market_group_id, results, account=None, **kwargs ): assert isinstance(results, (list, set, tuple)) if not account: if "default_account" in self.config: account = self.c...
[ " Create an betting market. This needs to be **proposed**.\n\n :param str betting_market_group_id: Market Group ID to resolve\n :param list results: Array of Result of the market (``win``,\n ``not_win``, or ``cancel``)\n :param str account: (optional) the account to a...
Please provide a description of the function:def bet_place( self, betting_market_id, amount_to_bet, backer_multiplier, back_or_lay, account=None, **kwargs ): from . import GRAPHENE_BETTING_ODDS_PRECISION assert isinstance(amount_to_be...
[ " Place a bet\n\n :param str betting_market_id: The identifier for the market to bet\n in\n :param peerplays.amount.Amount amount_to_bet: Amount to bet with\n :param int backer_multiplier: Multipler for backer\n :param str back_or_lay: \"back\" or \"lay\" t...
Please provide a description of the function:def bet_cancel(self, bet_to_cancel, account=None, **kwargs): if not account: if "default_account" in self.config: account = self.config["default_account"] if not account: raise ValueError("You need to provide a...
[ " Cancel a bet\n\n :param str bet_to_cancel: The identifier that identifies the bet to\n cancel\n :param str account: (optional) the account that owns the bet\n (defaults to ``default_account``)\n " ]
Please provide a description of the function:def verbose(f): @click.pass_context def new_func(ctx, *args, **kwargs): global log verbosity = ["critical", "error", "warn", "info", "debug"][ int(min(ctx.obj.get("verbose", 0), 4)) ] log.setLevel(getattr(logging, ver...
[ " Add verbose flags and add logging handlers\n " ]
Please provide a description of the function:def offline(f): @click.pass_context @verbose def new_func(ctx, *args, **kwargs): ctx.obj["offline"] = True ctx.peerplays = PeerPlays(**ctx.obj) ctx.blockchain = ctx.peerplays set_shared_peerplays_instance(ctx.peerplays) ...
[ " This decorator allows you to access ``ctx.peerplays`` which is\n an instance of PeerPlays with ``offline=True``.\n " ]
Please provide a description of the function:def customchain(**kwargsChain): def wrap(f): @click.pass_context @verbose def new_func(ctx, *args, **kwargs): newoptions = ctx.obj newoptions.update(kwargsChain) ctx.peerplays = PeerPlays(**newoptions) ...
[ " This decorator allows you to access ``ctx.peerplays`` which is\n an instance of Peerplays. But in contrast to @chain, this is a\n decorator that expects parameters that are directed right to\n ``PeerPlays()``.\n\n ... code-block::python\n\n @main.command()\n ...
Please provide a description of the function:def configfile(f): @click.pass_context def new_func(ctx, *args, **kwargs): ctx.config = yaml.load(open(ctx.obj["configfile"])) return ctx.invoke(f, *args, **kwargs) return update_wrapper(new_func, f)
[ " This decorator will parse a configuration file in YAML format\n and store the dictionary in ``ctx.blockchain.config``\n " ]
Please provide a description of the function:def allow(ctx, foreign_account, permission, weight, threshold, account): if not foreign_account: from peerplaysbase.account import PasswordKey pwd = click.prompt( "Password for Key Derivation", hide_input=True, confirmation_prompt=True ...
[ " Add a key/account to an account's permission\n " ]
Please provide a description of the function:def disallow(ctx, foreign_account, permission, threshold, account): pprint( ctx.peerplays.disallow( foreign_account, account=account, permission=permission, threshold=threshold ) )
[ " Remove a key/account from an account's permission\n " ]
Please provide a description of the function:def history(ctx, account, limit, type, csv, exclude, raw): from peerplaysbase.operations import getOperationNameForId header = ["#", "time (block)", "operation", "details"] if csv: import csv t = csv.writer(sys.stdout, delimiter=";") ...
[ " Show history of an account\n " ]
Please provide a description of the function:def transfer(ctx, to, amount, asset, memo, account): pprint(ctx.peerplays.transfer(to, amount, asset, memo=memo, account=account))
[ " Transfer assets\n " ]
Please provide a description of the function:def balance(ctx, accounts): t = PrettyTable(["Account", "Amount"]) t.align = "r" for a in accounts: account = Account(a, peerplays_instance=ctx.peerplays) for b in account.balances: t.add_row([str(a), str(b)]) click.echo(str(t...
[ " Show Account balances\n " ]
Please provide a description of the function:def newaccount(ctx, accountname, account, password): pprint( ctx.peerplays.create_account(accountname, registrar=account, password=password) )
[ " Create a new account\n " ]
Please provide a description of the function:def changememokey(ctx, key, account): pprint(ctx.blockchain.update_memo_key(key, account=account))
[ " Change the memo key of an account\n " ]
Please provide a description of the function:def approvewitness(ctx, witnesses, account): pprint(ctx.peerplays.approvewitness(witnesses, account=account))
[ " Approve witness(es)\n " ]
Please provide a description of the function:def disapprovewitness(ctx, witnesses, account): pprint(ctx.peerplays.disapprovewitness(witnesses, account=account))
[ " Disapprove witness(es)\n " ]
Please provide a description of the function:def on_open(self, ws): self.login(self.user, self.password, api_id=1) self.database(api_id=1) self.cancel_all_subscriptions() # Subscribe to events on the Backend and give them a # callback number that allows us to identify t...
[ " This method will be called once the websocket connection is\n established. It will\n\n * login,\n * register to the database api, and\n * subscribe to the objects defined if there is a\n callback/slot available for callbacks\n " ]
Please provide a description of the function:def on_message(self, ws, reply, *args): log.debug("Received message: %s" % str(reply)) data = {} try: data = json.loads(reply, strict=False) except ValueError: raise ValueError("API node returned invalid format...
[ " This method is called by the websocket connection on every\n message that is received. If we receive a ``notice``, we\n hand over post-processing and signalling of events to\n ``process_notice``.\n " ]
Please provide a description of the function:def on_close(self, ws): log.debug("Closing WebSocket connection with {}".format(self.url)) if self.keepalive and self.keepalive.is_alive(): self.keepalive.do_run = False self.keepalive.join()
[ " Called when websocket connection is closed\n " ]
Please provide a description of the function:def run_forever(self): cnt = 0 while True: cnt += 1 self.url = next(self.urls) log.debug("Trying to connect to node %s" % self.url) try: # websocket.enableTrace(True) sel...
[ " This method is used to run the websocket app continuously.\n It will execute callbacks as defined and try to stay\n connected with the provided APIs\n " ]
Please provide a description of the function:def set(ctx, key, value): if key == "default_account" and value[0] == "@": value = value[1:] ctx.blockchain.config[key] = value
[ " Set configuration parameters\n " ]
Please provide a description of the function:def disapproveproposal(ctx, proposal, account): pprint(ctx.peerplays.disapproveproposal(proposal, account=account))
[ " Disapprove a proposal\n " ]
Please provide a description of the function:def approveproposal(ctx, proposal, account): pprint(ctx.peerplays.approveproposal(proposal, account=account))
[ " Approve a proposal\n " ]
Please provide a description of the function:def proposals(ctx, account): proposals = Proposals(account) t = PrettyTable( [ "id", "expiration", "proposer", "required approvals", "available approvals", "review period time", ...
[ " List proposals\n " ]
Please provide a description of the function:def get_network(self): props = self.get_chain_properties() chain_id = props["chain_id"] for k, v in known_chains.items(): if v["chain_id"] == chain_id: return v raise Exception("Connecting to unknown networ...
[ " Identify the connected network. This call returns a\n dictionary with keys chain_id, core_symbol and prefix\n " ]
Please provide a description of the function:def sign(ctx, file, account): if not file: # click.echo("Prompting for message. Terminate with CTRL-D") file = click.get_text_stream("stdin") m = Message(file.read(), peerplays_instance=ctx.peerplays) click.echo(m.sign(account))
[ " Sign a message with an account\n " ]
Please provide a description of the function:def register_dataframe_method(method): def inner(*args, **kwargs): class AccessorMethod(object): def __init__(self, pandas_obj): self._obj = pandas_obj @wraps(method) def __call__(self, *args, **kwargs)...
[ "Register a function as a method attached to the Pandas DataFrame.\n\n Example\n -------\n\n .. code-block:: python\n\n @register_dataframe_method\n def print_column(df, col):\n '''Print the dataframe column given'''\n print(df[col])\n " ]
Please provide a description of the function:def register_series_method(method): def inner(*args, **kwargs): class AccessorMethod(object): __doc__ = method.__doc__ def __init__(self, pandas_obj): self._obj = pandas_obj @wraps(method) de...
[ "Register a function as a method attached to the Pandas Series.\n " ]
Please provide a description of the function:def add_invites_to_user(cls, user, amount): stat, _ = InvitationStat.objects.get_or_create(user=user) if stat.invites_allocated != -1: stat.invites_allocated += amount stat.save()
[ "\n Add the specified number of invites to current allocated total.\n " ]
Please provide a description of the function:def add_invites(cls, amount): for user in get_user_model().objects.all(): cls.add_invites_to_user(user, amount)
[ "\n Add invites for all users.\n " ]
Please provide a description of the function:def topoff_user(cls, user, amount): stat, _ = cls.objects.get_or_create(user=user) remaining = stat.invites_remaining() if remaining != -1 and remaining < amount: stat.invites_allocated += (amount - remaining) stat.sav...
[ "\n Ensure user has a minimum number of invites.\n " ]
Please provide a description of the function:def topoff(cls, amount): for user in get_user_model().objects.all(): cls.topoff_user(user, amount)
[ "\n Ensure all users have a minimum number of invites.\n " ]
Please provide a description of the function:def hexdump( src, length=16, sep='.', start = 0): ''' @brief Return {src} in hex dump. @param[in] length {Int} Nb Bytes by row. @param[in] sep {Char} For the text part, {sep} will be used for non ASCII char. @return {Str} The hexdump @note Full support for python2 an...
[]
Please provide a description of the function:def parse_mini(memory_decriptor, buff): mms = MinidumpMemorySegment() mms.start_virtual_address = memory_decriptor.StartOfMemoryRange mms.size = memory_decriptor.Memory.DataSize mms.start_file_address = memory_decriptor.Memory.Rva mms.end_virtual_address = mms.s...
[ "\n\t\tmemory_descriptor: MINIDUMP_MEMORY_DESCRIPTOR\n\t\tbuff: file_handle\n\t\t" ]
Please provide a description of the function:def parse(mod, buff): mm = MinidumpUnloadedModule() mm.baseaddress = mod.BaseOfImage mm.size = mod.SizeOfImage mm.checksum = mod.CheckSum mm.timestamp = mod.TimeDateStamp mm.name = MINIDUMP_STRING.get_from_rva(mod.ModuleNameRva, buff) mm.endaddress = mm.base...
[ "\n\t\tmod: MINIDUMP_MODULE\n\t\tbuff: file handle\n\t\t" ]
Please provide a description of the function:def seek(self, offset, whence = 0): if whence == 0: t = self.current_segment.start_address + offset elif whence == 1: t = self.current_position + offset elif whence == 2: t = self.current_segment.end_address - offset else: raise Exception('Seek functio...
[ "\n\t\tChanges the current address to an offset of offset. The whence parameter controls from which position should we count the offsets.\n\t\t0: beginning of the current memory segment\n\t\t1: from current position\n\t\t2: from the end of the current memory segment\n\t\tIf you wish to move out from the segment, us...
Please provide a description of the function:def align(self, alignment = None): if alignment is None: if self.reader.sysinfo.ProcessorArchitecture == PROCESSOR_ARCHITECTURE.AMD64: alignment = 8 else: alignment = 4 offset = self.current_position % alignment if offset == 0: return offset_to_al...
[ "\n\t\tRepositions the current reader to match architecture alignment\n\t\t" ]
Please provide a description of the function:def peek(self, length): t = self.current_position + length if not self.current_segment.inrange(t): raise Exception('Would read over segment boundaries!') return self.current_segment.data[self.current_position - self.current_segment.start_address :t - self.current...
[ "\n\t\tReturns up to length bytes from the current memory segment\n\t\t" ]
Please provide a description of the function:def read(self, size = -1): if size < -1: raise Exception('You shouldnt be doing this') if size == -1: t = self.current_segment.remaining_len(self.current_position) if not t: return None old_new_pos = self.current_position self.current_position =...
[ "\n\t\tReturns data bytes of size size from the current segment. If size is -1 it returns all the remaining data bytes from memory segment\n\t\t" ]
Please provide a description of the function:def find(self, pattern): pos = self.current_segment.data.find(pattern) if pos == -1: return -1 return pos + self.current_position
[ "\n\t\tSearches for a pattern in the current memory segment\n\t\t" ]
Please provide a description of the function:def find_all(self, pattern): pos = [] last_found = -1 while True: last_found = self.current_segment.data.find(pattern, last_found + 1) if last_found == -1: break pos.append(last_found + self.current_segment.start_address) return pos
[ "\n\t\tSearches for all occurrences of a pattern in the current memory segment, returns all occurrences as a list\n\t\t" ]
Please provide a description of the function:def find_global(self, pattern): pos_s = self.reader.search(pattern) if len(pos_s) == 0: return -1 return pos_s[0]
[ "\n\t\tSearches for the pattern in the whole process memory space and returns the first occurrence.\n\t\tThis is exhaustive!\n\t\t" ]
Please provide a description of the function:def report_privilege_information(): "Report all privilege information assigned to the current process." privileges = get_privilege_information() print("found {0} privileges".format(privileges.count)) tuple(map(print, privileges))
[]
Please provide a description of the function:async def handle(self): # For each channel, launch its own listening coroutine listeners = [] for key, value in self.beat_config.items(): listeners.append(asyncio.ensure_future( self.listener(key) )) ...
[ "\n Listens on all the provided channels and handles the messages.\n " ]
Please provide a description of the function:async def emitters(self, key, value): while True: await asyncio.sleep(value['schedule'].total_seconds()) await self.channel_layer.send(key, { "type": value['type'], "message": value['message'] ...
[ "\n Single-channel emitter\n " ]
Please provide a description of the function:async def listener(self, channel): while True: message = await self.channel_layer.receive(channel) if not message.get("type", None): raise ValueError("Worker received message with no type.") # Make a scope ...
[ "\n Single-channel listener\n " ]
Please provide a description of the function:def overall_rating(object, category=""): try: ct = ContentType.objects.get_for_model(object) if category: rating = OverallRating.objects.get( object_id=object.pk, content_type=ct, category=c...
[ "\n Usage:\n {% overall_rating obj [category] as var %}\n " ]
Please provide a description of the function:def rating_count(obj): count = Rating.objects.filter( object_id=obj.pk, content_type=ContentType.objects.get_for_model(obj), ).exclude(rating=0).count() return count
[ "\n Total amount of users who have submitted a positive rating for this object.\n\n Usage:\n {% rating_count obj %}\n " ]
Please provide a description of the function:def set_pixel(self, x, y, value): if x < 0 or x > 7 or y < 0 or y > 7: # Ignore out of bounds pixels. return # Set green LED based on 1st bit in value. self.set_led(y * 16 + x, 1 if value & GREEN > 0 else 0) # ...
[ "Set pixel at position x, y to the given value. X and Y should be values\n of 0 to 8. Value should be OFF, GREEN, RED, or YELLOW.\n " ]
Please provide a description of the function:def set_image(self, image): imwidth, imheight = image.size if imwidth != 8 or imheight != 8: raise ValueError('Image must be an 8x8 pixels in size.') # Convert image to RGB and grab all the pixels. pix = image.convert('RGB...
[ "Set display buffer to Python Image Library image. Red pixels (r=255,\n g=0, b=0) will map to red LEDs, green pixels (r=0, g=255, b=0) will map to\n green LEDs, and yellow pixels (r=255, g=255, b=0) will map to yellow LEDs.\n All other pixel values will map to an unlit LED value.\n " ]
Please provide a description of the function:def set_bar(self, bar, value): if bar < 0 or bar > 23: # Ignore out of bounds bars. return # Compute cathode and anode value. c = (bar if bar < 12 else bar - 12) // 4 a = bar % 4 if bar >= 12: ...
[ "Set bar to desired color. Bar should be a value of 0 to 23, and value\n should be OFF, GREEN, RED, or YELLOW.\n " ]
Please provide a description of the function:def animate(self, images, delay=.25): for image in images: # Draw the image on the display buffer. self.set_image(image) # Draw the buffer to the display hardware. self.write_display() time.sleep(d...
[ "Displays each of the input images in order, pausing for \"delay\"\n seconds after each image.\n\n Keyword arguments:\n image -- An iterable collection of Image objects.\n delay -- How many seconds to wait after displaying an image before\n displaying the next one. (Default = ...
Please provide a description of the function:def set_pixel(self, x, y, value): if x < 0 or x > 7 or y < 0 or y > 15: # Ignore out of bounds pixels. return self.set_led((7 - x) * 16 + y, value)
[ "Set pixel at position x, y to the given value. X and Y should be values\n of 0 to 7 and 0 to 15, resp. Value should be 0 for off and non-zero for on.\n " ]
Please provide a description of the function:def set_image(self, image): imwidth, imheight = image.size if imwidth != 8 or imheight != 16: raise ValueError('Image must be an 8x16 pixels in size.') # Convert image to 1 bit color and grab all the pixels. pix = image.co...
[ "Set display buffer to Python Image Library image. Image will be converted\n to 1 bit color and non-zero color values will light the LEDs.\n " ]
Please provide a description of the function:def horizontal_scroll(self, image, padding=True): image_list = list() width = image.size[0] # Scroll into the blank image. if padding: for x in range(8): section = image.crop((0, 0, x, 16)) ...
[ "Returns a list of images which appear to scroll from left to right\n across the input image when displayed on the LED matrix in order.\n\n The input image is not limited to being 8x16. If the input image is\n larger than this, then all columns will be scrolled through but only\n the top...
Please provide a description of the function:def vertical_scroll(self, image, padding=True): image_list = list() height = image.size[1] # Scroll into the blank image. if padding: for y in range(16): section = image.crop((0, 0, 8, y)) ...
[ "Returns a list of images which appear to scroll from top to bottom\n down the input image when displayed on the LED matrix in order.\n\n The input image is not limited to being 8x16. If the input image is\n largerthan this, then all rows will be scrolled through but only the\n left-most...
Please provide a description of the function:def set_digit_raw(self, pos, bitmask): if pos < 0 or pos > 3: # Ignore out of bounds digits. return # Set the digit bitmask value at the appropriate position. # Also set bit 7 (decimal point) if decimal is True. ...
[ "Set digit at position to raw bitmask value. Position should be a value\n of 0 to 3 with 0 being the left most digit on the display." ]
Please provide a description of the function:def set_decimal(self, pos, decimal): if pos < 0 or pos > 3: # Ignore out of bounds digits. return # Set bit 14 (decimal point) based on provided value. if decimal: self.buffer[pos*2+1] |= (1 << 6) e...
[ "Turn decimal point on or off at provided position. Position should be\n a value 0 to 3 with 0 being the left most digit on the display. Decimal\n should be True to turn on the decimal point and False to turn it off.\n " ]
Please provide a description of the function:def set_digit(self, pos, digit, decimal=False): self.set_digit_raw(pos, DIGIT_VALUES.get(str(digit), 0x00)) if decimal: self.set_decimal(pos, True)
[ "Set digit at position to provided value. Position should be a value\n of 0 to 3 with 0 being the left most digit on the display. Digit should\n be any ASCII value 32-127 (printable ASCII).\n " ]
Please provide a description of the function:def print_str(self, value, justify_right=True): # Calculcate starting position of digits based on justification. pos = (4-len(value)) if justify_right else 0 # Go through each character and print it on the display. for i, ch in enumer...
[ "Print a 4 character long string of values to the display. Characters\n in the string should be any ASCII value 32 to 127 (printable ASCII).\n " ]
Please provide a description of the function:def print_number_str(self, value, justify_right=True): # Calculate length of value without decimals. length = len(value.translate(None, '.')) # Error if value without decimals is longer than 4 characters. if length > 4: se...
[ "Print a 4 character long string of numeric values to the display. This\n function is similar to print_str but will interpret periods not as\n characters but as decimal points associated with the previous character.\n " ]