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
DLR-RM/RAFCON
source/rafcon/gui/views/graphical_editor.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/views/graphical_editor.py#L250-L281
def _configure(self, *args): """Configure viewport This method is called when the widget is resized or something triggers a redraw. The method configures the view to show all elements in an orthogonal perspective. """ # Obtain a reference to the OpenGL drawable # and ren...
[ "def", "_configure", "(", "self", ",", "*", "args", ")", ":", "# Obtain a reference to the OpenGL drawable", "# and rendering context.", "gldrawable", "=", "self", ".", "get_gl_drawable", "(", ")", "glcontext", "=", "self", ".", "get_gl_context", "(", ")", "# logger...
Configure viewport This method is called when the widget is resized or something triggers a redraw. The method configures the view to show all elements in an orthogonal perspective.
[ "Configure", "viewport" ]
python
train
defunkt/pystache
setup.py
https://github.com/defunkt/pystache/blob/17a5dfdcd56eb76af731d141de395a7632a905b8/setup.py#L248-L279
def make_long_description(): """ Generate the reST long_description for setup() from source files. Returns the generated long_description as a unicode string. """ readme_path = README_PATH # Remove our HTML comments because PyPI does not allow it. # See the setup.py docstring for more inf...
[ "def", "make_long_description", "(", ")", ":", "readme_path", "=", "README_PATH", "# Remove our HTML comments because PyPI does not allow it.", "# See the setup.py docstring for more info on this.", "readme_md", "=", "strip_html_comments", "(", "read", "(", "readme_path", ")", ")...
Generate the reST long_description for setup() from source files. Returns the generated long_description as a unicode string.
[ "Generate", "the", "reST", "long_description", "for", "setup", "()", "from", "source", "files", "." ]
python
train
lsst-sqre/lsst-projectmeta-kit
lsstprojectmeta/jsonld.py
https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/jsonld.py#L34-L44
def default(self, obj): """Encode values as JSON strings. This method overrides the default implementation from `json.JSONEncoder`. """ if isinstance(obj, datetime.datetime): return self._encode_datetime(obj) # Fallback to the default encoding return...
[ "def", "default", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "datetime", ".", "datetime", ")", ":", "return", "self", ".", "_encode_datetime", "(", "obj", ")", "# Fallback to the default encoding", "return", "json", ".", "JSONEnc...
Encode values as JSON strings. This method overrides the default implementation from `json.JSONEncoder`.
[ "Encode", "values", "as", "JSON", "strings", "." ]
python
valid
LionelAuroux/pyrser
pyrser/type_system/scope.py
https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L206-L210
def intersection(self, sig: Scope) -> Scope: """ Create a new Set produce by the intersection of 2 Set """ new = Scope(sig=self._hsig.values(), state=self.state) new &= sig return new
[ "def", "intersection", "(", "self", ",", "sig", ":", "Scope", ")", "->", "Scope", ":", "new", "=", "Scope", "(", "sig", "=", "self", ".", "_hsig", ".", "values", "(", ")", ",", "state", "=", "self", ".", "state", ")", "new", "&=", "sig", "return"...
Create a new Set produce by the intersection of 2 Set
[ "Create", "a", "new", "Set", "produce", "by", "the", "intersection", "of", "2", "Set" ]
python
test
spyder-ide/spyder
spyder/plugins/console/widgets/shell.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/shell.py#L790-L797
def _key_period(self, text): """Action for '.'""" self.insert_text(text) if self.codecompletion_auto: # Enable auto-completion only if last token isn't a float last_obj = self.get_last_obj() if last_obj and not last_obj.isdigit(): self.s...
[ "def", "_key_period", "(", "self", ",", "text", ")", ":", "self", ".", "insert_text", "(", "text", ")", "if", "self", ".", "codecompletion_auto", ":", "# Enable auto-completion only if last token isn't a float\r", "last_obj", "=", "self", ".", "get_last_obj", "(", ...
Action for '.
[ "Action", "for", "." ]
python
train
Kozea/pygal
pygal/graph/public.py
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/graph/public.py#L150-L169
def render_sparkline(self, **kwargs): """Render a sparkline""" spark_options = dict( width=200, height=50, show_dots=False, show_legend=False, show_x_labels=False, show_y_labels=False, spacing=0, margin=5, ...
[ "def", "render_sparkline", "(", "self", ",", "*", "*", "kwargs", ")", ":", "spark_options", "=", "dict", "(", "width", "=", "200", ",", "height", "=", "50", ",", "show_dots", "=", "False", ",", "show_legend", "=", "False", ",", "show_x_labels", "=", "F...
Render a sparkline
[ "Render", "a", "sparkline" ]
python
train
ga4gh/ga4gh-server
ga4gh/server/datarepo.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datarepo.py#L1251-L1269
def insertIndividual(self, individual): """ Inserts the specified individual into this repository. """ try: models.Individual.create( id=individual.getId(), datasetId=individual.getParentContainer().getId(), name=individual.getL...
[ "def", "insertIndividual", "(", "self", ",", "individual", ")", ":", "try", ":", "models", ".", "Individual", ".", "create", "(", "id", "=", "individual", ".", "getId", "(", ")", ",", "datasetId", "=", "individual", ".", "getParentContainer", "(", ")", "...
Inserts the specified individual into this repository.
[ "Inserts", "the", "specified", "individual", "into", "this", "repository", "." ]
python
train
gmr/tredis
tredis/client.py
https://github.com/gmr/tredis/blob/2e91c6a58a35460be0525c51ac6a98fde3b506ad/tredis/client.py#L510-L517
def _on_closed(self): """Invoked by connections when they are closed.""" self._connected.clear() if not self._closing: if self._on_close_callback: self._on_close_callback() else: raise exceptions.ConnectionError('closed')
[ "def", "_on_closed", "(", "self", ")", ":", "self", ".", "_connected", ".", "clear", "(", ")", "if", "not", "self", ".", "_closing", ":", "if", "self", ".", "_on_close_callback", ":", "self", ".", "_on_close_callback", "(", ")", "else", ":", "raise", "...
Invoked by connections when they are closed.
[ "Invoked", "by", "connections", "when", "they", "are", "closed", "." ]
python
train
Erotemic/utool
utool/util_dict.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_dict.py#L553-L560
def iter_all_dict_combinations_ordered(varied_dict): """ Same as all_dict_combinations but preserves order """ tups_list = [[(key, val) for val in val_list] for (key, val_list) in six.iteritems(varied_dict)] dict_iter = (OrderedDict(tups) for tups in it.product(*tups_list)) retu...
[ "def", "iter_all_dict_combinations_ordered", "(", "varied_dict", ")", ":", "tups_list", "=", "[", "[", "(", "key", ",", "val", ")", "for", "val", "in", "val_list", "]", "for", "(", "key", ",", "val_list", ")", "in", "six", ".", "iteritems", "(", "varied_...
Same as all_dict_combinations but preserves order
[ "Same", "as", "all_dict_combinations", "but", "preserves", "order" ]
python
train
PaulHancock/Aegean
AegeanTools/cluster.py
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L138-L206
def regroup_vectorized(srccat, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Assumes srccat is recarray-like for efficiency. Return a list of island groups. Parameters ---------- srccat : np.rec.arry or pd.DataFrame Sho...
[ "def", "regroup_vectorized", "(", "srccat", ",", "eps", ",", "far", "=", "None", ",", "dist", "=", "norm_dist", ")", ":", "if", "far", "is", "None", ":", "far", "=", "0.5", "# 10*max(a.a/3600 for a in srccat)", "# most negative declination first", "# XXX: kind='me...
Regroup the islands of a catalog according to their normalised distance. Assumes srccat is recarray-like for efficiency. Return a list of island groups. Parameters ---------- srccat : np.rec.arry or pd.DataFrame Should have the following fields[units]: ra[deg],dec[deg], a[arcsec],b...
[ "Regroup", "the", "islands", "of", "a", "catalog", "according", "to", "their", "normalised", "distance", "." ]
python
train
aws/aws-encryption-sdk-python
src/aws_encryption_sdk/internal/crypto/encryption.py
https://github.com/aws/aws-encryption-sdk-python/blob/d182155d5fb1ef176d9e7d0647679737d5146495/src/aws_encryption_sdk/internal/crypto/encryption.py#L135-L151
def decrypt(algorithm, key, encrypted_data, associated_data): """Decrypts a frame body. :param algorithm: Algorithm used to encrypt this body :type algorithm: aws_encryption_sdk.identifiers.Algorithm :param bytes key: Plaintext data key :param encrypted_data: EncryptedData containing body data ...
[ "def", "decrypt", "(", "algorithm", ",", "key", ",", "encrypted_data", ",", "associated_data", ")", ":", "decryptor", "=", "Decryptor", "(", "algorithm", ",", "key", ",", "associated_data", ",", "encrypted_data", ".", "iv", ",", "encrypted_data", ".", "tag", ...
Decrypts a frame body. :param algorithm: Algorithm used to encrypt this body :type algorithm: aws_encryption_sdk.identifiers.Algorithm :param bytes key: Plaintext data key :param encrypted_data: EncryptedData containing body data :type encrypted_data: :class:`aws_encryption_sdk.internal.structures....
[ "Decrypts", "a", "frame", "body", "." ]
python
train
AtteqCom/zsl
src/zsl/resource/json_server_resource.py
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/resource/json_server_resource.py#L188-L231
def read(self, params, args, data): """Modifies the parameters and adds metadata for read results.""" result_count = None result_links = None if params is None: params = [] if args: args = args.copy() else: args = {} ctx = sel...
[ "def", "read", "(", "self", ",", "params", ",", "args", ",", "data", ")", ":", "result_count", "=", "None", "result_links", "=", "None", "if", "params", "is", "None", ":", "params", "=", "[", "]", "if", "args", ":", "args", "=", "args", ".", "copy"...
Modifies the parameters and adds metadata for read results.
[ "Modifies", "the", "parameters", "and", "adds", "metadata", "for", "read", "results", "." ]
python
train
wesyoung/pyzyre
czmq/_czmq_ctypes.py
https://github.com/wesyoung/pyzyre/blob/22d4c757acefcfdb700d3802adaf30b402bb9eea/czmq/_czmq_ctypes.py#L2817-L2823
def update(self, key, item): """ Update item into hash table with specified key and item. If key is already present, destroys old item and inserts new one. Use free_fn method to ensure deallocator is properly called on item. """ return lib.zhash_update(self._as_parameter_, key, item)
[ "def", "update", "(", "self", ",", "key", ",", "item", ")", ":", "return", "lib", ".", "zhash_update", "(", "self", ".", "_as_parameter_", ",", "key", ",", "item", ")" ]
Update item into hash table with specified key and item. If key is already present, destroys old item and inserts new one. Use free_fn method to ensure deallocator is properly called on item.
[ "Update", "item", "into", "hash", "table", "with", "specified", "key", "and", "item", ".", "If", "key", "is", "already", "present", "destroys", "old", "item", "and", "inserts", "new", "one", ".", "Use", "free_fn", "method", "to", "ensure", "deallocator", "...
python
train
authomatic/authomatic
authomatic/core.py
https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/core.py#L879-L928
def deserialize(cls, config, credentials): """ A *class method* which reconstructs credentials created by :meth:`serialize`. You can also pass it a :class:`.Credentials` instance. :param dict config: The same :doc:`config` used in the :func:`.login` to get the ...
[ "def", "deserialize", "(", "cls", ",", "config", ",", "credentials", ")", ":", "# Accept both serialized and normal.", "if", "isinstance", "(", "credentials", ",", "Credentials", ")", ":", "return", "credentials", "decoded", "=", "parse", ".", "unquote", "(", "c...
A *class method* which reconstructs credentials created by :meth:`serialize`. You can also pass it a :class:`.Credentials` instance. :param dict config: The same :doc:`config` used in the :func:`.login` to get the credentials. :param str credentials: ...
[ "A", "*", "class", "method", "*", "which", "reconstructs", "credentials", "created", "by", ":", "meth", ":", "serialize", ".", "You", "can", "also", "pass", "it", "a", ":", "class", ":", ".", "Credentials", "instance", "." ]
python
test
gmr/tinman
tinman/session.py
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/session.py#L273-L282
def save(self): """Store the session data in redis :param method callback: The callback method to invoke when done """ result = yield gen.Task(RedisSession._redis_client.set, self._key, self.dumps()) LOGGER.debug('Saved session %s (%r)', self.id,...
[ "def", "save", "(", "self", ")", ":", "result", "=", "yield", "gen", ".", "Task", "(", "RedisSession", ".", "_redis_client", ".", "set", ",", "self", ".", "_key", ",", "self", ".", "dumps", "(", ")", ")", "LOGGER", ".", "debug", "(", "'Saved session ...
Store the session data in redis :param method callback: The callback method to invoke when done
[ "Store", "the", "session", "data", "in", "redis" ]
python
train
CalebBell/thermo
thermo/critical.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/critical.py#L1009-L1071
def Meissner(Tc=None, Pc=None, Vc=None): r'''Old (1942) relationship for estimating critical properties from each other. Two of the three properties are required. This model uses the "critical surface", a general plot of Tc vs Pc vs Vc. The model used 42 organic and inorganic compounds to derive the equ...
[ "def", "Meissner", "(", "Tc", "=", "None", ",", "Pc", "=", "None", ",", "Vc", "=", "None", ")", ":", "if", "Tc", "and", "Vc", ":", "Vc", "=", "Vc", "*", "1E6", "Pc", "=", "20.8", "*", "Tc", "/", "(", "Vc", "-", "8", ")", "Pc", "=", "10132...
r'''Old (1942) relationship for estimating critical properties from each other. Two of the three properties are required. This model uses the "critical surface", a general plot of Tc vs Pc vs Vc. The model used 42 organic and inorganic compounds to derive the equation. The general equation is in [1]_: ...
[ "r", "Old", "(", "1942", ")", "relationship", "for", "estimating", "critical", "properties", "from", "each", "other", ".", "Two", "of", "the", "three", "properties", "are", "required", ".", "This", "model", "uses", "the", "critical", "surface", "a", "general...
python
valid
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3350-L3369
def fm_discriminator(Signal): """ Calculates the digital FM discriminator from a real-valued time signal. Parameters ---------- Signal : array-like A real-valued time signal Returns ------- fmDiscriminator : array-like The digital FM discriminator of the argument signal...
[ "def", "fm_discriminator", "(", "Signal", ")", ":", "S_analytic", "=", "_hilbert", "(", "Signal", ")", "S_analytic_star", "=", "_GetComplexConjugateArray", "(", "S_analytic", ")", "S_analytic_hat", "=", "S_analytic", "[", "1", ":", "]", "*", "S_analytic_star", "...
Calculates the digital FM discriminator from a real-valued time signal. Parameters ---------- Signal : array-like A real-valued time signal Returns ------- fmDiscriminator : array-like The digital FM discriminator of the argument signal
[ "Calculates", "the", "digital", "FM", "discriminator", "from", "a", "real", "-", "valued", "time", "signal", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17s_1_02/rbridge_id/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/rbridge_id/__init__.py#L572-L593
def _set_threshold_monitor(self, v, load=False): """ Setter method for threshold_monitor, mapped from YANG variable /rbridge_id/threshold_monitor (container) If this variable is read-only (config: false) in the source YANG file, then _set_threshold_monitor is considered as a private method. Backends...
[ "def", "_set_threshold_monitor", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",",...
Setter method for threshold_monitor, mapped from YANG variable /rbridge_id/threshold_monitor (container) If this variable is read-only (config: false) in the source YANG file, then _set_threshold_monitor is considered as a private method. Backends looking to populate this variable should do so via calli...
[ "Setter", "method", "for", "threshold_monitor", "mapped", "from", "YANG", "variable", "/", "rbridge_id", "/", "threshold_monitor", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "sou...
python
train
capless/valley
valley/utils/imports.py
https://github.com/capless/valley/blob/491e4203e428a9e92264e204d44a1df96a570bbc/valley/utils/imports.py#L4-L14
def import_util(imp): ''' Lazily imports a utils (class, function,or variable) from a module) from a string. @param imp: ''' mod_name, obj_name = imp.rsplit('.', 1) mod = importlib.import_module(mod_name) return getattr(mod, obj_name)
[ "def", "import_util", "(", "imp", ")", ":", "mod_name", ",", "obj_name", "=", "imp", ".", "rsplit", "(", "'.'", ",", "1", ")", "mod", "=", "importlib", ".", "import_module", "(", "mod_name", ")", "return", "getattr", "(", "mod", ",", "obj_name", ")" ]
Lazily imports a utils (class, function,or variable) from a module) from a string. @param imp:
[ "Lazily", "imports", "a", "utils", "(", "class", "function", "or", "variable", ")", "from", "a", "module", ")", "from", "a", "string", "." ]
python
train
mattharrison/rst2odp
odplib/preso.py
https://github.com/mattharrison/rst2odp/blob/4adbf29b28c8207ec882f792ded07e98b1d3e7d0/odplib/preso.py#L1350-L1356
def _check_add_node(self, parent, name): """ Returns False if bad to make name a child of parent """ if name == ns("text", "a"): if parent.tag == ns("draw", "text-box"): return False return True
[ "def", "_check_add_node", "(", "self", ",", "parent", ",", "name", ")", ":", "if", "name", "==", "ns", "(", "\"text\"", ",", "\"a\"", ")", ":", "if", "parent", ".", "tag", "==", "ns", "(", "\"draw\"", ",", "\"text-box\"", ")", ":", "return", "False",...
Returns False if bad to make name a child of parent
[ "Returns", "False", "if", "bad", "to", "make", "name", "a", "child", "of", "parent" ]
python
train
bitshares/python-bitshares
bitshares/bitshares.py
https://github.com/bitshares/python-bitshares/blob/8a3b5954a6abcaaff7c6a5c41d910e58eea3142f/bitshares/bitshares.py#L1253-L1274
def create_committee_member(self, url="", account=None, **kwargs): """ Create a committee member :param str url: URL to read more about the worker :param str account: (optional) the account to allow access to (defaults to ``default_account``) """ if not a...
[ "def", "create_committee_member", "(", "self", ",", "url", "=", "\"\"", ",", "account", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "account", ":", "if", "\"default_account\"", "in", "self", ".", "config", ":", "account", "=", "self", ...
Create a committee member :param str url: URL to read more about the worker :param str account: (optional) the account to allow access to (defaults to ``default_account``)
[ "Create", "a", "committee", "member" ]
python
train
hyperledger/sawtooth-core
cli/sawtooth_cli/tty.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/cli/sawtooth_cli/tty.py#L24-L37
def size(): """Determines the height and width of the console window Returns: tuple of int: The height in lines, then width in characters """ try: assert os != 'nt' and sys.stdout.isatty() rows, columns = os.popen('stty size', 'r').read().split() except (AssertionErr...
[ "def", "size", "(", ")", ":", "try", ":", "assert", "os", "!=", "'nt'", "and", "sys", ".", "stdout", ".", "isatty", "(", ")", "rows", ",", "columns", "=", "os", ".", "popen", "(", "'stty size'", ",", "'r'", ")", ".", "read", "(", ")", ".", "spl...
Determines the height and width of the console window Returns: tuple of int: The height in lines, then width in characters
[ "Determines", "the", "height", "and", "width", "of", "the", "console", "window" ]
python
train
saltstack/salt
salt/modules/ipmi.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ipmi.py#L790-L826
def get_user(uid, channel=14, **kwargs): ''' Get user from uid and access on channel :param uid: user number [1:16] :param channel: number [1:7] :param kwargs: - api_host=127.0.0.1 - api_user=admin - api_pass=example - api_port=623 - api_kg=None Return D...
[ "def", "get_user", "(", "uid", ",", "channel", "=", "14", ",", "*", "*", "kwargs", ")", ":", "name", "=", "get_user_name", "(", "uid", ",", "*", "*", "kwargs", ")", "access", "=", "get_user_access", "(", "uid", ",", "channel", ",", "*", "*", "kwarg...
Get user from uid and access on channel :param uid: user number [1:16] :param channel: number [1:7] :param kwargs: - api_host=127.0.0.1 - api_user=admin - api_pass=example - api_port=623 - api_kg=None Return Data .. code-block:: none name: (str) ...
[ "Get", "user", "from", "uid", "and", "access", "on", "channel" ]
python
train
jasonrbriggs/stomp.py
stomp/transport.py
https://github.com/jasonrbriggs/stomp.py/blob/643843c5fbf25fd24339dd0e69a9411c3d8b94c7/stomp/transport.py#L196-L251
def notify(self, frame_type, headers=None, body=None): """ Utility function for notifying listeners of incoming and outgoing messages :param str frame_type: the type of message :param dict headers: the map of headers associated with the message :param body: the content of the me...
[ "def", "notify", "(", "self", ",", "frame_type", ",", "headers", "=", "None", ",", "body", "=", "None", ")", ":", "if", "frame_type", "==", "'receipt'", ":", "# logic for wait-on-receipt notification", "receipt", "=", "headers", "[", "'receipt-id'", "]", "rece...
Utility function for notifying listeners of incoming and outgoing messages :param str frame_type: the type of message :param dict headers: the map of headers associated with the message :param body: the content of the message
[ "Utility", "function", "for", "notifying", "listeners", "of", "incoming", "and", "outgoing", "messages" ]
python
train
salu133445/pypianoroll
pypianoroll/metrics.py
https://github.com/salu133445/pypianoroll/blob/6224dc1e29222de2124d249acb80f3d072166917/pypianoroll/metrics.py#L47-L58
def qualified_note_rate(pianoroll, threshold=2): """Return the ratio of the number of the qualified notes (notes longer than `threshold` (in time step)) to the total number of notes in a pianoroll.""" _validate_pianoroll(pianoroll) if np.issubdtype(pianoroll.dtype, np.bool_): pianoroll = pianoro...
[ "def", "qualified_note_rate", "(", "pianoroll", ",", "threshold", "=", "2", ")", ":", "_validate_pianoroll", "(", "pianoroll", ")", "if", "np", ".", "issubdtype", "(", "pianoroll", ".", "dtype", ",", "np", ".", "bool_", ")", ":", "pianoroll", "=", "pianoro...
Return the ratio of the number of the qualified notes (notes longer than `threshold` (in time step)) to the total number of notes in a pianoroll.
[ "Return", "the", "ratio", "of", "the", "number", "of", "the", "qualified", "notes", "(", "notes", "longer", "than", "threshold", "(", "in", "time", "step", "))", "to", "the", "total", "number", "of", "notes", "in", "a", "pianoroll", "." ]
python
train
tamasgal/km3pipe
km3pipe/io/__init__.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/io/__init__.py#L90-L113
def read_calibration( detx=None, det_id=None, from_file=False, det_id_table=None ): """Retrive calibration from file, the DB.""" from km3pipe.calib import Calibration # noqa if not (detx or det_id or from_file): return None if detx is not None: return Calibration(filename=det...
[ "def", "read_calibration", "(", "detx", "=", "None", ",", "det_id", "=", "None", ",", "from_file", "=", "False", ",", "det_id_table", "=", "None", ")", ":", "from", "km3pipe", ".", "calib", "import", "Calibration", "# noqa", "if", "not", "(", "detx", "or...
Retrive calibration from file, the DB.
[ "Retrive", "calibration", "from", "file", "the", "DB", "." ]
python
train
adsabs/adsutils
adsutils/ads_utils.py
https://github.com/adsabs/adsutils/blob/fb9d6b4f6ed5e6ca19c552efc3cdd6466c587fdb/adsutils/ads_utils.py#L124-L150
def get_pub_abbreviation(pubstring, numBest=5, exact=None): """ Get ADS journal abbreviation ("bibstem") candidates for a given publication name. * 'exact': if True results will only be returned if an exact match was found * 'numBest': maximum number of guesses to return A list of tuples will be ret...
[ "def", "get_pub_abbreviation", "(", "pubstring", ",", "numBest", "=", "5", ",", "exact", "=", "None", ")", ":", "if", "exact", ":", "# Only try to find exact matches", "bibstems", "=", "_defaultSourcematcher", ".", "getExactMatch", "(", "string", ".", "upper", "...
Get ADS journal abbreviation ("bibstem") candidates for a given publication name. * 'exact': if True results will only be returned if an exact match was found * 'numBest': maximum number of guesses to return A list of tuples will be returned, each tuple consisting of a score and a bibstem
[ "Get", "ADS", "journal", "abbreviation", "(", "bibstem", ")", "candidates", "for", "a", "given", "publication", "name", ".", "*", "exact", ":", "if", "True", "results", "will", "only", "be", "returned", "if", "an", "exact", "match", "was", "found", "*", ...
python
train
alex-kostirin/pyatomac
atomac/ldtpd/core.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L148-L170
def startprocessmonitor(self, process_name, interval=2): """ Start memory and CPU monitoring, with the time interval between each process scan @param process_name: Process name, ex: firefox-bin. @type process_name: string @param interval: Time interval between each proce...
[ "def", "startprocessmonitor", "(", "self", ",", "process_name", ",", "interval", "=", "2", ")", ":", "if", "process_name", "in", "self", ".", "_process_stats", ":", "# Stop previously running instance", "# At any point, only one process name can be tracked", "# If an instan...
Start memory and CPU monitoring, with the time interval between each process scan @param process_name: Process name, ex: firefox-bin. @type process_name: string @param interval: Time interval between each process scan @type interval: double @return: 1 on success ...
[ "Start", "memory", "and", "CPU", "monitoring", "with", "the", "time", "interval", "between", "each", "process", "scan" ]
python
valid
gem/oq-engine
openquake/hazardlib/gsim/dowrickrhoades_2005.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/dowrickrhoades_2005.py#L74-L96
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ assert all(stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES ...
[ "def", "get_mean_and_stddevs", "(", "self", ",", "sites", ",", "rup", ",", "dists", ",", "imt", ",", "stddev_types", ")", ":", "assert", "all", "(", "stddev_type", "in", "self", ".", "DEFINED_FOR_STANDARD_DEVIATION_TYPES", "for", "stddev_type", "in", "stddev_typ...
See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.
[ "See", ":", "meth", ":", "superclass", "method", "<", ".", "base", ".", "GroundShakingIntensityModel", ".", "get_mean_and_stddevs", ">", "for", "spec", "of", "input", "and", "result", "values", "." ]
python
train
abingham/spor
src/spor/repository/repository.py
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/repository/repository.py#L61-L76
def add(self, anchor): """Add a new anchor to the repository. This will create a new ID for the anchor and provision new storage for it. Returns: The storage ID for the Anchor which can be used to retrieve the anchor later. """ anchor_id = uuid.uuid4().hex ...
[ "def", "add", "(", "self", ",", "anchor", ")", ":", "anchor_id", "=", "uuid", ".", "uuid4", "(", ")", ".", "hex", "anchor_path", "=", "self", ".", "_anchor_path", "(", "anchor_id", ")", "with", "anchor_path", ".", "open", "(", "mode", "=", "'wt'", ")...
Add a new anchor to the repository. This will create a new ID for the anchor and provision new storage for it. Returns: The storage ID for the Anchor which can be used to retrieve the anchor later.
[ "Add", "a", "new", "anchor", "to", "the", "repository", "." ]
python
train
20c/twentyc.database
twentyc/database/couchbase/client.py
https://github.com/20c/twentyc.database/blob/c6b7184d66dddafb306c94c4f98234bef1df1291/twentyc/database/couchbase/client.py#L101-L126
def get(self, key): """ Retrieve object indexed by <key> """ try: try: obj = self.bucket.get(key) except couchbase.exception.MemcachedError, inst: if str(inst) == "Memcached error #1: Not found": # for some reason the py cb client raises an error when ...
[ "def", "get", "(", "self", ",", "key", ")", ":", "try", ":", "try", ":", "obj", "=", "self", ".", "bucket", ".", "get", "(", "key", ")", "except", "couchbase", ".", "exception", ".", "MemcachedError", ",", "inst", ":", "if", "str", "(", "inst", "...
Retrieve object indexed by <key>
[ "Retrieve", "object", "indexed", "by", "<key", ">" ]
python
train
jmgilman/Neolib
neolib/pyamf/util/pure.py
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/pure.py#L218-L233
def write_uchar(self, c): """ Writes an C{unsigned char} to the stream. @param c: Unsigned char @type c: C{int} @raise TypeError: Unexpected type for int C{c}. @raise OverflowError: Not in range. """ if type(c) not in python.int_types: raise T...
[ "def", "write_uchar", "(", "self", ",", "c", ")", ":", "if", "type", "(", "c", ")", "not", "in", "python", ".", "int_types", ":", "raise", "TypeError", "(", "'expected an int (got:%r)'", "%", "type", "(", "c", ")", ")", "if", "not", "0", "<=", "c", ...
Writes an C{unsigned char} to the stream. @param c: Unsigned char @type c: C{int} @raise TypeError: Unexpected type for int C{c}. @raise OverflowError: Not in range.
[ "Writes", "an", "C", "{", "unsigned", "char", "}", "to", "the", "stream", "." ]
python
train
PyCQA/astroid
astroid/modutils.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/modutils.py#L536-L558
def get_source_file(filename, include_no_ext=False): """given a python module's file name return the matching source file name (the filename will be returned identically if it's already an absolute path to a python source file...) :type filename: str :param filename: python module's file name ...
[ "def", "get_source_file", "(", "filename", ",", "include_no_ext", "=", "False", ")", ":", "filename", "=", "os", ".", "path", ".", "abspath", "(", "_path_from_filename", "(", "filename", ")", ")", "base", ",", "orig_ext", "=", "os", ".", "path", ".", "sp...
given a python module's file name return the matching source file name (the filename will be returned identically if it's already an absolute path to a python source file...) :type filename: str :param filename: python module's file name :raise NoSourceFile: if no source file exists on the file s...
[ "given", "a", "python", "module", "s", "file", "name", "return", "the", "matching", "source", "file", "name", "(", "the", "filename", "will", "be", "returned", "identically", "if", "it", "s", "already", "an", "absolute", "path", "to", "a", "python", "sourc...
python
train
OpenHydrology/floodestimation
floodestimation/fehdata.py
https://github.com/OpenHydrology/floodestimation/blob/782da7c5abd1348923129efe89fb70003ebb088c/floodestimation/fehdata.py#L82-L109
def update_available(after_days=1): """ Check whether updated NRFA data is available. :param after_days: Only check if not checked previously since a certain number of days ago :type after_days: float :return: `True` if update available, `False` if not, `None` if remote location cannot be reached. ...
[ "def", "update_available", "(", "after_days", "=", "1", ")", ":", "never_downloaded", "=", "not", "bool", "(", "config", ".", "get", "(", "'nrfa'", ",", "'downloaded_on'", ",", "fallback", "=", "None", ")", "or", "None", ")", "if", "never_downloaded", ":",...
Check whether updated NRFA data is available. :param after_days: Only check if not checked previously since a certain number of days ago :type after_days: float :return: `True` if update available, `False` if not, `None` if remote location cannot be reached. :rtype: bool or None
[ "Check", "whether", "updated", "NRFA", "data", "is", "available", "." ]
python
train
tensorflow/cleverhans
cleverhans/compat.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/compat.py#L35-L54
def reduce_function(op_func, input_tensor, axis=None, keepdims=None, name=None, reduction_indices=None): """ This function used to be needed to support tf 1.4 and early, but support for tf 1.4 and earlier is now dropped. :param op_func: expects the function to handle eg: tf.reduce_sum. :para...
[ "def", "reduce_function", "(", "op_func", ",", "input_tensor", ",", "axis", "=", "None", ",", "keepdims", "=", "None", ",", "name", "=", "None", ",", "reduction_indices", "=", "None", ")", ":", "warnings", ".", "warn", "(", "\"`reduce_function` is deprecated a...
This function used to be needed to support tf 1.4 and early, but support for tf 1.4 and earlier is now dropped. :param op_func: expects the function to handle eg: tf.reduce_sum. :param input_tensor: The tensor to reduce. Should have numeric type. :param axis: The dimensions to reduce. If None (the default), ...
[ "This", "function", "used", "to", "be", "needed", "to", "support", "tf", "1", ".", "4", "and", "early", "but", "support", "for", "tf", "1", ".", "4", "and", "earlier", "is", "now", "dropped", ".", ":", "param", "op_func", ":", "expects", "the", "func...
python
train
tensorpack/tensorpack
examples/FasterRCNN/dataset.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/examples/FasterRCNN/dataset.py#L203-L229
def load_training_roidbs(self, names): """ Args: names (list[str]): name of the training datasets, e.g. ['train2014', 'valminusminival2014'] Returns: roidbs (list[dict]): Produce "roidbs" as a list of dict, each dict corresponds to one image with k>=0 instances...
[ "def", "load_training_roidbs", "(", "self", ",", "names", ")", ":", "return", "COCODetection", ".", "load_many", "(", "cfg", ".", "DATA", ".", "BASEDIR", ",", "names", ",", "add_gt", "=", "True", ",", "add_mask", "=", "cfg", ".", "MODE_MASK", ")" ]
Args: names (list[str]): name of the training datasets, e.g. ['train2014', 'valminusminival2014'] Returns: roidbs (list[dict]): Produce "roidbs" as a list of dict, each dict corresponds to one image with k>=0 instances. and the following keys are expected for training:...
[ "Args", ":", "names", "(", "list", "[", "str", "]", ")", ":", "name", "of", "the", "training", "datasets", "e", ".", "g", ".", "[", "train2014", "valminusminival2014", "]" ]
python
train
annoviko/pyclustering
pyclustering/cluster/cure.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/cure.py#L178-L243
def __process_by_python(self): """! @brief Performs cluster analysis using python code. """ self.__create_queue() # queue self.__create_kdtree() # create k-d tree while len(self.__queue) > self.__number_cluster: cluster1 = self.__queue[0] # clust...
[ "def", "__process_by_python", "(", "self", ")", ":", "self", ".", "__create_queue", "(", ")", "# queue\r", "self", ".", "__create_kdtree", "(", ")", "# create k-d tree\r", "while", "len", "(", "self", ".", "__queue", ")", ">", "self", ".", "__number_cluster", ...
! @brief Performs cluster analysis using python code.
[ "!" ]
python
valid
lucalianas/pyBaseX
pybasex/fragments.py
https://github.com/lucalianas/pyBaseX/blob/c397e7182932bdeb997313c5dbe7731516b575c8/pybasex/fragments.py#L6-L15
def build_query_fragment(query): """ <query xmlns="http://basex.org/rest"> <text><![CDATA[ (//city/name)[position() <= 5] ]]></text> </query> """ root = etree.Element('query', nsmap={None: 'http://basex.org/rest'}) text = etree.SubElement(root, 'text') text.text = etree.CDATA(query.s...
[ "def", "build_query_fragment", "(", "query", ")", ":", "root", "=", "etree", ".", "Element", "(", "'query'", ",", "nsmap", "=", "{", "None", ":", "'http://basex.org/rest'", "}", ")", "text", "=", "etree", ".", "SubElement", "(", "root", ",", "'text'", ")...
<query xmlns="http://basex.org/rest"> <text><![CDATA[ (//city/name)[position() <= 5] ]]></text> </query>
[ "<query", "xmlns", "=", "http", ":", "//", "basex", ".", "org", "/", "rest", ">", "<text", ">", "<!", "[", "CDATA", "[", "(", "//", "city", "/", "name", ")", "[", "position", "()", "<", "=", "5", "]", "]]", ">", "<", "/", "text", ">", "<", ...
python
train
DarkEnergySurvey/ugali
ugali/simulation/simulator.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/simulation/simulator.py#L400-L493
def background(self,mc_source_id=2,seed=None): """ Create a simulation of the background stellar population. Because some stars have been clipped to generate the CMD, this function tends to slightly underestimate (~1%) the background as compared to the true catalog. The...
[ "def", "background", "(", "self", ",", "mc_source_id", "=", "2", ",", "seed", "=", "None", ")", ":", "if", "seed", "is", "not", "None", ":", "np", ".", "random", ".", "seed", "(", "seed", ")", "self", ".", "_setup_cmd", "(", ")", "# Randomize the num...
Create a simulation of the background stellar population. Because some stars have been clipped to generate the CMD, this function tends to slightly underestimate (~1%) the background as compared to the true catalog. The simulation of background object colors relies on the data-...
[ "Create", "a", "simulation", "of", "the", "background", "stellar", "population", ".", "Because", "some", "stars", "have", "been", "clipped", "to", "generate", "the", "CMD", "this", "function", "tends", "to", "slightly", "underestimate", "(", "~1%", ")", "the",...
python
train
AguaClara/aguaclara
aguaclara/core/physchem.py
https://github.com/AguaClara/aguaclara/blob/8dd4e734768b166a7fc2b60388a24df2f93783fc/aguaclara/core/physchem.py#L121-L128
def re_rect(FlowRate, Width, DistCenter, Nu, openchannel): """Return the Reynolds Number for a rectangular channel.""" #Checking input validity - inputs not checked here are checked by #functions this function calls. ut.check_range([FlowRate, ">0", "Flow rate"], [Nu, ">0", "Nu"]) return (4 * FlowRat...
[ "def", "re_rect", "(", "FlowRate", ",", "Width", ",", "DistCenter", ",", "Nu", ",", "openchannel", ")", ":", "#Checking input validity - inputs not checked here are checked by", "#functions this function calls.", "ut", ".", "check_range", "(", "[", "FlowRate", ",", "\">...
Return the Reynolds Number for a rectangular channel.
[ "Return", "the", "Reynolds", "Number", "for", "a", "rectangular", "channel", "." ]
python
train
bwohlberg/sporco
sporco/dictlrn/prlcnscdl.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/dictlrn/prlcnscdl.py#L249-L262
def step_group(k): """Do a single iteration over cbpdn and ccmod steps that can be performed independently for each slice `k` of the input data set. """ cbpdn_xstep(k) if mp_xrlx != 1.0: cbpdn_relax(k) cbpdn_ystep(k) cbpdn_ustep(k) ccmod_setcoef(k) ccmod_xstep(k) if mp_d...
[ "def", "step_group", "(", "k", ")", ":", "cbpdn_xstep", "(", "k", ")", "if", "mp_xrlx", "!=", "1.0", ":", "cbpdn_relax", "(", "k", ")", "cbpdn_ystep", "(", "k", ")", "cbpdn_ustep", "(", "k", ")", "ccmod_setcoef", "(", "k", ")", "ccmod_xstep", "(", "k...
Do a single iteration over cbpdn and ccmod steps that can be performed independently for each slice `k` of the input data set.
[ "Do", "a", "single", "iteration", "over", "cbpdn", "and", "ccmod", "steps", "that", "can", "be", "performed", "independently", "for", "each", "slice", "k", "of", "the", "input", "data", "set", "." ]
python
train
brentp/cruzdb
cruzdb/__init__.py
https://github.com/brentp/cruzdb/blob/9068d46e25952f4a929dde0242beb31fa4c7e89a/cruzdb/__init__.py#L449-L484
def annotate(self, fname, tables, feature_strand=False, in_memory=False, header=None, out=sys.stdout, parallel=False): """ annotate a file with a number of tables Parameters ---------- fname : str or file file name or file-handle tables : list ...
[ "def", "annotate", "(", "self", ",", "fname", ",", "tables", ",", "feature_strand", "=", "False", ",", "in_memory", "=", "False", ",", "header", "=", "None", ",", "out", "=", "sys", ".", "stdout", ",", "parallel", "=", "False", ")", ":", "from", ".",...
annotate a file with a number of tables Parameters ---------- fname : str or file file name or file-handle tables : list list of tables with which to annotate `fname` feature_strand : bool if this is True, then the up/downstream designations...
[ "annotate", "a", "file", "with", "a", "number", "of", "tables" ]
python
train
pbrisk/mathtoolspy
mathtoolspy/solver/minimize_algorithm_1dim_brent.py
https://github.com/pbrisk/mathtoolspy/blob/d0d35b45d20f346ba8a755e53ed0aa182fab43dd/mathtoolspy/solver/minimize_algorithm_1dim_brent.py#L25-L102
def minimize_algorithm_1dim_brent(fct, _a, _b, _c, tolerance=DOUBLE_TOL): ''' Finds the minimum of the given function f. The arguments are the given function f, and given a bracketing triplet of abscissas A, B, C (such that B is between A and C, and f(B) is less than both f(A) and f(C)) and the Tolerance. ...
[ "def", "minimize_algorithm_1dim_brent", "(", "fct", ",", "_a", ",", "_b", ",", "_c", ",", "tolerance", "=", "DOUBLE_TOL", ")", ":", "''' ZEPS is a small number that protects against trying to achieve fractional accuracy\n for a minimum that happens to be exactly zero. '''", "ZEP...
Finds the minimum of the given function f. The arguments are the given function f, and given a bracketing triplet of abscissas A, B, C (such that B is between A and C, and f(B) is less than both f(A) and f(C)) and the Tolerance. This routine isolates the minimum to a fractional precision of about tol using ...
[ "Finds", "the", "minimum", "of", "the", "given", "function", "f", ".", "The", "arguments", "are", "the", "given", "function", "f", "and", "given", "a", "bracketing", "triplet", "of", "abscissas", "A", "B", "C", "(", "such", "that", "B", "is", "between", ...
python
train
lambdamusic/Ontospy
ontospy/extras/shell_lib.py
https://github.com/lambdamusic/Ontospy/blob/eb46cb13792b2b87f21babdf976996318eec7571/ontospy/extras/shell_lib.py#L964-L984
def do_visualize(self, line): """Visualize an ontology - ie wrapper for export command""" if not self.current: self._help_noontology() return line = line.split() try: # from ..viz.builder import action_visualize from ..ontodocs.builder i...
[ "def", "do_visualize", "(", "self", ",", "line", ")", ":", "if", "not", "self", ".", "current", ":", "self", ".", "_help_noontology", "(", ")", "return", "line", "=", "line", ".", "split", "(", ")", "try", ":", "# from ..viz.builder import action_visualize",...
Visualize an ontology - ie wrapper for export command
[ "Visualize", "an", "ontology", "-", "ie", "wrapper", "for", "export", "command" ]
python
train
yinkaisheng/Python-UIAutomation-for-Windows
uiautomation/uiautomation.py
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3829-L3837
def SetView(self, view: int) -> bool: """ Call IUIAutomationMultipleViewPattern::SetCurrentView. Set the view of the control. view: int, the control-specific view identifier. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desk...
[ "def", "SetView", "(", "self", ",", "view", ":", "int", ")", "->", "bool", ":", "return", "self", ".", "pattern", ".", "SetCurrentView", "(", "view", ")", "==", "S_OK" ]
Call IUIAutomationMultipleViewPattern::SetCurrentView. Set the view of the control. view: int, the control-specific view identifier. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautoma...
[ "Call", "IUIAutomationMultipleViewPattern", "::", "SetCurrentView", ".", "Set", "the", "view", "of", "the", "control", ".", "view", ":", "int", "the", "control", "-", "specific", "view", "identifier", ".", "Return", "bool", "True", "if", "succeed", "otherwise", ...
python
valid
sdispater/orator
orator/schema/grammars/grammar.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/schema/grammars/grammar.py#L152-L156
def _get_commands_by_name(self, blueprint, name): """ Get all of the commands with a given name. """ return list(filter(lambda value: value.name == name, blueprint.get_commands()))
[ "def", "_get_commands_by_name", "(", "self", ",", "blueprint", ",", "name", ")", ":", "return", "list", "(", "filter", "(", "lambda", "value", ":", "value", ".", "name", "==", "name", ",", "blueprint", ".", "get_commands", "(", ")", ")", ")" ]
Get all of the commands with a given name.
[ "Get", "all", "of", "the", "commands", "with", "a", "given", "name", "." ]
python
train
saltstack/salt
salt/cli/caller.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L104-L109
def print_grains(self): ''' Print out the grains ''' grains = self.minion.opts.get('grains') or salt.loader.grains(self.opts) salt.output.display_output({'local': grains}, 'grains', self.opts)
[ "def", "print_grains", "(", "self", ")", ":", "grains", "=", "self", ".", "minion", ".", "opts", ".", "get", "(", "'grains'", ")", "or", "salt", ".", "loader", ".", "grains", "(", "self", ".", "opts", ")", "salt", ".", "output", ".", "display_output"...
Print out the grains
[ "Print", "out", "the", "grains" ]
python
train
ga4gh/ga4gh-server
ga4gh/server/gff3.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/gff3.py#L272-L284
def _parseAttrs(self, attrsStr): """ Parse the attributes and values """ attributes = dict() for attrStr in self.SPLIT_ATTR_COL_RE.split(attrsStr): name, vals = self._parseAttrVal(attrStr) if name in attributes: raise GFF3Exception( ...
[ "def", "_parseAttrs", "(", "self", ",", "attrsStr", ")", ":", "attributes", "=", "dict", "(", ")", "for", "attrStr", "in", "self", ".", "SPLIT_ATTR_COL_RE", ".", "split", "(", "attrsStr", ")", ":", "name", ",", "vals", "=", "self", ".", "_parseAttrVal", ...
Parse the attributes and values
[ "Parse", "the", "attributes", "and", "values" ]
python
train
eumis/pyviews
pyviews/rendering/node.py
https://github.com/eumis/pyviews/blob/80a868242ee9cdc6f4ded594b3e0544cc238ed55/pyviews/rendering/node.py#L20-L27
def get_inst_type(xml_node: XmlNode): '''Returns type by xml node''' (module_path, class_name) = (xml_node.namespace, xml_node.name) try: return import_module(module_path).__dict__[class_name] except (KeyError, ImportError, ModuleNotFoundError): message = 'Import "{0}.{1}" is failed.'.fo...
[ "def", "get_inst_type", "(", "xml_node", ":", "XmlNode", ")", ":", "(", "module_path", ",", "class_name", ")", "=", "(", "xml_node", ".", "namespace", ",", "xml_node", ".", "name", ")", "try", ":", "return", "import_module", "(", "module_path", ")", ".", ...
Returns type by xml node
[ "Returns", "type", "by", "xml", "node" ]
python
train
tanghaibao/goatools
goatools/gosubdag/plot/gosubdag_plot.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/plot/gosubdag_plot.py#L152-L155
def _plt_pydot(self, fout_img): """Plot using the pydot graphics engine.""" dag = self.get_pydot_graph() self.wr_pydot_dag(fout_img, dag)
[ "def", "_plt_pydot", "(", "self", ",", "fout_img", ")", ":", "dag", "=", "self", ".", "get_pydot_graph", "(", ")", "self", ".", "wr_pydot_dag", "(", "fout_img", ",", "dag", ")" ]
Plot using the pydot graphics engine.
[ "Plot", "using", "the", "pydot", "graphics", "engine", "." ]
python
train
tuxpiper/cloudcast
cloudcast/iscm/phased.py
https://github.com/tuxpiper/cloudcast/blob/06ca62045c483e9c3e7ee960ba70d90ea6a13776/cloudcast/iscm/phased.py#L135-L145
def get_dict_repr(self): """ Return a dictionary representation of this phase. This will be used for checksumming, in order to uniquely compare instance images against their requirements """ return dict( phase_name = self.phase_name, phase_type = s...
[ "def", "get_dict_repr", "(", "self", ")", ":", "return", "dict", "(", "phase_name", "=", "self", ".", "phase_name", ",", "phase_type", "=", "self", ".", "phase_type", ",", "actions", "=", "self", ".", "actions", ")" ]
Return a dictionary representation of this phase. This will be used for checksumming, in order to uniquely compare instance images against their requirements
[ "Return", "a", "dictionary", "representation", "of", "this", "phase", ".", "This", "will", "be", "used", "for", "checksumming", "in", "order", "to", "uniquely", "compare", "instance", "images", "against", "their", "requirements" ]
python
train
Rapptz/discord.py
discord/iterators.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/iterators.py#L571-L579
async def _retrieve_guilds_before_strategy(self, retrieve): """Retrieve guilds using before parameter.""" before = self.before.id if self.before else None data = await self.get_guilds(retrieve, before=before) if len(data): if self.limit is not None: self.limit...
[ "async", "def", "_retrieve_guilds_before_strategy", "(", "self", ",", "retrieve", ")", ":", "before", "=", "self", ".", "before", ".", "id", "if", "self", ".", "before", "else", "None", "data", "=", "await", "self", ".", "get_guilds", "(", "retrieve", ",",...
Retrieve guilds using before parameter.
[ "Retrieve", "guilds", "using", "before", "parameter", "." ]
python
train
astropy/photutils
photutils/utils/interpolation.py
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/interpolation.py#L289-L370
def interpolate_masked_data(data, mask, error=None, background=None): """ Interpolate over masked pixels in data and optional error or background images. The value of masked pixels are replaced by the mean value of the connected neighboring non-masked pixels. This function is intended for sing...
[ "def", "interpolate_masked_data", "(", "data", ",", "mask", ",", "error", "=", "None", ",", "background", "=", "None", ")", ":", "if", "data", ".", "shape", "!=", "mask", ".", "shape", ":", "raise", "ValueError", "(", "'data and mask must have the same shape'"...
Interpolate over masked pixels in data and optional error or background images. The value of masked pixels are replaced by the mean value of the connected neighboring non-masked pixels. This function is intended for single, isolated masked pixels (e.g. hot/warm pixels). Parameters ---------- ...
[ "Interpolate", "over", "masked", "pixels", "in", "data", "and", "optional", "error", "or", "background", "images", "." ]
python
train
vingd/encrypted-pickle-python
encryptedpickle/encryptedpickle.py
https://github.com/vingd/encrypted-pickle-python/blob/7656233598e02e65971f69e11849a0f288b2b2a5/encryptedpickle/encryptedpickle.py#L190-L193
def set_signature_passphrases(self, signature_passphrases): '''Set signature passphrases''' self.signature_passphrases = self._update_dict(signature_passphrases, {}, replace_data=True)
[ "def", "set_signature_passphrases", "(", "self", ",", "signature_passphrases", ")", ":", "self", ".", "signature_passphrases", "=", "self", ".", "_update_dict", "(", "signature_passphrases", ",", "{", "}", ",", "replace_data", "=", "True", ")" ]
Set signature passphrases
[ "Set", "signature", "passphrases" ]
python
valid
dnanexus/dx-toolkit
src/python/dxpy/bindings/dxworkflow.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxworkflow.py#L277-L295
def move_stage(self, stage, new_index, edit_version=None, **kwargs): ''' :param stage: A number for the stage index (for the nth stage, starting from 0), or a string of the stage index, name, or ID :type stage: int or string :param new_index: The new position in the order of stages that ...
[ "def", "move_stage", "(", "self", ",", "stage", ",", "new_index", ",", "edit_version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "stage_id", "=", "self", ".", "_get_stage_id", "(", "stage", ")", "move_stage_input", "=", "{", "\"stage\"", ":", "stag...
:param stage: A number for the stage index (for the nth stage, starting from 0), or a string of the stage index, name, or ID :type stage: int or string :param new_index: The new position in the order of stages that the specified stage should have (where 0 indicates the first stage) :type new_ind...
[ ":", "param", "stage", ":", "A", "number", "for", "the", "stage", "index", "(", "for", "the", "nth", "stage", "starting", "from", "0", ")", "or", "a", "string", "of", "the", "stage", "index", "name", "or", "ID", ":", "type", "stage", ":", "int", "o...
python
train
bprinty/gems
gems/datatypes.py
https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/datatypes.py#L428-L435
def items(self): """ Return keys for object, if they are available. """ if self.meta_type == 'list': return self._list elif self.meta_type == 'dict': return self._dict.items()
[ "def", "items", "(", "self", ")", ":", "if", "self", ".", "meta_type", "==", "'list'", ":", "return", "self", ".", "_list", "elif", "self", ".", "meta_type", "==", "'dict'", ":", "return", "self", ".", "_dict", ".", "items", "(", ")" ]
Return keys for object, if they are available.
[ "Return", "keys", "for", "object", "if", "they", "are", "available", "." ]
python
valid
vlukes/dicom2fem
dicom2fem/base.py
https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/base.py#L430-L448
def copy(self, deep=False, name=None): """Make a (deep) copy of self. Parameters: deep : bool Make a deep copy. name : str Name of the copy, with default self.name + '_copy'. """ if deep: other = deepcopy(self) else: ...
[ "def", "copy", "(", "self", ",", "deep", "=", "False", ",", "name", "=", "None", ")", ":", "if", "deep", ":", "other", "=", "deepcopy", "(", "self", ")", "else", ":", "other", "=", "copy", "(", "self", ")", "if", "hasattr", "(", "self", ",", "'...
Make a (deep) copy of self. Parameters: deep : bool Make a deep copy. name : str Name of the copy, with default self.name + '_copy'.
[ "Make", "a", "(", "deep", ")", "copy", "of", "self", "." ]
python
train
minio/minio-py
examples/progress.py
https://github.com/minio/minio-py/blob/7107c84183cf5fb4deff68c0a16ab9f1c0b4c37e/examples/progress.py#L131-L141
def seconds_to_time(seconds): """ Consistent time format to be displayed on the elapsed time in screen. :param seconds: seconds """ minutes, seconds = divmod(int(seconds), 60) hours, m = divmod(minutes, 60) if hours: return _HOURS_OF_ELAPSED % (hours, m, seconds) else: re...
[ "def", "seconds_to_time", "(", "seconds", ")", ":", "minutes", ",", "seconds", "=", "divmod", "(", "int", "(", "seconds", ")", ",", "60", ")", "hours", ",", "m", "=", "divmod", "(", "minutes", ",", "60", ")", "if", "hours", ":", "return", "_HOURS_OF_...
Consistent time format to be displayed on the elapsed time in screen. :param seconds: seconds
[ "Consistent", "time", "format", "to", "be", "displayed", "on", "the", "elapsed", "time", "in", "screen", ".", ":", "param", "seconds", ":", "seconds" ]
python
train
raymontag/kppy
kppy/database.py
https://github.com/raymontag/kppy/blob/a43f1fff7d49da1da4b3d8628a1b3ebbaf47f43a/kppy/database.py#L810-L815
def _get_passwordkey(self): """This method just hashes self.password.""" sha = SHA256.new() sha.update(self.password.encode('utf-8')) return sha.digest()
[ "def", "_get_passwordkey", "(", "self", ")", ":", "sha", "=", "SHA256", ".", "new", "(", ")", "sha", ".", "update", "(", "self", ".", "password", ".", "encode", "(", "'utf-8'", ")", ")", "return", "sha", ".", "digest", "(", ")" ]
This method just hashes self.password.
[ "This", "method", "just", "hashes", "self", ".", "password", "." ]
python
train
ska-sa/purr
Purr/MainWindow.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/MainWindow.py#L744-L748
def _addDPFiles(self, *files): """callback to add DPs corresponding to files.""" # quiet flag is always true self.new_entry_dialog.addDataProducts(self.purrer.makeDataProducts( [(file, True) for file in files], unbanish=True, unignore=True))
[ "def", "_addDPFiles", "(", "self", ",", "*", "files", ")", ":", "# quiet flag is always true", "self", ".", "new_entry_dialog", ".", "addDataProducts", "(", "self", ".", "purrer", ".", "makeDataProducts", "(", "[", "(", "file", ",", "True", ")", "for", "file...
callback to add DPs corresponding to files.
[ "callback", "to", "add", "DPs", "corresponding", "to", "files", "." ]
python
train
hyperledger/sawtooth-core
validator/sawtooth_validator/consensus/notifier.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/validator/sawtooth_validator/consensus/notifier.py#L169-L175
def notify_engine_activated(self, chain_head): """The consensus engine has been activated.""" chain_head_bytes = chain_head.SerializeToString() self._notify( "consensus_notifier_notify_engine_activated", chain_head_bytes, len(chain_head_bytes))
[ "def", "notify_engine_activated", "(", "self", ",", "chain_head", ")", ":", "chain_head_bytes", "=", "chain_head", ".", "SerializeToString", "(", ")", "self", ".", "_notify", "(", "\"consensus_notifier_notify_engine_activated\"", ",", "chain_head_bytes", ",", "len", "...
The consensus engine has been activated.
[ "The", "consensus", "engine", "has", "been", "activated", "." ]
python
train
odlgroup/odl
odl/solvers/functional/default_functionals.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/solvers/functional/default_functionals.py#L2022-L2103
def proximal(self): """Return the proximal operator. Raises ------ NotImplementedError if ``outer_exp`` is not 1 or ``singular_vector_exp`` is not 1, 2 or infinity """ if self.outernorm.exponent != 1: raise NotImplementedError('`proxim...
[ "def", "proximal", "(", "self", ")", ":", "if", "self", ".", "outernorm", ".", "exponent", "!=", "1", ":", "raise", "NotImplementedError", "(", "'`proximal` only implemented for '", "'`outer_exp==1`'", ")", "if", "self", ".", "pwisenorm", ".", "exponent", "not",...
Return the proximal operator. Raises ------ NotImplementedError if ``outer_exp`` is not 1 or ``singular_vector_exp`` is not 1, 2 or infinity
[ "Return", "the", "proximal", "operator", "." ]
python
train
Microsoft/nni
tools/nni_trial_tool/rest_utils.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_trial_tool/rest_utils.py#L34-L44
def rest_post(url, data, timeout, rethrow_exception=False): '''Call rest post method''' try: response = requests.post(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\ data=data, timeout=timeout) return response except Exceptio...
[ "def", "rest_post", "(", "url", ",", "data", ",", "timeout", ",", "rethrow_exception", "=", "False", ")", ":", "try", ":", "response", "=", "requests", ".", "post", "(", "url", ",", "headers", "=", "{", "'Accept'", ":", "'application/json'", ",", "'Conte...
Call rest post method
[ "Call", "rest", "post", "method" ]
python
train
carpedm20/fbchat
fbchat/_client.py
https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L724-L754
def searchForThreads(self, name, limit=10): """ Find and get a thread by its name :param name: Name of the thread :param limit: The max. amount of groups to fetch :return: :class:`models.User`, :class:`models.Group` and :class:`models.Page` objects, ordered by relevance ...
[ "def", "searchForThreads", "(", "self", ",", "name", ",", "limit", "=", "10", ")", ":", "params", "=", "{", "\"search\"", ":", "name", ",", "\"limit\"", ":", "limit", "}", "j", "=", "self", ".", "graphql_request", "(", "GraphQL", "(", "query", "=", "...
Find and get a thread by its name :param name: Name of the thread :param limit: The max. amount of groups to fetch :return: :class:`models.User`, :class:`models.Group` and :class:`models.Page` objects, ordered by relevance :rtype: list :raises: FBchatException if request failed
[ "Find", "and", "get", "a", "thread", "by", "its", "name" ]
python
train
peopledoc/django-agnocomplete
agnocomplete/core.py
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L458-L466
def build_filtered_queryset(self, query, **kwargs): """ Build and return the fully-filtered queryset """ # Take the basic queryset qs = self.get_queryset() # filter it via the query conditions qs = qs.filter(self.get_queryset_filters(query)) return self.bu...
[ "def", "build_filtered_queryset", "(", "self", ",", "query", ",", "*", "*", "kwargs", ")", ":", "# Take the basic queryset", "qs", "=", "self", ".", "get_queryset", "(", ")", "# filter it via the query conditions", "qs", "=", "qs", ".", "filter", "(", "self", ...
Build and return the fully-filtered queryset
[ "Build", "and", "return", "the", "fully", "-", "filtered", "queryset" ]
python
train
iceb0y/aiowrap
aiowrap/wrap.py
https://github.com/iceb0y/aiowrap/blob/7a155e68c0faee0eea7a3f43c1e96a36ccc2fd84/aiowrap/wrap.py#L5-L18
def wrap_async(func): """Wraps an asynchronous function into a synchronous function.""" @functools.wraps(func) def wrapped(*args, **kwargs): fut = asyncio.ensure_future(func(*args, **kwargs)) cur = greenlet.getcurrent() def callback(fut): try: cur.switch(f...
[ "def", "wrap_async", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "fut", "=", "asyncio", ".", "ensure_future", "(", "func", "(", "*", "args", ",", ...
Wraps an asynchronous function into a synchronous function.
[ "Wraps", "an", "asynchronous", "function", "into", "a", "synchronous", "function", "." ]
python
train
harlowja/fasteners
fasteners/_utils.py
https://github.com/harlowja/fasteners/blob/8f3bbab0204a50037448a8fad7a6bf12eb1a2695/fasteners/_utils.py#L47-L57
def canonicalize_path(path): """Canonicalizes a potential path. Returns a binary string encoded into filesystem encoding. """ if isinstance(path, six.binary_type): return path if isinstance(path, six.text_type): return _fsencode(path) else: return canonicalize_path(str(p...
[ "def", "canonicalize_path", "(", "path", ")", ":", "if", "isinstance", "(", "path", ",", "six", ".", "binary_type", ")", ":", "return", "path", "if", "isinstance", "(", "path", ",", "six", ".", "text_type", ")", ":", "return", "_fsencode", "(", "path", ...
Canonicalizes a potential path. Returns a binary string encoded into filesystem encoding.
[ "Canonicalizes", "a", "potential", "path", "." ]
python
train
saltstack/salt
salt/auth/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L288-L308
def authenticate_eauth(self, load): ''' Authenticate a user by the external auth module specified in load. Return True on success or False on failure. ''' if 'eauth' not in load: log.warning('Authentication failure of type "eauth" occurred.') return False ...
[ "def", "authenticate_eauth", "(", "self", ",", "load", ")", ":", "if", "'eauth'", "not", "in", "load", ":", "log", ".", "warning", "(", "'Authentication failure of type \"eauth\" occurred.'", ")", "return", "False", "if", "load", "[", "'eauth'", "]", "not", "i...
Authenticate a user by the external auth module specified in load. Return True on success or False on failure.
[ "Authenticate", "a", "user", "by", "the", "external", "auth", "module", "specified", "in", "load", ".", "Return", "True", "on", "success", "or", "False", "on", "failure", "." ]
python
train
fermiPy/fermipy
fermipy/diffuse/diffuse_src_manager.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L456-L485
def make_diffuse_comp_info_dict(**kwargs): """Build and return the information about the diffuse components """ library_yamlfile = kwargs.pop('library', 'models/library.yaml') components = kwargs.pop('components', None) if components is None: comp_yamlfile = kwargs.pop('comp', 'config/binnin...
[ "def", "make_diffuse_comp_info_dict", "(", "*", "*", "kwargs", ")", ":", "library_yamlfile", "=", "kwargs", ".", "pop", "(", "'library'", ",", "'models/library.yaml'", ")", "components", "=", "kwargs", ".", "pop", "(", "'components'", ",", "None", ")", "if", ...
Build and return the information about the diffuse components
[ "Build", "and", "return", "the", "information", "about", "the", "diffuse", "components" ]
python
train
PiotrDabkowski/pyjsparser
pyjsparser/parser.py
https://github.com/PiotrDabkowski/pyjsparser/blob/5465d037b30e334cb0997f2315ec1e451b8ad4c1/pyjsparser/parser.py#L518-L608
def _interpret_regexp(self, string, flags): '''Perform sctring escape - for regexp literals''' self.index = 0 self.length = len(string) self.source = string self.lineNumber = 0 self.lineStart = 0 octal = False st = '' inside_square = 0 whil...
[ "def", "_interpret_regexp", "(", "self", ",", "string", ",", "flags", ")", ":", "self", ".", "index", "=", "0", "self", ".", "length", "=", "len", "(", "string", ")", "self", ".", "source", "=", "string", "self", ".", "lineNumber", "=", "0", "self", ...
Perform sctring escape - for regexp literals
[ "Perform", "sctring", "escape", "-", "for", "regexp", "literals" ]
python
train
Nic30/hwt
hwt/simulator/hdlSimulator.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/hdlSimulator.py#L310-L324
def _scheduleApplyValues(self) -> None: """ Apply stashed values to signals """ assert not self._applyValPlaned, self.now self._add_process(self._applyValues(), PRIORITY_APPLY_COMB) self._applyValPlaned = True if self._runSeqProcessesPlaned: # if runS...
[ "def", "_scheduleApplyValues", "(", "self", ")", "->", "None", ":", "assert", "not", "self", ".", "_applyValPlaned", ",", "self", ".", "now", "self", ".", "_add_process", "(", "self", ".", "_applyValues", "(", ")", ",", "PRIORITY_APPLY_COMB", ")", "self", ...
Apply stashed values to signals
[ "Apply", "stashed", "values", "to", "signals" ]
python
test
yunojuno/elasticsearch-django
elasticsearch_django/models.py
https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/models.py#L308-L342
def as_search_action(self, *, index, action): """ Return an object as represented in a bulk api operation. Bulk API operations have a very specific format. This function will call the standard `as_search_document` method on the object and then wrap that up in the correct format ...
[ "def", "as_search_action", "(", "self", ",", "*", ",", "index", ",", "action", ")", ":", "if", "action", "not", "in", "(", "\"index\"", ",", "\"update\"", ",", "\"delete\"", ")", ":", "raise", "ValueError", "(", "\"Action must be 'index', 'update' or 'delete'.\"...
Return an object as represented in a bulk api operation. Bulk API operations have a very specific format. This function will call the standard `as_search_document` method on the object and then wrap that up in the correct format for the action specified. https://www.elastic.co/guide/en...
[ "Return", "an", "object", "as", "represented", "in", "a", "bulk", "api", "operation", "." ]
python
train
uw-it-aca/uw-restclients-nws
uw_nws/__init__.py
https://github.com/uw-it-aca/uw-restclients-nws/blob/ec6fd14342ffc883d14bcb53b2fe9bc288696027/uw_nws/__init__.py#L393-L411
def update_person(self, person): """ Update an existing person :param person: is the updated person that the client wants to update """ self._validate_regid(person.person_id) self._validate_subscriber_id(person.surrogate_id) for attr in MANAGED_ATTRIBUTES: ...
[ "def", "update_person", "(", "self", ",", "person", ")", ":", "self", ".", "_validate_regid", "(", "person", ".", "person_id", ")", "self", ".", "_validate_subscriber_id", "(", "person", ".", "surrogate_id", ")", "for", "attr", "in", "MANAGED_ATTRIBUTES", ":",...
Update an existing person :param person: is the updated person that the client wants to update
[ "Update", "an", "existing", "person", ":", "param", "person", ":", "is", "the", "updated", "person", "that", "the", "client", "wants", "to", "update" ]
python
train
zeth/inputs
inputs.py
https://github.com/zeth/inputs/blob/a46681dbf77d6ab07834f550e5855c1f50701f99/inputs.py#L2268-L2278
def _get_key_value(self, event, event_type): """Get the key value.""" if event_type == 10: value = 1 elif event_type == 11: value = 0 elif event_type == 12: value = self._get_flag_value(event) else: value = -1 return value
[ "def", "_get_key_value", "(", "self", ",", "event", ",", "event_type", ")", ":", "if", "event_type", "==", "10", ":", "value", "=", "1", "elif", "event_type", "==", "11", ":", "value", "=", "0", "elif", "event_type", "==", "12", ":", "value", "=", "s...
Get the key value.
[ "Get", "the", "key", "value", "." ]
python
train
ic-labs/django-icekit
glamkit_collections/etl/base.py
https://github.com/ic-labs/django-icekit/blob/c507ea5b1864303732c53ad7c5800571fca5fa94/glamkit_collections/etl/base.py#L17-L29
def items_to_extract(self, offset=0, length=None): """ Return an iterable of specific items to extract. As a side-effect, set self.items_to_extract_length. :param offset: where to start extracting :param length: how many to extract :return: An iterable of the specific ...
[ "def", "items_to_extract", "(", "self", ",", "offset", "=", "0", ",", "length", "=", "None", ")", ":", "endoffset", "=", "length", "and", "offset", "+", "length", "qs", "=", "self", ".", "origin_data", "(", ")", "[", "offset", ":", "endoffset", "]", ...
Return an iterable of specific items to extract. As a side-effect, set self.items_to_extract_length. :param offset: where to start extracting :param length: how many to extract :return: An iterable of the specific
[ "Return", "an", "iterable", "of", "specific", "items", "to", "extract", ".", "As", "a", "side", "-", "effect", "set", "self", ".", "items_to_extract_length", "." ]
python
train
pteichman/cobe
cobe/brain.py
https://github.com/pteichman/cobe/blob/b0dc2a707035035b9a689105c8f833894fb59eb7/cobe/brain.py#L197-L303
def reply(self, text, loop_ms=500, max_len=None): """Reply to a string of text. If the input is not already Unicode, it will be decoded as utf-8.""" if type(text) != types.UnicodeType: # Assume that non-Unicode text is encoded as utf-8, which # should be somewhat safe in ...
[ "def", "reply", "(", "self", ",", "text", ",", "loop_ms", "=", "500", ",", "max_len", "=", "None", ")", ":", "if", "type", "(", "text", ")", "!=", "types", ".", "UnicodeType", ":", "# Assume that non-Unicode text is encoded as utf-8, which", "# should be somewha...
Reply to a string of text. If the input is not already Unicode, it will be decoded as utf-8.
[ "Reply", "to", "a", "string", "of", "text", ".", "If", "the", "input", "is", "not", "already", "Unicode", "it", "will", "be", "decoded", "as", "utf", "-", "8", "." ]
python
train
refenv/cijoe
modules/cij/runner.py
https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L322-L337
def tsuite_enter(trun, tsuite): """Triggers when entering the given testsuite""" if trun["conf"]["VERBOSE"]: cij.emph("rnr:tsuite:enter { name: %r }" % tsuite["name"]) rcode = 0 for hook in tsuite["hooks"]["enter"]: # ENTER-hooks rcode = script_run(trun, hook) if rcode: ...
[ "def", "tsuite_enter", "(", "trun", ",", "tsuite", ")", ":", "if", "trun", "[", "\"conf\"", "]", "[", "\"VERBOSE\"", "]", ":", "cij", ".", "emph", "(", "\"rnr:tsuite:enter { name: %r }\"", "%", "tsuite", "[", "\"name\"", "]", ")", "rcode", "=", "0", "for...
Triggers when entering the given testsuite
[ "Triggers", "when", "entering", "the", "given", "testsuite" ]
python
valid
iotile/coretools
transport_plugins/jlink/iotile_transport_jlink/jlink.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/jlink/iotile_transport_jlink/jlink.py#L179-L207
def probe_async(self, callback): """Send advertisements for all connected devices. Args: callback (callable): A callback for when the probe operation has completed. callback should have signature callback(adapter_id, success, failure_reason) where: succes...
[ "def", "probe_async", "(", "self", ",", "callback", ")", ":", "def", "_on_finished", "(", "_name", ",", "control_info", ",", "exception", ")", ":", "if", "exception", "is", "not", "None", ":", "callback", "(", "self", ".", "id", ",", "False", ",", "str...
Send advertisements for all connected devices. Args: callback (callable): A callback for when the probe operation has completed. callback should have signature callback(adapter_id, success, failure_reason) where: success: bool failure_reason: ...
[ "Send", "advertisements", "for", "all", "connected", "devices", "." ]
python
train
untwisted/untwisted
untwisted/expect.py
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/expect.py#L84-L90
def destroy(self): """ Unregister up from untwisted reactor. It is needed to call self.terminate() first to kill the process. """ core.gear.pool.remove(self) self.base.clear()
[ "def", "destroy", "(", "self", ")", ":", "core", ".", "gear", ".", "pool", ".", "remove", "(", "self", ")", "self", ".", "base", ".", "clear", "(", ")" ]
Unregister up from untwisted reactor. It is needed to call self.terminate() first to kill the process.
[ "Unregister", "up", "from", "untwisted", "reactor", ".", "It", "is", "needed", "to", "call", "self", ".", "terminate", "()", "first", "to", "kill", "the", "process", "." ]
python
train
Unity-Technologies/ml-agents
ml-agents/mlagents/trainers/curriculum.py
https://github.com/Unity-Technologies/ml-agents/blob/37d139af636e4a2351751fbf0f2fca5a9ed7457f/ml-agents/mlagents/trainers/curriculum.py#L96-L112
def get_config(self, lesson=None): """ Returns reset parameters which correspond to the lesson. :param lesson: The lesson you want to get the config of. If None, the current lesson is returned. :return: The configuration of the reset parameters. """ if not ...
[ "def", "get_config", "(", "self", ",", "lesson", "=", "None", ")", ":", "if", "not", "self", ".", "data", ":", "return", "{", "}", "if", "lesson", "is", "None", ":", "lesson", "=", "self", ".", "lesson_num", "lesson", "=", "max", "(", "0", ",", "...
Returns reset parameters which correspond to the lesson. :param lesson: The lesson you want to get the config of. If None, the current lesson is returned. :return: The configuration of the reset parameters.
[ "Returns", "reset", "parameters", "which", "correspond", "to", "the", "lesson", ".", ":", "param", "lesson", ":", "The", "lesson", "you", "want", "to", "get", "the", "config", "of", ".", "If", "None", "the", "current", "lesson", "is", "returned", ".", ":...
python
train
widdowquinn/pyani
pyani/anib.py
https://github.com/widdowquinn/pyani/blob/2b24ec971401e04024bba896e4011984fe3f53f0/pyani/anib.py#L134-L147
def get_fraglength_dict(fastafiles): """Returns dictionary of sequence fragment lengths, keyed by query name. - fastafiles - list of FASTA input whole sequence files Loops over input files and, for each, produces a dictionary with fragment lengths, keyed by sequence ID. These are returned as a diction...
[ "def", "get_fraglength_dict", "(", "fastafiles", ")", ":", "fraglength_dict", "=", "{", "}", "for", "filename", "in", "fastafiles", ":", "qname", "=", "os", ".", "path", ".", "split", "(", "filename", ")", "[", "-", "1", "]", ".", "split", "(", "\"-fra...
Returns dictionary of sequence fragment lengths, keyed by query name. - fastafiles - list of FASTA input whole sequence files Loops over input files and, for each, produces a dictionary with fragment lengths, keyed by sequence ID. These are returned as a dictionary with the keys being query IDs derive...
[ "Returns", "dictionary", "of", "sequence", "fragment", "lengths", "keyed", "by", "query", "name", "." ]
python
train
datadesk/python-documentcloud
documentcloud/__init__.py
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L1154-L1163
def get_document(self, id): """ Retrieves a particular document from this project. """ obj_list = self.document_list matches = [i for i in obj_list if str(i.id) == str(id)] if not matches: raise DoesNotExistError("The resource you've requested does not \ exist...
[ "def", "get_document", "(", "self", ",", "id", ")", ":", "obj_list", "=", "self", ".", "document_list", "matches", "=", "[", "i", "for", "i", "in", "obj_list", "if", "str", "(", "i", ".", "id", ")", "==", "str", "(", "id", ")", "]", "if", "not", ...
Retrieves a particular document from this project.
[ "Retrieves", "a", "particular", "document", "from", "this", "project", "." ]
python
train
QInfer/python-qinfer
src/qinfer/tomography/plotting_tools.py
https://github.com/QInfer/python-qinfer/blob/8170c84a0be1723f8c6b09e0d3c7a40a886f1fe3/src/qinfer/tomography/plotting_tools.py#L156-L202
def plot_rebit_prior(prior, rebit_axes=REBIT_AXES, n_samples=2000, true_state=None, true_size=250, force_mean=None, legend=True, mean_color_index=2 ): """ Plots rebit states drawn from a given prior. :param qinfer.tomography.DensityOperatorDistribution prior: Distributio...
[ "def", "plot_rebit_prior", "(", "prior", ",", "rebit_axes", "=", "REBIT_AXES", ",", "n_samples", "=", "2000", ",", "true_state", "=", "None", ",", "true_size", "=", "250", ",", "force_mean", "=", "None", ",", "legend", "=", "True", ",", "mean_color_index", ...
Plots rebit states drawn from a given prior. :param qinfer.tomography.DensityOperatorDistribution prior: Distribution over rebit states to plot. :param list rebit_axes: List containing indices for the :math:`x` and :math:`z` axes. :param int n_samples: Number of samples to draw from the ...
[ "Plots", "rebit", "states", "drawn", "from", "a", "given", "prior", "." ]
python
train
pandas-dev/pandas
pandas/io/pytables.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L765-L846
def select_as_multiple(self, keys, where=None, selector=None, columns=None, start=None, stop=None, iterator=False, chunksize=None, auto_close=False, **kwargs): """ Retrieve pandas objects from multiple tables Parameters ---------- ke...
[ "def", "select_as_multiple", "(", "self", ",", "keys", ",", "where", "=", "None", ",", "selector", "=", "None", ",", "columns", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "iterator", "=", "False", ",", "chunksize", "=", "N...
Retrieve pandas objects from multiple tables Parameters ---------- keys : a list of the tables selector : the table to apply the where criteria (defaults to keys[0] if not supplied) columns : the columns I want back start : integer (defaults to None), row num...
[ "Retrieve", "pandas", "objects", "from", "multiple", "tables" ]
python
train
sibirrer/lenstronomy
lenstronomy/LensModel/Profiles/spep.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/spep.py#L20-L47
def function(self, x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0): """ :param x: set of x-coordinates :type x: array of size (n) :param theta_E: Einstein radius of lense :type theta_E: float. :param gamma: power law slope of mass profifle :type gamma: <2 fl...
[ "def", "function", "(", "self", ",", "x", ",", "y", ",", "theta_E", ",", "gamma", ",", "e1", ",", "e2", ",", "center_x", "=", "0", ",", "center_y", "=", "0", ")", ":", "phi_G", ",", "q", "=", "param_util", ".", "ellipticity2phi_q", "(", "e1", ","...
:param x: set of x-coordinates :type x: array of size (n) :param theta_E: Einstein radius of lense :type theta_E: float. :param gamma: power law slope of mass profifle :type gamma: <2 float :param q: Axis ratio :type q: 0<q<1 :param phi_G: position angel o...
[ ":", "param", "x", ":", "set", "of", "x", "-", "coordinates", ":", "type", "x", ":", "array", "of", "size", "(", "n", ")", ":", "param", "theta_E", ":", "Einstein", "radius", "of", "lense", ":", "type", "theta_E", ":", "float", ".", ":", "param", ...
python
train
kgiusti/pyngus
pyngus/connection.py
https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/connection.py#L461-L533
def process(self, now): """Perform connection state processing.""" if self._pn_connection is None: LOG.error("Connection.process() called on destroyed connection!") return 0 # do nothing until the connection has been opened if self._pn_connection.state & proton.E...
[ "def", "process", "(", "self", ",", "now", ")", ":", "if", "self", ".", "_pn_connection", "is", "None", ":", "LOG", ".", "error", "(", "\"Connection.process() called on destroyed connection!\"", ")", "return", "0", "# do nothing until the connection has been opened", ...
Perform connection state processing.
[ "Perform", "connection", "state", "processing", "." ]
python
test
steffann/pylisp
pylisp/packet/ip/udp.py
https://github.com/steffann/pylisp/blob/907340f0c7ef2c4d4fe0c8e0a48df5be0d969407/pylisp/packet/ip/udp.py#L26-L39
def sanitize(self): ''' Check if the current settings conform to the RFC and fix where possible ''' # Check ports if not isinstance(self.source_port, numbers.Integral) \ or self.source_port < 0 \ or self.source_port >= 2 ** 16: raise ValueError('Invali...
[ "def", "sanitize", "(", "self", ")", ":", "# Check ports", "if", "not", "isinstance", "(", "self", ".", "source_port", ",", "numbers", ".", "Integral", ")", "or", "self", ".", "source_port", "<", "0", "or", "self", ".", "source_port", ">=", "2", "**", ...
Check if the current settings conform to the RFC and fix where possible
[ "Check", "if", "the", "current", "settings", "conform", "to", "the", "RFC", "and", "fix", "where", "possible" ]
python
train
rsalmei/clearly
clearly/server.py
https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/server.py#L148-L154
def find_task(self, request, context): """Finds one specific task.""" _log_request(request, context) task = self.listener.memory.tasks.get(request.task_uuid) if not task: return clearly_pb2.TaskMessage() return ClearlyServer._event_to_pb(task)[1]
[ "def", "find_task", "(", "self", ",", "request", ",", "context", ")", ":", "_log_request", "(", "request", ",", "context", ")", "task", "=", "self", ".", "listener", ".", "memory", ".", "tasks", ".", "get", "(", "request", ".", "task_uuid", ")", "if", ...
Finds one specific task.
[ "Finds", "one", "specific", "task", "." ]
python
train
poppy-project/pypot
pypot/vrep/remoteApiBindings/vrep.py
https://github.com/poppy-project/pypot/blob/d9c6551bbc87d45d9d1f0bc15e35b616d0002afd/pypot/vrep/remoteApiBindings/vrep.py#L1432-L1446
def simxPackInts(intList): ''' Please have a look at the function description/documentation in the V-REP user manual ''' if sys.version_info[0] == 3: s=bytes() for i in range(len(intList)): s=s+struct.pack('<i',intList[i]) s=bytearray(s) else: s='' ...
[ "def", "simxPackInts", "(", "intList", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "==", "3", ":", "s", "=", "bytes", "(", ")", "for", "i", "in", "range", "(", "len", "(", "intList", ")", ")", ":", "s", "=", "s", "+", "struct", ...
Please have a look at the function description/documentation in the V-REP user manual
[ "Please", "have", "a", "look", "at", "the", "function", "description", "/", "documentation", "in", "the", "V", "-", "REP", "user", "manual" ]
python
train
QInfer/python-qinfer
src/qinfer/tomography/bases.py
https://github.com/QInfer/python-qinfer/blob/8170c84a0be1723f8c6b09e0d3c7a40a886f1fe3/src/qinfer/tomography/bases.py#L323-L336
def state_to_modelparams(self, state): """ Converts a QuTiP-represented state into a model parameter vector. :param qutip.Qobj state: State to be converted. :rtype: :class:`np.ndarray` :return: The representation of the given state in this basis, as a vector of real ...
[ "def", "state_to_modelparams", "(", "self", ",", "state", ")", ":", "basis", "=", "self", ".", "flat", "(", ")", "data", "=", "state", ".", "data", ".", "todense", "(", ")", ".", "view", "(", "np", ".", "ndarray", ")", ".", "flatten", "(", ")", "...
Converts a QuTiP-represented state into a model parameter vector. :param qutip.Qobj state: State to be converted. :rtype: :class:`np.ndarray` :return: The representation of the given state in this basis, as a vector of real parameters.
[ "Converts", "a", "QuTiP", "-", "represented", "state", "into", "a", "model", "parameter", "vector", "." ]
python
train
marten-de-vries/Flask-WebSub
flask_websub/hub/__init__.py
https://github.com/marten-de-vries/Flask-WebSub/blob/422d5b597245554c47e881483f99cae7c57a81ba/flask_websub/hub/__init__.py#L66-L103
def init_celery(self, celery): """Registers the celery tasks on the hub object.""" count = next(self.counter) def task_with_hub(f, **opts): @functools.wraps(f) def wrapper(*args, **kwargs): return f(self, *args, **kwargs) # Make sure newer in...
[ "def", "init_celery", "(", "self", ",", "celery", ")", ":", "count", "=", "next", "(", "self", ".", "counter", ")", "def", "task_with_hub", "(", "f", ",", "*", "*", "opts", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", ...
Registers the celery tasks on the hub object.
[ "Registers", "the", "celery", "tasks", "on", "the", "hub", "object", "." ]
python
train
aio-libs/aioredis
aioredis/commands/hash.py
https://github.com/aio-libs/aioredis/blob/e8c33e39558d4cc91cf70dde490d8b330c97dc2e/aioredis/commands/hash.py#L104-L106
def hset(self, key, field, value): """Set the string value of a hash field.""" return self.execute(b'HSET', key, field, value)
[ "def", "hset", "(", "self", ",", "key", ",", "field", ",", "value", ")", ":", "return", "self", ".", "execute", "(", "b'HSET'", ",", "key", ",", "field", ",", "value", ")" ]
Set the string value of a hash field.
[ "Set", "the", "string", "value", "of", "a", "hash", "field", "." ]
python
train
ihmeuw/vivarium
src/vivarium/framework/results_writer.py
https://github.com/ihmeuw/vivarium/blob/c5f5d50f775c8bf337d3aae1ff7c57c025a8e258/src/vivarium/framework/results_writer.py#L50-L79
def write_output(self, data, file_name, key=None): """Writes output data to disk. Parameters ---------- data: pandas.DataFrame or dict The data to write to disk. file_name: str The name of the file to write. key: str, optional The look...
[ "def", "write_output", "(", "self", ",", "data", ",", "file_name", ",", "key", "=", "None", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_directories", "[", "key", "]", ",", "file_name", ")", "extension", "=", "file_name"...
Writes output data to disk. Parameters ---------- data: pandas.DataFrame or dict The data to write to disk. file_name: str The name of the file to write. key: str, optional The lookup key for the sub_directory to write results to, if any.
[ "Writes", "output", "data", "to", "disk", "." ]
python
train
juju/python-libjuju
juju/utils.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/utils.py#L88-L115
async def run_with_interrupt(task, *events, loop=None): """ Awaits a task while allowing it to be interrupted by one or more `asyncio.Event`s. If the task finishes without the events becoming set, the results of the task will be returned. If the event become set, the task will be cancelled ``N...
[ "async", "def", "run_with_interrupt", "(", "task", ",", "*", "events", ",", "loop", "=", "None", ")", ":", "loop", "=", "loop", "or", "asyncio", ".", "get_event_loop", "(", ")", "task", "=", "asyncio", ".", "ensure_future", "(", "task", ",", "loop", "=...
Awaits a task while allowing it to be interrupted by one or more `asyncio.Event`s. If the task finishes without the events becoming set, the results of the task will be returned. If the event become set, the task will be cancelled ``None`` will be returned. :param task: Task to run :param eve...
[ "Awaits", "a", "task", "while", "allowing", "it", "to", "be", "interrupted", "by", "one", "or", "more", "asyncio", ".", "Event", "s", "." ]
python
train
rvswift/EB
EB/builder/postanalysis/postanalysis_io.py
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/postanalysis/postanalysis_io.py#L27-L92
def print_extended_help(): """ print a detailed help message :return: """ w = textwrap.TextWrapper() w.expand_tabs = False w.width = 85 w.initial_indent = '\t' w.subsequent_indent = '\t ' print('') print(textwrap.fill("<postanalyze> Complete parameter list:", initial_indent...
[ "def", "print_extended_help", "(", ")", ":", "w", "=", "textwrap", ".", "TextWrapper", "(", ")", "w", ".", "expand_tabs", "=", "False", "w", ".", "width", "=", "85", "w", ".", "initial_indent", "=", "'\\t'", "w", ".", "subsequent_indent", "=", "'\\t '",...
print a detailed help message :return:
[ "print", "a", "detailed", "help", "message", ":", "return", ":" ]
python
train
SheffieldML/GPy
GPy/plotting/gpy_plot/gp_plots.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/gp_plots.py#L222-L258
def plot_density(self, plot_limits=None, fixed_inputs=None, resolution=None, plot_raw=False, apply_link=False, visible_dims=None, which_data_ycols='all', levels=35, label='gp density', predict_kw=None, **kwargs): """ Plot the co...
[ "def", "plot_density", "(", "self", ",", "plot_limits", "=", "None", ",", "fixed_inputs", "=", "None", ",", "resolution", "=", "None", ",", "plot_raw", "=", "False", ",", "apply_link", "=", "False", ",", "visible_dims", "=", "None", ",", "which_data_ycols", ...
Plot the confidence interval between the percentiles lower and upper. E.g. the 95% confidence interval is $2.5, 97.5$. Note: Only implemented for one dimension! You can deactivate the legend for this one plot by supplying None to label. Give the Y_metadata in the predict_kw if you need it. :param...
[ "Plot", "the", "confidence", "interval", "between", "the", "percentiles", "lower", "and", "upper", ".", "E", ".", "g", ".", "the", "95%", "confidence", "interval", "is", "$2", ".", "5", "97", ".", "5$", ".", "Note", ":", "Only", "implemented", "for", "...
python
train
helixyte/everest
everest/url.py
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/url.py#L161-L170
def make_filter_string(cls, filter_specification): """ Converts the given filter specification to a CQL filter expression. """ registry = get_current_registry() visitor_cls = registry.getUtility(IFilterSpecificationVisitor, name=EXPRESSIO...
[ "def", "make_filter_string", "(", "cls", ",", "filter_specification", ")", ":", "registry", "=", "get_current_registry", "(", ")", "visitor_cls", "=", "registry", ".", "getUtility", "(", "IFilterSpecificationVisitor", ",", "name", "=", "EXPRESSION_KINDS", ".", "CQL"...
Converts the given filter specification to a CQL filter expression.
[ "Converts", "the", "given", "filter", "specification", "to", "a", "CQL", "filter", "expression", "." ]
python
train
orb-framework/orb
orb/core/query.py
https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L994-L1013
def lessThan(self, value): """ Sets the operator type to Query.Op.LessThan and sets the value to the inputted value. :param value <variant> :return <Query> :sa lessThan :usage |>>> from orb import Que...
[ "def", "lessThan", "(", "self", ",", "value", ")", ":", "newq", "=", "self", ".", "copy", "(", ")", "newq", ".", "setOp", "(", "Query", ".", "Op", ".", "LessThan", ")", "newq", ".", "setValue", "(", "value", ")", "return", "newq" ]
Sets the operator type to Query.Op.LessThan and sets the value to the inputted value. :param value <variant> :return <Query> :sa lessThan :usage |>>> from orb import Query as Q |>>> query = Q('tes...
[ "Sets", "the", "operator", "type", "to", "Query", ".", "Op", ".", "LessThan", "and", "sets", "the", "value", "to", "the", "inputted", "value", ".", ":", "param", "value", "<variant", ">", ":", "return", "<Query", ">", ":", "sa", "lessThan", ":", "usage...
python
train
getsentry/rb
rb/cluster.py
https://github.com/getsentry/rb/blob/569d1d13311f6c04bae537fc17e75da430e4ec45/rb/cluster.py#L147-L152
def disconnect_pools(self): """Disconnects all connections from the internal pools.""" with self._lock: for pool in self._pools.itervalues(): pool.disconnect() self._pools.clear()
[ "def", "disconnect_pools", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "for", "pool", "in", "self", ".", "_pools", ".", "itervalues", "(", ")", ":", "pool", ".", "disconnect", "(", ")", "self", ".", "_pools", ".", "clear", "(", ")" ]
Disconnects all connections from the internal pools.
[ "Disconnects", "all", "connections", "from", "the", "internal", "pools", "." ]
python
train
CleanCut/green
green/loader.py
https://github.com/CleanCut/green/blob/6434515302472363b7d10135be76ed8cd3934d80/green/loader.py#L333-L375
def toParallelTargets(suite, targets): """ Produce a list of targets which should be tested in parallel. For the most part this will be a list of test modules. The exception is when a dotted name representing something more granular than a module was input (like an individal test case or test meth...
[ "def", "toParallelTargets", "(", "suite", ",", "targets", ")", ":", "targets", "=", "filter", "(", "lambda", "x", ":", "x", "!=", "'.'", ",", "targets", ")", "# First, convert the suite to a proto test list - proto tests nicely", "# parse things like the fully dotted name...
Produce a list of targets which should be tested in parallel. For the most part this will be a list of test modules. The exception is when a dotted name representing something more granular than a module was input (like an individal test case or test method)
[ "Produce", "a", "list", "of", "targets", "which", "should", "be", "tested", "in", "parallel", "." ]
python
train