partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
_StructMessageToJsonObject
Converts Struct message according to Proto3 JSON Specification.
typy/google/protobuf/json_format.py
def _StructMessageToJsonObject(message, unused_including_default=False): """Converts Struct message according to Proto3 JSON Specification.""" fields = message.fields ret = {} for key in fields: ret[key] = _ValueMessageToJsonObject(fields[key]) return ret
def _StructMessageToJsonObject(message, unused_including_default=False): """Converts Struct message according to Proto3 JSON Specification.""" fields = message.fields ret = {} for key in fields: ret[key] = _ValueMessageToJsonObject(fields[key]) return ret
[ "Converts", "Struct", "message", "according", "to", "Proto3", "JSON", "Specification", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L271-L277
[ "def", "_StructMessageToJsonObject", "(", "message", ",", "unused_including_default", "=", "False", ")", ":", "fields", "=", "message", ".", "fields", "ret", "=", "{", "}", "for", "key", "in", "fields", ":", "ret", "[", "key", "]", "=", "_ValueMessageToJsonO...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
Parse
Parses a JSON representation of a protocol message into a message. Args: text: Message JSON representation. message: A protocol beffer message to merge into. Returns: The same message passed as argument. Raises:: ParseError: On JSON parsing problems.
typy/google/protobuf/json_format.py
def Parse(text, message): """Parses a JSON representation of a protocol message into a message. Args: text: Message JSON representation. message: A protocol beffer message to merge into. Returns: The same message passed as argument. Raises:: ParseError: On JSON parsing problems. """ if no...
def Parse(text, message): """Parses a JSON representation of a protocol message into a message. Args: text: Message JSON representation. message: A protocol beffer message to merge into. Returns: The same message passed as argument. Raises:: ParseError: On JSON parsing problems. """ if no...
[ "Parses", "a", "JSON", "representation", "of", "a", "protocol", "message", "into", "a", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L298-L321
[ "def", "Parse", "(", "text", ",", "message", ")", ":", "if", "not", "isinstance", "(", "text", ",", "six", ".", "text_type", ")", ":", "text", "=", "text", ".", "decode", "(", "'utf-8'", ")", "try", ":", "if", "sys", ".", "version_info", "<", "(", ...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_ConvertFieldValuePair
Convert field value pairs into regular message. Args: js: A JSON object to convert the field value pairs. message: A regular protocol message to record the data. Raises: ParseError: In case of problems converting.
typy/google/protobuf/json_format.py
def _ConvertFieldValuePair(js, message): """Convert field value pairs into regular message. Args: js: A JSON object to convert the field value pairs. message: A regular protocol message to record the data. Raises: ParseError: In case of problems converting. """ names = [] message_descriptor = ...
def _ConvertFieldValuePair(js, message): """Convert field value pairs into regular message. Args: js: A JSON object to convert the field value pairs. message: A regular protocol message to record the data. Raises: ParseError: In case of problems converting. """ names = [] message_descriptor = ...
[ "Convert", "field", "value", "pairs", "into", "regular", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L324-L402
[ "def", "_ConvertFieldValuePair", "(", "js", ",", "message", ")", ":", "names", "=", "[", "]", "message_descriptor", "=", "message", ".", "DESCRIPTOR", "for", "name", "in", "js", ":", "try", ":", "field", "=", "message_descriptor", ".", "fields_by_camelcase_nam...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_ConvertMessage
Convert a JSON object into a message. Args: value: A JSON object. message: A WKT or regular protocol message to record the data. Raises: ParseError: In case of convert problems.
typy/google/protobuf/json_format.py
def _ConvertMessage(value, message): """Convert a JSON object into a message. Args: value: A JSON object. message: A WKT or regular protocol message to record the data. Raises: ParseError: In case of convert problems. """ message_descriptor = message.DESCRIPTOR full_name = message_descriptor.f...
def _ConvertMessage(value, message): """Convert a JSON object into a message. Args: value: A JSON object. message: A WKT or regular protocol message to record the data. Raises: ParseError: In case of convert problems. """ message_descriptor = message.DESCRIPTOR full_name = message_descriptor.f...
[ "Convert", "a", "JSON", "object", "into", "a", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L405-L422
[ "def", "_ConvertMessage", "(", "value", ",", "message", ")", ":", "message_descriptor", "=", "message", ".", "DESCRIPTOR", "full_name", "=", "message_descriptor", ".", "full_name", "if", "_IsWrapperMessage", "(", "message_descriptor", ")", ":", "_ConvertWrapperMessage...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_ConvertValueMessage
Convert a JSON representation into Value message.
typy/google/protobuf/json_format.py
def _ConvertValueMessage(value, message): """Convert a JSON representation into Value message.""" if isinstance(value, dict): _ConvertStructMessage(value, message.struct_value) elif isinstance(value, list): _ConvertListValueMessage(value, message.list_value) elif value is None: message.null_value = ...
def _ConvertValueMessage(value, message): """Convert a JSON representation into Value message.""" if isinstance(value, dict): _ConvertStructMessage(value, message.struct_value) elif isinstance(value, list): _ConvertListValueMessage(value, message.list_value) elif value is None: message.null_value = ...
[ "Convert", "a", "JSON", "representation", "into", "Value", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L459-L474
[ "def", "_ConvertValueMessage", "(", "value", ",", "message", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "_ConvertStructMessage", "(", "value", ",", "message", ".", "struct_value", ")", "elif", "isinstance", "(", "value", ",", "list", ...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_ConvertListValueMessage
Convert a JSON representation into ListValue message.
typy/google/protobuf/json_format.py
def _ConvertListValueMessage(value, message): """Convert a JSON representation into ListValue message.""" if not isinstance(value, list): raise ParseError( 'ListValue must be in [] which is {0}.'.format(value)) message.ClearField('values') for item in value: _ConvertValueMessage(item, message.va...
def _ConvertListValueMessage(value, message): """Convert a JSON representation into ListValue message.""" if not isinstance(value, list): raise ParseError( 'ListValue must be in [] which is {0}.'.format(value)) message.ClearField('values') for item in value: _ConvertValueMessage(item, message.va...
[ "Convert", "a", "JSON", "representation", "into", "ListValue", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L477-L484
[ "def", "_ConvertListValueMessage", "(", "value", ",", "message", ")", ":", "if", "not", "isinstance", "(", "value", ",", "list", ")", ":", "raise", "ParseError", "(", "'ListValue must be in [] which is {0}.'", ".", "format", "(", "value", ")", ")", "message", ...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_ConvertStructMessage
Convert a JSON representation into Struct message.
typy/google/protobuf/json_format.py
def _ConvertStructMessage(value, message): """Convert a JSON representation into Struct message.""" if not isinstance(value, dict): raise ParseError( 'Struct must be in a dict which is {0}.'.format(value)) for key in value: _ConvertValueMessage(value[key], message.fields[key]) return
def _ConvertStructMessage(value, message): """Convert a JSON representation into Struct message.""" if not isinstance(value, dict): raise ParseError( 'Struct must be in a dict which is {0}.'.format(value)) for key in value: _ConvertValueMessage(value[key], message.fields[key]) return
[ "Convert", "a", "JSON", "representation", "into", "Struct", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L487-L494
[ "def", "_ConvertStructMessage", "(", "value", ",", "message", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "ParseError", "(", "'Struct must be in a dict which is {0}.'", ".", "format", "(", "value", ")", ")", "for", "key",...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
update_config
Update config options with the provided dictionary of options.
nbserve/app.py
def update_config(new_config): """ Update config options with the provided dictionary of options. """ flask_app.base_config.update(new_config) # Check for changed working directory. if new_config.has_key('working_directory'): wd = os.path.abspath(new_config['working_directory']) if ...
def update_config(new_config): """ Update config options with the provided dictionary of options. """ flask_app.base_config.update(new_config) # Check for changed working directory. if new_config.has_key('working_directory'): wd = os.path.abspath(new_config['working_directory']) if ...
[ "Update", "config", "options", "with", "the", "provided", "dictionary", "of", "options", "." ]
robchambers/nbserve
python
https://github.com/robchambers/nbserve/blob/74d820fdd5dd7cdaafae22698dcba9487974bcc5/nbserve/app.py#L62-L73
[ "def", "update_config", "(", "new_config", ")", ":", "flask_app", ".", "base_config", ".", "update", "(", "new_config", ")", "# Check for changed working directory.", "if", "new_config", ".", "has_key", "(", "'working_directory'", ")", ":", "wd", "=", "os", ".", ...
74d820fdd5dd7cdaafae22698dcba9487974bcc5
valid
set_config
Reset config options to defaults, and then update (optionally) with the provided dictionary of options.
nbserve/app.py
def set_config(new_config={}): """ Reset config options to defaults, and then update (optionally) with the provided dictionary of options. """ # The default base configuration. flask_app.base_config = dict(working_directory='.', template='collapse-input', ...
def set_config(new_config={}): """ Reset config options to defaults, and then update (optionally) with the provided dictionary of options. """ # The default base configuration. flask_app.base_config = dict(working_directory='.', template='collapse-input', ...
[ "Reset", "config", "options", "to", "defaults", "and", "then", "update", "(", "optionally", ")", "with", "the", "provided", "dictionary", "of", "options", "." ]
robchambers/nbserve
python
https://github.com/robchambers/nbserve/blob/74d820fdd5dd7cdaafae22698dcba9487974bcc5/nbserve/app.py#L76-L84
[ "def", "set_config", "(", "new_config", "=", "{", "}", ")", ":", "# The default base configuration.", "flask_app", ".", "base_config", "=", "dict", "(", "working_directory", "=", "'.'", ",", "template", "=", "'collapse-input'", ",", "debug", "=", "False", ",", ...
74d820fdd5dd7cdaafae22698dcba9487974bcc5
valid
Command.execute
Executes the command given specific arguments as an input. Args: correlation_id: a unique correlation/transaction id args: command arguments Returns: an execution result. Raises: ApplicationException: when execution fails fo...
pip_services_commons/commands/Command.py
def execute(self, correlation_id, args): """ Executes the command given specific arguments as an input. Args: correlation_id: a unique correlation/transaction id args: command arguments Returns: an execution result. Rai...
def execute(self, correlation_id, args): """ Executes the command given specific arguments as an input. Args: correlation_id: a unique correlation/transaction id args: command arguments Returns: an execution result. Rai...
[ "Executes", "the", "command", "given", "specific", "arguments", "as", "an", "input", ".", "Args", ":", "correlation_id", ":", "a", "unique", "correlation", "/", "transaction", "id", "args", ":", "command", "arguments", "Returns", ":", "an", "execution", "resul...
pip-services/pip-services-commons-python
python
https://github.com/pip-services/pip-services-commons-python/blob/2205b18c45c60372966c62c1f23ac4fbc31e11b3/pip_services_commons/commands/Command.py#L50-L76
[ "def", "execute", "(", "self", ",", "correlation_id", ",", "args", ")", ":", "# Validate arguments\r", "if", "self", ".", "_schema", "!=", "None", ":", "self", ".", "validate_and_throw_exception", "(", "correlation_id", ",", "args", ")", "# Call the function\r", ...
2205b18c45c60372966c62c1f23ac4fbc31e11b3
valid
optimize
**Optimization method based on Brent's method** First, a bracket (a b c) is sought that contains the minimum (b value is smaller than both a or c). The bracket is then recursively halfed. Here we apply some modifications to ensure our suggested point is not too close to either a or c, because that could be pr...
jbopt/optimize1d.py
def optimize(function, x0, cons=[], ftol=0.2, disp=0, plot=False): """ **Optimization method based on Brent's method** First, a bracket (a b c) is sought that contains the minimum (b value is smaller than both a or c). The bracket is then recursively halfed. Here we apply some modifications to ensure our sug...
def optimize(function, x0, cons=[], ftol=0.2, disp=0, plot=False): """ **Optimization method based on Brent's method** First, a bracket (a b c) is sought that contains the minimum (b value is smaller than both a or c). The bracket is then recursively halfed. Here we apply some modifications to ensure our sug...
[ "**", "Optimization", "method", "based", "on", "Brent", "s", "method", "**", "First", "a", "bracket", "(", "a", "b", "c", ")", "is", "sought", "that", "contains", "the", "minimum", "(", "b", "value", "is", "smaller", "than", "both", "a", "or", "c", "...
JohannesBuchner/jbopt
python
https://github.com/JohannesBuchner/jbopt/blob/11b721ea001625ad7820f71ff684723c71216646/jbopt/optimize1d.py#L270-L322
[ "def", "optimize", "(", "function", ",", "x0", ",", "cons", "=", "[", "]", ",", "ftol", "=", "0.2", ",", "disp", "=", "0", ",", "plot", "=", "False", ")", ":", "if", "disp", ">", "0", ":", "print", "print", "' ===== custom 1d optimization routine ====...
11b721ea001625ad7820f71ff684723c71216646
valid
cache2errors
This function will attempt to identify 1 sigma errors, assuming your function is a chi^2. For this, the 1-sigma is bracketed. If you were smart enough to build a cache list of [x,y] into your function, you can pass it here. The values bracketing 1 sigma will be used as starting values. If no such values exist, ...
jbopt/optimize1d.py
def cache2errors(function, cache, disp=0, ftol=0.05): """ This function will attempt to identify 1 sigma errors, assuming your function is a chi^2. For this, the 1-sigma is bracketed. If you were smart enough to build a cache list of [x,y] into your function, you can pass it here. The values bracketing 1 sigma w...
def cache2errors(function, cache, disp=0, ftol=0.05): """ This function will attempt to identify 1 sigma errors, assuming your function is a chi^2. For this, the 1-sigma is bracketed. If you were smart enough to build a cache list of [x,y] into your function, you can pass it here. The values bracketing 1 sigma w...
[ "This", "function", "will", "attempt", "to", "identify", "1", "sigma", "errors", "assuming", "your", "function", "is", "a", "chi^2", ".", "For", "this", "the", "1", "-", "sigma", "is", "bracketed", ".", "If", "you", "were", "smart", "enough", "to", "buil...
JohannesBuchner/jbopt
python
https://github.com/JohannesBuchner/jbopt/blob/11b721ea001625ad7820f71ff684723c71216646/jbopt/optimize1d.py#L324-L415
[ "def", "cache2errors", "(", "function", ",", "cache", ",", "disp", "=", "0", ",", "ftol", "=", "0.05", ")", ":", "vals", "=", "numpy", ".", "array", "(", "sorted", "(", "cache", ",", "key", "=", "lambda", "x", ":", "x", "[", "0", "]", ")", ")",...
11b721ea001625ad7820f71ff684723c71216646
valid
Timing.end_timing
Completes measuring time interval and updates counter.
pip_services_commons/count/Timing.py
def end_timing(self): """ Completes measuring time interval and updates counter. """ if self._callback != None: elapsed = time.clock() * 1000 - self._start self._callback.end_timing(self._counter, elapsed)
def end_timing(self): """ Completes measuring time interval and updates counter. """ if self._callback != None: elapsed = time.clock() * 1000 - self._start self._callback.end_timing(self._counter, elapsed)
[ "Completes", "measuring", "time", "interval", "and", "updates", "counter", "." ]
pip-services/pip-services-commons-python
python
https://github.com/pip-services/pip-services-commons-python/blob/2205b18c45c60372966c62c1f23ac4fbc31e11b3/pip_services_commons/count/Timing.py#L37-L44
[ "def", "end_timing", "(", "self", ")", ":", "if", "self", ".", "_callback", "!=", "None", ":", "elapsed", "=", "time", ".", "clock", "(", ")", "*", "1000", "-", "self", ".", "_start", "self", ".", "_callback", ".", "end_timing", "(", "self", ".", "...
2205b18c45c60372966c62c1f23ac4fbc31e11b3
valid
Duration.ToJsonString
Converts Duration to string format. Returns: A string converted from self. The string format will contains 3, 6, or 9 fractional digits depending on the precision required to represent the exact Duration value. For example: "1s", "1.010s", "1.000000100s", "-3.100s"
typy/google/protobuf/internal/well_known_types.py
def ToJsonString(self): """Converts Duration to string format. Returns: A string converted from self. The string format will contains 3, 6, or 9 fractional digits depending on the precision required to represent the exact Duration value. For example: "1s", "1.010s", "1.000000100s", "-3....
def ToJsonString(self): """Converts Duration to string format. Returns: A string converted from self. The string format will contains 3, 6, or 9 fractional digits depending on the precision required to represent the exact Duration value. For example: "1s", "1.010s", "1.000000100s", "-3....
[ "Converts", "Duration", "to", "string", "format", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/internal/well_known_types.py#L241-L270
[ "def", "ToJsonString", "(", "self", ")", ":", "if", "self", ".", "seconds", "<", "0", "or", "self", ".", "nanos", "<", "0", ":", "result", "=", "'-'", "seconds", "=", "-", "self", ".", "seconds", "+", "int", "(", "(", "0", "-", "self", ".", "na...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
Duration.FromJsonString
Converts a string to Duration. Args: value: A string to be converted. The string must end with 's'. Any fractional digits (or none) are accepted as long as they fit into precision. For example: "1s", "1.01s", "1.0000001s", "-3.100s Raises: ParseError: On parsing problems.
typy/google/protobuf/internal/well_known_types.py
def FromJsonString(self, value): """Converts a string to Duration. Args: value: A string to be converted. The string must end with 's'. Any fractional digits (or none) are accepted as long as they fit into precision. For example: "1s", "1.01s", "1.0000001s", "-3.100s Raises: ...
def FromJsonString(self, value): """Converts a string to Duration. Args: value: A string to be converted. The string must end with 's'. Any fractional digits (or none) are accepted as long as they fit into precision. For example: "1s", "1.01s", "1.0000001s", "-3.100s Raises: ...
[ "Converts", "a", "string", "to", "Duration", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/internal/well_known_types.py#L272-L299
[ "def", "FromJsonString", "(", "self", ",", "value", ")", ":", "if", "len", "(", "value", ")", "<", "1", "or", "value", "[", "-", "1", "]", "!=", "'s'", ":", "raise", "ParseError", "(", "'Duration must end with letter \"s\": {0}.'", ".", "format", "(", "v...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
FieldMask.FromJsonString
Converts string to FieldMask according to proto3 JSON spec.
typy/google/protobuf/internal/well_known_types.py
def FromJsonString(self, value): """Converts string to FieldMask according to proto3 JSON spec.""" self.Clear() for path in value.split(','): self.paths.append(path)
def FromJsonString(self, value): """Converts string to FieldMask according to proto3 JSON spec.""" self.Clear() for path in value.split(','): self.paths.append(path)
[ "Converts", "string", "to", "FieldMask", "according", "to", "proto3", "JSON", "spec", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/internal/well_known_types.py#L384-L388
[ "def", "FromJsonString", "(", "self", ",", "value", ")", ":", "self", ".", "Clear", "(", ")", "for", "path", "in", "value", ".", "split", "(", "','", ")", ":", "self", ".", "paths", ".", "append", "(", "path", ")" ]
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
get_doc
Return a CouchDB document, given its ID, revision and database name.
relax/couchdb/shortcuts.py
def get_doc(doc_id, db_name, server_url='http://127.0.0.1:5984/', rev=None): """Return a CouchDB document, given its ID, revision and database name.""" db = get_server(server_url)[db_name] if rev: headers, response = db.resource.get(doc_id, rev=rev) return couchdb.client.Document(response) ...
def get_doc(doc_id, db_name, server_url='http://127.0.0.1:5984/', rev=None): """Return a CouchDB document, given its ID, revision and database name.""" db = get_server(server_url)[db_name] if rev: headers, response = db.resource.get(doc_id, rev=rev) return couchdb.client.Document(response) ...
[ "Return", "a", "CouchDB", "document", "given", "its", "ID", "revision", "and", "database", "name", "." ]
zvoase/django-relax
python
https://github.com/zvoase/django-relax/blob/10bb37bf3a512b290816856a6877c17fa37e930f/relax/couchdb/shortcuts.py#L20-L26
[ "def", "get_doc", "(", "doc_id", ",", "db_name", ",", "server_url", "=", "'http://127.0.0.1:5984/'", ",", "rev", "=", "None", ")", ":", "db", "=", "get_server", "(", "server_url", ")", "[", "db_name", "]", "if", "rev", ":", "headers", ",", "response", "=...
10bb37bf3a512b290816856a6877c17fa37e930f
valid
get_or_create_db
Return an (optionally existing) CouchDB database instance.
relax/couchdb/shortcuts.py
def get_or_create_db(db_name, server_url='http://127.0.0.1:5984/'): """Return an (optionally existing) CouchDB database instance.""" server = get_server(server_url) if db_name in server: return server[db_name] return server.create(db_name)
def get_or_create_db(db_name, server_url='http://127.0.0.1:5984/'): """Return an (optionally existing) CouchDB database instance.""" server = get_server(server_url) if db_name in server: return server[db_name] return server.create(db_name)
[ "Return", "an", "(", "optionally", "existing", ")", "CouchDB", "database", "instance", "." ]
zvoase/django-relax
python
https://github.com/zvoase/django-relax/blob/10bb37bf3a512b290816856a6877c17fa37e930f/relax/couchdb/shortcuts.py#L28-L33
[ "def", "get_or_create_db", "(", "db_name", ",", "server_url", "=", "'http://127.0.0.1:5984/'", ")", ":", "server", "=", "get_server", "(", "server_url", ")", "if", "db_name", "in", "server", ":", "return", "server", "[", "db_name", "]", "return", "server", "."...
10bb37bf3a512b290816856a6877c17fa37e930f
valid
read
Give reST format README for pypi.
setup.py
def read(readme): """Give reST format README for pypi.""" extend = os.path.splitext(readme)[1] if (extend == '.rst'): import codecs return codecs.open(readme, 'r', 'utf-8').read() elif (extend == '.md'): import pypandoc return pypandoc.convert(readme, 'rst')
def read(readme): """Give reST format README for pypi.""" extend = os.path.splitext(readme)[1] if (extend == '.rst'): import codecs return codecs.open(readme, 'r', 'utf-8').read() elif (extend == '.md'): import pypandoc return pypandoc.convert(readme, 'rst')
[ "Give", "reST", "format", "README", "for", "pypi", "." ]
crazy-canux/arguspy
python
https://github.com/crazy-canux/arguspy/blob/e9486b5df61978a990d56bf43de35f3a4cdefcc3/setup.py#L29-L37
[ "def", "read", "(", "readme", ")", ":", "extend", "=", "os", ".", "path", ".", "splitext", "(", "readme", ")", "[", "1", "]", "if", "(", "extend", "==", "'.rst'", ")", ":", "import", "codecs", "return", "codecs", ".", "open", "(", "readme", ",", ...
e9486b5df61978a990d56bf43de35f3a4cdefcc3
valid
main
Register your own mode and handle method here.
scripts/check_mssql.py
def main(): """Register your own mode and handle method here.""" plugin = Register() if plugin.args.option == 'sql': plugin.sql_handle() elif plugin.args.option == 'database-used': plugin.database_used_handle() elif plugin.args.option == 'databaselog-used': plugin.database_lo...
def main(): """Register your own mode and handle method here.""" plugin = Register() if plugin.args.option == 'sql': plugin.sql_handle() elif plugin.args.option == 'database-used': plugin.database_used_handle() elif plugin.args.option == 'databaselog-used': plugin.database_lo...
[ "Register", "your", "own", "mode", "and", "handle", "method", "here", "." ]
crazy-canux/arguspy
python
https://github.com/crazy-canux/arguspy/blob/e9486b5df61978a990d56bf43de35f3a4cdefcc3/scripts/check_mssql.py#L475-L485
[ "def", "main", "(", ")", ":", "plugin", "=", "Register", "(", ")", "if", "plugin", ".", "args", ".", "option", "==", "'sql'", ":", "plugin", ".", "sql_handle", "(", ")", "elif", "plugin", ".", "args", ".", "option", "==", "'database-used'", ":", "plu...
e9486b5df61978a990d56bf43de35f3a4cdefcc3
valid
Parser.parse
:param args: arguments :type args: None or string or list of string :return: formatted arguments if specified else ``self.default_args`` :rtype: list of string
headlessvim/arguments.py
def parse(self, args): """ :param args: arguments :type args: None or string or list of string :return: formatted arguments if specified else ``self.default_args`` :rtype: list of string """ if args is None: args = self._default_args if isinsta...
def parse(self, args): """ :param args: arguments :type args: None or string or list of string :return: formatted arguments if specified else ``self.default_args`` :rtype: list of string """ if args is None: args = self._default_args if isinsta...
[ ":", "param", "args", ":", "arguments", ":", "type", "args", ":", "None", "or", "string", "or", "list", "of", "string", ":", "return", ":", "formatted", "arguments", "if", "specified", "else", "self", ".", "default_args", ":", "rtype", ":", "list", "of",...
manicmaniac/headlessvim
python
https://github.com/manicmaniac/headlessvim/blob/3e4657f95d981ddf21fd285b7e1b9da2154f9cb9/headlessvim/arguments.py#L24-L35
[ "def", "parse", "(", "self", ",", "args", ")", ":", "if", "args", "is", "None", ":", "args", "=", "self", ".", "_default_args", "if", "isinstance", "(", "args", ",", "six", ".", "string_types", ")", ":", "args", "=", "shlex", ".", "split", "(", "ar...
3e4657f95d981ddf21fd285b7e1b9da2154f9cb9
valid
PrivateClient._request
Sends an HTTP request to the REST API and receives the requested data. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argument keywords :returns: requested data :raises APIError: for non-2xx responses
cbexchange/private.py
def _request(self, method, *relative_path_parts, **kwargs): """Sends an HTTP request to the REST API and receives the requested data. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argument keywords :returns: requested data ...
def _request(self, method, *relative_path_parts, **kwargs): """Sends an HTTP request to the REST API and receives the requested data. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argument keywords :returns: requested data ...
[ "Sends", "an", "HTTP", "request", "to", "the", "REST", "API", "and", "receives", "the", "requested", "data", "." ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/private.py#L72-L89
[ "def", "_request", "(", "self", ",", "method", ",", "*", "relative_path_parts", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_create_api_uri", "(", "*", "relative_path_parts", ")", "if", "method", "==", "'get'", ":", "response", "=", "get...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
PrivateClient._place_order
`<https://docs.exchange.coinbase.com/#orders>`_
cbexchange/private.py
def _place_order(self, side, product_id='BTC-USD', client_oid=None, type=None, stp=None, price=None, size=None, funds=None, time_in_force=None, ...
def _place_order(self, side, product_id='BTC-USD', client_oid=None, type=None, stp=None, price=None, size=None, funds=None, time_in_force=None, ...
[ "<https", ":", "//", "docs", ".", "exchange", ".", "coinbase", ".", "com", "/", "#orders", ">", "_" ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/private.py#L107-L133
[ "def", "_place_order", "(", "self", ",", "side", ",", "product_id", "=", "'BTC-USD'", ",", "client_oid", "=", "None", ",", "type", "=", "None", ",", "stp", "=", "None", ",", "price", "=", "None", ",", "size", "=", "None", ",", "funds", "=", "None", ...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
PrivateClient.place_limit_order
`<https://docs.exchange.coinbase.com/#orders>`_
cbexchange/private.py
def place_limit_order(self, side, price, size, product_id='BTC-USD', client_oid=None, stp=None, time_in_force=None, cancel_after...
def place_limit_order(self, side, price, size, product_id='BTC-USD', client_oid=None, stp=None, time_in_force=None, cancel_after...
[ "<https", ":", "//", "docs", ".", "exchange", ".", "coinbase", ".", "com", "/", "#orders", ">", "_" ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/private.py#L135-L155
[ "def", "place_limit_order", "(", "self", ",", "side", ",", "price", ",", "size", ",", "product_id", "=", "'BTC-USD'", ",", "client_oid", "=", "None", ",", "stp", "=", "None", ",", "time_in_force", "=", "None", ",", "cancel_after", "=", "None", ",", "post...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
PrivateClient.place_market_order
`<https://docs.exchange.coinbase.com/#orders>`_
cbexchange/private.py
def place_market_order(self, side, product_id='BTC-USD', size=None, funds=None, client_oid=None, stp=None): """`<https://docs.exchange.coinbase.com/#orders>`_""" ...
def place_market_order(self, side, product_id='BTC-USD', size=None, funds=None, client_oid=None, stp=None): """`<https://docs.exchange.coinbase.com/#orders>`_""" ...
[ "<https", ":", "//", "docs", ".", "exchange", ".", "coinbase", ".", "com", "/", "#orders", ">", "_" ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/private.py#L157-L171
[ "def", "place_market_order", "(", "self", ",", "side", ",", "product_id", "=", "'BTC-USD'", ",", "size", "=", "None", ",", "funds", "=", "None", ",", "client_oid", "=", "None", ",", "stp", "=", "None", ")", ":", "return", "self", ".", "_place_order", "...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
PrivateClient._deposit_withdraw
`<https://docs.exchange.coinbase.com/#depositwithdraw>`_
cbexchange/private.py
def _deposit_withdraw(self, type, amount, coinbase_account_id): """`<https://docs.exchange.coinbase.com/#depositwithdraw>`_""" data = { 'type':type, 'amount':amount, 'coinbase_account_id':coinbase_account_id } return self._post('transfers', data=data)
def _deposit_withdraw(self, type, amount, coinbase_account_id): """`<https://docs.exchange.coinbase.com/#depositwithdraw>`_""" data = { 'type':type, 'amount':amount, 'coinbase_account_id':coinbase_account_id } return self._post('transfers', data=data)
[ "<https", ":", "//", "docs", ".", "exchange", ".", "coinbase", ".", "com", "/", "#depositwithdraw", ">", "_" ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/private.py#L193-L200
[ "def", "_deposit_withdraw", "(", "self", ",", "type", ",", "amount", ",", "coinbase_account_id", ")", ":", "data", "=", "{", "'type'", ":", "type", ",", "'amount'", ":", "amount", ",", "'coinbase_account_id'", ":", "coinbase_account_id", "}", "return", "self",...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
PrivateClient._new_report
`<https://docs.exchange.coinbase.com/#create-a-new-report>`_
cbexchange/private.py
def _new_report(self, type, start_date, end_date, product_id='BTC-USD', account_id=None, format=None, email=None): """`<https://docs.exchange.coinbase.com/#create-a-new-report>`_""" data...
def _new_report(self, type, start_date, end_date, product_id='BTC-USD', account_id=None, format=None, email=None): """`<https://docs.exchange.coinbase.com/#create-a-new-report>`_""" data...
[ "<https", ":", "//", "docs", ".", "exchange", ".", "coinbase", ".", "com", "/", "#create", "-", "a", "-", "new", "-", "report", ">", "_" ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/private.py#L210-L228
[ "def", "_new_report", "(", "self", ",", "type", ",", "start_date", ",", "end_date", ",", "product_id", "=", "'BTC-USD'", ",", "account_id", "=", "None", ",", "format", "=", "None", ",", "email", "=", "None", ")", ":", "data", "=", "{", "'type'", ":", ...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
PrivateClient.new_fills_report
`<https://docs.exchange.coinbase.com/#create-a-new-report>`_
cbexchange/private.py
def new_fills_report(self, start_date, end_date, account_id=None, product_id='BTC-USD', format=None, email=None): """`<https://docs.exchange.coinbase.com/#create-a-new-report>`_"...
def new_fills_report(self, start_date, end_date, account_id=None, product_id='BTC-USD', format=None, email=None): """`<https://docs.exchange.coinbase.com/#create-a-new-report>`_"...
[ "<https", ":", "//", "docs", ".", "exchange", ".", "coinbase", ".", "com", "/", "#create", "-", "a", "-", "new", "-", "report", ">", "_" ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/private.py#L230-L244
[ "def", "new_fills_report", "(", "self", ",", "start_date", ",", "end_date", ",", "account_id", "=", "None", ",", "product_id", "=", "'BTC-USD'", ",", "format", "=", "None", ",", "email", "=", "None", ")", ":", "return", "self", ".", "_new_report", "(", "...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
PrivatePaginationClient._request
Sends an HTTP request to the REST API and receives the requested data. Additionally sets up pagination cursors. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argument keywords :returns: requested data :raises APIError: for ...
cbexchange/private.py
def _request(self, method, *relative_path_parts, **kwargs): """Sends an HTTP request to the REST API and receives the requested data. Additionally sets up pagination cursors. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argume...
def _request(self, method, *relative_path_parts, **kwargs): """Sends an HTTP request to the REST API and receives the requested data. Additionally sets up pagination cursors. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argume...
[ "Sends", "an", "HTTP", "request", "to", "the", "REST", "API", "and", "receives", "the", "requested", "data", ".", "Additionally", "sets", "up", "pagination", "cursors", "." ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/private.py#L274-L295
[ "def", "_request", "(", "self", ",", "method", ",", "*", "relative_path_parts", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_create_api_uri", "(", "*", "relative_path_parts", ")", "if", "method", "==", "'get'", ":", "response", "=", "get...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
DataStore.fetch
return one record from the collection whose parameters match kwargs --- kwargs should be a dictionary whose keys match column names (in traditional SQL / fields in NoSQL) and whose values are the values of those fields. e.g. kwargs={name='my application name',client_id=12345}
proauth2/data_stores/async_mongo_ds.py
def fetch(self, collection, **kwargs): ''' return one record from the collection whose parameters match kwargs --- kwargs should be a dictionary whose keys match column names (in traditional SQL / fields in NoSQL) and whose values are the values of those fields. e...
def fetch(self, collection, **kwargs): ''' return one record from the collection whose parameters match kwargs --- kwargs should be a dictionary whose keys match column names (in traditional SQL / fields in NoSQL) and whose values are the values of those fields. e...
[ "return", "one", "record", "from", "the", "collection", "whose", "parameters", "match", "kwargs", "---", "kwargs", "should", "be", "a", "dictionary", "whose", "keys", "match", "column", "names", "(", "in", "traditional", "SQL", "/", "fields", "in", "NoSQL", ...
charlesthomas/proauth2
python
https://github.com/charlesthomas/proauth2/blob/f88c8df966a1802414047ed304d02df1dd520097/proauth2/data_stores/async_mongo_ds.py#L31-L42
[ "def", "fetch", "(", "self", ",", "collection", ",", "*", "*", "kwargs", ")", ":", "callback", "=", "kwargs", ".", "pop", "(", "'callback'", ")", "data", "=", "yield", "Op", "(", "self", ".", "db", "[", "collection", "]", ".", "find_one", ",", "kwa...
f88c8df966a1802414047ed304d02df1dd520097
valid
DataStore.remove
remove records from collection whose parameters match kwargs
proauth2/data_stores/async_mongo_ds.py
def remove(self, collection, **kwargs): ''' remove records from collection whose parameters match kwargs ''' callback = kwargs.pop('callback') yield Op(self.db[collection].remove, kwargs) callback()
def remove(self, collection, **kwargs): ''' remove records from collection whose parameters match kwargs ''' callback = kwargs.pop('callback') yield Op(self.db[collection].remove, kwargs) callback()
[ "remove", "records", "from", "collection", "whose", "parameters", "match", "kwargs" ]
charlesthomas/proauth2
python
https://github.com/charlesthomas/proauth2/blob/f88c8df966a1802414047ed304d02df1dd520097/proauth2/data_stores/async_mongo_ds.py#L45-L51
[ "def", "remove", "(", "self", ",", "collection", ",", "*", "*", "kwargs", ")", ":", "callback", "=", "kwargs", ".", "pop", "(", "'callback'", ")", "yield", "Op", "(", "self", ".", "db", "[", "collection", "]", ".", "remove", ",", "kwargs", ")", "ca...
f88c8df966a1802414047ed304d02df1dd520097
valid
DataStore.store
validate the passed values in kwargs based on the collection, store them in the mongodb collection
proauth2/data_stores/async_mongo_ds.py
def store(self, collection, **kwargs): ''' validate the passed values in kwargs based on the collection, store them in the mongodb collection ''' callback = kwargs.pop('callback') key = validate(collection, **kwargs) data = yield Task(self.fetch, collection, **{ke...
def store(self, collection, **kwargs): ''' validate the passed values in kwargs based on the collection, store them in the mongodb collection ''' callback = kwargs.pop('callback') key = validate(collection, **kwargs) data = yield Task(self.fetch, collection, **{ke...
[ "validate", "the", "passed", "values", "in", "kwargs", "based", "on", "the", "collection", "store", "them", "in", "the", "mongodb", "collection" ]
charlesthomas/proauth2
python
https://github.com/charlesthomas/proauth2/blob/f88c8df966a1802414047ed304d02df1dd520097/proauth2/data_stores/async_mongo_ds.py#L54-L65
[ "def", "store", "(", "self", ",", "collection", ",", "*", "*", "kwargs", ")", ":", "callback", "=", "kwargs", ".", "pop", "(", "'callback'", ")", "key", "=", "validate", "(", "collection", ",", "*", "*", "kwargs", ")", "data", "=", "yield", "Task", ...
f88c8df966a1802414047ed304d02df1dd520097
valid
generate_api
Generates a factory function to instantiate the API with the given version.
trelloapi/api.py
def generate_api(version): """ Generates a factory function to instantiate the API with the given version. """ def get_partial_api(key, token=None): return TrelloAPI(ENDPOINTS[version], version, key, token=token) get_partial_api.__doc__ = \ """Interfaz REST con Trello. Versión ...
def generate_api(version): """ Generates a factory function to instantiate the API with the given version. """ def get_partial_api(key, token=None): return TrelloAPI(ENDPOINTS[version], version, key, token=token) get_partial_api.__doc__ = \ """Interfaz REST con Trello. Versión ...
[ "Generates", "a", "factory", "function", "to", "instantiate", "the", "API", "with", "the", "given", "version", "." ]
nilp0inter/trelloapi
python
https://github.com/nilp0inter/trelloapi/blob/88f4135832548ea71598d50a73943890e1cf9e20/trelloapi/api.py#L131-L143
[ "def", "generate_api", "(", "version", ")", ":", "def", "get_partial_api", "(", "key", ",", "token", "=", "None", ")", ":", "return", "TrelloAPI", "(", "ENDPOINTS", "[", "version", "]", ",", "version", ",", "key", ",", "token", "=", "token", ")", "get_...
88f4135832548ea71598d50a73943890e1cf9e20
valid
TrelloAPI._url
Resolve the URL to this point. >>> trello = TrelloAPIV1('APIKEY') >>> trello.batch._url '1/batch' >>> trello.boards(board_id='BOARD_ID')._url '1/boards/BOARD_ID' >>> trello.boards(board_id='BOARD_ID')(field='FIELD')._url '1/boards/BOARD_ID/FIELD' >>> trel...
trelloapi/api.py
def _url(self): """ Resolve the URL to this point. >>> trello = TrelloAPIV1('APIKEY') >>> trello.batch._url '1/batch' >>> trello.boards(board_id='BOARD_ID')._url '1/boards/BOARD_ID' >>> trello.boards(board_id='BOARD_ID')(field='FIELD')._url '1/boa...
def _url(self): """ Resolve the URL to this point. >>> trello = TrelloAPIV1('APIKEY') >>> trello.batch._url '1/batch' >>> trello.boards(board_id='BOARD_ID')._url '1/boards/BOARD_ID' >>> trello.boards(board_id='BOARD_ID')(field='FIELD')._url '1/boa...
[ "Resolve", "the", "URL", "to", "this", "point", "." ]
nilp0inter/trelloapi
python
https://github.com/nilp0inter/trelloapi/blob/88f4135832548ea71598d50a73943890e1cf9e20/trelloapi/api.py#L67-L90
[ "def", "_url", "(", "self", ")", ":", "if", "self", ".", "_api_arg", ":", "mypart", "=", "str", "(", "self", ".", "_api_arg", ")", "else", ":", "mypart", "=", "self", ".", "_name", "if", "self", ".", "_parent", ":", "return", "'/'", ".", "join", ...
88f4135832548ea71598d50a73943890e1cf9e20
valid
TrelloAPI._api_call
Makes the HTTP request.
trelloapi/api.py
def _api_call(self, method_name, *args, **kwargs): """ Makes the HTTP request. """ params = kwargs.setdefault('params', {}) params.update({'key': self._apikey}) if self._token is not None: params.update({'token': self._token}) http_method = getattr(r...
def _api_call(self, method_name, *args, **kwargs): """ Makes the HTTP request. """ params = kwargs.setdefault('params', {}) params.update({'key': self._apikey}) if self._token is not None: params.update({'token': self._token}) http_method = getattr(r...
[ "Makes", "the", "HTTP", "request", "." ]
nilp0inter/trelloapi
python
https://github.com/nilp0inter/trelloapi/blob/88f4135832548ea71598d50a73943890e1cf9e20/trelloapi/api.py#L92-L103
[ "def", "_api_call", "(", "self", ",", "method_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "params", "=", "kwargs", ".", "setdefault", "(", "'params'", ",", "{", "}", ")", "params", ".", "update", "(", "{", "'key'", ":", "self", ".",...
88f4135832548ea71598d50a73943890e1cf9e20
valid
Merge
Parses an text representation of a protocol message into a message. Like Parse(), but allows repeated values for a non-repeated field, and uses the last one. Args: text: Message text representation. message: A protocol buffer message to merge into. allow_unknown_extension: if True, skip over missing...
typy/google/protobuf/text_format.py
def Merge(text, message, allow_unknown_extension=False, allow_field_number=False): """Parses an text representation of a protocol message into a message. Like Parse(), but allows repeated values for a non-repeated field, and uses the last one. Args: text: Message text representation. message...
def Merge(text, message, allow_unknown_extension=False, allow_field_number=False): """Parses an text representation of a protocol message into a message. Like Parse(), but allows repeated values for a non-repeated field, and uses the last one. Args: text: Message text representation. message...
[ "Parses", "an", "text", "representation", "of", "a", "protocol", "message", "into", "a", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L348-L369
[ "def", "Merge", "(", "text", ",", "message", ",", "allow_unknown_extension", "=", "False", ",", "allow_field_number", "=", "False", ")", ":", "return", "MergeLines", "(", "text", ".", "split", "(", "'\\n'", ")", ",", "message", ",", "allow_unknown_extension", ...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
ParseLines
Parses an text representation of a protocol message into a message. Args: lines: An iterable of lines of a message's text representation. message: A protocol buffer message to merge into. allow_unknown_extension: if True, skip over missing extensions and keep parsing allow_field_number: if True...
typy/google/protobuf/text_format.py
def ParseLines(lines, message, allow_unknown_extension=False, allow_field_number=False): """Parses an text representation of a protocol message into a message. Args: lines: An iterable of lines of a message's text representation. message: A protocol buffer message to merge into. allow_un...
def ParseLines(lines, message, allow_unknown_extension=False, allow_field_number=False): """Parses an text representation of a protocol message into a message. Args: lines: An iterable of lines of a message's text representation. message: A protocol buffer message to merge into. allow_un...
[ "Parses", "an", "text", "representation", "of", "a", "protocol", "message", "into", "a", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L372-L390
[ "def", "ParseLines", "(", "lines", ",", "message", ",", "allow_unknown_extension", "=", "False", ",", "allow_field_number", "=", "False", ")", ":", "parser", "=", "_Parser", "(", "allow_unknown_extension", ",", "allow_field_number", ")", "return", "parser", ".", ...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_SkipFieldValue
Skips over a field value. Args: tokenizer: A tokenizer to parse the field name and values. Raises: ParseError: In case an invalid field value is found.
typy/google/protobuf/text_format.py
def _SkipFieldValue(tokenizer): """Skips over a field value. Args: tokenizer: A tokenizer to parse the field name and values. Raises: ParseError: In case an invalid field value is found. """ # String/bytes tokens can come in multiple adjacent string literals. # If we can consume one, consume as ma...
def _SkipFieldValue(tokenizer): """Skips over a field value. Args: tokenizer: A tokenizer to parse the field name and values. Raises: ParseError: In case an invalid field value is found. """ # String/bytes tokens can come in multiple adjacent string literals. # If we can consume one, consume as ma...
[ "Skips", "over", "a", "field", "value", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L739-L759
[ "def", "_SkipFieldValue", "(", "tokenizer", ")", ":", "# String/bytes tokens can come in multiple adjacent string literals.", "# If we can consume one, consume as many as we can.", "if", "tokenizer", ".", "TryConsumeByteString", "(", ")", ":", "while", "tokenizer", ".", "TryConsu...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
ParseInteger
Parses an integer. Args: text: The text to parse. is_signed: True if a signed integer must be parsed. is_long: True if a long integer must be parsed. Returns: The integer value. Raises: ValueError: Thrown Iff the text is not a valid integer.
typy/google/protobuf/text_format.py
def ParseInteger(text, is_signed=False, is_long=False): """Parses an integer. Args: text: The text to parse. is_signed: True if a signed integer must be parsed. is_long: True if a long integer must be parsed. Returns: The integer value. Raises: ValueError: Thrown Iff the text is not a val...
def ParseInteger(text, is_signed=False, is_long=False): """Parses an integer. Args: text: The text to parse. is_signed: True if a signed integer must be parsed. is_long: True if a long integer must be parsed. Returns: The integer value. Raises: ValueError: Thrown Iff the text is not a val...
[ "Parses", "an", "integer", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L1102-L1131
[ "def", "ParseInteger", "(", "text", ",", "is_signed", "=", "False", ",", "is_long", "=", "False", ")", ":", "# Do the actual parsing. Exception handling is propagated to caller.", "try", ":", "# We force 32-bit values to int and 64-bit values to long to make", "# alternate implem...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Printer.PrintMessage
Convert protobuf message to text format. Args: message: The protocol buffers message.
typy/google/protobuf/text_format.py
def PrintMessage(self, message): """Convert protobuf message to text format. Args: message: The protocol buffers message. """ fields = message.ListFields() if self.use_index_order: fields.sort(key=lambda x: x[0].index) for field, value in fields: if _IsMapEntry(field): ...
def PrintMessage(self, message): """Convert protobuf message to text format. Args: message: The protocol buffers message. """ fields = message.ListFields() if self.use_index_order: fields.sort(key=lambda x: x[0].index) for field, value in fields: if _IsMapEntry(field): ...
[ "Convert", "protobuf", "message", "to", "text", "format", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L208-L232
[ "def", "PrintMessage", "(", "self", ",", "message", ")", ":", "fields", "=", "message", ".", "ListFields", "(", ")", "if", "self", ".", "use_index_order", ":", "fields", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", "[", "0", "]", ".", "in...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Printer.PrintFieldValue
Print a single field value (not including name). For repeated fields, the value should be a single element. Args: field: The descriptor of the field to be printed. value: The value of the field.
typy/google/protobuf/text_format.py
def PrintFieldValue(self, field, value): """Print a single field value (not including name). For repeated fields, the value should be a single element. Args: field: The descriptor of the field to be printed. value: The value of the field. """ out = self.out if self.pointy_brackets:...
def PrintFieldValue(self, field, value): """Print a single field value (not including name). For repeated fields, the value should be a single element. Args: field: The descriptor of the field to be printed. value: The value of the field. """ out = self.out if self.pointy_brackets:...
[ "Print", "a", "single", "field", "value", "(", "not", "including", "name", ")", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L267-L322
[ "def", "PrintFieldValue", "(", "self", ",", "field", ",", "value", ")", ":", "out", "=", "self", ".", "out", "if", "self", ".", "pointy_brackets", ":", "openb", "=", "'<'", "closeb", "=", "'>'", "else", ":", "openb", "=", "'{'", "closeb", "=", "'}'",...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Parser._ParseOrMerge
Converts an text representation of a protocol message into a message. Args: lines: Lines of a message's text representation. message: A protocol buffer message to merge into. Raises: ParseError: On text parsing problems.
typy/google/protobuf/text_format.py
def _ParseOrMerge(self, lines, message): """Converts an text representation of a protocol message into a message. Args: lines: Lines of a message's text representation. message: A protocol buffer message to merge into. Raises: ParseError: On text parsing problems. """ tokenizer =...
def _ParseOrMerge(self, lines, message): """Converts an text representation of a protocol message into a message. Args: lines: Lines of a message's text representation. message: A protocol buffer message to merge into. Raises: ParseError: On text parsing problems. """ tokenizer =...
[ "Converts", "an", "text", "representation", "of", "a", "protocol", "message", "into", "a", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L443-L455
[ "def", "_ParseOrMerge", "(", "self", ",", "lines", ",", "message", ")", ":", "tokenizer", "=", "_Tokenizer", "(", "lines", ")", "while", "not", "tokenizer", ".", "AtEnd", "(", ")", ":", "self", ".", "_MergeField", "(", "tokenizer", ",", "message", ")" ]
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Parser._MergeMessageField
Merges a single scalar field into a message. Args: tokenizer: A tokenizer to parse the field value. message: The message of which field is a member. field: The descriptor of the field to be merged. Raises: ParseError: In case of text parsing problems.
typy/google/protobuf/text_format.py
def _MergeMessageField(self, tokenizer, message, field): """Merges a single scalar field into a message. Args: tokenizer: A tokenizer to parse the field value. message: The message of which field is a member. field: The descriptor of the field to be merged. Raises: ParseError: In c...
def _MergeMessageField(self, tokenizer, message, field): """Merges a single scalar field into a message. Args: tokenizer: A tokenizer to parse the field value. message: The message of which field is a member. field: The descriptor of the field to be merged. Raises: ParseError: In c...
[ "Merges", "a", "single", "scalar", "field", "into", "a", "message", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L566-L611
[ "def", "_MergeMessageField", "(", "self", ",", "tokenizer", ",", "message", ",", "field", ")", ":", "is_map_entry", "=", "_IsMapEntry", "(", "field", ")", "if", "tokenizer", ".", "TryConsume", "(", "'<'", ")", ":", "end_token", "=", "'>'", "else", ":", "...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Tokenizer.ConsumeIdentifier
Consumes protocol message field identifier. Returns: Identifier string. Raises: ParseError: If an identifier couldn't be consumed.
typy/google/protobuf/text_format.py
def ConsumeIdentifier(self): """Consumes protocol message field identifier. Returns: Identifier string. Raises: ParseError: If an identifier couldn't be consumed. """ result = self.token if not self._IDENTIFIER.match(result): raise self._ParseError('Expected identifier.') ...
def ConsumeIdentifier(self): """Consumes protocol message field identifier. Returns: Identifier string. Raises: ParseError: If an identifier couldn't be consumed. """ result = self.token if not self._IDENTIFIER.match(result): raise self._ParseError('Expected identifier.') ...
[ "Consumes", "protocol", "message", "field", "identifier", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L860-L873
[ "def", "ConsumeIdentifier", "(", "self", ")", ":", "result", "=", "self", ".", "token", "if", "not", "self", ".", "_IDENTIFIER", ".", "match", "(", "result", ")", ":", "raise", "self", ".", "_ParseError", "(", "'Expected identifier.'", ")", "self", ".", ...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Tokenizer.ConsumeInt32
Consumes a signed 32bit integer number. Returns: The integer parsed. Raises: ParseError: If a signed 32bit integer couldn't be consumed.
typy/google/protobuf/text_format.py
def ConsumeInt32(self): """Consumes a signed 32bit integer number. Returns: The integer parsed. Raises: ParseError: If a signed 32bit integer couldn't be consumed. """ try: result = ParseInteger(self.token, is_signed=True, is_long=False) except ValueError as e: raise se...
def ConsumeInt32(self): """Consumes a signed 32bit integer number. Returns: The integer parsed. Raises: ParseError: If a signed 32bit integer couldn't be consumed. """ try: result = ParseInteger(self.token, is_signed=True, is_long=False) except ValueError as e: raise se...
[ "Consumes", "a", "signed", "32bit", "integer", "number", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L875-L889
[ "def", "ConsumeInt32", "(", "self", ")", ":", "try", ":", "result", "=", "ParseInteger", "(", "self", ".", "token", ",", "is_signed", "=", "True", ",", "is_long", "=", "False", ")", "except", "ValueError", "as", "e", ":", "raise", "self", ".", "_ParseE...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Tokenizer.ConsumeFloat
Consumes an floating point number. Returns: The number parsed. Raises: ParseError: If a floating point number couldn't be consumed.
typy/google/protobuf/text_format.py
def ConsumeFloat(self): """Consumes an floating point number. Returns: The number parsed. Raises: ParseError: If a floating point number couldn't be consumed. """ try: result = ParseFloat(self.token) except ValueError as e: raise self._ParseError(str(e)) self.NextTo...
def ConsumeFloat(self): """Consumes an floating point number. Returns: The number parsed. Raises: ParseError: If a floating point number couldn't be consumed. """ try: result = ParseFloat(self.token) except ValueError as e: raise self._ParseError(str(e)) self.NextTo...
[ "Consumes", "an", "floating", "point", "number", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L960-L974
[ "def", "ConsumeFloat", "(", "self", ")", ":", "try", ":", "result", "=", "ParseFloat", "(", "self", ".", "token", ")", "except", "ValueError", "as", "e", ":", "raise", "self", ".", "_ParseError", "(", "str", "(", "e", ")", ")", "self", ".", "NextToke...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Tokenizer.ConsumeBool
Consumes a boolean value. Returns: The bool parsed. Raises: ParseError: If a boolean value couldn't be consumed.
typy/google/protobuf/text_format.py
def ConsumeBool(self): """Consumes a boolean value. Returns: The bool parsed. Raises: ParseError: If a boolean value couldn't be consumed. """ try: result = ParseBool(self.token) except ValueError as e: raise self._ParseError(str(e)) self.NextToken() return resu...
def ConsumeBool(self): """Consumes a boolean value. Returns: The bool parsed. Raises: ParseError: If a boolean value couldn't be consumed. """ try: result = ParseBool(self.token) except ValueError as e: raise self._ParseError(str(e)) self.NextToken() return resu...
[ "Consumes", "a", "boolean", "value", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L976-L990
[ "def", "ConsumeBool", "(", "self", ")", ":", "try", ":", "result", "=", "ParseBool", "(", "self", ".", "token", ")", "except", "ValueError", "as", "e", ":", "raise", "self", ".", "_ParseError", "(", "str", "(", "e", ")", ")", "self", ".", "NextToken"...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
_Tokenizer._ConsumeSingleByteString
Consume one token of a string literal. String literals (whether bytes or text) can come in multiple adjacent tokens which are automatically concatenated, like in C or Python. This method only consumes one token. Returns: The token parsed. Raises: ParseError: When the wrong format data...
typy/google/protobuf/text_format.py
def _ConsumeSingleByteString(self): """Consume one token of a string literal. String literals (whether bytes or text) can come in multiple adjacent tokens which are automatically concatenated, like in C or Python. This method only consumes one token. Returns: The token parsed. Raises: ...
def _ConsumeSingleByteString(self): """Consume one token of a string literal. String literals (whether bytes or text) can come in multiple adjacent tokens which are automatically concatenated, like in C or Python. This method only consumes one token. Returns: The token parsed. Raises: ...
[ "Consume", "one", "token", "of", "a", "string", "literal", "." ]
ibelie/typy
python
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L1028-L1052
[ "def", "_ConsumeSingleByteString", "(", "self", ")", ":", "text", "=", "self", ".", "token", "if", "len", "(", "text", ")", "<", "1", "or", "text", "[", "0", "]", "not", "in", "_QUOTES", ":", "raise", "self", ".", "_ParseError", "(", "'Expected string ...
3616845fb91459aacd8df6bf82c5d91f4542bee7
valid
timestamp
Returns a human-readable timestamp given a Unix timestamp 't' or for the current time. The Unix timestamp is the number of seconds since start of epoch (1970-01-01 00:00:00). When forfilename is True, then spaces and semicolons are replace with hyphens. The returned string is usable as a (part of a) fil...
dpostools/utils.py
def timestamp(t = None, forfilename=False): """Returns a human-readable timestamp given a Unix timestamp 't' or for the current time. The Unix timestamp is the number of seconds since start of epoch (1970-01-01 00:00:00). When forfilename is True, then spaces and semicolons are replace with hyphens....
def timestamp(t = None, forfilename=False): """Returns a human-readable timestamp given a Unix timestamp 't' or for the current time. The Unix timestamp is the number of seconds since start of epoch (1970-01-01 00:00:00). When forfilename is True, then spaces and semicolons are replace with hyphens....
[ "Returns", "a", "human", "-", "readable", "timestamp", "given", "a", "Unix", "timestamp", "t", "or", "for", "the", "current", "time", ".", "The", "Unix", "timestamp", "is", "the", "number", "of", "seconds", "since", "start", "of", "epoch", "(", "1970", "...
BlockHub/blockhubdpostools
python
https://github.com/BlockHub/blockhubdpostools/blob/27712cd97cd3658ee54a4330ff3135b51a01d7d1/dpostools/utils.py#L33-L48
[ "def", "timestamp", "(", "t", "=", "None", ",", "forfilename", "=", "False", ")", ":", "datetimesep", "=", "' '", "timesep", "=", "':'", "if", "forfilename", ":", "datetimesep", "=", "'-'", "timesep", "=", "'-'", "return", "time", ".", "strftime", "(", ...
27712cd97cd3658ee54a4330ff3135b51a01d7d1
valid
arktimestamp
Returns a human-readable timestamp given an Ark timestamp 'arct'. An Ark timestamp is the number of seconds since Genesis block, 2017:03:21 15:55:44.
dpostools/utils.py
def arktimestamp(arkt, forfilename=False): """Returns a human-readable timestamp given an Ark timestamp 'arct'. An Ark timestamp is the number of seconds since Genesis block, 2017:03:21 15:55:44.""" t = arkt + time.mktime((2017, 3, 21, 15, 55, 44, 0, 0, 0)) return '%d %s' % (arkt, timestamp(t))
def arktimestamp(arkt, forfilename=False): """Returns a human-readable timestamp given an Ark timestamp 'arct'. An Ark timestamp is the number of seconds since Genesis block, 2017:03:21 15:55:44.""" t = arkt + time.mktime((2017, 3, 21, 15, 55, 44, 0, 0, 0)) return '%d %s' % (arkt, timestamp(t))
[ "Returns", "a", "human", "-", "readable", "timestamp", "given", "an", "Ark", "timestamp", "arct", ".", "An", "Ark", "timestamp", "is", "the", "number", "of", "seconds", "since", "Genesis", "block", "2017", ":", "03", ":", "21", "15", ":", "55", ":", "4...
BlockHub/blockhubdpostools
python
https://github.com/BlockHub/blockhubdpostools/blob/27712cd97cd3658ee54a4330ff3135b51a01d7d1/dpostools/utils.py#L51-L57
[ "def", "arktimestamp", "(", "arkt", ",", "forfilename", "=", "False", ")", ":", "t", "=", "arkt", "+", "time", ".", "mktime", "(", "(", "2017", ",", "3", ",", "21", ",", "15", ",", "55", ",", "44", ",", "0", ",", "0", ",", "0", ")", ")", "r...
27712cd97cd3658ee54a4330ff3135b51a01d7d1
valid
arkt_to_unixt
convert ark timestamp to unix timestamp
dpostools/utils.py
def arkt_to_unixt(ark_timestamp): """ convert ark timestamp to unix timestamp""" res = datetime.datetime(2017, 3, 21, 15, 55, 44) + datetime.timedelta(seconds=ark_timestamp) return res.timestamp()
def arkt_to_unixt(ark_timestamp): """ convert ark timestamp to unix timestamp""" res = datetime.datetime(2017, 3, 21, 15, 55, 44) + datetime.timedelta(seconds=ark_timestamp) return res.timestamp()
[ "convert", "ark", "timestamp", "to", "unix", "timestamp" ]
BlockHub/blockhubdpostools
python
https://github.com/BlockHub/blockhubdpostools/blob/27712cd97cd3658ee54a4330ff3135b51a01d7d1/dpostools/utils.py#L65-L68
[ "def", "arkt_to_unixt", "(", "ark_timestamp", ")", ":", "res", "=", "datetime", ".", "datetime", "(", "2017", ",", "3", ",", "21", ",", "15", ",", "55", ",", "44", ")", "+", "datetime", ".", "timedelta", "(", "seconds", "=", "ark_timestamp", ")", "re...
27712cd97cd3658ee54a4330ff3135b51a01d7d1
valid
Mssql.close
Close the connection.
arguspy/mssql_pymssql.py
def close(self): """Close the connection.""" try: self.conn.close() self.logger.debug("Close connect succeed.") except pymssql.Error as e: self.unknown("Close connect error: %s" % e)
def close(self): """Close the connection.""" try: self.conn.close() self.logger.debug("Close connect succeed.") except pymssql.Error as e: self.unknown("Close connect error: %s" % e)
[ "Close", "the", "connection", "." ]
crazy-canux/arguspy
python
https://github.com/crazy-canux/arguspy/blob/e9486b5df61978a990d56bf43de35f3a4cdefcc3/arguspy/mssql_pymssql.py#L67-L73
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "conn", ".", "close", "(", ")", "self", ".", "logger", ".", "debug", "(", "\"Close connect succeed.\"", ")", "except", "pymssql", ".", "Error", "as", "e", ":", "self", ".", "unknown", "(...
e9486b5df61978a990d56bf43de35f3a4cdefcc3
valid
get_version
Extract package __version__
setup.py
def get_version(): """Extract package __version__""" with open(VERSION_FILE, encoding='utf-8') as fp: content = fp.read() match = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', content, re.M) if match: return match.group(1) raise RuntimeError("Could not extract package __version__"...
def get_version(): """Extract package __version__""" with open(VERSION_FILE, encoding='utf-8') as fp: content = fp.read() match = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', content, re.M) if match: return match.group(1) raise RuntimeError("Could not extract package __version__"...
[ "Extract", "package", "__version__" ]
suryakencana007/baka_model
python
https://github.com/suryakencana007/baka_model/blob/915c2da9920e973302f5764ae63799acd5ecf0b7/setup.py#L89-L96
[ "def", "get_version", "(", ")", ":", "with", "open", "(", "VERSION_FILE", ",", "encoding", "=", "'utf-8'", ")", "as", "fp", ":", "content", "=", "fp", ".", "read", "(", ")", "match", "=", "re", ".", "search", "(", "r'^__version__ = [\\'\"]([^\\'\"]*)[\\'\"...
915c2da9920e973302f5764ae63799acd5ecf0b7
valid
de
**Differential evolution** via `inspyred <http://inspyred.github.io/>`_ specially tuned. steady state replacement, n-point crossover, pop size 20, gaussian mutation noise 0.01 & 1e-6. stores intermediate results (can be used for resume, see seeds) :param start: start point :param seeds: list of s...
jbopt/de.py
def de(output_basename, parameter_names, transform, loglikelihood, prior, nsteps=40000, vizfunc=None, printfunc=None, **problem): """ **Differential evolution** via `inspyred <http://inspyred.github.io/>`_ specially tuned. steady state replacement, n-point crossover, pop size 20, gaussian mutation noise...
def de(output_basename, parameter_names, transform, loglikelihood, prior, nsteps=40000, vizfunc=None, printfunc=None, **problem): """ **Differential evolution** via `inspyred <http://inspyred.github.io/>`_ specially tuned. steady state replacement, n-point crossover, pop size 20, gaussian mutation noise...
[ "**", "Differential", "evolution", "**", "via", "inspyred", "<http", ":", "//", "inspyred", ".", "github", ".", "io", "/", ">", "_", "specially", "tuned", ".", "steady", "state", "replacement", "n", "-", "point", "crossover", "pop", "size", "20", "gaussian...
JohannesBuchner/jbopt
python
https://github.com/JohannesBuchner/jbopt/blob/11b721ea001625ad7820f71ff684723c71216646/jbopt/de.py#L6-L141
[ "def", "de", "(", "output_basename", ",", "parameter_names", ",", "transform", ",", "loglikelihood", ",", "prior", ",", "nsteps", "=", "40000", ",", "vizfunc", "=", "None", ",", "printfunc", "=", "None", ",", "*", "*", "problem", ")", ":", "import", "jso...
11b721ea001625ad7820f71ff684723c71216646
valid
Preprocessor.process_macros
Replace macros with content defined in the config. :param content: Markdown content :returns: Markdown content without macros
foliant/preprocessors/macros.py
def process_macros(self, content: str) -> str: '''Replace macros with content defined in the config. :param content: Markdown content :returns: Markdown content without macros ''' def _sub(macro): name = macro.group('body') params = self.get_options(mac...
def process_macros(self, content: str) -> str: '''Replace macros with content defined in the config. :param content: Markdown content :returns: Markdown content without macros ''' def _sub(macro): name = macro.group('body') params = self.get_options(mac...
[ "Replace", "macros", "with", "content", "defined", "in", "the", "config", "." ]
foliant-docs/foliantcontrib.macros
python
https://github.com/foliant-docs/foliantcontrib.macros/blob/0332dcd7c2b32be72fdf710a012096db1ee83a51/foliant/preprocessors/macros.py#L10-L24
[ "def", "process_macros", "(", "self", ",", "content", ":", "str", ")", "->", "str", ":", "def", "_sub", "(", "macro", ")", ":", "name", "=", "macro", ".", "group", "(", "'body'", ")", "params", "=", "self", ".", "get_options", "(", "macro", ".", "g...
0332dcd7c2b32be72fdf710a012096db1ee83a51
valid
MarketClient._request
Sends an HTTP request to the REST API and receives the requested data. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argument keywords :returns: requested data :raises APIError: for non-2xx responses
cbexchange/market.py
def _request(self, method, *relative_path_parts, **kwargs): """Sends an HTTP request to the REST API and receives the requested data. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argument keywords :returns: requested data ...
def _request(self, method, *relative_path_parts, **kwargs): """Sends an HTTP request to the REST API and receives the requested data. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argument keywords :returns: requested data ...
[ "Sends", "an", "HTTP", "request", "to", "the", "REST", "API", "and", "receives", "the", "requested", "data", "." ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/market.py#L23-L35
[ "def", "_request", "(", "self", ",", "method", ",", "*", "relative_path_parts", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_create_api_uri", "(", "*", "relative_path_parts", ")", "response", "=", "get", "(", "uri", ",", "params", "=", ...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
MarketClient.get_historic_trades
`<https://docs.exchange.coinbase.com/#get-historic-rates>`_ :param start: either datetime.datetime or str in ISO 8601 :param end: either datetime.datetime or str in ISO 8601 :pram int granularity: desired timeslice in seconds :returns: desired data
cbexchange/market.py
def get_historic_trades(self, start, end, granularity, product_id='BTC-USD'): """`<https://docs.exchange.coinbase.com/#get-historic-rates>`_ :param start: either datetime.datetime or str in ISO 8601 :param end: either datetime.datetime or str in ISO 8601 :pram int granularity: desired timeslice in seco...
def get_historic_trades(self, start, end, granularity, product_id='BTC-USD'): """`<https://docs.exchange.coinbase.com/#get-historic-rates>`_ :param start: either datetime.datetime or str in ISO 8601 :param end: either datetime.datetime or str in ISO 8601 :pram int granularity: desired timeslice in seco...
[ "<https", ":", "//", "docs", ".", "exchange", ".", "coinbase", ".", "com", "/", "#get", "-", "historic", "-", "rates", ">", "_" ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/market.py#L53-L67
[ "def", "get_historic_trades", "(", "self", ",", "start", ",", "end", ",", "granularity", ",", "product_id", "=", "'BTC-USD'", ")", ":", "params", "=", "{", "'start'", ":", "self", ".", "_format_iso_time", "(", "start", ")", ",", "'end'", ":", "self", "."...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
MarketPaginationClient._request
Sends an HTTP request to the REST API and receives the requested data. Additionally sets up pagination cursors. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argument keywords :returns: requested data :raises APIError: for ...
cbexchange/market.py
def _request(self, method, *relative_path_parts, **kwargs): """Sends an HTTP request to the REST API and receives the requested data. Additionally sets up pagination cursors. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argume...
def _request(self, method, *relative_path_parts, **kwargs): """Sends an HTTP request to the REST API and receives the requested data. Additionally sets up pagination cursors. :param str method: HTTP method name :param relative_path_parts: the relative paths for the request URI :param kwargs: argume...
[ "Sends", "an", "HTTP", "request", "to", "the", "REST", "API", "and", "receives", "the", "requested", "data", ".", "Additionally", "sets", "up", "pagination", "cursors", "." ]
agsimeonov/cbexchange
python
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/market.py#L82-L98
[ "def", "_request", "(", "self", ",", "method", ",", "*", "relative_path_parts", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_create_api_uri", "(", "*", "relative_path_parts", ")", "response", "=", "get", "(", "uri", ",", "params", "=", ...
e3762f77583f89cf7b4f501ab3c7675fc7d30ab3
valid
get_unique_pathname
Return a pathname possibly with a number appended to it so that it is unique in the directory.
jaraco/path.py
def get_unique_pathname(path, root=''): """Return a pathname possibly with a number appended to it so that it is unique in the directory.""" path = os.path.join(root, path) # consider the path supplied, then the paths with numbers appended potentialPaths = itertools.chain((path,), __get_numbered_paths(path)) ...
def get_unique_pathname(path, root=''): """Return a pathname possibly with a number appended to it so that it is unique in the directory.""" path = os.path.join(root, path) # consider the path supplied, then the paths with numbers appended potentialPaths = itertools.chain((path,), __get_numbered_paths(path)) ...
[ "Return", "a", "pathname", "possibly", "with", "a", "number", "appended", "to", "it", "so", "that", "it", "is", "unique", "in", "the", "directory", "." ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L29-L36
[ "def", "get_unique_pathname", "(", "path", ",", "root", "=", "''", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "root", ",", "path", ")", "# consider the path supplied, then the paths with numbers appended\r", "potentialPaths", "=", "itertools", "."...
39e4da09f325382e21b0917b1b5cd027edce8728
valid
__get_numbered_paths
Append numbers in sequential order to the filename or folder name Numbers should be appended before the extension on a filename.
jaraco/path.py
def __get_numbered_paths(filepath): """Append numbers in sequential order to the filename or folder name Numbers should be appended before the extension on a filename.""" format = '%s (%%d)%s' % splitext_files_only(filepath) return map(lambda n: format % n, itertools.count(1))
def __get_numbered_paths(filepath): """Append numbers in sequential order to the filename or folder name Numbers should be appended before the extension on a filename.""" format = '%s (%%d)%s' % splitext_files_only(filepath) return map(lambda n: format % n, itertools.count(1))
[ "Append", "numbers", "in", "sequential", "order", "to", "the", "filename", "or", "folder", "name", "Numbers", "should", "be", "appended", "before", "the", "extension", "on", "a", "filename", "." ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L39-L43
[ "def", "__get_numbered_paths", "(", "filepath", ")", ":", "format", "=", "'%s (%%d)%s'", "%", "splitext_files_only", "(", "filepath", ")", "return", "map", "(", "lambda", "n", ":", "format", "%", "n", ",", "itertools", ".", "count", "(", "1", ")", ")" ]
39e4da09f325382e21b0917b1b5cd027edce8728
valid
splitext_files_only
Custom version of splitext that doesn't perform splitext on directories
jaraco/path.py
def splitext_files_only(filepath): "Custom version of splitext that doesn't perform splitext on directories" return ( (filepath, '') if os.path.isdir(filepath) else os.path.splitext(filepath) )
def splitext_files_only(filepath): "Custom version of splitext that doesn't perform splitext on directories" return ( (filepath, '') if os.path.isdir(filepath) else os.path.splitext(filepath) )
[ "Custom", "version", "of", "splitext", "that", "doesn", "t", "perform", "splitext", "on", "directories" ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L46-L50
[ "def", "splitext_files_only", "(", "filepath", ")", ":", "return", "(", "(", "filepath", ",", "''", ")", "if", "os", ".", "path", ".", "isdir", "(", "filepath", ")", "else", "os", ".", "path", ".", "splitext", "(", "filepath", ")", ")" ]
39e4da09f325382e21b0917b1b5cd027edce8728
valid
set_time
Set the modified time of a file
jaraco/path.py
def set_time(filename, mod_time): """ Set the modified time of a file """ log.debug('Setting modified time to %s', mod_time) mtime = calendar.timegm(mod_time.utctimetuple()) # utctimetuple discards microseconds, so restore it (for consistency) mtime += mod_time.microsecond / 1000000 atime = os.stat(file...
def set_time(filename, mod_time): """ Set the modified time of a file """ log.debug('Setting modified time to %s', mod_time) mtime = calendar.timegm(mod_time.utctimetuple()) # utctimetuple discards microseconds, so restore it (for consistency) mtime += mod_time.microsecond / 1000000 atime = os.stat(file...
[ "Set", "the", "modified", "time", "of", "a", "file" ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L53-L62
[ "def", "set_time", "(", "filename", ",", "mod_time", ")", ":", "log", ".", "debug", "(", "'Setting modified time to %s'", ",", "mod_time", ")", "mtime", "=", "calendar", ".", "timegm", "(", "mod_time", ".", "utctimetuple", "(", ")", ")", "# utctimetuple discar...
39e4da09f325382e21b0917b1b5cd027edce8728
valid
get_time
Get the modified time for a file as a datetime instance
jaraco/path.py
def get_time(filename): """ Get the modified time for a file as a datetime instance """ ts = os.stat(filename).st_mtime return datetime.datetime.utcfromtimestamp(ts)
def get_time(filename): """ Get the modified time for a file as a datetime instance """ ts = os.stat(filename).st_mtime return datetime.datetime.utcfromtimestamp(ts)
[ "Get", "the", "modified", "time", "for", "a", "file", "as", "a", "datetime", "instance" ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L65-L70
[ "def", "get_time", "(", "filename", ")", ":", "ts", "=", "os", ".", "stat", "(", "filename", ")", ".", "st_mtime", "return", "datetime", ".", "datetime", ".", "utcfromtimestamp", "(", "ts", ")" ]
39e4da09f325382e21b0917b1b5cd027edce8728
valid
insert_before_extension
Given a filename and some content, insert the content just before the extension. >>> insert_before_extension('pages.pdf', '-old') 'pages-old.pdf'
jaraco/path.py
def insert_before_extension(filename, content): """ Given a filename and some content, insert the content just before the extension. >>> insert_before_extension('pages.pdf', '-old') 'pages-old.pdf' """ parts = list(os.path.splitext(filename)) parts[1:1] = [content] return ''.join(parts)
def insert_before_extension(filename, content): """ Given a filename and some content, insert the content just before the extension. >>> insert_before_extension('pages.pdf', '-old') 'pages-old.pdf' """ parts = list(os.path.splitext(filename)) parts[1:1] = [content] return ''.join(parts)
[ "Given", "a", "filename", "and", "some", "content", "insert", "the", "content", "just", "before", "the", "extension", ".", ">>>", "insert_before_extension", "(", "pages", ".", "pdf", "-", "old", ")", "pages", "-", "old", ".", "pdf" ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L73-L83
[ "def", "insert_before_extension", "(", "filename", ",", "content", ")", ":", "parts", "=", "list", "(", "os", ".", "path", ".", "splitext", "(", "filename", ")", ")", "parts", "[", "1", ":", "1", "]", "=", "[", "content", "]", "return", "''", ".", ...
39e4da09f325382e21b0917b1b5cd027edce8728
valid
recursive_glob
Like iglob, but recurse directories >>> any('path.py' in result for result in recursive_glob('.', '*.py')) True >>> all(result.startswith('.') for result in recursive_glob('.', '*.py')) True >>> len(list(recursive_glob('.', '*.foo'))) 0
jaraco/path.py
def recursive_glob(root, spec): """ Like iglob, but recurse directories >>> any('path.py' in result for result in recursive_glob('.', '*.py')) True >>> all(result.startswith('.') for result in recursive_glob('.', '*.py')) True >>> len(list(recursive_glob('.', '*.foo'))) 0 """ specs = ( os...
def recursive_glob(root, spec): """ Like iglob, but recurse directories >>> any('path.py' in result for result in recursive_glob('.', '*.py')) True >>> all(result.startswith('.') for result in recursive_glob('.', '*.py')) True >>> len(list(recursive_glob('.', '*.foo'))) 0 """ specs = ( os...
[ "Like", "iglob", "but", "recurse", "directories", ">>>", "any", "(", "path", ".", "py", "in", "result", "for", "result", "in", "recursive_glob", "(", ".", "*", ".", "py", "))", "True", ">>>", "all", "(", "result", ".", "startswith", "(", ".", ")", "f...
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L131-L154
[ "def", "recursive_glob", "(", "root", ",", "spec", ")", ":", "specs", "=", "(", "os", ".", "path", ".", "join", "(", "dirpath", ",", "dirname", ",", "spec", ")", "for", "dirpath", ",", "dirnames", ",", "filenames", "in", "os", ".", "walk", "(", "ro...
39e4da09f325382e21b0917b1b5cd027edce8728
valid
encode
Encode the name for a suitable name in the given filesystem >>> encode('Test :1') 'Test _1'
jaraco/path.py
def encode(name, system='NTFS'): """ Encode the name for a suitable name in the given filesystem >>> encode('Test :1') 'Test _1' """ assert system == 'NTFS', 'unsupported filesystem' special_characters = r'<>:"/\|?*' + ''.join(map(chr, range(32))) pattern = '|'.join(map(re.escape, special_characters)) ...
def encode(name, system='NTFS'): """ Encode the name for a suitable name in the given filesystem >>> encode('Test :1') 'Test _1' """ assert system == 'NTFS', 'unsupported filesystem' special_characters = r'<>:"/\|?*' + ''.join(map(chr, range(32))) pattern = '|'.join(map(re.escape, special_characters)) ...
[ "Encode", "the", "name", "for", "a", "suitable", "name", "in", "the", "given", "filesystem", ">>>", "encode", "(", "Test", ":", "1", ")", "Test", "_1" ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L157-L167
[ "def", "encode", "(", "name", ",", "system", "=", "'NTFS'", ")", ":", "assert", "system", "==", "'NTFS'", ",", "'unsupported filesystem'", "special_characters", "=", "r'<>:\"/\\|?*'", "+", "''", ".", "join", "(", "map", "(", "chr", ",", "range", "(", "32",...
39e4da09f325382e21b0917b1b5cd027edce8728
valid
ensure_dir_exists
wrap a function that returns a dir, making sure it exists
jaraco/path.py
def ensure_dir_exists(func): "wrap a function that returns a dir, making sure it exists" @functools.wraps(func) def make_if_not_present(): dir = func() if not os.path.isdir(dir): os.makedirs(dir) return dir return make_if_not_present
def ensure_dir_exists(func): "wrap a function that returns a dir, making sure it exists" @functools.wraps(func) def make_if_not_present(): dir = func() if not os.path.isdir(dir): os.makedirs(dir) return dir return make_if_not_present
[ "wrap", "a", "function", "that", "returns", "a", "dir", "making", "sure", "it", "exists" ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L229-L237
[ "def", "ensure_dir_exists", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "make_if_not_present", "(", ")", ":", "dir", "=", "func", "(", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "dir", ")", ":", "os"...
39e4da09f325382e21b0917b1b5cd027edce8728
valid
read_chunks
Read file in chunks of size chunk_size (or smaller). If update_func is specified, call it on every chunk with the amount read.
jaraco/path.py
def read_chunks(file, chunk_size=2048, update_func=lambda x: None): """ Read file in chunks of size chunk_size (or smaller). If update_func is specified, call it on every chunk with the amount read. """ while(True): res = file.read(chunk_size) if not res: break update_func(len(res)) yield re...
def read_chunks(file, chunk_size=2048, update_func=lambda x: None): """ Read file in chunks of size chunk_size (or smaller). If update_func is specified, call it on every chunk with the amount read. """ while(True): res = file.read(chunk_size) if not res: break update_func(len(res)) yield re...
[ "Read", "file", "in", "chunks", "of", "size", "chunk_size", "(", "or", "smaller", ")", ".", "If", "update_func", "is", "specified", "call", "it", "on", "every", "chunk", "with", "the", "amount", "read", "." ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L240-L251
[ "def", "read_chunks", "(", "file", ",", "chunk_size", "=", "2048", ",", "update_func", "=", "lambda", "x", ":", "None", ")", ":", "while", "(", "True", ")", ":", "res", "=", "file", ".", "read", "(", "chunk_size", ")", "if", "not", "res", ":", "bre...
39e4da09f325382e21b0917b1b5cd027edce8728
valid
is_hidden
Check whether a file is presumed hidden, either because the pathname starts with dot or because the platform indicates such.
jaraco/path.py
def is_hidden(path): """ Check whether a file is presumed hidden, either because the pathname starts with dot or because the platform indicates such. """ full_path = os.path.abspath(path) name = os.path.basename(full_path) def no(path): return False platform_hidden = globals().get('is_hidden_' + ...
def is_hidden(path): """ Check whether a file is presumed hidden, either because the pathname starts with dot or because the platform indicates such. """ full_path = os.path.abspath(path) name = os.path.basename(full_path) def no(path): return False platform_hidden = globals().get('is_hidden_' + ...
[ "Check", "whether", "a", "file", "is", "presumed", "hidden", "either", "because", "the", "pathname", "starts", "with", "dot", "or", "because", "the", "platform", "indicates", "such", "." ]
jaraco/jaraco.path
python
https://github.com/jaraco/jaraco.path/blob/39e4da09f325382e21b0917b1b5cd027edce8728/jaraco/path.py#L254-L266
[ "def", "is_hidden", "(", "path", ")", ":", "full_path", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "name", "=", "os", ".", "path", ".", "basename", "(", "full_path", ")", "def", "no", "(", "path", ")", ":", "return", "False", "platfo...
39e4da09f325382e21b0917b1b5cd027edce8728
valid
SerialReader.age
Get closer to your EOL
libardurep/serialreader.py
def age(self): """ Get closer to your EOL """ # 0 means this composer will never decompose if self.rounds == 1: self.do_run = False elif self.rounds > 1: self.rounds -= 1
def age(self): """ Get closer to your EOL """ # 0 means this composer will never decompose if self.rounds == 1: self.do_run = False elif self.rounds > 1: self.rounds -= 1
[ "Get", "closer", "to", "your", "EOL" ]
zwischenloesung/ardu-report-lib
python
https://github.com/zwischenloesung/ardu-report-lib/blob/51bd4a07e036065aafcb1273b151bea3fdfa50fa/libardurep/serialreader.py#L42-L50
[ "def", "age", "(", "self", ")", ":", "# 0 means this composer will never decompose", "if", "self", ".", "rounds", "==", "1", ":", "self", ".", "do_run", "=", "False", "elif", "self", ".", "rounds", ">", "1", ":", "self", ".", "rounds", "-=", "1" ]
51bd4a07e036065aafcb1273b151bea3fdfa50fa
valid
SerialReader.run
Open a connection over the serial line and receive data lines
libardurep/serialreader.py
def run(self): """ Open a connection over the serial line and receive data lines """ if not self.device: return try: data = "" while (self.do_run): try: if (self.device.inWaiting() > 1): ...
def run(self): """ Open a connection over the serial line and receive data lines """ if not self.device: return try: data = "" while (self.do_run): try: if (self.device.inWaiting() > 1): ...
[ "Open", "a", "connection", "over", "the", "serial", "line", "and", "receive", "data", "lines" ]
zwischenloesung/ardu-report-lib
python
https://github.com/zwischenloesung/ardu-report-lib/blob/51bd4a07e036065aafcb1273b151bea3fdfa50fa/libardurep/serialreader.py#L52-L89
[ "def", "run", "(", "self", ")", ":", "if", "not", "self", ".", "device", ":", "return", "try", ":", "data", "=", "\"\"", "while", "(", "self", ".", "do_run", ")", ":", "try", ":", "if", "(", "self", ".", "device", ".", "inWaiting", "(", ")", ">...
51bd4a07e036065aafcb1273b151bea3fdfa50fa
valid
ThreadCreator.append_main_thread
create & start main thread :return: None
threads_creator/entry.py
def append_main_thread(self): """create & start main thread :return: None """ thread = MainThread(main_queue=self.main_queue, main_spider=self.main_spider, branch_spider=self.branch_spider) thread.daemon = True thre...
def append_main_thread(self): """create & start main thread :return: None """ thread = MainThread(main_queue=self.main_queue, main_spider=self.main_spider, branch_spider=self.branch_spider) thread.daemon = True thre...
[ "create", "&", "start", "main", "thread" ]
ecmadao/threads-creator
python
https://github.com/ecmadao/threads-creator/blob/f081091425d4382e5e9776c395c20e1af2332657/threads_creator/entry.py#L51-L60
[ "def", "append_main_thread", "(", "self", ")", ":", "thread", "=", "MainThread", "(", "main_queue", "=", "self", ".", "main_queue", ",", "main_spider", "=", "self", ".", "main_spider", ",", "branch_spider", "=", "self", ".", "branch_spider", ")", "thread", "...
f081091425d4382e5e9776c395c20e1af2332657
valid
getTextFromNode
Scans through all children of node and gathers the text. If node has non-text child-nodes then NotTextNodeError is raised.
ambient/__init__.py
def getTextFromNode(node): """ Scans through all children of node and gathers the text. If node has non-text child-nodes then NotTextNodeError is raised. """ t = "" for n in node.childNodes: if n.nodeType == n.TEXT_NODE: t += n.nodeValue else: raise No...
def getTextFromNode(node): """ Scans through all children of node and gathers the text. If node has non-text child-nodes then NotTextNodeError is raised. """ t = "" for n in node.childNodes: if n.nodeType == n.TEXT_NODE: t += n.nodeValue else: raise No...
[ "Scans", "through", "all", "children", "of", "node", "and", "gathers", "the", "text", ".", "If", "node", "has", "non", "-", "text", "child", "-", "nodes", "then", "NotTextNodeError", "is", "raised", "." ]
praekelt/python-ambient
python
https://github.com/praekelt/python-ambient/blob/392d82a63445bcc48d2adcaab2a0cf2fb90abe7b/ambient/__init__.py#L54-L66
[ "def", "getTextFromNode", "(", "node", ")", ":", "t", "=", "\"\"", "for", "n", "in", "node", ".", "childNodes", ":", "if", "n", ".", "nodeType", "==", "n", ".", "TEXT_NODE", ":", "t", "+=", "n", ".", "nodeValue", "else", ":", "raise", "NotTextNodeErr...
392d82a63445bcc48d2adcaab2a0cf2fb90abe7b
valid
AmbientSMS.getbalance
Get the number of credits remaining at AmbientSMS
ambient/__init__.py
def getbalance(self, url='http://services.ambientmobile.co.za/credits'): """ Get the number of credits remaining at AmbientSMS """ postXMLList = [] postXMLList.append("<api-key>%s</api-key>" % self.api_key) postXMLList.append("<password>%s</password>" % self.password) ...
def getbalance(self, url='http://services.ambientmobile.co.za/credits'): """ Get the number of credits remaining at AmbientSMS """ postXMLList = [] postXMLList.append("<api-key>%s</api-key>" % self.api_key) postXMLList.append("<password>%s</password>" % self.password) ...
[ "Get", "the", "number", "of", "credits", "remaining", "at", "AmbientSMS" ]
praekelt/python-ambient
python
https://github.com/praekelt/python-ambient/blob/392d82a63445bcc48d2adcaab2a0cf2fb90abe7b/ambient/__init__.py#L123-L136
[ "def", "getbalance", "(", "self", ",", "url", "=", "'http://services.ambientmobile.co.za/credits'", ")", ":", "postXMLList", "=", "[", "]", "postXMLList", ".", "append", "(", "\"<api-key>%s</api-key>\"", "%", "self", ".", "api_key", ")", "postXMLList", ".", "appen...
392d82a63445bcc48d2adcaab2a0cf2fb90abe7b
valid
AmbientSMS.sendmsg
Send a mesage via the AmbientSMS API server
ambient/__init__.py
def sendmsg(self, message, recipient_mobiles=[], url='http://services.ambientmobile.co.za/sms', concatenate_message=True, message_id=str(time()).replace(".", ""), reply_path=None, allow_duplicates=True, ...
def sendmsg(self, message, recipient_mobiles=[], url='http://services.ambientmobile.co.za/sms', concatenate_message=True, message_id=str(time()).replace(".", ""), reply_path=None, allow_duplicates=True, ...
[ "Send", "a", "mesage", "via", "the", "AmbientSMS", "API", "server" ]
praekelt/python-ambient
python
https://github.com/praekelt/python-ambient/blob/392d82a63445bcc48d2adcaab2a0cf2fb90abe7b/ambient/__init__.py#L138-L185
[ "def", "sendmsg", "(", "self", ",", "message", ",", "recipient_mobiles", "=", "[", "]", ",", "url", "=", "'http://services.ambientmobile.co.za/sms'", ",", "concatenate_message", "=", "True", ",", "message_id", "=", "str", "(", "time", "(", ")", ")", ".", "re...
392d82a63445bcc48d2adcaab2a0cf2fb90abe7b
valid
AmbientSMS.curl
Inteface for sending web requests to the AmbientSMS API Server
ambient/__init__.py
def curl(self, url, post): """ Inteface for sending web requests to the AmbientSMS API Server """ try: req = urllib2.Request(url) req.add_header("Content-type", "application/xml") data = urllib2.urlopen(req, post.encode('utf-8')).read() except ...
def curl(self, url, post): """ Inteface for sending web requests to the AmbientSMS API Server """ try: req = urllib2.Request(url) req.add_header("Content-type", "application/xml") data = urllib2.urlopen(req, post.encode('utf-8')).read() except ...
[ "Inteface", "for", "sending", "web", "requests", "to", "the", "AmbientSMS", "API", "Server" ]
praekelt/python-ambient
python
https://github.com/praekelt/python-ambient/blob/392d82a63445bcc48d2adcaab2a0cf2fb90abe7b/ambient/__init__.py#L187-L197
[ "def", "curl", "(", "self", ",", "url", ",", "post", ")", ":", "try", ":", "req", "=", "urllib2", ".", "Request", "(", "url", ")", "req", ".", "add_header", "(", "\"Content-type\"", ",", "\"application/xml\"", ")", "data", "=", "urllib2", ".", "urlopen...
392d82a63445bcc48d2adcaab2a0cf2fb90abe7b
valid
InterceptedCommand.execute
Executes the command given specific arguments as an input. Args: correlation_id: a unique correlation/transaction id args: command arguments Returns: an execution result. Raises: MicroserviceError: when execution fails for w...
pip_services_commons/commands/InterceptedCommand.py
def execute(self, correlation_id, args): """ Executes the command given specific arguments as an input. Args: correlation_id: a unique correlation/transaction id args: command arguments Returns: an execution result. Rai...
def execute(self, correlation_id, args): """ Executes the command given specific arguments as an input. Args: correlation_id: a unique correlation/transaction id args: command arguments Returns: an execution result. Rai...
[ "Executes", "the", "command", "given", "specific", "arguments", "as", "an", "input", ".", "Args", ":", "correlation_id", ":", "a", "unique", "correlation", "/", "transaction", "id", "args", ":", "command", "arguments", "Returns", ":", "an", "execution", "resul...
pip-services/pip-services-commons-python
python
https://github.com/pip-services/pip-services-commons-python/blob/2205b18c45c60372966c62c1f23ac4fbc31e11b3/pip_services_commons/commands/InterceptedCommand.py#L42-L55
[ "def", "execute", "(", "self", ",", "correlation_id", ",", "args", ")", ":", "return", "self", ".", "_intercepter", ".", "execute", "(", "_next", ",", "correlation_id", ",", "args", ")" ]
2205b18c45c60372966c62c1f23ac4fbc31e11b3
valid
DefaultMinifier.contents
Called for each file Must return file content Can be wrapped :type f: static_bundle.files.StaticFileResult :type text: str|unicode :rtype: str|unicode
static_bundle/minifiers.py
def contents(self, f, text): """ Called for each file Must return file content Can be wrapped :type f: static_bundle.files.StaticFileResult :type text: str|unicode :rtype: str|unicode """ text += self._read(f.abs_path) + "\r\n" return text
def contents(self, f, text): """ Called for each file Must return file content Can be wrapped :type f: static_bundle.files.StaticFileResult :type text: str|unicode :rtype: str|unicode """ text += self._read(f.abs_path) + "\r\n" return text
[ "Called", "for", "each", "file", "Must", "return", "file", "content", "Can", "be", "wrapped" ]
Rikanishu/static-bundle
python
https://github.com/Rikanishu/static-bundle/blob/2f6458cb9d9d9049b4fd829f7d6951a45d547c68/static_bundle/minifiers.py#L34-L45
[ "def", "contents", "(", "self", ",", "f", ",", "text", ")", ":", "text", "+=", "self", ".", "_read", "(", "f", ".", "abs_path", ")", "+", "\"\\r\\n\"", "return", "text" ]
2f6458cb9d9d9049b4fd829f7d6951a45d547c68
valid
is_date_type
Return True if the class is a date type.
era.py
def is_date_type(cls): """Return True if the class is a date type.""" if not isinstance(cls, type): return False return issubclass(cls, date) and not issubclass(cls, datetime)
def is_date_type(cls): """Return True if the class is a date type.""" if not isinstance(cls, type): return False return issubclass(cls, date) and not issubclass(cls, datetime)
[ "Return", "True", "if", "the", "class", "is", "a", "date", "type", "." ]
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L76-L80
[ "def", "is_date_type", "(", "cls", ")", ":", "if", "not", "isinstance", "(", "cls", ",", "type", ")", ":", "return", "False", "return", "issubclass", "(", "cls", ",", "date", ")", "and", "not", "issubclass", "(", "cls", ",", "datetime", ")" ]
73994c82360e65a983c803b1182892e2138320b2
valid
to_datetime
Convert a date or time to a datetime. If when is a date then it sets the time to midnight. If when is a time it sets the date to the epoch. If when is None or a datetime it returns when. Otherwise a TypeError is raised. Returned datetimes have tzinfo set to None unless when is a datetime with tzinfo set in ...
era.py
def to_datetime(when): """ Convert a date or time to a datetime. If when is a date then it sets the time to midnight. If when is a time it sets the date to the epoch. If when is None or a datetime it returns when. Otherwise a TypeError is raised. Returned datetimes have tzinfo set to None unless when is...
def to_datetime(when): """ Convert a date or time to a datetime. If when is a date then it sets the time to midnight. If when is a time it sets the date to the epoch. If when is None or a datetime it returns when. Otherwise a TypeError is raised. Returned datetimes have tzinfo set to None unless when is...
[ "Convert", "a", "date", "or", "time", "to", "a", "datetime", ".", "If", "when", "is", "a", "date", "then", "it", "sets", "the", "time", "to", "midnight", ".", "If", "when", "is", "a", "time", "it", "sets", "the", "date", "to", "the", "epoch", ".", ...
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L95-L108
[ "def", "to_datetime", "(", "when", ")", ":", "if", "when", "is", "None", "or", "is_datetime", "(", "when", ")", ":", "return", "when", "if", "is_time", "(", "when", ")", ":", "return", "datetime", ".", "combine", "(", "epoch", ".", "date", "(", ")", ...
73994c82360e65a983c803b1182892e2138320b2
valid
totz
Return a date, time, or datetime converted to a datetime in the given timezone. If when is a datetime and has no timezone it is assumed to be local time. Date and time objects are also assumed to be UTC. The tz value defaults to UTC. Raise TypeError if when cannot be converted to a datetime.
era.py
def totz(when, tz=None): """ Return a date, time, or datetime converted to a datetime in the given timezone. If when is a datetime and has no timezone it is assumed to be local time. Date and time objects are also assumed to be UTC. The tz value defaults to UTC. Raise TypeError if when cannot be convert...
def totz(when, tz=None): """ Return a date, time, or datetime converted to a datetime in the given timezone. If when is a datetime and has no timezone it is assumed to be local time. Date and time objects are also assumed to be UTC. The tz value defaults to UTC. Raise TypeError if when cannot be convert...
[ "Return", "a", "date", "time", "or", "datetime", "converted", "to", "a", "datetime", "in", "the", "given", "timezone", ".", "If", "when", "is", "a", "datetime", "and", "has", "no", "timezone", "it", "is", "assumed", "to", "be", "local", "time", ".", "D...
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L121-L133
[ "def", "totz", "(", "when", ",", "tz", "=", "None", ")", ":", "if", "when", "is", "None", ":", "return", "None", "when", "=", "to_datetime", "(", "when", ")", "if", "when", ".", "tzinfo", "is", "None", ":", "when", "=", "when", ".", "replace", "(...
73994c82360e65a983c803b1182892e2138320b2
valid
timeago
Return a datetime so much time ago. Takes the same arguments as timedelta().
era.py
def timeago(tz=None, *args, **kwargs): """Return a datetime so much time ago. Takes the same arguments as timedelta().""" return totz(datetime.now(), tz) - timedelta(*args, **kwargs)
def timeago(tz=None, *args, **kwargs): """Return a datetime so much time ago. Takes the same arguments as timedelta().""" return totz(datetime.now(), tz) - timedelta(*args, **kwargs)
[ "Return", "a", "datetime", "so", "much", "time", "ago", ".", "Takes", "the", "same", "arguments", "as", "timedelta", "()", "." ]
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L156-L158
[ "def", "timeago", "(", "tz", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "totz", "(", "datetime", ".", "now", "(", ")", ",", "tz", ")", "-", "timedelta", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
73994c82360e65a983c803b1182892e2138320b2
valid
ts
Return a Unix timestamp in seconds for the provided datetime. The `totz` function is called on the datetime to convert it to the provided timezone. It will be converted to UTC if no timezone is provided.
era.py
def ts(when, tz=None): """ Return a Unix timestamp in seconds for the provided datetime. The `totz` function is called on the datetime to convert it to the provided timezone. It will be converted to UTC if no timezone is provided. """ if not when: return None when = totz(when, tz) ...
def ts(when, tz=None): """ Return a Unix timestamp in seconds for the provided datetime. The `totz` function is called on the datetime to convert it to the provided timezone. It will be converted to UTC if no timezone is provided. """ if not when: return None when = totz(when, tz) ...
[ "Return", "a", "Unix", "timestamp", "in", "seconds", "for", "the", "provided", "datetime", ".", "The", "totz", "function", "is", "called", "on", "the", "datetime", "to", "convert", "it", "to", "the", "provided", "timezone", ".", "It", "will", "be", "conver...
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L161-L170
[ "def", "ts", "(", "when", ",", "tz", "=", "None", ")", ":", "if", "not", "when", ":", "return", "None", "when", "=", "totz", "(", "when", ",", "tz", ")", "return", "calendar", ".", "timegm", "(", "when", ".", "timetuple", "(", ")", ")" ]
73994c82360e65a983c803b1182892e2138320b2
valid
tsms
Return a Unix timestamp in milliseconds for the provided datetime. The `totz` function is called on the datetime to convert it to the provided timezone. It will be converted to UTC if no timezone is provided.
era.py
def tsms(when, tz=None): """ Return a Unix timestamp in milliseconds for the provided datetime. The `totz` function is called on the datetime to convert it to the provided timezone. It will be converted to UTC if no timezone is provided. """ if not when: return None when = totz(when,...
def tsms(when, tz=None): """ Return a Unix timestamp in milliseconds for the provided datetime. The `totz` function is called on the datetime to convert it to the provided timezone. It will be converted to UTC if no timezone is provided. """ if not when: return None when = totz(when,...
[ "Return", "a", "Unix", "timestamp", "in", "milliseconds", "for", "the", "provided", "datetime", ".", "The", "totz", "function", "is", "called", "on", "the", "datetime", "to", "convert", "it", "to", "the", "provided", "timezone", ".", "It", "will", "be", "c...
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L173-L182
[ "def", "tsms", "(", "when", ",", "tz", "=", "None", ")", ":", "if", "not", "when", ":", "return", "None", "when", "=", "totz", "(", "when", ",", "tz", ")", "return", "calendar", ".", "timegm", "(", "when", ".", "timetuple", "(", ")", ")", "*", ...
73994c82360e65a983c803b1182892e2138320b2
valid
fromts
Return the datetime representation of the provided Unix timestamp. By defaults the timestamp is interpreted as UTC. If tzin is set it will be interpreted as this timestamp instead. By default the output datetime will have UTC time. If tzout is set it will be converted in this timezone instead.
era.py
def fromts(ts, tzin=None, tzout=None): """ Return the datetime representation of the provided Unix timestamp. By defaults the timestamp is interpreted as UTC. If tzin is set it will be interpreted as this timestamp instead. By default the output datetime will have UTC time. If tzout is set it will be co...
def fromts(ts, tzin=None, tzout=None): """ Return the datetime representation of the provided Unix timestamp. By defaults the timestamp is interpreted as UTC. If tzin is set it will be interpreted as this timestamp instead. By default the output datetime will have UTC time. If tzout is set it will be co...
[ "Return", "the", "datetime", "representation", "of", "the", "provided", "Unix", "timestamp", ".", "By", "defaults", "the", "timestamp", "is", "interpreted", "as", "UTC", ".", "If", "tzin", "is", "set", "it", "will", "be", "interpreted", "as", "this", "timest...
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L185-L195
[ "def", "fromts", "(", "ts", ",", "tzin", "=", "None", ",", "tzout", "=", "None", ")", ":", "if", "ts", "is", "None", ":", "return", "None", "when", "=", "datetime", ".", "utcfromtimestamp", "(", "ts", ")", ".", "replace", "(", "tzinfo", "=", "tzin"...
73994c82360e65a983c803b1182892e2138320b2
valid
fromtsms
Return the Unix timestamp in milliseconds as a datetime object. If tz is set it will be converted to the requested timezone otherwise it defaults to UTC.
era.py
def fromtsms(ts, tzin=None, tzout=None): """ Return the Unix timestamp in milliseconds as a datetime object. If tz is set it will be converted to the requested timezone otherwise it defaults to UTC. """ if ts is None: return None when = datetime.utcfromtimestamp(ts / 1000).replace(micros...
def fromtsms(ts, tzin=None, tzout=None): """ Return the Unix timestamp in milliseconds as a datetime object. If tz is set it will be converted to the requested timezone otherwise it defaults to UTC. """ if ts is None: return None when = datetime.utcfromtimestamp(ts / 1000).replace(micros...
[ "Return", "the", "Unix", "timestamp", "in", "milliseconds", "as", "a", "datetime", "object", ".", "If", "tz", "is", "set", "it", "will", "be", "converted", "to", "the", "requested", "timezone", "otherwise", "it", "defaults", "to", "UTC", "." ]
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L198-L207
[ "def", "fromtsms", "(", "ts", ",", "tzin", "=", "None", ",", "tzout", "=", "None", ")", ":", "if", "ts", "is", "None", ":", "return", "None", "when", "=", "datetime", ".", "utcfromtimestamp", "(", "ts", "/", "1000", ")", ".", "replace", "(", "micro...
73994c82360e65a983c803b1182892e2138320b2
valid
truncate
Return the datetime truncated to the precision of the provided unit.
era.py
def truncate(when, unit, week_start=mon): """Return the datetime truncated to the precision of the provided unit.""" if is_datetime(when): if unit == millisecond: return when.replace(microsecond=int(round(when.microsecond / 1000.0)) * 1000) elif unit == second: return whe...
def truncate(when, unit, week_start=mon): """Return the datetime truncated to the precision of the provided unit.""" if is_datetime(when): if unit == millisecond: return when.replace(microsecond=int(round(when.microsecond / 1000.0)) * 1000) elif unit == second: return whe...
[ "Return", "the", "datetime", "truncated", "to", "the", "precision", "of", "the", "provided", "unit", "." ]
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L210-L245
[ "def", "truncate", "(", "when", ",", "unit", ",", "week_start", "=", "mon", ")", ":", "if", "is_datetime", "(", "when", ")", ":", "if", "unit", "==", "millisecond", ":", "return", "when", ".", "replace", "(", "microsecond", "=", "int", "(", "round", ...
73994c82360e65a983c803b1182892e2138320b2
valid
weekday
Return the date for the day of this week.
era.py
def weekday(when, weekday, start=mon): """Return the date for the day of this week.""" if isinstance(when, datetime): when = when.date() today = when.weekday() delta = weekday - today if weekday < start and today >= start: delta += 7 elif weekday >= start and today < start: ...
def weekday(when, weekday, start=mon): """Return the date for the day of this week.""" if isinstance(when, datetime): when = when.date() today = when.weekday() delta = weekday - today if weekday < start and today >= start: delta += 7 elif weekday >= start and today < start: ...
[ "Return", "the", "date", "for", "the", "day", "of", "this", "week", "." ]
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L248-L259
[ "def", "weekday", "(", "when", ",", "weekday", ",", "start", "=", "mon", ")", ":", "if", "isinstance", "(", "when", ",", "datetime", ")", ":", "when", "=", "when", ".", "date", "(", ")", "today", "=", "when", ".", "weekday", "(", ")", "delta", "=...
73994c82360e65a983c803b1182892e2138320b2
valid
prevweekday
Return the date for the most recent day of the week. If inclusive is True (the default) today may count as the weekday we're looking for.
era.py
def prevweekday(when, weekday, inclusive=True): """ Return the date for the most recent day of the week. If inclusive is True (the default) today may count as the weekday we're looking for. """ if isinstance(when, datetime): when = when.date() delta = weekday - when.weekday() if (inc...
def prevweekday(when, weekday, inclusive=True): """ Return the date for the most recent day of the week. If inclusive is True (the default) today may count as the weekday we're looking for. """ if isinstance(when, datetime): when = when.date() delta = weekday - when.weekday() if (inc...
[ "Return", "the", "date", "for", "the", "most", "recent", "day", "of", "the", "week", ".", "If", "inclusive", "is", "True", "(", "the", "default", ")", "today", "may", "count", "as", "the", "weekday", "we", "re", "looking", "for", "." ]
zenreach/py-era
python
https://github.com/zenreach/py-era/blob/73994c82360e65a983c803b1182892e2138320b2/era.py#L262-L272
[ "def", "prevweekday", "(", "when", ",", "weekday", ",", "inclusive", "=", "True", ")", ":", "if", "isinstance", "(", "when", ",", "datetime", ")", ":", "when", "=", "when", ".", "date", "(", ")", "delta", "=", "weekday", "-", "when", ".", "weekday", ...
73994c82360e65a983c803b1182892e2138320b2
valid
opt_normalizations
**optimization algorithm for scale variables (positive value of unknown magnitude)** Each parameter is a normalization of a feature, and its value is sought. The parameters are handled in order (assumed to be independent), but a second round can be run. Various magnitudes of the normalization are tried. If the n...
jbopt/independent.py
def opt_normalizations(params, func, limits, abandon_threshold=100, noimprovement_threshold=1e-3, disp=0): """ **optimization algorithm for scale variables (positive value of unknown magnitude)** Each parameter is a normalization of a feature, and its value is sought. The parameters are handled in order (assumed...
def opt_normalizations(params, func, limits, abandon_threshold=100, noimprovement_threshold=1e-3, disp=0): """ **optimization algorithm for scale variables (positive value of unknown magnitude)** Each parameter is a normalization of a feature, and its value is sought. The parameters are handled in order (assumed...
[ "**", "optimization", "algorithm", "for", "scale", "variables", "(", "positive", "value", "of", "unknown", "magnitude", ")", "**", "Each", "parameter", "is", "a", "normalization", "of", "a", "feature", "and", "its", "value", "is", "sought", ".", "The", "para...
JohannesBuchner/jbopt
python
https://github.com/JohannesBuchner/jbopt/blob/11b721ea001625ad7820f71ff684723c71216646/jbopt/independent.py#L10-L86
[ "def", "opt_normalizations", "(", "params", ",", "func", ",", "limits", ",", "abandon_threshold", "=", "100", ",", "noimprovement_threshold", "=", "1e-3", ",", "disp", "=", "0", ")", ":", "newparams", "=", "numpy", ".", "copy", "(", "params", ")", "lower",...
11b721ea001625ad7820f71ff684723c71216646
valid
opt_grid
see :func:`optimize1d.optimize`, considers each parameter in order :param ftol: difference in values at which the function can be considered flat :param compute_errors: compute standard deviation of gaussian around optimum
jbopt/independent.py
def opt_grid(params, func, limits, ftol=0.01, disp=0, compute_errors=True): """ see :func:`optimize1d.optimize`, considers each parameter in order :param ftol: difference in values at which the function can be considered flat :param compute_errors: compute standard deviation of gaussian around optimum """ ...
def opt_grid(params, func, limits, ftol=0.01, disp=0, compute_errors=True): """ see :func:`optimize1d.optimize`, considers each parameter in order :param ftol: difference in values at which the function can be considered flat :param compute_errors: compute standard deviation of gaussian around optimum """ ...
[ "see", ":", "func", ":", "optimize1d", ".", "optimize", "considers", "each", "parameter", "in", "order", ":", "param", "ftol", ":", "difference", "in", "values", "at", "which", "the", "function", "can", "be", "considered", "flat", ":", "param", "compute_erro...
JohannesBuchner/jbopt
python
https://github.com/JohannesBuchner/jbopt/blob/11b721ea001625ad7820f71ff684723c71216646/jbopt/independent.py#L90-L131
[ "def", "opt_grid", "(", "params", ",", "func", ",", "limits", ",", "ftol", "=", "0.01", ",", "disp", "=", "0", ",", "compute_errors", "=", "True", ")", ":", "caches", "=", "[", "[", "]", "for", "p", "in", "params", "]", "newparams", "=", "numpy", ...
11b721ea001625ad7820f71ff684723c71216646
valid
opt_grid_parallel
parallelized version of :func:`opt_grid`
jbopt/independent.py
def opt_grid_parallel(params, func, limits, ftol=0.01, disp=0, compute_errors=True): """ parallelized version of :func:`opt_grid` """ import multiprocessing def spawn(f): def fun(q_in,q_out): while True: i,x = q_in.get() if i == None: break q_out.put((i,f(x))) return fun ...
def opt_grid_parallel(params, func, limits, ftol=0.01, disp=0, compute_errors=True): """ parallelized version of :func:`opt_grid` """ import multiprocessing def spawn(f): def fun(q_in,q_out): while True: i,x = q_in.get() if i == None: break q_out.put((i,f(x))) return fun ...
[ "parallelized", "version", "of", ":", "func", ":", "opt_grid" ]
JohannesBuchner/jbopt
python
https://github.com/JohannesBuchner/jbopt/blob/11b721ea001625ad7820f71ff684723c71216646/jbopt/independent.py#L133-L214
[ "def", "opt_grid_parallel", "(", "params", ",", "func", ",", "limits", ",", "ftol", "=", "0.01", ",", "disp", "=", "0", ",", "compute_errors", "=", "True", ")", ":", "import", "multiprocessing", "def", "spawn", "(", "f", ")", ":", "def", "fun", "(", ...
11b721ea001625ad7820f71ff684723c71216646
valid
_GetNativeEolStyle
Internal function that determines EOL_STYLE_NATIVE constant with the proper value for the current platform.
zerotk/easyfs/_easyfs.py
def _GetNativeEolStyle(platform=sys.platform): ''' Internal function that determines EOL_STYLE_NATIVE constant with the proper value for the current platform. ''' _NATIVE_EOL_STYLE_MAP = { 'win32' : EOL_STYLE_WINDOWS, 'linux2' : EOL_STYLE_UNIX, 'linux' : EOL_STYLE_UNIX, ...
def _GetNativeEolStyle(platform=sys.platform): ''' Internal function that determines EOL_STYLE_NATIVE constant with the proper value for the current platform. ''' _NATIVE_EOL_STYLE_MAP = { 'win32' : EOL_STYLE_WINDOWS, 'linux2' : EOL_STYLE_UNIX, 'linux' : EOL_STYLE_UNIX, ...
[ "Internal", "function", "that", "determines", "EOL_STYLE_NATIVE", "constant", "with", "the", "proper", "value", "for", "the", "current", "platform", "." ]
zerotk/easyfs
python
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L29-L46
[ "def", "_GetNativeEolStyle", "(", "platform", "=", "sys", ".", "platform", ")", ":", "_NATIVE_EOL_STYLE_MAP", "=", "{", "'win32'", ":", "EOL_STYLE_WINDOWS", ",", "'linux2'", ":", "EOL_STYLE_UNIX", ",", "'linux'", ":", "EOL_STYLE_UNIX", ",", "'darwin'", ":", "EOL...
140923db51fb91d5a5847ad17412e8bce51ba3da
valid
Cwd
Context manager for current directory (uses with_statement) e.g.: # working on some directory with Cwd('/home/new_dir'): # working on new_dir # working on some directory again :param unicode directory: Target directory to enter
zerotk/easyfs/_easyfs.py
def Cwd(directory): ''' Context manager for current directory (uses with_statement) e.g.: # working on some directory with Cwd('/home/new_dir'): # working on new_dir # working on some directory again :param unicode directory: Target directory to enter '...
def Cwd(directory): ''' Context manager for current directory (uses with_statement) e.g.: # working on some directory with Cwd('/home/new_dir'): # working on new_dir # working on some directory again :param unicode directory: Target directory to enter '...
[ "Context", "manager", "for", "current", "directory", "(", "uses", "with_statement", ")" ]
zerotk/easyfs
python
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L70-L90
[ "def", "Cwd", "(", "directory", ")", ":", "old_directory", "=", "six", ".", "moves", ".", "getcwd", "(", ")", "if", "directory", "is", "not", "None", ":", "os", ".", "chdir", "(", "directory", ")", "try", ":", "yield", "directory", "finally", ":", "o...
140923db51fb91d5a5847ad17412e8bce51ba3da
valid
NormalizePath
Normalizes a path maintaining the final slashes. Some environment variables need the final slash in order to work. Ex. The SOURCES_DIR set by subversion must end with a slash because of the way it is used in the Visual Studio projects. :param unicode path: The path to normalize. :rtype: ...
zerotk/easyfs/_easyfs.py
def NormalizePath(path): ''' Normalizes a path maintaining the final slashes. Some environment variables need the final slash in order to work. Ex. The SOURCES_DIR set by subversion must end with a slash because of the way it is used in the Visual Studio projects. :param unicode path: ...
def NormalizePath(path): ''' Normalizes a path maintaining the final slashes. Some environment variables need the final slash in order to work. Ex. The SOURCES_DIR set by subversion must end with a slash because of the way it is used in the Visual Studio projects. :param unicode path: ...
[ "Normalizes", "a", "path", "maintaining", "the", "final", "slashes", "." ]
zerotk/easyfs
python
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L97-L117
[ "def", "NormalizePath", "(", "path", ")", ":", "if", "path", ".", "endswith", "(", "'/'", ")", "or", "path", ".", "endswith", "(", "'\\\\'", ")", ":", "slash", "=", "os", ".", "path", ".", "sep", "else", ":", "slash", "=", "''", "return", "os", "...
140923db51fb91d5a5847ad17412e8bce51ba3da
valid
CanonicalPath
Returns a version of a path that is unique. Given two paths path1 and path2: CanonicalPath(path1) == CanonicalPath(path2) if and only if they represent the same file on the host OS. Takes account of case, slashes and relative paths. :param unicode path: The original path. :rtype: ...
zerotk/easyfs/_easyfs.py
def CanonicalPath(path): ''' Returns a version of a path that is unique. Given two paths path1 and path2: CanonicalPath(path1) == CanonicalPath(path2) if and only if they represent the same file on the host OS. Takes account of case, slashes and relative paths. :param unicode path: ...
def CanonicalPath(path): ''' Returns a version of a path that is unique. Given two paths path1 and path2: CanonicalPath(path1) == CanonicalPath(path2) if and only if they represent the same file on the host OS. Takes account of case, slashes and relative paths. :param unicode path: ...
[ "Returns", "a", "version", "of", "a", "path", "that", "is", "unique", "." ]
zerotk/easyfs
python
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L123-L142
[ "def", "CanonicalPath", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "normpath", "(", "path", ")", "path", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "path", "=", "os", ".", "path", ".", "normcase", "(", "path", ")",...
140923db51fb91d5a5847ad17412e8bce51ba3da
valid
StandardizePath
Replaces all slashes and backslashes with the target separator StandardPath: We are defining that the standard-path is the one with only back-slashes in it, either on Windows or any other platform. :param bool strip: If True, removes additional slashes from the end of the path.
zerotk/easyfs/_easyfs.py
def StandardizePath(path, strip=False): ''' Replaces all slashes and backslashes with the target separator StandardPath: We are defining that the standard-path is the one with only back-slashes in it, either on Windows or any other platform. :param bool strip: If True, removes ...
def StandardizePath(path, strip=False): ''' Replaces all slashes and backslashes with the target separator StandardPath: We are defining that the standard-path is the one with only back-slashes in it, either on Windows or any other platform. :param bool strip: If True, removes ...
[ "Replaces", "all", "slashes", "and", "backslashes", "with", "the", "target", "separator" ]
zerotk/easyfs
python
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L148-L162
[ "def", "StandardizePath", "(", "path", ",", "strip", "=", "False", ")", ":", "path", "=", "path", ".", "replace", "(", "SEPARATOR_WINDOWS", ",", "SEPARATOR_UNIX", ")", "if", "strip", ":", "path", "=", "path", ".", "rstrip", "(", "SEPARATOR_UNIX", ")", "r...
140923db51fb91d5a5847ad17412e8bce51ba3da
valid
NormStandardPath
Normalizes a standard path (posixpath.normpath) maintaining any slashes at the end of the path. Normalize: Removes any local references in the path "/../" StandardPath: We are defining that the standard-path is the one with only back-slashes in it, either on Windows or any other platfo...
zerotk/easyfs/_easyfs.py
def NormStandardPath(path): ''' Normalizes a standard path (posixpath.normpath) maintaining any slashes at the end of the path. Normalize: Removes any local references in the path "/../" StandardPath: We are defining that the standard-path is the one with only back-slashes in it, eithe...
def NormStandardPath(path): ''' Normalizes a standard path (posixpath.normpath) maintaining any slashes at the end of the path. Normalize: Removes any local references in the path "/../" StandardPath: We are defining that the standard-path is the one with only back-slashes in it, eithe...
[ "Normalizes", "a", "standard", "path", "(", "posixpath", ".", "normpath", ")", "maintaining", "any", "slashes", "at", "the", "end", "of", "the", "path", "." ]
zerotk/easyfs
python
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L169-L185
[ "def", "NormStandardPath", "(", "path", ")", ":", "import", "posixpath", "if", "path", ".", "endswith", "(", "'/'", ")", ":", "slash", "=", "'/'", "else", ":", "slash", "=", "''", "return", "posixpath", ".", "normpath", "(", "path", ")", "+", "slash" ]
140923db51fb91d5a5847ad17412e8bce51ba3da
valid
CreateMD5
Creates a md5 file from a source file (contents are the md5 hash of source file) :param unicode source_filename: Path to source file :type target_filename: unicode or None :param target_filename: Name of the target file with the md5 contents If None, defaults to source_filename + ...
zerotk/easyfs/_easyfs.py
def CreateMD5(source_filename, target_filename=None): ''' Creates a md5 file from a source file (contents are the md5 hash of source file) :param unicode source_filename: Path to source file :type target_filename: unicode or None :param target_filename: Name of the target file with...
def CreateMD5(source_filename, target_filename=None): ''' Creates a md5 file from a source file (contents are the md5 hash of source file) :param unicode source_filename: Path to source file :type target_filename: unicode or None :param target_filename: Name of the target file with...
[ "Creates", "a", "md5", "file", "from", "a", "source", "file", "(", "contents", "are", "the", "md5", "hash", "of", "source", "file", ")" ]
zerotk/easyfs
python
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L192-L220
[ "def", "CreateMD5", "(", "source_filename", ",", "target_filename", "=", "None", ")", ":", "if", "target_filename", "is", "None", ":", "target_filename", "=", "source_filename", "+", "'.md5'", "from", "six", ".", "moves", ".", "urllib", ".", "parse", "import",...
140923db51fb91d5a5847ad17412e8bce51ba3da
valid
CopyFile
Copy a file from source to target. :param source_filename: @see _DoCopyFile :param target_filename: @see _DoCopyFile :param bool md5_check: If True, checks md5 files (of both source and target files), if they match, skip this copy and return MD5_SKIP Md5 files a...
zerotk/easyfs/_easyfs.py
def CopyFile(source_filename, target_filename, override=True, md5_check=False, copy_symlink=True): ''' Copy a file from source to target. :param source_filename: @see _DoCopyFile :param target_filename: @see _DoCopyFile :param bool md5_check: If True, checks md5 files (o...
def CopyFile(source_filename, target_filename, override=True, md5_check=False, copy_symlink=True): ''' Copy a file from source to target. :param source_filename: @see _DoCopyFile :param target_filename: @see _DoCopyFile :param bool md5_check: If True, checks md5 files (o...
[ "Copy", "a", "file", "from", "source", "to", "target", "." ]
zerotk/easyfs
python
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L228-L299
[ "def", "CopyFile", "(", "source_filename", ",", "target_filename", ",", "override", "=", "True", ",", "md5_check", "=", "False", ",", "copy_symlink", "=", "True", ")", ":", "from", ".", "_exceptions", "import", "FileNotFoundError", "# Check override", "if", "not...
140923db51fb91d5a5847ad17412e8bce51ba3da