repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
edeposit/marcxml_parser
src/marcxml_parser/query.py
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L40-L93
def _parse_corporations(self, datafield, subfield, roles=["any"]): """ Parse informations about corporations from given field identified by `datafield` parameter. Args: datafield (str): MARC field ID ("``110``", "``610``", etc..) subfield (str): MARC subfield ID...
[ "def", "_parse_corporations", "(", "self", ",", "datafield", ",", "subfield", ",", "roles", "=", "[", "\"any\"", "]", ")", ":", "if", "len", "(", "datafield", ")", "!=", "3", ":", "raise", "ValueError", "(", "\"datafield parameter have to be exactly 3 chars long...
Parse informations about corporations from given field identified by `datafield` parameter. Args: datafield (str): MARC field ID ("``110``", "``610``", etc..) subfield (str): MARC subfield ID with name, which is typically stored in "``a``" subfield....
[ "Parse", "informations", "about", "corporations", "from", "given", "field", "identified", "by", "datafield", "parameter", "." ]
python
valid
Tsjerk/Insane
insane/structure.py
https://github.com/Tsjerk/Insane/blob/b73f08910ddb0b66597b20ff75ecee7f65f4ecf6/insane/structure.py#L332-L366
def write_gro(outfile, title, atoms, box): """ Write a GRO file. Parameters ---------- outfile The stream to write in. title The title of the GRO file. Must be a single line. atoms An instance of Structure containing the atoms to write. box The periodic b...
[ "def", "write_gro", "(", "outfile", ",", "title", ",", "atoms", ",", "box", ")", ":", "# Print the title", "print", "(", "title", ",", "file", "=", "outfile", ")", "# Print the number of atoms", "print", "(", "\"{:5d}\"", ".", "format", "(", "len", "(", "a...
Write a GRO file. Parameters ---------- outfile The stream to write in. title The title of the GRO file. Must be a single line. atoms An instance of Structure containing the atoms to write. box The periodic box as a 3x3 matrix.
[ "Write", "a", "GRO", "file", "." ]
python
test
sernst/cauldron
cauldron/session/reloading.py
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/session/reloading.py#L70-L93
def reload_children(parent_module: types.ModuleType, newer_than: int) -> bool: """ Reloads all imported children of the specified parent module object :param parent_module: A module object whose children should be refreshed if their currently loaded versions are out of date. :param newe...
[ "def", "reload_children", "(", "parent_module", ":", "types", ".", "ModuleType", ",", "newer_than", ":", "int", ")", "->", "bool", ":", "if", "not", "hasattr", "(", "parent_module", ",", "'__path__'", ")", ":", "return", "False", "parent_name", "=", "get_mod...
Reloads all imported children of the specified parent module object :param parent_module: A module object whose children should be refreshed if their currently loaded versions are out of date. :param newer_than: An integer time in seconds for comparison. Any children modules that ...
[ "Reloads", "all", "imported", "children", "of", "the", "specified", "parent", "module", "object" ]
python
train
Azure/azure-sdk-for-python
azure-servicebus/azure/servicebus/aio/async_receive_handler.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/aio/async_receive_handler.py#L246-L277
async def close(self, exception=None): """Close down the receiver connection. If the receiver has already closed, this operation will do nothing. An optional exception can be passed in to indicate that the handler was shutdown due to error. It is recommended to open a handler within a c...
[ "async", "def", "close", "(", "self", ",", "exception", "=", "None", ")", ":", "if", "not", "self", ".", "running", ":", "return", "self", ".", "running", "=", "False", "self", ".", "receiver_shutdown", "=", "True", "self", ".", "_used", ".", "set", ...
Close down the receiver connection. If the receiver has already closed, this operation will do nothing. An optional exception can be passed in to indicate that the handler was shutdown due to error. It is recommended to open a handler within a context manager as opposed to calling the m...
[ "Close", "down", "the", "receiver", "connection", "." ]
python
test
allenai/allennlp
allennlp/data/dataset_readers/dataset_utils/span_utils.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/data/dataset_readers/dataset_utils/span_utils.py#L217-L260
def bioul_tags_to_spans(tag_sequence: List[str], classes_to_ignore: List[str] = None) -> List[TypedStringSpan]: """ Given a sequence corresponding to BIOUL tags, extracts spans. Spans are inclusive and can be of zero length, representing a single word span. Ill-formed spans are n...
[ "def", "bioul_tags_to_spans", "(", "tag_sequence", ":", "List", "[", "str", "]", ",", "classes_to_ignore", ":", "List", "[", "str", "]", "=", "None", ")", "->", "List", "[", "TypedStringSpan", "]", ":", "spans", "=", "[", "]", "classes_to_ignore", "=", "...
Given a sequence corresponding to BIOUL tags, extracts spans. Spans are inclusive and can be of zero length, representing a single word span. Ill-formed spans are not allowed and will raise ``InvalidTagSequence``. This function works properly when the spans are unlabeled (i.e., your labels are simply "B...
[ "Given", "a", "sequence", "corresponding", "to", "BIOUL", "tags", "extracts", "spans", ".", "Spans", "are", "inclusive", "and", "can", "be", "of", "zero", "length", "representing", "a", "single", "word", "span", ".", "Ill", "-", "formed", "spans", "are", "...
python
train
IAMconsortium/pyam
pyam/core.py
https://github.com/IAMconsortium/pyam/blob/4077929ca6e7be63a0e3ecf882c5f1da97b287bf/pyam/core.py#L1162-L1169
def stack_plot(self, *args, **kwargs): """Plot timeseries stacks of existing data see pyam.plotting.stack_plot() for all available options """ df = self.as_pandas(with_metadata=True) ax = plotting.stack_plot(df, *args, **kwargs) return ax
[ "def", "stack_plot", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "df", "=", "self", ".", "as_pandas", "(", "with_metadata", "=", "True", ")", "ax", "=", "plotting", ".", "stack_plot", "(", "df", ",", "*", "args", ",", "*", "...
Plot timeseries stacks of existing data see pyam.plotting.stack_plot() for all available options
[ "Plot", "timeseries", "stacks", "of", "existing", "data" ]
python
train
Dullage/starlingbank
starlingbank/__init__.py
https://github.com/Dullage/starlingbank/blob/9495456980d5d6d85c4e999a17dc69481067af09/starlingbank/__init__.py#L111-L129
def get_image(self, filename: str=None) -> None: """Download the photo associated with a Savings Goal.""" if filename is None: filename = "{0}.png".format(self.name) endpoint = "/account/{0}/savings-goals/{1}/photo".format( self._account_uid, self.uid ...
[ "def", "get_image", "(", "self", ",", "filename", ":", "str", "=", "None", ")", "->", "None", ":", "if", "filename", "is", "None", ":", "filename", "=", "\"{0}.png\"", ".", "format", "(", "self", ".", "name", ")", "endpoint", "=", "\"/account/{0}/savings...
Download the photo associated with a Savings Goal.
[ "Download", "the", "photo", "associated", "with", "a", "Savings", "Goal", "." ]
python
train
BlueBrain/hpcbench
hpcbench/benchmark/ior.py
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/benchmark/ior.py#L220-L225
def apis(self): """List of API to test""" value = self.attributes['apis'] if isinstance(value, six.string_types): value = shlex.split(value) return value
[ "def", "apis", "(", "self", ")", ":", "value", "=", "self", ".", "attributes", "[", "'apis'", "]", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "value", "=", "shlex", ".", "split", "(", "value", ")", "return", "value" ...
List of API to test
[ "List", "of", "API", "to", "test" ]
python
train
PredixDev/predixpy
predix/admin/eventhub.py
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/eventhub.py#L28-L38
def create(self): """ Create an instance of the Time Series Service with the typical starting settings. """ self.service.create() os.environ[predix.config.get_env_key(self.use_class, 'host')] = self.get_eventhub_host() os.environ[predix.config.get_env_key(self.us...
[ "def", "create", "(", "self", ")", ":", "self", ".", "service", ".", "create", "(", ")", "os", ".", "environ", "[", "predix", ".", "config", ".", "get_env_key", "(", "self", ".", "use_class", ",", "'host'", ")", "]", "=", "self", ".", "get_eventhub_h...
Create an instance of the Time Series Service with the typical starting settings.
[ "Create", "an", "instance", "of", "the", "Time", "Series", "Service", "with", "the", "typical", "starting", "settings", "." ]
python
train
mitsei/dlkit
dlkit/json_/commenting/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2404-L2421
def has_parent_books(self, book_id): """Tests if the ``Book`` has any parents. arg: book_id (osid.id.Id): a book ``Id`` return: (boolean) - ``true`` if the book has parents, f ``alse`` otherwise raise: NotFound - ``book_id`` is not found raise: NullArgument ...
[ "def", "has_parent_books", "(", "self", ",", "book_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.has_parent_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", "...
Tests if the ``Book`` has any parents. arg: book_id (osid.id.Id): a book ``Id`` return: (boolean) - ``true`` if the book has parents, f ``alse`` otherwise raise: NotFound - ``book_id`` is not found raise: NullArgument - ``book_id`` is ``null`` raise: Operat...
[ "Tests", "if", "the", "Book", "has", "any", "parents", "." ]
python
train
modin-project/modin
modin/engines/ray/pandas_on_ray/io.py
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/pandas_on_ray/io.py#L100-L119
def _read_hdf_columns(path_or_buf, columns, num_splits, kwargs): # pragma: no cover """Use a Ray task to read columns from HDF5 into a Pandas DataFrame. Note: Ray functions are not detected by codecov (thus pragma: no cover) Args: path_or_buf: The path of the HDF5 file. columns: The list ...
[ "def", "_read_hdf_columns", "(", "path_or_buf", ",", "columns", ",", "num_splits", ",", "kwargs", ")", ":", "# pragma: no cover", "df", "=", "pandas", ".", "read_hdf", "(", "path_or_buf", ",", "columns", "=", "columns", ",", "*", "*", "kwargs", ")", "# Appen...
Use a Ray task to read columns from HDF5 into a Pandas DataFrame. Note: Ray functions are not detected by codecov (thus pragma: no cover) Args: path_or_buf: The path of the HDF5 file. columns: The list of column names to read. num_splits: The number of partitions to split the column in...
[ "Use", "a", "Ray", "task", "to", "read", "columns", "from", "HDF5", "into", "a", "Pandas", "DataFrame", "." ]
python
train
jbaiter/hidapi-cffi
hidapi.py
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L310-L326
def get_indexed_string(self, idx): """ Get a string from the device, based on its string index. :param idx: The index of the string to get :type idx: int :return: The string at the index :rtype: unicode """ self._check_device_status() bufp = ffi....
[ "def", "get_indexed_string", "(", "self", ",", "idx", ")", ":", "self", ".", "_check_device_status", "(", ")", "bufp", "=", "ffi", ".", "new", "(", "\"wchar_t*\"", ")", "rv", "=", "hidapi", ".", "hid_get_indexed_string", "(", "self", ".", "_device", ",", ...
Get a string from the device, based on its string index. :param idx: The index of the string to get :type idx: int :return: The string at the index :rtype: unicode
[ "Get", "a", "string", "from", "the", "device", "based", "on", "its", "string", "index", "." ]
python
train
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/sendable/reply_markup.py
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/sendable/reply_markup.py#L201-L215
def to_array(self): """ Serializes this KeyboardButton to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(KeyboardButton, self).to_array() array['text'] = u(self.text) # py2: type unicode, py3: type str if...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "KeyboardButton", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'text'", "]", "=", "u", "(", "self", ".", "text", ")", "# py2: type unicode, py3: type str", "if", "self",...
Serializes this KeyboardButton to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "KeyboardButton", "to", "a", "dictionary", "." ]
python
train
saltstack/salt
salt/cloud/clouds/vultrpy.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vultrpy.py#L100-L122
def _cache_provider_details(conn=None): ''' Provide a place to hang onto results of --list-[locations|sizes|images] so we don't have to go out to the API and get them every time. ''' DETAILS['avail_locations'] = {} DETAILS['avail_sizes'] = {} DETAILS['avail_images'] = {} locations = avai...
[ "def", "_cache_provider_details", "(", "conn", "=", "None", ")", ":", "DETAILS", "[", "'avail_locations'", "]", "=", "{", "}", "DETAILS", "[", "'avail_sizes'", "]", "=", "{", "}", "DETAILS", "[", "'avail_images'", "]", "=", "{", "}", "locations", "=", "a...
Provide a place to hang onto results of --list-[locations|sizes|images] so we don't have to go out to the API and get them every time.
[ "Provide", "a", "place", "to", "hang", "onto", "results", "of", "--", "list", "-", "[", "locations|sizes|images", "]", "so", "we", "don", "t", "have", "to", "go", "out", "to", "the", "API", "and", "get", "them", "every", "time", "." ]
python
train
OpenKMIP/PyKMIP
kmip/core/primitives.py
https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/primitives.py#L754-L770
def write_value(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the value of the Boolean object to the output stream. Args: ostream (Stream): A buffer to contain the encoded bytes of the value of a Boolean object. Usually a BytearrayStream object. ...
[ "def", "write_value", "(", "self", ",", "ostream", ",", "kmip_version", "=", "enums", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "try", ":", "ostream", ".", "write", "(", "pack", "(", "'!Q'", ",", "self", ".", "value", ")", ")", "except", "Exceptio...
Write the value of the Boolean object to the output stream. Args: ostream (Stream): A buffer to contain the encoded bytes of the value of a Boolean object. Usually a BytearrayStream object. Required. kmip_version (KMIPVersion): An enumeration defining the...
[ "Write", "the", "value", "of", "the", "Boolean", "object", "to", "the", "output", "stream", "." ]
python
test
googledatalab/pydatalab
google/datalab/ml/_feature_slice_view.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/google/datalab/ml/_feature_slice_view.py#L46-L88
def plot(self, data): """ Plots a featire slice view on given data. Args: data: Can be one of: A string of sql query. A sql query module defined by "%%sql --module module_name". A pandas DataFrame. Regardless of data type, it must include the following columns: ...
[ "def", "plot", "(", "self", ",", "data", ")", ":", "import", "IPython", "if", "(", "(", "sys", ".", "version_info", ".", "major", ">", "2", "and", "isinstance", "(", "data", ",", "str", ")", ")", "or", "(", "sys", ".", "version_info", ".", "major",...
Plots a featire slice view on given data. Args: data: Can be one of: A string of sql query. A sql query module defined by "%%sql --module module_name". A pandas DataFrame. Regardless of data type, it must include the following columns: "feature": identifies a s...
[ "Plots", "a", "featire", "slice", "view", "on", "given", "data", "." ]
python
train
estnltk/estnltk
estnltk/textcleaner.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/textcleaner.py#L36-L38
def clean(self, text): """Remove all unwanted characters from text.""" return ''.join([c for c in text if c in self.alphabet])
[ "def", "clean", "(", "self", ",", "text", ")", ":", "return", "''", ".", "join", "(", "[", "c", "for", "c", "in", "text", "if", "c", "in", "self", ".", "alphabet", "]", ")" ]
Remove all unwanted characters from text.
[ "Remove", "all", "unwanted", "characters", "from", "text", "." ]
python
train
project-ncl/pnc-cli
pnc_cli/buildrecords.py
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildrecords.py#L91-L97
def list_built_artifacts(id, page_size=200, page_index=0, sort="", q=""): """ List Artifacts associated with a BuildRecord """ data = list_built_artifacts_raw(id, page_size, page_index, sort, q) if data: return utils.format_json_list(data)
[ "def", "list_built_artifacts", "(", "id", ",", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "data", "=", "list_built_artifacts_raw", "(", "id", ",", "page_size", ",", "page_index", ",", ...
List Artifacts associated with a BuildRecord
[ "List", "Artifacts", "associated", "with", "a", "BuildRecord" ]
python
train
gwastro/pycbc-glue
pycbc_glue/lal.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/lal.py#L652-L657
def fromfile(cls, fileobj, coltype=LIGOTimeGPS): """ Return a Cache object whose entries are read from an open file. """ c = [cls.entry_class(line, coltype=coltype) for line in fileobj] return cls(c)
[ "def", "fromfile", "(", "cls", ",", "fileobj", ",", "coltype", "=", "LIGOTimeGPS", ")", ":", "c", "=", "[", "cls", ".", "entry_class", "(", "line", ",", "coltype", "=", "coltype", ")", "for", "line", "in", "fileobj", "]", "return", "cls", "(", "c", ...
Return a Cache object whose entries are read from an open file.
[ "Return", "a", "Cache", "object", "whose", "entries", "are", "read", "from", "an", "open", "file", "." ]
python
train
adewes/blitzdb
blitzdb/backends/file/index.py
https://github.com/adewes/blitzdb/blob/4b459e0bcde9e1f6224dd4e3bea74194586864b0/blitzdb/backends/file/index.py#L300-L331
def add_key(self, attributes, store_key): """Add key to the index. :param attributes: Attributes to be added to the index :type attributes: dict(str) :param store_key: The key for the document in the store :type store_key: str """ undefined = False try: ...
[ "def", "add_key", "(", "self", ",", "attributes", ",", "store_key", ")", ":", "undefined", "=", "False", "try", ":", "value", "=", "self", ".", "get_value", "(", "attributes", ")", "except", "(", "KeyError", ",", "IndexError", ")", ":", "undefined", "=",...
Add key to the index. :param attributes: Attributes to be added to the index :type attributes: dict(str) :param store_key: The key for the document in the store :type store_key: str
[ "Add", "key", "to", "the", "index", "." ]
python
train
great-expectations/great_expectations
great_expectations/dataset/dataset.py
https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/dataset.py#L1135-L1177
def expect_column_values_to_match_strftime_format(self, column, strftime_format, mostly=None, result_for...
[ "def", "expect_column_values_to_match_strftime_format", "(", "self", ",", "column", ",", "strftime_format", ",", "mostly", "=", "None", ",", "result_format", "=", "None", ",", "include_config", "=", "False", ",", "catch_exceptions", "=", "None", ",", "meta", "=", ...
Expect column entries to be strings representing a date or time with a given format. expect_column_values_to_match_strftime_format is a :func:`column_map_expectation <great_expectations.data_asset.dataset.Dataset.column_map_expectation>`. Args: column (str): \ The column na...
[ "Expect", "column", "entries", "to", "be", "strings", "representing", "a", "date", "or", "time", "with", "a", "given", "format", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/rl/trainer_model_based_params.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based_params.py#L294-L300
def rlmb_base_stochastic(): """Base setting with a stochastic next-frame model.""" hparams = rlmb_base() hparams.initial_epoch_train_steps_multiplier = 5 hparams.generative_model = "next_frame_basic_stochastic" hparams.generative_model_params = "next_frame_basic_stochastic" return hparams
[ "def", "rlmb_base_stochastic", "(", ")", ":", "hparams", "=", "rlmb_base", "(", ")", "hparams", ".", "initial_epoch_train_steps_multiplier", "=", "5", "hparams", ".", "generative_model", "=", "\"next_frame_basic_stochastic\"", "hparams", ".", "generative_model_params", ...
Base setting with a stochastic next-frame model.
[ "Base", "setting", "with", "a", "stochastic", "next", "-", "frame", "model", "." ]
python
train
yyuu/botornado
boto/sts/credentials.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/sts/credentials.py#L63-L75
def load(cls, file_path): """ Create and return a new Session Token based on the contents of a previously saved JSON-format file. :type file_path: str :param file_path: The fully qualified path to the JSON-format file containing the previously saved Session Token inf...
[ "def", "load", "(", "cls", ",", "file_path", ")", ":", "fp", "=", "open", "(", "file_path", ")", "json_doc", "=", "fp", ".", "read", "(", ")", "fp", ".", "close", "(", ")", "return", "cls", ".", "from_json", "(", "json_doc", ")" ]
Create and return a new Session Token based on the contents of a previously saved JSON-format file. :type file_path: str :param file_path: The fully qualified path to the JSON-format file containing the previously saved Session Token information.
[ "Create", "and", "return", "a", "new", "Session", "Token", "based", "on", "the", "contents", "of", "a", "previously", "saved", "JSON", "-", "format", "file", "." ]
python
train
googledatalab/pydatalab
datalab/bigquery/_api.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/datalab/bigquery/_api.py#L300-L309
def datasets_update(self, dataset_name, dataset_info): """Updates the Dataset info. Args: dataset_name: the name of the dataset to update as a tuple of components. dataset_info: the Dataset resource with updated fields. """ url = Api._ENDPOINT + (Api._DATASETS_PATH % dataset_name) retur...
[ "def", "datasets_update", "(", "self", ",", "dataset_name", ",", "dataset_info", ")", ":", "url", "=", "Api", ".", "_ENDPOINT", "+", "(", "Api", ".", "_DATASETS_PATH", "%", "dataset_name", ")", "return", "datalab", ".", "utils", ".", "Http", ".", "request"...
Updates the Dataset info. Args: dataset_name: the name of the dataset to update as a tuple of components. dataset_info: the Dataset resource with updated fields.
[ "Updates", "the", "Dataset", "info", "." ]
python
train
frictionlessdata/tableschema-py
tableschema/schema.py
https://github.com/frictionlessdata/tableschema-py/blob/9c5fa930319e7c5b10351f794091c5f9de5e8684/tableschema/schema.py#L72-L85
def foreign_keys(self): """https://github.com/frictionlessdata/tableschema-py#schema """ foreign_keys = self.__current_descriptor.get('foreignKeys', []) for key in foreign_keys: key.setdefault('fields', []) key.setdefault('reference', {}) key['referenc...
[ "def", "foreign_keys", "(", "self", ")", ":", "foreign_keys", "=", "self", ".", "__current_descriptor", ".", "get", "(", "'foreignKeys'", ",", "[", "]", ")", "for", "key", "in", "foreign_keys", ":", "key", ".", "setdefault", "(", "'fields'", ",", "[", "]...
https://github.com/frictionlessdata/tableschema-py#schema
[ "https", ":", "//", "github", ".", "com", "/", "frictionlessdata", "/", "tableschema", "-", "py#schema" ]
python
train
datalib/StatsCounter
statscounter/_stats.py
https://github.com/datalib/StatsCounter/blob/5386c967808bbe451025af1d550f060cd7f86669/statscounter/_stats.py#L64-L85
def mean(data): """Return the sample arithmetic mean of data. >>> mean([1, 2, 3, 4, 4]) 2.8 >>> from fractions import Fraction as F >>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)]) Fraction(13, 21) >>> from decimal import Decimal as D >>> mean([D("0.5"), D("0.75"), D("0.625"), D("0.375...
[ "def", "mean", "(", "data", ")", ":", "if", "iter", "(", "data", ")", "is", "data", ":", "data", "=", "list", "(", "data", ")", "n", "=", "len", "(", "data", ")", "if", "n", "<", "1", ":", "raise", "StatisticsError", "(", "'mean requires at least o...
Return the sample arithmetic mean of data. >>> mean([1, 2, 3, 4, 4]) 2.8 >>> from fractions import Fraction as F >>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)]) Fraction(13, 21) >>> from decimal import Decimal as D >>> mean([D("0.5"), D("0.75"), D("0.625"), D("0.375")]) Decimal('0.562...
[ "Return", "the", "sample", "arithmetic", "mean", "of", "data", "." ]
python
train
ethereum/eth-abi
eth_abi/codec.py
https://github.com/ethereum/eth-abi/blob/0a5cab0bdeae30b77efa667379427581784f1707/eth_abi/codec.py#L50-L65
def encode_single(self, typ: TypeStr, arg: Any) -> bytes: """ Encodes the python value ``arg`` as a binary value of the ABI type ``typ``. :param typ: The string representation of the ABI type that will be used for encoding e.g. ``'uint256'``, ``'bytes[]'``, ``'(int,int)'``, ...
[ "def", "encode_single", "(", "self", ",", "typ", ":", "TypeStr", ",", "arg", ":", "Any", ")", "->", "bytes", ":", "encoder", "=", "self", ".", "_registry", ".", "get_encoder", "(", "typ", ")", "return", "encoder", "(", "arg", ")" ]
Encodes the python value ``arg`` as a binary value of the ABI type ``typ``. :param typ: The string representation of the ABI type that will be used for encoding e.g. ``'uint256'``, ``'bytes[]'``, ``'(int,int)'``, etc. :param arg: The python value to be encoded. ...
[ "Encodes", "the", "python", "value", "arg", "as", "a", "binary", "value", "of", "the", "ABI", "type", "typ", "." ]
python
train
atlassian-api/atlassian-python-api
atlassian/jira.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/jira.py#L752-L756
def get_issue_link_type(self, issue_link_type_id): """Returns for a given issue link type id all information about this issue link type. """ url = 'rest/api/2/issueLinkType/{issueLinkTypeId}'.format(issueLinkTypeId=issue_link_type_id) return self.get(url)
[ "def", "get_issue_link_type", "(", "self", ",", "issue_link_type_id", ")", ":", "url", "=", "'rest/api/2/issueLinkType/{issueLinkTypeId}'", ".", "format", "(", "issueLinkTypeId", "=", "issue_link_type_id", ")", "return", "self", ".", "get", "(", "url", ")" ]
Returns for a given issue link type id all information about this issue link type.
[ "Returns", "for", "a", "given", "issue", "link", "type", "id", "all", "information", "about", "this", "issue", "link", "type", "." ]
python
train
jtpaasch/simplygithub
simplygithub/internals/blobs.py
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/internals/blobs.py#L16-L35
def get_blob(profile, sha): """Fetch a blob. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha The SHA of th...
[ "def", "get_blob", "(", "profile", ",", "sha", ")", ":", "resource", "=", "\"/blobs/\"", "+", "sha", "data", "=", "api", ".", "get_request", "(", "profile", ",", "resource", ")", "return", "prepare", "(", "data", ")" ]
Fetch a blob. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha The SHA of the blob to fetch. Returns: ...
[ "Fetch", "a", "blob", "." ]
python
train
urbn/Caesium
caesium/handler.py
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/handler.py#L559-L574
def put(self, id): """ Update a revision by ID :param id: BSON id :return: """ collection_name = self.request.headers.get("collection") if not collection_name: self.raise_error(400, "Missing a collection name header") self.client = BaseAsyn...
[ "def", "put", "(", "self", ",", "id", ")", ":", "collection_name", "=", "self", ".", "request", ".", "headers", ".", "get", "(", "\"collection\"", ")", "if", "not", "collection_name", ":", "self", ".", "raise_error", "(", "400", ",", "\"Missing a collectio...
Update a revision by ID :param id: BSON id :return:
[ "Update", "a", "revision", "by", "ID" ]
python
train
javipalanca/spade
spade/message.py
https://github.com/javipalanca/spade/blob/59942bd1a1edae4c807d06cabb178d5630cbf61b/spade/message.py#L100-L110
def sender(self, jid: str): """ Set jid of the sender Args: jid (str): jid of the sender """ if jid is not None and not isinstance(jid, str): raise TypeError("'sender' MUST be a string") self._sender = aioxmpp.JID.fromstr(jid) if jid is not None el...
[ "def", "sender", "(", "self", ",", "jid", ":", "str", ")", ":", "if", "jid", "is", "not", "None", "and", "not", "isinstance", "(", "jid", ",", "str", ")", ":", "raise", "TypeError", "(", "\"'sender' MUST be a string\"", ")", "self", ".", "_sender", "="...
Set jid of the sender Args: jid (str): jid of the sender
[ "Set", "jid", "of", "the", "sender" ]
python
train
radujica/baloo
baloo/core/series.py
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/series.py#L551-L572
def from_pandas(cls, series): """Create baloo Series from pandas Series. Parameters ---------- series : pandas.series.Series Returns ------- Series """ from pandas import Index as PandasIndex, MultiIndex as PandasMultiIndex if isinstanc...
[ "def", "from_pandas", "(", "cls", ",", "series", ")", ":", "from", "pandas", "import", "Index", "as", "PandasIndex", ",", "MultiIndex", "as", "PandasMultiIndex", "if", "isinstance", "(", "series", ".", "index", ",", "PandasIndex", ")", ":", "baloo_index", "=...
Create baloo Series from pandas Series. Parameters ---------- series : pandas.series.Series Returns ------- Series
[ "Create", "baloo", "Series", "from", "pandas", "Series", "." ]
python
train
insomnia-lab/libreant
libreantdb/api.py
https://github.com/insomnia-lab/libreant/blob/55d529435baf4c05a86b8341899e9f5e14e50245/libreantdb/api.py#L211-L222
def clone_index(self, new_indexname, index_conf=None): '''Clone current index All entries of the current index will be copied into the newly created one named `new_indexname` :param index_conf: Configuration to be used in the new index creation. T...
[ "def", "clone_index", "(", "self", ",", "new_indexname", ",", "index_conf", "=", "None", ")", ":", "log", ".", "debug", "(", "\"Cloning index '{}' into '{}'\"", ".", "format", "(", "self", ".", "index_name", ",", "new_indexname", ")", ")", "self", ".", "crea...
Clone current index All entries of the current index will be copied into the newly created one named `new_indexname` :param index_conf: Configuration to be used in the new index creation. This param will be passed directly to :py:func:`DB.create_index`
[ "Clone", "current", "index" ]
python
train
quantopian/zipline
zipline/algorithm.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/algorithm.py#L408-L421
def init_engine(self, get_loader): """ Construct and store a PipelineEngine from loader. If get_loader is None, constructs an ExplodingPipelineEngine """ if get_loader is not None: self.engine = SimplePipelineEngine( get_loader, self.a...
[ "def", "init_engine", "(", "self", ",", "get_loader", ")", ":", "if", "get_loader", "is", "not", "None", ":", "self", ".", "engine", "=", "SimplePipelineEngine", "(", "get_loader", ",", "self", ".", "asset_finder", ",", "self", ".", "default_pipeline_domain", ...
Construct and store a PipelineEngine from loader. If get_loader is None, constructs an ExplodingPipelineEngine
[ "Construct", "and", "store", "a", "PipelineEngine", "from", "loader", "." ]
python
train
ChristopherRabotin/bungiesearch
bungiesearch/__init__.py
https://github.com/ChristopherRabotin/bungiesearch/blob/13768342bc2698b214eb0003c2d113b6e273c30d/bungiesearch/__init__.py#L155-L210
def map_raw_results(cls, raw_results, instance=None): ''' Maps raw results to database model objects. :param raw_results: list raw results as returned from elasticsearch-dsl-py. :param instance: Bungiesearch instance if you want to make use of `.only()` or `optmize_queries` as defined in...
[ "def", "map_raw_results", "(", "cls", ",", "raw_results", ",", "instance", "=", "None", ")", ":", "# Let's iterate over the results and determine the appropriate mapping.", "model_results", "=", "defaultdict", "(", "list", ")", "# Initializing the list to the number of returned...
Maps raw results to database model objects. :param raw_results: list raw results as returned from elasticsearch-dsl-py. :param instance: Bungiesearch instance if you want to make use of `.only()` or `optmize_queries` as defined in the ModelIndex. :return: list of mapped results in the *same* ord...
[ "Maps", "raw", "results", "to", "database", "model", "objects", ".", ":", "param", "raw_results", ":", "list", "raw", "results", "as", "returned", "from", "elasticsearch", "-", "dsl", "-", "py", ".", ":", "param", "instance", ":", "Bungiesearch", "instance",...
python
train
bitshares/python-bitshares
bitshares/bitshares.py
https://github.com/bitshares/python-bitshares/blob/8a3b5954a6abcaaff7c6a5c41d910e58eea3142f/bitshares/bitshares.py#L541-L570
def update_memo_key(self, key, account=None, **kwargs): """ Update an account's memo public key This method does **not** add any private keys to your wallet but merely changes the memo public key. :param str key: New memo public key :param str account: (optional...
[ "def", "update_memo_key", "(", "self", ",", "key", ",", "account", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "account", ":", "if", "\"default_account\"", "in", "self", ".", "config", ":", "account", "=", "self", ".", "config", "[", ...
Update an account's memo public key This method does **not** add any private keys to your wallet but merely changes the memo public key. :param str key: New memo public key :param str account: (optional) the account to allow access to (defaults to ``defa...
[ "Update", "an", "account", "s", "memo", "public", "key" ]
python
train
juju/charm-helpers
charmhelpers/contrib/storage/linux/utils.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/utils.py#L78-L95
def zap_disk(block_device): ''' Clear a block device of partition table. Relies on sgdisk, which is installed as pat of the 'gdisk' package in Ubuntu. :param block_device: str: Full path of block device to clean. ''' # https://github.com/ceph/ceph/commit/fdd7f8d83afa25c4e09aaedd90ab93f3b64a677b...
[ "def", "zap_disk", "(", "block_device", ")", ":", "# https://github.com/ceph/ceph/commit/fdd7f8d83afa25c4e09aaedd90ab93f3b64a677b", "# sometimes sgdisk exits non-zero; this is OK, dd will clean up", "call", "(", "[", "'sgdisk'", ",", "'--zap-all'", ",", "'--'", ",", "block_device",...
Clear a block device of partition table. Relies on sgdisk, which is installed as pat of the 'gdisk' package in Ubuntu. :param block_device: str: Full path of block device to clean.
[ "Clear", "a", "block", "device", "of", "partition", "table", ".", "Relies", "on", "sgdisk", "which", "is", "installed", "as", "pat", "of", "the", "gdisk", "package", "in", "Ubuntu", "." ]
python
train
presslabs/z3
z3/pput.py
https://github.com/presslabs/z3/blob/965898cccddd351ce4c56402a215c3bda9f37b5e/z3/pput.py#L32-L46
def multipart_etag(digests): """ Computes etag for multipart uploads :type digests: list of hex-encoded md5 sums (string) :param digests: The list of digests for each individual chunk. :rtype: string :returns: The etag computed from the individual chunks. """ etag = hashlib.md5() co...
[ "def", "multipart_etag", "(", "digests", ")", ":", "etag", "=", "hashlib", ".", "md5", "(", ")", "count", "=", "0", "for", "dig", "in", "digests", ":", "count", "+=", "1", "etag", ".", "update", "(", "binascii", ".", "a2b_hex", "(", "dig", ")", ")"...
Computes etag for multipart uploads :type digests: list of hex-encoded md5 sums (string) :param digests: The list of digests for each individual chunk. :rtype: string :returns: The etag computed from the individual chunks.
[ "Computes", "etag", "for", "multipart", "uploads", ":", "type", "digests", ":", "list", "of", "hex", "-", "encoded", "md5", "sums", "(", "string", ")", ":", "param", "digests", ":", "The", "list", "of", "digests", "for", "each", "individual", "chunk", "....
python
train
IBM/ibm-cos-sdk-python-s3transfer
ibm_s3transfer/aspera/manager.py
https://github.com/IBM/ibm-cos-sdk-python-s3transfer/blob/24ba53137213e26e6b8fc2c3ec1e8198d507d22b/ibm_s3transfer/aspera/manager.py#L581-L620
def _process_waiting_queue(self): ''' thread to processes the waiting queue fetches transfer spec then calls start transfer ensures that max ascp is not exceeded ''' logger.info("Queue processing thread started") while not self.is_stop(): self._pro...
[ "def", "_process_waiting_queue", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Queue processing thread started\"", ")", "while", "not", "self", ".", "is_stop", "(", ")", ":", "self", ".", "_processing_event", ".", "wait", "(", "3", ")", "self", ".", ...
thread to processes the waiting queue fetches transfer spec then calls start transfer ensures that max ascp is not exceeded
[ "thread", "to", "processes", "the", "waiting", "queue", "fetches", "transfer", "spec", "then", "calls", "start", "transfer", "ensures", "that", "max", "ascp", "is", "not", "exceeded" ]
python
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L159-L186
def _sge_get_mem(xmlstring, queue_name): """ Get memory information from qhost """ rootxml = ET.fromstring(xmlstring) my_machine_dict = {} # on some machines rootxml.tag looks like "{...}qhost" where the "{...}" gets prepended to all attributes rootTag = rootxml.tag.rstrip("qhost") for host ...
[ "def", "_sge_get_mem", "(", "xmlstring", ",", "queue_name", ")", ":", "rootxml", "=", "ET", ".", "fromstring", "(", "xmlstring", ")", "my_machine_dict", "=", "{", "}", "# on some machines rootxml.tag looks like \"{...}qhost\" where the \"{...}\" gets prepended to all attribut...
Get memory information from qhost
[ "Get", "memory", "information", "from", "qhost" ]
python
train
KelSolaar/Foundations
foundations/trace.py
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/trace.py#L311-L324
def get_method_name(method): """ Returns given method name. :param method: Method to retrieve the name. :type method: object :return: Method name. :rtype: unicode """ name = get_object_name(method) if name.startswith("__") and not name.endswith("__"): name = "_{0}{1}".forma...
[ "def", "get_method_name", "(", "method", ")", ":", "name", "=", "get_object_name", "(", "method", ")", "if", "name", ".", "startswith", "(", "\"__\"", ")", "and", "not", "name", ".", "endswith", "(", "\"__\"", ")", ":", "name", "=", "\"_{0}{1}\"", ".", ...
Returns given method name. :param method: Method to retrieve the name. :type method: object :return: Method name. :rtype: unicode
[ "Returns", "given", "method", "name", "." ]
python
train
MillionIntegrals/vel
vel/storage/classic.py
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/storage/classic.py#L161-L168
def create(model_config, backend, checkpoint_strategy, streaming=None): """ Vel factory function """ return ClassicStorage( model_config=model_config, backend=backend, checkpoint_strategy=checkpoint_strategy, streaming=streaming )
[ "def", "create", "(", "model_config", ",", "backend", ",", "checkpoint_strategy", ",", "streaming", "=", "None", ")", ":", "return", "ClassicStorage", "(", "model_config", "=", "model_config", ",", "backend", "=", "backend", ",", "checkpoint_strategy", "=", "che...
Vel factory function
[ "Vel", "factory", "function" ]
python
train
dcaune/perseus-lib-python-common
exifread/tags/makernote/olympus.py
https://github.com/dcaune/perseus-lib-python-common/blob/ba48fe0fd9bb4a75b53e7d10c41ada36a72d4496/exifread/tags/makernote/olympus.py#L4-L21
def special_mode(v): """decode Olympus SpecialMode tag in MakerNote""" mode1 = { 0: 'Normal', 1: 'Unknown', 2: 'Fast', 3: 'Panorama', } mode2 = { 0: 'Non-panoramic', 1: 'Left to right', 2: 'Right to left', 3: 'Bottom to top', 4: 'To...
[ "def", "special_mode", "(", "v", ")", ":", "mode1", "=", "{", "0", ":", "'Normal'", ",", "1", ":", "'Unknown'", ",", "2", ":", "'Fast'", ",", "3", ":", "'Panorama'", ",", "}", "mode2", "=", "{", "0", ":", "'Non-panoramic'", ",", "1", ":", "'Left ...
decode Olympus SpecialMode tag in MakerNote
[ "decode", "Olympus", "SpecialMode", "tag", "in", "MakerNote" ]
python
train
NoviceLive/intellicoder
intellicoder/sources.py
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/sources.py#L77-L93
def make_c_header(name, front, body): """ Build a C header from the front and body. """ return """ {0} # ifndef _GU_ZHENGXIONG_{1}_H # define _GU_ZHENGXIONG_{1}_H {2} # endif /* {3}.h */ """.strip().format(front, name.upper(), body, name) + '\n'
[ "def", "make_c_header", "(", "name", ",", "front", ",", "body", ")", ":", "return", "\"\"\"\n{0}\n\n\n# ifndef _GU_ZHENGXIONG_{1}_H\n# define _GU_ZHENGXIONG_{1}_H\n\n\n{2}\n\n\n# endif /* {3}.h */\n \"\"\"", ".", "strip", "(", ")", ".", "format", "(", "front", ",", "name...
Build a C header from the front and body.
[ "Build", "a", "C", "header", "from", "the", "front", "and", "body", "." ]
python
train
cackharot/suds-py3
suds/xsd/schema.py
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/xsd/schema.py#L313-L334
def dereference(self): """ Instruct all children to perform dereferencing. """ all = [] indexes = {} for child in self.children: child.content(all) deplist = DepList() for x in all: x.qualify() midx, deps = x.dependencie...
[ "def", "dereference", "(", "self", ")", ":", "all", "=", "[", "]", "indexes", "=", "{", "}", "for", "child", "in", "self", ".", "children", ":", "child", ".", "content", "(", "all", ")", "deplist", "=", "DepList", "(", ")", "for", "x", "in", "all...
Instruct all children to perform dereferencing.
[ "Instruct", "all", "children", "to", "perform", "dereferencing", "." ]
python
train
savoirfairelinux/num2words
num2words/lang_ID.py
https://github.com/savoirfairelinux/num2words/blob/f4b2bac098ae8e4850cf2f185f6ff52a5979641f/num2words/lang_ID.py#L53-L76
def split_by_3(self, number): """ starting here, it groups the number by three from the tail '1234567' -> (('1',),('234',),('567',)) :param number:str :rtype:tuple """ blocks = () length = len(number) if length < 3: blocks += ((number,...
[ "def", "split_by_3", "(", "self", ",", "number", ")", ":", "blocks", "=", "(", ")", "length", "=", "len", "(", "number", ")", "if", "length", "<", "3", ":", "blocks", "+=", "(", "(", "number", ",", ")", ",", ")", "else", ":", "len_of_first_block", ...
starting here, it groups the number by three from the tail '1234567' -> (('1',),('234',),('567',)) :param number:str :rtype:tuple
[ "starting", "here", "it", "groups", "the", "number", "by", "three", "from", "the", "tail", "1234567", "-", ">", "((", "1", ")", "(", "234", ")", "(", "567", "))", ":", "param", "number", ":", "str", ":", "rtype", ":", "tuple" ]
python
test
ctuning/ck
ck/repo/module/web/module.py
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/repo/module/web/module.py#L193-L226
def web_err(i): """ Input: { http - http object type - content type bin - bytes to output } Output: { return - 0 } """ http=i['http'] tp=i['type'] bin=i['bin'] try: bin=bin.decode('utf-8') except Ex...
[ "def", "web_err", "(", "i", ")", ":", "http", "=", "i", "[", "'http'", "]", "tp", "=", "i", "[", "'type'", "]", "bin", "=", "i", "[", "'bin'", "]", "try", ":", "bin", "=", "bin", ".", "decode", "(", "'utf-8'", ")", "except", "Exception", "as", ...
Input: { http - http object type - content type bin - bytes to output } Output: { return - 0 }
[ "Input", ":", "{", "http", "-", "http", "object", "type", "-", "content", "type", "bin", "-", "bytes", "to", "output", "}" ]
python
train
prompt-toolkit/pyvim
pyvim/commands/handler.py
https://github.com/prompt-toolkit/pyvim/blob/5928b53b9d700863c1a06d2181a034a955f94594/pyvim/commands/handler.py#L48-L53
def _go_to_line(editor, line): """ Move cursor to this line in the current buffer. """ b = editor.application.current_buffer b.cursor_position = b.document.translate_row_col_to_index(max(0, int(line) - 1), 0)
[ "def", "_go_to_line", "(", "editor", ",", "line", ")", ":", "b", "=", "editor", ".", "application", ".", "current_buffer", "b", ".", "cursor_position", "=", "b", ".", "document", ".", "translate_row_col_to_index", "(", "max", "(", "0", ",", "int", "(", "...
Move cursor to this line in the current buffer.
[ "Move", "cursor", "to", "this", "line", "in", "the", "current", "buffer", "." ]
python
train
Kopachris/seshet
seshet/config.py
https://github.com/Kopachris/seshet/blob/d55bae01cff56762c5467138474145a2c17d1932/seshet/config.py#L156-L222
def build_bot(config_file=None): """Parse a config and return a SeshetBot instance. After, the bot can be run simply by calling .connect() and then .start() Optional arguments: config_file - valid file path or ConfigParser instance If config_file is None, will read default conf...
[ "def", "build_bot", "(", "config_file", "=", "None", ")", ":", "from", ".", "import", "bot", "config", "=", "ConfigParser", "(", "interpolation", "=", "None", ")", "if", "config_file", "is", "None", ":", "config", ".", "read_string", "(", "default_config", ...
Parse a config and return a SeshetBot instance. After, the bot can be run simply by calling .connect() and then .start() Optional arguments: config_file - valid file path or ConfigParser instance If config_file is None, will read default config defined in this module.
[ "Parse", "a", "config", "and", "return", "a", "SeshetBot", "instance", ".", "After", "the", "bot", "can", "be", "run", "simply", "by", "calling", ".", "connect", "()", "and", "then", ".", "start", "()", "Optional", "arguments", ":", "config_file", "-", "...
python
train
ibm-watson-iot/iot-python
src/wiotp/sdk/client.py
https://github.com/ibm-watson-iot/iot-python/blob/195f05adce3fba4ec997017e41e02ebd85c0c4cc/src/wiotp/sdk/client.py#L323-L343
def _onDisconnect(self, mqttc, obj, rc): """ Called when the client disconnects from IBM Watson IoT Platform. See [paho.mqtt.python#on_disconnect](https://github.com/eclipse/paho.mqtt.python#on_disconnect) for more information # Parameters mqttc (paho.mqtt.clien...
[ "def", "_onDisconnect", "(", "self", ",", "mqttc", ",", "obj", ",", "rc", ")", ":", "# Clear the event to indicate we're no longer connected", "self", ".", "connectEvent", ".", "clear", "(", ")", "if", "rc", "!=", "0", ":", "self", ".", "logger", ".", "error...
Called when the client disconnects from IBM Watson IoT Platform. See [paho.mqtt.python#on_disconnect](https://github.com/eclipse/paho.mqtt.python#on_disconnect) for more information # Parameters mqttc (paho.mqtt.client.Client): The client instance for this callback obj ...
[ "Called", "when", "the", "client", "disconnects", "from", "IBM", "Watson", "IoT", "Platform", ".", "See", "[", "paho", ".", "mqtt", ".", "python#on_disconnect", "]", "(", "https", ":", "//", "github", ".", "com", "/", "eclipse", "/", "paho", ".", "mqtt",...
python
test
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L271-L284
def registerViewType(self, cls, window=None): """ Registers the inputed widget class as a potential view class. If the \ optional window argument is supplied, then the registerToWindow method \ will be called for the class. :param cls | <subclass of XView> ...
[ "def", "registerViewType", "(", "self", ",", "cls", ",", "window", "=", "None", ")", ":", "if", "(", "not", "cls", "in", "self", ".", "_viewTypes", ")", ":", "self", ".", "_viewTypes", ".", "append", "(", "cls", ")", "if", "(", "window", ")", ":", ...
Registers the inputed widget class as a potential view class. If the \ optional window argument is supplied, then the registerToWindow method \ will be called for the class. :param cls | <subclass of XView> window | <QMainWindow> || <QDialog> || No...
[ "Registers", "the", "inputed", "widget", "class", "as", "a", "potential", "view", "class", ".", "If", "the", "\\", "optional", "window", "argument", "is", "supplied", "then", "the", "registerToWindow", "method", "\\", "will", "be", "called", "for", "the", "c...
python
train
alerta/alerta
alerta/database/backends/mongodb/base.py
https://github.com/alerta/alerta/blob/6478d6addc217c96a4a6688fab841035bef134e1/alerta/database/backends/mongodb/base.py#L171-L220
def dedup_alert(self, alert, history): """ Update alert status, service, value, text, timeout and rawData, increment duplicate count and set repeat=True, and keep track of last receive id and time but don't append to history unless status changes. """ query = { 'envir...
[ "def", "dedup_alert", "(", "self", ",", "alert", ",", "history", ")", ":", "query", "=", "{", "'environment'", ":", "alert", ".", "environment", ",", "'resource'", ":", "alert", ".", "resource", ",", "'event'", ":", "alert", ".", "event", ",", "'severity...
Update alert status, service, value, text, timeout and rawData, increment duplicate count and set repeat=True, and keep track of last receive id and time but don't append to history unless status changes.
[ "Update", "alert", "status", "service", "value", "text", "timeout", "and", "rawData", "increment", "duplicate", "count", "and", "set", "repeat", "=", "True", "and", "keep", "track", "of", "last", "receive", "id", "and", "time", "but", "don", "t", "append", ...
python
train
reingart/gui2py
gui/controls/listbox.py
https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L101-L128
def _set_items(self, a_iter): "Clear and set the strings (and data if any) in the control from a list" self._items_dict = {} if not a_iter: string_list = [] data_list = [] elif not isinstance(a_iter, (tuple, list, dict)): raise ValueError("ite...
[ "def", "_set_items", "(", "self", ",", "a_iter", ")", ":", "self", ".", "_items_dict", "=", "{", "}", "if", "not", "a_iter", ":", "string_list", "=", "[", "]", "data_list", "=", "[", "]", "elif", "not", "isinstance", "(", "a_iter", ",", "(", "tuple",...
Clear and set the strings (and data if any) in the control from a list
[ "Clear", "and", "set", "the", "strings", "(", "and", "data", "if", "any", ")", "in", "the", "control", "from", "a", "list" ]
python
test
drdoctr/doctr
doctr/local.py
https://github.com/drdoctr/doctr/blob/0f19ff78c8239efcc98d417f36b0a31d9be01ba5/doctr/local.py#L227-L264
def get_travis_token(*, GitHub_token=None, **login_kwargs): """ Generate a temporary token for authenticating with Travis The GitHub token can be passed in to the ``GitHub_token`` keyword argument. If no token is passed in, a GitHub token is generated temporarily, and then immediately deleted. ...
[ "def", "get_travis_token", "(", "*", ",", "GitHub_token", "=", "None", ",", "*", "*", "login_kwargs", ")", ":", "_headers", "=", "{", "'Content-Type'", ":", "'application/json'", ",", "'User-Agent'", ":", "'MyClient/1.0.0'", ",", "}", "headersv2", "=", "{", ...
Generate a temporary token for authenticating with Travis The GitHub token can be passed in to the ``GitHub_token`` keyword argument. If no token is passed in, a GitHub token is generated temporarily, and then immediately deleted. This is needed to activate a private repo Returns the secret token...
[ "Generate", "a", "temporary", "token", "for", "authenticating", "with", "Travis" ]
python
train
johnnoone/facts
facts/grafts/system_grafts.py
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/grafts/system_grafts.py#L173-L193
def devices_data(): """Returns devices data. """ response = {} for part in psutil.disk_partitions(): device = part.device response[device] = { 'device': device, 'mountpoint': part.mountpoint, 'fstype': part.fstype, 'opts': part.opts, ...
[ "def", "devices_data", "(", ")", ":", "response", "=", "{", "}", "for", "part", "in", "psutil", ".", "disk_partitions", "(", ")", ":", "device", "=", "part", ".", "device", "response", "[", "device", "]", "=", "{", "'device'", ":", "device", ",", "'m...
Returns devices data.
[ "Returns", "devices", "data", "." ]
python
train
materialsproject/pymatgen
pymatgen/analysis/gb/grain.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L153-L165
def sigma_from_site_prop(self): """ This method returns the sigma value of the gb from site properties. If the GB structure merge some atoms due to the atoms too closer with each other, this property will not work. """ num_coi = 0 if None in self.site_properties['...
[ "def", "sigma_from_site_prop", "(", "self", ")", ":", "num_coi", "=", "0", "if", "None", "in", "self", ".", "site_properties", "[", "'grain_label'", "]", ":", "raise", "RuntimeError", "(", "'Site were merged, this property do not work'", ")", "for", "tag", "in", ...
This method returns the sigma value of the gb from site properties. If the GB structure merge some atoms due to the atoms too closer with each other, this property will not work.
[ "This", "method", "returns", "the", "sigma", "value", "of", "the", "gb", "from", "site", "properties", ".", "If", "the", "GB", "structure", "merge", "some", "atoms", "due", "to", "the", "atoms", "too", "closer", "with", "each", "other", "this", "property",...
python
train
edx/edx-enterprise
integrated_channels/degreed/exporters/learner_data.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/exporters/learner_data.py#L25-L68
def get_learner_data_records( self, enterprise_enrollment, completed_date=None, is_passing=False, **kwargs ): # pylint: disable=arguments-differ,unused-argument """ Return a DegreedLearnerDataTransmissionAudit with the given enrollment and...
[ "def", "get_learner_data_records", "(", "self", ",", "enterprise_enrollment", ",", "completed_date", "=", "None", ",", "is_passing", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=arguments-differ,unused-argument", "# Degreed expects completion dates of...
Return a DegreedLearnerDataTransmissionAudit with the given enrollment and course completion data. If completed_date is None, then course completion has not been met. If no remote ID can be found, return None.
[ "Return", "a", "DegreedLearnerDataTransmissionAudit", "with", "the", "given", "enrollment", "and", "course", "completion", "data", "." ]
python
valid
rmorshea/dstruct
dstruct/dstruct.py
https://github.com/rmorshea/dstruct/blob/c5eec8ac659c0846835e35ce1f59e7c3f9c9f25c/dstruct/dstruct.py#L364-L373
def del_fields(self, *names): """Delete data fields from this struct instance""" cls = type(self) self.__class__ = cls for n in names: # don't raise error if a field is absent if isinstance(getattr(cls, n, None), DataField): if n in self._field_val...
[ "def", "del_fields", "(", "self", ",", "*", "names", ")", ":", "cls", "=", "type", "(", "self", ")", "self", ".", "__class__", "=", "cls", "for", "n", "in", "names", ":", "# don't raise error if a field is absent", "if", "isinstance", "(", "getattr", "(", ...
Delete data fields from this struct instance
[ "Delete", "data", "fields", "from", "this", "struct", "instance" ]
python
train
edx/edx-sphinx-theme
edx_theme/__init__.py
https://github.com/edx/edx-sphinx-theme/blob/0abdc8c64ca1453f571a45f4603a6b2907a34378/edx_theme/__init__.py#L38-L42
def update_context(app, pagename, templatename, context, doctree): # pylint: disable=unused-argument """ Update the page rendering context to include ``feedback_form_url``. """ context['feedback_form_url'] = feedback_form_url(app.config.project, pagename)
[ "def", "update_context", "(", "app", ",", "pagename", ",", "templatename", ",", "context", ",", "doctree", ")", ":", "# pylint: disable=unused-argument", "context", "[", "'feedback_form_url'", "]", "=", "feedback_form_url", "(", "app", ".", "config", ".", "project...
Update the page rendering context to include ``feedback_form_url``.
[ "Update", "the", "page", "rendering", "context", "to", "include", "feedback_form_url", "." ]
python
train
LionelAuroux/pyrser
pyrser/parsing/base.py
https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/parsing/base.py#L151-L155
def begin_tag(self, name: str) -> Node: """Save the current index under the given name.""" # Check if we could attach tag cache to current rule_nodes scope self.tag_cache[name] = Tag(self._stream, self._stream.index) return True
[ "def", "begin_tag", "(", "self", ",", "name", ":", "str", ")", "->", "Node", ":", "# Check if we could attach tag cache to current rule_nodes scope", "self", ".", "tag_cache", "[", "name", "]", "=", "Tag", "(", "self", ".", "_stream", ",", "self", ".", "_strea...
Save the current index under the given name.
[ "Save", "the", "current", "index", "under", "the", "given", "name", "." ]
python
test
allenai/allennlp
allennlp/data/instance.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/data/instance.py#L59-L72
def index_fields(self, vocab: Vocabulary) -> None: """ Indexes all fields in this ``Instance`` using the provided ``Vocabulary``. This `mutates` the current object, it does not return a new ``Instance``. A ``DataIterator`` will call this on each pass through a dataset; we use the ``index...
[ "def", "index_fields", "(", "self", ",", "vocab", ":", "Vocabulary", ")", "->", "None", ":", "if", "not", "self", ".", "indexed", ":", "self", ".", "indexed", "=", "True", "for", "field", "in", "self", ".", "fields", ".", "values", "(", ")", ":", "...
Indexes all fields in this ``Instance`` using the provided ``Vocabulary``. This `mutates` the current object, it does not return a new ``Instance``. A ``DataIterator`` will call this on each pass through a dataset; we use the ``indexed`` flag to make sure that indexing only happens once. ...
[ "Indexes", "all", "fields", "in", "this", "Instance", "using", "the", "provided", "Vocabulary", ".", "This", "mutates", "the", "current", "object", "it", "does", "not", "return", "a", "new", "Instance", ".", "A", "DataIterator", "will", "call", "this", "on",...
python
train
SiLab-Bonn/pixel_clusterizer
pixel_clusterizer/cluster_functions.py
https://github.com/SiLab-Bonn/pixel_clusterizer/blob/d2c8c3072fb03ebb7c6a3e8c57350fbbe38efd4d/pixel_clusterizer/cluster_functions.py#L125-L133
def _set_1d_array(array, value, size=-1): ''' Set array elemets to value for given number of elements (if size is negative number set all elements to value). ''' if size >= 0: for i in range(size): array[i] = value else: for i in range(array.shape[0]): array[i] = ...
[ "def", "_set_1d_array", "(", "array", ",", "value", ",", "size", "=", "-", "1", ")", ":", "if", "size", ">=", "0", ":", "for", "i", "in", "range", "(", "size", ")", ":", "array", "[", "i", "]", "=", "value", "else", ":", "for", "i", "in", "ra...
Set array elemets to value for given number of elements (if size is negative number set all elements to value).
[ "Set", "array", "elemets", "to", "value", "for", "given", "number", "of", "elements", "(", "if", "size", "is", "negative", "number", "set", "all", "elements", "to", "value", ")", "." ]
python
test
walkr/nanoservice
nanoservice/reqrep.py
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/reqrep.py#L144-L147
def build_payload(cls, method, args): """ Build the payload to be sent to a `Responder` """ ref = str(uuid.uuid4()) return (method, args, ref)
[ "def", "build_payload", "(", "cls", ",", "method", ",", "args", ")", ":", "ref", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "return", "(", "method", ",", "args", ",", "ref", ")" ]
Build the payload to be sent to a `Responder`
[ "Build", "the", "payload", "to", "be", "sent", "to", "a", "Responder" ]
python
train
loads/molotov
molotov/slave.py
https://github.com/loads/molotov/blob/bd2c94e7f250e1fbb21940f02c68b4437655bc11/molotov/slave.py#L62-L122
def main(): """Moloslave clones a git repo and runs a molotov test """ parser = argparse.ArgumentParser(description='Github-based load test') parser.add_argument('--version', action='store_true', default=False, help='Displays version and exits.') parser.add_argument('--virt...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Github-based load test'", ")", "parser", ".", "add_argument", "(", "'--version'", ",", "action", "=", "'store_true'", ",", "default", "=", "False", ",", ...
Moloslave clones a git repo and runs a molotov test
[ "Moloslave", "clones", "a", "git", "repo", "and", "runs", "a", "molotov", "test" ]
python
train
pantsbuild/pants
pants-plugins/src/python/internal_backend/sitegen/tasks/sitegen.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/pants-plugins/src/python/internal_backend/sitegen/tasks/sitegen.py#L70-L76
def load_config(json_path): """Load config info from a .json file and return it.""" with open(json_path, 'r') as json_file: config = json.loads(json_file.read()) # sanity-test the config: assert(config['tree'][0]['page'] == 'index') return config
[ "def", "load_config", "(", "json_path", ")", ":", "with", "open", "(", "json_path", ",", "'r'", ")", "as", "json_file", ":", "config", "=", "json", ".", "loads", "(", "json_file", ".", "read", "(", ")", ")", "# sanity-test the config:", "assert", "(", "c...
Load config info from a .json file and return it.
[ "Load", "config", "info", "from", "a", ".", "json", "file", "and", "return", "it", "." ]
python
train
Synerty/pytmpdir
pytmpdir/Directory.py
https://github.com/Synerty/pytmpdir/blob/8f21d7a0b28d4f5c3a0ed91f9660ac5310773605/pytmpdir/Directory.py#L264-L283
def scan(self) -> ['File']: """ Scan Scan the directory for files and folders and update the file dictionary. @return: List of files """ self._files = {} output = self._listFilesWin() if isWindows else self._listFilesPosix() output = [line for line in output if...
[ "def", "scan", "(", "self", ")", "->", "[", "'File'", "]", ":", "self", ".", "_files", "=", "{", "}", "output", "=", "self", ".", "_listFilesWin", "(", ")", "if", "isWindows", "else", "self", ".", "_listFilesPosix", "(", ")", "output", "=", "[", "l...
Scan Scan the directory for files and folders and update the file dictionary. @return: List of files
[ "Scan" ]
python
train
euske/pdfminer
pdfminer/encodingdb.py
https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/encodingdb.py#L13-L20
def name2unicode(name): """Converts Adobe glyph names to Unicode numbers.""" if name in glyphname2unicode: return glyphname2unicode[name] m = STRIP_NAME.search(name) if not m: raise KeyError(name) return unichr(int(m.group(0)))
[ "def", "name2unicode", "(", "name", ")", ":", "if", "name", "in", "glyphname2unicode", ":", "return", "glyphname2unicode", "[", "name", "]", "m", "=", "STRIP_NAME", ".", "search", "(", "name", ")", "if", "not", "m", ":", "raise", "KeyError", "(", "name",...
Converts Adobe glyph names to Unicode numbers.
[ "Converts", "Adobe", "glyph", "names", "to", "Unicode", "numbers", "." ]
python
train
quintusdias/glymur
glymur/lib/openjp2.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjp2.py#L859-L885
def image_tile_create(comptparms, clrspc): """Creates a new image structure. Wraps the openjp2 library function opj_image_tile_create. Parameters ---------- cmptparms : comptparms_t The component parameters. clrspc : int Specifies the color space. Returns ------- i...
[ "def", "image_tile_create", "(", "comptparms", ",", "clrspc", ")", ":", "ARGTYPES", "=", "[", "ctypes", ".", "c_uint32", ",", "ctypes", ".", "POINTER", "(", "ImageComptParmType", ")", ",", "COLOR_SPACE_TYPE", "]", "OPENJP2", ".", "opj_image_tile_create", ".", ...
Creates a new image structure. Wraps the openjp2 library function opj_image_tile_create. Parameters ---------- cmptparms : comptparms_t The component parameters. clrspc : int Specifies the color space. Returns ------- image : ImageType Reference to ImageType in...
[ "Creates", "a", "new", "image", "structure", "." ]
python
train
Jajcus/pyxmpp2
pyxmpp2/roster.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L906-L930
def _roster_set(self, item, callback, error_callback): """Send a 'roster set' to the server. :Parameters: - `item`: the requested change :Types: - `item`: `RosterItem` """ stanza = Iq(to_jid = self.server, stanza_type = "set") payload = RosterPayl...
[ "def", "_roster_set", "(", "self", ",", "item", ",", "callback", ",", "error_callback", ")", ":", "stanza", "=", "Iq", "(", "to_jid", "=", "self", ".", "server", ",", "stanza_type", "=", "\"set\"", ")", "payload", "=", "RosterPayload", "(", "[", "item", ...
Send a 'roster set' to the server. :Parameters: - `item`: the requested change :Types: - `item`: `RosterItem`
[ "Send", "a", "roster", "set", "to", "the", "server", "." ]
python
valid
hufman/flask_rdf
flask_rdf/format.py
https://github.com/hufman/flask_rdf/blob/9bf86023288171eb0665c15fb28070250f80310c/flask_rdf/format.py#L135-L147
def add_format(mimetype, format, requires_context=False): """ Registers a new format to be used in a graph's serialize call If you've installed an rdflib serializer plugin, use this to add it to the content negotiation system Set requires_context=True if this format requires a context-aware graph """ ...
[ "def", "add_format", "(", "mimetype", ",", "format", ",", "requires_context", "=", "False", ")", ":", "global", "formats", "global", "ctxless_mimetypes", "global", "all_mimetypes", "formats", "[", "mimetype", "]", "=", "format", "if", "not", "requires_context", ...
Registers a new format to be used in a graph's serialize call If you've installed an rdflib serializer plugin, use this to add it to the content negotiation system Set requires_context=True if this format requires a context-aware graph
[ "Registers", "a", "new", "format", "to", "be", "used", "in", "a", "graph", "s", "serialize", "call", "If", "you", "ve", "installed", "an", "rdflib", "serializer", "plugin", "use", "this", "to", "add", "it", "to", "the", "content", "negotiation", "system", ...
python
train
glitchassassin/lackey
lackey/InputEmulation.py
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/InputEmulation.py#L87-L94
def buttonDown(self, button=mouse.LEFT): """ Holds down the specified mouse button. Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT """ self._lock.acquire() mouse.press(button) self._lock.release()
[ "def", "buttonDown", "(", "self", ",", "button", "=", "mouse", ".", "LEFT", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "mouse", ".", "press", "(", "button", ")", "self", ".", "_lock", ".", "release", "(", ")" ]
Holds down the specified mouse button. Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT
[ "Holds", "down", "the", "specified", "mouse", "button", "." ]
python
train
wavycloud/pyboto3
pyboto3/dynamodb.py
https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/dynamodb.py#L3728-L4306
def update_item(TableName=None, Key=None, AttributeUpdates=None, Expected=None, ConditionalOperator=None, ReturnValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, UpdateExpression=None, ConditionExpression=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None): """ Edits a...
[ "def", "update_item", "(", "TableName", "=", "None", ",", "Key", "=", "None", ",", "AttributeUpdates", "=", "None", ",", "Expected", "=", "None", ",", "ConditionalOperator", "=", "None", ",", "ReturnValues", "=", "None", ",", "ReturnConsumedCapacity", "=", "...
Edits an existing item's attributes, or adds a new item to the table if it does not already exist. You can put, delete, or add attribute values. You can also perform a conditional update on an existing item (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has cer...
[ "Edits", "an", "existing", "item", "s", "attributes", "or", "adds", "a", "new", "item", "to", "the", "table", "if", "it", "does", "not", "already", "exist", ".", "You", "can", "put", "delete", "or", "add", "attribute", "values", ".", "You", "can", "als...
python
train
markokr/rarfile
rarfile.py
https://github.com/markokr/rarfile/blob/2704344e8d7a1658c96c8ed8f449d7ba01bedea3/rarfile.py#L2109-L2118
def _skip(self, cnt): """Read and discard data""" while cnt > 0: if cnt > 8192: buf = self.read(8192) else: buf = self.read(cnt) if not buf: break cnt -= len(buf)
[ "def", "_skip", "(", "self", ",", "cnt", ")", ":", "while", "cnt", ">", "0", ":", "if", "cnt", ">", "8192", ":", "buf", "=", "self", ".", "read", "(", "8192", ")", "else", ":", "buf", "=", "self", ".", "read", "(", "cnt", ")", "if", "not", ...
Read and discard data
[ "Read", "and", "discard", "data" ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L88-L98
def ComputeFortranSuffixes(suffixes, ppsuffixes): """suffixes are fortran source files, and ppsuffixes the ones to be pre-processed. Both should be sequences, not strings.""" assert len(suffixes) > 0 s = suffixes[0] sup = s.upper() upper_suffixes = [_.upper() for _ in suffixes] if SCons.Util...
[ "def", "ComputeFortranSuffixes", "(", "suffixes", ",", "ppsuffixes", ")", ":", "assert", "len", "(", "suffixes", ")", ">", "0", "s", "=", "suffixes", "[", "0", "]", "sup", "=", "s", ".", "upper", "(", ")", "upper_suffixes", "=", "[", "_", ".", "upper...
suffixes are fortran source files, and ppsuffixes the ones to be pre-processed. Both should be sequences, not strings.
[ "suffixes", "are", "fortran", "source", "files", "and", "ppsuffixes", "the", "ones", "to", "be", "pre", "-", "processed", ".", "Both", "should", "be", "sequences", "not", "strings", "." ]
python
train
lorien/grab
grab/spider/cache_backend/mongodb.py
https://github.com/lorien/grab/blob/8b301db2a08c830245b61c589e58af6234f4db79/grab/spider/cache_backend/mongodb.py#L45-L52
def get_item(self, url): """ Returned item should have specific interface. See module docstring. """ _hash = self.build_hash(url) query = {'_id': _hash} return self.dbase.cache.find_one(query)
[ "def", "get_item", "(", "self", ",", "url", ")", ":", "_hash", "=", "self", ".", "build_hash", "(", "url", ")", "query", "=", "{", "'_id'", ":", "_hash", "}", "return", "self", ".", "dbase", ".", "cache", ".", "find_one", "(", "query", ")" ]
Returned item should have specific interface. See module docstring.
[ "Returned", "item", "should", "have", "specific", "interface", ".", "See", "module", "docstring", "." ]
python
train
angr/angr
angr/knowledge_plugins/functions/function.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L820-L846
def _call_to(self, from_node, to_func, ret_node, stmt_idx=None, ins_addr=None, return_to_outside=False): """ Registers an edge between the caller basic block and callee function. :param from_addr: The basic block that control flow leaves during the transition. :type from_addr: angr...
[ "def", "_call_to", "(", "self", ",", "from_node", ",", "to_func", ",", "ret_node", ",", "stmt_idx", "=", "None", ",", "ins_addr", "=", "None", ",", "return_to_outside", "=", "False", ")", ":", "self", ".", "_register_nodes", "(", "True", ",", "from_node", ...
Registers an edge between the caller basic block and callee function. :param from_addr: The basic block that control flow leaves during the transition. :type from_addr: angr.knowledge.CodeNode :param to_func: The function that we are calling :type to_func: Function ...
[ "Registers", "an", "edge", "between", "the", "caller", "basic", "block", "and", "callee", "function", "." ]
python
train
cloudnull/cloudlib
cloudlib/http.py
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/http.py#L104-L116
def _get_url(url): """Returns a URL string. If the ``url`` parameter is a ParsedResult from `urlparse` the full url will be unparsed and made into a string. Otherwise the ``url`` parameter is returned as is. :param url: ``str`` || ``object`` """ if isinstance(ur...
[ "def", "_get_url", "(", "url", ")", ":", "if", "isinstance", "(", "url", ",", "urlparse", ".", "ParseResult", ")", ":", "return", "urlparse", ".", "urlunparse", "(", "url", ")", "else", ":", "return", "url" ]
Returns a URL string. If the ``url`` parameter is a ParsedResult from `urlparse` the full url will be unparsed and made into a string. Otherwise the ``url`` parameter is returned as is. :param url: ``str`` || ``object``
[ "Returns", "a", "URL", "string", "." ]
python
train
oceanprotocol/squid-py
squid_py/keeper/keeper.py
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/keeper.py#L68-L81
def get_network_name(network_id): """ Return the keeper network name based on the current ethereum network id. Return `development` for every network id that is not mapped. :param network_id: Network id, int :return: Network name, str """ if os.environ.get('KEEPE...
[ "def", "get_network_name", "(", "network_id", ")", ":", "if", "os", ".", "environ", ".", "get", "(", "'KEEPER_NETWORK_NAME'", ")", ":", "logging", ".", "debug", "(", "'keeper network name overridden by an environment variable: {}'", ".", "format", "(", "os", ".", ...
Return the keeper network name based on the current ethereum network id. Return `development` for every network id that is not mapped. :param network_id: Network id, int :return: Network name, str
[ "Return", "the", "keeper", "network", "name", "based", "on", "the", "current", "ethereum", "network", "id", ".", "Return", "development", "for", "every", "network", "id", "that", "is", "not", "mapped", "." ]
python
train
choderalab/pymbar
pymbar/mbar.py
https://github.com/choderalab/pymbar/blob/69d1f0ff680e9ac1c6a51a5a207ea28f3ed86740/pymbar/mbar.py#L407-L459
def computeOverlap(self): """ Compute estimate of overlap matrix between the states. Returns ------- result_vals : dictonary Possible keys in the result_vals dictionary: 'scalar' : np.ndarray, float, shape=(K, K) One minus the largest nontrival eige...
[ "def", "computeOverlap", "(", "self", ")", ":", "W", "=", "np", ".", "matrix", "(", "self", ".", "getWeights", "(", ")", ",", "np", ".", "float64", ")", "O", "=", "np", ".", "multiply", "(", "self", ".", "N_k", ",", "W", ".", "T", "*", "W", "...
Compute estimate of overlap matrix between the states. Returns ------- result_vals : dictonary Possible keys in the result_vals dictionary: 'scalar' : np.ndarray, float, shape=(K, K) One minus the largest nontrival eigenvalue (largest is 1 or -1) 'eigenvalu...
[ "Compute", "estimate", "of", "overlap", "matrix", "between", "the", "states", "." ]
python
train
Miserlou/Zappa
zappa/handler.py
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/handler.py#L343-L598
def handler(self, event, context): """ An AWS Lambda function which parses specific API Gateway input into a WSGI request, feeds it to our WSGI app, procceses the response, and returns that back to the API Gateway. """ settings = self.settings # If in DEBUG mode...
[ "def", "handler", "(", "self", ",", "event", ",", "context", ")", ":", "settings", "=", "self", ".", "settings", "# If in DEBUG mode, log all raw incoming events.", "if", "settings", ".", "DEBUG", ":", "logger", ".", "debug", "(", "'Zappa Event: {}'", ".", "form...
An AWS Lambda function which parses specific API Gateway input into a WSGI request, feeds it to our WSGI app, procceses the response, and returns that back to the API Gateway.
[ "An", "AWS", "Lambda", "function", "which", "parses", "specific", "API", "Gateway", "input", "into", "a", "WSGI", "request", "feeds", "it", "to", "our", "WSGI", "app", "procceses", "the", "response", "and", "returns", "that", "back", "to", "the", "API", "G...
python
train
ssato/python-anyconfig
src/anyconfig/processors.py
https://github.com/ssato/python-anyconfig/blob/f2f4fb8d8e232aadea866c202e1dd7a5967e2877/src/anyconfig/processors.py#L243-L249
def register(self, *pclss): """ :param pclss: A list of :class:`Processor` or its children classes """ for pcls in pclss: if pcls.cid() not in self._processors: self._processors[pcls.cid()] = pcls
[ "def", "register", "(", "self", ",", "*", "pclss", ")", ":", "for", "pcls", "in", "pclss", ":", "if", "pcls", ".", "cid", "(", ")", "not", "in", "self", ".", "_processors", ":", "self", ".", "_processors", "[", "pcls", ".", "cid", "(", ")", "]", ...
:param pclss: A list of :class:`Processor` or its children classes
[ ":", "param", "pclss", ":", "A", "list", "of", ":", "class", ":", "Processor", "or", "its", "children", "classes" ]
python
train
gwpy/gwpy
gwpy/io/hdf5.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/io/hdf5.py#L46-L62
def with_read_hdf5(func): """Decorate an HDF5-reading function to open a filepath if needed ``func`` should be written to presume an `h5py.Group` as the first positional argument. """ @wraps(func) def decorated_func(fobj, *args, **kwargs): # pylint: disable=missing-docstring if ...
[ "def", "with_read_hdf5", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "decorated_func", "(", "fobj", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=missing-docstring", "if", "not", "isinstance", "(", "fobj", ",", ...
Decorate an HDF5-reading function to open a filepath if needed ``func`` should be written to presume an `h5py.Group` as the first positional argument.
[ "Decorate", "an", "HDF5", "-", "reading", "function", "to", "open", "a", "filepath", "if", "needed" ]
python
train
igorcoding/asynctnt-queue
asynctnt_queue/tube.py
https://github.com/igorcoding/asynctnt-queue/blob/75719b2dd27e8314ae924aea6a7a85be8f48ecc5/asynctnt_queue/tube.py#L156-L166
async def peek(self, task_id): """ Get task without changing its state :param task_id: Task id :return: Task instance """ args = (task_id,) res = await self.conn.call(self.__funcs['peek'], args) return self._create_task(res.body)
[ "async", "def", "peek", "(", "self", ",", "task_id", ")", ":", "args", "=", "(", "task_id", ",", ")", "res", "=", "await", "self", ".", "conn", ".", "call", "(", "self", ".", "__funcs", "[", "'peek'", "]", ",", "args", ")", "return", "self", ".",...
Get task without changing its state :param task_id: Task id :return: Task instance
[ "Get", "task", "without", "changing", "its", "state" ]
python
train
pywbem/pywbem
pywbem/tupletree.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupletree.py#L281-L426
def check_invalid_utf8_sequences(utf8_string, meaning, conn_id=None): """ Examine a UTF-8 encoded string and raise a `pywbem.XMLParseError` exception if the string contains invalid UTF-8 sequences (incorrectly encoded or ill-formed). This function works in both "wide" and "narrow" Unicode builds of...
[ "def", "check_invalid_utf8_sequences", "(", "utf8_string", ",", "meaning", ",", "conn_id", "=", "None", ")", ":", "context_before", "=", "16", "# number of chars to print before any bad chars", "context_after", "=", "16", "# number of chars to print after any bad chars", "try...
Examine a UTF-8 encoded string and raise a `pywbem.XMLParseError` exception if the string contains invalid UTF-8 sequences (incorrectly encoded or ill-formed). This function works in both "wide" and "narrow" Unicode builds of Python and supports the full range of Unicode characters from U+0000 to U+10F...
[ "Examine", "a", "UTF", "-", "8", "encoded", "string", "and", "raise", "a", "pywbem", ".", "XMLParseError", "exception", "if", "the", "string", "contains", "invalid", "UTF", "-", "8", "sequences", "(", "incorrectly", "encoded", "or", "ill", "-", "formed", "...
python
train
csirtgadgets/csirtgsdk-py
csirtgsdk/feed.py
https://github.com/csirtgadgets/csirtgsdk-py/blob/5a7ed9c5e6fa27170366ecbdef710dc80d537dc2/csirtgsdk/feed.py#L53-L65
def delete(self, user, name): """ Removes a feed :param user: feed username :param name: feed name :return: true/false """ uri = self.client.remote + '/users/{}/feeds/{}'.format(user, name) resp = self.client.session.delete(uri) return resp.stat...
[ "def", "delete", "(", "self", ",", "user", ",", "name", ")", ":", "uri", "=", "self", ".", "client", ".", "remote", "+", "'/users/{}/feeds/{}'", ".", "format", "(", "user", ",", "name", ")", "resp", "=", "self", ".", "client", ".", "session", ".", ...
Removes a feed :param user: feed username :param name: feed name :return: true/false
[ "Removes", "a", "feed" ]
python
train
ratt-ru/PyMORESANE
pymoresane/beam_fit.py
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/beam_fit.py#L6-L69
def beam_fit(psf, cdelt1, cdelt2): """ The following contructs a restoring beam from the psf. This is accoplished by fitting an elliptical Gaussian to the central lobe of the PSF. INPUTS: psf (no default): Array containing the psf for the image in question. cdelt1, cdelt2 (no default...
[ "def", "beam_fit", "(", "psf", ",", "cdelt1", ",", "cdelt2", ")", ":", "if", "psf", ".", "shape", ">", "512", ":", "psf_slice", "=", "tuple", "(", "[", "slice", "(", "psf", ".", "shape", "[", "0", "]", "/", "2", "-", "256", ",", "psf", ".", "...
The following contructs a restoring beam from the psf. This is accoplished by fitting an elliptical Gaussian to the central lobe of the PSF. INPUTS: psf (no default): Array containing the psf for the image in question. cdelt1, cdelt2 (no default): Header of the psf.
[ "The", "following", "contructs", "a", "restoring", "beam", "from", "the", "psf", ".", "This", "is", "accoplished", "by", "fitting", "an", "elliptical", "Gaussian", "to", "the", "central", "lobe", "of", "the", "PSF", "." ]
python
train
lambdalisue/django-permission
src/permission/utils/field_lookup.py
https://github.com/lambdalisue/django-permission/blob/580f7a1f857701d06ccf41163f188ac04fbc4fac/src/permission/utils/field_lookup.py#L6-L40
def field_lookup(obj, field_path): """ Lookup django model field in similar way of django query lookup. Args: obj (instance): Django Model instance field_path (str): '__' separated field path Example: >>> from django.db import model >>> from django.contrib.auth.models i...
[ "def", "field_lookup", "(", "obj", ",", "field_path", ")", ":", "if", "hasattr", "(", "obj", ",", "'iterator'", ")", ":", "return", "(", "field_lookup", "(", "x", ",", "field_path", ")", "for", "x", "in", "obj", ".", "iterator", "(", ")", ")", "elif"...
Lookup django model field in similar way of django query lookup. Args: obj (instance): Django Model instance field_path (str): '__' separated field path Example: >>> from django.db import model >>> from django.contrib.auth.models import User >>> class Article(models.Mod...
[ "Lookup", "django", "model", "field", "in", "similar", "way", "of", "django", "query", "lookup", "." ]
python
train
quantopian/pyfolio
pyfolio/perf_attrib.py
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/perf_attrib.py#L471-L501
def plot_risk_exposures(exposures, ax=None, title='Daily risk factor exposures'): """ Parameters ---------- exposures : pd.DataFrame df indexed by datetime, with factors as columns - Example: momentum reversal dt 20...
[ "def", "plot_risk_exposures", "(", "exposures", ",", "ax", "=", "None", ",", "title", "=", "'Daily risk factor exposures'", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "for", "col", "in", "exposures", ":", "ax", "."...
Parameters ---------- exposures : pd.DataFrame df indexed by datetime, with factors as columns - Example: momentum reversal dt 2017-01-01 -0.238655 0.077123 2017-01-02 0.821872 1.520515 ax : matplotlib.axes.Axes axes o...
[ "Parameters", "----------", "exposures", ":", "pd", ".", "DataFrame", "df", "indexed", "by", "datetime", "with", "factors", "as", "columns", "-", "Example", ":", "momentum", "reversal", "dt", "2017", "-", "01", "-", "01", "-", "0", ".", "238655", "0", "....
python
valid
knipknap/exscript
Exscript/emulators/command.py
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/emulators/command.py#L73-L96
def add_from_file(self, filename, handler_decorator=None): """ Wrapper around add() that reads the handlers from the file with the given name. The file is a Python script containing a list named 'commands' of tuples that map command names to handlers. :type filename: st...
[ "def", "add_from_file", "(", "self", ",", "filename", ",", "handler_decorator", "=", "None", ")", ":", "args", "=", "{", "}", "execfile", "(", "filename", ",", "args", ")", "commands", "=", "args", ".", "get", "(", "'commands'", ")", "if", "commands", ...
Wrapper around add() that reads the handlers from the file with the given name. The file is a Python script containing a list named 'commands' of tuples that map command names to handlers. :type filename: str :param filename: The name of the file containing the tuples. ...
[ "Wrapper", "around", "add", "()", "that", "reads", "the", "handlers", "from", "the", "file", "with", "the", "given", "name", ".", "The", "file", "is", "a", "Python", "script", "containing", "a", "list", "named", "commands", "of", "tuples", "that", "map", ...
python
train
daviddrysdale/python-phonenumbers
python/phonenumbers/shortnumberinfo.py
https://github.com/daviddrysdale/python-phonenumbers/blob/9cc5bb4ab5e661e70789b4c64bf7a9383c7bdc20/python/phonenumbers/shortnumberinfo.py#L295-L322
def _example_short_number_for_cost(region_code, cost): """Gets a valid short number for the specified cost category. Arguments: region_code -- the region for which an example short number is needed. cost -- the cost category of number that is needed. Returns a valid short number for the specified ...
[ "def", "_example_short_number_for_cost", "(", "region_code", ",", "cost", ")", ":", "metadata", "=", "PhoneMetadata", ".", "short_metadata_for_region", "(", "region_code", ")", "if", "metadata", "is", "None", ":", "return", "U_EMPTY_STRING", "desc", "=", "None", "...
Gets a valid short number for the specified cost category. Arguments: region_code -- the region for which an example short number is needed. cost -- the cost category of number that is needed. Returns a valid short number for the specified region and cost category. Returns an empty string when the...
[ "Gets", "a", "valid", "short", "number", "for", "the", "specified", "cost", "category", "." ]
python
train
KennethWilke/PingdomLib
pingdomlib/pingdom.py
https://github.com/KennethWilke/PingdomLib/blob/3ed1e481f9c9d16b032558d62fb05c2166e162ed/pingdomlib/pingdom.py#L221-L226
def getCheck(self, checkid): """Returns a detailed description of a specified check.""" check = PingdomCheck(self, {'id': checkid}) check.getDetails() return check
[ "def", "getCheck", "(", "self", ",", "checkid", ")", ":", "check", "=", "PingdomCheck", "(", "self", ",", "{", "'id'", ":", "checkid", "}", ")", "check", ".", "getDetails", "(", ")", "return", "check" ]
Returns a detailed description of a specified check.
[ "Returns", "a", "detailed", "description", "of", "a", "specified", "check", "." ]
python
train
proteanhq/protean
src/protean/core/queryset.py
https://github.com/proteanhq/protean/blob/0e29873f4aa634aa93cc08ed675dd749c7ed4b0f/src/protean/core/queryset.py#L243-L264
def update_all(self, *args, **kwargs): """Updates all objects with details given if they match a set of conditions supplied. This method forwards filters and updates directly to the repository. It does not instantiate entities and it does not trigger Entity callbacks or validations. Up...
[ "def", "update_all", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "updated_item_count", "=", "0", "repository", "=", "repo_factory", ".", "get_repository", "(", "self", ".", "_entity_cls", ")", "try", ":", "updated_item_count", "=", "r...
Updates all objects with details given if they match a set of conditions supplied. This method forwards filters and updates directly to the repository. It does not instantiate entities and it does not trigger Entity callbacks or validations. Update values can be specified either as a dict, or ...
[ "Updates", "all", "objects", "with", "details", "given", "if", "they", "match", "a", "set", "of", "conditions", "supplied", "." ]
python
train
ofa/django-bouncy
django_bouncy/views.py
https://github.com/ofa/django-bouncy/blob/a386dfa8c4ce59bd18978a3537c03cd6ad07bf06/django_bouncy/views.py#L38-L128
def endpoint(request): """Endpoint that SNS accesses. Includes logic verifying request""" # pylint: disable=too-many-return-statements,too-many-branches # In order to 'hide' the endpoint, all non-POST requests should return # the site's default HTTP404 if request.method != 'POST': raise Htt...
[ "def", "endpoint", "(", "request", ")", ":", "# pylint: disable=too-many-return-statements,too-many-branches", "# In order to 'hide' the endpoint, all non-POST requests should return", "# the site's default HTTP404", "if", "request", ".", "method", "!=", "'POST'", ":", "raise", "Ht...
Endpoint that SNS accesses. Includes logic verifying request
[ "Endpoint", "that", "SNS", "accesses", ".", "Includes", "logic", "verifying", "request" ]
python
train
ipazc/mtcnn
mtcnn/layer_factory.py
https://github.com/ipazc/mtcnn/blob/17029fe453a435f50c472ae2fd1c493341b5ede3/mtcnn/layer_factory.py#L179-L200
def new_fully_connected(self, name: str, output_count: int, relu=True, input_layer_name: str=None): """ Creates a new fully connected layer. :param name: name for the layer. :param output_count: number of outputs of the fully connected layer. :param relu: boolean flag to set if ...
[ "def", "new_fully_connected", "(", "self", ",", "name", ":", "str", ",", "output_count", ":", "int", ",", "relu", "=", "True", ",", "input_layer_name", ":", "str", "=", "None", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ")", ":", "inpu...
Creates a new fully connected layer. :param name: name for the layer. :param output_count: number of outputs of the fully connected layer. :param relu: boolean flag to set if ReLu should be applied at the end of this layer. :param input_layer_name: name of the input layer for this layer...
[ "Creates", "a", "new", "fully", "connected", "layer", "." ]
python
train
craft-ai/craft-ai-client-python
craftai/client.py
https://github.com/craft-ai/craft-ai-client-python/blob/8bc1a9038511540930371aacfdde0f4040e08f24/craftai/client.py#L516-L552
def get_decision_tree(self, agent_id, timestamp=None, version=DEFAULT_DECISION_TREE_VERSION): """Get decision tree. :param str agent_id: the id of the agent to get the tree. It must be an str containing only characters in "a-zA-Z0-9_-" and must be between 1 and 36 characters. :param int timestamp: ...
[ "def", "get_decision_tree", "(", "self", ",", "agent_id", ",", "timestamp", "=", "None", ",", "version", "=", "DEFAULT_DECISION_TREE_VERSION", ")", ":", "# Raises an error when agent_id is invalid", "self", ".", "_check_agent_id", "(", "agent_id", ")", "if", "self", ...
Get decision tree. :param str agent_id: the id of the agent to get the tree. It must be an str containing only characters in "a-zA-Z0-9_-" and must be between 1 and 36 characters. :param int timestamp: Optional. The decision tree is comptuted at this timestamp. :default timestamp: None, means t...
[ "Get", "decision", "tree", "." ]
python
train
jxtech/wechatpy
wechatpy/client/api/invoice.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L195-L210
def upload_pdf(self, pdf): """ 上传电子发票中的消费凭证 PDF 详情请参考 https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2 :param pdf: 要上传的 PDF 文件,一个 File-object :return: 64位整数,在将发票卡券插入用户卡包时使用用于关联pdf和发票卡券。有效期为3天。 """ return self._post( 'platform/setpdf', ...
[ "def", "upload_pdf", "(", "self", ",", "pdf", ")", ":", "return", "self", ".", "_post", "(", "'platform/setpdf'", ",", "files", "=", "{", "'pdf'", ":", "pdf", ",", "}", ",", "result_processor", "=", "lambda", "x", ":", "x", "[", "'s_media_id'", "]", ...
上传电子发票中的消费凭证 PDF 详情请参考 https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2 :param pdf: 要上传的 PDF 文件,一个 File-object :return: 64位整数,在将发票卡券插入用户卡包时使用用于关联pdf和发票卡券。有效期为3天。
[ "上传电子发票中的消费凭证", "PDF", "详情请参考", "https", ":", "//", "mp", ".", "weixin", ".", "qq", ".", "com", "/", "wiki?id", "=", "mp1497082828_r1cI2" ]
python
train
bykof/billomapy
billomapy/billomapy.py
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L389-L402
def get_all_client_tags(self, params=None): """ Get all client tags This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """ ...
[ "def", "get_all_client_tags", "(", "self", ",", "params", "=", "None", ")", ":", "return", "self", ".", "_iterate_through_pages", "(", "get_function", "=", "self", ".", "get_client_tags_per_page", ",", "resource", "=", "CLIENT_TAGS", ",", "*", "*", "{", "'para...
Get all client tags This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list
[ "Get", "all", "client", "tags", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "will", "get", "noth...
python
train
google/apitools
apitools/base/protorpclite/util.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/base/protorpclite/util.py#L197-L201
def total_seconds(offset): """Backport of offset.total_seconds() from python 2.7+.""" seconds = offset.days * 24 * 60 * 60 + offset.seconds microseconds = seconds * 10**6 + offset.microseconds return microseconds / (10**6 * 1.0)
[ "def", "total_seconds", "(", "offset", ")", ":", "seconds", "=", "offset", ".", "days", "*", "24", "*", "60", "*", "60", "+", "offset", ".", "seconds", "microseconds", "=", "seconds", "*", "10", "**", "6", "+", "offset", ".", "microseconds", "return", ...
Backport of offset.total_seconds() from python 2.7+.
[ "Backport", "of", "offset", ".", "total_seconds", "()", "from", "python", "2", ".", "7", "+", "." ]
python
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L500-L506
def has_main_target (self, name): """Tells if a main target with the specified name exists.""" assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets() return name in self.main_target_
[ "def", "has_main_target", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "return", "name", "in", "self", "....
Tells if a main target with the specified name exists.
[ "Tells", "if", "a", "main", "target", "with", "the", "specified", "name", "exists", "." ]
python
train
kkroening/ffmpeg-python
ffmpeg/_filters.py
https://github.com/kkroening/ffmpeg-python/blob/ac111dc3a976ddbb872bc7d6d4fe24a267c1a956/ffmpeg/_filters.py#L191-L212
def drawbox(stream, x, y, width, height, color, thickness=None, **kwargs): """Draw a colored box on the input image. Args: x: The expression which specifies the top left corner x coordinate of the box. It defaults to 0. y: The expression which specifies the top left corner y coordinate of the b...
[ "def", "drawbox", "(", "stream", ",", "x", ",", "y", ",", "width", ",", "height", ",", "color", ",", "thickness", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "thickness", ":", "kwargs", "[", "'t'", "]", "=", "thickness", "return", "Filter...
Draw a colored box on the input image. Args: x: The expression which specifies the top left corner x coordinate of the box. It defaults to 0. y: The expression which specifies the top left corner y coordinate of the box. It defaults to 0. width: Specify the width of the box; if 0 interprete...
[ "Draw", "a", "colored", "box", "on", "the", "input", "image", "." ]
python
train