_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q3000
formatted_str_to_val
train
def formatted_str_to_val(data, format, enum_set=None): """ Return an unsigned integer representation of the data given format specified. :param data: a string holding the value to convert :param format: a string holding a format which will be used to convert the data string :param enum_set: an iterable...
python
{ "resource": "" }
q3001
val_to_formatted_str
train
def val_to_formatted_str(val, format, enum_set=None): """ Return a string representation of the value given format specified. :param val: a string holding an unsigned integer to convert :param format: a string holding a format which will be used to convert the data string :param enum_set: an iterable o...
python
{ "resource": "" }
q3002
_NetCount.shrank
train
def shrank(self, block=None, percent_diff=0, abs_diff=1): """ Returns whether a block has less nets than before :param Block block: block to check (if changed) :param Number percent_diff: percentage difference threshold :param int abs_diff: absolute difference threshold ...
python
{ "resource": "" }
q3003
kogge_stone
train
def kogge_stone(a, b, cin=0): """ Creates a Kogge-Stone adder given two inputs :param WireVector a, b: The two WireVectors to add up (bitwidths don't need to match) :param cin: An optimal carry in WireVector or value :return: a Wirevector representing the output of the adder The Kogge-Stone ad...
python
{ "resource": "" }
q3004
_cla_adder_unit
train
def _cla_adder_unit(a, b, cin): """ Carry generation and propogation signals will be calculated only using the inputs; their values don't rely on the sum. Every unit generates a cout signal which is used as cin for the next unit. """ gen = a & b prop = a ^ b assert(len(prop) == len(gen)...
python
{ "resource": "" }
q3005
fast_group_adder
train
def fast_group_adder(wires_to_add, reducer=wallace_reducer, final_adder=kogge_stone): """ A generalization of the carry save adder, this is designed to add many numbers together in a both area and time efficient manner. Uses a tree reducer to achieve this performance :param [WireVector] wires_to_a...
python
{ "resource": "" }
q3006
MemBlock._build
train
def _build(self, addr, data, enable): """ Builds a write port. """ if self.max_write_ports is not None: self.write_ports += 1 if self.write_ports > self.max_write_ports: raise PyrtlError('maximum number of write ports (%d) exceeded' % ...
python
{ "resource": "" }
q3007
AES.encryption
train
def encryption(self, plaintext, key): """ Builds a single cycle AES Encryption circuit :param WireVector plaintext: text to encrypt :param WireVector key: AES key to use to encrypt :return: a WireVector containing the ciphertext """ if len(plaintext) != self._ke...
python
{ "resource": "" }
q3008
AES.encrypt_state_m
train
def encrypt_state_m(self, plaintext_in, key_in, reset): """ Builds a multiple cycle AES Encryption state machine circuit :param reset: a one bit signal telling the state machine to reset and accept the current plaintext and key :return ready, cipher_text: ready is a one bit si...
python
{ "resource": "" }
q3009
AES.decryption
train
def decryption(self, ciphertext, key): """ Builds a single cycle AES Decryption circuit :param WireVector ciphertext: data to decrypt :param WireVector key: AES key to use to encrypt (AES is symmetric) :return: a WireVector containing the plaintext """ if len(cip...
python
{ "resource": "" }
q3010
AES.decryption_statem
train
def decryption_statem(self, ciphertext_in, key_in, reset): """ Builds a multiple cycle AES Decryption state machine circuit :param reset: a one bit signal telling the state machine to reset and accept the current plaintext and key :return ready, plain_text: ready is a one bit ...
python
{ "resource": "" }
q3011
AES._g
train
def _g(self, word, key_expand_round): """ One-byte left circular rotation, substitution of each byte """ import numbers self._build_memories_if_not_exists() a = libutils.partition_wire(word, 8) sub = [self.sbox[a[index]] for index in (3, 0, 1, 2)] if isins...
python
{ "resource": "" }
q3012
extend
train
def extend(*args): """shallow dictionary merge Args: a: dict to extend b: dict to apply to a Returns: new instance of the same type as _a_, with _a_ and _b_ merged. """ if not args: return {} first = args[0] rest = args[1:] out = type(first)(first) ...
python
{ "resource": "" }
q3013
_trivialgraph_default_namer
train
def _trivialgraph_default_namer(thing, is_edge=True): """ Returns a "good" string for thing in printed graphs. """ if is_edge: if thing.name is None or thing.name.startswith('tmp'): return '' else: return '/'.join([thing.name, str(len(thing))]) elif isinstance(thing, ...
python
{ "resource": "" }
q3014
net_graph
train
def net_graph(block=None, split_state=False): """ Return a graph representation of the current block. Graph has the following form: { node1: { nodeA: edge1A, nodeB: edge1B}, node2: { nodeB: edge2B, nodeC: edge2C}, ... } aka: edge = graph[source][dest] Each node can...
python
{ "resource": "" }
q3015
output_to_trivialgraph
train
def output_to_trivialgraph(file, namer=_trivialgraph_default_namer, block=None): """ Walk the block and output it in trivial graph format to the open file. """ graph = net_graph(block) node_index_map = {} # map node -> index # print the list of nodes for index, node in enumerate(graph): pr...
python
{ "resource": "" }
q3016
_graphviz_default_namer
train
def _graphviz_default_namer(thing, is_edge=True, is_to_splitmerge=False): """ Returns a "good" graphviz label for thing. """ if is_edge: if (thing.name is None or thing.name.startswith('tmp') or isinstance(thing, (Input, Output, Const, Register))): name = '' ...
python
{ "resource": "" }
q3017
output_to_graphviz
train
def output_to_graphviz(file, namer=_graphviz_default_namer, block=None): """ Walk the block and output it in graphviz format to the open file. """ print(block_to_graphviz_string(block, namer), file=file)
python
{ "resource": "" }
q3018
block_to_svg
train
def block_to_svg(block=None): """ Return an SVG for the block. """ block = working_block(block) try: from graphviz import Source return Source(block_to_graphviz_string())._repr_svg_() except ImportError: raise PyrtlError('need graphviz installed (try "pip install graphviz")')
python
{ "resource": "" }
q3019
trace_to_html
train
def trace_to_html(simtrace, trace_list=None, sortkey=None): """ Return a HTML block showing the trace. """ from .simulation import SimulationTrace, _trace_sort_key if not isinstance(simtrace, SimulationTrace): raise PyrtlError('first arguement must be of type SimulationTrace') trace = simtrace...
python
{ "resource": "" }
q3020
create_store
train
def create_store(reducer, initial_state=None, enhancer=None): """ redux in a nutshell. observable has been omitted. Args: reducer: root reducer function for the state tree initial_state: optional initial state data enhancer: optional enhancer function for middleware etc. R...
python
{ "resource": "" }
q3021
set_debug_mode
train
def set_debug_mode(debug=True): """ Set the global debug mode. """ global debug_mode global _setting_keep_wirevector_call_stack global _setting_slower_but_more_descriptive_tmps debug_mode = debug _setting_keep_wirevector_call_stack = debug _setting_slower_but_more_descriptive_tmps = debug
python
{ "resource": "" }
q3022
Block.add_wirevector
train
def add_wirevector(self, wirevector): """ Add a wirevector object to the block.""" self.sanity_check_wirevector(wirevector) self.wirevector_set.add(wirevector) self.wirevector_by_name[wirevector.name] = wirevector
python
{ "resource": "" }
q3023
Block.remove_wirevector
train
def remove_wirevector(self, wirevector): """ Remove a wirevector object to the block.""" self.wirevector_set.remove(wirevector) del self.wirevector_by_name[wirevector.name]
python
{ "resource": "" }
q3024
Block.add_net
train
def add_net(self, net): """ Add a net to the logic of the block. The passed net, which must be of type LogicNet, is checked and then added to the block. No wires are added by this member, they must be added seperately with add_wirevector.""" self.sanity_check_net(net) ...
python
{ "resource": "" }
q3025
Block.wirevector_subset
train
def wirevector_subset(self, cls=None, exclude=tuple()): """Return set of wirevectors, filtered by the type or tuple of types provided as cls. If no cls is specified, the full set of wirevectors associated with the Block are returned. If cls is a single type, or a tuple of types, only those wir...
python
{ "resource": "" }
q3026
Block.get_wirevector_by_name
train
def get_wirevector_by_name(self, name, strict=False): """Return the wirevector matching name. By fallthrough, if a matching wirevector cannot be found the value None is returned. However, if the argument strict is set to True, then this will instead throw a PyrtlError when no match is ...
python
{ "resource": "" }
q3027
Block.net_connections
train
def net_connections(self, include_virtual_nodes=False): """ Returns a representation of the current block useful for creating a graph. :param include_virtual_nodes: if enabled, the wire itself will be used to signal an external source or sink (such as the source for an Input net). I...
python
{ "resource": "" }
q3028
Block.sanity_check
train
def sanity_check(self): """ Check block and throw PyrtlError or PyrtlInternalError if there is an issue. Should not modify anything, only check data structures to make sure they have been built according to the assumptions stated in the Block comments.""" # TODO: check that the wirevec...
python
{ "resource": "" }
q3029
Block.sanity_check_memory_sync
train
def sanity_check_memory_sync(self, wire_src_dict=None): """ Check that all memories are synchronous unless explicitly specified as async. While the semantics of 'm' memories reads is asynchronous, if you want your design to use a block ram (on an FPGA or otherwise) you want to make sure the ind...
python
{ "resource": "" }
q3030
Block.sanity_check_wirevector
train
def sanity_check_wirevector(self, w): """ Check that w is a valid wirevector type. """ from .wire import WireVector if not isinstance(w, WireVector): raise PyrtlError( 'error attempting to pass an input of type "%s" ' 'instead of WireVector' % type(w))
python
{ "resource": "" }
q3031
_NameSanitizer.make_valid_string
train
def make_valid_string(self, string=''): """ Inputting a value for the first time """ if not self.is_valid_str(string): if string in self.val_map and not self.allow_dups: raise IndexError("Value {} has already been given to the sanitizer".format(string)) internal_n...
python
{ "resource": "" }
q3032
optimize
train
def optimize(update_working_block=True, block=None, skip_sanity_check=False): """ Return an optimized version of a synthesized hardware block. :param Boolean update_working_block: Don't copy the block and optimize the new block :param Block block: the block to optimize (defaults to working block) ...
python
{ "resource": "" }
q3033
_remove_wire_nets
train
def _remove_wire_nets(block): """ Remove all wire nodes from the block. """ wire_src_dict = _ProducerList() wire_removal_set = set() # set of all wirevectors to be removed # one pass to build the map of value producers and # all of the nets and wires to be removed for net in block.logic: ...
python
{ "resource": "" }
q3034
constant_propagation
train
def constant_propagation(block, silence_unexpected_net_warnings=False): """ Removes excess constants in the block. Note on resulting block: The output of the block can have wirevectors that are driven but not listened to. This is to be expected. These are to be removed by the _remove_unlistened_net...
python
{ "resource": "" }
q3035
common_subexp_elimination
train
def common_subexp_elimination(block=None, abs_thresh=1, percent_thresh=0): """ Common Subexpression Elimination for PyRTL blocks :param block: the block to run the subexpression elimination on :param abs_thresh: absolute threshold for stopping optimization :param percent_thresh: percent threshold f...
python
{ "resource": "" }
q3036
_remove_unlistened_nets
train
def _remove_unlistened_nets(block): """ Removes all nets that are not connected to an output wirevector """ listened_nets = set() listened_wires = set() prev_listened_net_count = 0 def add_to_listened(net): listened_nets.add(net) listened_wires.update(net.args) for a_net i...
python
{ "resource": "" }
q3037
_remove_unused_wires
train
def _remove_unused_wires(block, keep_inputs=True): """ Removes all unconnected wires from a block""" valid_wires = set() for logic_net in block.logic: valid_wires.update(logic_net.args, logic_net.dests) wire_removal_set = block.wirevector_set.difference(valid_wires) for removed_wire in wire...
python
{ "resource": "" }
q3038
synthesize
train
def synthesize(update_working_block=True, block=None): """ Lower the design to just single-bit "and", "or", and "not" gates. :param update_working_block: Boolean specifying if working block update :param block: The block you want to synthesize :return: The newly synthesized block (of type PostSynthesis...
python
{ "resource": "" }
q3039
barrel_shifter
train
def barrel_shifter(bits_to_shift, bit_in, direction, shift_dist, wrap_around=0): """ Create a barrel shifter that operates on data based on the wire width. :param bits_to_shift: the input wire :param bit_in: the 1-bit wire giving the value to shift in :param direction: a one bit WireVector representing...
python
{ "resource": "" }
q3040
compose
train
def compose(*funcs): """ chained function composition wrapper creates function f, where f(x) = arg0(arg1(arg2(...argN(x)))) if *funcs is empty, an identity function is returned. Args: *funcs: list of functions to chain Returns: a new function composed of chained calls to ...
python
{ "resource": "" }
q3041
software_fibonacci
train
def software_fibonacci(n): """ a normal old python function to return the Nth fibonacci number. """ a, b = 0, 1 for i in range(n): a, b = b, a + b return a
python
{ "resource": "" }
q3042
apply_middleware
train
def apply_middleware(*middlewares): """ creates an enhancer function composed of middleware Args: *middlewares: list of middleware functions to apply Returns: an enhancer for subsequent calls to create_store() """ def inner(create_store_): def create_wrapper(reducer, en...
python
{ "resource": "" }
q3043
mux
train
def mux(index, *mux_ins, **kwargs): """ Multiplexer returning the value of the wire in . :param WireVector index: used as the select input to the multiplexer :param WireVector mux_ins: additional WireVector arguments selected when select>1 :param WireVector kwargs: additional WireVectors, keyword arg "...
python
{ "resource": "" }
q3044
select
train
def select(sel, truecase, falsecase): """ Multiplexer returning falsecase for select==0, otherwise truecase. :param WireVector sel: used as the select input to the multiplexer :param WireVector falsecase: the WireVector selected if select==0 :param WireVector truecase: the WireVector selected if select...
python
{ "resource": "" }
q3045
concat
train
def concat(*args): """ Concatenates multiple WireVectors into a single WireVector :param WireVector args: inputs to be concatenated :return: WireVector with length equal to the sum of the args' lengths You can provide multiple arguments and they will be combined with the right-most argument being ...
python
{ "resource": "" }
q3046
signed_add
train
def signed_add(a, b): """ Return wirevector for result of signed addition. :param a: a wirevector to serve as first input to addition :param b: a wirevector to serve as second input to addition Given a length n and length m wirevector the result of the signed addition is length max(n,m)+1. The in...
python
{ "resource": "" }
q3047
signed_lt
train
def signed_lt(a, b): """ Return a single bit result of signed less than comparison. """ a, b = match_bitwidth(as_wires(a), as_wires(b), signed=True) r = a - b return r[-1] ^ (~a[-1]) ^ (~b[-1])
python
{ "resource": "" }
q3048
signed_le
train
def signed_le(a, b): """ Return a single bit result of signed less than or equal comparison. """ a, b = match_bitwidth(as_wires(a), as_wires(b), signed=True) r = a - b return (r[-1] ^ (~a[-1]) ^ (~b[-1])) | (a == b)
python
{ "resource": "" }
q3049
signed_gt
train
def signed_gt(a, b): """ Return a single bit result of signed greater than comparison. """ a, b = match_bitwidth(as_wires(a), as_wires(b), signed=True) r = b - a return r[-1] ^ (~a[-1]) ^ (~b[-1])
python
{ "resource": "" }
q3050
signed_ge
train
def signed_ge(a, b): """ Return a single bit result of signed greater than or equal comparison. """ a, b = match_bitwidth(as_wires(a), as_wires(b), signed=True) r = b - a return (r[-1] ^ (~a[-1]) ^ (~b[-1])) | (a == b)
python
{ "resource": "" }
q3051
shift_right_arithmetic
train
def shift_right_arithmetic(bits_to_shift, shift_amount): """ Shift right arithmetic operation. :param bits_to_shift: WireVector to shift right :param shift_amount: WireVector specifying amount to shift :return: WireVector of same length as bits_to_shift This function returns a new WireVector of le...
python
{ "resource": "" }
q3052
match_bitwidth
train
def match_bitwidth(*args, **opt): """ Matches the bitwidth of all of the input arguments with zero or sign extend :param args: WireVectors of which to match bitwidths :param opt: Optional keyword argument 'signed=True' (defaults to False) :return: tuple of args in order with extended bits Example ...
python
{ "resource": "" }
q3053
as_wires
train
def as_wires(val, bitwidth=None, truncating=True, block=None): """ Return wires from val which may be wires, integers, strings, or bools. :param val: a wirevector-like object or something that can be converted into a Const :param bitwidth: The bitwidth the resulting wire should be :param bool tru...
python
{ "resource": "" }
q3054
bitfield_update
train
def bitfield_update(w, range_start, range_end, newvalue, truncating=False): """ Return wirevector w but with some of the bits overwritten by newvalue. :param w: a wirevector to use as the starting point for the update :param range_start: the start of the range of bits to be updated :param range_end: th...
python
{ "resource": "" }
q3055
enum_mux
train
def enum_mux(cntrl, table, default=None, strict=True): """ Build a mux for the control signals specified by an enum. :param cntrl: is a wirevector and control for the mux. :param table: is a dictionary of the form mapping enum->wirevector. :param default: is a wirevector to use when the key is not pres...
python
{ "resource": "" }
q3056
rtl_any
train
def rtl_any(*vectorlist): """ Hardware equivalent of python native "any". :param WireVector vectorlist: all arguments are WireVectors of length 1 :return: WireVector of length 1 Returns a 1-bit WireVector which will hold a '1' if any of the inputs are '1' (i.e. it is a big ol' OR gate) """ ...
python
{ "resource": "" }
q3057
rtl_all
train
def rtl_all(*vectorlist): """ Hardware equivalent of python native "all". :param WireVector vectorlist: all arguments are WireVectors of length 1 :return: WireVector of length 1 Returns a 1-bit WireVector which will hold a '1' only if all of the inputs are '1' (i.e. it is a big ol' AND gate) "...
python
{ "resource": "" }
q3058
_basic_mult
train
def _basic_mult(A, B): """ A stripped-down copy of the Wallace multiplier in rtllib """ if len(B) == 1: A, B = B, A # so that we can reuse the code below :) if len(A) == 1: return concat_list(list(A & b for b in B) + [Const(0)]) # keep WireVector len consistent result_bitwidth = len(A...
python
{ "resource": "" }
q3059
_push_condition
train
def _push_condition(predicate): """As we enter new conditions, this pushes them on the predicate stack.""" global _depth _check_under_condition() _depth += 1 if predicate is not otherwise and len(predicate) > 1: raise PyrtlError('all predicates for conditional assignments must wirevectors of...
python
{ "resource": "" }
q3060
_build
train
def _build(lhs, rhs): """Stores the wire assignment details until finalize is called.""" _check_under_condition() final_predicate, pred_set = _current_select() _check_and_add_pred_set(lhs, pred_set) _predicate_map.setdefault(lhs, []).append((final_predicate, rhs))
python
{ "resource": "" }
q3061
_pred_sets_are_in_conflict
train
def _pred_sets_are_in_conflict(pred_set_a, pred_set_b): """ Find conflict in sets, return conflict if found, else None. """ # pred_sets conflict if we cannot find one shared predicate that is "negated" in one # and "non-negated" in the other for pred_a, bool_a in pred_set_a: for pred_b, bool_b i...
python
{ "resource": "" }
q3062
_finalize
train
def _finalize(): """Build the required muxes and call back to WireVector to finalize the wirevector build.""" from .memory import MemBlock from pyrtl.corecircuits import select for lhs in _predicate_map: # handle memory write ports if isinstance(lhs, MemBlock): p, (addr, data...
python
{ "resource": "" }
q3063
_current_select
train
def _current_select(): """ Function to calculate the current "predicate" in the current context. Returns a tuple of information: (predicate, pred_set). The value pred_set is a set([ (predicate, bool), ... ]) as described in the _reset_conditional_state """ # helper to create the conjuction of ...
python
{ "resource": "" }
q3064
area_estimation
train
def area_estimation(tech_in_nm=130, block=None): """ Estimates the total area of the block. :param tech_in_nm: the size of the circuit technology to be estimated (for example, 65 is 65nm and 250 is 0.25um) :return: tuple of estimated areas (logic, mem) in terms of mm^2 The estimations are base...
python
{ "resource": "" }
q3065
_bits_ports_and_isrom_from_memory
train
def _bits_ports_and_isrom_from_memory(mem): """ Helper to extract mem bits and ports for estimation. """ is_rom = False bits = 2**mem.addrwidth * mem.bitwidth read_ports = len(mem.readport_nets) try: write_ports = len(mem.writeport_nets) except AttributeError: # dealing with ROMs ...
python
{ "resource": "" }
q3066
yosys_area_delay
train
def yosys_area_delay(library, abc_cmd=None, block=None): """ Synthesize with Yosys and return estimate of area and delay. :param library: stdcell library file to target in liberty format :param abc_cmd: string of commands for yosys to pass to abc for synthesis :param block: pyrtl block to analyze :...
python
{ "resource": "" }
q3067
TimingAnalysis.max_freq
train
def max_freq(self, tech_in_nm=130, ffoverhead=None): """ Estimates the max frequency of a block in MHz. :param tech_in_nm: the size of the circuit technology to be estimated (for example, 65 is 65nm and 250 is 0.25um) :param ffoverhead: setup and ff propagation delay in picoseconds ...
python
{ "resource": "" }
q3068
TimingAnalysis.critical_path
train
def critical_path(self, print_cp=True, cp_limit=100): """ Takes a timing map and returns the critical paths of the system. :param print_cp: Whether to print the critical path to the terminal after calculation :return: a list containing tuples with the 'first' wire as the ...
python
{ "resource": "" }
q3069
Client._post
train
def _post(self, endpoint, data, **kwargs): """ Method to perform POST request on the API. :param endpoint: Endpoint of the API. :param data: POST DATA for the request. :param kwargs: Other keyword arguments for requests. :return: Response of the POST request. ""...
python
{ "resource": "" }
q3070
Client._request
train
def _request(self, endpoint, method, data=None, **kwargs): """ Method to hanle both GET and POST requests. :param endpoint: Endpoint of the API. :param method: Method of HTTP request. :param data: POST DATA for the request. :param kwargs: Other keyword arguments. ...
python
{ "resource": "" }
q3071
Client.login
train
def login(self, username='admin', password='admin'): """ Method to authenticate the qBittorrent Client. Declares a class attribute named ``session`` which stores the authenticated session if the login is correct. Else, shows the login error. :param username: Username. ...
python
{ "resource": "" }
q3072
Client.torrents
train
def torrents(self, **filters): """ Returns a list of torrents matching the supplied filters. :param filter: Current status of the torrents. :param category: Fetch all torrents with the supplied label. :param sort: Sort torrents by. :param reverse: Enable reverse sorting....
python
{ "resource": "" }
q3073
Client.preferences
train
def preferences(self): """ Get the current qBittorrent preferences. Can also be used to assign individual preferences. For setting multiple preferences at once, see ``set_preferences`` method. Note: Even if this is a ``property``, to fetch the current preferences...
python
{ "resource": "" }
q3074
Client.download_from_link
train
def download_from_link(self, link, **kwargs): """ Download torrent using a link. :param link: URL Link or list of. :param savepath: Path to download the torrent. :param category: Label or Category of the torrent(s). :return: Empty JSON data. """ # old:ne...
python
{ "resource": "" }
q3075
Client.download_from_file
train
def download_from_file(self, file_buffer, **kwargs): """ Download torrent using a file. :param file_buffer: Single file() buffer or list of. :param save_path: Path to download the torrent. :param label: Label of the torrent(s). :return: Empty JSON data. """ ...
python
{ "resource": "" }
q3076
Client.add_trackers
train
def add_trackers(self, infohash, trackers): """ Add trackers to a torrent. :param infohash: INFO HASH of torrent. :param trackers: Trackers. """ data = {'hash': infohash.lower(), 'urls': trackers} return self._post('command/addTrackers', data=data...
python
{ "resource": "" }
q3077
Client._process_infohash_list
train
def _process_infohash_list(infohash_list): """ Method to convert the infohash_list to qBittorrent API friendly values. :param infohash_list: List of infohash. """ if isinstance(infohash_list, list): data = {'hashes': '|'.join([h.lower() for h in infohash_list])} ...
python
{ "resource": "" }
q3078
Client.pause_multiple
train
def pause_multiple(self, infohash_list): """ Pause multiple torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/pauseAll', data=data)
python
{ "resource": "" }
q3079
Client.set_category
train
def set_category(self, infohash_list, category): """ Set the category on multiple torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) data['category'] = category return self._post('command/setCateg...
python
{ "resource": "" }
q3080
Client.resume_multiple
train
def resume_multiple(self, infohash_list): """ Resume multiple paused torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/resumeAll', data=data)
python
{ "resource": "" }
q3081
Client.delete
train
def delete(self, infohash_list): """ Delete torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/delete', data=data)
python
{ "resource": "" }
q3082
Client.delete_permanently
train
def delete_permanently(self, infohash_list): """ Permanently delete torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/deletePerm', data=data)
python
{ "resource": "" }
q3083
Client.recheck
train
def recheck(self, infohash_list): """ Recheck torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/recheck', data=data)
python
{ "resource": "" }
q3084
Client.increase_priority
train
def increase_priority(self, infohash_list): """ Increase priority of torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/increasePrio', data=data)
python
{ "resource": "" }
q3085
Client.decrease_priority
train
def decrease_priority(self, infohash_list): """ Decrease priority of torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/decreasePrio', data=data)
python
{ "resource": "" }
q3086
Client.set_max_priority
train
def set_max_priority(self, infohash_list): """ Set torrents to maximum priority level. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/topPrio', data=data)
python
{ "resource": "" }
q3087
Client.set_min_priority
train
def set_min_priority(self, infohash_list): """ Set torrents to minimum priority level. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/bottomPrio', data=data)
python
{ "resource": "" }
q3088
Client.set_file_priority
train
def set_file_priority(self, infohash, file_id, priority): """ Set file of a torrent to a supplied priority level. :param infohash: INFO HASH of torrent. :param file_id: ID of the file to set priority. :param priority: Priority level of the file. """ if priority n...
python
{ "resource": "" }
q3089
Client.get_torrent_download_limit
train
def get_torrent_download_limit(self, infohash_list): """ Get download speed limit of the supplied torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/getTorrentsDlLimit', data=da...
python
{ "resource": "" }
q3090
Client.set_torrent_download_limit
train
def set_torrent_download_limit(self, infohash_list, limit): """ Set download speed limit of the supplied torrents. :param infohash_list: Single or list() of infohashes. :param limit: Speed limit in bytes. """ data = self._process_infohash_list(infohash_list) data...
python
{ "resource": "" }
q3091
Client.get_torrent_upload_limit
train
def get_torrent_upload_limit(self, infohash_list): """ Get upoload speed limit of the supplied torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/getTorrentsUpLimit', data=data)
python
{ "resource": "" }
q3092
Client.set_torrent_upload_limit
train
def set_torrent_upload_limit(self, infohash_list, limit): """ Set upload speed limit of the supplied torrents. :param infohash_list: Single or list() of infohashes. :param limit: Speed limit in bytes. """ data = self._process_infohash_list(infohash_list) data.upd...
python
{ "resource": "" }
q3093
Client.toggle_sequential_download
train
def toggle_sequential_download(self, infohash_list): """ Toggle sequential download in supplied torrents. :param infohash_list: Single or list() of infohashes. """ data = self._process_infohash_list(infohash_list) return self._post('command/toggleSequentialDownload', dat...
python
{ "resource": "" }
q3094
Client.force_start
train
def force_start(self, infohash_list, value=True): """ Force start selected torrents. :param infohash_list: Single or list() of infohashes. :param value: Force start value (bool) """ data = self._process_infohash_list(infohash_list) data.update({'value': json.dump...
python
{ "resource": "" }
q3095
humantime
train
def humantime(time): """Converts a time in seconds to a reasonable human readable time Parameters ---------- t : float The number of seconds Returns ------- time : string The human readable formatted value of the given time """ try: time = float(time) ex...
python
{ "resource": "" }
q3096
ansi_len
train
def ansi_len(string): """Extra length due to any ANSI sequences in the string.""" return len(string) - wcswidth(re.compile(r'\x1b[^m]*m').sub('', string))
python
{ "resource": "" }
q3097
format_line
train
def format_line(data, linestyle): """Formats a list of elements using the given line style""" return linestyle.begin + linestyle.sep.join(data) + linestyle.end
python
{ "resource": "" }
q3098
parse_width
train
def parse_width(width, n): """Parses an int or array of widths Parameters ---------- width : int or array_like n : int """ if isinstance(width, int): widths = [width] * n else: assert len(width) == n, "Widths and data do not match" widths = width return wid...
python
{ "resource": "" }
q3099
table
train
def table(data, headers=None, format_spec=FMT, width=WIDTH, align=ALIGN, style=STYLE, out=sys.stdout): """Print a table with the given data Parameters ---------- data : array_like An (m x n) array containing the data to print (m rows of n columns) headers : list, optional A list of...
python
{ "resource": "" }