repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
pandas-dev/pandas
pandas/tseries/offsets.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/tseries/offsets.py#L669-L678
def rollforward(self, dt): """ Roll provided date forward to next offset only if not on offset. """ if not self.onOffset(dt): if self.n >= 0: return self._next_opening_time(dt) else: return self._prev_opening_time(dt) return...
[ "def", "rollforward", "(", "self", ",", "dt", ")", ":", "if", "not", "self", ".", "onOffset", "(", "dt", ")", ":", "if", "self", ".", "n", ">=", "0", ":", "return", "self", ".", "_next_opening_time", "(", "dt", ")", "else", ":", "return", "self", ...
Roll provided date forward to next offset only if not on offset.
[ "Roll", "provided", "date", "forward", "to", "next", "offset", "only", "if", "not", "on", "offset", "." ]
python
train
31.4
pypa/pipenv
pipenv/vendor/toml/encoder.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/toml/encoder.py#L11-L29
def dump(o, f): """Writes out dict as toml to a file Args: o: Object to dump into toml f: File descriptor where the toml should be stored Returns: String containing the toml corresponding to dictionary Raises: TypeError: When anything other than file descriptor is pass...
[ "def", "dump", "(", "o", ",", "f", ")", ":", "if", "not", "f", ".", "write", ":", "raise", "TypeError", "(", "\"You can only dump an object to a file descriptor\"", ")", "d", "=", "dumps", "(", "o", ")", "f", ".", "write", "(", "d", ")", "return", "d" ...
Writes out dict as toml to a file Args: o: Object to dump into toml f: File descriptor where the toml should be stored Returns: String containing the toml corresponding to dictionary Raises: TypeError: When anything other than file descriptor is passed
[ "Writes", "out", "dict", "as", "toml", "to", "a", "file" ]
python
train
23.894737
datacamp/protowhat
protowhat/checks/check_files.py
https://github.com/datacamp/protowhat/blob/a392b4e51e07a2e50e7b7f6ad918b3f5cbb63edc/protowhat/checks/check_files.py#L7-L50
def check_file( state, fname, missing_msg="Did you create a file named `{}`?", is_dir_msg="Want to check a file named `{}`, but found a directory.", parse=True, use_fs=True, use_solution=False, ): """Test whether file exists, and make its contents the student code. Note: this SCT fa...
[ "def", "check_file", "(", "state", ",", "fname", ",", "missing_msg", "=", "\"Did you create a file named `{}`?\"", ",", "is_dir_msg", "=", "\"Want to check a file named `{}`, but found a directory.\"", ",", "parse", "=", "True", ",", "use_fs", "=", "True", ",", "use_sol...
Test whether file exists, and make its contents the student code. Note: this SCT fails if the file is a directory.
[ "Test", "whether", "file", "exists", "and", "make", "its", "contents", "the", "student", "code", "." ]
python
train
30.772727
StackStorm/pybind
pybind/slxos/v17r_1_01a/ipv6_acl/ipv6/access_list/extended/seq/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/ipv6_acl/ipv6/access_list/extended/seq/__init__.py#L338-L359
def _set_sport(self, v, load=False): """ Setter method for sport, mapped from YANG variable /ipv6_acl/ipv6/access_list/extended/seq/sport (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_sport is considered as a private method. Backends looking to popula...
[ "def", "_set_sport", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base", ...
Setter method for sport, mapped from YANG variable /ipv6_acl/ipv6/access_list/extended/seq/sport (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_sport is considered as a private method. Backends looking to populate this variable should do so via calling thi...
[ "Setter", "method", "for", "sport", "mapped", "from", "YANG", "variable", "/", "ipv6_acl", "/", "ipv6", "/", "access_list", "/", "extended", "/", "seq", "/", "sport", "(", "enumeration", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "con...
python
train
102.136364
astroML/gatspy
gatspy/datasets/rrlyrae.py
https://github.com/astroML/gatspy/blob/a8f94082a3f27dfe9cb58165707b883bf28d9223/gatspy/datasets/rrlyrae.py#L186-L195
def get_obsmeta(self, lcid): """Get the observation metadata for the given id. This is table 3 of Sesar 2010 """ if self._obsdata is None: self._obsdata = fetch_rrlyrae_fitdata() i = np.where(self._obsdata['id'] == lcid)[0] if len(i) == 0: raise Va...
[ "def", "get_obsmeta", "(", "self", ",", "lcid", ")", ":", "if", "self", ".", "_obsdata", "is", "None", ":", "self", ".", "_obsdata", "=", "fetch_rrlyrae_fitdata", "(", ")", "i", "=", "np", ".", "where", "(", "self", ".", "_obsdata", "[", "'id'", "]",...
Get the observation metadata for the given id. This is table 3 of Sesar 2010
[ "Get", "the", "observation", "metadata", "for", "the", "given", "id", ".", "This", "is", "table", "3", "of", "Sesar", "2010" ]
python
train
38.8
GPflow/GPflow
gpflow/training/monitor.py
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/training/monitor.py#L550-L565
def _growing_step_sequence(interval_growth, max_interval, init_interval, start_level=None): """ Returns an iterator that constructs a sequence of trigger levels with growing intervals. The interval is growing exponentially until it reaches the maximum value. Then the interval stays the s...
[ "def", "_growing_step_sequence", "(", "interval_growth", ",", "max_interval", ",", "init_interval", ",", "start_level", "=", "None", ")", ":", "interval", "=", "init_interval", "next_level", "=", "start_level", "or", "init_interval", "while", "True", ":", "yield", ...
Returns an iterator that constructs a sequence of trigger levels with growing intervals. The interval is growing exponentially until it reaches the maximum value. Then the interval stays the same and the sequence becomes linear. An optional starting level `start_level` defaults to the initial i...
[ "Returns", "an", "iterator", "that", "constructs", "a", "sequence", "of", "trigger", "levels", "with", "growing", "intervals", ".", "The", "interval", "is", "growing", "exponentially", "until", "it", "reaches", "the", "maximum", "value", ".", "Then", "the", "i...
python
train
50.9375
apple/turicreate
src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_mxnet_converter.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_mxnet_converter.py#L127-L272
def convert(model, input_shape, class_labels=None, mode=None, preprocessor_args=None, builder=None, verbose=True): """Convert an MXNet model to the protobuf spec. Parameters ---------- model: MXNet model A trained MXNet neural network model. input_shape: list of tuples ...
[ "def", "convert", "(", "model", ",", "input_shape", ",", "class_labels", "=", "None", ",", "mode", "=", "None", ",", "preprocessor_args", "=", "None", ",", "builder", "=", "None", ",", "verbose", "=", "True", ")", ":", "if", "not", "isinstance", "(", "...
Convert an MXNet model to the protobuf spec. Parameters ---------- model: MXNet model A trained MXNet neural network model. input_shape: list of tuples A list of (name, shape) tuples, defining the input names and their shapes. The list also serves to define the desired order of...
[ "Convert", "an", "MXNet", "model", "to", "the", "protobuf", "spec", "." ]
python
train
39.157534
chardet/chardet
convert_language_model.py
https://github.com/chardet/chardet/blob/b5194bf8250b7d180ac4edff51e09cab9d99febe/convert_language_model.py#L113-L218
def convert_models_for_lang(language): """Convert old SingleByteCharSetModels for the given language""" # Validate language language = language.title() lang_metadata = LANGUAGES.get(language) if not lang_metadata: raise ValueError('Unknown language: {}. If you are adding a model for a' ...
[ "def", "convert_models_for_lang", "(", "language", ")", ":", "# Validate language", "language", "=", "language", ".", "title", "(", ")", "lang_metadata", "=", "LANGUAGES", ".", "get", "(", "language", ")", "if", "not", "lang_metadata", ":", "raise", "ValueError"...
Convert old SingleByteCharSetModels for the given language
[ "Convert", "old", "SingleByteCharSetModels", "for", "the", "given", "language" ]
python
train
47.292453
FutunnOpen/futuquant
futuquant/examples/TinyQuant/TinyQuantBase.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/examples/TinyQuant/TinyQuantBase.py#L73-L89
def updateBar(self, bar): """更新K线""" self.count += 1 if not self.inited and self.count >= self.size: self.inited = True self.openArray[0:self.size - 1] = self.openArray[1:self.size] self.highArray[0:self.size - 1] = self.highArray[1:self.size] self.lowArray[0...
[ "def", "updateBar", "(", "self", ",", "bar", ")", ":", "self", ".", "count", "+=", "1", "if", "not", "self", ".", "inited", "and", "self", ".", "count", ">=", "self", ".", "size", ":", "self", ".", "inited", "=", "True", "self", ".", "openArray", ...
更新K线
[ "更新K线" ]
python
train
40.529412
osrg/ryu
ryu/services/protocols/bgp/core_managers/table_manager.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L814-L897
def update_flowspec_global_table(self, flowspec_family, rules, actions=None, is_withdraw=False): """Update a BGP route in the Global table for Flow Specification. ``flowspec_family`` specifies one of the Flow Specification family name. ``rules`` sp...
[ "def", "update_flowspec_global_table", "(", "self", ",", "flowspec_family", ",", "rules", ",", "actions", "=", "None", ",", "is_withdraw", "=", "False", ")", ":", "from", "ryu", ".", "services", ".", "protocols", ".", "bgp", ".", "core", "import", "BgpCoreEr...
Update a BGP route in the Global table for Flow Specification. ``flowspec_family`` specifies one of the Flow Specification family name. ``rules`` specifies NLRIs of Flow Specification as a dictionary type value. `` actions`` specifies Traffic Filtering Actions of Flow...
[ "Update", "a", "BGP", "route", "in", "the", "Global", "table", "for", "Flow", "Specification", "." ]
python
train
36.261905
tensorflow/datasets
tensorflow_datasets/core/features/feature.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/core/features/feature.py#L508-L514
def save_metadata(self, data_dir, feature_name=None): """See base class for details.""" # Recursively save all child features for feature_key, feature in six.iteritems(self._feature_dict): if feature_name: feature_key = '-'.join((feature_name, feature_key)) feature.save_metadata(data_dir...
[ "def", "save_metadata", "(", "self", ",", "data_dir", ",", "feature_name", "=", "None", ")", ":", "# Recursively save all child features", "for", "feature_key", ",", "feature", "in", "six", ".", "iteritems", "(", "self", ".", "_feature_dict", ")", ":", "if", "...
See base class for details.
[ "See", "base", "class", "for", "details", "." ]
python
train
48.714286
lorien/grab
grab/document.py
https://github.com/lorien/grab/blob/8b301db2a08c830245b61c589e58af6234f4db79/grab/document.py#L511-L516
def rex_assert(self, rex, byte=False): """ If `rex` expression is not found then raise `DataNotFound` exception. """ self.rex_search(rex, byte=byte)
[ "def", "rex_assert", "(", "self", ",", "rex", ",", "byte", "=", "False", ")", ":", "self", ".", "rex_search", "(", "rex", ",", "byte", "=", "byte", ")" ]
If `rex` expression is not found then raise `DataNotFound` exception.
[ "If", "rex", "expression", "is", "not", "found", "then", "raise", "DataNotFound", "exception", "." ]
python
train
29.333333
facetoe/zenpy
zenpy/lib/api.py
https://github.com/facetoe/zenpy/blob/34c54c7e408b9ed01604ddf8b3422204c8bf31ea/zenpy/lib/api.py#L1106-L1131
def audits(self, ticket=None, include=None, **kwargs): """ Retrieve TicketAudits. If ticket is passed, return the tickets for a specific audit. If ticket_id is None, a TicketAuditGenerator is returned to handle pagination. The way this generator works is a different to the other Zenpy g...
[ "def", "audits", "(", "self", ",", "ticket", "=", "None", ",", "include", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ticket", "is", "not", "None", ":", "return", "self", ".", "_query_zendesk", "(", "self", ".", "endpoint", ".", "audits", ...
Retrieve TicketAudits. If ticket is passed, return the tickets for a specific audit. If ticket_id is None, a TicketAuditGenerator is returned to handle pagination. The way this generator works is a different to the other Zenpy generators as it is cursor based, allowing you to change the directi...
[ "Retrieve", "TicketAudits", ".", "If", "ticket", "is", "passed", "return", "the", "tickets", "for", "a", "specific", "audit", "." ]
python
train
47.538462
danielhrisca/asammdf
asammdf/mdf.py
https://github.com/danielhrisca/asammdf/blob/3c7a1fd19c957ceebe4dcdbb2abf00806c2bdb66/asammdf/mdf.py#L2966-L2991
def whereis(self, channel): """ get ocurrences of channel name in the file Parameters ---------- channel : str channel name string Returns ------- ocurrences : tuple Examples -------- >>> mdf = MDF(file_name) >>> mdf...
[ "def", "whereis", "(", "self", ",", "channel", ")", ":", "if", "channel", "in", "self", ":", "return", "tuple", "(", "self", ".", "channels_db", "[", "channel", "]", ")", "else", ":", "return", "tuple", "(", ")" ]
get ocurrences of channel name in the file Parameters ---------- channel : str channel name string Returns ------- ocurrences : tuple Examples -------- >>> mdf = MDF(file_name) >>> mdf.whereis('VehicleSpeed') # "VehicleSpeed...
[ "get", "ocurrences", "of", "channel", "name", "in", "the", "file" ]
python
train
23.230769
telefonicaid/fiware-sdc
python-sdcclient/utils/logger_utils.py
https://github.com/telefonicaid/fiware-sdc/blob/d2d5f87fc574caf6bcc49594bbcb31f620ba8c51/python-sdcclient/utils/logger_utils.py#L53-L67
def configure_logging(level): """ Configure global log level to given one :param level: Level (INFO | DEBUG | WARN | ERROR) :return: """ global logging_level logging_level = logging.ERROR if "info" == level.lower(): logging_level = logging.INFO elif "warn" == level.lower(): ...
[ "def", "configure_logging", "(", "level", ")", ":", "global", "logging_level", "logging_level", "=", "logging", ".", "ERROR", "if", "\"info\"", "==", "level", ".", "lower", "(", ")", ":", "logging_level", "=", "logging", ".", "INFO", "elif", "\"warn\"", "=="...
Configure global log level to given one :param level: Level (INFO | DEBUG | WARN | ERROR) :return:
[ "Configure", "global", "log", "level", "to", "given", "one", ":", "param", "level", ":", "Level", "(", "INFO", "|", "DEBUG", "|", "WARN", "|", "ERROR", ")", ":", "return", ":" ]
python
train
27.866667
markovmodel/PyEMMA
pyemma/coordinates/data/_base/_in_memory_mixin.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/coordinates/data/_base/_in_memory_mixin.py#L22-L30
def in_memory(self, op_in_mem): r""" If set to True, the output will be stored in memory. """ old_state = self.in_memory if not old_state and op_in_mem: self._map_to_memory() elif not op_in_mem and old_state: self._clear_in_memory()
[ "def", "in_memory", "(", "self", ",", "op_in_mem", ")", ":", "old_state", "=", "self", ".", "in_memory", "if", "not", "old_state", "and", "op_in_mem", ":", "self", ".", "_map_to_memory", "(", ")", "elif", "not", "op_in_mem", "and", "old_state", ":", "self"...
r""" If set to True, the output will be stored in memory.
[ "r", "If", "set", "to", "True", "the", "output", "will", "be", "stored", "in", "memory", "." ]
python
train
32.888889
c-w/gutenberg
gutenberg/_util/objects.py
https://github.com/c-w/gutenberg/blob/d1ef3da6fba6c3636d452479ed6bcb17c7d4d246/gutenberg/_util/objects.py#L4-L11
def all_subclasses(cls): """Recursively returns all the subclasses of the provided class. """ subclasses = cls.__subclasses__() descendants = (descendant for subclass in subclasses for descendant in all_subclasses(subclass)) return set(subclasses) | set(descendants)
[ "def", "all_subclasses", "(", "cls", ")", ":", "subclasses", "=", "cls", ".", "__subclasses__", "(", ")", "descendants", "=", "(", "descendant", "for", "subclass", "in", "subclasses", "for", "descendant", "in", "all_subclasses", "(", "subclass", ")", ")", "r...
Recursively returns all the subclasses of the provided class.
[ "Recursively", "returns", "all", "the", "subclasses", "of", "the", "provided", "class", "." ]
python
train
37.375
LLNL/scraper
scraper/bitbucket/__init__.py
https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/bitbucket/__init__.py#L7-L16
def connect(url, username, password): """ Return a connected Bitbucket session """ bb_session = stashy.connect(url, username, password) logger.info('Connected to: %s as %s', url, username) return bb_session
[ "def", "connect", "(", "url", ",", "username", ",", "password", ")", ":", "bb_session", "=", "stashy", ".", "connect", "(", "url", ",", "username", ",", "password", ")", "logger", ".", "info", "(", "'Connected to: %s as %s'", ",", "url", ",", "username", ...
Return a connected Bitbucket session
[ "Return", "a", "connected", "Bitbucket", "session" ]
python
test
22.4
JasonKessler/scattertext
scattertext/categoryprojector/CategoryProjector.py
https://github.com/JasonKessler/scattertext/blob/cacf1f687d218ee8cae3fc05cc901db824bb1b81/scattertext/categoryprojector/CategoryProjector.py#L41-L49
def project_with_metadata(self, term_doc_mat, x_dim=0, y_dim=1): ''' Returns a projection of the :param term_doc_mat: a TermDocMatrix :return: CategoryProjection ''' return self._project_category_corpus(self._get_category_metadata_corpus_and_replace_terms(term_doc_mat), ...
[ "def", "project_with_metadata", "(", "self", ",", "term_doc_mat", ",", "x_dim", "=", "0", ",", "y_dim", "=", "1", ")", ":", "return", "self", ".", "_project_category_corpus", "(", "self", ".", "_get_category_metadata_corpus_and_replace_terms", "(", "term_doc_mat", ...
Returns a projection of the :param term_doc_mat: a TermDocMatrix :return: CategoryProjection
[ "Returns", "a", "projection", "of", "the" ]
python
train
41.111111
Karaage-Cluster/karaage
karaage/plugins/kgapplications/emails.py
https://github.com/Karaage-Cluster/karaage/blob/2f4c8b4e2d728b3fcbb151160c49000f1c04f5c9/karaage/plugins/kgapplications/emails.py#L66-L79
def send_request_email( authorised_text, authorised_role, authorised_persons, application, link, is_secret): """Sends an email to admin asking to approve user application""" context = CONTEXT.copy() context['requester'] = application.applicant context['link'] = link context['is_secre...
[ "def", "send_request_email", "(", "authorised_text", ",", "authorised_role", ",", "authorised_persons", ",", "application", ",", "link", ",", "is_secret", ")", ":", "context", "=", "CONTEXT", ".", "copy", "(", ")", "context", "[", "'requester'", "]", "=", "app...
Sends an email to admin asking to approve user application
[ "Sends", "an", "email", "to", "admin", "asking", "to", "approve", "user", "application" ]
python
train
37.5
Samreay/ChainConsumer
chainconsumer/diagnostic.py
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/diagnostic.py#L11-L76
def gelman_rubin(self, chain=None, threshold=0.05): r""" Runs the Gelman Rubin diagnostic on the supplied chains. Parameters ---------- chain : int|str, optional Which chain to run the diagnostic on. By default, this is `None`, which will run the diagnostic on al...
[ "def", "gelman_rubin", "(", "self", ",", "chain", "=", "None", ",", "threshold", "=", "0.05", ")", ":", "if", "chain", "is", "None", ":", "return", "np", ".", "all", "(", "[", "self", ".", "gelman_rubin", "(", "k", ",", "threshold", "=", "threshold",...
r""" Runs the Gelman Rubin diagnostic on the supplied chains. Parameters ---------- chain : int|str, optional Which chain to run the diagnostic on. By default, this is `None`, which will run the diagnostic on all chains. You can also supply and integer (the c...
[ "r", "Runs", "the", "Gelman", "Rubin", "diagnostic", "on", "the", "supplied", "chains", "." ]
python
train
41.863636
Clinical-Genomics/housekeeper
housekeeper/store/models.py
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/store/models.py#L52-L54
def relative_root_dir(self): """Build the relative root dir path for the bundle version.""" return Path(self.bundle.name) / str(self.created_at.date())
[ "def", "relative_root_dir", "(", "self", ")", ":", "return", "Path", "(", "self", ".", "bundle", ".", "name", ")", "/", "str", "(", "self", ".", "created_at", ".", "date", "(", ")", ")" ]
Build the relative root dir path for the bundle version.
[ "Build", "the", "relative", "root", "dir", "path", "for", "the", "bundle", "version", "." ]
python
train
55
google/dotty
efilter/transforms/solve.py
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/transforms/solve.py#L326-L350
def solve_apply(expr, vars): """Returns the result of applying function (lhs) to its arguments (rest). We use IApplicative to apply the function, because that gives the host application an opportunity to compare the function being called against a whitelist. EFILTER will never directly call a function ...
[ "def", "solve_apply", "(", "expr", ",", "vars", ")", ":", "func", "=", "__solve_for_scalar", "(", "expr", ".", "func", ",", "vars", ")", "args", "=", "[", "]", "kwargs", "=", "{", "}", "for", "arg", "in", "expr", ".", "args", ":", "if", "isinstance...
Returns the result of applying function (lhs) to its arguments (rest). We use IApplicative to apply the function, because that gives the host application an opportunity to compare the function being called against a whitelist. EFILTER will never directly call a function that wasn't provided through a p...
[ "Returns", "the", "result", "of", "applying", "function", "(", "lhs", ")", "to", "its", "arguments", "(", "rest", ")", "." ]
python
train
35.8
volafiled/python-volapi
volapi/volapi.py
https://github.com/volafiled/python-volapi/blob/5f0bc03dbde703264ac6ed494e2050761f688a3e/volapi/volapi.py#L529-L534
def __expire_files(self): """Because files are always unclean""" self.__files = OrderedDict( item for item in self.__files.items() if not item[1].expired )
[ "def", "__expire_files", "(", "self", ")", ":", "self", ".", "__files", "=", "OrderedDict", "(", "item", "for", "item", "in", "self", ".", "__files", ".", "items", "(", ")", "if", "not", "item", "[", "1", "]", ".", "expired", ")" ]
Because files are always unclean
[ "Because", "files", "are", "always", "unclean" ]
python
train
31.166667
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/input_readers.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/input_readers.py#L1783-L1792
def _next_offset(self): """Return the offset of the next line to read.""" if self._filestream: offset = self._filestream.tell() if offset: offset -= 1 else: offset = self._initial_offset return offset
[ "def", "_next_offset", "(", "self", ")", ":", "if", "self", ".", "_filestream", ":", "offset", "=", "self", ".", "_filestream", ".", "tell", "(", ")", "if", "offset", ":", "offset", "-=", "1", "else", ":", "offset", "=", "self", ".", "_initial_offset",...
Return the offset of the next line to read.
[ "Return", "the", "offset", "of", "the", "next", "line", "to", "read", "." ]
python
train
23.4
mon/kbinxml
kbinxml/kbinxml.py
https://github.com/mon/kbinxml/blob/ca4a6e309ec458dd359f1bf25f91a4443758365a/kbinxml/kbinxml.py#L106-L126
def mem_size(self): '''used when allocating memory ingame''' data_len = self._data_mem_size node_count = len(list(self.xml_doc.iter(tag=etree.Element))) if self.compressed: size = 52 * node_count + data_len + 630 else: tags_len = 0 for e in s...
[ "def", "mem_size", "(", "self", ")", ":", "data_len", "=", "self", ".", "_data_mem_size", "node_count", "=", "len", "(", "list", "(", "self", ".", "xml_doc", ".", "iter", "(", "tag", "=", "etree", ".", "Element", ")", ")", ")", "if", "self", ".", "...
used when allocating memory ingame
[ "used", "when", "allocating", "memory", "ingame" ]
python
valid
32.190476
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/history_console_widget.py#L252-L259
def _history_locked(self): """ Returns whether history movement is locked. """ return (self.history_lock and (self._get_edited_history(self._history_index) != self.input_buffer) and (self._get_prompt_cursor().blockNumber() != self...
[ "def", "_history_locked", "(", "self", ")", ":", "return", "(", "self", ".", "history_lock", "and", "(", "self", ".", "_get_edited_history", "(", "self", ".", "_history_index", ")", "!=", "self", ".", "input_buffer", ")", "and", "(", "self", ".", "_get_pro...
Returns whether history movement is locked.
[ "Returns", "whether", "history", "movement", "is", "locked", "." ]
python
test
43.375
saltstack/salt
salt/cloud/clouds/ec2.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4154-L4282
def create_volume(kwargs=None, call=None, wait_to_finish=False): ''' Create a volume. zone The availability zone used to create the volume. Required. String. size The size of the volume, in GiBs. Defaults to ``10``. Integer. snapshot The snapshot-id from which to create th...
[ "def", "create_volume", "(", "kwargs", "=", "None", ",", "call", "=", "None", ",", "wait_to_finish", "=", "False", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The create_volume function must be called with -f or --function.'", ")",...
Create a volume. zone The availability zone used to create the volume. Required. String. size The size of the volume, in GiBs. Defaults to ``10``. Integer. snapshot The snapshot-id from which to create the volume. Integer. type The volume type. This can be gp2 for Gen...
[ "Create", "a", "volume", "." ]
python
train
32.434109
markchil/gptools
gptools/kernel/core.py
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/kernel/core.py#L858-L870
def _mask_cov_func(self, *args): """Masks the covariance function into a form usable by :py:func:`mpmath.diff`. Parameters ---------- *args : `num_dim` * 2 floats The individual elements of Xi and Xj to be passed to :py:attr:`cov_func`. """ # Have to ...
[ "def", "_mask_cov_func", "(", "self", ",", "*", "args", ")", ":", "# Have to do it in two cases to get the 1d unwrapped properly:", "if", "self", ".", "num_dim", "==", "1", ":", "return", "self", ".", "cov_func", "(", "args", "[", "0", "]", ",", "args", "[", ...
Masks the covariance function into a form usable by :py:func:`mpmath.diff`. Parameters ---------- *args : `num_dim` * 2 floats The individual elements of Xi and Xj to be passed to :py:attr:`cov_func`.
[ "Masks", "the", "covariance", "function", "into", "a", "form", "usable", "by", ":", "py", ":", "func", ":", "mpmath", ".", "diff", ".", "Parameters", "----------", "*", "args", ":", "num_dim", "*", "2", "floats", "The", "individual", "elements", "of", "X...
python
train
42.923077
DataONEorg/d1_python
lib_client/src/d1_client/cnclient.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_client/src/d1_client/cnclient.py#L113-L130
def reserveIdentifierResponse(self, pid, vendorSpecific=None): """CNCore.getLogRecords(session[, fromDate][, toDate][, event][, start][, count]) → Log https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNCore.getLogRecords Implemented in d1_client.baseclient....
[ "def", "reserveIdentifierResponse", "(", "self", ",", "pid", ",", "vendorSpecific", "=", "None", ")", ":", "mmp_dict", "=", "{", "'pid'", ":", "pid", "}", "return", "self", ".", "POST", "(", "[", "'reserve'", ",", "pid", "]", ",", "fields", "=", "mmp_d...
CNCore.getLogRecords(session[, fromDate][, toDate][, event][, start][, count]) → Log https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNCore.getLogRecords Implemented in d1_client.baseclient.py. CNCore.reserveIdentifier(session, pid) → Identifier h...
[ "CNCore", ".", "getLogRecords", "(", "session", "[", "fromDate", "]", "[", "toDate", "]", "[", "event", "]", "[", "start", "]", "[", "count", "]", ")", "→", "Log", "https", ":", "//", "releases", ".", "dataone", ".", "org", "/", "online", "/", "api...
python
train
37.888889
google/grumpy
third_party/pypy/datetime.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1550-L1552
def time(self): "Return the time part, with tzinfo None." return time(self.hour, self.minute, self.second, self.microsecond)
[ "def", "time", "(", "self", ")", ":", "return", "time", "(", "self", ".", "hour", ",", "self", ".", "minute", ",", "self", ".", "second", ",", "self", ".", "microsecond", ")" ]
Return the time part, with tzinfo None.
[ "Return", "the", "time", "part", "with", "tzinfo", "None", "." ]
python
valid
46
jrief/djangocms-cascade
cmsplugin_cascade/plugin_base.py
https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/plugin_base.py#L445-L454
def get_next_instance(self, obj): """ Return the next plugin instance for the given object. This differs from `obj.get_next_sibling()` which returns an unsorted sibling. """ ordered_siblings = obj.get_siblings().filter(placeholder=obj.placeholder).order_by('position') pos...
[ "def", "get_next_instance", "(", "self", ",", "obj", ")", ":", "ordered_siblings", "=", "obj", ".", "get_siblings", "(", ")", ".", "filter", "(", "placeholder", "=", "obj", ".", "placeholder", ")", ".", "order_by", "(", "'position'", ")", "pos", "=", "li...
Return the next plugin instance for the given object. This differs from `obj.get_next_sibling()` which returns an unsorted sibling.
[ "Return", "the", "next", "plugin", "instance", "for", "the", "given", "object", ".", "This", "differs", "from", "obj", ".", "get_next_sibling", "()", "which", "returns", "an", "unsorted", "sibling", "." ]
python
train
51.2
bitesofcode/projexui
projexui/dialogs/xwizardbrowserdialog/xwizardplugin.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/dialogs/xwizardbrowserdialog/xwizardplugin.py#L170-L179
def find( cls, name ): """ Finds a particular wizard plugin based on its name. :param name | <str> || None """ if ( cls._plugins is None ): cls._plugins = {} return cls._plugins.get(nativestring(name))
[ "def", "find", "(", "cls", ",", "name", ")", ":", "if", "(", "cls", ".", "_plugins", "is", "None", ")", ":", "cls", ".", "_plugins", "=", "{", "}", "return", "cls", ".", "_plugins", ".", "get", "(", "nativestring", "(", "name", ")", ")" ]
Finds a particular wizard plugin based on its name. :param name | <str> || None
[ "Finds", "a", "particular", "wizard", "plugin", "based", "on", "its", "name", ".", ":", "param", "name", "|", "<str", ">", "||", "None" ]
python
train
28.2
tuxpiper/cloudcast
cloudcast/iscm/phased.py
https://github.com/tuxpiper/cloudcast/blob/06ca62045c483e9c3e7ee960ba70d90ea6a13776/cloudcast/iscm/phased.py#L135-L145
def get_dict_repr(self): """ Return a dictionary representation of this phase. This will be used for checksumming, in order to uniquely compare instance images against their requirements """ return dict( phase_name = self.phase_name, phase_type = s...
[ "def", "get_dict_repr", "(", "self", ")", ":", "return", "dict", "(", "phase_name", "=", "self", ".", "phase_name", ",", "phase_type", "=", "self", ".", "phase_type", ",", "actions", "=", "self", ".", "actions", ")" ]
Return a dictionary representation of this phase. This will be used for checksumming, in order to uniquely compare instance images against their requirements
[ "Return", "a", "dictionary", "representation", "of", "this", "phase", ".", "This", "will", "be", "used", "for", "checksumming", "in", "order", "to", "uniquely", "compare", "instance", "images", "against", "their", "requirements" ]
python
train
34
rigetti/pyquil
pyquil/device.py
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/device.py#L327-L351
def from_dict(d): """ Re-create the Specs from a dictionary representation. :param Dict[str, Any] d: The dictionary representation. :return: The restored Specs. :rtype: Specs """ return Specs( qubits_specs=sorted([QubitSpecs(id=int(q), ...
[ "def", "from_dict", "(", "d", ")", ":", "return", "Specs", "(", "qubits_specs", "=", "sorted", "(", "[", "QubitSpecs", "(", "id", "=", "int", "(", "q", ")", ",", "fRO", "=", "qspecs", ".", "get", "(", "'fRO'", ")", ",", "f1QRB", "=", "qspecs", "....
Re-create the Specs from a dictionary representation. :param Dict[str, Any] d: The dictionary representation. :return: The restored Specs. :rtype: Specs
[ "Re", "-", "create", "the", "Specs", "from", "a", "dictionary", "representation", "." ]
python
train
52.2
datadesk/python-documentcloud
documentcloud/__init__.py
https://github.com/datadesk/python-documentcloud/blob/0d7f42cbf1edf5c61fca37ed846362cba4abfd76/documentcloud/__init__.py#L975-L982
def get_large_image(self, page=1): """ Downloads and returns the large sized image of a single page. The page kwarg specifies which page to return. One is the default. """ url = self.get_large_image_url(page=page) return self._get_url(url)
[ "def", "get_large_image", "(", "self", ",", "page", "=", "1", ")", ":", "url", "=", "self", ".", "get_large_image_url", "(", "page", "=", "page", ")", "return", "self", ".", "_get_url", "(", "url", ")" ]
Downloads and returns the large sized image of a single page. The page kwarg specifies which page to return. One is the default.
[ "Downloads", "and", "returns", "the", "large", "sized", "image", "of", "a", "single", "page", "." ]
python
train
35.125
wmayner/pyphi
pyphi/models/actual_causation.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/models/actual_causation.py#L354-L364
def _null_ac_sia(transition, direction, alpha=0.0): """Return an |AcSystemIrreducibilityAnalysis| with zero |big_alpha| and empty accounts. """ return AcSystemIrreducibilityAnalysis( transition=transition, direction=direction, alpha=alpha, account=(), partitioned_...
[ "def", "_null_ac_sia", "(", "transition", ",", "direction", ",", "alpha", "=", "0.0", ")", ":", "return", "AcSystemIrreducibilityAnalysis", "(", "transition", "=", "transition", ",", "direction", "=", "direction", ",", "alpha", "=", "alpha", ",", "account", "=...
Return an |AcSystemIrreducibilityAnalysis| with zero |big_alpha| and empty accounts.
[ "Return", "an", "|AcSystemIrreducibilityAnalysis|", "with", "zero", "|big_alpha|", "and", "empty", "accounts", "." ]
python
train
29.636364
inveniosoftware-attic/invenio-documents
invenio_documents/cli.py
https://github.com/inveniosoftware-attic/invenio-documents/blob/cdfcd21ea5d9ad26f4405f418863fcc3df636176/invenio_documents/cli.py#L68-L71
def setcontents(source, identifier, pointer): """Patch existing bibliographic record.""" record = Record.get_record(identifier) Document(record, pointer).setcontents(source)
[ "def", "setcontents", "(", "source", ",", "identifier", ",", "pointer", ")", ":", "record", "=", "Record", ".", "get_record", "(", "identifier", ")", "Document", "(", "record", ",", "pointer", ")", ".", "setcontents", "(", "source", ")" ]
Patch existing bibliographic record.
[ "Patch", "existing", "bibliographic", "record", "." ]
python
train
45.5
volfpeter/graphscraper
src/graphscraper/igraphwrapper.py
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/igraphwrapper.py#L107-L122
def _create_memory_database_interface(self) -> GraphDatabaseInterface: """ Creates and returns the in-memory database interface the graph will use. """ Base = declarative_base() engine = sqlalchemy.create_engine("sqlite://", poolclass=StaticPool) Session = sessionmaker(bi...
[ "def", "_create_memory_database_interface", "(", "self", ")", "->", "GraphDatabaseInterface", ":", "Base", "=", "declarative_base", "(", ")", "engine", "=", "sqlalchemy", ".", "create_engine", "(", "\"sqlite://\"", ",", "poolclass", "=", "StaticPool", ")", "Session"...
Creates and returns the in-memory database interface the graph will use.
[ "Creates", "and", "returns", "the", "in", "-", "memory", "database", "interface", "the", "graph", "will", "use", "." ]
python
train
35.4375
bitesofcode/projexui
projexui/widgets/xorbtreewidget/xorbtreewidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L191-L218
def createEditor( self, parent, option, index ): """ Creates a new editor for the given index parented to the inputed widget. :param parent | <QWidget> option | <QStyleOption> index | <QModelIndex> :return <QWidg...
[ "def", "createEditor", "(", "self", ",", "parent", ",", "option", ",", "index", ")", ":", "# determine the editor to use for the inputed index based on the\r", "# table column\r", "item", "=", "self", ".", "parent", "(", ")", ".", "itemFromIndex", "(", "index", ")",...
Creates a new editor for the given index parented to the inputed widget. :param parent | <QWidget> option | <QStyleOption> index | <QModelIndex> :return <QWidget> || None
[ "Creates", "a", "new", "editor", "for", "the", "given", "index", "parented", "to", "the", "inputed", "widget", ".", ":", "param", "parent", "|", "<QWidget", ">", "option", "|", "<QStyleOption", ">", "index", "|", "<QModelIndex", ">", ":", "return", "<QWidg...
python
train
38.714286
improbable-research/keanu
keanu-python/keanu/vertex/generated.py
https://github.com/improbable-research/keanu/blob/73189a8f569078e156168e795f82c7366c59574b/keanu-python/keanu/vertex/generated.py#L235-L242
def Bernoulli(prob_true: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ One to one constructor for mapping some shape of probTrue to a matching shaped Bernoulli. :param prob_true: probTrue with same shape as desired Bernoulli tensor or scalar """ return Boolean(co...
[ "def", "Bernoulli", "(", "prob_true", ":", "vertex_constructor_param_types", ",", "label", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Vertex", ":", "return", "Boolean", "(", "context", ".", "jvm_view", "(", ")", ".", "BernoulliVertex", ",", ...
One to one constructor for mapping some shape of probTrue to a matching shaped Bernoulli. :param prob_true: probTrue with same shape as desired Bernoulli tensor or scalar
[ "One", "to", "one", "constructor", "for", "mapping", "some", "shape", "of", "probTrue", "to", "a", "matching", "shaped", "Bernoulli", ".", ":", "param", "prob_true", ":", "probTrue", "with", "same", "shape", "as", "desired", "Bernoulli", "tensor", "or", "sca...
python
train
48.375
carpedm20/fbchat
fbchat/_client.py
https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L3864-L3893
def onPollCreated( self, mid=None, poll=None, author_id=None, thread_id=None, thread_type=None, ts=None, metadata=None, msg=None, ): """ Called when the client is listening, and somebody creates a group poll :param mid:...
[ "def", "onPollCreated", "(", "self", ",", "mid", "=", "None", ",", "poll", "=", "None", ",", "author_id", "=", "None", ",", "thread_id", "=", "None", ",", "thread_type", "=", "None", ",", "ts", "=", "None", ",", "metadata", "=", "None", ",", "msg", ...
Called when the client is listening, and somebody creates a group poll :param mid: The action ID :param poll: Created poll :param author_id: The ID of the person who created the poll :param thread_id: Thread ID that the action was sent to. See :ref:`intro_threads` :param thread_...
[ "Called", "when", "the", "client", "is", "listening", "and", "somebody", "creates", "a", "group", "poll" ]
python
train
33.066667
hubo1016/vlcp
vlcp/server/module.py
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/server/module.py#L242-L247
def discover(self, details = False): 'Discover API definitions. Set details=true to show details' if details and not (isinstance(details, str) and details.lower() == 'false'): return copy.deepcopy(self.discoverinfo) else: return dict((k,v.get('description', '')) for k,v i...
[ "def", "discover", "(", "self", ",", "details", "=", "False", ")", ":", "if", "details", "and", "not", "(", "isinstance", "(", "details", ",", "str", ")", "and", "details", ".", "lower", "(", ")", "==", "'false'", ")", ":", "return", "copy", ".", "...
Discover API definitions. Set details=true to show details
[ "Discover", "API", "definitions", ".", "Set", "details", "=", "true", "to", "show", "details" ]
python
train
57.166667
portfors-lab/sparkle
sparkle/gui/dialogs/saving_dlg.py
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/dialogs/saving_dlg.py#L43-L59
def getfile(self): """Gets the full file path of the entered/selected file :returns: str -- the name of the data file to open/create """ current_file = str(self.selectedFiles()[0]) if os.path.isfile(current_file): print 'current_file', current_file if cur...
[ "def", "getfile", "(", "self", ")", ":", "current_file", "=", "str", "(", "self", ".", "selectedFiles", "(", ")", "[", "0", "]", ")", "if", "os", ".", "path", ".", "isfile", "(", "current_file", ")", ":", "print", "'current_file'", ",", "current_file",...
Gets the full file path of the entered/selected file :returns: str -- the name of the data file to open/create
[ "Gets", "the", "full", "file", "path", "of", "the", "entered", "/", "selected", "file" ]
python
train
37.647059
wonambi-python/wonambi
wonambi/datatype.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/datatype.py#L302-L351
def _copy(self, axis=True, attr=True, data=False): """Create a new instance of Data, but does not copy the data necessarily. Parameters ---------- axis : bool, optional deep copy the axes (default: True) attr : bool, optional deep copy the attribu...
[ "def", "_copy", "(", "self", ",", "axis", "=", "True", ",", "attr", "=", "True", ",", "data", "=", "False", ")", ":", "cdata", "=", "type", "(", "self", ")", "(", ")", "# create instance of the same class", "cdata", ".", "s_freq", "=", "self", ".", "...
Create a new instance of Data, but does not copy the data necessarily. Parameters ---------- axis : bool, optional deep copy the axes (default: True) attr : bool, optional deep copy the attributes (default: True) data : bool, optional ...
[ "Create", "a", "new", "instance", "of", "Data", "but", "does", "not", "copy", "the", "data", "necessarily", "." ]
python
train
30.1
bokeh/bokeh
bokeh/transform.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L157-L187
def factor_mark(field_name, markers, factors, start=0, end=None): ''' Create a ``DataSpec`` dict that applies a client-side ``CategoricalMarkerMapper`` transformation to a ``ColumnDataSource`` column. .. note:: This transform is primarily only useful with ``scatter``, which can be param...
[ "def", "factor_mark", "(", "field_name", ",", "markers", ",", "factors", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "field", "(", "field_name", ",", "CategoricalMarkerMapper", "(", "markers", "=", "markers", ",", "factors", "=", ...
Create a ``DataSpec`` dict that applies a client-side ``CategoricalMarkerMapper`` transformation to a ``ColumnDataSource`` column. .. note:: This transform is primarily only useful with ``scatter``, which can be parameterized by glyph type. Args: field_name (str) : a field name...
[ "Create", "a", "DataSpec", "dict", "that", "applies", "a", "client", "-", "side", "CategoricalMarkerMapper", "transformation", "to", "a", "ColumnDataSource", "column", "." ]
python
train
37.193548
knipknap/exscript
Exscript/queue.py
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/queue.py#L534-L552
def shutdown(self, force=False): """ Stop executing any further jobs. If the force argument is True, the function does not wait until any queued jobs are completed but stops immediately. After emptying the queue it is restarted, so you may still call run() after using th...
[ "def", "shutdown", "(", "self", ",", "force", "=", "False", ")", ":", "if", "not", "force", ":", "self", ".", "join", "(", ")", "self", ".", "_dbg", "(", "2", ",", "'Shutting down queue...'", ")", "self", ".", "workqueue", ".", "shutdown", "(", "True...
Stop executing any further jobs. If the force argument is True, the function does not wait until any queued jobs are completed but stops immediately. After emptying the queue it is restarted, so you may still call run() after using this method. :type force: bool :param...
[ "Stop", "executing", "any", "further", "jobs", ".", "If", "the", "force", "argument", "is", "True", "the", "function", "does", "not", "wait", "until", "any", "queued", "jobs", "are", "completed", "but", "stops", "immediately", "." ]
python
train
32.894737
matthewdeanmartin/jiggle_version
jiggle_version/parse_kwarg_version.py
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/parse_kwarg_version.py#L73-L94
def find_version_by_string_lib(line): # type: (str)->Optional[str] """ No regex parsing. Or at least, mostly, not regex. """ if not line: return None simplified_line = simplify_line(line) version = None if simplified_line.startswith("version="): if '"' not in simplified_line...
[ "def", "find_version_by_string_lib", "(", "line", ")", ":", "# type: (str)->Optional[str]", "if", "not", "line", ":", "return", "None", "simplified_line", "=", "simplify_line", "(", "line", ")", "version", "=", "None", "if", "simplified_line", ".", "startswith", "...
No regex parsing. Or at least, mostly, not regex.
[ "No", "regex", "parsing", ".", "Or", "at", "least", "mostly", "not", "regex", "." ]
python
train
39.227273
numenta/htmresearch
htmresearch/frameworks/location/ambiguity_index.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/location/ambiguity_index.py#L254-L277
def generateLowerBoundList(confidence, numUniqueFeatures, numLocationsPerObject, maxNumObjects): """ Metric: How unique is each object's most unique feature? Calculate the probabilistic lower bound for the number of occurrences of an object's most unique feature. For example, if confi...
[ "def", "generateLowerBoundList", "(", "confidence", ",", "numUniqueFeatures", ",", "numLocationsPerObject", ",", "maxNumObjects", ")", ":", "# We're choosing a location, checking its feature, and checking how many", "# *other* occurrences there are of this feature. So we check n - 1 locati...
Metric: How unique is each object's most unique feature? Calculate the probabilistic lower bound for the number of occurrences of an object's most unique feature. For example, if confidence is 0.8, the tick "3" will be placed at the point where 80% of objects are completely composed of features with 3 or more t...
[ "Metric", ":", "How", "unique", "is", "each", "object", "s", "most", "unique", "feature?", "Calculate", "the", "probabilistic", "lower", "bound", "for", "the", "number", "of", "occurrences", "of", "an", "object", "s", "most", "unique", "feature", ".", "For",...
python
train
48.541667
saltstack/salt
salt/pillar/pillar_ldap.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/pillar_ldap.py#L309-L365
def ext_pillar(minion_id, # pylint: disable=W0613 pillar, # pylint: disable=W0613 config_file): ''' Execute LDAP searches and return the aggregated data ''' config_template = None try: config_template = _render_template(config_file) except jinja2.exception...
[ "def", "ext_pillar", "(", "minion_id", ",", "# pylint: disable=W0613", "pillar", ",", "# pylint: disable=W0613", "config_file", ")", ":", "config_template", "=", "None", "try", ":", "config_template", "=", "_render_template", "(", "config_file", ")", "except", "jinja2...
Execute LDAP searches and return the aggregated data
[ "Execute", "LDAP", "searches", "and", "return", "the", "aggregated", "data" ]
python
train
31.649123
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_system.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_system.py#L25-L37
def get_system_uptime_output_show_system_uptime_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_system_uptime = ET.Element("get_system_uptime") config = get_system_uptime output = ET.SubElement(get_system_uptime, "output") ...
[ "def", "get_system_uptime_output_show_system_uptime_rbridge_id", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_system_uptime", "=", "ET", ".", "Element", "(", "\"get_system_uptime\"", ")", "config...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
44.846154
tensorflow/tensor2tensor
tensor2tensor/serving/export.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/serving/export.py#L80-L100
def export_module_spec_with_checkpoint(module_spec, checkpoint_path, export_path, scope_prefix=""): """Exports given checkpoint as tfhub module with given spec.""" # The main requirement is that it ...
[ "def", "export_module_spec_with_checkpoint", "(", "module_spec", ",", "checkpoint_path", ",", "export_path", ",", "scope_prefix", "=", "\"\"", ")", ":", "# The main requirement is that it is possible to know how to map from", "# module variable name to checkpoint variable name.", "# ...
Exports given checkpoint as tfhub module with given spec.
[ "Exports", "given", "checkpoint", "as", "tfhub", "module", "with", "given", "spec", "." ]
python
train
43.904762
programa-stic/barf-project
barf/core/reil/builder.py
https://github.com/programa-stic/barf-project/blob/18ed9e5eace55f7bf6015ec57f037c364099021c/barf/core/reil/builder.py#L202-L207
def gen_smul(src1, src2, dst): """Return a SMUL instruction. """ assert src1.size == src2.size return ReilBuilder.build(ReilMnemonic.SMUL, src1, src2, dst)
[ "def", "gen_smul", "(", "src1", ",", "src2", ",", "dst", ")", ":", "assert", "src1", ".", "size", "==", "src2", ".", "size", "return", "ReilBuilder", ".", "build", "(", "ReilMnemonic", ".", "SMUL", ",", "src1", ",", "src2", ",", "dst", ")" ]
Return a SMUL instruction.
[ "Return", "a", "SMUL", "instruction", "." ]
python
train
30.5
juicer/juicer
juicer/common/CartItem.py
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/common/CartItem.py#L44-L54
def update(self, path): """ Update the attributes of this CartItem. """ self._reset() self.path = path self._refresh_synced() if self.is_synced: self._refresh_path() self._refresh_signed() self._refresh_nvr()
[ "def", "update", "(", "self", ",", "path", ")", ":", "self", ".", "_reset", "(", ")", "self", ".", "path", "=", "path", "self", ".", "_refresh_synced", "(", ")", "if", "self", ".", "is_synced", ":", "self", ".", "_refresh_path", "(", ")", "self", "...
Update the attributes of this CartItem.
[ "Update", "the", "attributes", "of", "this", "CartItem", "." ]
python
train
26.363636
mozilla/funfactory
funfactory/helpers.py
https://github.com/mozilla/funfactory/blob/c9bbf1c534eaa15641265bc75fa87afca52b7dd6/funfactory/helpers.py#L64-L68
def urlencode(txt): """Url encode a path.""" if isinstance(txt, unicode): txt = txt.encode('utf-8') return urllib.quote_plus(txt)
[ "def", "urlencode", "(", "txt", ")", ":", "if", "isinstance", "(", "txt", ",", "unicode", ")", ":", "txt", "=", "txt", ".", "encode", "(", "'utf-8'", ")", "return", "urllib", ".", "quote_plus", "(", "txt", ")" ]
Url encode a path.
[ "Url", "encode", "a", "path", "." ]
python
train
29
SectorLabs/django-postgres-extra
psqlextra/manager/manager.py
https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/manager/manager.py#L142-L171
def bulk_insert(self, rows, return_model=False): """Creates multiple new records in the database. This allows specifying custom conflict behavior using .on_conflict(). If no special behavior was specified, this uses the normal Django create(..) Arguments: rows: ...
[ "def", "bulk_insert", "(", "self", ",", "rows", ",", "return_model", "=", "False", ")", ":", "if", "self", ".", "conflict_target", "or", "self", ".", "conflict_action", ":", "compiler", "=", "self", ".", "_build_insert_compiler", "(", "rows", ")", "objs", ...
Creates multiple new records in the database. This allows specifying custom conflict behavior using .on_conflict(). If no special behavior was specified, this uses the normal Django create(..) Arguments: rows: An array of dictionaries, where each dictionary ...
[ "Creates", "multiple", "new", "records", "in", "the", "database", "." ]
python
test
41.566667
wavefrontHQ/python-client
wavefront_api_client/api/user_api.py
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/api/user_api.py#L428-L447
def get_all_user(self, **kwargs): # noqa: E501 """Get all users # noqa: E501 Returns all users # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_all_user(async_req=True) ...
[ "def", "get_all_user", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "get_all_user_with_http_info", ...
Get all users # noqa: E501 Returns all users # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_all_user(async_req=True) >>> result = thread.get() :param async_req...
[ "Get", "all", "users", "#", "noqa", ":", "E501" ]
python
train
39.4
LogicalDash/LiSE
allegedb/allegedb/cache.py
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/cache.py#L287-L386
def _get_keycachelike(self, keycache, keys, get_adds_dels, parentity, branch, turn, tick, *, forward): """Try to retrieve a frozenset representing extant keys. If I can't, generate one, store it, and return it. """ keycache_key = parentity + (branch,) keycache2 = keycache3 = No...
[ "def", "_get_keycachelike", "(", "self", ",", "keycache", ",", "keys", ",", "get_adds_dels", ",", "parentity", ",", "branch", ",", "turn", ",", "tick", ",", "*", ",", "forward", ")", ":", "keycache_key", "=", "parentity", "+", "(", "branch", ",", ")", ...
Try to retrieve a frozenset representing extant keys. If I can't, generate one, store it, and return it.
[ "Try", "to", "retrieve", "a", "frozenset", "representing", "extant", "keys", "." ]
python
train
51.18
user-cont/conu
conu/backend/podman/image.py
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/backend/podman/image.py#L206-L216
def _file_not_empty(tmpfile): """ Returns True if file exists and it is not empty to check if it is time to read container ID from cidfile :param tmpfile: str, path to file :return: bool, True if container id is written to the file """ if os.path.exists(tmpfile): ...
[ "def", "_file_not_empty", "(", "tmpfile", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "tmpfile", ")", ":", "return", "os", ".", "stat", "(", "tmpfile", ")", ".", "st_size", "!=", "0", "else", ":", "return", "False" ]
Returns True if file exists and it is not empty to check if it is time to read container ID from cidfile :param tmpfile: str, path to file :return: bool, True if container id is written to the file
[ "Returns", "True", "if", "file", "exists", "and", "it", "is", "not", "empty", "to", "check", "if", "it", "is", "time", "to", "read", "container", "ID", "from", "cidfile", ":", "param", "tmpfile", ":", "str", "path", "to", "file", ":", "return", ":", ...
python
train
36.090909
heuer/segno
segno/encoder.py
https://github.com/heuer/segno/blob/64d912a2bd17d0b5ff3e8b5d37098edfc663c2b3/segno/encoder.py#L1409-L1426
def is_kanji(data): """\ Returns if the `data` can be encoded in "kanji" mode. :param bytes data: The data to check. :rtype: bool """ data_len = len(data) if not data_len or data_len % 2: return False if _PY2: data = (ord(c) for c in data) data_iter = iter(data) ...
[ "def", "is_kanji", "(", "data", ")", ":", "data_len", "=", "len", "(", "data", ")", "if", "not", "data_len", "or", "data_len", "%", "2", ":", "return", "False", "if", "_PY2", ":", "data", "=", "(", "ord", "(", "c", ")", "for", "c", "in", "data", ...
\ Returns if the `data` can be encoded in "kanji" mode. :param bytes data: The data to check. :rtype: bool
[ "\\", "Returns", "if", "the", "data", "can", "be", "encoded", "in", "kanji", "mode", "." ]
python
train
27.888889
annoviko/pyclustering
pyclustering/cluster/bang.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/bang.py#L553-L574
def __build_level(self, previous_level_blocks, level): """! @brief Build new level of directory. @param[in] previous_level_blocks (list): BANG-blocks on the previous level. @param[in] level (uint): Level number that should be built. @return (list) New block on the specif...
[ "def", "__build_level", "(", "self", ",", "previous_level_blocks", ",", "level", ")", ":", "current_level_blocks", "=", "[", "]", "split_dimension", "=", "level", "%", "len", "(", "self", ".", "__data", "[", "0", "]", ")", "cache_require", "=", "(", "level...
! @brief Build new level of directory. @param[in] previous_level_blocks (list): BANG-blocks on the previous level. @param[in] level (uint): Level number that should be built. @return (list) New block on the specified level.
[ "!" ]
python
valid
33.090909
chemlab/chemlab
chemlab/graphics/transformations.py
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/graphics/transformations.py#L1429-L1440
def quaternion_inverse(quaternion): """Return inverse of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_inverse(q0) >>> numpy.allclose(quaternion_multiply(q0, q1), [1, 0, 0, 0]) True """ q = numpy.array(quaternion, dtype=numpy.float64, copy=True) numpy.negative(q[1:], q[1...
[ "def", "quaternion_inverse", "(", "quaternion", ")", ":", "q", "=", "numpy", ".", "array", "(", "quaternion", ",", "dtype", "=", "numpy", ".", "float64", ",", "copy", "=", "True", ")", "numpy", ".", "negative", "(", "q", "[", "1", ":", "]", ",", "q...
Return inverse of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_inverse(q0) >>> numpy.allclose(quaternion_multiply(q0, q1), [1, 0, 0, 0]) True
[ "Return", "inverse", "of", "quaternion", "." ]
python
train
28.583333
chrislit/abydos
abydos/compression/_arithmetic.py
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_arithmetic.py#L204-L245
def decode(self, longval, nbits): """Decode the number to a string using the given statistics. Parameters ---------- longval : int The first part of an encoded tuple from encode nbits : int The second part of an encoded tuple from encode Returns ...
[ "def", "decode", "(", "self", ",", "longval", ",", "nbits", ")", ":", "val", "=", "Fraction", "(", "longval", ",", "long", "(", "1", ")", "<<", "nbits", ")", "letters", "=", "[", "]", "probs_items", "=", "[", "(", "char", ",", "minval", ",", "max...
Decode the number to a string using the given statistics. Parameters ---------- longval : int The first part of an encoded tuple from encode nbits : int The second part of an encoded tuple from encode Returns ------- str The a...
[ "Decode", "the", "number", "to", "a", "string", "using", "the", "given", "statistics", "." ]
python
valid
26.404762
CI-WATER/gsshapy
gsshapy/grid/grid_to_gssha.py
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L681-L806
def _load_converted_gssha_data_from_lsm(self, gssha_var, lsm_var, load_type, time_step=None): """ This function loads data from LSM and converts to GSSHA format """ if 'radiation' in gssha_var: conversion_factor = self.netcdf_attributes[gssha_var]['conversion_factor'][load_ty...
[ "def", "_load_converted_gssha_data_from_lsm", "(", "self", ",", "gssha_var", ",", "lsm_var", ",", "load_type", ",", "time_step", "=", "None", ")", ":", "if", "'radiation'", "in", "gssha_var", ":", "conversion_factor", "=", "self", ".", "netcdf_attributes", "[", ...
This function loads data from LSM and converts to GSSHA format
[ "This", "function", "loads", "data", "from", "LSM", "and", "converts", "to", "GSSHA", "format" ]
python
train
55.412698
Parsely/schemato
schemato/schemas/parselypage.py
https://github.com/Parsely/schemato/blob/7002316fbcd52f2e669f8372bf1338c572e3df4b/schemato/schemas/parselypage.py#L69-L84
def _get_parselypage(self, body): """extract the parsely-page meta content from a page""" parser = ParselyPageParser() ret = None try: parser.feed(body) except HTMLParseError: pass # ignore and hope we got ppage if parser.ppage is None: ...
[ "def", "_get_parselypage", "(", "self", ",", "body", ")", ":", "parser", "=", "ParselyPageParser", "(", ")", "ret", "=", "None", "try", ":", "parser", ".", "feed", "(", "body", ")", "except", "HTMLParseError", ":", "pass", "# ignore and hope we got ppage", "...
extract the parsely-page meta content from a page
[ "extract", "the", "parsely", "-", "page", "meta", "content", "from", "a", "page" ]
python
train
31.1875
postlund/pyatv
pyatv/mrp/protocol.py
https://github.com/postlund/pyatv/blob/655dfcda4e2f9d1c501540e18da4f480d8bf0e70/pyatv/mrp/protocol.py#L172-L183
def message_received(self, message): """Message was received from device.""" # If the message identifer is outstanding, then someone is # waiting for the respone so we save it here identifier = message.identifier or 'type_' + str(message.type) if identifier in self._outstanding: ...
[ "def", "message_received", "(", "self", ",", "message", ")", ":", "# If the message identifer is outstanding, then someone is", "# waiting for the respone so we save it here", "identifier", "=", "message", ".", "identifier", "or", "'type_'", "+", "str", "(", "message", ".",...
Message was received from device.
[ "Message", "was", "received", "from", "device", "." ]
python
train
52.25
RiotGames/cloud-inquisitor
plugins/public/cinq-auditor-iam/cinq_auditor_iam/__init__.py
https://github.com/RiotGames/cloud-inquisitor/blob/181dc2566ca59fc855f695b7fcc2c3b934e6ee9f/plugins/public/cinq-auditor-iam/cinq_auditor_iam/__init__.py#L155-L285
def check_roles(self, account, aws_policies, aws_roles): """Iterate through the roles of a specific account and create or update the roles if they're missing or does not match the roles from Git. Args: account (:obj:`Account`): The account to check roles on aws_policies ...
[ "def", "check_roles", "(", "self", ",", "account", ",", "aws_policies", ",", "aws_roles", ")", ":", "self", ".", "log", ".", "debug", "(", "'Checking roles for {}'", ".", "format", "(", "account", ".", "account_name", ")", ")", "max_session_duration", "=", "...
Iterate through the roles of a specific account and create or update the roles if they're missing or does not match the roles from Git. Args: account (:obj:`Account`): The account to check roles on aws_policies (:obj:`dict` of `str`: `dict`): A dictionary containing all the poli...
[ "Iterate", "through", "the", "roles", "of", "a", "specific", "account", "and", "create", "or", "update", "the", "roles", "if", "they", "re", "missing", "or", "does", "not", "match", "the", "roles", "from", "Git", "." ]
python
train
47.435115
respondcreate/django-versatileimagefield
versatileimagefield/versatileimagefield.py
https://github.com/respondcreate/django-versatileimagefield/blob/d41e279c39cccffafbe876c67596184704ae8877/versatileimagefield/versatileimagefield.py#L190-L198
def process_image(self, image, image_format, save_kwargs={}): """Return a BytesIO instance of `image` with inverted colors.""" imagefile = BytesIO() inv_image = ImageOps.invert(image) inv_image.save( imagefile, **save_kwargs ) return imagefile
[ "def", "process_image", "(", "self", ",", "image", ",", "image_format", ",", "save_kwargs", "=", "{", "}", ")", ":", "imagefile", "=", "BytesIO", "(", ")", "inv_image", "=", "ImageOps", ".", "invert", "(", "image", ")", "inv_image", ".", "save", "(", "...
Return a BytesIO instance of `image` with inverted colors.
[ "Return", "a", "BytesIO", "instance", "of", "image", "with", "inverted", "colors", "." ]
python
test
34.111111
dshean/pygeotools
pygeotools/lib/timelib.py
https://github.com/dshean/pygeotools/blob/5ac745717c0098d01eb293ff1fe32fd7358c76ab/pygeotools/lib/timelib.py#L496-L516
def jd2dt(jd): """Convert julian date to datetime """ n = int(round(float(jd))) a = n + 32044 b = (4*a + 3)//146097 c = a - (146097*b)//4 d = (4*c + 3)//1461 e = c - (1461*d)//4 m = (5*e + 2)//153 day = e + 1 - (153*m + 2)//5 month = m + 3 - 12*(m//10) year = 100*b + d - ...
[ "def", "jd2dt", "(", "jd", ")", ":", "n", "=", "int", "(", "round", "(", "float", "(", "jd", ")", ")", ")", "a", "=", "n", "+", "32044", "b", "=", "(", "4", "*", "a", "+", "3", ")", "//", "146097", "c", "=", "a", "-", "(", "146097", "*"...
Convert julian date to datetime
[ "Convert", "julian", "date", "to", "datetime" ]
python
train
29.333333
MycroftAI/adapt
adapt/engine.py
https://github.com/MycroftAI/adapt/blob/334f23248b8e09fb9d84a88398424ec5bd3bae4c/adapt/engine.py#L315-L327
def register_regex_entity(self, regex_str, domain=0): """ A regular expression making use of python named group expressions. Example: (?P<Artist>.*) Args: regex_str(str): a string representing a regular expression as defined above domain(str): a string represent...
[ "def", "register_regex_entity", "(", "self", ",", "regex_str", ",", "domain", "=", "0", ")", ":", "if", "domain", "not", "in", "self", ".", "domains", ":", "self", ".", "register_domain", "(", "domain", "=", "domain", ")", "self", ".", "domains", "[", ...
A regular expression making use of python named group expressions. Example: (?P<Artist>.*) Args: regex_str(str): a string representing a regular expression as defined above domain(str): a string representing the domain you wish to add the entity to
[ "A", "regular", "expression", "making", "use", "of", "python", "named", "group", "expressions", "." ]
python
train
40.230769
MacHu-GWU/dataIO-project
dataIO/zzz_manual_install.py
https://github.com/MacHu-GWU/dataIO-project/blob/7e1cc192b5e53426eed6dbd742918619b8fd60ab/dataIO/zzz_manual_install.py#L103-L109
def find_DST(): """Find where this package should be installed to. """ if SYS_NAME == "Windows": return os.path.join(site.getsitepackages()[1], PKG_NAME) elif SYS_NAME in ["Darwin", "Linux"]: return os.path.join(site.getsitepackages()[0], PKG_NAME)
[ "def", "find_DST", "(", ")", ":", "if", "SYS_NAME", "==", "\"Windows\"", ":", "return", "os", ".", "path", ".", "join", "(", "site", ".", "getsitepackages", "(", ")", "[", "1", "]", ",", "PKG_NAME", ")", "elif", "SYS_NAME", "in", "[", "\"Darwin\"", "...
Find where this package should be installed to.
[ "Find", "where", "this", "package", "should", "be", "installed", "to", "." ]
python
train
39.142857
LuqueDaniel/pybooru
pybooru/api_danbooru.py
https://github.com/LuqueDaniel/pybooru/blob/60cd5254684d293b308f0b11b8f4ac2dce101479/pybooru/api_danbooru.py#L570-L593
def artist_update(self, artist_id, name=None, other_names_comma=None, group_name=None, url_string=None, body=None): """Function to update artists (Requires login) (UNTESTED). Parameters: artist_id (str): name (str): Artist name. other_names_comm...
[ "def", "artist_update", "(", "self", ",", "artist_id", ",", "name", "=", "None", ",", "other_names_comma", "=", "None", ",", "group_name", "=", "None", ",", "url_string", "=", "None", ",", "body", "=", "None", ")", ":", "params", "=", "{", "'artist[name]...
Function to update artists (Requires login) (UNTESTED). Parameters: artist_id (str): name (str): Artist name. other_names_comma (str): List of alternative names for this artist, comma delimited. group_name (str): The name of t...
[ "Function", "to", "update", "artists", "(", "Requires", "login", ")", "(", "UNTESTED", ")", "." ]
python
train
46.583333
CZ-NIC/python-rt
rt.py
https://github.com/CZ-NIC/python-rt/blob/e7a9f555e136708aec3317f857045145a2271e16/rt.py#L963-L1051
def get_attachment(self, ticket_id, attachment_id): """ Get attachment. :param ticket_id: ID of ticket :param attachment_id: ID of attachment for obtain :returns: Attachment as dictionary with these keys: * Transaction * ContentType ...
[ "def", "get_attachment", "(", "self", ",", "ticket_id", ",", "attachment_id", ")", ":", "msg", "=", "self", ".", "__request", "(", "'ticket/{}/attachments/{}'", ".", "format", "(", "str", "(", "ticket_id", ")", ",", "str", "(", "attachment_id", ")", ")", "...
Get attachment. :param ticket_id: ID of ticket :param attachment_id: ID of attachment for obtain :returns: Attachment as dictionary with these keys: * Transaction * ContentType * Parent * Creator ...
[ "Get", "attachment", "." ]
python
train
43.47191
novopl/peltak
src/peltak/core/conf.py
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/conf.py#L91-L109
def load(): # type: () -> None """ Load configuration from file. This will search the directory structure upwards to find the project root (directory containing ``pelconf.py`` file). Once found it will import the config file which should initialize all the configuration (using `peltak.core.conf...
[ "def", "load", "(", ")", ":", "# type: () -> None", "with", "within_proj_dir", "(", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "'pelconf.yaml'", ")", ":", "load_yaml_config", "(", "'pelconf.yaml'", ")", "if", "os", ".", "path", ".", "exists", ...
Load configuration from file. This will search the directory structure upwards to find the project root (directory containing ``pelconf.py`` file). Once found it will import the config file which should initialize all the configuration (using `peltak.core.conf.init()` function). You can also have ...
[ "Load", "configuration", "from", "file", "." ]
python
train
37.631579
spacetelescope/pysynphot
pysynphot/spectrum.py
https://github.com/spacetelescope/pysynphot/blob/a125ff956f4d94beb157bd51899747a13234bb97/pysynphot/spectrum.py#L1896-L1940
def photbw(self, floor=0): """Calculate :ref:`pysynphot-formula-bandw`. .. note:: For backward-compatibility with IRAF STSDAS SYNPHOT only. Parameters ---------- floor : float Same as :meth:`rmswidth`. Returns ------- ans : float ...
[ "def", "photbw", "(", "self", ",", "floor", "=", "0", ")", ":", "mywaveunits", "=", "self", ".", "waveunits", ".", "name", "self", ".", "convert", "(", "'angstroms'", ")", "wave", "=", "self", ".", "wave", "thru", "=", "self", ".", "throughput", "sel...
Calculate :ref:`pysynphot-formula-bandw`. .. note:: For backward-compatibility with IRAF STSDAS SYNPHOT only. Parameters ---------- floor : float Same as :meth:`rmswidth`. Returns ------- ans : float RMS band width (deprecated).
[ "Calculate", ":", "ref", ":", "pysynphot", "-", "formula", "-", "bandw", "." ]
python
train
25.066667
wmayner/pyphi
pyphi/actual.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/actual.py#L366-L383
def potential_purviews(self, direction, mechanism, purviews=False): """Return all purviews that could belong to the |MIC|/|MIE|. Filters out trivially-reducible purviews. Args: direction (str): Either |CAUSE| or |EFFECT|. mechanism (tuple[int]): The mechanism of interes...
[ "def", "potential_purviews", "(", "self", ",", "direction", ",", "mechanism", ",", "purviews", "=", "False", ")", ":", "system", "=", "self", ".", "system", "[", "direction", "]", "return", "[", "purview", "for", "purview", "in", "system", ".", "potential_...
Return all purviews that could belong to the |MIC|/|MIE|. Filters out trivially-reducible purviews. Args: direction (str): Either |CAUSE| or |EFFECT|. mechanism (tuple[int]): The mechanism of interest. Keyword Args: purviews (tuple[int]): Optional subset of...
[ "Return", "all", "purviews", "that", "could", "belong", "to", "the", "|MIC|", "/", "|MIE|", "." ]
python
train
36.833333
obulpathi/cdn-fastly-python
fastly/__init__.py
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L228-L232
def update_cache_settings(self, service_id, version_number, name_key, **kwargs): """Update a specific cache settings object.""" body = self._formdata(kwargs, FastlyCacheSettings.FIELDS) content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name_key), method="PUT", body=bo...
[ "def", "update_cache_settings", "(", "self", ",", "service_id", ",", "version_number", ",", "name_key", ",", "*", "*", "kwargs", ")", ":", "body", "=", "self", ".", "_formdata", "(", "kwargs", ",", "FastlyCacheSettings", ".", "FIELDS", ")", "content", "=", ...
Update a specific cache settings object.
[ "Update", "a", "specific", "cache", "settings", "object", "." ]
python
train
72.6
saltstack/salt
salt/states/ipmi.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ipmi.py#L150-L257
def user_present(name, uid, password, channel=14, callback=False, link_auth=True, ipmi_msg=True, privilege_level='administrator', **kwargs): ''' Ensure IPMI user and user privileges. name name of user (limit 16 bytes) uid user id number (1 to 7) password us...
[ "def", "user_present", "(", "name", ",", "uid", ",", "password", ",", "channel", "=", "14", ",", "callback", "=", "False", ",", "link_auth", "=", "True", ",", "ipmi_msg", "=", "True", ",", "privilege_level", "=", "'administrator'", ",", "*", "*", "kwargs...
Ensure IPMI user and user privileges. name name of user (limit 16 bytes) uid user id number (1 to 7) password user password (limit 16 bytes) channel ipmi channel defaults to 14 for auto callback User Restricted to Callback False = User Privilege ...
[ "Ensure", "IPMI", "user", "and", "user", "privileges", "." ]
python
train
35.148148
aws/sagemaker-containers
src/sagemaker_containers/_mapping.py
https://github.com/aws/sagemaker-containers/blob/0030f07abbaf22a55d986d97274d7a8d1aa1f10c/src/sagemaker_containers/_mapping.py#L144-L151
def properties(self): # type: () -> list """ Returns: (list[str]) List of public properties """ _type = type(self) return [_property for _property in dir(_type) if self._is_property(_property)]
[ "def", "properties", "(", "self", ")", ":", "# type: () -> list", "_type", "=", "type", "(", "self", ")", "return", "[", "_property", "for", "_property", "in", "dir", "(", "_type", ")", "if", "self", ".", "_is_property", "(", "_property", ")", "]" ]
Returns: (list[str]) List of public properties
[ "Returns", ":", "(", "list", "[", "str", "]", ")", "List", "of", "public", "properties" ]
python
train
31
salu133445/pypianoroll
pypianoroll/metrics.py
https://github.com/salu133445/pypianoroll/blob/6224dc1e29222de2124d249acb80f3d072166917/pypianoroll/metrics.py#L47-L58
def qualified_note_rate(pianoroll, threshold=2): """Return the ratio of the number of the qualified notes (notes longer than `threshold` (in time step)) to the total number of notes in a pianoroll.""" _validate_pianoroll(pianoroll) if np.issubdtype(pianoroll.dtype, np.bool_): pianoroll = pianoro...
[ "def", "qualified_note_rate", "(", "pianoroll", ",", "threshold", "=", "2", ")", ":", "_validate_pianoroll", "(", "pianoroll", ")", "if", "np", ".", "issubdtype", "(", "pianoroll", ".", "dtype", ",", "np", ".", "bool_", ")", ":", "pianoroll", "=", "pianoro...
Return the ratio of the number of the qualified notes (notes longer than `threshold` (in time step)) to the total number of notes in a pianoroll.
[ "Return", "the", "ratio", "of", "the", "number", "of", "the", "qualified", "notes", "(", "notes", "longer", "than", "threshold", "(", "in", "time", "step", "))", "to", "the", "total", "number", "of", "notes", "in", "a", "pianoroll", "." ]
python
train
52.166667
fbergmann/libSEDML
examples/python/print_sedml.py
https://github.com/fbergmann/libSEDML/blob/2611274d993cb92c663f8f0296896a6e441f75fd/examples/python/print_sedml.py#L40-L97
def main (args): """Usage: print_sedml input-filename """ if len(args) != 2: print(main.__doc__) sys.exit(1) doc = libsedml.readSedML(args[1]); if ( doc.getErrorLog().getNumFailsWithSeverity(libsedml.LIBSEDML_SEV_ERROR) > 0): print doc.getErrorLog().toString(); sys.exit(2); print 'The...
[ "def", "main", "(", "args", ")", ":", "if", "len", "(", "args", ")", "!=", "2", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", "1", ")", "doc", "=", "libsedml", ".", "readSedML", "(", "args", "[", "1", "]", ")", "if"...
Usage: print_sedml input-filename
[ "Usage", ":", "print_sedml", "input", "-", "filename" ]
python
train
43.293103
pandas-dev/pandas
pandas/io/pytables.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1619-L1646
def convert(self, values, nan_rep, encoding, errors): """ set the values from this selection: take = take ownership """ # values is a recarray if values.dtype.fields is not None: values = values[self.cname] values = _maybe_convert(values, self.kind, encoding, errors) ...
[ "def", "convert", "(", "self", ",", "values", ",", "nan_rep", ",", "encoding", ",", "errors", ")", ":", "# values is a recarray", "if", "values", ".", "dtype", ".", "fields", "is", "not", "None", ":", "values", "=", "values", "[", "self", ".", "cname", ...
set the values from this selection: take = take ownership
[ "set", "the", "values", "from", "this", "selection", ":", "take", "=", "take", "ownership" ]
python
train
36.107143
StackStorm/pybind
pybind/nos/v6_0_2f/rbridge_id/router/router_bgp/router_bgp_attributes/neighbor/neighbor_ips/neighbor_addr/update_source/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/rbridge_id/router/router_bgp/router_bgp_attributes/neighbor/neighbor_ips/neighbor_addr/update_source/__init__.py#L95-L116
def _set_sip_ipv4_address(self, v, load=False): """ Setter method for sip_ipv4_address, mapped from YANG variable /rbridge_id/router/router_bgp/router_bgp_attributes/neighbor/neighbor_ips/neighbor_addr/update_source/sip_ipv4_address (sip-ipv4-address) If this variable is read-only (config: false) in the ...
[ "def", "_set_sip_ipv4_address", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", ...
Setter method for sip_ipv4_address, mapped from YANG variable /rbridge_id/router/router_bgp/router_bgp_attributes/neighbor/neighbor_ips/neighbor_addr/update_source/sip_ipv4_address (sip-ipv4-address) If this variable is read-only (config: false) in the source YANG file, then _set_sip_ipv4_address is considered ...
[ "Setter", "method", "for", "sip_ipv4_address", "mapped", "from", "YANG", "variable", "/", "rbridge_id", "/", "router", "/", "router_bgp", "/", "router_bgp_attributes", "/", "neighbor", "/", "neighbor_ips", "/", "neighbor_addr", "/", "update_source", "/", "sip_ipv4_a...
python
train
97.818182
ojii/django-multilingual-ng
multilingual/translation.py
https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L38-L80
def fill_translation_cache(instance): """ Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization. """ if hasattr(instance, '_transl...
[ "def", "fill_translation_cache", "(", "instance", ")", ":", "if", "hasattr", "(", "instance", ",", "'_translation_cache'", ")", ":", "# do not refill the cache", "return", "instance", ".", "_translation_cache", "=", "{", "}", "# unsafed instances cannot have translations"...
Fill the translation cache using information received in the instance objects as extra fields. You can not do this in post_init because the extra fields are assigned by QuerySet.iterator after model initialization.
[ "Fill", "the", "translation", "cache", "using", "information", "received", "in", "the", "instance", "objects", "as", "extra", "fields", "." ]
python
train
41.953488
Tygs/ww
src/ww/tools/iterables.py
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L333-L343
def lasts(iterable, items=1, default=None): # type: (Iterable[T], int, T) -> Iterable[T] """ Lazily return the last x items from this iterable or default. """ last_items = deque(iterable, maxlen=items) for _ in range(items - len(last_items)): yield default for y in last_items: yie...
[ "def", "lasts", "(", "iterable", ",", "items", "=", "1", ",", "default", "=", "None", ")", ":", "# type: (Iterable[T], int, T) -> Iterable[T]", "last_items", "=", "deque", "(", "iterable", ",", "maxlen", "=", "items", ")", "for", "_", "in", "range", "(", "...
Lazily return the last x items from this iterable or default.
[ "Lazily", "return", "the", "last", "x", "items", "from", "this", "iterable", "or", "default", "." ]
python
train
28.545455
brechtm/rinohtype
src/rinoh/util.py
https://github.com/brechtm/rinohtype/blob/40a63c4e5ad7550f62b6860f1812cb67cafb9dc7/src/rinoh/util.py#L42-L47
def all_subclasses(cls): """Generator yielding all subclasses of `cls` recursively""" for subcls in cls.__subclasses__(): yield subcls for subsubcls in all_subclasses(subcls): yield subsubcls
[ "def", "all_subclasses", "(", "cls", ")", ":", "for", "subcls", "in", "cls", ".", "__subclasses__", "(", ")", ":", "yield", "subcls", "for", "subsubcls", "in", "all_subclasses", "(", "subcls", ")", ":", "yield", "subsubcls" ]
Generator yielding all subclasses of `cls` recursively
[ "Generator", "yielding", "all", "subclasses", "of", "cls", "recursively" ]
python
train
37
jonhadfield/creds
lib/creds/constants.py
https://github.com/jonhadfield/creds/blob/b2053b43516cf742c6e4c2b79713bc625592f47c/lib/creds/constants.py#L33-L54
def login_defs(): """Discover the minimum and maximum UID number.""" uid_min = None uid_max = None login_defs_path = '/etc/login.defs' if os.path.exists(login_defs_path): with io.open(text_type(login_defs_path), encoding=text_type('utf-8')) as log_defs_file: login_data = log_defs...
[ "def", "login_defs", "(", ")", ":", "uid_min", "=", "None", "uid_max", "=", "None", "login_defs_path", "=", "'/etc/login.defs'", "if", "os", ".", "path", ".", "exists", "(", "login_defs_path", ")", ":", "with", "io", ".", "open", "(", "text_type", "(", "...
Discover the minimum and maximum UID number.
[ "Discover", "the", "minimum", "and", "maximum", "UID", "number", "." ]
python
train
40.863636
apple/turicreate
src/unity/python/turicreate/toolkits/_tree_model_mixin.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L210-L247
def _dump_to_json(self, with_stats): """ Dump the models into a list of strings. Each string is a text representation of a tree. Parameters ---------- with_stats : bool If true, include node statistics in the output. Returns ------- o...
[ "def", "_dump_to_json", "(", "self", ",", "with_stats", ")", ":", "import", "json", "trees_json_str", "=", "tc", ".", "extensions", ".", "_xgboost_dump_model", "(", "self", ".", "__proxy__", ",", "with_stats", "=", "with_stats", ",", "format", "=", "'json'", ...
Dump the models into a list of strings. Each string is a text representation of a tree. Parameters ---------- with_stats : bool If true, include node statistics in the output. Returns ------- out : SFrame A table with two columns: feature...
[ "Dump", "the", "models", "into", "a", "list", "of", "strings", ".", "Each", "string", "is", "a", "text", "representation", "of", "a", "tree", "." ]
python
train
38.210526
scidash/sciunit
sciunit/models/backends.py
https://github.com/scidash/sciunit/blob/41b2e38c45c0776727ab1f281a572b65be19cea1/sciunit/models/backends.py#L90-L93
def set_memory_cache(self, results, key=None): """Store result in memory cache with key matching model state.""" key = self.model.hash if key is None else key self.memory_cache[key] = results
[ "def", "set_memory_cache", "(", "self", ",", "results", ",", "key", "=", "None", ")", ":", "key", "=", "self", ".", "model", ".", "hash", "if", "key", "is", "None", "else", "key", "self", ".", "memory_cache", "[", "key", "]", "=", "results" ]
Store result in memory cache with key matching model state.
[ "Store", "result", "in", "memory", "cache", "with", "key", "matching", "model", "state", "." ]
python
train
53
ray-project/ray
python/ray/tune/trial_runner.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial_runner.py#L555-L578
def _update_trial_queue(self, blocking=False, timeout=600): """Adds next trials to queue if possible. Note that the timeout is currently unexposed to the user. Args: blocking (bool): Blocks until either a trial is available or is_finished (timeout or search algorith...
[ "def", "_update_trial_queue", "(", "self", ",", "blocking", "=", "False", ",", "timeout", "=", "600", ")", ":", "trials", "=", "self", ".", "_search_alg", ".", "next_trials", "(", ")", "if", "blocking", "and", "not", "trials", ":", "start", "=", "time", ...
Adds next trials to queue if possible. Note that the timeout is currently unexposed to the user. Args: blocking (bool): Blocks until either a trial is available or is_finished (timeout or search algorithm finishes). timeout (int): Seconds before blocking times o...
[ "Adds", "next", "trials", "to", "queue", "if", "possible", "." ]
python
train
42.666667
HewlettPackard/python-hpOneView
hpOneView/oneview_client.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L777-L786
def racks(self): """ Gets the Racks API client. Returns: Racks: """ if not self.__racks: self.__racks = Racks(self.__connection) return self.__racks
[ "def", "racks", "(", "self", ")", ":", "if", "not", "self", ".", "__racks", ":", "self", ".", "__racks", "=", "Racks", "(", "self", ".", "__connection", ")", "return", "self", ".", "__racks" ]
Gets the Racks API client. Returns: Racks:
[ "Gets", "the", "Racks", "API", "client", "." ]
python
train
21.2
onicagroup/runway
runway/commands/runway_command.py
https://github.com/onicagroup/runway/blob/3f3549ec3bf6e39b9f27d9738a1847f3a4369e7f/runway/commands/runway_command.py#L51-L59
def get_yaml_files_at_env_root(self): """Return list of yaml files in env_root.""" yaml_files = glob.glob( os.path.join(self.env_root, '*.yaml') ) yml_files = glob.glob( os.path.join(self.env_root, '*.yml') ) return yaml_files + yml_files
[ "def", "get_yaml_files_at_env_root", "(", "self", ")", ":", "yaml_files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "env_root", ",", "'*.yaml'", ")", ")", "yml_files", "=", "glob", ".", "glob", "(", "os", ".", "...
Return list of yaml files in env_root.
[ "Return", "list", "of", "yaml", "files", "in", "env_root", "." ]
python
train
33.555556
albertz/py_better_exchook
better_exchook.py
https://github.com/albertz/py_better_exchook/blob/3d524a027d7fc4e83e47e39a1978849561da69b3/better_exchook.py#L736-L743
def hide_button_span(self, mode, file=sys.stdout): """ :param int mode: 1 or 2 :param io.TextIOBase|io.StringIO file: """ file.write("\033[83;%iu" % mode) yield file.write("\033[83;0u")
[ "def", "hide_button_span", "(", "self", ",", "mode", ",", "file", "=", "sys", ".", "stdout", ")", ":", "file", ".", "write", "(", "\"\\033[83;%iu\"", "%", "mode", ")", "yield", "file", ".", "write", "(", "\"\\033[83;0u\"", ")" ]
:param int mode: 1 or 2 :param io.TextIOBase|io.StringIO file:
[ ":", "param", "int", "mode", ":", "1", "or", "2", ":", "param", "io", ".", "TextIOBase|io", ".", "StringIO", "file", ":" ]
python
train
29.25
chrisrink10/basilisp
src/basilisp/lang/compiler/generator.py
https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/compiler/generator.py#L2487-L2505
def _ns_var( py_ns_var: str = _NS_VAR, lisp_ns_var: str = LISP_NS_VAR, lisp_ns_ns: str = CORE_NS ) -> ast.Assign: """Assign a Python variable named `ns_var` to the value of the current namespace.""" return ast.Assign( targets=[ast.Name(id=py_ns_var, ctx=ast.Store())], value=ast.Call( ...
[ "def", "_ns_var", "(", "py_ns_var", ":", "str", "=", "_NS_VAR", ",", "lisp_ns_var", ":", "str", "=", "LISP_NS_VAR", ",", "lisp_ns_ns", ":", "str", "=", "CORE_NS", ")", "->", "ast", ".", "Assign", ":", "return", "ast", ".", "Assign", "(", "targets", "="...
Assign a Python variable named `ns_var` to the value of the current namespace.
[ "Assign", "a", "Python", "variable", "named", "ns_var", "to", "the", "value", "of", "the", "current", "namespace", "." ]
python
test
33
lyst/lightfm
lightfm/evaluation.py
https://github.com/lyst/lightfm/blob/87b942f87759b8336f9066a25e4762ae7d95455e/lightfm/evaluation.py#L257-L327
def reciprocal_rank( model, test_interactions, train_interactions=None, user_features=None, item_features=None, preserve_rows=False, num_threads=1, check_intersections=True, ): """ Measure the reciprocal rank metric for a model: 1 / the rank of the highest ranked positive exa...
[ "def", "reciprocal_rank", "(", "model", ",", "test_interactions", ",", "train_interactions", "=", "None", ",", "user_features", "=", "None", ",", "item_features", "=", "None", ",", "preserve_rows", "=", "False", ",", "num_threads", "=", "1", ",", "check_intersec...
Measure the reciprocal rank metric for a model: 1 / the rank of the highest ranked positive example. A perfect score is 1.0. Parameters ---------- model: LightFM instance the fitted model to be evaluated test_interactions: np.float32 csr_matrix of shape [n_users, n_items] Non-zer...
[ "Measure", "the", "reciprocal", "rank", "metric", "for", "a", "model", ":", "1", "/", "the", "rank", "of", "the", "highest", "ranked", "positive", "example", ".", "A", "perfect", "score", "is", "1", ".", "0", "." ]
python
train
37.492958
jonathf/chaospy
chaospy/distributions/baseclass.py
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/distributions/baseclass.py#L226-L298
def sample(self, size=(), rule="R", antithetic=None): """ Create pseudo-random generated samples. By default, the samples are created using standard (pseudo-)random samples. However, if needed, the samples can also be created by either low-discrepancy sequences, and/or variance ...
[ "def", "sample", "(", "self", ",", "size", "=", "(", ")", ",", "rule", "=", "\"R\"", ",", "antithetic", "=", "None", ")", ":", "size_", "=", "numpy", ".", "prod", "(", "size", ",", "dtype", "=", "int", ")", "dim", "=", "len", "(", "self", ")", ...
Create pseudo-random generated samples. By default, the samples are created using standard (pseudo-)random samples. However, if needed, the samples can also be created by either low-discrepancy sequences, and/or variance reduction techniques. Changing the sampling scheme, use the follo...
[ "Create", "pseudo", "-", "random", "generated", "samples", "." ]
python
train
44.410959
genialis/resolwe
resolwe/flow/views/entity.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/views/entity.py#L150-L160
def add_data(self, request, pk=None): """Add data to Entity and it's collection.""" # add data to entity resp = super().add_data(request, pk) # add data to collections in which entity is entity = self.get_object() for collection in entity.collections.all(): c...
[ "def", "add_data", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "# add data to entity", "resp", "=", "super", "(", ")", ".", "add_data", "(", "request", ",", "pk", ")", "# add data to collections in which entity is", "entity", "=", "self", ...
Add data to Entity and it's collection.
[ "Add", "data", "to", "Entity", "and", "it", "s", "collection", "." ]
python
train
33.727273
razorpay/razorpay-python
razorpay/resources/subscription.py
https://github.com/razorpay/razorpay-python/blob/5bc63fd8452165a4b54556888492e555222c8afe/razorpay/resources/subscription.py#L10-L17
def all(self, data={}, **kwargs): """" Fetch all Subscription entities Returns: Dictionary of Subscription data """ return super(Subscription, self).all(data, **kwargs)
[ "def", "all", "(", "self", ",", "data", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "Subscription", ",", "self", ")", ".", "all", "(", "data", ",", "*", "*", "kwargs", ")" ]
Fetch all Subscription entities Returns: Dictionary of Subscription data
[ "Fetch", "all", "Subscription", "entities" ]
python
train
26.75
push-things/django-th
th_evernote/evernote_mgr.py
https://github.com/push-things/django-th/blob/86c999d16bcf30b6224206e5b40824309834ac8c/th_evernote/evernote_mgr.py#L36-L45
def set_notebook(note_store, my_notebook, notebook_id): """ create a notebook """ if notebook_id == 0: new_notebook = Types.Notebook() new_notebook.name = my_notebook new_notebook.defaultNotebook = False notebook_id = note_store.createN...
[ "def", "set_notebook", "(", "note_store", ",", "my_notebook", ",", "notebook_id", ")", ":", "if", "notebook_id", "==", "0", ":", "new_notebook", "=", "Types", ".", "Notebook", "(", ")", "new_notebook", ".", "name", "=", "my_notebook", "new_notebook", ".", "d...
create a notebook
[ "create", "a", "notebook" ]
python
train
36.4
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L4348-L4384
def get_assessment_form_for_create(self, assessment_record_types): """Gets the assessment form for creating new assessments. A new form should be requested for each create transaction. arg: assessment_record_types (osid.type.Type[]): array of assessment record types to be in...
[ "def", "get_assessment_form_for_create", "(", "self", ",", "assessment_record_types", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.get_resource_form_for_create_template", "for", "arg", "in", "assessment_record_types", ":", "if", "not", "isinsta...
Gets the assessment form for creating new assessments. A new form should be requested for each create transaction. arg: assessment_record_types (osid.type.Type[]): array of assessment record types to be included in the create operation or an empty list if none ...
[ "Gets", "the", "assessment", "form", "for", "creating", "new", "assessments", "." ]
python
train
48.108108