def sdkopts_from_commandline(argv=None, remove=False, prefix='--dt_'): '''Creates a SDK option list for use with the :code:`sdkopts` parameter of :func:`.initialize` from a list :code:`argv` of command line parameters. An element in :code:`argv` is treated as an SDK option if starts with :code:`prefix`. The return value of this function will then contain the remainder of that parameter (without the prefix). If :code:`remove` is :data:`True`, these arguments will be removed from :code:`argv`. :param argv: An iterable of command line parameter strings. Defaults to :data:`sys.argv`. Must be a :obj:`~typing.MutableSequence` if :code:`remove` is :data:`True`. :type argv: ~typing.Iterable[str] or ~typing.MutableSequence[str] :param bool remove: Whether to remove a command line parameter that was recognized as an SDK option from :code:`argv` (if :data:`True`) or leave :code:`argv` unmodified (if :data:`False`). If :data:`True`, :code:`argv` must be a :obj:`~typing.MutableSequence`. :param str prefix: The prefix string by which SDK options are recognized and which is removed from the copy of the command line parameter that is added to the return value. :rtype: list[str] ''' if argv is None: argv = sys.argv if not remove: return [ param[len(prefix):] for param in argv if param.startswith(prefix) ] result = [] for i in range(len(argv) - 1, -1, -1): if argv[i].startswith(prefix): result.append(argv[i][len(prefix):]) del argv[i] result.reverse() return result
def customrequestattribute_add_strings(self, keys, values, count): _typecheck(count, int) assert count > 0, 'Invalid count' for _, key, val in zip(range(count), keys, values): self.customrequestattribute_add_string(self, key, val)
def add_kvs(self, tracer_h, keys, vals, count): _livecheck(tracer_h, InWebReqHandle) _typecheck(count, int) for _, key, val in zip(range(count), keys, vals): adder(self, tracer_h, key, val)
def add_kvs(self, tracer_h, keys, vals, count): _livecheck(tracer_h, web_req_handle_type) _typecheck(count, int) for _, key, val in zip(range(count), keys, vals): adder(self, tracer_h, key, val)