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
thebjorn/pydeps
pydeps/cli.py
https://github.com/thebjorn/pydeps/blob/1e6715b7bea47a40e8042821b57937deaaa0fdc3/pydeps/cli.py#L45-L78
def base_argparser(argv=()): """Initial parser that can set values for the rest of the parsing process. """ global verbose verbose = _not_verbose _p = argparse.ArgumentParser(add_help=False) _p.add_argument('--debug', action='store_true', help="turn on all the show and verbose options (mainly f...
[ "def", "base_argparser", "(", "argv", "=", "(", ")", ")", ":", "global", "verbose", "verbose", "=", "_not_verbose", "_p", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "_p", ".", "add_argument", "(", "'--debug'", ",", "action"...
Initial parser that can set values for the rest of the parsing process.
[ "Initial", "parser", "that", "can", "set", "values", "for", "the", "rest", "of", "the", "parsing", "process", "." ]
python
train
saltstack/salt
salt/modules/mac_shadow.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_shadow.py#L238-L257
def get_login_failed_count(name): ''' Get the the number of failed login attempts :param str name: The username of the account :return: The number of failed login attempts :rtype: int :raises: CommandExecutionError on user not found or any other unknown error CLI Example: .. code-bl...
[ "def", "get_login_failed_count", "(", "name", ")", ":", "ret", "=", "_get_account_policy_data_value", "(", "name", ",", "'failedLoginCount'", ")", "return", "salt", ".", "utils", ".", "mac_utils", ".", "parse_return", "(", "ret", ")" ]
Get the the number of failed login attempts :param str name: The username of the account :return: The number of failed login attempts :rtype: int :raises: CommandExecutionError on user not found or any other unknown error CLI Example: .. code-block:: bash salt '*' shadow.get_login_...
[ "Get", "the", "the", "number", "of", "failed", "login", "attempts" ]
python
train
llllllllll/codetransformer
codetransformer/code.py
https://github.com/llllllllll/codetransformer/blob/c5f551e915df45adc7da7e0b1b635f0cc6a1bb27/codetransformer/code.py#L429-L510
def from_pycode(cls, co): """Create a Code object from a python code object. Parameters ---------- co : CodeType The python code object. Returns ------- code : Code The codetransformer Code object. """ # Make it sparse to ...
[ "def", "from_pycode", "(", "cls", ",", "co", ")", ":", "# Make it sparse to instrs[n] is the instruction at bytecode[n]", "sparse_instrs", "=", "tuple", "(", "_sparse_args", "(", "Instruction", ".", "from_opcode", "(", "b", ".", "opcode", ",", "Instruction", ".", "_...
Create a Code object from a python code object. Parameters ---------- co : CodeType The python code object. Returns ------- code : Code The codetransformer Code object.
[ "Create", "a", "Code", "object", "from", "a", "python", "code", "object", "." ]
python
train
offu/WeRoBot
werobot/crypto/__init__.py
https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/crypto/__init__.py#L123-L144
def encrypt_message(self, reply, timestamp=None, nonce=None): """ 加密微信回复 :param reply: 加密前的回复 :type reply: WeChatReply 或 XML 文本 :return: 加密后的回复文本 """ if hasattr(reply, "render"): reply = reply.render() timestamp = timestamp or to_text(int(time...
[ "def", "encrypt_message", "(", "self", ",", "reply", ",", "timestamp", "=", "None", ",", "nonce", "=", "None", ")", ":", "if", "hasattr", "(", "reply", ",", "\"render\"", ")", ":", "reply", "=", "reply", ".", "render", "(", ")", "timestamp", "=", "ti...
加密微信回复 :param reply: 加密前的回复 :type reply: WeChatReply 或 XML 文本 :return: 加密后的回复文本
[ "加密微信回复", ":", "param", "reply", ":", "加密前的回复", ":", "type", "reply", ":", "WeChatReply", "或", "XML", "文本", ":", "return", ":", "加密后的回复文本" ]
python
train
bitesofcode/projexui
projexui/widgets/xtabwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtabwidget.py#L187-L195
def resizeEvent(self, event): """ Updates the position of the additional buttons when this widget \ resizes. :param event | <QResizeEvet> """ super(XTabWidget, self).resizeEvent(event) self.adjustButtons()
[ "def", "resizeEvent", "(", "self", ",", "event", ")", ":", "super", "(", "XTabWidget", ",", "self", ")", ".", "resizeEvent", "(", "event", ")", "self", ".", "adjustButtons", "(", ")" ]
Updates the position of the additional buttons when this widget \ resizes. :param event | <QResizeEvet>
[ "Updates", "the", "position", "of", "the", "additional", "buttons", "when", "this", "widget", "\\", "resizes", ".", ":", "param", "event", "|", "<QResizeEvet", ">" ]
python
train
hfaran/piazza-api
piazza_api/rpc.py
https://github.com/hfaran/piazza-api/blob/26201d06e26bada9a838f6765c1bccedad05bd39/piazza_api/rpc.py#L345-L362
def search(self, query, nid=None): """Search for posts with ``query`` :type nid: str :param nid: This is the ID of the network to get the feed from. This is optional and only to override the existing `network_id` entered when created the class :type query: str ...
[ "def", "search", "(", "self", ",", "query", ",", "nid", "=", "None", ")", ":", "r", "=", "self", ".", "request", "(", "method", "=", "\"network.search\"", ",", "nid", "=", "nid", ",", "data", "=", "dict", "(", "query", "=", "query", ")", ")", "re...
Search for posts with ``query`` :type nid: str :param nid: This is the ID of the network to get the feed from. This is optional and only to override the existing `network_id` entered when created the class :type query: str :param query: The search query; should ...
[ "Search", "for", "posts", "with", "query" ]
python
train
Kozea/cairocffi
cairocffi/fonts.py
https://github.com/Kozea/cairocffi/blob/450853add7e32eea20985b6aa5f54d9cb3cd04fe/cairocffi/fonts.py#L198-L211
def get_ctm(self): """Copies the scaled font’s font current transform matrix. Note that the translation offsets ``(x0, y0)`` of the CTM are ignored by :class:`ScaledFont`. So, the matrix this method returns always has 0 as ``x0`` and ``y0``. :returns: A new :class:`Matrix` obje...
[ "def", "get_ctm", "(", "self", ")", ":", "matrix", "=", "Matrix", "(", ")", "cairo", ".", "cairo_scaled_font_get_ctm", "(", "self", ".", "_pointer", ",", "matrix", ".", "_pointer", ")", "self", ".", "_check_status", "(", ")", "return", "matrix" ]
Copies the scaled font’s font current transform matrix. Note that the translation offsets ``(x0, y0)`` of the CTM are ignored by :class:`ScaledFont`. So, the matrix this method returns always has 0 as ``x0`` and ``y0``. :returns: A new :class:`Matrix` object.
[ "Copies", "the", "scaled", "font’s", "font", "current", "transform", "matrix", "." ]
python
train
saltstack/salt
salt/modules/postgres.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1335-L1359
def _role_remove(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Removes a role from the Postgres Server ''' # check if user exists if not user_exists(name, user, host, port, maintenance_db, password=password, runas...
[ "def", "_role_remove", "(", "name", ",", "user", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ",", "maintenance_db", "=", "None", ",", "password", "=", "None", ",", "runas", "=", "None", ")", ":", "# check if user exists", "if", "no...
Removes a role from the Postgres Server
[ "Removes", "a", "role", "from", "the", "Postgres", "Server" ]
python
train
blue-yonder/tsfresh
tsfresh/scripts/run_tsfresh.py
https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/scripts/run_tsfresh.py#L30-L42
def _preprocess(df): """ given a DataFrame where records are stored row-wise, rearrange it such that records are stored column-wise. """ df = df.stack() df.index.rename(["id", "time"], inplace=True) # .reset_index() df.name = "value" df = df.reset_index() return df
[ "def", "_preprocess", "(", "df", ")", ":", "df", "=", "df", ".", "stack", "(", ")", "df", ".", "index", ".", "rename", "(", "[", "\"id\"", ",", "\"time\"", "]", ",", "inplace", "=", "True", ")", "# .reset_index()", "df", ".", "name", "=", "\"value\...
given a DataFrame where records are stored row-wise, rearrange it such that records are stored column-wise.
[ "given", "a", "DataFrame", "where", "records", "are", "stored", "row", "-", "wise", "rearrange", "it", "such", "that", "records", "are", "stored", "column", "-", "wise", "." ]
python
train
tanghaibao/jcvi
jcvi/apps/cdhit.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/apps/cdhit.py#L188-L242
def deduplicate(args): """ %prog deduplicate fastafile Wraps `cd-hit-est` to remove duplicate sequences. """ p = OptionParser(deduplicate.__doc__) p.set_align(pctid=96, pctcov=0) p.add_option("--fast", default=False, action="store_true", help="Place sequence in the first cl...
[ "def", "deduplicate", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "deduplicate", ".", "__doc__", ")", "p", ".", "set_align", "(", "pctid", "=", "96", ",", "pctcov", "=", "0", ")", "p", ".", "add_option", "(", "\"--fast\"", ",", "default", "...
%prog deduplicate fastafile Wraps `cd-hit-est` to remove duplicate sequences.
[ "%prog", "deduplicate", "fastafile" ]
python
train
jmgilman/Neolib
neolib/pyamf/codec.py
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/codec.py#L480-L499
def writeElement(self, data): """ Encodes C{data} to AMF. If the data is not able to be matched to an AMF type, then L{pyamf.EncodeError} will be raised. """ key = type(data) func = None try: func = self._func_cache[key] except KeyError: ...
[ "def", "writeElement", "(", "self", ",", "data", ")", ":", "key", "=", "type", "(", "data", ")", "func", "=", "None", "try", ":", "func", "=", "self", ".", "_func_cache", "[", "key", "]", "except", "KeyError", ":", "func", "=", "self", ".", "getTyp...
Encodes C{data} to AMF. If the data is not able to be matched to an AMF type, then L{pyamf.EncodeError} will be raised.
[ "Encodes", "C", "{", "data", "}", "to", "AMF", ".", "If", "the", "data", "is", "not", "able", "to", "be", "matched", "to", "an", "AMF", "type", "then", "L", "{", "pyamf", ".", "EncodeError", "}", "will", "be", "raised", "." ]
python
train
havardgulldahl/jottalib
src/jottalib/JFS.py
https://github.com/havardgulldahl/jottalib/blob/4d015e4309b1d9055e561ec757363fb2632b4eb7/src/jottalib/JFS.py#L822-L833
def files(self, mountPoint): """Get an iterator of JFSFile() from the given mountPoint. "mountPoint" may be either an actual mountPoint element from JFSDevice.mountPoints{} or its .name. """ if isinstance(mountPoint, six.string_types): # shortcut: pass a mountpoint name ...
[ "def", "files", "(", "self", ",", "mountPoint", ")", ":", "if", "isinstance", "(", "mountPoint", ",", "six", ".", "string_types", ")", ":", "# shortcut: pass a mountpoint name", "mountPoint", "=", "self", ".", "mountPoints", "[", "mountPoint", "]", "try", ":",...
Get an iterator of JFSFile() from the given mountPoint. "mountPoint" may be either an actual mountPoint element from JFSDevice.mountPoints{} or its .name.
[ "Get", "an", "iterator", "of", "JFSFile", "()", "from", "the", "given", "mountPoint", "." ]
python
train
UDST/urbansim
urbansim/models/dcm.py
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/models/dcm.py#L1158-L1195
def predict(self, choosers, alternatives, debug=False): """ Choose from among alternatives for a group of agents after segmenting the `choosers` table. Parameters ---------- choosers : pandas.DataFrame Table describing the agents making choices, e.g. househol...
[ "def", "predict", "(", "self", ",", "choosers", ",", "alternatives", ",", "debug", "=", "False", ")", ":", "logger", ".", "debug", "(", "'start: predict models in LCM group {}'", ".", "format", "(", "self", ".", "name", ")", ")", "results", "=", "[", "]", ...
Choose from among alternatives for a group of agents after segmenting the `choosers` table. Parameters ---------- choosers : pandas.DataFrame Table describing the agents making choices, e.g. households. Must have a column matching the .segmentation_col attribute....
[ "Choose", "from", "among", "alternatives", "for", "a", "group", "of", "agents", "after", "segmenting", "the", "choosers", "table", "." ]
python
train
clalancette/pycdlib
pycdlib/pycdlib.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/pycdlib.py#L677-L731
def seek(self, offset, whence=0): # type: (int, int) -> int ''' A method to change the stream position to byte offset offset. The offset is interpreted relative to the position indicated by whence. Valid values for whence are: * 0 -- start of stream (the default); offse...
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "0", ")", ":", "# type: (int, int) -> int", "if", "not", "self", ".", "_open", ":", "raise", "pycdlibexception", ".", "PyCdlibInvalidInput", "(", "'I/O operation on closed file.'", ")", "if", "isinst...
A method to change the stream position to byte offset offset. The offset is interpreted relative to the position indicated by whence. Valid values for whence are: * 0 -- start of stream (the default); offset should be zero or positive * 1 -- current stream position; offset may be negat...
[ "A", "method", "to", "change", "the", "stream", "position", "to", "byte", "offset", "offset", ".", "The", "offset", "is", "interpreted", "relative", "to", "the", "position", "indicated", "by", "whence", ".", "Valid", "values", "for", "whence", "are", ":" ]
python
train
connectordb/connectordb-python
connectordb/_datapointarray.py
https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L95-L107
def loadExport(self, folder): """Adds the data from a ConnectorDB export. If it is a stream export, then the folder is the location of the export. If it is a device export, then the folder is the export folder with the stream name as a subdirectory If it is a user export, you will use t...
[ "def", "loadExport", "(", "self", ",", "folder", ")", ":", "self", ".", "loadJSON", "(", "os", ".", "path", ".", "join", "(", "folder", ",", "\"data.json\"", ")", ")", "return", "self" ]
Adds the data from a ConnectorDB export. If it is a stream export, then the folder is the location of the export. If it is a device export, then the folder is the export folder with the stream name as a subdirectory If it is a user export, you will use the path of the export folder, with the us...
[ "Adds", "the", "data", "from", "a", "ConnectorDB", "export", ".", "If", "it", "is", "a", "stream", "export", "then", "the", "folder", "is", "the", "location", "of", "the", "export", ".", "If", "it", "is", "a", "device", "export", "then", "the", "folder...
python
test
KnorrFG/pyparadigm
pyparadigm/surface_composition.py
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/surface_composition.py#L483-L511
def compose(target, root=None): """Top level function to create a surface. :param target: the pygame.Surface to blit on. Or a (width, height) tuple in which case a new surface will be created :type target: - """ if type(root) == Surface: raise ValueError("A Surface may not be u...
[ "def", "compose", "(", "target", ",", "root", "=", "None", ")", ":", "if", "type", "(", "root", ")", "==", "Surface", ":", "raise", "ValueError", "(", "\"A Surface may not be used as root, please add \"", "+", "\"it as a single child i.e. compose(...)(Surface(...))\"", ...
Top level function to create a surface. :param target: the pygame.Surface to blit on. Or a (width, height) tuple in which case a new surface will be created :type target: -
[ "Top", "level", "function", "to", "create", "a", "surface", ".", ":", "param", "target", ":", "the", "pygame", ".", "Surface", "to", "blit", "on", ".", "Or", "a", "(", "width", "height", ")", "tuple", "in", "which", "case", "a", "new", "surface", "wi...
python
train
fossasia/knittingpattern
knittingpattern/convert/AYABPNGBuilder.py
https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/convert/AYABPNGBuilder.py#L82-L93
def _set_pixel(self, x, y, color): """set the color of the pixel. :param color: must be a valid color in the form of "#RRGGBB". If you need to convert color, use `_set_pixel_and_convert_color()`. """ if not self.is_in_bounds(x, y): return rgb = self._conver...
[ "def", "_set_pixel", "(", "self", ",", "x", ",", "y", ",", "color", ")", ":", "if", "not", "self", ".", "is_in_bounds", "(", "x", ",", "y", ")", ":", "return", "rgb", "=", "self", ".", "_convert_rrggbb_to_image_color", "(", "color", ")", "x", "-=", ...
set the color of the pixel. :param color: must be a valid color in the form of "#RRGGBB". If you need to convert color, use `_set_pixel_and_convert_color()`.
[ "set", "the", "color", "of", "the", "pixel", "." ]
python
valid
profitbricks/profitbricks-sdk-python
profitbricks/client.py
https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1998-L2012
def list_group_users(self, group_id, depth=1): """ Retrieves a list of all users that are members of a particular group. :param group_id: The unique ID of the group. :type group_id: ``str`` :param depth: The depth of the response data. :type depth:...
[ "def", "list_group_users", "(", "self", ",", "group_id", ",", "depth", "=", "1", ")", ":", "response", "=", "self", ".", "_perform_request", "(", "'/um/groups/%s/users?depth=%s'", "%", "(", "group_id", ",", "str", "(", "depth", ")", ")", ")", "return", "re...
Retrieves a list of all users that are members of a particular group. :param group_id: The unique ID of the group. :type group_id: ``str`` :param depth: The depth of the response data. :type depth: ``int``
[ "Retrieves", "a", "list", "of", "all", "users", "that", "are", "members", "of", "a", "particular", "group", "." ]
python
valid
SpriteLink/NIPAP
nipap-www/nipapwww/controllers/xhr.py
https://github.com/SpriteLink/NIPAP/blob/f96069f11ab952d80b13cab06e0528f2d24b3de9/nipap-www/nipapwww/controllers/xhr.py#L92-L132
def smart_search_vrf(self): """ Perform a smart VRF search. The "smart" search function tries extract a query from a text string. This query is then passed to the search_vrf function, which performs the search. """ search_options = {} extra_query = N...
[ "def", "smart_search_vrf", "(", "self", ")", ":", "search_options", "=", "{", "}", "extra_query", "=", "None", "if", "'query_id'", "in", "request", ".", "json", ":", "search_options", "[", "'query_id'", "]", "=", "request", ".", "json", "[", "'query_id'", ...
Perform a smart VRF search. The "smart" search function tries extract a query from a text string. This query is then passed to the search_vrf function, which performs the search.
[ "Perform", "a", "smart", "VRF", "search", "." ]
python
train
twisted/mantissa
xmantissa/scrolltable.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/scrolltable.py#L734-L754
def constructRows(self, items): """ Build row objects that are serializable using Athena for sending to the client. @param items: an iterable of objects compatible with my columns' C{extractValue} methods. @return: a list of dictionaries, where each dictionary has a str...
[ "def", "constructRows", "(", "self", ",", "items", ")", ":", "rows", "=", "[", "]", "for", "item", "in", "items", ":", "row", "=", "dict", "(", "(", "colname", ",", "col", ".", "extractValue", "(", "self", ",", "item", ")", ")", "for", "(", "coln...
Build row objects that are serializable using Athena for sending to the client. @param items: an iterable of objects compatible with my columns' C{extractValue} methods. @return: a list of dictionaries, where each dictionary has a string key for each column name in my list of c...
[ "Build", "row", "objects", "that", "are", "serializable", "using", "Athena", "for", "sending", "to", "the", "client", "." ]
python
train
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L3639-L3658
def assign_item_to_bank(self, item_id, bank_id): """Adds an existing ``Item`` to a ``Bank``. arg: item_id (osid.id.Id): the ``Id`` of the ``Item`` arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank`` raise: AlreadyExists - ``item_id`` is already assigned to ``ban...
[ "def", "assign_item_to_bank", "(", "self", ",", "item_id", ",", "bank_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinAssignmentSession.assign_resource_to_bin", "mgr", "=", "self", ".", "_get_provider_manager", "(", "'ASSESSMENT'", ",", "local", ...
Adds an existing ``Item`` to a ``Bank``. arg: item_id (osid.id.Id): the ``Id`` of the ``Item`` arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank`` raise: AlreadyExists - ``item_id`` is already assigned to ``bank_id`` raise: NotFound - ``item_id`` or ``bank_id``...
[ "Adds", "an", "existing", "Item", "to", "a", "Bank", "." ]
python
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L239-L267
def _matrix_adjust(self, X): """Adjust all values in X to encode for NaNs and infinities in the data. Parameters ---------- X : array-like, shape=(n_samples, n_feature) Input array of type int. Returns ------- X : array-like, shape=(n_samples, n_feat...
[ "def", "_matrix_adjust", "(", "self", ",", "X", ")", ":", "data_matrix", "=", "X", ".", "data", "if", "sparse", ".", "issparse", "(", "X", ")", "else", "X", "# Shift all values to specially encode for NAN/infinity/OTHER and 0", "# Old value New Value", "# --...
Adjust all values in X to encode for NaNs and infinities in the data. Parameters ---------- X : array-like, shape=(n_samples, n_feature) Input array of type int. Returns ------- X : array-like, shape=(n_samples, n_feature) Input array without any...
[ "Adjust", "all", "values", "in", "X", "to", "encode", "for", "NaNs", "and", "infinities", "in", "the", "data", "." ]
python
train
manns/pyspread
pyspread/src/lib/fileio.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/fileio.py#L103-L115
def write(self, *args, **kwargs): """Write that shows progress in statusbar for each <freq> cells""" self.progress_status() # Check abortes state and raise StopIteration if aborted if self.aborted: statustext = _("File saving aborted.") post_command_event(self.m...
[ "def", "write", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "progress_status", "(", ")", "# Check abortes state and raise StopIteration if aborted", "if", "self", ".", "aborted", ":", "statustext", "=", "_", "(", "\"File savi...
Write that shows progress in statusbar for each <freq> cells
[ "Write", "that", "shows", "progress", "in", "statusbar", "for", "each", "<freq", ">", "cells" ]
python
train
Azure/azure-cosmos-table-python
azure-cosmosdb-table/azure/cosmosdb/table/tableservice.py
https://github.com/Azure/azure-cosmos-table-python/blob/a7b618f6bddc465c9fdf899ea2971dfe4d04fcf0/azure-cosmosdb-table/azure/cosmosdb/table/tableservice.py#L1044-L1072
def insert_or_replace_entity(self, table_name, entity, timeout=None): ''' Replaces an existing entity or inserts a new entity if it does not exist in the table. Because this operation can insert or update an entity, it is also known as an "upsert" operation. If insert_or_replace...
[ "def", "insert_or_replace_entity", "(", "self", ",", "table_name", ",", "entity", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'table_name'", ",", "table_name", ")", "request", "=", "_insert_or_replace_entity", "(", "entity", ",", "self", "...
Replaces an existing entity or inserts a new entity if it does not exist in the table. Because this operation can insert or update an entity, it is also known as an "upsert" operation. If insert_or_replace_entity is used to replace an entity, any properties from the previous entity wil...
[ "Replaces", "an", "existing", "entity", "or", "inserts", "a", "new", "entity", "if", "it", "does", "not", "exist", "in", "the", "table", ".", "Because", "this", "operation", "can", "insert", "or", "update", "an", "entity", "it", "is", "also", "known", "a...
python
train
maas/python-libmaas
maas/client/utils/profiles.py
https://github.com/maas/python-libmaas/blob/4092c68ef7fb1753efc843569848e2bcc3415002/maas/client/utils/profiles.py#L247-L283
def open(cls, dbpath=Path("~/.maas.db").expanduser(), migrate_from=Path("~/.maascli.db").expanduser()): """Load a profiles database. Called without arguments this will open (and create) a database in the user's home directory. **Note** that this returns a context manager w...
[ "def", "open", "(", "cls", ",", "dbpath", "=", "Path", "(", "\"~/.maas.db\"", ")", ".", "expanduser", "(", ")", ",", "migrate_from", "=", "Path", "(", "\"~/.maascli.db\"", ")", ".", "expanduser", "(", ")", ")", ":", "# Ensure we're working with a Path instance...
Load a profiles database. Called without arguments this will open (and create) a database in the user's home directory. **Note** that this returns a context manager which will close the database on exit, saving if the exit is clean. :param dbpath: The path to the database file...
[ "Load", "a", "profiles", "database", "." ]
python
train
webkom/django-auth-abakus
abakus/auth.py
https://github.com/webkom/django-auth-abakus/blob/26779ad8e9f520835c2665f8a4d6731ca6f4ca18/abakus/auth.py#L25-L71
def authenticate(self, username, password): """ Should try to login with abakus.no (NERD). """ if getattr(settings, 'ABAKUS_DUMMY_AUTH', False): return self.dummy_authenticate(username, password) response = requests.post(url=path, data={'username': username, 'password...
[ "def", "authenticate", "(", "self", ",", "username", ",", "password", ")", ":", "if", "getattr", "(", "settings", ",", "'ABAKUS_DUMMY_AUTH'", ",", "False", ")", ":", "return", "self", ".", "dummy_authenticate", "(", "username", ",", "password", ")", "respons...
Should try to login with abakus.no (NERD).
[ "Should", "try", "to", "login", "with", "abakus", ".", "no", "(", "NERD", ")", "." ]
python
train
qntm/greenery
greenery/fsm.py
https://github.com/qntm/greenery/blob/f4dc7fb483825459d26e8fe9f417764469c56ee8/greenery/fsm.py#L649-L684
def derive(self, input): ''' Compute the Brzozowski derivative of this FSM with respect to the input string of symbols. <https://en.wikipedia.org/wiki/Brzozowski_derivative> If any of the symbols are not members of the alphabet, that's a KeyError. If you fall into oblivion, then the derivative is an FSM a...
[ "def", "derive", "(", "self", ",", "input", ")", ":", "try", ":", "# Consume the input string.", "state", "=", "self", ".", "initial", "for", "symbol", "in", "input", ":", "if", "not", "symbol", "in", "self", ".", "alphabet", ":", "if", "not", "anything_...
Compute the Brzozowski derivative of this FSM with respect to the input string of symbols. <https://en.wikipedia.org/wiki/Brzozowski_derivative> If any of the symbols are not members of the alphabet, that's a KeyError. If you fall into oblivion, then the derivative is an FSM accepting no strings.
[ "Compute", "the", "Brzozowski", "derivative", "of", "this", "FSM", "with", "respect", "to", "the", "input", "string", "of", "symbols", ".", "<https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Brzozowski_derivative", ">", "If", "any"...
python
train
secdev/scapy
scapy/packet.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L551-L560
def build(self): """ Create the current layer :return: string of the packet with the payload """ p = self.do_build() p += self.build_padding() p = self.build_done(p) return p
[ "def", "build", "(", "self", ")", ":", "p", "=", "self", ".", "do_build", "(", ")", "p", "+=", "self", ".", "build_padding", "(", ")", "p", "=", "self", ".", "build_done", "(", "p", ")", "return", "p" ]
Create the current layer :return: string of the packet with the payload
[ "Create", "the", "current", "layer" ]
python
train
quantmind/pulsar
pulsar/apps/wsgi/wrappers.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/apps/wsgi/wrappers.py#L172-L179
def cookies(self): """Container of request cookies """ cookies = SimpleCookie() cookie = self.environ.get('HTTP_COOKIE') if cookie: cookies.load(cookie) return cookies
[ "def", "cookies", "(", "self", ")", ":", "cookies", "=", "SimpleCookie", "(", ")", "cookie", "=", "self", ".", "environ", ".", "get", "(", "'HTTP_COOKIE'", ")", "if", "cookie", ":", "cookies", ".", "load", "(", "cookie", ")", "return", "cookies" ]
Container of request cookies
[ "Container", "of", "request", "cookies" ]
python
train
shexSpec/grammar
parsers/python/pyshexc/parser_impl/shex_node_expression_parser.py
https://github.com/shexSpec/grammar/blob/4497cd1f73fa6703bca6e2cb53ba9c120f22e48c/parsers/python/pyshexc/parser_impl/shex_node_expression_parser.py#L121-L129
def _literal_exclusions(self, stem: LiteralStemRange, exclusions: List[ShExDocParser.LiteralExclusionContext]) -> None: """ ShExC: literalExclusion = '-' literal STEM_MARK? ShExJ: exclusions: [STRING|LiteralStem +] literalStem: {stem:STRING} """...
[ "def", "_literal_exclusions", "(", "self", ",", "stem", ":", "LiteralStemRange", ",", "exclusions", ":", "List", "[", "ShExDocParser", ".", "LiteralExclusionContext", "]", ")", "->", "None", ":", "for", "excl", "in", "exclusions", ":", "excl_literal_v", "=", "...
ShExC: literalExclusion = '-' literal STEM_MARK? ShExJ: exclusions: [STRING|LiteralStem +] literalStem: {stem:STRING}
[ "ShExC", ":", "literalExclusion", "=", "-", "literal", "STEM_MARK?", "ShExJ", ":", "exclusions", ":", "[", "STRING|LiteralStem", "+", "]", "literalStem", ":", "{", "stem", ":", "STRING", "}" ]
python
train
d0c-s4vage/pfp
pfp/bitwrap.py
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L207-L217
def size(self): """Return the size of the stream, or -1 if it cannot be determined. """ pos = self._stream.tell() # seek to the end of the stream self._stream.seek(0,2) size = self._stream.tell() self._stream.seek(pos, 0) return size
[ "def", "size", "(", "self", ")", ":", "pos", "=", "self", ".", "_stream", ".", "tell", "(", ")", "# seek to the end of the stream", "self", ".", "_stream", ".", "seek", "(", "0", ",", "2", ")", "size", "=", "self", ".", "_stream", ".", "tell", "(", ...
Return the size of the stream, or -1 if it cannot be determined.
[ "Return", "the", "size", "of", "the", "stream", "or", "-", "1", "if", "it", "cannot", "be", "determined", "." ]
python
train
eykd/paved
paved/s3.py
https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/s3.py#L44-L94
def upload_s3(file_path, bucket_name, file_key, force=False, acl='private'): """Upload a local file to S3. """ file_path = path(file_path) bucket = open_s3(bucket_name) if file_path.isdir(): # Upload the contents of the dir path. paths = file_path.listdir() paths_keys = list...
[ "def", "upload_s3", "(", "file_path", ",", "bucket_name", ",", "file_key", ",", "force", "=", "False", ",", "acl", "=", "'private'", ")", ":", "file_path", "=", "path", "(", "file_path", ")", "bucket", "=", "open_s3", "(", "bucket_name", ")", "if", "file...
Upload a local file to S3.
[ "Upload", "a", "local", "file", "to", "S3", "." ]
python
valid
django-haystack/pysolr
pysolr.py
https://github.com/django-haystack/pysolr/blob/ee28b39324fa21a99842d297e313c1759d8adbd2/pysolr.py#L1161-L1167
def reload(self, core): # NOQA: A003 """http://wiki.apache.org/solr/CoreAdmin#head-3f125034c6a64611779442539812067b8b430930""" params = { 'action': 'RELOAD', 'core': core, } return self._get_url(self.url, params=params)
[ "def", "reload", "(", "self", ",", "core", ")", ":", "# NOQA: A003", "params", "=", "{", "'action'", ":", "'RELOAD'", ",", "'core'", ":", "core", ",", "}", "return", "self", ".", "_get_url", "(", "self", ".", "url", ",", "params", "=", "params", ")" ...
http://wiki.apache.org/solr/CoreAdmin#head-3f125034c6a64611779442539812067b8b430930
[ "http", ":", "//", "wiki", ".", "apache", ".", "org", "/", "solr", "/", "CoreAdmin#head", "-", "3f125034c6a64611779442539812067b8b430930" ]
python
train
nchopin/particles
particles/resampling.py
https://github.com/nchopin/particles/blob/3faa97a1073db45c5889eef3e015dd76ef350b52/particles/resampling.py#L259-L274
def log_sum_exp_ab(a, b): """log_sum_exp for two scalars. Parameters ---------- a, b: float Returns ------- c: float c = log(e^a + e^b) """ if a > b: return a + np.log(1. + np.exp(b - a)) else: return b + np.log(1. + np.exp(a - b))
[ "def", "log_sum_exp_ab", "(", "a", ",", "b", ")", ":", "if", "a", ">", "b", ":", "return", "a", "+", "np", ".", "log", "(", "1.", "+", "np", ".", "exp", "(", "b", "-", "a", ")", ")", "else", ":", "return", "b", "+", "np", ".", "log", "(",...
log_sum_exp for two scalars. Parameters ---------- a, b: float Returns ------- c: float c = log(e^a + e^b)
[ "log_sum_exp", "for", "two", "scalars", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_mac_address_table.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_mac_address_table.py#L313-L327
def get_mac_address_table_output_mac_address_table_vlanid(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_mac_address_table = ET.Element("get_mac_address_table") config = get_mac_address_table output = ET.SubElement(get_mac_address_table, "ou...
[ "def", "get_mac_address_table_output_mac_address_table_vlanid", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_mac_address_table", "=", "ET", ".", "Element", "(", "\"get_mac_address_table\"", ")", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
kaste/mockito-python
mockito/mockito.py
https://github.com/kaste/mockito-python/blob/d6b22b003f56ee5b156dbd9d8ba209faf35b6713/mockito/mockito.py#L284-L317
def expect(obj, strict=None, times=None, atleast=None, atmost=None, between=None): """Stub a function call, and set up an expected call count. Usage:: # Given `dog` is an instance of a `Dog` expect(dog, times=1).bark('Wuff').thenReturn('Miau') dog.bark('Wuff') dog.ba...
[ "def", "expect", "(", "obj", ",", "strict", "=", "None", ",", "times", "=", "None", ",", "atleast", "=", "None", ",", "atmost", "=", "None", ",", "between", "=", "None", ")", ":", "if", "strict", "is", "None", ":", "strict", "=", "True", "theMock",...
Stub a function call, and set up an expected call count. Usage:: # Given `dog` is an instance of a `Dog` expect(dog, times=1).bark('Wuff').thenReturn('Miau') dog.bark('Wuff') dog.bark('Wuff') # will throw at call time: too many invocations # maybe if you need to ensure th...
[ "Stub", "a", "function", "call", "and", "set", "up", "an", "expected", "call", "count", "." ]
python
train
wtsi-hgi/gitlab-build-variables
gitlabbuildvariables/reader.py
https://github.com/wtsi-hgi/gitlab-build-variables/blob/ed1afe50bc41fa20ffb29cacba5ff6dbc2446808/gitlabbuildvariables/reader.py#L12-L27
def read_variables(config_location: str) -> Dict[str, str]: """ Reads variables out of a config file. Variables can be in a ini file, a shell file used to source the variables (i.e. one that has just got "export *" like statements in it) or in JSON. :param config_location: the location of the config fil...
[ "def", "read_variables", "(", "config_location", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "with", "open", "(", "config_location", ",", "\"r\"", ")", "as", "config_file", ":", "config_lines", "=", "config_file", ".", "readlines", "("...
Reads variables out of a config file. Variables can be in a ini file, a shell file used to source the variables (i.e. one that has just got "export *" like statements in it) or in JSON. :param config_location: the location of the config file :return: dictionary where the variable names are key and their val...
[ "Reads", "variables", "out", "of", "a", "config", "file", ".", "Variables", "can", "be", "in", "a", "ini", "file", "a", "shell", "file", "used", "to", "source", "the", "variables", "(", "i", ".", "e", ".", "one", "that", "has", "just", "got", "export...
python
train
UB-UNIBAS/simple-elastic
simple_elastic/index.py
https://github.com/UB-UNIBAS/simple-elastic/blob/54f2fdd3405a7eafbf8873f337da263b8d47532a/simple_elastic/index.py#L189-L197
def update(self, doc: dict, doc_id: str): """Partial update to a single document. Uses the Update API with the specified partial document. """ body = { 'doc': doc } self.instance.update(self.index, self.doc_type, doc_id, body=body)
[ "def", "update", "(", "self", ",", "doc", ":", "dict", ",", "doc_id", ":", "str", ")", ":", "body", "=", "{", "'doc'", ":", "doc", "}", "self", ".", "instance", ".", "update", "(", "self", ".", "index", ",", "self", ".", "doc_type", ",", "doc_id"...
Partial update to a single document. Uses the Update API with the specified partial document.
[ "Partial", "update", "to", "a", "single", "document", "." ]
python
train
smira/py-numa
numa.py
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L230-L243
def set_interleave_mask(nodemask): """ Sets the memory interleave mask for the current thread to C{nodemask}. @param nodemask: node mask @type nodemask: C{set} """ mask = set_to_numa_nodemask(nodemask) tmp = bitmask_t() tmp.maskp = cast(byref(mask), POINTER(c_ulong)) tmp.size = siz...
[ "def", "set_interleave_mask", "(", "nodemask", ")", ":", "mask", "=", "set_to_numa_nodemask", "(", "nodemask", ")", "tmp", "=", "bitmask_t", "(", ")", "tmp", ".", "maskp", "=", "cast", "(", "byref", "(", "mask", ")", ",", "POINTER", "(", "c_ulong", ")", ...
Sets the memory interleave mask for the current thread to C{nodemask}. @param nodemask: node mask @type nodemask: C{set}
[ "Sets", "the", "memory", "interleave", "mask", "for", "the", "current", "thread", "to", "C", "{", "nodemask", "}", "." ]
python
train
datamachine/twx.botapi
twx/botapi/botapi.py
https://github.com/datamachine/twx.botapi/blob/c85184da738169e8f9d6d8e62970540f427c486e/twx/botapi/botapi.py#L4266-L4268
def set_chat_photo(self, *args, **kwargs): """See :func:`set_chat_photo`""" return set_chat_photo(*args, **self._merge_overrides(**kwargs)).run()
[ "def", "set_chat_photo", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "set_chat_photo", "(", "*", "args", ",", "*", "*", "self", ".", "_merge_overrides", "(", "*", "*", "kwargs", ")", ")", ".", "run", "(", ")" ]
See :func:`set_chat_photo`
[ "See", ":", "func", ":", "set_chat_photo" ]
python
train
IrvKalb/pygwidgets
pygwidgets/pygwidgets.py
https://github.com/IrvKalb/pygwidgets/blob/a830d8885d4d209e471cb53816277d30db56273c/pygwidgets/pygwidgets.py#L1301-L1305
def disableGroup(self): """Disables all radio buttons in the group""" radioButtonListInGroup = PygWidgetsRadioButton.__PygWidgets__Radio__Buttons__Groups__Dicts__[self.group] for radioButton in radioButtonListInGroup: radioButton.disable()
[ "def", "disableGroup", "(", "self", ")", ":", "radioButtonListInGroup", "=", "PygWidgetsRadioButton", ".", "__PygWidgets__Radio__Buttons__Groups__Dicts__", "[", "self", ".", "group", "]", "for", "radioButton", "in", "radioButtonListInGroup", ":", "radioButton", ".", "di...
Disables all radio buttons in the group
[ "Disables", "all", "radio", "buttons", "in", "the", "group" ]
python
train
ghcollin/multitables
multitables.py
https://github.com/ghcollin/multitables/blob/9654a45800289a20e66d2b0e0666149f0d370f93/multitables.py#L107-L115
def wait(self, index, next_index=None): """ Block until it is the turn indicated by index. :param index: :param next_index: Set the index to this value after finishing. Releases the process waiting on next_index. Defaults to incrementing index by 1. :return: "...
[ "def", "wait", "(", "self", ",", "index", ",", "next_index", "=", "None", ")", ":", "return", "OrderedBarrier", ".", "Guard", "(", "self", ",", "index", ",", "index", "+", "1", "if", "next_index", "is", "None", "else", "next_index", ")" ]
Block until it is the turn indicated by index. :param index: :param next_index: Set the index to this value after finishing. Releases the process waiting on next_index. Defaults to incrementing index by 1. :return:
[ "Block", "until", "it", "is", "the", "turn", "indicated", "by", "index", ".", ":", "param", "index", ":", ":", "param", "next_index", ":", "Set", "the", "index", "to", "this", "value", "after", "finishing", ".", "Releases", "the", "process", "waiting", "...
python
test
Ex-Mente/auxi.0
auxi/core/reporting.py
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/core/reporting.py#L53-L81
def render(self, format=ReportFormat.printout): """ Render the report in the specified format :param format: The format. The default format is to print the report to the console. :returns: If the format was set to 'string' then a string representation of the report ...
[ "def", "render", "(", "self", ",", "format", "=", "ReportFormat", ".", "printout", ")", ":", "table", "=", "self", ".", "_generate_table_", "(", ")", "if", "format", "==", "ReportFormat", ".", "printout", ":", "print", "(", "tabulate", "(", "table", ",",...
Render the report in the specified format :param format: The format. The default format is to print the report to the console. :returns: If the format was set to 'string' then a string representation of the report is returned.
[ "Render", "the", "report", "in", "the", "specified", "format" ]
python
valid
six8/polydatum
src/polydatum/context.py
https://github.com/six8/polydatum/blob/c98a498f8e7972218903ec027f6de78089726c1d/src/polydatum/context.py#L239-L275
def _exit(self, obj, type, value, traceback): """ Teardown a Resource or Middleware. """ if type is None: # No in-context exception occurred try: obj.next() except StopIteration: # Resource closed as expected ...
[ "def", "_exit", "(", "self", ",", "obj", ",", "type", ",", "value", ",", "traceback", ")", ":", "if", "type", "is", "None", ":", "# No in-context exception occurred", "try", ":", "obj", ".", "next", "(", ")", "except", "StopIteration", ":", "# Resource clo...
Teardown a Resource or Middleware.
[ "Teardown", "a", "Resource", "or", "Middleware", "." ]
python
test
akissa/spamc
setup.py
https://github.com/akissa/spamc/blob/da50732e276f7ed3d67cb75c31cb017d6a62f066/setup.py#L38-L56
def get_readme(): """Generate long description""" pandoc = None for path in os.environ["PATH"].split(os.pathsep): path = path.strip('"') pandoc = os.path.join(path, 'pandoc') if os.path.isfile(pandoc) and os.access(pandoc, os.X_OK): break else: pandoc ...
[ "def", "get_readme", "(", ")", ":", "pandoc", "=", "None", "for", "path", "in", "os", ".", "environ", "[", "\"PATH\"", "]", ".", "split", "(", "os", ".", "pathsep", ")", ":", "path", "=", "path", ".", "strip", "(", "'\"'", ")", "pandoc", "=", "os...
Generate long description
[ "Generate", "long", "description" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_common_def.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_common_def.py#L1151-L1162
def router_fabric_virtual_gateway_address_family_ipv4_accept_unicast_arp_request(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") router = ET.SubElement(config, "router", xmlns="urn:brocade.com:mgmt:brocade-common-def") fabric_virtual_gateway = ET.SubElem...
[ "def", "router_fabric_virtual_gateway_address_family_ipv4_accept_unicast_arp_request", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "router", "=", "ET", ".", "SubElement", "(", "config", ",", "\"route...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
paramiko/paramiko
paramiko/ssh_gss.py
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L483-L508
def ssh_get_mic(self, session_id, gss_kex=False): """ Create the MIC token for a SSH2 message. :param str session_id: The SSH session ID :param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not :return: gssapi-with-mic: Returns the MIC token from ...
[ "def", "ssh_get_mic", "(", "self", ",", "session_id", ",", "gss_kex", "=", "False", ")", ":", "self", ".", "_session_id", "=", "session_id", "if", "not", "gss_kex", ":", "mic_field", "=", "self", ".", "_ssh_build_mic", "(", "self", ".", "_session_id", ",",...
Create the MIC token for a SSH2 message. :param str session_id: The SSH session ID :param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not :return: gssapi-with-mic: Returns the MIC token from SSPI for the message we created with ``_ssh_build_mic...
[ "Create", "the", "MIC", "token", "for", "a", "SSH2", "message", "." ]
python
train
EUDAT-B2SAFE/B2HANDLE
b2handle/utilhandle.py
https://github.com/EUDAT-B2SAFE/B2HANDLE/blob/a6d216d459644e01fbdfd5b318a535950bc5cdbb/b2handle/utilhandle.py#L120-L154
def make_request_log_message(**args): ''' Creates a string containing all relevant information about a request made to the Handle System, for logging purposes. :handle: The handle that the request is about. :url: The url the request is sent to. :headers: The headers sent along with the requ...
[ "def", "make_request_log_message", "(", "*", "*", "args", ")", ":", "mandatory_args", "=", "[", "'op'", ",", "'handle'", ",", "'url'", ",", "'headers'", ",", "'verify'", ",", "'resp'", "]", "optional_args", "=", "[", "'payload'", "]", "util", ".", "check_p...
Creates a string containing all relevant information about a request made to the Handle System, for logging purposes. :handle: The handle that the request is about. :url: The url the request is sent to. :headers: The headers sent along with the request. :verify: Boolean parameter passed to the ...
[ "Creates", "a", "string", "containing", "all", "relevant", "information", "about", "a", "request", "made", "to", "the", "Handle", "System", "for", "logging", "purposes", "." ]
python
train
bhearsum/chunkify
chunkify/__init__.py
https://github.com/bhearsum/chunkify/blob/f3a693b17c80626852523955bf3c01b4fd93439b/chunkify/__init__.py#L8-L33
def split_evenly(n, chunks): """Split an integer into evenly distributed list >>> split_evenly(7, 3) [3, 2, 2] >>> split_evenly(12, 3) [4, 4, 4] >>> split_evenly(35, 10) [4, 4, 4, 4, 4, 3, 3, 3, 3, 3] >>> split_evenly(1, 2) Traceback (most recent call last): ... Chunk...
[ "def", "split_evenly", "(", "n", ",", "chunks", ")", ":", "if", "n", "<", "chunks", ":", "raise", "ChunkingError", "(", "\"Number of chunks is greater than number\"", ")", "if", "n", "%", "chunks", "==", "0", ":", "# Either we can evenly split or only 1 chunk left",...
Split an integer into evenly distributed list >>> split_evenly(7, 3) [3, 2, 2] >>> split_evenly(12, 3) [4, 4, 4] >>> split_evenly(35, 10) [4, 4, 4, 4, 4, 3, 3, 3, 3, 3] >>> split_evenly(1, 2) Traceback (most recent call last): ... ChunkingError: Number of chunks is greate...
[ "Split", "an", "integer", "into", "evenly", "distributed", "list" ]
python
train
psd-tools/psd-tools
src/psd_tools/api/layers.py
https://github.com/psd-tools/psd-tools/blob/4952b57bcf1cf2c1f16fd9d6d51d4fa0b53bce4e/src/psd_tools/api/layers.py#L342-L351
def compose(self, *args, **kwargs): """ Compose layer and masks (mask, vector mask, and clipping layers). :return: :py:class:`PIL.Image`, or `None` if the layer has no pixel. """ from psd_tools.api.composer import compose_layer if self.bbox == (0, 0, 0, 0): r...
[ "def", "compose", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "psd_tools", ".", "api", ".", "composer", "import", "compose_layer", "if", "self", ".", "bbox", "==", "(", "0", ",", "0", ",", "0", ",", "0", ")", ":", ...
Compose layer and masks (mask, vector mask, and clipping layers). :return: :py:class:`PIL.Image`, or `None` if the layer has no pixel.
[ "Compose", "layer", "and", "masks", "(", "mask", "vector", "mask", "and", "clipping", "layers", ")", "." ]
python
train
LionelAuroux/pyrser
pyrser/type_system/inference.py
https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/inference.py#L228-L246
def infer_id(self, ident, diagnostic=None): """ Infer type from an ID! - check if ID is declarated in the scope - if no ID is polymorphic type """ # check if ID is declared #defined = self.type_node.get_by_symbol_name(ident) defined = self.infer_node.scope...
[ "def", "infer_id", "(", "self", ",", "ident", ",", "diagnostic", "=", "None", ")", ":", "# check if ID is declared", "#defined = self.type_node.get_by_symbol_name(ident)", "defined", "=", "self", ".", "infer_node", ".", "scope_node", ".", "get_by_symbol_name", "(", "i...
Infer type from an ID! - check if ID is declarated in the scope - if no ID is polymorphic type
[ "Infer", "type", "from", "an", "ID!", "-", "check", "if", "ID", "is", "declarated", "in", "the", "scope", "-", "if", "no", "ID", "is", "polymorphic", "type" ]
python
test
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L248-L261
def add_suffix (self, specified_name, file_type, prop_set): """ Appends the suffix appropriate to 'type/property_set' combination to the specified name and returns the result. """ assert isinstance(specified_name, basestring) assert isinstance(file_type, basestring) a...
[ "def", "add_suffix", "(", "self", ",", "specified_name", ",", "file_type", ",", "prop_set", ")", ":", "assert", "isinstance", "(", "specified_name", ",", "basestring", ")", "assert", "isinstance", "(", "file_type", ",", "basestring", ")", "assert", "isinstance",...
Appends the suffix appropriate to 'type/property_set' combination to the specified name and returns the result.
[ "Appends", "the", "suffix", "appropriate", "to", "type", "/", "property_set", "combination", "to", "the", "specified", "name", "and", "returns", "the", "result", "." ]
python
train
datastore/datastore
datastore/core/basic.py
https://github.com/datastore/datastore/blob/7ccf0cd4748001d3dbf5e6dda369b0f63e0269d3/datastore/core/basic.py#L1138-L1154
def shard_query_generator(self, query): '''A generator that queries each shard in sequence.''' shard_query = query.copy() for shard in self._stores: # yield all items matching within this shard cursor = shard.query(shard_query) for item in cursor: yield item # update query ...
[ "def", "shard_query_generator", "(", "self", ",", "query", ")", ":", "shard_query", "=", "query", ".", "copy", "(", ")", "for", "shard", "in", "self", ".", "_stores", ":", "# yield all items matching within this shard", "cursor", "=", "shard", ".", "query", "(...
A generator that queries each shard in sequence.
[ "A", "generator", "that", "queries", "each", "shard", "in", "sequence", "." ]
python
train
ContextLab/quail
quail/load.py
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L87-L121
def load_egg(filepath, update=True): """ Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg """ try: ...
[ "def", "load_egg", "(", "filepath", ",", "update", "=", "True", ")", ":", "try", ":", "egg", "=", "Egg", "(", "*", "*", "dd", ".", "io", ".", "load", "(", "filepath", ")", ")", "except", ":", "# if error, try loading old format", "with", "open", "(", ...
Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg
[ "Loads", "pickled", "egg" ]
python
train
Damgaard/PyImgur
pyimgur/__init__.py
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L432-L437
def get_replies(self): """Get the replies to this comment.""" url = self._imgur._base_url + "/3/comment/{0}/replies".format(self.id) json = self._imgur._send_request(url) child_comments = json['children'] return [Comment(com, self._imgur) for com in child_comments]
[ "def", "get_replies", "(", "self", ")", ":", "url", "=", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/comment/{0}/replies\"", ".", "format", "(", "self", ".", "id", ")", "json", "=", "self", ".", "_imgur", ".", "_send_request", "(", "url", ")", ...
Get the replies to this comment.
[ "Get", "the", "replies", "to", "this", "comment", "." ]
python
train
square/pylink
setup.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/setup.py#L111-L121
def finalize_options(self): """Finalizes the command's options. Args: self (CoverageCommand): the ``CoverageCommand`` instance Returns: ``None`` """ self.cwd = os.path.abspath(os.path.dirname(__file__)) self.test_dir = os.path.join(self.cwd, 'tests')
[ "def", "finalize_options", "(", "self", ")", ":", "self", ".", "cwd", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "self", ".", "test_dir", "=", "os", ".", "path", ".", "join", "(", "s...
Finalizes the command's options. Args: self (CoverageCommand): the ``CoverageCommand`` instance Returns: ``None``
[ "Finalizes", "the", "command", "s", "options", "." ]
python
train
chrismattmann/nutch-python
nutch/crawl.py
https://github.com/chrismattmann/nutch-python/blob/07ae182e283b2f74ef062ddfa20a690a59ab6f5a/nutch/crawl.py#L38-L51
def crawl_cmd(self, seed_list, n): ''' Runs the crawl job for n rounds :param seed_list: lines of seed URLs :param n: number of rounds :return: number of successful rounds ''' print("Num Rounds "+str(n)) cc = self.proxy.Crawl(seed=seed_list, rounds=n) ...
[ "def", "crawl_cmd", "(", "self", ",", "seed_list", ",", "n", ")", ":", "print", "(", "\"Num Rounds \"", "+", "str", "(", "n", ")", ")", "cc", "=", "self", ".", "proxy", ".", "Crawl", "(", "seed", "=", "seed_list", ",", "rounds", "=", "n", ")", "r...
Runs the crawl job for n rounds :param seed_list: lines of seed URLs :param n: number of rounds :return: number of successful rounds
[ "Runs", "the", "crawl", "job", "for", "n", "rounds", ":", "param", "seed_list", ":", "lines", "of", "seed", "URLs", ":", "param", "n", ":", "number", "of", "rounds", ":", "return", ":", "number", "of", "successful", "rounds" ]
python
train
bitshares/uptick
uptick/account.py
https://github.com/bitshares/uptick/blob/66c102200fdbf96cef4fd55cc69d00e690f62001/uptick/account.py#L269-L273
def blacklist(ctx, blacklist_account, account): """ Add an account to a blacklist """ account = Account(account, blockchain_instance=ctx.blockchain) print_tx(account.blacklist(blacklist_account))
[ "def", "blacklist", "(", "ctx", ",", "blacklist_account", ",", "account", ")", ":", "account", "=", "Account", "(", "account", ",", "blockchain_instance", "=", "ctx", ".", "blockchain", ")", "print_tx", "(", "account", ".", "blacklist", "(", "blacklist_account...
Add an account to a blacklist
[ "Add", "an", "account", "to", "a", "blacklist" ]
python
train
NarrativeScience/lsi
src/lsi/utils/hosts.py
https://github.com/NarrativeScience/lsi/blob/7d901b03fdb1a34ef795e5412bfe9685d948e32d/src/lsi/utils/hosts.py#L462-L472
def get_region(): """Use the environment to get the current region""" global _REGION if _REGION is None: region_name = os.getenv("AWS_DEFAULT_REGION") or "us-east-1" region_dict = {r.name: r for r in boto.regioninfo.get_regions("ec2")} if region_name not in region_dict: r...
[ "def", "get_region", "(", ")", ":", "global", "_REGION", "if", "_REGION", "is", "None", ":", "region_name", "=", "os", ".", "getenv", "(", "\"AWS_DEFAULT_REGION\"", ")", "or", "\"us-east-1\"", "region_dict", "=", "{", "r", ".", "name", ":", "r", "for", "...
Use the environment to get the current region
[ "Use", "the", "environment", "to", "get", "the", "current", "region" ]
python
test
antocuni/pdb
pdb.py
https://github.com/antocuni/pdb/blob/a88be00d31f1ff38e26711a1d99589d830524c9e/pdb.py#L1218-L1225
def is_skipped_module(self, module_name): """Backport for https://bugs.python.org/issue36130. Fixed in Python 3.8+. """ if module_name is None: return False return super(Pdb, self).is_skipped_module(module_name)
[ "def", "is_skipped_module", "(", "self", ",", "module_name", ")", ":", "if", "module_name", "is", "None", ":", "return", "False", "return", "super", "(", "Pdb", ",", "self", ")", ".", "is_skipped_module", "(", "module_name", ")" ]
Backport for https://bugs.python.org/issue36130. Fixed in Python 3.8+.
[ "Backport", "for", "https", ":", "//", "bugs", ".", "python", ".", "org", "/", "issue36130", "." ]
python
train
closeio/tasktiger
tasktiger/worker.py
https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/worker.py#L122-L142
def _filter_queues(self, queues): """ Applies the queue filter to the given list of queues and returns the queues that match. Note that a queue name matches any subqueues starting with the name, followed by a date. For example, "foo" will match both "foo" and "foo.bar". "...
[ "def", "_filter_queues", "(", "self", ",", "queues", ")", ":", "def", "match", "(", "queue", ")", ":", "\"\"\"\n Returns whether the given queue should be included by checking each\n part of the queue name.\n \"\"\"", "for", "part", "in", "reverse...
Applies the queue filter to the given list of queues and returns the queues that match. Note that a queue name matches any subqueues starting with the name, followed by a date. For example, "foo" will match both "foo" and "foo.bar".
[ "Applies", "the", "queue", "filter", "to", "the", "given", "list", "of", "queues", "and", "returns", "the", "queues", "that", "match", ".", "Note", "that", "a", "queue", "name", "matches", "any", "subqueues", "starting", "with", "the", "name", "followed", ...
python
train
cloud-custodian/cloud-custodian
c7n/reports/csvout.py
https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/reports/csvout.py#L238-L278
def record_set(session_factory, bucket, key_prefix, start_date, specify_hour=False): """Retrieve all s3 records for the given policy output url From the given start date. """ s3 = local_session(session_factory).client('s3') records = [] key_count = 0 date = start_date.strftime('%Y/%m/%d'...
[ "def", "record_set", "(", "session_factory", ",", "bucket", ",", "key_prefix", ",", "start_date", ",", "specify_hour", "=", "False", ")", ":", "s3", "=", "local_session", "(", "session_factory", ")", ".", "client", "(", "'s3'", ")", "records", "=", "[", "]...
Retrieve all s3 records for the given policy output url From the given start date.
[ "Retrieve", "all", "s3", "records", "for", "the", "given", "policy", "output", "url" ]
python
train
globality-corp/microcosm-postgres
microcosm_postgres/store.py
https://github.com/globality-corp/microcosm-postgres/blob/43dd793b1fc9b84e4056700f350e79e0df5ff501/microcosm_postgres/store.py#L139-L149
def replace(self, identifier, new_instance): """ Create or update a model. """ try: # Note that `self.update()` ultimately calls merge, which will not enforce # a strict replacement; absent fields will default to the current values. return self.update...
[ "def", "replace", "(", "self", ",", "identifier", ",", "new_instance", ")", ":", "try", ":", "# Note that `self.update()` ultimately calls merge, which will not enforce", "# a strict replacement; absent fields will default to the current values.", "return", "self", ".", "update", ...
Create or update a model.
[ "Create", "or", "update", "a", "model", "." ]
python
train
PythonCharmers/python-future
src/future/backports/email/_header_value_parser.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/email/_header_value_parser.py#L2165-L2219
def get_mailbox_list(value): """ mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list obs-mbox-list = *([CFWS] ",") mailbox *("," [mailbox / CFWS]) For this routine we go outside the formal grammar in order to improve error handling. We recognize the end of the mailbox list only at the end of t...
[ "def", "get_mailbox_list", "(", "value", ")", ":", "mailbox_list", "=", "MailboxList", "(", ")", "while", "value", "and", "value", "[", "0", "]", "!=", "';'", ":", "try", ":", "token", ",", "value", "=", "get_mailbox", "(", "value", ")", "mailbox_list", ...
mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list obs-mbox-list = *([CFWS] ",") mailbox *("," [mailbox / CFWS]) For this routine we go outside the formal grammar in order to improve error handling. We recognize the end of the mailbox list only at the end of the value or at a ';' (the group t...
[ "mailbox", "-", "list", "=", "(", "mailbox", "*", "(", "mailbox", "))", "/", "obs", "-", "mbox", "-", "list", "obs", "-", "mbox", "-", "list", "=", "*", "(", "[", "CFWS", "]", ")", "mailbox", "*", "(", "[", "mailbox", "/", "CFWS", "]", ")" ]
python
train
envi-idl/envipyarclib
envipyarclib/system.py
https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/system.py#L20-L25
def appdata_roaming_dir(): """Returns the roaming AppData directory for the installed ArcGIS Desktop.""" install = arcpy.GetInstallInfo('desktop') app_data = arcpy.GetSystemEnvironment("APPDATA") product_dir = ''.join((install['ProductName'], major_version())) return os.path.join(app_data, 'ESRI', p...
[ "def", "appdata_roaming_dir", "(", ")", ":", "install", "=", "arcpy", ".", "GetInstallInfo", "(", "'desktop'", ")", "app_data", "=", "arcpy", ".", "GetSystemEnvironment", "(", "\"APPDATA\"", ")", "product_dir", "=", "''", ".", "join", "(", "(", "install", "[...
Returns the roaming AppData directory for the installed ArcGIS Desktop.
[ "Returns", "the", "roaming", "AppData", "directory", "for", "the", "installed", "ArcGIS", "Desktop", "." ]
python
train
saltstack/salt
salt/modules/wordpress.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/wordpress.py#L175-L225
def install(path, user, admin_user, admin_password, admin_email, title, url): ''' Run the initial setup functions for a wordpress install path path to wordpress install location user user to run the command as admin_user Username for the Administrative user for the wordpre...
[ "def", "install", "(", "path", ",", "user", ",", "admin_user", ",", "admin_password", ",", "admin_email", ",", "title", ",", "url", ")", ":", "retcode", "=", "__salt__", "[", "'cmd.retcode'", "]", "(", "(", "'wp --path={0} core install '", "'--title=\"{1}\" '", ...
Run the initial setup functions for a wordpress install path path to wordpress install location user user to run the command as admin_user Username for the Administrative user for the wordpress install admin_password Initial Password for the Administrative user for th...
[ "Run", "the", "initial", "setup", "functions", "for", "a", "wordpress", "install" ]
python
train
python-diamond/Diamond
src/diamond/server.py
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/diamond/server.py#L64-L227
def run(self): """ Load handler and collector classes and then start collectors """ ####################################################################### # Config ####################################################################### self.config = load_config(...
[ "def", "run", "(", "self", ")", ":", "#######################################################################", "# Config", "#######################################################################", "self", ".", "config", "=", "load_config", "(", "self", ".", "configfile", ")", ...
Load handler and collector classes and then start collectors
[ "Load", "handler", "and", "collector", "classes", "and", "then", "start", "collectors" ]
python
train
arista-eosplus/pyeapi
pyeapi/client.py
https://github.com/arista-eosplus/pyeapi/blob/96a74faef1fe3bd79c4e900aed29c9956a0587d6/pyeapi/client.py#L155-L181
def autoload(self): """ Loads the eapi.conf file This method will use the module variable CONFIG_SEARCH_PATH to attempt to locate a valid eapi.conf file if a filename is not already configured. This method will load the first eapi.conf file it finds and then return. T...
[ "def", "autoload", "(", "self", ")", ":", "path", "=", "list", "(", "CONFIG_SEARCH_PATH", ")", "if", "'EAPI_CONF'", "in", "os", ".", "environ", ":", "path", "=", "os", ".", "environ", "[", "'EAPI_CONF'", "]", "elif", "self", ".", "filename", ":", "path...
Loads the eapi.conf file This method will use the module variable CONFIG_SEARCH_PATH to attempt to locate a valid eapi.conf file if a filename is not already configured. This method will load the first eapi.conf file it finds and then return. The CONFIG_SEARCH_PATH can be ove...
[ "Loads", "the", "eapi", ".", "conf", "file" ]
python
train
line/line-bot-sdk-python
linebot/api.py
https://github.com/line/line-bot-sdk-python/blob/1b38bfc2497ff3e3c75be4b50e0f1b7425a07ce0/linebot/api.py#L235-L262
def get_group_member_ids(self, group_id, start=None, timeout=None): """Call get group member IDs API. https://devdocs.line.me/en/#get-group-room-member-ids Gets the user IDs of the members of a group that the bot is in. This includes the user IDs of users who have not added the bot as ...
[ "def", "get_group_member_ids", "(", "self", ",", "group_id", ",", "start", "=", "None", ",", "timeout", "=", "None", ")", ":", "params", "=", "None", "if", "start", "is", "None", "else", "{", "'start'", ":", "start", "}", "response", "=", "self", ".", ...
Call get group member IDs API. https://devdocs.line.me/en/#get-group-room-member-ids Gets the user IDs of the members of a group that the bot is in. This includes the user IDs of users who have not added the bot as a friend or has blocked the bot. :param str group_id: Group ID...
[ "Call", "get", "group", "member", "IDs", "API", "." ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L10564-L10594
def repmf(instr, marker, value, sigdig, informat, lenout=None): """ Replace a marker in a string with a formatted double precision value. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/repmf_c.html :param instr: Input string. :type instr: str :param marker: Marker to be replaced. ...
[ "def", "repmf", "(", "instr", ",", "marker", ",", "value", ",", "sigdig", ",", "informat", ",", "lenout", "=", "None", ")", ":", "if", "lenout", "is", "None", ":", "lenout", "=", "ctypes", ".", "c_int", "(", "len", "(", "instr", ")", "+", "len", ...
Replace a marker in a string with a formatted double precision value. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/repmf_c.html :param instr: Input string. :type instr: str :param marker: Marker to be replaced. :type marker: str :param value: Replacement value. :type value: floa...
[ "Replace", "a", "marker", "in", "a", "string", "with", "a", "formatted", "double", "precision", "value", "." ]
python
train
chrisjrn/registrasion
registrasion/reporting/views.py
https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/views.py#L569-L608
def attendee_list(request): ''' Returns a list of all attendees. ''' attendees = people.Attendee.objects.select_related( "attendeeprofilebase", "user", ) profiles = AttendeeProfile.objects.filter( attendee__in=attendees ).select_related( "attendee", "attendee__user"...
[ "def", "attendee_list", "(", "request", ")", ":", "attendees", "=", "people", ".", "Attendee", ".", "objects", ".", "select_related", "(", "\"attendeeprofilebase\"", ",", "\"user\"", ",", ")", "profiles", "=", "AttendeeProfile", ".", "objects", ".", "filter", ...
Returns a list of all attendees.
[ "Returns", "a", "list", "of", "all", "attendees", "." ]
python
test
portfors-lab/sparkle
sparkle/gui/abstract_drag_view.py
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/abstract_drag_view.py#L153-L168
def dropEvent(self, event): """Handles an item being dropped onto view, calls dropped -- implemented by subclass """ super(AbstractDragView, self).dropEvent(event) self.dragStartPosition = None self.dragline = None self.originalPos = None data = event.mime...
[ "def", "dropEvent", "(", "self", ",", "event", ")", ":", "super", "(", "AbstractDragView", ",", "self", ")", ".", "dropEvent", "(", "event", ")", "self", ".", "dragStartPosition", "=", "None", "self", ".", "dragline", "=", "None", "self", ".", "originalP...
Handles an item being dropped onto view, calls dropped -- implemented by subclass
[ "Handles", "an", "item", "being", "dropped", "onto", "view", "calls", "dropped", "--", "implemented", "by", "subclass" ]
python
train
sernst/cauldron
cauldron/cli/commander.py
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/cli/commander.py#L35-L61
def fetch(reload: bool = False) -> dict: """ Returns a dictionary containing all of the available Cauldron commands currently registered. This data is cached for performance. Unless the reload argument is set to True, the command list will only be generated the first time this function is called. ...
[ "def", "fetch", "(", "reload", ":", "bool", "=", "False", ")", "->", "dict", ":", "if", "len", "(", "list", "(", "COMMANDS", ".", "keys", "(", ")", ")", ")", ">", "0", "and", "not", "reload", ":", "return", "COMMANDS", "COMMANDS", ".", "clear", "...
Returns a dictionary containing all of the available Cauldron commands currently registered. This data is cached for performance. Unless the reload argument is set to True, the command list will only be generated the first time this function is called. :param reload: Whether or not to disregard...
[ "Returns", "a", "dictionary", "containing", "all", "of", "the", "available", "Cauldron", "commands", "currently", "registered", ".", "This", "data", "is", "cached", "for", "performance", ".", "Unless", "the", "reload", "argument", "is", "set", "to", "True", "t...
python
train
maas/python-libmaas
maas/client/viscera/__init__.py
https://github.com/maas/python-libmaas/blob/4092c68ef7fb1753efc843569848e2bcc3415002/maas/client/viscera/__init__.py#L96-L114
def dir_instance(inst): """Return a list of names available on `inst`. Eliminates names that bind to an `ObjectMethod` without a corresponding instance method; see `ObjectMethod`. """ # Skip instance attributes; __slots__ is automatically defined, and # descriptors are used to define attributes...
[ "def", "dir_instance", "(", "inst", ")", ":", "# Skip instance attributes; __slots__ is automatically defined, and", "# descriptors are used to define attributes. Instead, go straight to class", "# attributes (including methods).", "for", "name", ",", "value", "in", "vars_class", "(", ...
Return a list of names available on `inst`. Eliminates names that bind to an `ObjectMethod` without a corresponding instance method; see `ObjectMethod`.
[ "Return", "a", "list", "of", "names", "available", "on", "inst", "." ]
python
train
MillionIntegrals/vel
vel/rl/buffers/backend/circular_vec_buffer_backend.py
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/rl/buffers/backend/circular_vec_buffer_backend.py#L207-L242
def get_transitions(self, indexes): """ Get dictionary of transition data """ assert indexes.shape[1] == self.state_buffer.shape[1], \ "Must have the same number of indexes as there are environments" frame_batch_shape = ( [indexes.shape[0], indexes.shape[1]] ...
[ "def", "get_transitions", "(", "self", ",", "indexes", ")", ":", "assert", "indexes", ".", "shape", "[", "1", "]", "==", "self", ".", "state_buffer", ".", "shape", "[", "1", "]", ",", "\"Must have the same number of indexes as there are environments\"", "frame_bat...
Get dictionary of transition data
[ "Get", "dictionary", "of", "transition", "data" ]
python
train
mwouts/jupytext
jupytext/pandoc.py
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pandoc.py#L44-L50
def pandoc_version(): """Pandoc's version number""" version = pandoc(u'--version').splitlines()[0].split()[1] if parse_version(version) < parse_version('2.7.2'): raise PandocError('Please install pandoc>=2.7.2 (found version {})'.format(version)) return version
[ "def", "pandoc_version", "(", ")", ":", "version", "=", "pandoc", "(", "u'--version'", ")", ".", "splitlines", "(", ")", "[", "0", "]", ".", "split", "(", ")", "[", "1", "]", "if", "parse_version", "(", "version", ")", "<", "parse_version", "(", "'2....
Pandoc's version number
[ "Pandoc", "s", "version", "number" ]
python
train
O365/python-o365
O365/utils/token.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/token.py#L211-L221
def delete_token(self): """ Deletes the token from the store :return bool: Success / Failure """ try: self.doc_ref.delete() except Exception as e: log.error('Could not delete the token (key: {}): {}'.format(self.doc_id, str(e))) return ...
[ "def", "delete_token", "(", "self", ")", ":", "try", ":", "self", ".", "doc_ref", ".", "delete", "(", ")", "except", "Exception", "as", "e", ":", "log", ".", "error", "(", "'Could not delete the token (key: {}): {}'", ".", "format", "(", "self", ".", "doc_...
Deletes the token from the store :return bool: Success / Failure
[ "Deletes", "the", "token", "from", "the", "store", ":", "return", "bool", ":", "Success", "/", "Failure" ]
python
train
spyder-ide/spyder
spyder/plugins/editor/panels/codefolding.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/codefolding.py#L563-L579
def refresh_decorations(self, force=False): """ Refresh decorations colors. This function is called by the syntax highlighter when the style changed so that we may update our decorations colors according to the new style. """ cursor = self.editor.textCursor() if (...
[ "def", "refresh_decorations", "(", "self", ",", "force", "=", "False", ")", ":", "cursor", "=", "self", ".", "editor", ".", "textCursor", "(", ")", "if", "(", "self", ".", "_prev_cursor", "is", "None", "or", "force", "or", "self", ".", "_prev_cursor", ...
Refresh decorations colors. This function is called by the syntax highlighter when the style changed so that we may update our decorations colors according to the new style.
[ "Refresh", "decorations", "colors", ".", "This", "function", "is", "called", "by", "the", "syntax", "highlighter", "when", "the", "style", "changed", "so", "that", "we", "may", "update", "our", "decorations", "colors", "according", "to", "the", "new", "style",...
python
train
futapi/fut
fut/core.py
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1536-L1542
def packs(self): """List all (currently?) available packs.""" method = 'GET' url = 'store/purchaseGroup/cardpack' params = {'ppInfo': True} return self.__request__(method, url, params=params)
[ "def", "packs", "(", "self", ")", ":", "method", "=", "'GET'", "url", "=", "'store/purchaseGroup/cardpack'", "params", "=", "{", "'ppInfo'", ":", "True", "}", "return", "self", ".", "__request__", "(", "method", ",", "url", ",", "params", "=", "params", ...
List all (currently?) available packs.
[ "List", "all", "(", "currently?", ")", "available", "packs", "." ]
python
valid
python-openxml/python-docx
docx/styles/latent.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/latent.py#L40-L48
def add_latent_style(self, name): """ Return a newly added |_LatentStyle| object to override the inherited defaults defined in this latent styles object for the built-in style having *name*. """ lsdException = self._element.add_lsdException() lsdException.name = B...
[ "def", "add_latent_style", "(", "self", ",", "name", ")", ":", "lsdException", "=", "self", ".", "_element", ".", "add_lsdException", "(", ")", "lsdException", ".", "name", "=", "BabelFish", ".", "ui2internal", "(", "name", ")", "return", "_LatentStyle", "("...
Return a newly added |_LatentStyle| object to override the inherited defaults defined in this latent styles object for the built-in style having *name*.
[ "Return", "a", "newly", "added", "|_LatentStyle|", "object", "to", "override", "the", "inherited", "defaults", "defined", "in", "this", "latent", "styles", "object", "for", "the", "built", "-", "in", "style", "having", "*", "name", "*", "." ]
python
train
google/grr
grr/server/grr_response_server/flow_base.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L496-L510
def Log(self, format_str, *args): """Logs the message using the flow's standard logging. Args: format_str: Format string *args: arguments to the format string """ log_entry = rdf_flow_objects.FlowLogEntry( client_id=self.rdf_flow.client_id, flow_id=self.rdf_flow.flow_id, ...
[ "def", "Log", "(", "self", ",", "format_str", ",", "*", "args", ")", ":", "log_entry", "=", "rdf_flow_objects", ".", "FlowLogEntry", "(", "client_id", "=", "self", ".", "rdf_flow", ".", "client_id", ",", "flow_id", "=", "self", ".", "rdf_flow", ".", "flo...
Logs the message using the flow's standard logging. Args: format_str: Format string *args: arguments to the format string
[ "Logs", "the", "message", "using", "the", "flow", "s", "standard", "logging", "." ]
python
train
inveniosoftware/invenio-oauthclient
invenio_oauthclient/models.py
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/models.py#L166-L188
def get(cls, user_id, client_id, token_type='', access_token=None): """Get RemoteToken for user. :param user_id: The user id. :param client_id: The client id. :param token_type: The token type. (Default: ``''``) :param access_token: If set, will filter also by access token. ...
[ "def", "get", "(", "cls", ",", "user_id", ",", "client_id", ",", "token_type", "=", "''", ",", "access_token", "=", "None", ")", ":", "args", "=", "[", "RemoteAccount", ".", "id", "==", "RemoteToken", ".", "id_remote_account", ",", "RemoteAccount", ".", ...
Get RemoteToken for user. :param user_id: The user id. :param client_id: The client id. :param token_type: The token type. (Default: ``''``) :param access_token: If set, will filter also by access token. (Default: ``None``) :returns: A :class:`invenio_oauthclient.mod...
[ "Get", "RemoteToken", "for", "user", "." ]
python
train
saltstack/salt
salt/transport/ipc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/ipc.py#L216-L226
def close(self): ''' Routines to handle any cleanup before the instance shuts down. Sockets and filehandles should be closed explicitly, to prevent leaks. ''' if self._closing: return self._closing = True if hasattr(self.sock, 'close'): ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_closing", ":", "return", "self", ".", "_closing", "=", "True", "if", "hasattr", "(", "self", ".", "sock", ",", "'close'", ")", ":", "self", ".", "sock", ".", "close", "(", ")" ]
Routines to handle any cleanup before the instance shuts down. Sockets and filehandles should be closed explicitly, to prevent leaks.
[ "Routines", "to", "handle", "any", "cleanup", "before", "the", "instance", "shuts", "down", ".", "Sockets", "and", "filehandles", "should", "be", "closed", "explicitly", "to", "prevent", "leaks", "." ]
python
train
brechtm/rinohtype
src/rinoh/backend/pdf/xobject/purepng.py
https://github.com/brechtm/rinohtype/blob/40a63c4e5ad7550f62b6860f1812cb67cafb9dc7/src/rinoh/backend/pdf/xobject/purepng.py#L2071-L2077
def read(self, n): """Read `n` chars from buffer""" r = self.buf[self.offset:self.offset + n] if isinstance(r, array): r = r.tostring() self.offset += n return r
[ "def", "read", "(", "self", ",", "n", ")", ":", "r", "=", "self", ".", "buf", "[", "self", ".", "offset", ":", "self", ".", "offset", "+", "n", "]", "if", "isinstance", "(", "r", ",", "array", ")", ":", "r", "=", "r", ".", "tostring", "(", ...
Read `n` chars from buffer
[ "Read", "n", "chars", "from", "buffer" ]
python
train
facetoe/zenpy
zenpy/lib/api_objects/chat_objects.py
https://github.com/facetoe/zenpy/blob/34c54c7e408b9ed01604ddf8b3422204c8bf31ea/zenpy/lib/api_objects/chat_objects.py#L435-L440
def zendesk_ticket(self): """ | Description: The ID of the Zendesk Support ticket created from this chat. Available only if using version 2 of the Zendesk Chat-Support integration """ if self.api and self.zendesk_ticket_id: return self.api._get_zendesk_ticket(self.zendesk_ti...
[ "def", "zendesk_ticket", "(", "self", ")", ":", "if", "self", ".", "api", "and", "self", ".", "zendesk_ticket_id", ":", "return", "self", ".", "api", ".", "_get_zendesk_ticket", "(", "self", ".", "zendesk_ticket_id", ")" ]
| Description: The ID of the Zendesk Support ticket created from this chat. Available only if using version 2 of the Zendesk Chat-Support integration
[ "|", "Description", ":", "The", "ID", "of", "the", "Zendesk", "Support", "ticket", "created", "from", "this", "chat", ".", "Available", "only", "if", "using", "version", "2", "of", "the", "Zendesk", "Chat", "-", "Support", "integration" ]
python
train
ejeschke/ginga
ginga/util/wcs.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/util/wcs.py#L553-L556
def deltaStarsRaDecDeg1(ra1_deg, dec1_deg, ra2_deg, dec2_deg): """Spherical triangulation.""" phi, dist = dispos(ra1_deg, dec1_deg, ra2_deg, dec2_deg) return arcsecToDeg(dist * 60.0)
[ "def", "deltaStarsRaDecDeg1", "(", "ra1_deg", ",", "dec1_deg", ",", "ra2_deg", ",", "dec2_deg", ")", ":", "phi", ",", "dist", "=", "dispos", "(", "ra1_deg", ",", "dec1_deg", ",", "ra2_deg", ",", "dec2_deg", ")", "return", "arcsecToDeg", "(", "dist", "*", ...
Spherical triangulation.
[ "Spherical", "triangulation", "." ]
python
train
saltstack/salt
salt/spm/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L886-L892
def _verbose(self, msg, level=log.debug): ''' Display verbose information ''' if self.opts.get('verbose', False) is True: self.ui.status(msg) level(msg)
[ "def", "_verbose", "(", "self", ",", "msg", ",", "level", "=", "log", ".", "debug", ")", ":", "if", "self", ".", "opts", ".", "get", "(", "'verbose'", ",", "False", ")", "is", "True", ":", "self", ".", "ui", ".", "status", "(", "msg", ")", "lev...
Display verbose information
[ "Display", "verbose", "information" ]
python
train
materialsproject/pymatgen
pymatgen/core/tensors.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L917-L922
def get_uvec(vec): """ Gets a unit vector parallel to input vector""" l = np.linalg.norm(vec) if l < 1e-8: return vec return vec / l
[ "def", "get_uvec", "(", "vec", ")", ":", "l", "=", "np", ".", "linalg", ".", "norm", "(", "vec", ")", "if", "l", "<", "1e-8", ":", "return", "vec", "return", "vec", "/", "l" ]
Gets a unit vector parallel to input vector
[ "Gets", "a", "unit", "vector", "parallel", "to", "input", "vector" ]
python
train
wiheto/teneto
teneto/classes/bids.py
https://github.com/wiheto/teneto/blob/80d7a83a9adc1714589b020627c45bd5b66248ab/teneto/classes/bids.py#L360-L398
def make_functional_connectivity(self, njobs=None, returngroup=False, file_hdr=None, file_idx=None): """ Makes connectivity matrix for each of the subjects. Parameters ---------- returngroup : bool, default=False If true, returns the group average connectivity matrix...
[ "def", "make_functional_connectivity", "(", "self", ",", "njobs", "=", "None", ",", "returngroup", "=", "False", ",", "file_hdr", "=", "None", ",", "file_idx", "=", "None", ")", ":", "if", "not", "njobs", ":", "njobs", "=", "self", ".", "njobs", "self", ...
Makes connectivity matrix for each of the subjects. Parameters ---------- returngroup : bool, default=False If true, returns the group average connectivity matrix. njobs : int How many parallel jobs to run file_idx : bool Default False, true i...
[ "Makes", "connectivity", "matrix", "for", "each", "of", "the", "subjects", "." ]
python
train
abiiranathan/db2
db2/session.py
https://github.com/abiiranathan/db2/blob/347319e421921517bcae7639f524c3c3eb5446e6/db2/session.py#L297-L304
def exists(self, model_class, ID): '''Check if a record of id==ID exists in table model_class.__name__.lower()''' assert hasattr(model_class, '_fields'), 'Not a valid model class' res = self.get(model_class, id=ID, fetchOne=True) if res: return True return False
[ "def", "exists", "(", "self", ",", "model_class", ",", "ID", ")", ":", "assert", "hasattr", "(", "model_class", ",", "'_fields'", ")", ",", "'Not a valid model class'", "res", "=", "self", ".", "get", "(", "model_class", ",", "id", "=", "ID", ",", "fetch...
Check if a record of id==ID exists in table model_class.__name__.lower()
[ "Check", "if", "a", "record", "of", "id", "==", "ID", "exists", "in", "table", "model_class", ".", "__name__", ".", "lower", "()" ]
python
train
gwpy/gwpy
gwpy/timeseries/timeseries.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/timeseries/timeseries.py#L447-L499
def spectrogram2(self, fftlength, overlap=None, window='hann', **kwargs): """Calculate the non-averaged power `Spectrogram` of this `TimeSeries` Parameters ---------- fftlength : `float` number of seconds in single FFT. overlap : `float`, optional number...
[ "def", "spectrogram2", "(", "self", ",", "fftlength", ",", "overlap", "=", "None", ",", "window", "=", "'hann'", ",", "*", "*", "kwargs", ")", ":", "# set kwargs for periodogram()", "kwargs", ".", "setdefault", "(", "'fs'", ",", "self", ".", "sample_rate", ...
Calculate the non-averaged power `Spectrogram` of this `TimeSeries` Parameters ---------- fftlength : `float` number of seconds in single FFT. overlap : `float`, optional number of seconds of overlap between FFTs, defaults to the recommended overlap ...
[ "Calculate", "the", "non", "-", "averaged", "power", "Spectrogram", "of", "this", "TimeSeries" ]
python
train
gwastro/pycbc
pycbc/conversions.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/conversions.py#L443-L447
def phi_s(spin1x, spin1y, spin2x, spin2y): """ Returns the sum of the in-plane perpendicular spins.""" phi1 = phi_from_spinx_spiny(spin1x, spin1y) phi2 = phi_from_spinx_spiny(spin2x, spin2y) return (phi1 + phi2) % (2 * numpy.pi)
[ "def", "phi_s", "(", "spin1x", ",", "spin1y", ",", "spin2x", ",", "spin2y", ")", ":", "phi1", "=", "phi_from_spinx_spiny", "(", "spin1x", ",", "spin1y", ")", "phi2", "=", "phi_from_spinx_spiny", "(", "spin2x", ",", "spin2y", ")", "return", "(", "phi1", "...
Returns the sum of the in-plane perpendicular spins.
[ "Returns", "the", "sum", "of", "the", "in", "-", "plane", "perpendicular", "spins", "." ]
python
train
sananth12/ImageScraper
image_scraper/utils.py
https://github.com/sananth12/ImageScraper/blob/04cdefaa184420637d02b5a285cf407bbd428929/image_scraper/utils.py#L138-L167
def get_img_list(self): """ Gets list of images from the page_html. """ tree = html.fromstring(self.page_html) img = tree.xpath('//img/@src') links = tree.xpath('//a/@href') img_list = self.process_links(img) img_links = self.process_links(links) img_list.extend(i...
[ "def", "get_img_list", "(", "self", ")", ":", "tree", "=", "html", ".", "fromstring", "(", "self", ".", "page_html", ")", "img", "=", "tree", ".", "xpath", "(", "'//img/@src'", ")", "links", "=", "tree", ".", "xpath", "(", "'//a/@href'", ")", "img_list...
Gets list of images from the page_html.
[ "Gets", "list", "of", "images", "from", "the", "page_html", "." ]
python
train
istresearch/scrapy-cluster
utils/scutils/zookeeper_watcher.py
https://github.com/istresearch/scrapy-cluster/blob/13aaed2349af5d792d6bcbfcadc5563158aeb599/utils/scutils/zookeeper_watcher.py#L133-L146
def state_listener(self, state): ''' Restarts the session if we get anything besides CONNECTED ''' if state == KazooState.SUSPENDED: self.set_valid(False) self.call_error(self.BAD_CONNECTION) elif state == KazooState.LOST and not self.do_not_restart: ...
[ "def", "state_listener", "(", "self", ",", "state", ")", ":", "if", "state", "==", "KazooState", ".", "SUSPENDED", ":", "self", ".", "set_valid", "(", "False", ")", "self", ".", "call_error", "(", "self", ".", "BAD_CONNECTION", ")", "elif", "state", "=="...
Restarts the session if we get anything besides CONNECTED
[ "Restarts", "the", "session", "if", "we", "get", "anything", "besides", "CONNECTED" ]
python
train
guaix-ucm/numina
numina/store/gtc/load.py
https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/store/gtc/load.py#L20-L59
def process_node(node): """Process a node in result.json structure""" value = node['value'] mname = node['name'] typeid = node['typeid'] if typeid == 52: # StructDataValue obj = {} for el in value['elements']: key, val = process_node(el) obj[key] = val ...
[ "def", "process_node", "(", "node", ")", ":", "value", "=", "node", "[", "'value'", "]", "mname", "=", "node", "[", "'name'", "]", "typeid", "=", "node", "[", "'typeid'", "]", "if", "typeid", "==", "52", ":", "# StructDataValue", "obj", "=", "{", "}"...
Process a node in result.json structure
[ "Process", "a", "node", "in", "result", ".", "json", "structure" ]
python
train
leonardt/fault
fault/utils.py
https://github.com/leonardt/fault/blob/da1b48ab727bd85abc54ae9b52841d08188c0df5/fault/utils.py#L7-L67
def get_short_lambda_body_text(lambda_func): """Return the source of a (short) lambda function. If it's impossible to obtain, returns None. """ try: source_lines, _ = inspect.getsourcelines(lambda_func) except (IOError, TypeError): return None # skip `def`-ed functions and long ...
[ "def", "get_short_lambda_body_text", "(", "lambda_func", ")", ":", "try", ":", "source_lines", ",", "_", "=", "inspect", ".", "getsourcelines", "(", "lambda_func", ")", "except", "(", "IOError", ",", "TypeError", ")", ":", "return", "None", "# skip `def`-ed func...
Return the source of a (short) lambda function. If it's impossible to obtain, returns None.
[ "Return", "the", "source", "of", "a", "(", "short", ")", "lambda", "function", ".", "If", "it", "s", "impossible", "to", "obtain", "returns", "None", "." ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1025-L1029
def bk_dark(cls): "Make the current background color dark." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
[ "def", "bk_dark", "(", "cls", ")", ":", "wAttributes", "=", "cls", ".", "_get_text_attributes", "(", ")", "wAttributes", "&=", "~", "win32", ".", "BACKGROUND_INTENSITY", "cls", ".", "_set_text_attributes", "(", "wAttributes", ")" ]
Make the current background color dark.
[ "Make", "the", "current", "background", "color", "dark", "." ]
python
train
quantumlib/Cirq
cirq/experiments/google_v2_supremacy_circuit.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/experiments/google_v2_supremacy_circuit.py#L109-L149
def generate_supremacy_circuit_google_v2_bristlecone(n_rows: int, cz_depth: int, seed: int ) -> circuits.Circuit: """ Generates Google Random Circuits v2 in Bristlecone. See also https://arxiv.org/abs/1...
[ "def", "generate_supremacy_circuit_google_v2_bristlecone", "(", "n_rows", ":", "int", ",", "cz_depth", ":", "int", ",", "seed", ":", "int", ")", "->", "circuits", ".", "Circuit", ":", "def", "get_qubits", "(", "n_rows", ")", ":", "def", "count_neighbors", "(",...
Generates Google Random Circuits v2 in Bristlecone. See also https://arxiv.org/abs/1807.10749 Args: n_rows: number of rows in a Bristlecone lattice. Note that we do not include single qubit corners. cz_depth: number of layers with CZ gates. seed: seed for the random instance. ...
[ "Generates", "Google", "Random", "Circuits", "v2", "in", "Bristlecone", ".", "See", "also", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1807", ".", "10749" ]
python
train
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/action_plugins/template.py
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/action_plugins/template.py#L29-L80
def run(self, conn, tmp, module_name, module_args, inject): ''' handler for template operations ''' if not self.runner.is_playbook: raise errors.AnsibleError("in current versions of ansible, templates are only usable in playbooks") # load up options options = utils.parse_k...
[ "def", "run", "(", "self", ",", "conn", ",", "tmp", ",", "module_name", ",", "module_args", ",", "inject", ")", ":", "if", "not", "self", ".", "runner", ".", "is_playbook", ":", "raise", "errors", ".", "AnsibleError", "(", "\"in current versions of ansible, ...
handler for template operations
[ "handler", "for", "template", "operations" ]
python
train
iterative/dvc
dvc/command/run.py
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/command/run.py#L61-L74
def _parsed_cmd(self): """ We need to take into account two cases: - ['python code.py foo bar']: Used mainly with dvc as a library - ['echo', 'foo bar']: List of arguments received from the CLI The second case would need quoting, as it was passed through: dvc ru...
[ "def", "_parsed_cmd", "(", "self", ")", ":", "if", "len", "(", "self", ".", "args", ".", "command", ")", "<", "2", ":", "return", "\" \"", ".", "join", "(", "self", ".", "args", ".", "command", ")", "return", "\" \"", ".", "join", "(", "self", "....
We need to take into account two cases: - ['python code.py foo bar']: Used mainly with dvc as a library - ['echo', 'foo bar']: List of arguments received from the CLI The second case would need quoting, as it was passed through: dvc run echo "foo bar"
[ "We", "need", "to", "take", "into", "account", "two", "cases", ":" ]
python
train