repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
SetBased/py-etlt
etlt/Transformer.py
Transformer._handle_exception
def _handle_exception(self, row, exception): """ Logs an exception occurred during transformation of a row. :param list|dict|() row: The source row. :param Exception exception: The exception. """ self._log('Error during processing of line {0:d}.'.format(self._source_read...
python
def _handle_exception(self, row, exception): """ Logs an exception occurred during transformation of a row. :param list|dict|() row: The source row. :param Exception exception: The exception. """ self._log('Error during processing of line {0:d}.'.format(self._source_read...
[ "def", "_handle_exception", "(", "self", ",", "row", ",", "exception", ")", ":", "self", ".", "_log", "(", "'Error during processing of line {0:d}.'", ".", "format", "(", "self", ".", "_source_reader", ".", "row_number", ")", ")", "self", ".", "_log", "(", "...
Logs an exception occurred during transformation of a row. :param list|dict|() row: The source row. :param Exception exception: The exception.
[ "Logs", "an", "exception", "occurred", "during", "transformation", "of", "a", "row", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L153-L163
SetBased/py-etlt
etlt/Transformer.py
Transformer._find_all_step_methods
def _find_all_step_methods(self): """ Finds all _step<n> methods where n is an integer in this class. """ steps = ([method for method in dir(self) if callable(getattr(self, method)) and re.match(r'_step\d+\d+.*', method)]) steps = sorted(steps) for step ...
python
def _find_all_step_methods(self): """ Finds all _step<n> methods where n is an integer in this class. """ steps = ([method for method in dir(self) if callable(getattr(self, method)) and re.match(r'_step\d+\d+.*', method)]) steps = sorted(steps) for step ...
[ "def", "_find_all_step_methods", "(", "self", ")", ":", "steps", "=", "(", "[", "method", "for", "method", "in", "dir", "(", "self", ")", "if", "callable", "(", "getattr", "(", "self", ",", "method", ")", ")", "and", "re", ".", "match", "(", "r'_step...
Finds all _step<n> methods where n is an integer in this class.
[ "Finds", "all", "_step<n", ">", "methods", "where", "n", "is", "an", "integer", "in", "this", "class", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L166-L174
SetBased/py-etlt
etlt/Transformer.py
Transformer._transform_rows
def _transform_rows(self): """ Transforms all source rows. """ self._find_all_step_methods() for row in self._source_reader.next(): self._transform_row_wrapper(row)
python
def _transform_rows(self): """ Transforms all source rows. """ self._find_all_step_methods() for row in self._source_reader.next(): self._transform_row_wrapper(row)
[ "def", "_transform_rows", "(", "self", ")", ":", "self", ".", "_find_all_step_methods", "(", ")", "for", "row", "in", "self", ".", "_source_reader", ".", "next", "(", ")", ":", "self", ".", "_transform_row_wrapper", "(", "row", ")" ]
Transforms all source rows.
[ "Transforms", "all", "source", "rows", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L177-L184
SetBased/py-etlt
etlt/Transformer.py
Transformer._transform_row_wrapper
def _transform_row_wrapper(self, row): """ Transforms a single source row. :param dict[str|str] row: The source row. """ self._count_total += 1 try: # Transform the naturals keys in line to technical keys. in_row = copy.copy(row) out_...
python
def _transform_row_wrapper(self, row): """ Transforms a single source row. :param dict[str|str] row: The source row. """ self._count_total += 1 try: # Transform the naturals keys in line to technical keys. in_row = copy.copy(row) out_...
[ "def", "_transform_row_wrapper", "(", "self", ",", "row", ")", ":", "self", ".", "_count_total", "+=", "1", "try", ":", "# Transform the naturals keys in line to technical keys.", "in_row", "=", "copy", ".", "copy", "(", "row", ")", "out_row", "=", "{", "}", "...
Transforms a single source row. :param dict[str|str] row: The source row.
[ "Transforms", "a", "single", "source", "row", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L211-L249
SetBased/py-etlt
etlt/Transformer.py
Transformer._transform_row
def _transform_row(self, in_row, out_row): """ Transforms an input row to an output row (i.e. (partial) dimensional data). :param dict[str,str] in_row: The input row. :param dict[str,T] out_row: The output row. :rtype: (str,str) """ tmp_row = {} for ste...
python
def _transform_row(self, in_row, out_row): """ Transforms an input row to an output row (i.e. (partial) dimensional data). :param dict[str,str] in_row: The input row. :param dict[str,T] out_row: The output row. :rtype: (str,str) """ tmp_row = {} for ste...
[ "def", "_transform_row", "(", "self", ",", "in_row", ",", "out_row", ")", ":", "tmp_row", "=", "{", "}", "for", "step", "in", "self", ".", "_steps", ":", "park_info", ",", "ignore_info", "=", "step", "(", "in_row", ",", "tmp_row", ",", "out_row", ")", ...
Transforms an input row to an output row (i.e. (partial) dimensional data). :param dict[str,str] in_row: The input row. :param dict[str,T] out_row: The output row. :rtype: (str,str)
[ "Transforms", "an", "input", "row", "to", "an", "output", "row", "(", "i", ".", "e", ".", "(", "partial", ")", "dimensional", "data", ")", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L252-L268
SetBased/py-etlt
etlt/Transformer.py
Transformer._step00
def _step00(self, in_row, tmp_row, out_row): """ Prunes whitespace for all fields in the input row. :param dict in_row: The input row. :param dict tmp_row: Not used. :param dict out_row: Not used. """ for key, value in in_row.items(): in_row[key] = Wh...
python
def _step00(self, in_row, tmp_row, out_row): """ Prunes whitespace for all fields in the input row. :param dict in_row: The input row. :param dict tmp_row: Not used. :param dict out_row: Not used. """ for key, value in in_row.items(): in_row[key] = Wh...
[ "def", "_step00", "(", "self", ",", "in_row", ",", "tmp_row", ",", "out_row", ")", ":", "for", "key", ",", "value", "in", "in_row", ".", "items", "(", ")", ":", "in_row", "[", "key", "]", "=", "WhitespaceCleaner", ".", "clean", "(", "value", ")", "...
Prunes whitespace for all fields in the input row. :param dict in_row: The input row. :param dict tmp_row: Not used. :param dict out_row: Not used.
[ "Prunes", "whitespace", "for", "all", "fields", "in", "the", "input", "row", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L271-L282
SetBased/py-etlt
etlt/Transformer.py
Transformer._step99
def _step99(self, in_row, tmp_row, out_row): """ Validates all mandatory fields are in the output row and are filled. :param dict in_row: The input row. :param dict tmp_row: Not used. :param dict out_row: The output row. """ park_info = '' for field in se...
python
def _step99(self, in_row, tmp_row, out_row): """ Validates all mandatory fields are in the output row and are filled. :param dict in_row: The input row. :param dict tmp_row: Not used. :param dict out_row: The output row. """ park_info = '' for field in se...
[ "def", "_step99", "(", "self", ",", "in_row", ",", "tmp_row", ",", "out_row", ")", ":", "park_info", "=", "''", "for", "field", "in", "self", ".", "_mandatory_fields", ":", "if", "field", "not", "in", "out_row", "or", "not", "out_row", "[", "field", "]...
Validates all mandatory fields are in the output row and are filled. :param dict in_row: The input row. :param dict tmp_row: Not used. :param dict out_row: The output row.
[ "Validates", "all", "mandatory", "fields", "are", "in", "the", "output", "row", "and", "are", "filled", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L285-L300
SetBased/py-etlt
etlt/Transformer.py
Transformer._log_statistics
def _log_statistics(self): """ Log statistics about the number of rows and number of rows per second. """ rows_per_second_trans = self._count_total / (self._time1 - self._time0) rows_per_second_load = self._count_transform / (self._time2 - self._time1) rows_per_second_ove...
python
def _log_statistics(self): """ Log statistics about the number of rows and number of rows per second. """ rows_per_second_trans = self._count_total / (self._time1 - self._time0) rows_per_second_load = self._count_transform / (self._time2 - self._time1) rows_per_second_ove...
[ "def", "_log_statistics", "(", "self", ")", ":", "rows_per_second_trans", "=", "self", ".", "_count_total", "/", "(", "self", ".", "_time1", "-", "self", ".", "_time0", ")", "rows_per_second_load", "=", "self", ".", "_count_transform", "/", "(", "self", ".",...
Log statistics about the number of rows and number of rows per second.
[ "Log", "statistics", "about", "the", "number", "of", "rows", "and", "number", "of", "rows", "per", "second", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L333-L348
SetBased/py-etlt
etlt/Transformer.py
Transformer.transform_source_rows
def transform_source_rows(self): """ Transforms the rows for the source system into (partial) dimensional data. """ # Start timer for overall progress. self._time0 = time.perf_counter() self.pre_transform_source_rows() # Transform all source rows. with s...
python
def transform_source_rows(self): """ Transforms the rows for the source system into (partial) dimensional data. """ # Start timer for overall progress. self._time0 = time.perf_counter() self.pre_transform_source_rows() # Transform all source rows. with s...
[ "def", "transform_source_rows", "(", "self", ")", ":", "# Start timer for overall progress.", "self", ".", "_time0", "=", "time", ".", "perf_counter", "(", ")", "self", ".", "pre_transform_source_rows", "(", ")", "# Transform all source rows.", "with", "self", ".", ...
Transforms the rows for the source system into (partial) dimensional data.
[ "Transforms", "the", "rows", "for", "the", "source", "system", "into", "(", "partial", ")", "dimensional", "data", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/Transformer.py#L360-L393
seibert-media/Highton
highton/call_mixins/list_tag_call_mixin.py
ListTagCallMixin.list_tags
def list_tags(self): """ Get the tags of current object :return: the tags :rtype: list """ from highton.models.tag import Tag return fields.ListField( name=self.ENDPOINT, init_class=Tag ).decode( self.element_from_strin...
python
def list_tags(self): """ Get the tags of current object :return: the tags :rtype: list """ from highton.models.tag import Tag return fields.ListField( name=self.ENDPOINT, init_class=Tag ).decode( self.element_from_strin...
[ "def", "list_tags", "(", "self", ")", ":", "from", "highton", ".", "models", ".", "tag", "import", "Tag", "return", "fields", ".", "ListField", "(", "name", "=", "self", ".", "ENDPOINT", ",", "init_class", "=", "Tag", ")", ".", "decode", "(", "self", ...
Get the tags of current object :return: the tags :rtype: list
[ "Get", "the", "tags", "of", "current", "object" ]
train
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/call_mixins/list_tag_call_mixin.py#L12-L29
jkwill87/mapi
mapi/endpoints.py
_clean_dict
def _clean_dict(target_dict, whitelist=None): """ Convenience function that removes a dicts keys that have falsy values """ assert isinstance(target_dict, dict) return { ustr(k).strip(): ustr(v).strip() for k, v in target_dict.items() if v not in (None, Ellipsis, [], (), "") ...
python
def _clean_dict(target_dict, whitelist=None): """ Convenience function that removes a dicts keys that have falsy values """ assert isinstance(target_dict, dict) return { ustr(k).strip(): ustr(v).strip() for k, v in target_dict.items() if v not in (None, Ellipsis, [], (), "") ...
[ "def", "_clean_dict", "(", "target_dict", ",", "whitelist", "=", "None", ")", ":", "assert", "isinstance", "(", "target_dict", ",", "dict", ")", "return", "{", "ustr", "(", "k", ")", ".", "strip", "(", ")", ":", "ustr", "(", "v", ")", ".", "strip", ...
Convenience function that removes a dicts keys that have falsy values
[ "Convenience", "function", "that", "removes", "a", "dicts", "keys", "that", "have", "falsy", "values" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L69-L78
jkwill87/mapi
mapi/endpoints.py
_get_user_agent
def _get_user_agent(platform=None): """ Convenience function that looks up a user agent string, random if N/A """ if isinstance(platform, ustr): platform = platform.upper() return {"chrome": AGENT_CHROME, "edge": AGENT_EDGE, "ios": AGENT_IOS}.get( platform, random.choice(AGENT_ALL) )
python
def _get_user_agent(platform=None): """ Convenience function that looks up a user agent string, random if N/A """ if isinstance(platform, ustr): platform = platform.upper() return {"chrome": AGENT_CHROME, "edge": AGENT_EDGE, "ios": AGENT_IOS}.get( platform, random.choice(AGENT_ALL) )
[ "def", "_get_user_agent", "(", "platform", "=", "None", ")", ":", "if", "isinstance", "(", "platform", ",", "ustr", ")", ":", "platform", "=", "platform", ".", "upper", "(", ")", "return", "{", "\"chrome\"", ":", "AGENT_CHROME", ",", "\"edge\"", ":", "AG...
Convenience function that looks up a user agent string, random if N/A
[ "Convenience", "function", "that", "looks", "up", "a", "user", "agent", "string", "random", "if", "N", "/", "A" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L87-L94
jkwill87/mapi
mapi/endpoints.py
_request_json
def _request_json( url, parameters=None, body=None, headers=None, cache=True, agent=None, reattempt=5, ): """ Queries a url for json data Note: Requests are cached using requests_cached for a week, this is done transparently by using the package's monkey patching """ ass...
python
def _request_json( url, parameters=None, body=None, headers=None, cache=True, agent=None, reattempt=5, ): """ Queries a url for json data Note: Requests are cached using requests_cached for a week, this is done transparently by using the package's monkey patching """ ass...
[ "def", "_request_json", "(", "url", ",", "parameters", "=", "None", ",", "body", "=", "None", ",", "headers", "=", "None", ",", "cache", "=", "True", ",", "agent", "=", "None", ",", "reattempt", "=", "5", ",", ")", ":", "assert", "url", "content", ...
Queries a url for json data Note: Requests are cached using requests_cached for a week, this is done transparently by using the package's monkey patching
[ "Queries", "a", "url", "for", "json", "data" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L97-L167
jkwill87/mapi
mapi/endpoints.py
tmdb_find
def tmdb_find( api_key, external_source, external_id, language="en-US", cache=True ): """ Search for The Movie Database objects using another DB's foreign key Note: language codes aren't checked on this end or by TMDb, so if you enter an invalid language code your search itself will succeed, but ...
python
def tmdb_find( api_key, external_source, external_id, language="en-US", cache=True ): """ Search for The Movie Database objects using another DB's foreign key Note: language codes aren't checked on this end or by TMDb, so if you enter an invalid language code your search itself will succeed, but ...
[ "def", "tmdb_find", "(", "api_key", ",", "external_source", ",", "external_id", ",", "language", "=", "\"en-US\"", ",", "cache", "=", "True", ")", ":", "sources", "=", "[", "\"imdb_id\"", ",", "\"freebase_mid\"", ",", "\"freebase_id\"", ",", "\"tvdb_id\"", ","...
Search for The Movie Database objects using another DB's foreign key Note: language codes aren't checked on this end or by TMDb, so if you enter an invalid language code your search itself will succeed, but certain fields like synopsis will just be empty Online docs: developers.themoviedb.org/...
[ "Search", "for", "The", "Movie", "Database", "objects", "using", "another", "DB", "s", "foreign", "key" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L170-L206
jkwill87/mapi
mapi/endpoints.py
tmdb_movies
def tmdb_movies(api_key, id_tmdb, language="en-US", cache=True): """ Lookup a movie item using The Movie Database Online docs: developers.themoviedb.org/3/movies """ try: url = "https://api.themoviedb.org/3/movie/%d" % int(id_tmdb) except ValueError: raise MapiProviderException("id_...
python
def tmdb_movies(api_key, id_tmdb, language="en-US", cache=True): """ Lookup a movie item using The Movie Database Online docs: developers.themoviedb.org/3/movies """ try: url = "https://api.themoviedb.org/3/movie/%d" % int(id_tmdb) except ValueError: raise MapiProviderException("id_...
[ "def", "tmdb_movies", "(", "api_key", ",", "id_tmdb", ",", "language", "=", "\"en-US\"", ",", "cache", "=", "True", ")", ":", "try", ":", "url", "=", "\"https://api.themoviedb.org/3/movie/%d\"", "%", "int", "(", "id_tmdb", ")", "except", "ValueError", ":", "...
Lookup a movie item using The Movie Database Online docs: developers.themoviedb.org/3/movies
[ "Lookup", "a", "movie", "item", "using", "The", "Movie", "Database" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L209-L226
jkwill87/mapi
mapi/endpoints.py
tmdb_search_movies
def tmdb_search_movies( api_key, title, year=None, adult=False, region=None, page=1, cache=True ): """ Search for movies using The Movie Database Online docs: developers.themoviedb.org/3/search/search-movies """ url = "https://api.themoviedb.org/3/search/movie" try: if year: ...
python
def tmdb_search_movies( api_key, title, year=None, adult=False, region=None, page=1, cache=True ): """ Search for movies using The Movie Database Online docs: developers.themoviedb.org/3/search/search-movies """ url = "https://api.themoviedb.org/3/search/movie" try: if year: ...
[ "def", "tmdb_search_movies", "(", "api_key", ",", "title", ",", "year", "=", "None", ",", "adult", "=", "False", ",", "region", "=", "None", ",", "page", "=", "1", ",", "cache", "=", "True", ")", ":", "url", "=", "\"https://api.themoviedb.org/3/search/movi...
Search for movies using The Movie Database Online docs: developers.themoviedb.org/3/search/search-movies
[ "Search", "for", "movies", "using", "The", "Movie", "Database" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L229-L257
jkwill87/mapi
mapi/endpoints.py
tvdb_login
def tvdb_login(api_key): """ Logs into TVDb using the provided api key Note: You can register for a free TVDb key at thetvdb.com/?tab=apiregister Online docs: api.thetvdb.com/swagger#!/Authentication/post_login= """ url = "https://api.thetvdb.com/login" body = {"apikey": api_key} status, co...
python
def tvdb_login(api_key): """ Logs into TVDb using the provided api key Note: You can register for a free TVDb key at thetvdb.com/?tab=apiregister Online docs: api.thetvdb.com/swagger#!/Authentication/post_login= """ url = "https://api.thetvdb.com/login" body = {"apikey": api_key} status, co...
[ "def", "tvdb_login", "(", "api_key", ")", ":", "url", "=", "\"https://api.thetvdb.com/login\"", "body", "=", "{", "\"apikey\"", ":", "api_key", "}", "status", ",", "content", "=", "_request_json", "(", "url", ",", "body", "=", "body", ",", "cache", "=", "F...
Logs into TVDb using the provided api key Note: You can register for a free TVDb key at thetvdb.com/?tab=apiregister Online docs: api.thetvdb.com/swagger#!/Authentication/post_login=
[ "Logs", "into", "TVDb", "using", "the", "provided", "api", "key" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L260-L273
jkwill87/mapi
mapi/endpoints.py
tvdb_refresh_token
def tvdb_refresh_token(token): """ Refreshes JWT token Online docs: api.thetvdb.com/swagger#!/Authentication/get_refresh_token= """ url = "https://api.thetvdb.com/refresh_token" headers = {"Authorization": "Bearer %s" % token} status, content = _request_json(url, headers=headers, cache=False) ...
python
def tvdb_refresh_token(token): """ Refreshes JWT token Online docs: api.thetvdb.com/swagger#!/Authentication/get_refresh_token= """ url = "https://api.thetvdb.com/refresh_token" headers = {"Authorization": "Bearer %s" % token} status, content = _request_json(url, headers=headers, cache=False) ...
[ "def", "tvdb_refresh_token", "(", "token", ")", ":", "url", "=", "\"https://api.thetvdb.com/refresh_token\"", "headers", "=", "{", "\"Authorization\"", ":", "\"Bearer %s\"", "%", "token", "}", "status", ",", "content", "=", "_request_json", "(", "url", ",", "heade...
Refreshes JWT token Online docs: api.thetvdb.com/swagger#!/Authentication/get_refresh_token=
[ "Refreshes", "JWT", "token" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L276-L288
jkwill87/mapi
mapi/endpoints.py
tvdb_series_id
def tvdb_series_id(token, id_tvdb, lang="en", cache=True): """ Returns a series records that contains all information known about a particular series id Online docs: api.thetvdb.com/swagger#!/Series/get_series_id= """ if lang not in TVDB_LANGUAGE_CODES: raise MapiProviderException( ...
python
def tvdb_series_id(token, id_tvdb, lang="en", cache=True): """ Returns a series records that contains all information known about a particular series id Online docs: api.thetvdb.com/swagger#!/Series/get_series_id= """ if lang not in TVDB_LANGUAGE_CODES: raise MapiProviderException( ...
[ "def", "tvdb_series_id", "(", "token", ",", "id_tvdb", ",", "lang", "=", "\"en\"", ",", "cache", "=", "True", ")", ":", "if", "lang", "not", "in", "TVDB_LANGUAGE_CODES", ":", "raise", "MapiProviderException", "(", "\"'lang' must be one of %s\"", "%", "\",\"", ...
Returns a series records that contains all information known about a particular series id Online docs: api.thetvdb.com/swagger#!/Series/get_series_id=
[ "Returns", "a", "series", "records", "that", "contains", "all", "information", "known", "about", "a", "particular", "series", "id" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L317-L339
jkwill87/mapi
mapi/endpoints.py
tvdb_search_series
def tvdb_search_series( token, series=None, id_imdb=None, id_zap2it=None, lang="en", cache=True ): """ Allows the user to search for a series based on the following parameters Online docs: https://api.thetvdb.com/swagger#!/Search/get_search_series Note: results a maximum of 100 entries per page, no opt...
python
def tvdb_search_series( token, series=None, id_imdb=None, id_zap2it=None, lang="en", cache=True ): """ Allows the user to search for a series based on the following parameters Online docs: https://api.thetvdb.com/swagger#!/Search/get_search_series Note: results a maximum of 100 entries per page, no opt...
[ "def", "tvdb_search_series", "(", "token", ",", "series", "=", "None", ",", "id_imdb", "=", "None", ",", "id_zap2it", "=", "None", ",", "lang", "=", "\"en\"", ",", "cache", "=", "True", ")", ":", "if", "lang", "not", "in", "TVDB_LANGUAGE_CODES", ":", "...
Allows the user to search for a series based on the following parameters Online docs: https://api.thetvdb.com/swagger#!/Search/get_search_series Note: results a maximum of 100 entries per page, no option for pagination=
[ "Allows", "the", "user", "to", "search", "for", "a", "series", "based", "on", "the", "following", "parameters" ]
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/endpoints.py#L401-L429
kennknowles/python-rightarrow
rightarrow/lexer.py
Lexer.t_ID
def t_ID(self, t): r'~?[a-zA-Z_][a-zA-Z0-9_]*' if t.value[0] == '~': t.type = 'TYVAR' t.value = t.value[1:] elif t.value in self.reserved_words: t.type = self.reserved_words[t.value] else: t.type = 'ID' return t
python
def t_ID(self, t): r'~?[a-zA-Z_][a-zA-Z0-9_]*' if t.value[0] == '~': t.type = 'TYVAR' t.value = t.value[1:] elif t.value in self.reserved_words: t.type = self.reserved_words[t.value] else: t.type = 'ID' return t
[ "def", "t_ID", "(", "self", ",", "t", ")", ":", "if", "t", ".", "value", "[", "0", "]", "==", "'~'", ":", "t", ".", "type", "=", "'TYVAR'", "t", ".", "value", "=", "t", ".", "value", "[", "1", ":", "]", "elif", "t", ".", "value", "in", "s...
r'~?[a-zA-Z_][a-zA-Z0-9_]*
[ "r", "~?", "[", "a", "-", "zA", "-", "Z_", "]", "[", "a", "-", "zA", "-", "Z0", "-", "9_", "]", "*" ]
train
https://github.com/kennknowles/python-rightarrow/blob/86c83bde9d2fba6d54744eac9abedd1c248b7e73/rightarrow/lexer.py#L50-L61
moonso/vcftoolbox
vcftoolbox/header_parser.py
HeaderParser.parse_meta_data
def parse_meta_data(self, line): """Parse a vcf metadataline""" line = line.rstrip() logger.debug("Parsing metadata line:{0}".format(line)) line_info = line[2:].split('=') match = False if line_info[0] == 'fileformat': logger.debug("Parsing fileformat") ...
python
def parse_meta_data(self, line): """Parse a vcf metadataline""" line = line.rstrip() logger.debug("Parsing metadata line:{0}".format(line)) line_info = line[2:].split('=') match = False if line_info[0] == 'fileformat': logger.debug("Parsing fileformat") ...
[ "def", "parse_meta_data", "(", "self", ",", "line", ")", ":", "line", "=", "line", ".", "rstrip", "(", ")", "logger", ".", "debug", "(", "\"Parsing metadata line:{0}\"", ".", "format", "(", "line", ")", ")", "line_info", "=", "line", "[", "2", ":", "]"...
Parse a vcf metadataline
[ "Parse", "a", "vcf", "metadataline" ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/header_parser.py#L138-L240
moonso/vcftoolbox
vcftoolbox/header_parser.py
HeaderParser.remove_header
def remove_header(self, name): """Remove a field from the header""" if name in self.info_dict: self.info_dict.pop(name) logger.info("Removed '{0}' from INFO".format(name)) if name in self.filter_dict: self.filter_dict.pop(name) logger.info("Removed...
python
def remove_header(self, name): """Remove a field from the header""" if name in self.info_dict: self.info_dict.pop(name) logger.info("Removed '{0}' from INFO".format(name)) if name in self.filter_dict: self.filter_dict.pop(name) logger.info("Removed...
[ "def", "remove_header", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "info_dict", ":", "self", ".", "info_dict", ".", "pop", "(", "name", ")", "logger", ".", "info", "(", "\"Removed '{0}' from INFO\"", ".", "format", "(", "name", ...
Remove a field from the header
[ "Remove", "a", "field", "from", "the", "header" ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/header_parser.py#L249-L269
moonso/vcftoolbox
vcftoolbox/header_parser.py
HeaderParser.add_fileformat
def add_fileformat(self, fileformat): """ Add fileformat line to the header. Arguments: fileformat (str): The id of the info line """ self.fileformat = fileformat logger.info("Adding fileformat to vcf: {0}".format(fileformat)) return
python
def add_fileformat(self, fileformat): """ Add fileformat line to the header. Arguments: fileformat (str): The id of the info line """ self.fileformat = fileformat logger.info("Adding fileformat to vcf: {0}".format(fileformat)) return
[ "def", "add_fileformat", "(", "self", ",", "fileformat", ")", ":", "self", ".", "fileformat", "=", "fileformat", "logger", ".", "info", "(", "\"Adding fileformat to vcf: {0}\"", ".", "format", "(", "fileformat", ")", ")", "return" ]
Add fileformat line to the header. Arguments: fileformat (str): The id of the info line
[ "Add", "fileformat", "line", "to", "the", "header", "." ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/header_parser.py#L294-L304
moonso/vcftoolbox
vcftoolbox/header_parser.py
HeaderParser.add_meta_line
def add_meta_line(self, key, value): """ Adds an arbitrary metadata line to the header. This must be a key value pair Arguments: key (str): The key of the metadata line value (str): The value of the metadata line """ meta_line = '##{0}={1}'.form...
python
def add_meta_line(self, key, value): """ Adds an arbitrary metadata line to the header. This must be a key value pair Arguments: key (str): The key of the metadata line value (str): The value of the metadata line """ meta_line = '##{0}={1}'.form...
[ "def", "add_meta_line", "(", "self", ",", "key", ",", "value", ")", ":", "meta_line", "=", "'##{0}={1}'", ".", "format", "(", "key", ",", "value", ")", "logger", ".", "info", "(", "\"Adding meta line to vcf: {0}\"", ".", "format", "(", "meta_line", ")", ")...
Adds an arbitrary metadata line to the header. This must be a key value pair Arguments: key (str): The key of the metadata line value (str): The value of the metadata line
[ "Adds", "an", "arbitrary", "metadata", "line", "to", "the", "header", "." ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/header_parser.py#L306-L322
moonso/vcftoolbox
vcftoolbox/header_parser.py
HeaderParser.add_filter
def add_filter(self, filter_id, description): """ Add a filter line to the header. Arguments: filter_id (str): The id of the filter line description (str): A description of the info line """ filter_line = '##FILTER=<ID={0},Description="{1}">'.format( ...
python
def add_filter(self, filter_id, description): """ Add a filter line to the header. Arguments: filter_id (str): The id of the filter line description (str): A description of the info line """ filter_line = '##FILTER=<ID={0},Description="{1}">'.format( ...
[ "def", "add_filter", "(", "self", ",", "filter_id", ",", "description", ")", ":", "filter_line", "=", "'##FILTER=<ID={0},Description=\"{1}\">'", ".", "format", "(", "filter_id", ",", "description", ")", "logger", ".", "info", "(", "\"Adding filter line to vcf: {0}\"",...
Add a filter line to the header. Arguments: filter_id (str): The id of the filter line description (str): A description of the info line
[ "Add", "a", "filter", "line", "to", "the", "header", "." ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/header_parser.py#L342-L356
moonso/vcftoolbox
vcftoolbox/header_parser.py
HeaderParser.add_format
def add_format(self, format_id, number, entry_type, description): """ Add a format line to the header. Arguments: format_id (str): The id of the format line number (str): Integer or any of [A,R,G,.] entry_type (str): Any of [Integer,Float,Flag,Character,Strin...
python
def add_format(self, format_id, number, entry_type, description): """ Add a format line to the header. Arguments: format_id (str): The id of the format line number (str): Integer or any of [A,R,G,.] entry_type (str): Any of [Integer,Float,Flag,Character,Strin...
[ "def", "add_format", "(", "self", ",", "format_id", ",", "number", ",", "entry_type", ",", "description", ")", ":", "format_line", "=", "'##FORMAT=<ID={0},Number={1},Type={2},Description=\"{3}\">'", ".", "format", "(", "format_id", ",", "number", ",", "entry_type", ...
Add a format line to the header. Arguments: format_id (str): The id of the format line number (str): Integer or any of [A,R,G,.] entry_type (str): Any of [Integer,Float,Flag,Character,String] description (str): A description of the info line
[ "Add", "a", "format", "line", "to", "the", "header", "." ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/header_parser.py#L358-L374
moonso/vcftoolbox
vcftoolbox/header_parser.py
HeaderParser.add_alt
def add_alt(self, alt_id, description): """ Add a alternative allele format field line to the header. Arguments: alt_id (str): The id of the alternative line description (str): A description of the info line """ alt_line = '##ALT=<ID={0},Description="{1}...
python
def add_alt(self, alt_id, description): """ Add a alternative allele format field line to the header. Arguments: alt_id (str): The id of the alternative line description (str): A description of the info line """ alt_line = '##ALT=<ID={0},Description="{1}...
[ "def", "add_alt", "(", "self", ",", "alt_id", ",", "description", ")", ":", "alt_line", "=", "'##ALT=<ID={0},Description=\"{1}\">'", ".", "format", "(", "alt_id", ",", "description", ")", "logger", ".", "info", "(", "\"Adding alternative allele line to vcf: {0}\"", ...
Add a alternative allele format field line to the header. Arguments: alt_id (str): The id of the alternative line description (str): A description of the info line
[ "Add", "a", "alternative", "allele", "format", "field", "line", "to", "the", "header", "." ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/header_parser.py#L376-L390
moonso/vcftoolbox
vcftoolbox/header_parser.py
HeaderParser.add_contig
def add_contig(self, contig_id, length): """ Add a contig line to the header. Arguments: contig_id (str): The id of the alternative line length (str): A description of the info line """ contig_line = '##contig=<ID={0},length={1}>'.format( con...
python
def add_contig(self, contig_id, length): """ Add a contig line to the header. Arguments: contig_id (str): The id of the alternative line length (str): A description of the info line """ contig_line = '##contig=<ID={0},length={1}>'.format( con...
[ "def", "add_contig", "(", "self", ",", "contig_id", ",", "length", ")", ":", "contig_line", "=", "'##contig=<ID={0},length={1}>'", ".", "format", "(", "contig_id", ",", "length", ")", "logger", ".", "info", "(", "\"Adding contig line to vcf: {0}\"", ".", "format",...
Add a contig line to the header. Arguments: contig_id (str): The id of the alternative line length (str): A description of the info line
[ "Add", "a", "contig", "line", "to", "the", "header", "." ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/header_parser.py#L392-L406
moonso/vcftoolbox
vcftoolbox/get_file_handle.py
get_vcf_handle
def get_vcf_handle(fsock=None, infile=None): """Open the vcf file and return a handle""" vcf = None if (fsock or infile): if fsock: # if not infile and hasattr(fsock, 'name'): logger.info("Reading vcf form stdin") if sys.version_info < (3, 0): ...
python
def get_vcf_handle(fsock=None, infile=None): """Open the vcf file and return a handle""" vcf = None if (fsock or infile): if fsock: # if not infile and hasattr(fsock, 'name'): logger.info("Reading vcf form stdin") if sys.version_info < (3, 0): ...
[ "def", "get_vcf_handle", "(", "fsock", "=", "None", ",", "infile", "=", "None", ")", ":", "vcf", "=", "None", "if", "(", "fsock", "or", "infile", ")", ":", "if", "fsock", ":", "# if not infile and hasattr(fsock, 'name'):", "logger", ".", "info", "(", "\"Re...
Open the vcf file and return a handle
[ "Open", "the", "vcf", "file", "and", "return", "a", "handle" ]
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/get_file_handle.py#L9-L38
seibert-media/Highton
highton/call_mixins/delete_tag_call_mixin.py
DeleteTagCallMixin.delete_tag
def delete_tag(self, tag_id): """ Deletes a Tag to current object :param tag_id: the id of the tag which should be deleted :type tag_id: int :rtype: None """ from highton.models.tag import Tag self._delete_request( endpoint=self.ENDPOINT + '/...
python
def delete_tag(self, tag_id): """ Deletes a Tag to current object :param tag_id: the id of the tag which should be deleted :type tag_id: int :rtype: None """ from highton.models.tag import Tag self._delete_request( endpoint=self.ENDPOINT + '/...
[ "def", "delete_tag", "(", "self", ",", "tag_id", ")", ":", "from", "highton", ".", "models", ".", "tag", "import", "Tag", "self", ".", "_delete_request", "(", "endpoint", "=", "self", ".", "ENDPOINT", "+", "'/'", "+", "str", "(", "self", ".", "id", "...
Deletes a Tag to current object :param tag_id: the id of the tag which should be deleted :type tag_id: int :rtype: None
[ "Deletes", "a", "Tag", "to", "current", "object" ]
train
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/call_mixins/delete_tag_call_mixin.py#L11-L23
trustpilot/python-cireqs
cireqs/cli.py
expand
def expand(conf, output_requirements_filename, input_requirements_filename): """Expand given requirements file by extending it using pip freeze args: input_requirements_filename: the requirements filename to expand output_requirements_filename: the output filename for the expanded requirements fi...
python
def expand(conf, output_requirements_filename, input_requirements_filename): """Expand given requirements file by extending it using pip freeze args: input_requirements_filename: the requirements filename to expand output_requirements_filename: the output filename for the expanded requirements fi...
[ "def", "expand", "(", "conf", ",", "output_requirements_filename", ",", "input_requirements_filename", ")", ":", "exit_if_file_not_exists", "(", "input_requirements_filename", ",", "conf", ")", "cireqs", ".", "expand_requirements", "(", "requirements_filename", "=", "inpu...
Expand given requirements file by extending it using pip freeze args: input_requirements_filename: the requirements filename to expand output_requirements_filename: the output filename for the expanded requirements file
[ "Expand", "given", "requirements", "file", "by", "extending", "it", "using", "pip", "freeze" ]
train
https://github.com/trustpilot/python-cireqs/blob/7e17ac60ac7e6c6b0f1b939ba1248eb3349151cb/cireqs/cli.py#L74-L92
trustpilot/python-cireqs
cireqs/cli.py
verify
def verify(conf, input_requirements_filename): """Verifying that given requirements file is not missing any pins args: input_requirements_filename: requriements file to verify """ exit_if_file_not_exists(input_requirements_filename, conf) cireqs.check_if_requirements_are_up_to_date( ...
python
def verify(conf, input_requirements_filename): """Verifying that given requirements file is not missing any pins args: input_requirements_filename: requriements file to verify """ exit_if_file_not_exists(input_requirements_filename, conf) cireqs.check_if_requirements_are_up_to_date( ...
[ "def", "verify", "(", "conf", ",", "input_requirements_filename", ")", ":", "exit_if_file_not_exists", "(", "input_requirements_filename", ",", "conf", ")", "cireqs", ".", "check_if_requirements_are_up_to_date", "(", "requirements_filename", "=", "input_requirements_filename"...
Verifying that given requirements file is not missing any pins args: input_requirements_filename: requriements file to verify
[ "Verifying", "that", "given", "requirements", "file", "is", "not", "missing", "any", "pins" ]
train
https://github.com/trustpilot/python-cireqs/blob/7e17ac60ac7e6c6b0f1b939ba1248eb3349151cb/cireqs/cli.py#L108-L121
seibert-media/Highton
highton/call_mixins/list_task_call_mixin.py
ListTaskCallMixin.list_tasks
def list_tasks(self): """ Get the tasks of current object :return: the tasks :rtype: list """ from highton.models.task import Task return fields.ListField( name=self.ENDPOINT, init_class=Task ).decode( self.element_fro...
python
def list_tasks(self): """ Get the tasks of current object :return: the tasks :rtype: list """ from highton.models.task import Task return fields.ListField( name=self.ENDPOINT, init_class=Task ).decode( self.element_fro...
[ "def", "list_tasks", "(", "self", ")", ":", "from", "highton", ".", "models", ".", "task", "import", "Task", "return", "fields", ".", "ListField", "(", "name", "=", "self", ".", "ENDPOINT", ",", "init_class", "=", "Task", ")", ".", "decode", "(", "self...
Get the tasks of current object :return: the tasks :rtype: list
[ "Get", "the", "tasks", "of", "current", "object" ]
train
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/call_mixins/list_task_call_mixin.py#L12-L30
henzk/django-productline
django_productline/features/multilanguage_switcher/views.py
ChangeLangView.get
def get(self, *args, **kwargs): """ This view is used for changing the language (i18n). :return: """ from django.conf import settings new_lang = self.request.GET.get('lang') response = HttpResponseRedirect(self.request.META.get('HTTP_REFERER')) translation...
python
def get(self, *args, **kwargs): """ This view is used for changing the language (i18n). :return: """ from django.conf import settings new_lang = self.request.GET.get('lang') response = HttpResponseRedirect(self.request.META.get('HTTP_REFERER')) translation...
[ "def", "get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "django", ".", "conf", "import", "settings", "new_lang", "=", "self", ".", "request", ".", "GET", ".", "get", "(", "'lang'", ")", "response", "=", "HttpResponseRe...
This view is used for changing the language (i18n). :return:
[ "This", "view", "is", "used", "for", "changing", "the", "language", "(", "i18n", ")", ".", ":", "return", ":" ]
train
https://github.com/henzk/django-productline/blob/24ff156924c1a8c07b99cbb8a1de0a42b8d81f60/django_productline/features/multilanguage_switcher/views.py#L13-L32
seibert-media/Highton
highton/models/company.py
Company.people
def people(self): """ Retrieve all people of the company :return: list of people objects :rtype: list """ return fields.ListField(name=HightonConstants.PEOPLE, init_class=Person).decode( self.element_from_string( self._get_request( ...
python
def people(self): """ Retrieve all people of the company :return: list of people objects :rtype: list """ return fields.ListField(name=HightonConstants.PEOPLE, init_class=Person).decode( self.element_from_string( self._get_request( ...
[ "def", "people", "(", "self", ")", ":", "return", "fields", ".", "ListField", "(", "name", "=", "HightonConstants", ".", "PEOPLE", ",", "init_class", "=", "Person", ")", ".", "decode", "(", "self", ".", "element_from_string", "(", "self", ".", "_get_reques...
Retrieve all people of the company :return: list of people objects :rtype: list
[ "Retrieve", "all", "people", "of", "the", "company" ]
train
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/models/company.py#L79-L92
cthoyt/onto2nx
src/onto2nx/nx2onto.py
nx_to_ontology
def nx_to_ontology(graph, source_node, output_path, base_iri): """Graph nodes are ID's, and have a 'label' in the node data with the right label :param graph: :param source_node: :param str output_path: :param base_iri: """ ontology = owlready.Ontology(base_iri) parent_lookup = { ...
python
def nx_to_ontology(graph, source_node, output_path, base_iri): """Graph nodes are ID's, and have a 'label' in the node data with the right label :param graph: :param source_node: :param str output_path: :param base_iri: """ ontology = owlready.Ontology(base_iri) parent_lookup = { ...
[ "def", "nx_to_ontology", "(", "graph", ",", "source_node", ",", "output_path", ",", "base_iri", ")", ":", "ontology", "=", "owlready", ".", "Ontology", "(", "base_iri", ")", "parent_lookup", "=", "{", "source_node", ":", "types", ".", "new_class", "(", "sour...
Graph nodes are ID's, and have a 'label' in the node data with the right label :param graph: :param source_node: :param str output_path: :param base_iri:
[ "Graph", "nodes", "are", "ID", "s", "and", "have", "a", "label", "in", "the", "node", "data", "with", "the", "right", "label" ]
train
https://github.com/cthoyt/onto2nx/blob/94c86e5e187cca67534afe0260097177b66e02c8/src/onto2nx/nx2onto.py#L8-L31
shimpe/pyvectortween
vectortween/Utils.py
filter_none
def filter_none(list_of_points): """ :param list_of_points: :return: list_of_points with None's removed """ remove_elementnone = filter(lambda p: p is not None, list_of_points) remove_sublistnone = filter(lambda p: not contains_none(p), remove_elementnone) return list(remove_sublistnon...
python
def filter_none(list_of_points): """ :param list_of_points: :return: list_of_points with None's removed """ remove_elementnone = filter(lambda p: p is not None, list_of_points) remove_sublistnone = filter(lambda p: not contains_none(p), remove_elementnone) return list(remove_sublistnon...
[ "def", "filter_none", "(", "list_of_points", ")", ":", "remove_elementnone", "=", "filter", "(", "lambda", "p", ":", "p", "is", "not", "None", ",", "list_of_points", ")", "remove_sublistnone", "=", "filter", "(", "lambda", "p", ":", "not", "contains_none", "...
:param list_of_points: :return: list_of_points with None's removed
[ ":", "param", "list_of_points", ":", ":", "return", ":", "list_of_points", "with", "None", "s", "removed" ]
train
https://github.com/shimpe/pyvectortween/blob/aff071180474739060ec2d3102c39c8e73510988/vectortween/Utils.py#L20-L28
fp12/achallonge
challonge/participant.py
Participant.check_in
async def check_in(self): """ Checks this participant in |methcoro| Warning: |unstable| Raises: APIException """ res = await self.connection('POST', 'tournaments/{}/participants/{}/check_in'.format(self._tournament_id, self._id)) self._...
python
async def check_in(self): """ Checks this participant in |methcoro| Warning: |unstable| Raises: APIException """ res = await self.connection('POST', 'tournaments/{}/participants/{}/check_in'.format(self._tournament_id, self._id)) self._...
[ "async", "def", "check_in", "(", "self", ")", ":", "res", "=", "await", "self", ".", "connection", "(", "'POST'", ",", "'tournaments/{}/participants/{}/check_in'", ".", "format", "(", "self", ".", "_tournament_id", ",", "self", ".", "_id", ")", ")", "self", ...
Checks this participant in |methcoro| Warning: |unstable| Raises: APIException
[ "Checks", "this", "participant", "in" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/participant.py#L120-L133
fp12/achallonge
challonge/participant.py
Participant.undo_check_in
async def undo_check_in(self): """ Undo the check in for this participant |methcoro| Warning: |unstable| Raises: APIException """ res = await self.connection('POST', 'tournaments/{}/participants/{}/undo_check_in'.format(self._tournament_id, sel...
python
async def undo_check_in(self): """ Undo the check in for this participant |methcoro| Warning: |unstable| Raises: APIException """ res = await self.connection('POST', 'tournaments/{}/participants/{}/undo_check_in'.format(self._tournament_id, sel...
[ "async", "def", "undo_check_in", "(", "self", ")", ":", "res", "=", "await", "self", ".", "connection", "(", "'POST'", ",", "'tournaments/{}/participants/{}/undo_check_in'", ".", "format", "(", "self", ".", "_tournament_id", ",", "self", ".", "_id", ")", ")", ...
Undo the check in for this participant |methcoro| Warning: |unstable| Raises: APIException
[ "Undo", "the", "check", "in", "for", "this", "participant" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/participant.py#L135-L148
fp12/achallonge
challonge/participant.py
Participant.get_matches
async def get_matches(self, state: MatchState = MatchState.all_): """ Return the matches of the given state |methcoro| Args: state: see :class:`MatchState` Raises: APIException """ matches = await self.connection('GET', ...
python
async def get_matches(self, state: MatchState = MatchState.all_): """ Return the matches of the given state |methcoro| Args: state: see :class:`MatchState` Raises: APIException """ matches = await self.connection('GET', ...
[ "async", "def", "get_matches", "(", "self", ",", "state", ":", "MatchState", "=", "MatchState", ".", "all_", ")", ":", "matches", "=", "await", "self", ".", "connection", "(", "'GET'", ",", "'tournaments/{}/matches'", ".", "format", "(", "self", ".", "_tou...
Return the matches of the given state |methcoro| Args: state: see :class:`MatchState` Raises: APIException
[ "Return", "the", "matches", "of", "the", "given", "state" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/participant.py#L150-L170
fp12/achallonge
challonge/participant.py
Participant.get_next_match
async def get_next_match(self): """ Return the first open match found, or if none, the first pending match found |methcoro| Raises: APIException """ if self._final_rank is not None: return None matches = await self.get_matches(MatchState.open_)...
python
async def get_next_match(self): """ Return the first open match found, or if none, the first pending match found |methcoro| Raises: APIException """ if self._final_rank is not None: return None matches = await self.get_matches(MatchState.open_)...
[ "async", "def", "get_next_match", "(", "self", ")", ":", "if", "self", ".", "_final_rank", "is", "not", "None", ":", "return", "None", "matches", "=", "await", "self", ".", "get_matches", "(", "MatchState", ".", "open_", ")", "if", "len", "(", "matches",...
Return the first open match found, or if none, the first pending match found |methcoro| Raises: APIException
[ "Return", "the", "first", "open", "match", "found", "or", "if", "none", "the", "first", "pending", "match", "found" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/participant.py#L172-L192
fp12/achallonge
challonge/participant.py
Participant.get_next_opponent
async def get_next_opponent(self): """ Get the opponent of the potential next match. See :func:`get_next_match` |methcoro| Raises: APIException """ next_match = await self.get_next_match() if next_match is not None: opponent_id = next_match.play...
python
async def get_next_opponent(self): """ Get the opponent of the potential next match. See :func:`get_next_match` |methcoro| Raises: APIException """ next_match = await self.get_next_match() if next_match is not None: opponent_id = next_match.play...
[ "async", "def", "get_next_opponent", "(", "self", ")", ":", "next_match", "=", "await", "self", ".", "get_next_match", "(", ")", "if", "next_match", "is", "not", "None", ":", "opponent_id", "=", "next_match", ".", "player1_id", "if", "next_match", ".", "play...
Get the opponent of the potential next match. See :func:`get_next_match` |methcoro| Raises: APIException
[ "Get", "the", "opponent", "of", "the", "potential", "next", "match", ".", "See", ":", "func", ":", "get_next_match" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/participant.py#L194-L207
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper._get_pseudo_key
def _get_pseudo_key(self, row): """ Returns the pseudo key in a row. :param dict row: The row. :rtype: tuple """ ret = list() for key in self._pseudo_key: ret.append(row[key]) return tuple(ret)
python
def _get_pseudo_key(self, row): """ Returns the pseudo key in a row. :param dict row: The row. :rtype: tuple """ ret = list() for key in self._pseudo_key: ret.append(row[key]) return tuple(ret)
[ "def", "_get_pseudo_key", "(", "self", ",", "row", ")", ":", "ret", "=", "list", "(", ")", "for", "key", "in", "self", ".", "_pseudo_key", ":", "ret", ".", "append", "(", "row", "[", "key", "]", ")", "return", "tuple", "(", "ret", ")" ]
Returns the pseudo key in a row. :param dict row: The row. :rtype: tuple
[ "Returns", "the", "pseudo", "key", "in", "a", "row", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L73-L85
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper._date2int
def _date2int(date): """ Returns an integer representation of a date. :param str|datetime.date date: The date. :rtype: int """ if isinstance(date, str): if date.endswith(' 00:00:00') or date.endswith('T00:00:00'): # Ignore time suffix. ...
python
def _date2int(date): """ Returns an integer representation of a date. :param str|datetime.date date: The date. :rtype: int """ if isinstance(date, str): if date.endswith(' 00:00:00') or date.endswith('T00:00:00'): # Ignore time suffix. ...
[ "def", "_date2int", "(", "date", ")", ":", "if", "isinstance", "(", "date", ",", "str", ")", ":", "if", "date", ".", "endswith", "(", "' 00:00:00'", ")", "or", "date", ".", "endswith", "(", "'T00:00:00'", ")", ":", "# Ignore time suffix.", "date", "=", ...
Returns an integer representation of a date. :param str|datetime.date date: The date. :rtype: int
[ "Returns", "an", "integer", "representation", "of", "a", "date", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L89-L110
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper._rows_date2int
def _rows_date2int(self, rows): """ Replaces start and end dates in a row set with their integer representation :param list[dict[str,T]] rows: The list of rows. """ for row in rows: # Determine the type of dates based on the first start date. if not self....
python
def _rows_date2int(self, rows): """ Replaces start and end dates in a row set with their integer representation :param list[dict[str,T]] rows: The list of rows. """ for row in rows: # Determine the type of dates based on the first start date. if not self....
[ "def", "_rows_date2int", "(", "self", ",", "rows", ")", ":", "for", "row", "in", "rows", ":", "# Determine the type of dates based on the first start date.", "if", "not", "self", ".", "_date_type", ":", "self", ".", "_date_type", "=", "self", ".", "_get_date_type"...
Replaces start and end dates in a row set with their integer representation :param list[dict[str,T]] rows: The list of rows.
[ "Replaces", "start", "and", "end", "dates", "in", "a", "row", "set", "with", "their", "integer", "representation" ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L113-L126
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper._rows_int2date
def _rows_int2date(self, rows): """ Replaces start and end dates in the row set with their integer representation :param list[dict[str,T]] rows: The list of rows. """ for row in rows: if self._date_type == 'str': row[self._key_start_date] = datetime.d...
python
def _rows_int2date(self, rows): """ Replaces start and end dates in the row set with their integer representation :param list[dict[str,T]] rows: The list of rows. """ for row in rows: if self._date_type == 'str': row[self._key_start_date] = datetime.d...
[ "def", "_rows_int2date", "(", "self", ",", "rows", ")", ":", "for", "row", "in", "rows", ":", "if", "self", ".", "_date_type", "==", "'str'", ":", "row", "[", "self", ".", "_key_start_date", "]", "=", "datetime", ".", "date", ".", "fromordinal", "(", ...
Replaces start and end dates in the row set with their integer representation :param list[dict[str,T]] rows: The list of rows.
[ "Replaces", "start", "and", "end", "dates", "in", "the", "row", "set", "with", "their", "integer", "representation" ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L129-L146
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper._rows_sort
def _rows_sort(self, rows): """ Returns a list of rows sorted by start and end date. :param list[dict[str,T]] rows: The list of rows. :rtype: list[dict[str,T]] """ return sorted(rows, key=lambda row: (row[self._key_start_date], row[self._key_end_date]))
python
def _rows_sort(self, rows): """ Returns a list of rows sorted by start and end date. :param list[dict[str,T]] rows: The list of rows. :rtype: list[dict[str,T]] """ return sorted(rows, key=lambda row: (row[self._key_start_date], row[self._key_end_date]))
[ "def", "_rows_sort", "(", "self", ",", "rows", ")", ":", "return", "sorted", "(", "rows", ",", "key", "=", "lambda", "row", ":", "(", "row", "[", "self", ".", "_key_start_date", "]", ",", "row", "[", "self", ".", "_key_end_date", "]", ")", ")" ]
Returns a list of rows sorted by start and end date. :param list[dict[str,T]] rows: The list of rows. :rtype: list[dict[str,T]]
[ "Returns", "a", "list", "of", "rows", "sorted", "by", "start", "and", "end", "date", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L149-L157
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper._get_date_type
def _get_date_type(date): """ Returns the type of a date. :param str|datetime.date date: The date. :rtype: str """ if isinstance(date, str): return 'str' if isinstance(date, datetime.date): return 'date' if isinstance(date, int)...
python
def _get_date_type(date): """ Returns the type of a date. :param str|datetime.date date: The date. :rtype: str """ if isinstance(date, str): return 'str' if isinstance(date, datetime.date): return 'date' if isinstance(date, int)...
[ "def", "_get_date_type", "(", "date", ")", ":", "if", "isinstance", "(", "date", ",", "str", ")", ":", "return", "'str'", "if", "isinstance", "(", "date", ",", "datetime", ".", "date", ")", ":", "return", "'date'", "if", "isinstance", "(", "date", ",",...
Returns the type of a date. :param str|datetime.date date: The date. :rtype: str
[ "Returns", "the", "type", "of", "a", "date", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L161-L178
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper._equal
def _equal(self, row1, row2): """ Returns True if two rows are identical excluding start and end date. Returns False otherwise. :param dict[str,T] row1: The first row. :param dict[str,T] row2: The second row. :rtype: bool """ for key in row1.keys(): ...
python
def _equal(self, row1, row2): """ Returns True if two rows are identical excluding start and end date. Returns False otherwise. :param dict[str,T] row1: The first row. :param dict[str,T] row2: The second row. :rtype: bool """ for key in row1.keys(): ...
[ "def", "_equal", "(", "self", ",", "row1", ",", "row2", ")", ":", "for", "key", "in", "row1", ".", "keys", "(", ")", ":", "if", "key", "not", "in", "[", "self", ".", "_key_start_date", ",", "self", ".", "_key_end_date", "]", ":", "if", "row1", "[...
Returns True if two rows are identical excluding start and end date. Returns False otherwise. :param dict[str,T] row1: The first row. :param dict[str,T] row2: The second row. :rtype: bool
[ "Returns", "True", "if", "two", "rows", "are", "identical", "excluding", "start", "and", "end", "date", ".", "Returns", "False", "otherwise", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L181-L195
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper._merge_adjacent_rows
def _merge_adjacent_rows(self, rows): """ Resolves adjacent and overlapping rows. Overlapping rows are resolved as follows: * The interval with the most recent begin date prevails for the overlapping period. * If the begin dates are the same the interval with the most recent end date pre...
python
def _merge_adjacent_rows(self, rows): """ Resolves adjacent and overlapping rows. Overlapping rows are resolved as follows: * The interval with the most recent begin date prevails for the overlapping period. * If the begin dates are the same the interval with the most recent end date pre...
[ "def", "_merge_adjacent_rows", "(", "self", ",", "rows", ")", ":", "ret", "=", "list", "(", ")", "prev_row", "=", "None", "for", "row", "in", "rows", ":", "if", "prev_row", ":", "relation", "=", "Allen", ".", "relation", "(", "prev_row", "[", "self", ...
Resolves adjacent and overlapping rows. Overlapping rows are resolved as follows: * The interval with the most recent begin date prevails for the overlapping period. * If the begin dates are the same the interval with the most recent end date prevails. * If the begin and end dates are equal the ...
[ "Resolves", "adjacent", "and", "overlapping", "rows", ".", "Overlapping", "rows", "are", "resolved", "as", "follows", ":", "*", "The", "interval", "with", "the", "most", "recent", "begin", "date", "prevails", "for", "the", "overlapping", "period", ".", "*", ...
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L198-L306
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper.enumerate
def enumerate(self, name, start=1): """ Enumerates all rows such that the pseudo key and the ordinal number are a unique key. :param str name: The key holding the ordinal number. :param int start: The start of the ordinal numbers. Foreach pseudo key the first row has this ordinal number...
python
def enumerate(self, name, start=1): """ Enumerates all rows such that the pseudo key and the ordinal number are a unique key. :param str name: The key holding the ordinal number. :param int start: The start of the ordinal numbers. Foreach pseudo key the first row has this ordinal number...
[ "def", "enumerate", "(", "self", ",", "name", ",", "start", "=", "1", ")", ":", "for", "pseudo_key", ",", "rows", "in", "self", ".", "_rows", ".", "items", "(", ")", ":", "rows", "=", "self", ".", "_rows_sort", "(", "rows", ")", "ordinal", "=", "...
Enumerates all rows such that the pseudo key and the ordinal number are a unique key. :param str name: The key holding the ordinal number. :param int start: The start of the ordinal numbers. Foreach pseudo key the first row has this ordinal number.
[ "Enumerates", "all", "rows", "such", "that", "the", "pseudo", "key", "and", "the", "ordinal", "number", "are", "a", "unique", "key", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L309-L322
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper.get_rows
def get_rows(self, sort=False): """ Returns the rows of this Type2Helper. :param bool sort: If True the rows are sorted by the pseudo key. """ ret = [] for _, rows in sorted(self._rows.items()) if sort else self._rows.items(): self._rows_int2date(rows) ...
python
def get_rows(self, sort=False): """ Returns the rows of this Type2Helper. :param bool sort: If True the rows are sorted by the pseudo key. """ ret = [] for _, rows in sorted(self._rows.items()) if sort else self._rows.items(): self._rows_int2date(rows) ...
[ "def", "get_rows", "(", "self", ",", "sort", "=", "False", ")", ":", "ret", "=", "[", "]", "for", "_", ",", "rows", "in", "sorted", "(", "self", ".", "_rows", ".", "items", "(", ")", ")", "if", "sort", "else", "self", ".", "_rows", ".", "items"...
Returns the rows of this Type2Helper. :param bool sort: If True the rows are sorted by the pseudo key.
[ "Returns", "the", "rows", "of", "this", "Type2Helper", "." ]
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L325-L336
SetBased/py-etlt
etlt/helper/Type2Helper.py
Type2Helper.prepare_data
def prepare_data(self, rows): """ Sets and prepares the rows. The rows are stored in groups in a dictionary. A group is a list of rows with the same pseudo key. The key in the dictionary is a tuple with the values of the pseudo key. :param list[dict] rows: The rows """ s...
python
def prepare_data(self, rows): """ Sets and prepares the rows. The rows are stored in groups in a dictionary. A group is a list of rows with the same pseudo key. The key in the dictionary is a tuple with the values of the pseudo key. :param list[dict] rows: The rows """ s...
[ "def", "prepare_data", "(", "self", ",", "rows", ")", ":", "self", ".", "_rows", "=", "dict", "(", ")", "for", "row", "in", "copy", ".", "copy", "(", "rows", ")", "if", "self", ".", "copy", "else", "rows", ":", "pseudo_key", "=", "self", ".", "_g...
Sets and prepares the rows. The rows are stored in groups in a dictionary. A group is a list of rows with the same pseudo key. The key in the dictionary is a tuple with the values of the pseudo key. :param list[dict] rows: The rows
[ "Sets", "and", "prepares", "the", "rows", ".", "The", "rows", "are", "stored", "in", "groups", "in", "a", "dictionary", ".", "A", "group", "is", "a", "list", "of", "rows", "with", "the", "same", "pseudo", "key", ".", "The", "key", "in", "the", "dicti...
train
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2Helper.py#L339-L356
Lucretiel/autocommand
src/autocommand/autoparse.py
_get_type_description
def _get_type_description(annotation): ''' Given an annotation, return the (type, description) for the parameter. If you provide an annotation that is somehow both a string and a callable, the behavior is undefined. ''' if annotation is _empty: return None, None elif callable(annotat...
python
def _get_type_description(annotation): ''' Given an annotation, return the (type, description) for the parameter. If you provide an annotation that is somehow both a string and a callable, the behavior is undefined. ''' if annotation is _empty: return None, None elif callable(annotat...
[ "def", "_get_type_description", "(", "annotation", ")", ":", "if", "annotation", "is", "_empty", ":", "return", "None", ",", "None", "elif", "callable", "(", "annotation", ")", ":", "return", "annotation", ",", "None", "elif", "isinstance", "(", "annotation", ...
Given an annotation, return the (type, description) for the parameter. If you provide an annotation that is somehow both a string and a callable, the behavior is undefined.
[ "Given", "an", "annotation", "return", "the", "(", "type", "description", ")", "for", "the", "parameter", ".", "If", "you", "provide", "an", "annotation", "that", "is", "somehow", "both", "a", "string", "and", "a", "callable", "the", "behavior", "is", "und...
train
https://github.com/Lucretiel/autocommand/blob/bd3c58a210fdfcc943c729cc5579033add68d0b3/src/autocommand/autoparse.py#L57-L80
Lucretiel/autocommand
src/autocommand/autoparse.py
_add_arguments
def _add_arguments(param, parser, used_char_args, add_nos): ''' Add the argument(s) to an ArgumentParser (using add_argument) for a given parameter. used_char_args is the set of -short options currently already in use, and is updated (if necessary) by this function. If add_nos is True, this will als...
python
def _add_arguments(param, parser, used_char_args, add_nos): ''' Add the argument(s) to an ArgumentParser (using add_argument) for a given parameter. used_char_args is the set of -short options currently already in use, and is updated (if necessary) by this function. If add_nos is True, this will als...
[ "def", "_add_arguments", "(", "param", ",", "parser", ",", "used_char_args", ",", "add_nos", ")", ":", "# Impl note: This function is kept separate from make_parser because it's", "# already very long and I wanted to separate out as much as possible into", "# its own call scope, to preve...
Add the argument(s) to an ArgumentParser (using add_argument) for a given parameter. used_char_args is the set of -short options currently already in use, and is updated (if necessary) by this function. If add_nos is True, this will also add an inverse switch for all boolean options. For instance, for t...
[ "Add", "the", "argument", "(", "s", ")", "to", "an", "ArgumentParser", "(", "using", "add_argument", ")", "for", "a", "given", "parameter", ".", "used_char_args", "is", "the", "set", "of", "-", "short", "options", "currently", "already", "in", "use", "and"...
train
https://github.com/Lucretiel/autocommand/blob/bd3c58a210fdfcc943c729cc5579033add68d0b3/src/autocommand/autoparse.py#L83-L188
Lucretiel/autocommand
src/autocommand/autoparse.py
make_parser
def make_parser(func_sig, description, epilog, add_nos): ''' Given the signature of a function, create an ArgumentParser ''' parser = ArgumentParser(description=description, epilog=epilog) used_char_args = {'h'} # Arange the params so that single-character arguments are first. This # esnur...
python
def make_parser(func_sig, description, epilog, add_nos): ''' Given the signature of a function, create an ArgumentParser ''' parser = ArgumentParser(description=description, epilog=epilog) used_char_args = {'h'} # Arange the params so that single-character arguments are first. This # esnur...
[ "def", "make_parser", "(", "func_sig", ",", "description", ",", "epilog", ",", "add_nos", ")", ":", "parser", "=", "ArgumentParser", "(", "description", "=", "description", ",", "epilog", "=", "epilog", ")", "used_char_args", "=", "{", "'h'", "}", "# Arange ...
Given the signature of a function, create an ArgumentParser
[ "Given", "the", "signature", "of", "a", "function", "create", "an", "ArgumentParser" ]
train
https://github.com/Lucretiel/autocommand/blob/bd3c58a210fdfcc943c729cc5579033add68d0b3/src/autocommand/autoparse.py#L191-L209
Lucretiel/autocommand
src/autocommand/autoparse.py
parse_docstring
def parse_docstring(docstring): ''' Given a docstring, parse it into a description and epilog part ''' if docstring is None: return '', '' parts = _DOCSTRING_SPLIT.split(docstring) if len(parts) == 1: return docstring, '' elif len(parts) == 2: return parts[0], parts...
python
def parse_docstring(docstring): ''' Given a docstring, parse it into a description and epilog part ''' if docstring is None: return '', '' parts = _DOCSTRING_SPLIT.split(docstring) if len(parts) == 1: return docstring, '' elif len(parts) == 2: return parts[0], parts...
[ "def", "parse_docstring", "(", "docstring", ")", ":", "if", "docstring", "is", "None", ":", "return", "''", ",", "''", "parts", "=", "_DOCSTRING_SPLIT", ".", "split", "(", "docstring", ")", "if", "len", "(", "parts", ")", "==", "1", ":", "return", "doc...
Given a docstring, parse it into a description and epilog part
[ "Given", "a", "docstring", "parse", "it", "into", "a", "description", "and", "epilog", "part" ]
train
https://github.com/Lucretiel/autocommand/blob/bd3c58a210fdfcc943c729cc5579033add68d0b3/src/autocommand/autoparse.py#L215-L229
Lucretiel/autocommand
src/autocommand/autoparse.py
autoparse
def autoparse( func=None, *, description=None, epilog=None, add_nos=False, parser=None): ''' This decorator converts a function that takes normal arguments into a function which takes a single optional argument, argv, parses it using an argparse.ArgumentParser, an...
python
def autoparse( func=None, *, description=None, epilog=None, add_nos=False, parser=None): ''' This decorator converts a function that takes normal arguments into a function which takes a single optional argument, argv, parses it using an argparse.ArgumentParser, an...
[ "def", "autoparse", "(", "func", "=", "None", ",", "*", ",", "description", "=", "None", ",", "epilog", "=", "None", ",", "add_nos", "=", "False", ",", "parser", "=", "None", ")", ":", "# If @autoparse(...) is used instead of @autoparse", "if", "func", "is",...
This decorator converts a function that takes normal arguments into a function which takes a single optional argument, argv, parses it using an argparse.ArgumentParser, and calls the underlying function with the parsed arguments. If it is not given, sys.argv[1:] is used. This is so that the function can...
[ "This", "decorator", "converts", "a", "function", "that", "takes", "normal", "arguments", "into", "a", "function", "which", "takes", "a", "single", "optional", "argument", "argv", "parses", "it", "using", "an", "argparse", ".", "ArgumentParser", "and", "calls", ...
train
https://github.com/Lucretiel/autocommand/blob/bd3c58a210fdfcc943c729cc5579033add68d0b3/src/autocommand/autoparse.py#L232-L308
Lucretiel/autocommand
src/autocommand/autoparse.py
smart_open
def smart_open(filename_or_file, *args, **kwargs): ''' This context manager allows you to open a filename, if you want to default some already-existing file object, like sys.stdout, which shouldn't be closed at the end of the context. If the filename argument is a str, bytes, or int, the file object...
python
def smart_open(filename_or_file, *args, **kwargs): ''' This context manager allows you to open a filename, if you want to default some already-existing file object, like sys.stdout, which shouldn't be closed at the end of the context. If the filename argument is a str, bytes, or int, the file object...
[ "def", "smart_open", "(", "filename_or_file", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "filename_or_file", ",", "(", "str", ",", "bytes", ",", "int", ")", ")", ":", "with", "open", "(", "filename_or_file", ",", "*",...
This context manager allows you to open a filename, if you want to default some already-existing file object, like sys.stdout, which shouldn't be closed at the end of the context. If the filename argument is a str, bytes, or int, the file object is created via a call to open with the given *args and **k...
[ "This", "context", "manager", "allows", "you", "to", "open", "a", "filename", "if", "you", "want", "to", "default", "some", "already", "-", "existing", "file", "object", "like", "sys", ".", "stdout", "which", "shouldn", "t", "be", "closed", "at", "the", ...
train
https://github.com/Lucretiel/autocommand/blob/bd3c58a210fdfcc943c729cc5579033add68d0b3/src/autocommand/autoparse.py#L312-L333
seibert-media/Highton
highton/call_mixins/list_comment_call_mixin.py
ListCommentCallMixin.list_comments
def list_comments(self, page=0): """ Get the comments of current object :param page: the page starting at 0 :return: the emails :rtype: list """ from highton.models.comment import Comment params = {'page': int(page) * self.COMMENT_OFFSET} return ...
python
def list_comments(self, page=0): """ Get the comments of current object :param page: the page starting at 0 :return: the emails :rtype: list """ from highton.models.comment import Comment params = {'page': int(page) * self.COMMENT_OFFSET} return ...
[ "def", "list_comments", "(", "self", ",", "page", "=", "0", ")", ":", "from", "highton", ".", "models", ".", "comment", "import", "Comment", "params", "=", "{", "'page'", ":", "int", "(", "page", ")", "*", "self", ".", "COMMENT_OFFSET", "}", "return", ...
Get the comments of current object :param page: the page starting at 0 :return: the emails :rtype: list
[ "Get", "the", "comments", "of", "current", "object" ]
train
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/call_mixins/list_comment_call_mixin.py#L14-L35
seibert-media/Highton
highton/models/deal.py
Deal.update_status
def update_status(self, status): """ Updates the status of the deal :param status: status have to be ('won', 'pending', 'lost') :return: successfull response or raise Exception :rtype: """ assert (status in (HightonConstants.WON, HightonConstants.PENDING, Highton...
python
def update_status(self, status): """ Updates the status of the deal :param status: status have to be ('won', 'pending', 'lost') :return: successfull response or raise Exception :rtype: """ assert (status in (HightonConstants.WON, HightonConstants.PENDING, Highton...
[ "def", "update_status", "(", "self", ",", "status", ")", ":", "assert", "(", "status", "in", "(", "HightonConstants", ".", "WON", ",", "HightonConstants", ".", "PENDING", ",", "HightonConstants", ".", "LOST", ")", ")", "from", "highton", ".", "models", "im...
Updates the status of the deal :param status: status have to be ('won', 'pending', 'lost') :return: successfull response or raise Exception :rtype:
[ "Updates", "the", "status", "of", "the", "deal" ]
train
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/models/deal.py#L143-L158
rfinnie/dsari
dsari/utils.py
dict_merge
def dict_merge(s, m): """Recursively merge one dict into another.""" if not isinstance(m, dict): return m out = copy.deepcopy(s) for k, v in m.items(): if k in out and isinstance(out[k], dict): out[k] = dict_merge(out[k], v) else: out[k] = copy.deepcopy(v)...
python
def dict_merge(s, m): """Recursively merge one dict into another.""" if not isinstance(m, dict): return m out = copy.deepcopy(s) for k, v in m.items(): if k in out and isinstance(out[k], dict): out[k] = dict_merge(out[k], v) else: out[k] = copy.deepcopy(v)...
[ "def", "dict_merge", "(", "s", ",", "m", ")", ":", "if", "not", "isinstance", "(", "m", ",", "dict", ")", ":", "return", "m", "out", "=", "copy", ".", "deepcopy", "(", "s", ")", "for", "k", ",", "v", "in", "m", ".", "items", "(", ")", ":", ...
Recursively merge one dict into another.
[ "Recursively", "merge", "one", "dict", "into", "another", "." ]
train
https://github.com/rfinnie/dsari/blob/cd7b07c30876467393e0ec18f1ff45d86bcb1676/dsari/utils.py#L40-L50
pytorn/torn
torn/plugins/app.py
settings
def settings(instance): """Definition to set settings from config file to the app instance.""" with open(instance.root_dir + '/Config/config.yml') as config: config = yaml.load(config) instance.name = config['name'] instance.port = config['web']['port'] # default host ins...
python
def settings(instance): """Definition to set settings from config file to the app instance.""" with open(instance.root_dir + '/Config/config.yml') as config: config = yaml.load(config) instance.name = config['name'] instance.port = config['web']['port'] # default host ins...
[ "def", "settings", "(", "instance", ")", ":", "with", "open", "(", "instance", ".", "root_dir", "+", "'/Config/config.yml'", ")", "as", "config", ":", "config", "=", "yaml", ".", "load", "(", "config", ")", "instance", ".", "name", "=", "config", "[", ...
Definition to set settings from config file to the app instance.
[ "Definition", "to", "set", "settings", "from", "config", "file", "to", "the", "app", "instance", "." ]
train
https://github.com/pytorn/torn/blob/68ba077173a1d22236d570d933dd99a3e3f0040f/torn/plugins/app.py#L11-L22
pytorn/torn
torn/plugins/app.py
routing
def routing(routes, request): """Definition for route matching : helper""" # strip trailing slashes from request path path = request.path.strip('/') # iterate through routes to match args = {} for name, route in routes.items(): if route['path'] == '^': # this section exists...
python
def routing(routes, request): """Definition for route matching : helper""" # strip trailing slashes from request path path = request.path.strip('/') # iterate through routes to match args = {} for name, route in routes.items(): if route['path'] == '^': # this section exists...
[ "def", "routing", "(", "routes", ",", "request", ")", ":", "# strip trailing slashes from request path", "path", "=", "request", ".", "path", ".", "strip", "(", "'/'", ")", "# iterate through routes to match", "args", "=", "{", "}", "for", "name", ",", "route", ...
Definition for route matching : helper
[ "Definition", "for", "route", "matching", ":", "helper" ]
train
https://github.com/pytorn/torn/blob/68ba077173a1d22236d570d933dd99a3e3f0040f/torn/plugins/app.py#L24-L64
pytorn/torn
torn/plugins/app.py
uri_creator
def uri_creator(uri, regex, defaults): """Creates url and replaces regex and gives variables""" # strip trailing slash uri = uri.strip('/') # take out variables in uri matches = re.findall('{[a-zA-Z0-9\_]+}', uri) default_regex = '[a-zA-Z0-9]+' variables = [] # iter through match...
python
def uri_creator(uri, regex, defaults): """Creates url and replaces regex and gives variables""" # strip trailing slash uri = uri.strip('/') # take out variables in uri matches = re.findall('{[a-zA-Z0-9\_]+}', uri) default_regex = '[a-zA-Z0-9]+' variables = [] # iter through match...
[ "def", "uri_creator", "(", "uri", ",", "regex", ",", "defaults", ")", ":", "# strip trailing slash", "uri", "=", "uri", ".", "strip", "(", "'/'", ")", "# take out variables in uri", "matches", "=", "re", ".", "findall", "(", "'{[a-zA-Z0-9\\_]+}'", ",", "uri", ...
Creates url and replaces regex and gives variables
[ "Creates", "url", "and", "replaces", "regex", "and", "gives", "variables" ]
train
https://github.com/pytorn/torn/blob/68ba077173a1d22236d570d933dd99a3e3f0040f/torn/plugins/app.py#L66-L101
seibert-media/Highton
highton/call_mixins/detail_call_mixin.py
DetailCallMixin.get
def get(cls, object_id): """ Retrieves a single model :param object_id: the primary id of the model :type object_id: integer :return: the object of the parsed xml object :rtype: object """ return fields.ObjectField(name=cls.ENDPOINT, init_class=cls).decod...
python
def get(cls, object_id): """ Retrieves a single model :param object_id: the primary id of the model :type object_id: integer :return: the object of the parsed xml object :rtype: object """ return fields.ObjectField(name=cls.ENDPOINT, init_class=cls).decod...
[ "def", "get", "(", "cls", ",", "object_id", ")", ":", "return", "fields", ".", "ObjectField", "(", "name", "=", "cls", ".", "ENDPOINT", ",", "init_class", "=", "cls", ")", ".", "decode", "(", "cls", ".", "element_from_string", "(", "cls", ".", "_get_re...
Retrieves a single model :param object_id: the primary id of the model :type object_id: integer :return: the object of the parsed xml object :rtype: object
[ "Retrieves", "a", "single", "model" ]
train
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/call_mixins/detail_call_mixin.py#L12-L25
inveniosoftware/invenio-cache
invenio_cache/decorators.py
cached_unless_authenticated
def cached_unless_authenticated(timeout=50, key_prefix='default'): """Cache anonymous traffic.""" def caching(f): @wraps(f) def wrapper(*args, **kwargs): cache_fun = current_cache.cached( timeout=timeout, key_prefix=key_prefix, unless=lambda: current_c...
python
def cached_unless_authenticated(timeout=50, key_prefix='default'): """Cache anonymous traffic.""" def caching(f): @wraps(f) def wrapper(*args, **kwargs): cache_fun = current_cache.cached( timeout=timeout, key_prefix=key_prefix, unless=lambda: current_c...
[ "def", "cached_unless_authenticated", "(", "timeout", "=", "50", ",", "key_prefix", "=", "'default'", ")", ":", "def", "caching", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", ...
Cache anonymous traffic.
[ "Cache", "anonymous", "traffic", "." ]
train
https://github.com/inveniosoftware/invenio-cache/blob/2f0e1c8f9b1cf2b2dfb338d82b77f6287a367a74/invenio_cache/decorators.py#L18-L28
fp12/achallonge
challonge/tournament.py
Tournament.reset
async def reset(self): """ reset the tournament on Challonge |methcoro| Note: |from_api| Reset a tournament, clearing all of its scores and attachments. You can then add/remove/edit participants before starting the tournament again. Raises: APIException ...
python
async def reset(self): """ reset the tournament on Challonge |methcoro| Note: |from_api| Reset a tournament, clearing all of its scores and attachments. You can then add/remove/edit participants before starting the tournament again. Raises: APIException ...
[ "async", "def", "reset", "(", "self", ")", ":", "params", "=", "{", "'include_participants'", ":", "1", "if", "AUTO_GET_PARTICIPANTS", "else", "0", ",", "'include_matches'", ":", "1", "if", "AUTO_GET_MATCHES", "else", "0", "}", "res", "=", "await", "self", ...
reset the tournament on Challonge |methcoro| Note: |from_api| Reset a tournament, clearing all of its scores and attachments. You can then add/remove/edit participants before starting the tournament again. Raises: APIException
[ "reset", "the", "tournament", "on", "Challonge" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L127-L144
fp12/achallonge
challonge/tournament.py
Tournament.update
async def update(self, **params): """ update some parameters of the tournament Use this function if you want to update multiple options at once, but prefer helpers functions like :func:`allow_attachments`, :func:`set_start_date`... |methcoro| Args: params: one or more of: ...
python
async def update(self, **params): """ update some parameters of the tournament Use this function if you want to update multiple options at once, but prefer helpers functions like :func:`allow_attachments`, :func:`set_start_date`... |methcoro| Args: params: one or more of: ...
[ "async", "def", "update", "(", "self", ",", "*", "*", "params", ")", ":", "assert_or_raise", "(", "all", "(", "k", "in", "self", ".", "_update_parameters", "for", "k", "in", "params", ".", "keys", "(", ")", ")", ",", "NameError", ",", "'Wrong parameter...
update some parameters of the tournament Use this function if you want to update multiple options at once, but prefer helpers functions like :func:`allow_attachments`, :func:`set_start_date`... |methcoro| Args: params: one or more of: ``name`` ``tournament_type`` ``url`` ``subdoma...
[ "update", "some", "parameters", "of", "the", "tournament" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L165-L193
fp12/achallonge
challonge/tournament.py
Tournament.set_start_date
async def set_start_date(self, date: str, time: str, check_in_duration: int = None): """ set the tournament start date (and check in duration) |methcoro| Args: date: fomatted date as YYYY/MM/DD (2017/02/14) time: fromatted time as HH:MM (20:15) check_in_dura...
python
async def set_start_date(self, date: str, time: str, check_in_duration: int = None): """ set the tournament start date (and check in duration) |methcoro| Args: date: fomatted date as YYYY/MM/DD (2017/02/14) time: fromatted time as HH:MM (20:15) check_in_dura...
[ "async", "def", "set_start_date", "(", "self", ",", "date", ":", "str", ",", "time", ":", "str", ",", "check_in_duration", ":", "int", "=", "None", ")", ":", "date_time", "=", "datetime", ".", "strptime", "(", "date", "+", "' '", "+", "time", ",", "'...
set the tournament start date (and check in duration) |methcoro| Args: date: fomatted date as YYYY/MM/DD (2017/02/14) time: fromatted time as HH:MM (20:15) check_in_duration (optional): duration in minutes Raises: APIException
[ "set", "the", "tournament", "start", "date", "(", "and", "check", "in", "duration", ")" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L282-L302
fp12/achallonge
challonge/tournament.py
Tournament.update_notifications
async def update_notifications(self, on_match_open: bool = None, on_tournament_end: bool = None): """ update participants notifications for this tournament |methcoro| Args: on_match_open: Email registered Challonge participants when matches open up for them on_tournamen...
python
async def update_notifications(self, on_match_open: bool = None, on_tournament_end: bool = None): """ update participants notifications for this tournament |methcoro| Args: on_match_open: Email registered Challonge participants when matches open up for them on_tournamen...
[ "async", "def", "update_notifications", "(", "self", ",", "on_match_open", ":", "bool", "=", "None", ",", "on_tournament_end", ":", "bool", "=", "None", ")", ":", "params", "=", "{", "}", "if", "on_match_open", "is", "not", "None", ":", "params", "[", "'...
update participants notifications for this tournament |methcoro| Args: on_match_open: Email registered Challonge participants when matches open up for them on_tournament_end: Email registered Challonge participants the results when this tournament ends Raises: ...
[ "update", "participants", "notifications", "for", "this", "tournament" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L409-L428
fp12/achallonge
challonge/tournament.py
Tournament.get_participant
async def get_participant(self, p_id: int, force_update=False) -> Participant: """ get a participant by its id |methcoro| Args: p_id: participant id force_update (dfault=False): True to force an update to the Challonge API Returns: Participant: None...
python
async def get_participant(self, p_id: int, force_update=False) -> Participant: """ get a participant by its id |methcoro| Args: p_id: participant id force_update (dfault=False): True to force an update to the Challonge API Returns: Participant: None...
[ "async", "def", "get_participant", "(", "self", ",", "p_id", ":", "int", ",", "force_update", "=", "False", ")", "->", "Participant", ":", "found_p", "=", "self", ".", "_find_participant", "(", "p_id", ")", "if", "force_update", "or", "found_p", "is", "Non...
get a participant by its id |methcoro| Args: p_id: participant id force_update (dfault=False): True to force an update to the Challonge API Returns: Participant: None if not found Raises: APIException
[ "get", "a", "participant", "by", "its", "id" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L511-L531
fp12/achallonge
challonge/tournament.py
Tournament.get_participants
async def get_participants(self, force_update=False) -> list: """ get all participants |methcoro| Args: force_update (default=False): True to force an update to the Challonge API Returns: list[Participant]: Raises: APIException """...
python
async def get_participants(self, force_update=False) -> list: """ get all participants |methcoro| Args: force_update (default=False): True to force an update to the Challonge API Returns: list[Participant]: Raises: APIException """...
[ "async", "def", "get_participants", "(", "self", ",", "force_update", "=", "False", ")", "->", "list", ":", "if", "force_update", "or", "self", ".", "participants", "is", "None", ":", "res", "=", "await", "self", ".", "connection", "(", "'GET'", ",", "'t...
get all participants |methcoro| Args: force_update (default=False): True to force an update to the Challonge API Returns: list[Participant]: Raises: APIException
[ "get", "all", "participants" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L533-L551
fp12/achallonge
challonge/tournament.py
Tournament.search_participant
async def search_participant(self, name, force_update=False): """ search a participant by (display) name |methcoro| Args: name: display name of the participant force_update (dfault=False): True to force an update to the Challonge API Returns: Partic...
python
async def search_participant(self, name, force_update=False): """ search a participant by (display) name |methcoro| Args: name: display name of the participant force_update (dfault=False): True to force an update to the Challonge API Returns: Partic...
[ "async", "def", "search_participant", "(", "self", ",", "name", ",", "force_update", "=", "False", ")", ":", "if", "force_update", "or", "self", ".", "participants", "is", "None", ":", "await", "self", ".", "get_participants", "(", ")", "if", "self", ".", ...
search a participant by (display) name |methcoro| Args: name: display name of the participant force_update (dfault=False): True to force an update to the Challonge API Returns: Participant: None if not found Raises: APIException
[ "search", "a", "participant", "by", "(", "display", ")", "name" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L553-L575
fp12/achallonge
challonge/tournament.py
Tournament.add_participant
async def add_participant(self, display_name: str = None, username: str = None, email: str = None, seed: int = 0, misc: str = None, **params): """ add a participant to the tournament |methcoro| Args: display_name: The name displayed in the bracket/schedule - not required if email o...
python
async def add_participant(self, display_name: str = None, username: str = None, email: str = None, seed: int = 0, misc: str = None, **params): """ add a participant to the tournament |methcoro| Args: display_name: The name displayed in the bracket/schedule - not required if email o...
[ "async", "def", "add_participant", "(", "self", ",", "display_name", ":", "str", "=", "None", ",", "username", ":", "str", "=", "None", ",", "email", ":", "str", "=", "None", ",", "seed", ":", "int", "=", "0", ",", "misc", ":", "str", "=", "None", ...
add a participant to the tournament |methcoro| Args: display_name: The name displayed in the bracket/schedule - not required if email or challonge_username is provided. Must be unique per tournament. username: Provide this if the participant has a Challonge account. He or she w...
[ "add", "a", "participant", "to", "the", "tournament" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L577-L617
fp12/achallonge
challonge/tournament.py
Tournament.remove_participant
async def remove_participant(self, p: Participant): """ remove a participant from the tournament |methcoro| Args: p: the participant to remove Raises: APIException """ await self.connection('DELETE', 'tournaments/{}/participants/{}'.format(self...
python
async def remove_participant(self, p: Participant): """ remove a participant from the tournament |methcoro| Args: p: the participant to remove Raises: APIException """ await self.connection('DELETE', 'tournaments/{}/participants/{}'.format(self...
[ "async", "def", "remove_participant", "(", "self", ",", "p", ":", "Participant", ")", ":", "await", "self", ".", "connection", "(", "'DELETE'", ",", "'tournaments/{}/participants/{}'", ".", "format", "(", "self", ".", "_id", ",", "p", ".", "_id", ")", ")",...
remove a participant from the tournament |methcoro| Args: p: the participant to remove Raises: APIException
[ "remove", "a", "participant", "from", "the", "tournament" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L638-L652
fp12/achallonge
challonge/tournament.py
Tournament.get_match
async def get_match(self, m_id, force_update=False) -> Match: """ get a single match by id |methcoro| Args: m_id: match id force_update (default=False): True to force an update to the Challonge API Returns: Match Raises: APIExce...
python
async def get_match(self, m_id, force_update=False) -> Match: """ get a single match by id |methcoro| Args: m_id: match id force_update (default=False): True to force an update to the Challonge API Returns: Match Raises: APIExce...
[ "async", "def", "get_match", "(", "self", ",", "m_id", ",", "force_update", "=", "False", ")", "->", "Match", ":", "found_m", "=", "self", ".", "_find_match", "(", "m_id", ")", "if", "force_update", "or", "found_m", "is", "None", ":", "await", "self", ...
get a single match by id |methcoro| Args: m_id: match id force_update (default=False): True to force an update to the Challonge API Returns: Match Raises: APIException
[ "get", "a", "single", "match", "by", "id" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L654-L674
fp12/achallonge
challonge/tournament.py
Tournament.get_matches
async def get_matches(self, force_update=False) -> list: """ get all matches (once the tournament is started) |methcoro| Args: force_update (default=False): True to force an update to the Challonge API Returns: list[Match]: Raises: APIExcep...
python
async def get_matches(self, force_update=False) -> list: """ get all matches (once the tournament is started) |methcoro| Args: force_update (default=False): True to force an update to the Challonge API Returns: list[Match]: Raises: APIExcep...
[ "async", "def", "get_matches", "(", "self", ",", "force_update", "=", "False", ")", "->", "list", ":", "if", "force_update", "or", "self", ".", "matches", "is", "None", ":", "res", "=", "await", "self", ".", "connection", "(", "'GET'", ",", "'tournaments...
get all matches (once the tournament is started) |methcoro| Args: force_update (default=False): True to force an update to the Challonge API Returns: list[Match]: Raises: APIException
[ "get", "all", "matches", "(", "once", "the", "tournament", "is", "started", ")" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L676-L696
fp12/achallonge
challonge/tournament.py
Tournament.shuffle_participants
async def shuffle_participants(self): """ Shuffle participants' seeds |methcoro| Note: |from_api| Randomize seeds among participants. Only applicable before a tournament has started. Raises: APIException """ res = await self.connection('POST', ...
python
async def shuffle_participants(self): """ Shuffle participants' seeds |methcoro| Note: |from_api| Randomize seeds among participants. Only applicable before a tournament has started. Raises: APIException """ res = await self.connection('POST', ...
[ "async", "def", "shuffle_participants", "(", "self", ")", ":", "res", "=", "await", "self", ".", "connection", "(", "'POST'", ",", "'tournaments/{}/participants/randomize'", ".", "format", "(", "self", ".", "_id", ")", ")", "self", ".", "_refresh_participants_fr...
Shuffle participants' seeds |methcoro| Note: |from_api| Randomize seeds among participants. Only applicable before a tournament has started. Raises: APIException
[ "Shuffle", "participants", "seeds" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L698-L711
fp12/achallonge
challonge/tournament.py
Tournament.process_check_ins
async def process_check_ins(self): """ finalize the check in phase |methcoro| Warning: |unstable| Note: |from_api| This should be invoked after a tournament's check-in window closes before the tournament is started. 1. Marks participants who have no...
python
async def process_check_ins(self): """ finalize the check in phase |methcoro| Warning: |unstable| Note: |from_api| This should be invoked after a tournament's check-in window closes before the tournament is started. 1. Marks participants who have no...
[ "async", "def", "process_check_ins", "(", "self", ")", ":", "params", "=", "{", "'include_participants'", ":", "1", ",", "# forced to 1 since we need to update the Participant instances", "'include_matches'", ":", "1", "if", "AUTO_GET_MATCHES", "else", "0", "}", "res", ...
finalize the check in phase |methcoro| Warning: |unstable| Note: |from_api| This should be invoked after a tournament's check-in window closes before the tournament is started. 1. Marks participants who have not checked in as inactive. 2. Moves ...
[ "finalize", "the", "check", "in", "phase" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L713-L737
fp12/achallonge
challonge/tournament.py
Tournament.get_final_ranking
async def get_final_ranking(self) -> OrderedDict: """ Get the ordered players ranking Returns: collections.OrderedDict[rank, List[Participant]]: Raises: APIException """ if self._state != TournamentState.complete.value: return None ...
python
async def get_final_ranking(self) -> OrderedDict: """ Get the ordered players ranking Returns: collections.OrderedDict[rank, List[Participant]]: Raises: APIException """ if self._state != TournamentState.complete.value: return None ...
[ "async", "def", "get_final_ranking", "(", "self", ")", "->", "OrderedDict", ":", "if", "self", ".", "_state", "!=", "TournamentState", ".", "complete", ".", "value", ":", "return", "None", "ranking", "=", "{", "}", "for", "p", "in", "self", ".", "partici...
Get the ordered players ranking Returns: collections.OrderedDict[rank, List[Participant]]: Raises: APIException
[ "Get", "the", "ordered", "players", "ranking" ]
train
https://github.com/fp12/achallonge/blob/25780b3c48b66400a50ff9f884e4287afd4c89e4/challonge/tournament.py#L763-L783
ionelmc/python-cogen
cogen/core/proactors/stdlib_kqueue_impl.py
StdlibKQueueProactor.run
def run(self, timeout = 0): """ Run a proactor loop and return new socket events. Timeout is a timedelta object, 0 if active coros or None. kqueue timeout param is a integer number of nanoseconds (seconds/10**9). """ ptimeout = float( timeout.microsec...
python
def run(self, timeout = 0): """ Run a proactor loop and return new socket events. Timeout is a timedelta object, 0 if active coros or None. kqueue timeout param is a integer number of nanoseconds (seconds/10**9). """ ptimeout = float( timeout.microsec...
[ "def", "run", "(", "self", ",", "timeout", "=", "0", ")", ":", "ptimeout", "=", "float", "(", "timeout", ".", "microseconds", "/", "1000000", "+", "timeout", ".", "seconds", "if", "timeout", "else", "(", "self", ".", "resolution", "if", "timeout", "is"...
Run a proactor loop and return new socket events. Timeout is a timedelta object, 0 if active coros or None. kqueue timeout param is a integer number of nanoseconds (seconds/10**9).
[ "Run", "a", "proactor", "loop", "and", "return", "new", "socket", "events", ".", "Timeout", "is", "a", "timedelta", "object", "0", "if", "active", "coros", "or", "None", ".", "kqueue", "timeout", "param", "is", "a", "integer", "number", "of", "nanoseconds"...
train
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/cogen/core/proactors/stdlib_kqueue_impl.py#L48-L83
ionelmc/python-cogen
examples/static-serve.py
generate_xhtml
def generate_xhtml(path, dirs, files): """Return a XHTML document listing the directories and files.""" # Prepare the path to display. if path != '/': dirs.insert(0, '..') if not path.endswith('/'): path += '/' def itemize(item): return '<a href="%s">%s</a>' % (item...
python
def generate_xhtml(path, dirs, files): """Return a XHTML document listing the directories and files.""" # Prepare the path to display. if path != '/': dirs.insert(0, '..') if not path.endswith('/'): path += '/' def itemize(item): return '<a href="%s">%s</a>' % (item...
[ "def", "generate_xhtml", "(", "path", ",", "dirs", ",", "files", ")", ":", "# Prepare the path to display.\r", "if", "path", "!=", "'/'", ":", "dirs", ".", "insert", "(", "0", ",", "'..'", ")", "if", "not", "path", ".", "endswith", "(", "'/'", ")", ":"...
Return a XHTML document listing the directories and files.
[ "Return", "a", "XHTML", "document", "listing", "the", "directories", "and", "files", "." ]
train
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/examples/static-serve.py#L56-L74
ionelmc/python-cogen
examples/static-serve.py
get_entries
def get_entries(path): """Return sorted lists of directories and files in the given path.""" dirs, files = [], [] for entry in os.listdir(path): # Categorize entry as directory or file. if os.path.isdir(os.path.join(path, entry)): dirs.append(entry) else: ...
python
def get_entries(path): """Return sorted lists of directories and files in the given path.""" dirs, files = [], [] for entry in os.listdir(path): # Categorize entry as directory or file. if os.path.isdir(os.path.join(path, entry)): dirs.append(entry) else: ...
[ "def", "get_entries", "(", "path", ")", ":", "dirs", ",", "files", "=", "[", "]", ",", "[", "]", "for", "entry", "in", "os", ".", "listdir", "(", "path", ")", ":", "# Categorize entry as directory or file.\r", "if", "os", ".", "path", ".", "isdir", "("...
Return sorted lists of directories and files in the given path.
[ "Return", "sorted", "lists", "of", "directories", "and", "files", "in", "the", "given", "path", "." ]
train
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/examples/static-serve.py#L76-L87
ionelmc/python-cogen
examples/static-serve.py
Static._conditions
def _conditions(self, full_path, environ): """Return a tuple of etag, last_modified by mtime from stat.""" mtime = os.stat(full_path).st_mtime size = os.stat(full_path).st_size return str(mtime), rfc822.formatdate(mtime), size
python
def _conditions(self, full_path, environ): """Return a tuple of etag, last_modified by mtime from stat.""" mtime = os.stat(full_path).st_mtime size = os.stat(full_path).st_size return str(mtime), rfc822.formatdate(mtime), size
[ "def", "_conditions", "(", "self", ",", "full_path", ",", "environ", ")", ":", "mtime", "=", "os", ".", "stat", "(", "full_path", ")", ".", "st_mtime", "size", "=", "os", ".", "stat", "(", "full_path", ")", ".", "st_size", "return", "str", "(", "mtim...
Return a tuple of etag, last_modified by mtime from stat.
[ "Return", "a", "tuple", "of", "etag", "last_modified", "by", "mtime", "from", "stat", "." ]
train
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/examples/static-serve.py#L168-L172
cgearhart/Resound
resound/resound.py
hashes
def hashes(peaks, f_width=F_WIDTH, t_gap=ROWS_PER_SECOND, t_width=2*ROWS_PER_SECOND): """ Generator function for successive hashes calculated from a mono-channel time-domain audio signal as a set of tuples, (<long>, <int>). The <long> is an integral 64-bit hash so it can be used as a database ID, and ...
python
def hashes(peaks, f_width=F_WIDTH, t_gap=ROWS_PER_SECOND, t_width=2*ROWS_PER_SECOND): """ Generator function for successive hashes calculated from a mono-channel time-domain audio signal as a set of tuples, (<long>, <int>). The <long> is an integral 64-bit hash so it can be used as a database ID, and ...
[ "def", "hashes", "(", "peaks", ",", "f_width", "=", "F_WIDTH", ",", "t_gap", "=", "ROWS_PER_SECOND", ",", "t_width", "=", "2", "*", "ROWS_PER_SECOND", ")", ":", "for", "i", ",", "(", "t1", ",", "f1", ")", "in", "enumerate", "(", "peaks", ")", ":", ...
Generator function for successive hashes calculated from a mono-channel time-domain audio signal as a set of tuples, (<long>, <int>). The <long> is an integral 64-bit hash so it can be used as a database ID, and the <int> is the frame number associated with the beginning of the time bin for the anchor p...
[ "Generator", "function", "for", "successive", "hashes", "calculated", "from", "a", "mono", "-", "channel", "time", "-", "domain", "audio", "signal", "as", "a", "set", "of", "tuples", "(", "<long", ">", "<int", ">", ")", ".", "The", "<long", ">", "is", ...
train
https://github.com/cgearhart/Resound/blob/83a15be0ce2dc13003574c6039f8a1ad87734bc2/resound/resound.py#L53-L84
cgearhart/Resound
resound/resound.py
spectrogram
def spectrogram(t_signal, frame_width=FRAME_WIDTH, overlap=FRAME_STRIDE): """ Calculate the magnitude spectrogram of a single-channel time-domain signal from the real frequency components of the STFT with a hanning window applied to each frame. The frame size and overlap between frames should be spe...
python
def spectrogram(t_signal, frame_width=FRAME_WIDTH, overlap=FRAME_STRIDE): """ Calculate the magnitude spectrogram of a single-channel time-domain signal from the real frequency components of the STFT with a hanning window applied to each frame. The frame size and overlap between frames should be spe...
[ "def", "spectrogram", "(", "t_signal", ",", "frame_width", "=", "FRAME_WIDTH", ",", "overlap", "=", "FRAME_STRIDE", ")", ":", "frame_width", "=", "min", "(", "t_signal", ".", "shape", "[", "0", "]", ",", "frame_width", ")", "w", "=", "np", ".", "hanning"...
Calculate the magnitude spectrogram of a single-channel time-domain signal from the real frequency components of the STFT with a hanning window applied to each frame. The frame size and overlap between frames should be specified in number of samples.
[ "Calculate", "the", "magnitude", "spectrogram", "of", "a", "single", "-", "channel", "time", "-", "domain", "signal", "from", "the", "real", "frequency", "components", "of", "the", "STFT", "with", "a", "hanning", "window", "applied", "to", "each", "frame", "...
train
https://github.com/cgearhart/Resound/blob/83a15be0ce2dc13003574c6039f8a1ad87734bc2/resound/resound.py#L87-L105
cgearhart/Resound
resound/resound.py
_get_hash
def _get_hash(f1, f2, dt): """ Calculate a 64-bit integral hash from <f1:f2:dt>, where f1 and f2 are FFT frequency bins (based on frame width), and dt is propotional to the time difference between f1 and f2 as the the difference in frame number between the points. """ return ((long(f1) & 0xf...
python
def _get_hash(f1, f2, dt): """ Calculate a 64-bit integral hash from <f1:f2:dt>, where f1 and f2 are FFT frequency bins (based on frame width), and dt is propotional to the time difference between f1 and f2 as the the difference in frame number between the points. """ return ((long(f1) & 0xf...
[ "def", "_get_hash", "(", "f1", ",", "f2", ",", "dt", ")", ":", "return", "(", "(", "long", "(", "f1", ")", "&", "0xffff", ")", "<<", "48", "|", "(", "long", "(", "f2", ")", "&", "0xffff", ")", "<<", "32", "|", "(", "long", "(", "dt", ")", ...
Calculate a 64-bit integral hash from <f1:f2:dt>, where f1 and f2 are FFT frequency bins (based on frame width), and dt is propotional to the time difference between f1 and f2 as the the difference in frame number between the points.
[ "Calculate", "a", "64", "-", "bit", "integral", "hash", "from", "<f1", ":", "f2", ":", "dt", ">", "where", "f1", "and", "f2", "are", "FFT", "frequency", "bins", "(", "based", "on", "frame", "width", ")", "and", "dt", "is", "propotional", "to", "the",...
train
https://github.com/cgearhart/Resound/blob/83a15be0ce2dc13003574c6039f8a1ad87734bc2/resound/resound.py#L108-L117
cgearhart/Resound
resound/resound.py
_extract_peaks
def _extract_peaks(specgram, neighborhood, threshold): """ Partition the spectrogram into subcells and extract peaks from each cell if the peak is sufficiently energetic compared to the neighborhood. """ kernel = np.ones(shape=neighborhood) local_averages = convolve(specgram, kernel / kernel.sum...
python
def _extract_peaks(specgram, neighborhood, threshold): """ Partition the spectrogram into subcells and extract peaks from each cell if the peak is sufficiently energetic compared to the neighborhood. """ kernel = np.ones(shape=neighborhood) local_averages = convolve(specgram, kernel / kernel.sum...
[ "def", "_extract_peaks", "(", "specgram", ",", "neighborhood", ",", "threshold", ")", ":", "kernel", "=", "np", ".", "ones", "(", "shape", "=", "neighborhood", ")", "local_averages", "=", "convolve", "(", "specgram", ",", "kernel", "/", "kernel", ".", "sum...
Partition the spectrogram into subcells and extract peaks from each cell if the peak is sufficiently energetic compared to the neighborhood.
[ "Partition", "the", "spectrogram", "into", "subcells", "and", "extract", "peaks", "from", "each", "cell", "if", "the", "peak", "is", "sufficiently", "energetic", "compared", "to", "the", "neighborhood", "." ]
train
https://github.com/cgearhart/Resound/blob/83a15be0ce2dc13003574c6039f8a1ad87734bc2/resound/resound.py#L120-L137
shaiguitar/snowclient.py
snowclient/api.py
Api.list
def list(self,table, **kparams): """ get a collection of records by table name. returns a dict (the json map) for python 3.4 """ result = self.table_api_get(table, **kparams) return self.to_records(result, table)
python
def list(self,table, **kparams): """ get a collection of records by table name. returns a dict (the json map) for python 3.4 """ result = self.table_api_get(table, **kparams) return self.to_records(result, table)
[ "def", "list", "(", "self", ",", "table", ",", "*", "*", "kparams", ")", ":", "result", "=", "self", ".", "table_api_get", "(", "table", ",", "*", "*", "kparams", ")", "return", "self", ".", "to_records", "(", "result", ",", "table", ")" ]
get a collection of records by table name. returns a dict (the json map) for python 3.4
[ "get", "a", "collection", "of", "records", "by", "table", "name", ".", "returns", "a", "dict", "(", "the", "json", "map", ")", "for", "python", "3", ".", "4" ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L50-L56
shaiguitar/snowclient.py
snowclient/api.py
Api.update
def update(self,table, sys_id, **kparams): """ use PUT to update a single record by table name and sys_id returns a dict (the json map) for python 3.4 """ result = self.table_api_put(table, sys_id, **kparams) return self.to_record(result, table)
python
def update(self,table, sys_id, **kparams): """ use PUT to update a single record by table name and sys_id returns a dict (the json map) for python 3.4 """ result = self.table_api_put(table, sys_id, **kparams) return self.to_record(result, table)
[ "def", "update", "(", "self", ",", "table", ",", "sys_id", ",", "*", "*", "kparams", ")", ":", "result", "=", "self", ".", "table_api_put", "(", "table", ",", "sys_id", ",", "*", "*", "kparams", ")", "return", "self", ".", "to_record", "(", "result",...
use PUT to update a single record by table name and sys_id returns a dict (the json map) for python 3.4
[ "use", "PUT", "to", "update", "a", "single", "record", "by", "table", "name", "and", "sys_id", "returns", "a", "dict", "(", "the", "json", "map", ")", "for", "python", "3", ".", "4" ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L58-L64
shaiguitar/snowclient.py
snowclient/api.py
Api.get
def get(self,table, sys_id): """ get a single record by table name and sys_id returns a dict (the json map) for python 3.4 """ result = self.table_api_get(table, sys_id) return self.to_record(result, table)
python
def get(self,table, sys_id): """ get a single record by table name and sys_id returns a dict (the json map) for python 3.4 """ result = self.table_api_get(table, sys_id) return self.to_record(result, table)
[ "def", "get", "(", "self", ",", "table", ",", "sys_id", ")", ":", "result", "=", "self", ".", "table_api_get", "(", "table", ",", "sys_id", ")", "return", "self", ".", "to_record", "(", "result", ",", "table", ")" ]
get a single record by table name and sys_id returns a dict (the json map) for python 3.4
[ "get", "a", "single", "record", "by", "table", "name", "and", "sys_id", "returns", "a", "dict", "(", "the", "json", "map", ")", "for", "python", "3", ".", "4" ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L66-L72
shaiguitar/snowclient.py
snowclient/api.py
Api.req
def req(self, meth, url, http_data=''): """ sugar that wraps the 'requests' module with basic auth and some headers. """ self.logger.debug("Making request: %s %s\nBody:%s" % (meth, url, http_data)) req_method = getattr(requests, meth) return (req_method(url, ...
python
def req(self, meth, url, http_data=''): """ sugar that wraps the 'requests' module with basic auth and some headers. """ self.logger.debug("Making request: %s %s\nBody:%s" % (meth, url, http_data)) req_method = getattr(requests, meth) return (req_method(url, ...
[ "def", "req", "(", "self", ",", "meth", ",", "url", ",", "http_data", "=", "''", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Making request: %s %s\\nBody:%s\"", "%", "(", "meth", ",", "url", ",", "http_data", ")", ")", "req_method", "=", "ge...
sugar that wraps the 'requests' module with basic auth and some headers.
[ "sugar", "that", "wraps", "the", "requests", "module", "with", "basic", "auth", "and", "some", "headers", "." ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L80-L89
shaiguitar/snowclient.py
snowclient/api.py
Api.user_agent
def user_agent(self): """ its a user agent string! """ version = "" project_root = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(project_root, 'VERSION')) as version_file: version = version_file.read().strip() return "Python Snow A...
python
def user_agent(self): """ its a user agent string! """ version = "" project_root = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(project_root, 'VERSION')) as version_file: version = version_file.read().strip() return "Python Snow A...
[ "def", "user_agent", "(", "self", ")", ":", "version", "=", "\"\"", "project_root", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(",...
its a user agent string!
[ "its", "a", "user", "agent", "string!" ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L91-L100
shaiguitar/snowclient.py
snowclient/api.py
Api.table_api_get
def table_api_get(self, *paths, **kparams): """ helper to make GET /api/now/v1/table requests """ url = self.flattened_params_url("/api/now/v1/table", *paths, **kparams) rjson = self.req("get", url).text return json.loads(rjson)
python
def table_api_get(self, *paths, **kparams): """ helper to make GET /api/now/v1/table requests """ url = self.flattened_params_url("/api/now/v1/table", *paths, **kparams) rjson = self.req("get", url).text return json.loads(rjson)
[ "def", "table_api_get", "(", "self", ",", "*", "paths", ",", "*", "*", "kparams", ")", ":", "url", "=", "self", ".", "flattened_params_url", "(", "\"/api/now/v1/table\"", ",", "*", "paths", ",", "*", "*", "kparams", ")", "rjson", "=", "self", ".", "req...
helper to make GET /api/now/v1/table requests
[ "helper", "to", "make", "GET", "/", "api", "/", "now", "/", "v1", "/", "table", "requests" ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L132-L136
shaiguitar/snowclient.py
snowclient/api.py
Api.table_api_put
def table_api_put(self, *paths, **kparams): """ helper to make PUT /api/now/v1/table requests """ url = self.flattened_params_url("/api/now/v1/table", *paths) # json.dumps(kparams) is the body of the put/post rjson = self.req("put", url, json.dumps(kparams)).text return json.loa...
python
def table_api_put(self, *paths, **kparams): """ helper to make PUT /api/now/v1/table requests """ url = self.flattened_params_url("/api/now/v1/table", *paths) # json.dumps(kparams) is the body of the put/post rjson = self.req("put", url, json.dumps(kparams)).text return json.loa...
[ "def", "table_api_put", "(", "self", ",", "*", "paths", ",", "*", "*", "kparams", ")", ":", "url", "=", "self", ".", "flattened_params_url", "(", "\"/api/now/v1/table\"", ",", "*", "paths", ")", "# json.dumps(kparams) is the body of the put/post", "rjson", "=", ...
helper to make PUT /api/now/v1/table requests
[ "helper", "to", "make", "PUT", "/", "api", "/", "now", "/", "v1", "/", "table", "requests" ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L138-L144
shaiguitar/snowclient.py
snowclient/api.py
Api.flattened_params_url
def flattened_params_url(self, path_prefix, *paths, **kparams): """ url builder helper to make /api/now/v1/table paths for GET requests. Snow is Woe.""" base = self.base_url + path_prefix for p in paths: base += "/" base += p if kparams: base += "?" ...
python
def flattened_params_url(self, path_prefix, *paths, **kparams): """ url builder helper to make /api/now/v1/table paths for GET requests. Snow is Woe.""" base = self.base_url + path_prefix for p in paths: base += "/" base += p if kparams: base += "?" ...
[ "def", "flattened_params_url", "(", "self", ",", "path_prefix", ",", "*", "paths", ",", "*", "*", "kparams", ")", ":", "base", "=", "self", ".", "base_url", "+", "path_prefix", "for", "p", "in", "paths", ":", "base", "+=", "\"/\"", "base", "+=", "p", ...
url builder helper to make /api/now/v1/table paths for GET requests. Snow is Woe.
[ "url", "builder", "helper", "to", "make", "/", "api", "/", "now", "/", "v1", "/", "table", "paths", "for", "GET", "requests", ".", "Snow", "is", "Woe", "." ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L146-L157
shaiguitar/snowclient.py
snowclient/api.py
Api.resolve_links
def resolve_links(self, snow_record, **kparams): """ Get the infos from the links and return SnowRecords[]. """ records = [] for attr, link in snow_record.links().items(): records.append(self.resolve_link(snow_record, attr, **kparams)) return records
python
def resolve_links(self, snow_record, **kparams): """ Get the infos from the links and return SnowRecords[]. """ records = [] for attr, link in snow_record.links().items(): records.append(self.resolve_link(snow_record, attr, **kparams)) return records
[ "def", "resolve_links", "(", "self", ",", "snow_record", ",", "*", "*", "kparams", ")", ":", "records", "=", "[", "]", "for", "attr", ",", "link", "in", "snow_record", ".", "links", "(", ")", ".", "items", "(", ")", ":", "records", ".", "append", "...
Get the infos from the links and return SnowRecords[].
[ "Get", "the", "infos", "from", "the", "links", "and", "return", "SnowRecords", "[]", "." ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L159-L166
shaiguitar/snowclient.py
snowclient/api.py
Api.resolve_link
def resolve_link(self, snow_record, field_to_resolve, **kparams): """ Get the info from the link and return a SnowRecord. """ try: link = snow_record.links()[field_to_resolve] except KeyError as e: return SnowRecord.NotFound(self, snow_record._table_name, "Cou...
python
def resolve_link(self, snow_record, field_to_resolve, **kparams): """ Get the info from the link and return a SnowRecord. """ try: link = snow_record.links()[field_to_resolve] except KeyError as e: return SnowRecord.NotFound(self, snow_record._table_name, "Cou...
[ "def", "resolve_link", "(", "self", ",", "snow_record", ",", "field_to_resolve", ",", "*", "*", "kparams", ")", ":", "try", ":", "link", "=", "snow_record", ".", "links", "(", ")", "[", "field_to_resolve", "]", "except", "KeyError", "as", "e", ":", "retu...
Get the info from the link and return a SnowRecord.
[ "Get", "the", "info", "from", "the", "link", "and", "return", "a", "SnowRecord", "." ]
train
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/api.py#L168-L194