code
stringlengths
51
2.34k
docstring
stringlengths
11
171
def purge_queues(queues=None): current_queues.purge(queues=queues) click.secho( 'Queues {} have been purged.'.format( queues or current_queues.queues.keys()), fg='green' )
Purge the given queues.
def export(self, name, columns, points): if self.prefix is not None: name = self.prefix + '.' + name try: self.client.write_points(self._normalize(name, columns, points)) except Exception as e: logger.error("Cannot export {} stats to InfluxDB ({})".format(name...
Write the points to the InfluxDB server.
def _message_received(self, message): with self.lock: self._state.receive_message(message) for callable in chain(self._on_message_received, self._on_message): callable(message)
Notify the observers about the received message.
def register_postloop_hook(self, func: Callable[[None], None]) -> None: self._validate_prepostloop_callable(func) self._postloop_hooks.append(func)
Register a function to be called at the end of the command loop.
def parallel(processes, threads): pool = multithread(threads) pool.map(run_process, processes) pool.close() pool.join()
execute jobs in processes using N threads
def confidenceInterval(self, alpha=0.6827, steps=1.e5, plot=False): x_dense, y_dense = self.densify() y_dense -= np.max(y_dense) f = scipy.interpolate.interp1d(x_dense, y_dense, kind='linear') x = np.linspace(0., np.max(x_dense), steps) pdf = np.exp(f(x) / 2.) cut = (pdf ...
Compute two-sided confidence interval by taking x-values corresponding to the largest PDF-values first.
def path_end_to_end_distance(neurite): trunk = neurite.root_node.points[0] return max(morphmath.point_dist(l.points[-1], trunk) for l in neurite.root_node.ileaf())
Calculate and return end-to-end-distance of a given neurite.
def prompt(text, default=None, show_default=True, invisible=False, confirm=False, skip=False, type=None, input_function=None): t = determine_type(type, default) input_function = get_input_fn(input_function, invisible) if default is not None and show_default: text = '{} [{}]: '.format(text, default) whi...
Prompts for input from the user.
def add_user(self, name: str, email: str) -> models.User: new_user = self.User(name=name, email=email) self.add_commit(new_user) return new_user
Add a new user to the database.
def scatter_blocks_2d(x, indices, shape): x_shape = common_layers.shape_list(x) x_t = tf.transpose( tf.reshape(x, [x_shape[0], x_shape[1], -1, x_shape[-1]]), [2, 0, 1, 3]) x_t_shape = common_layers.shape_list(x_t) indices = tf.reshape(indices, [-1, 1]) scattered_x = tf.scatter_nd(indices, x_t, x_t_shape...
scatters blocks from x into shape with indices.
def with_app(f): @wraps(f) def decorator(*args, **kwargs): app = create_app() configure_extensions(app) configure_views(app) return f(app=app, *args, **kwargs) return decorator
Calls function passing app as first argument
def _format_job_instance(job): if not job: ret = {'Error': 'Cannot contact returner or no job with this jid'} return ret ret = {'Function': job.get('fun', 'unknown-function'), 'Arguments': list(job.get('arg', [])), 'Target': job.get('tgt', 'unknown-target'), 'Tar...
Helper to format a job instance
def _add_url(self, chunk): if 'url' in chunk: return chunk public_path = chunk.get('publicPath') if public_path: chunk['url'] = public_path else: fullpath = posixpath.join(self.state.static_view_path, chunk['name']...
Add a 'url' property to a chunk and return it
def master(self): if len(self.mav_master) == 0: return None if self.settings.link > len(self.mav_master): self.settings.link = 1 if not self.mav_master[self.settings.link-1].linkerror: return self.mav_master[self.settings.link-1] for m in self.mav_ma...
return the currently chosen mavlink master object
def delete_policy(self, policy): return self.manager.delete_policy(scaling_group=self, policy=policy)
Deletes the specified policy from this scaling group.
def _write_pidfile(self): flags = os.O_CREAT | os.O_RDWR try: flags = flags | os.O_EXLOCK except AttributeError: pass self._pid_fd = os.open(self.pidfile, flags, 0o666 & ~self.umask) os.write(self._pid_fd, str(os.getpid()).encode('utf-8'))
Create, write to, and lock the PID file.
def content_present(self, x: int, y: int) -> bool: if (x, y) in self.entries: return True if any(v.x == x and v.y1 < y < v.y2 for v in self.vertical_lines): return True if any(line_y == y and x1 < x < x2 for line_y, x1, x2, _ in self.horizontal_lines): ...
Determines if a line or printed text is at the given location.
def from_kirbidir(directory_path): cc = CCACHE() dir_path = os.path.join(os.path.abspath(directory_path), '*.kirbi') for filename in glob.glob(dir_path): with open(filename, 'rb') as f: kirbidata = f.read() kirbi = KRBCRED.load(kirbidata).native cc.add_kirbi(kirbi) return cc
Iterates trough all .kirbi files in a given directory and converts all of them into one CCACHE object
def invoke(ctx, name, profile, stage): factory = ctx.obj['factory'] factory.profile = profile try: invoke_handler = factory.create_lambda_invoke_handler(name, stage) payload = factory.create_stdin_reader().read() invoke_handler.invoke(payload) except NoSuchFunctionError as e: ...
Invoke the deployed lambda function NAME.
def run_once(func): def _inner(*args, **kwargs): if func.__name__ in CTX.run_once: LOGGER.info('skipping %s', func.__name__) return CTX.run_once[func.__name__] LOGGER.info('running: %s', func.__name__) result = func(*args, **kwargs) CTX.run_once[func.__name__]...
Simple decorator to ensure a function is ran only once
def create_room(room): if room.custom_server: return def _create_room(xmpp): muc = xmpp.plugin['xep_0045'] muc.joinMUC(room.jid, xmpp.requested_jid.user) muc.configureRoom(room.jid, _set_form_values(xmpp, room)) current_plugin.logger.info('Creating room %s', room.jid) _ex...
Creates a MUC room on the XMPP server.
def add_instruction(self, reil_instruction): for expr in self._translator.translate(reil_instruction): self._solver.add(expr)
Add an instruction for analysis.
def _safe_mkdir(directory): try: os.makedirs(directory) except OSError as error: if error.errno != errno.EEXIST: raise error
Create a directory, ignoring errors if it already exists.
def output_links(self): output_links = [] pm_dict = self.get_dict() output_links.append('surface_sample') if pm_dict['target_volume'] != 0.0: output_links.append('cell') return output_links
Return list of output link names
def clean(self,x): return x[~np.any(np.isnan(x) | np.isinf(x),axis=1)]
remove nan and inf rows from x
def phi_a(mass1, mass2, spin1x, spin1y, spin2x, spin2y): phi1 = phi_from_spinx_spiny(primary_spin(mass1, mass2, spin1x, spin2x), primary_spin(mass1, mass2, spin1y, spin2y)) phi2 = phi_from_spinx_spiny(secondary_spin(mass1, mass2, spin1x, spin2x), s...
Returns the angle between the in-plane perpendicular spins.
def select(table, index_track, field_name, op, value, includeMissing): result = [] result_index = [] counter = 0 for row in table: if detect_fields(field_name, convert_to_dict(row)): final_value = get_value(row, field_name) if do_op(final_value, op, value): ...
Modifies the table and index_track lists based on the comparison.
def setup_completion(shell): import glob try: import readline except ImportError: import pyreadline as readline def _complete(text, state): buf = readline.get_line_buffer() if buf.startswith('help ') or " " not in buf: return [x for x in shell.valid_identifier...
Setup readline to tab complete in a cross platform way.
def write(self, obj): accept = self.request.headers.get("Accept") if "json" in accept: if JsonDefaultHandler.__parser is None: JsonDefaultHandler.__parser = Parser() super(JsonDefaultHandler, self).write(JsonDefaultHandler.__parser.encode(obj)) return ...
Print object on output
def _next_pattern(self): current_state = self.state_stack[-1] position = self._position for pattern in self.patterns: if current_state not in pattern.states: continue m = pattern.regex.match(self.source, position) if not m: cont...
Parses the next pattern by matching each in turn.
async def make_transition_register(self, request: 'Request'): register = {} for stack in self._stacks: register = await stack.patch_register(register, request) return register
Use all underlying stacks to generate the next transition register.
def create_scroll_region(self): canvas_width = 0 canvas_height = 0 for label in self._category_labels.values(): width = label.winfo_reqwidth() canvas_height += label.winfo_reqheight() canvas_width = width if width > canvas_width else canvas_width self....
Setup the scroll region on the Canvas
def cli(env, format='table', config=None, verbose=0, proxy=None, really=False, demo=False, **kwargs): env.skip_confirmations = really env.config_file = config env.format = format env.ensure_client(config_file=config, is_demo=demo, proxy=proxy) ...
Main click CLI entry-point.
def each_img(img_dir): for fname in utils.each_img(img_dir): fname = os.path.join(img_dir, fname) yield cv.imread(fname), fname
Reads and iterates through each image file in the given directory
def create_default_element(self, name): found = self.root.find(name) if found is not None: return found ele = ET.Element(name) self.root.append(ele) return ele
Creates a <@name/> tag under root if there is none.
def update(self, td): self.sprite.last_position = self.sprite.position self.sprite.last_velocity = self.sprite.velocity if self.particle_group != None: self.update_particle_group(td)
Update state of ball
def execution_duration(self): duration = None if self.execution_start and self.execution_end: delta = self.execution_end - self.execution_start duration = delta.total_seconds() return duration
Returns total BMDS execution time, in seconds.
def start(self): global parallel for self.i in range(0, self.length): if parallel: self.thread.append(myThread(self.url[ self.i ], self.directory, self.i, self.min_file_size, self.max_file_size, self.no_redirects)) else: self.thread.append(myThread(self.url, self.directory, self.i , self.m...
function to initialize thread for downloading
def _update_sys_path(self, package_path=None): self.package_path = package_path if not self.package_path in sys.path: sys.path.append(self.package_path)
Updates and adds current directory to sys path
def balanced_binary_tree(n_leaves): def _balanced_subtree(leaves): if len(leaves) == 1: return leaves[0] elif len(leaves) == 2: return (leaves[0], leaves[1]) else: split = len(leaves) // 2 return (_balanced_subtree(leaves[:split]), ...
Create a balanced binary tree
def iter_finds(regex_obj, s): if isinstance(regex_obj, str): for m in re.finditer(regex_obj, s): yield m.group() else: for m in regex_obj.finditer(s): yield m.group()
Generate all matches found within a string for a regex and yield each match as a string
def register(self, library: str, cbl: Callable[['_AsyncLib'], None]): self._handlers[library] = cbl
Registers a callable to set up a library.
def filter(self, info, releases): for version in list(releases.keys()): if any(pattern.match(version) for pattern in self.patterns): del releases[version]
Remove all release versions that match any of the specificed patterns.
def Get(self): args = flow_pb2.ApiGetFlowArgs( client_id=self.client_id, flow_id=self.flow_id) data = self._context.SendRequest("GetFlow", args) return Flow(data=data, context=self._context)
Fetch flow's data and return proper Flow object.
def delete_network_postcommit(self, context): network = context.current log_context("delete_network_postcommit: network", network) segments = context.network_segments tenant_id = network['project_id'] self.delete_segments(segments) self.delete_network(network) sel...
Delete the network from CVX
def search_complete(self, completed): self.result_browser.set_sorting(ON) self.find_options.ok_button.setEnabled(True) self.find_options.stop_button.setEnabled(False) self.status_bar.hide() self.result_browser.expandAll() if self.search_thread is None: ...
Current search thread has finished
def option(self, section, option): if self.config.has_section(section): if self.config.has_option(section, option): return (True, self.config.get(section, option)) return (False, 'Option: ' + option + ' does not exist') return (False, 'Section: ' + section + ' doe...
Returns the value of the option
def unit(self): s = self.x * self.x + self.y * self.y if s < 1e-5: return Point(0,0) s = math.sqrt(s) return Point(self.x / s, self.y / s)
Return unit vector of a point.
def bpoints(self): return self.start, self.control1, self.control2, self.end
returns the Bezier control points of the segment.
def addRnaQuantificationSet(self): self._openRepo() dataset = self._repo.getDatasetByName(self._args.datasetName) if self._args.name is None: name = getNameFromPath(self._args.filePath) else: name = self._args.name rnaQuantificationSet = rna_quantification...
Adds an rnaQuantificationSet into this repo
def read(*paths): basedir = os.path.dirname(__file__) fullpath = os.path.join(basedir, *paths) contents = io.open(fullpath, encoding='utf-8').read().strip() return contents
Read a text file.
def _set_flask_alembic(): from flask_alembic import Alembic application.app.extensions["sqlalchemy"] = type('', (), {"db": db}) alembic = Alembic() alembic.init_app(application.app) return alembic
Add the SQLAlchemy object in the global extension
def load_ui_file(name): ui = gtk.Builder() ui.add_from_file(os.path.join(runtime.data_dir, name)) return ui
loads interface from the glade file; sorts out the path business
def request(self, method, url, data=None, headers=None, **kwargs): _credential_refresh_attempt = kwargs.pop( '_credential_refresh_attempt', 0) request_headers = headers.copy() if headers is not None else {} self.credentials.before_request( self._auth_request, method, url,...
Implementation of Requests' request.
def makediagram(edges): graph = pydot.Dot(graph_type='digraph') nodes = edges2nodes(edges) epnodes = [(node, makeanode(node[0])) for node in nodes if nodetype(node)=="epnode"] endnodes = [(node, makeendnode(node[0])) for node in nodes if nodetype(node)=="EndNode"] epbr = [(node, ma...
make the diagram with the edges
def _process_response(cls, response): if len(response) != 1: raise BadResponseError("Malformed response: {}".format(response)) stats = list(itervalues(response))[0] if not len(stats): raise BadResponseError("Malformed response for host: {}".format(stats)) return s...
Examine the response and raise an error is something is off
def unpack_rawr_zip_payload(table_sources, payload): from tilequeue.query.common import Table from io import BytesIO zfh = zipfile.ZipFile(BytesIO(payload), 'r') def get_table(table_name): data = zfh.open(table_name, 'r').read() unpacker = Unpacker(file_like=BytesIO(data)) source...
unpack a zipfile and turn it into a callable "tables" object.
def list_cache_settings(self, service_id, version_number): content = self._fetch("/service/%s/version/%d/cache_settings" % (service_id, version_number)) return map(lambda x: FastlyCacheSettings(self, x), content)
Get a list of all cache settings for a particular service and version.
def ngram_diff(args, parser): store = utils.get_data_store(args) corpus = utils.get_corpus(args) catalogue = utils.get_catalogue(args) tokenizer = utils.get_tokenizer(args) store.validate(corpus, catalogue) if args.asymmetric: store.diff_asymmetric(catalogue, args.asymmetric, tokenizer, ...
Outputs the results of performing a diff query.
def submission_filenames(round_num=None, tournament=None): click.echo(prettify( napi.get_submission_filenames(tournament, round_num)))
Get filenames of your submissions
def exp_transform(params): weights = np.exp(np.asarray(params) - np.mean(params)) return (len(weights) / weights.sum()) * weights
Transform parameters into exp-scale weights.
def atlasdb_renew_peer( peer_hostport, now, con=None, path=None ): with AtlasDBOpen(con=con, path=path) as dbcon: if now is None: now = time.time() sql = "UPDATE peers SET discovery_time = ? WHERE peer_hostport = ?;" args = (now, peer_hostport) cur = dbcon.cursor() ...
Renew a peer's discovery time
def check(self): for unsorted in iter(self[i] for i in range(len(self) - 2) if not operator.le(self[i], self[i + 1])): self.resort(unsorted)
re-sort any items in self that are not sorted
def ask_for_confirm_with_message(cls, ui, prompt='Do you agree?', message='', **options): return cls.get_appropriate_helper(ui).ask_for_confirm_with_message(prompt, message)
Returns True if user agrees, False otherwise
def nv_tuple_list_replace(l, v): _found = False for i, x in enumerate(l): if x[0] == v[0]: l[i] = v _found = True if not _found: l.append(v)
replace a tuple in a tuple list
def createSomeItems(store, itemType, values, counter): for i in counter: itemType(store=store, **values)
Create some instances of a particular type in a store.
def upload_cart(cart, collection): cart_cols = cart_db() cart_json = read_json_document(cart.cart_file()) try: cart_id = cart_cols[collection].save(cart_json) except MongoErrors.AutoReconnect: raise JuicerConfigError("Error saving cart to `cart_host`. Ensure that this node is the master....
Connect to mongo and store your cart in the specified collection.
def _send_heartbeat_request(self): if self.coordinator_unknown(): e = Errors.GroupCoordinatorNotAvailableError(self.coordinator_id) return Future().failure(e) elif not self._client.ready(self.coordinator_id, metadata_priority=False): e = Errors.NodeNotReadyError(self....
Send a heartbeat request
def modifierFactor(chart, factor, factorObj, otherObj, aspList): asp = aspects.aspectType(factorObj, otherObj, aspList) if asp != const.NO_ASPECT: return { 'factor': factor, 'aspect': asp, 'objID': otherObj.id, 'element': otherObj.element() } r...
Computes a factor for a modifier.
def OnBackView(self, event): self.historyIndex -= 1 try: self.RestoreHistory(self.history[self.historyIndex]) except IndexError, err: self.SetStatusText(_('No further history available'))
Request to move backward in the history
def matrixToMathTransform(matrix): if isinstance(matrix, ShallowTransform): return matrix off, scl, rot = MathTransform(matrix).decompose() return ShallowTransform(off, scl, rot)
Take a 6-tuple and return a ShallowTransform object.
def hourly(dt=datetime.datetime.utcnow(), fmt=None): date = datetime.datetime(dt.year, dt.month, dt.day, dt.hour, 1, 1, 0, dt.tzinfo) if fmt is not None: return date.strftime(fmt) return date
Get a new datetime object every hour.
def df(self, list_of_points, force_read=True): his = [] for point in list_of_points: try: his.append(self._findPoint(point, force_read=force_read).history) except ValueError as ve: self._log.error("{}".format(ve)) continue ...
When connected, calling DF should force a reading on the network.
def meta_dump_or_deepcopy(meta): if DEBUG_META_REFERENCES: from rafcon.gui.helpers.meta_data import meta_data_reference_check meta_data_reference_check(meta) return copy.deepcopy(meta)
Function to observe meta data vivi-dict copy process and to debug it at one point
def delay(self, params, now=None): if now is None: now = time.time() if not self.last: self.last = now elif now < self.last: now = self.last leaked = now - self.last self.last = now self.level = max(self.level - leaked, 0) diffe...
Determine delay until next request.
def store_async_result(async_id, async_result): logging.debug("Storing result for %s", async_id) key = FuriousAsyncMarker( id=async_id, result=json.dumps(async_result.to_dict()), status=async_result.status).put() logging.debug("Setting Async result %s using marker: %s.", async_result, ...
Persist the Async's result to the datastore.
def _token_auth(self): return TcExTokenAuth( self, self.args.tc_token, self.args.tc_token_expires, self.args.tc_api_path, self.tcex.log, )
Add ThreatConnect Token Auth to Session.
def _get_predicton_csv_lines(data, headers, images): if images: data = copy.deepcopy(data) for img_col in images: for d, im in zip(data, images[img_col]): if im == '': continue im = im.copy() im.thumbnail((299, 299), Image.ANTIALIAS) buf = BytesIO() im.s...
Create CSV lines from list-of-dict data.
def __ungrabHotkey(self, key, modifiers, window): logger.debug("Ungrabbing hotkey: %r %r", modifiers, key) try: keycode = self.__lookupKeyCode(key) mask = 0 for mod in modifiers: mask |= self.modMasks[mod] window.ungrab_key(keycode, mask) ...
Ungrab a specific hotkey in the given window
def _write_commits_to_release_notes(self): with open(self.release_file, 'a') as out: out.write("==========\n{}\n".format(self.tag)) for commit in self.commits: try: msg = commit[1] if msg != "cosmetic": out.w...
writes commits to the releasenotes file by appending to the end
def read_pdb(pdbfname, as_string=False): pybel.ob.obErrorLog.StopLogging() if os.name != 'nt': maxsize = resource.getrlimit(resource.RLIMIT_STACK)[-1] resource.setrlimit(resource.RLIMIT_STACK, (min(2 ** 28, maxsize), maxsize)) sys.setrecursionlimit(10 ** 5) return readmol(pdbfname, as_st...
Reads a given PDB file and returns a Pybel Molecule.
def _remote_add(self): self.repo.create_remote( 'origin', 'git@github.com:{username}/{repo}.git'.format( username=self.metadata.username, repo=self.metadata.name))
Execute git remote add.
def validate(data): if not isinstance(data, dict): error('Data must be a dictionary.') for value in data.values(): if not isinstance(value, basestring): error('Values must be strings.')
Query data and result data must have keys who's values are strings.
def _network_show(self, name, network_lst): for net in network_lst: if net.label == name: return net.__dict__ return {}
Parse the returned network list
def StartObject(self, numfields): self.assertNotNested() self.current_vtable = [0 for _ in range_func(numfields)] self.objectEnd = self.Offset() self.nested = True
StartObject initializes bookkeeping for writing a new object.
def render_doc(self): if self._doc_view: return self._doc_view() elif not self._doc: self.abort(self.bc_HTTPStatus_NOT_FOUND) res = render_template('swagger-ui.html', title=self.title, specs_url=self.specs_url) res = res.replace(self.complexReplaceString,self.APIDOCSPath) regexp="\"https...
Override this method to customize the documentation page
def build(level, code, validity=None): spatial = ':'.join((level, code)) if not validity: return spatial elif isinstance(validity, basestring): return '@'.join((spatial, validity)) elif isinstance(validity, datetime): return '@'.join((spatial, validity.date().isoformat())) el...
Serialize a GeoID from its parts
def ConsultarPuntosVentas(self, sep="||"): "Retorna los puntos de ventas autorizados para la utilizacion de WS" ret = self.client.consultarPuntosVenta( auth={ 'token': self.Token, 'sign': self.Sign, 'cuit': self.Cuit, }, ...
Retorna los puntos de ventas autorizados para la utilizacion de WS
def do_signal(self, signame: str) -> None: if hasattr(signal, signame): os.kill(os.getpid(), getattr(signal, signame)) else: self._sout.write('Unknown signal %s\n' % signame)
Send a Unix signal
def dispatch(self, args): if not args.list and not args.group: if not args.font and not args.char and not args.block: self.info() return else: args.list = args.group = True self._display = {k: args.__dict__[k] for k in ('list', 'gro...
Calls proper method depending on command-line arguments.
def create_model_class(cls, name, table_name, attrs, validations=None, *, otherattrs=None, other_bases=None): members = dict(table_name=table_name, attrs=attrs, validations=validations or []) if otherattrs: members.update(otherattrs) return type(name, other_bases or (), member...
Creates a new class derived from ModelBase.
def make_opfields( cls ): opfields = {} for opname in SERIALIZE_FIELDS.keys(): opcode = NAME_OPCODES[opname] opfields[opcode] = SERIALIZE_FIELDS[opname] return opfields
Calculate the virtulachain-required opfields dict.
def addon(self, name): cmd = ["heroku", "addons:create", name, "--app", self.name] self._run(cmd)
Set up an addon
def write_file(content, *path): with open(os.path.join(*path), "w") as file: return file.write(content)
Simply write some content to a file, overriding the file if necessary.
def resolve_and_build(self): pdebug("resolving and building task '%s'" % self.name, groups=["build_task"]) indent_text(indent="++2") toret = self.build(**self.resolve_dependencies()) indent_text(indent="--2") return toret
resolves the dependencies of this build target and builds it
def summary(self, scoring): if scoring == 'class_confusion': print('*' * 50) print(' Confusion Matrix ') print('x-axis: ' + ' | '.join(list(self.class_dictionary.keys()))) print('y-axis: ' + ' | '.join(self.truth_classes)) print(self.confusion_matrix(...
Prints out the summary of validation for giving scoring function.
def count(self) -> "CountQuery": return CountQuery( db=self._db, model=self.model, q_objects=self._q_objects, annotations=self._annotations, custom_filters=self._custom_filters, )
Return count of objects in queryset instead of objects.
def estimate_size_in_bytes(cls, magic, compression_type, key, value): assert magic in [0, 1], "Not supported magic" if compression_type: return ( cls.LOG_OVERHEAD + cls.record_overhead(magic) + cls.record_size(magic, key, value) ) return cl...
Upper bound estimate of record size.
def build_signature(self, user_api_key, user_secret, request): path = request.get_full_path() sent_signature = request.META.get( self.header_canonical('Authorization')) signature_headers = self.get_headers_from_signature(sent_signature) unsigned = self.build_dict_to_sign(requ...
Return the signature for the request.
def deurlform_app(parser, cmd, args): parser.add_argument('value', help='the query string to decode') args = parser.parse_args(args) return ' '.join('%s=%s' % (key, value) for key, values in deurlform(args.value).items() for value in values)
decode a query string into its key value pairs.