repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.get_series_episodes | def get_series_episodes(self, series_id, episode_number=None, aired_season=None, aired_episode=None,
dvd_season=None, dvd_episode=None, imdb_id=None, page=1):
"""
Retrieves all episodes for a particular series given its TheTVDB and filtered by additional optional details.
... | python | def get_series_episodes(self, series_id, episode_number=None, aired_season=None, aired_episode=None,
dvd_season=None, dvd_episode=None, imdb_id=None, page=1):
"""
Retrieves all episodes for a particular series given its TheTVDB and filtered by additional optional details.
... | [
"def",
"get_series_episodes",
"(",
"self",
",",
"series_id",
",",
"episode_number",
"=",
"None",
",",
"aired_season",
"=",
"None",
",",
"aired_episode",
"=",
"None",
",",
"dvd_season",
"=",
"None",
",",
"dvd_episode",
"=",
"None",
",",
"imdb_id",
"=",
"None"... | Retrieves all episodes for a particular series given its TheTVDB and filtered by additional optional details.
:param series_id: The TheTVDB id of the series.
:param episode_number: The optional absolute episode number.
:param aired_season: The optional aired season number.
:param aired_... | [
"Retrieves",
"all",
"episodes",
"for",
"a",
"particular",
"series",
"given",
"its",
"TheTVDB",
"and",
"filtered",
"by",
"additional",
"optional",
"details",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L167-L194 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.get_updated | def get_updated(self, from_time, to_time=None):
"""
Retrives a list of series that have changed on TheTVDB since a provided from time parameter and optionally to an
specified to time.
:param from_time: An epoch representation of the date from which to restrict the query to.
:par... | python | def get_updated(self, from_time, to_time=None):
"""
Retrives a list of series that have changed on TheTVDB since a provided from time parameter and optionally to an
specified to time.
:param from_time: An epoch representation of the date from which to restrict the query to.
:par... | [
"def",
"get_updated",
"(",
"self",
",",
"from_time",
",",
"to_time",
"=",
"None",
")",
":",
"arguments",
"=",
"locals",
"(",
")",
"optional_parameters",
"=",
"{",
"'to_time'",
":",
"'toTime'",
"}",
"query_string",
"=",
"'fromTime=%s&%s'",
"%",
"(",
"from_tim... | Retrives a list of series that have changed on TheTVDB since a provided from time parameter and optionally to an
specified to time.
:param from_time: An epoch representation of the date from which to restrict the query to.
:param to_time: An optional epcoh representation of the date to which to... | [
"Retrives",
"a",
"list",
"of",
"series",
"that",
"have",
"changed",
"on",
"TheTVDB",
"since",
"a",
"provided",
"from",
"time",
"parameter",
"and",
"optionally",
"to",
"an",
"specified",
"to",
"time",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L252-L271 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.get_user | def get_user(self):
"""
Retrieves information about the user currently using the api.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/user',
... | python | def get_user(self):
"""
Retrieves information about the user currently using the api.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/user',
... | [
"def",
"get_user",
"(",
"self",
")",
":",
"return",
"self",
".",
"parse_raw_response",
"(",
"requests_util",
".",
"run_request",
"(",
"'get'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/user'",
",",
"headers",
"=",
"self",
".",
"__get_header_with_auth",
"(",
... | Retrieves information about the user currently using the api.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Retrieves",
"information",
"about",
"the",
"user",
"currently",
"using",
"the",
"api",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L274-L282 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.get_user_favorites | def get_user_favorites(self):
"""
Retrieves the list of tv series the current user has flagged as favorite.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
return self.parse_raw_response(requests_util.run_request('get', self.API_B... | python | def get_user_favorites(self):
"""
Retrieves the list of tv series the current user has flagged as favorite.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
return self.parse_raw_response(requests_util.run_request('get', self.API_B... | [
"def",
"get_user_favorites",
"(",
"self",
")",
":",
"return",
"self",
".",
"parse_raw_response",
"(",
"requests_util",
".",
"run_request",
"(",
"'get'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/user/favorites'",
",",
"headers",
"=",
"self",
".",
"__get_header_w... | Retrieves the list of tv series the current user has flagged as favorite.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Retrieves",
"the",
"list",
"of",
"tv",
"series",
"the",
"current",
"user",
"has",
"flagged",
"as",
"favorite",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L285-L293 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.delete_user_favorite | def delete_user_favorite(self, series_id):
"""
Deletes the series of the provided id from the favorites list of the current user.
:param series_id: The TheTVDB id of the series.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
... | python | def delete_user_favorite(self, series_id):
"""
Deletes the series of the provided id from the favorites list of the current user.
:param series_id: The TheTVDB id of the series.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
... | [
"def",
"delete_user_favorite",
"(",
"self",
",",
"series_id",
")",
":",
"return",
"self",
".",
"parse_raw_response",
"(",
"requests_util",
".",
"run_request",
"(",
"'delete'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/user/favorites/%d'",
"%",
"series_id",
",",
... | Deletes the series of the provided id from the favorites list of the current user.
:param series_id: The TheTVDB id of the series.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Deletes",
"the",
"series",
"of",
"the",
"provided",
"id",
"from",
"the",
"favorites",
"list",
"of",
"the",
"current",
"user",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L296-L306 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.__get_user_ratings | def __get_user_ratings(self):
"""
Returns a list of the ratings provided by the current user.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/us... | python | def __get_user_ratings(self):
"""
Returns a list of the ratings provided by the current user.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/us... | [
"def",
"__get_user_ratings",
"(",
"self",
")",
":",
"return",
"self",
".",
"parse_raw_response",
"(",
"requests_util",
".",
"run_request",
"(",
"'get'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/user/ratings'",
",",
"headers",
"=",
"self",
".",
"__get_header_wit... | Returns a list of the ratings provided by the current user.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Returns",
"a",
"list",
"of",
"the",
"ratings",
"provided",
"by",
"the",
"current",
"user",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L322-L330 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.get_user_ratings | def get_user_ratings(self, item_type=None):
"""
Returns a list of the ratings for the type of item provided, for the current user.
:param item_type: One of: series, episode or banner.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""... | python | def get_user_ratings(self, item_type=None):
"""
Returns a list of the ratings for the type of item provided, for the current user.
:param item_type: One of: series, episode or banner.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""... | [
"def",
"get_user_ratings",
"(",
"self",
",",
"item_type",
"=",
"None",
")",
":",
"if",
"item_type",
":",
"query_string",
"=",
"'itemType=%s'",
"%",
"item_type",
"return",
"self",
".",
"parse_raw_response",
"(",
"requests_util",
".",
"run_request",
"(",
"'get'",
... | Returns a list of the ratings for the type of item provided, for the current user.
:param item_type: One of: series, episode or banner.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Returns",
"a",
"list",
"of",
"the",
"ratings",
"for",
"the",
"type",
"of",
"item",
"provided",
"for",
"the",
"current",
"user",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L333-L348 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.add_user_rating | def add_user_rating(self, item_type, item_id, item_rating):
"""
Adds the rating for the item indicated for the current user.
:param item_type: One of: series, episode, banner.
:param item_id: The TheTVDB id of the item.
:param item_rating: The rating from 0 to 10.
:retur... | python | def add_user_rating(self, item_type, item_id, item_rating):
"""
Adds the rating for the item indicated for the current user.
:param item_type: One of: series, episode, banner.
:param item_id: The TheTVDB id of the item.
:param item_rating: The rating from 0 to 10.
:retur... | [
"def",
"add_user_rating",
"(",
"self",
",",
"item_type",
",",
"item_id",
",",
"item_rating",
")",
":",
"raw_response",
"=",
"requests_util",
".",
"run_request",
"(",
"'put'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/user/ratings/%s/%d/%d'",
"%",
"(",
"item_type... | Adds the rating for the item indicated for the current user.
:param item_type: One of: series, episode, banner.
:param item_id: The TheTVDB id of the item.
:param item_rating: The rating from 0 to 10.
:return: | [
"Adds",
"the",
"rating",
"for",
"the",
"item",
"indicated",
"for",
"the",
"current",
"user",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L351-L366 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.delete_user_rating | def delete_user_rating(self, item_type, item_id):
"""
Deletes from the list of rating of the current user, the rating provided for the specified element type.
:param item_type: One of: series, episode, banner.
:param item_id: The TheTVDB Id of the item.
:return: a python diction... | python | def delete_user_rating(self, item_type, item_id):
"""
Deletes from the list of rating of the current user, the rating provided for the specified element type.
:param item_type: One of: series, episode, banner.
:param item_id: The TheTVDB Id of the item.
:return: a python diction... | [
"def",
"delete_user_rating",
"(",
"self",
",",
"item_type",
",",
"item_id",
")",
":",
"raw_response",
"=",
"requests_util",
".",
"run_request",
"(",
"'delete'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/user/ratings/%s/%d'",
"%",
"(",
"item_type",
",",
"item_id"... | Deletes from the list of rating of the current user, the rating provided for the specified element type.
:param item_type: One of: series, episode, banner.
:param item_id: The TheTVDB Id of the item.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Deletes",
"from",
"the",
"list",
"of",
"rating",
"of",
"the",
"current",
"user",
"the",
"rating",
"provided",
"for",
"the",
"specified",
"element",
"type",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L369-L382 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.get_episode | def get_episode(self, episode_id):
"""
Returns the full information of the episode belonging to the Id provided.
:param episode_id: The TheTVDB id of the episode.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
raw_respons... | python | def get_episode(self, episode_id):
"""
Returns the full information of the episode belonging to the Id provided.
:param episode_id: The TheTVDB id of the episode.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
raw_respons... | [
"def",
"get_episode",
"(",
"self",
",",
"episode_id",
")",
":",
"raw_response",
"=",
"requests_util",
".",
"run_request",
"(",
"'get'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/episodes/%d'",
"%",
"episode_id",
",",
"headers",
"=",
"self",
".",
"__get_header_... | Returns the full information of the episode belonging to the Id provided.
:param episode_id: The TheTVDB id of the episode.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Returns",
"the",
"full",
"information",
"of",
"the",
"episode",
"belonging",
"to",
"the",
"Id",
"provided",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L385-L396 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.get_languages | def get_languages(self):
"""
Returns a list of all language options available in TheTVDB.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
raw_response = requests_util.run_request('get', self.API_BASE_URL + '/languages',
... | python | def get_languages(self):
"""
Returns a list of all language options available in TheTVDB.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
raw_response = requests_util.run_request('get', self.API_BASE_URL + '/languages',
... | [
"def",
"get_languages",
"(",
"self",
")",
":",
"raw_response",
"=",
"requests_util",
".",
"run_request",
"(",
"'get'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/languages'",
",",
"headers",
"=",
"self",
".",
"__get_header_with_auth",
"(",
")",
")",
"return",
... | Returns a list of all language options available in TheTVDB.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Returns",
"a",
"list",
"of",
"all",
"language",
"options",
"available",
"in",
"TheTVDB",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L399-L409 | train |
thilux/tvdb_client | tvdb_client/clients/ApiV2Client.py | ApiV2Client.get_language | def get_language(self, language_id):
"""
Retrieves information about the language of the given id.
:param language_id: The TheTVDB Id of the language.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
raw_response = requests... | python | def get_language(self, language_id):
"""
Retrieves information about the language of the given id.
:param language_id: The TheTVDB Id of the language.
:return: a python dictionary with either the result of the search or an error from TheTVDB.
"""
raw_response = requests... | [
"def",
"get_language",
"(",
"self",
",",
"language_id",
")",
":",
"raw_response",
"=",
"requests_util",
".",
"run_request",
"(",
"'get'",
",",
"self",
".",
"API_BASE_URL",
"+",
"'/languages/%d'",
"%",
"language_id",
",",
"headers",
"=",
"self",
".",
"__get_hea... | Retrieves information about the language of the given id.
:param language_id: The TheTVDB Id of the language.
:return: a python dictionary with either the result of the search or an error from TheTVDB. | [
"Retrieves",
"information",
"about",
"the",
"language",
"of",
"the",
"given",
"id",
"."
] | 2d5106f260367c0abe1284683697874df6343f78 | https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L412-L423 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/__init__.py | SetCredentials | def SetCredentials(api_key,api_passwd):
"""Establish API key and password associated with APIv1 commands."""
global V1_API_KEY
global V1_API_PASSWD
global _V1_ENABLED
_V1_ENABLED = True
V1_API_KEY = api_key
V1_API_PASSWD = api_passwd | python | def SetCredentials(api_key,api_passwd):
"""Establish API key and password associated with APIv1 commands."""
global V1_API_KEY
global V1_API_PASSWD
global _V1_ENABLED
_V1_ENABLED = True
V1_API_KEY = api_key
V1_API_PASSWD = api_passwd | [
"def",
"SetCredentials",
"(",
"api_key",
",",
"api_passwd",
")",
":",
"global",
"V1_API_KEY",
"global",
"V1_API_PASSWD",
"global",
"_V1_ENABLED",
"_V1_ENABLED",
"=",
"True",
"V1_API_KEY",
"=",
"api_key",
"V1_API_PASSWD",
"=",
"api_passwd"
] | Establish API key and password associated with APIv1 commands. | [
"Establish",
"API",
"key",
"and",
"password",
"associated",
"with",
"APIv1",
"commands",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/__init__.py#L54-L61 | train |
vmonaco/pohmm | pohmm/utils.py | normalize | def normalize(A, axis=None, inplace=False):
"""
Normalize the input array so that it sums to 1.
Parameters
----------
A: array, shape (n_samples, n_features)
Non-normalized input data.
axis: int
Dimension along which normalization is performed.
Returns
-------
norma... | python | def normalize(A, axis=None, inplace=False):
"""
Normalize the input array so that it sums to 1.
Parameters
----------
A: array, shape (n_samples, n_features)
Non-normalized input data.
axis: int
Dimension along which normalization is performed.
Returns
-------
norma... | [
"def",
"normalize",
"(",
"A",
",",
"axis",
"=",
"None",
",",
"inplace",
"=",
"False",
")",
":",
"if",
"not",
"inplace",
":",
"A",
"=",
"A",
".",
"copy",
"(",
")",
"A",
"+=",
"np",
".",
"finfo",
"(",
"float",
")",
".",
"eps",
"Asum",
"=",
"A",... | Normalize the input array so that it sums to 1.
Parameters
----------
A: array, shape (n_samples, n_features)
Non-normalized input data.
axis: int
Dimension along which normalization is performed.
Returns
-------
normalized_A: array, shape (n_samples, n_features)
A ... | [
"Normalize",
"the",
"input",
"array",
"so",
"that",
"it",
"sums",
"to",
"1",
"."
] | c00f8a62d3005a171d424549a55d46c421859ae9 | https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L40-L68 | train |
vmonaco/pohmm | pohmm/utils.py | ph2full | def ph2full(ptrans, htrans):
"""
Convert a p-state transition matrix and h-state matrices to the full transation matrix
The full transmat hase N=n_pstates*n_hstates states
"""
n_pstates = len(ptrans)
n_hstates = len(htrans[0, 0])
N = n_pstates * n_hstates
trans = np.zeros((N, N))
fo... | python | def ph2full(ptrans, htrans):
"""
Convert a p-state transition matrix and h-state matrices to the full transation matrix
The full transmat hase N=n_pstates*n_hstates states
"""
n_pstates = len(ptrans)
n_hstates = len(htrans[0, 0])
N = n_pstates * n_hstates
trans = np.zeros((N, N))
fo... | [
"def",
"ph2full",
"(",
"ptrans",
",",
"htrans",
")",
":",
"n_pstates",
"=",
"len",
"(",
"ptrans",
")",
"n_hstates",
"=",
"len",
"(",
"htrans",
"[",
"0",
",",
"0",
"]",
")",
"N",
"=",
"n_pstates",
"*",
"n_hstates",
"trans",
"=",
"np",
".",
"zeros",
... | Convert a p-state transition matrix and h-state matrices to the full transation matrix
The full transmat hase N=n_pstates*n_hstates states | [
"Convert",
"a",
"p",
"-",
"state",
"transition",
"matrix",
"and",
"h",
"-",
"state",
"matrices",
"to",
"the",
"full",
"transation",
"matrix"
] | c00f8a62d3005a171d424549a55d46c421859ae9 | https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L71-L85 | train |
vmonaco/pohmm | pohmm/utils.py | full2ph | def full2ph(trans, n_pstates):
"""
Convert a full transmat to the respective p-state and h-state transmats
"""
n_hstates = len(trans) / n_pstates
htrans = np.zeros((n_pstates, n_pstates, n_hstates, n_hstates))
for pidx1, pidx2 in product(range(n_pstates), range(n_pstates)):
idx1 = pidx1... | python | def full2ph(trans, n_pstates):
"""
Convert a full transmat to the respective p-state and h-state transmats
"""
n_hstates = len(trans) / n_pstates
htrans = np.zeros((n_pstates, n_pstates, n_hstates, n_hstates))
for pidx1, pidx2 in product(range(n_pstates), range(n_pstates)):
idx1 = pidx1... | [
"def",
"full2ph",
"(",
"trans",
",",
"n_pstates",
")",
":",
"n_hstates",
"=",
"len",
"(",
"trans",
")",
"/",
"n_pstates",
"htrans",
"=",
"np",
".",
"zeros",
"(",
"(",
"n_pstates",
",",
"n_pstates",
",",
"n_hstates",
",",
"n_hstates",
")",
")",
"for",
... | Convert a full transmat to the respective p-state and h-state transmats | [
"Convert",
"a",
"full",
"transmat",
"to",
"the",
"respective",
"p",
"-",
"state",
"and",
"h",
"-",
"state",
"transmats"
] | c00f8a62d3005a171d424549a55d46c421859ae9 | https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L88-L103 | train |
vmonaco/pohmm | pohmm/utils.py | gen_stochastic_matrix | def gen_stochastic_matrix(size, random_state=None):
"""
Generate a unfiformly-random stochastic array or matrix
"""
if not type(size) is tuple:
size = (1, size)
assert len(size) == 2
n = random_state.uniform(size=(size[0], size[1] - 1))
n = np.concatenate([np.zeros((size[0], 1)), n... | python | def gen_stochastic_matrix(size, random_state=None):
"""
Generate a unfiformly-random stochastic array or matrix
"""
if not type(size) is tuple:
size = (1, size)
assert len(size) == 2
n = random_state.uniform(size=(size[0], size[1] - 1))
n = np.concatenate([np.zeros((size[0], 1)), n... | [
"def",
"gen_stochastic_matrix",
"(",
"size",
",",
"random_state",
"=",
"None",
")",
":",
"if",
"not",
"type",
"(",
"size",
")",
"is",
"tuple",
":",
"size",
"=",
"(",
"1",
",",
"size",
")",
"assert",
"len",
"(",
"size",
")",
"==",
"2",
"n",
"=",
"... | Generate a unfiformly-random stochastic array or matrix | [
"Generate",
"a",
"unfiformly",
"-",
"random",
"stochastic",
"array",
"or",
"matrix"
] | c00f8a62d3005a171d424549a55d46c421859ae9 | https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L106-L119 | train |
vmonaco/pohmm | pohmm/utils.py | steadystate | def steadystate(A, max_iter=100):
"""
Empirically determine the steady state probabilities from a stochastic matrix
"""
P = np.linalg.matrix_power(A, max_iter)
# Determine the unique rows in A
v = []
for i in range(len(P)):
if not np.any([np.allclose(P[i], vi, ) for vi in v]):
... | python | def steadystate(A, max_iter=100):
"""
Empirically determine the steady state probabilities from a stochastic matrix
"""
P = np.linalg.matrix_power(A, max_iter)
# Determine the unique rows in A
v = []
for i in range(len(P)):
if not np.any([np.allclose(P[i], vi, ) for vi in v]):
... | [
"def",
"steadystate",
"(",
"A",
",",
"max_iter",
"=",
"100",
")",
":",
"P",
"=",
"np",
".",
"linalg",
".",
"matrix_power",
"(",
"A",
",",
"max_iter",
")",
"# Determine the unique rows in A",
"v",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
... | Empirically determine the steady state probabilities from a stochastic matrix | [
"Empirically",
"determine",
"the",
"steady",
"state",
"probabilities",
"from",
"a",
"stochastic",
"matrix"
] | c00f8a62d3005a171d424549a55d46c421859ae9 | https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L122-L134 | train |
teepark/greenhouse | greenhouse/io/ipc.py | pipe | def pipe():
"""create an inter-process communication pipe
:returns:
a pair of :class:`File` objects ``(read, write)`` for the two ends of
the pipe
"""
r, w = os.pipe()
return File.fromfd(r, 'rb'), File.fromfd(w, 'wb') | python | def pipe():
"""create an inter-process communication pipe
:returns:
a pair of :class:`File` objects ``(read, write)`` for the two ends of
the pipe
"""
r, w = os.pipe()
return File.fromfd(r, 'rb'), File.fromfd(w, 'wb') | [
"def",
"pipe",
"(",
")",
":",
"r",
",",
"w",
"=",
"os",
".",
"pipe",
"(",
")",
"return",
"File",
".",
"fromfd",
"(",
"r",
",",
"'rb'",
")",
",",
"File",
".",
"fromfd",
"(",
"w",
",",
"'wb'",
")"
] | create an inter-process communication pipe
:returns:
a pair of :class:`File` objects ``(read, write)`` for the two ends of
the pipe | [
"create",
"an",
"inter",
"-",
"process",
"communication",
"pipe"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/ipc.py#L11-L19 | train |
cltl/KafNafParserPy | KafNafParserPy/span_data.py | Cspan.get_id_head | def get_id_head(self):
'''
Returns the id of the target that is set as "head"
@rtype: string
@return: the target id (or None) of the head target
'''
id_head = None
for target_node in self:
if target_node.is_head():
id_head = target_nod... | python | def get_id_head(self):
'''
Returns the id of the target that is set as "head"
@rtype: string
@return: the target id (or None) of the head target
'''
id_head = None
for target_node in self:
if target_node.is_head():
id_head = target_nod... | [
"def",
"get_id_head",
"(",
"self",
")",
":",
"id_head",
"=",
"None",
"for",
"target_node",
"in",
"self",
":",
"if",
"target_node",
".",
"is_head",
"(",
")",
":",
"id_head",
"=",
"target_node",
".",
"get_id",
"(",
")",
"break",
"return",
"id_head"
] | Returns the id of the target that is set as "head"
@rtype: string
@return: the target id (or None) of the head target | [
"Returns",
"the",
"id",
"of",
"the",
"target",
"that",
"is",
"set",
"as",
"head"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/span_data.py#L99-L110 | train |
cltl/KafNafParserPy | KafNafParserPy/span_data.py | Cspan.add_target_id | def add_target_id(self,this_id):
"""
Adds a new target to the span with the specified id
@type this_id: string
@param this_id: the id of the new target
"""
new_target = Ctarget()
new_target.set_id(this_id)
self.node.append(new_target.get_node()) | python | def add_target_id(self,this_id):
"""
Adds a new target to the span with the specified id
@type this_id: string
@param this_id: the id of the new target
"""
new_target = Ctarget()
new_target.set_id(this_id)
self.node.append(new_target.get_node()) | [
"def",
"add_target_id",
"(",
"self",
",",
"this_id",
")",
":",
"new_target",
"=",
"Ctarget",
"(",
")",
"new_target",
".",
"set_id",
"(",
"this_id",
")",
"self",
".",
"node",
".",
"append",
"(",
"new_target",
".",
"get_node",
"(",
")",
")"
] | Adds a new target to the span with the specified id
@type this_id: string
@param this_id: the id of the new target | [
"Adds",
"a",
"new",
"target",
"to",
"the",
"span",
"with",
"the",
"specified",
"id"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/span_data.py#L112-L120 | train |
cltl/KafNafParserPy | KafNafParserPy/span_data.py | Cspan.create_from_ids | def create_from_ids(self,list_ids):
"""
Adds new targets to the span with the specified ids
@type list_ids: list
@param list_ids: list of identifiers
"""
for this_id in list_ids:
new_target = Ctarget()
new_target.set_id(this_id)
self.no... | python | def create_from_ids(self,list_ids):
"""
Adds new targets to the span with the specified ids
@type list_ids: list
@param list_ids: list of identifiers
"""
for this_id in list_ids:
new_target = Ctarget()
new_target.set_id(this_id)
self.no... | [
"def",
"create_from_ids",
"(",
"self",
",",
"list_ids",
")",
":",
"for",
"this_id",
"in",
"list_ids",
":",
"new_target",
"=",
"Ctarget",
"(",
")",
"new_target",
".",
"set_id",
"(",
"this_id",
")",
"self",
".",
"node",
".",
"append",
"(",
"new_target",
".... | Adds new targets to the span with the specified ids
@type list_ids: list
@param list_ids: list of identifiers | [
"Adds",
"new",
"targets",
"to",
"the",
"span",
"with",
"the",
"specified",
"ids"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/span_data.py#L122-L131 | train |
cltl/KafNafParserPy | KafNafParserPy/span_data.py | Cspan.create_from_targets | def create_from_targets(self,list_targs):
"""
Adds new targets to the span that are defined in a list
@type list_targs: list
@param list_targs: list of Ctargets
"""
for this_target in list_targs:
self.node.append(this_target.get_node()) | python | def create_from_targets(self,list_targs):
"""
Adds new targets to the span that are defined in a list
@type list_targs: list
@param list_targs: list of Ctargets
"""
for this_target in list_targs:
self.node.append(this_target.get_node()) | [
"def",
"create_from_targets",
"(",
"self",
",",
"list_targs",
")",
":",
"for",
"this_target",
"in",
"list_targs",
":",
"self",
".",
"node",
".",
"append",
"(",
"this_target",
".",
"get_node",
"(",
")",
")"
] | Adds new targets to the span that are defined in a list
@type list_targs: list
@param list_targs: list of Ctargets | [
"Adds",
"new",
"targets",
"to",
"the",
"span",
"that",
"are",
"defined",
"in",
"a",
"list"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/span_data.py#L133-L140 | train |
cltl/KafNafParserPy | KafNafParserPy/attribution_data.py | Cattribution.get_statement | def get_statement(self, statement_id):
"""
Returns the statement object for the supplied identifier
@type statement_id: string
@param statement_id: statement identifier
"""
if statement_id in self.idx:
return Cstatement(self.idx[statement_id], self.type)
... | python | def get_statement(self, statement_id):
"""
Returns the statement object for the supplied identifier
@type statement_id: string
@param statement_id: statement identifier
"""
if statement_id in self.idx:
return Cstatement(self.idx[statement_id], self.type)
... | [
"def",
"get_statement",
"(",
"self",
",",
"statement_id",
")",
":",
"if",
"statement_id",
"in",
"self",
".",
"idx",
":",
"return",
"Cstatement",
"(",
"self",
".",
"idx",
"[",
"statement_id",
"]",
",",
"self",
".",
"type",
")",
"else",
":",
"return",
"N... | Returns the statement object for the supplied identifier
@type statement_id: string
@param statement_id: statement identifier | [
"Returns",
"the",
"statement",
"object",
"for",
"the",
"supplied",
"identifier"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/attribution_data.py#L279-L288 | train |
cltl/KafNafParserPy | KafNafParserPy/attribution_data.py | Cattribution.add_statement | def add_statement(self, statement_obj):
"""
Adds a statement object to the layer
@type statement_obj: L{Cstatement}
@param statement_obj: the statement object
"""
if statement_obj.get_id() in self.idx:
raise ValueError("Statement with id {} already exists!"
... | python | def add_statement(self, statement_obj):
"""
Adds a statement object to the layer
@type statement_obj: L{Cstatement}
@param statement_obj: the statement object
"""
if statement_obj.get_id() in self.idx:
raise ValueError("Statement with id {} already exists!"
... | [
"def",
"add_statement",
"(",
"self",
",",
"statement_obj",
")",
":",
"if",
"statement_obj",
".",
"get_id",
"(",
")",
"in",
"self",
".",
"idx",
":",
"raise",
"ValueError",
"(",
"\"Statement with id {} already exists!\"",
".",
"format",
"(",
"statement_obj",
".",
... | Adds a statement object to the layer
@type statement_obj: L{Cstatement}
@param statement_obj: the statement object | [
"Adds",
"a",
"statement",
"object",
"to",
"the",
"layer"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/attribution_data.py#L290-L300 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/datacenter.py | Datacenter.RootGroup | def RootGroup(self):
"""Returns group object for datacenter root group.
>>> clc.v2.Datacenter().RootGroup()
<clc.APIv2.group.Group object at 0x105feacd0>
>>> print _
WA1 Hardware
"""
return(clc.v2.Group(id=self.root_group_id,alias=self.alias,session=self.session)) | python | def RootGroup(self):
"""Returns group object for datacenter root group.
>>> clc.v2.Datacenter().RootGroup()
<clc.APIv2.group.Group object at 0x105feacd0>
>>> print _
WA1 Hardware
"""
return(clc.v2.Group(id=self.root_group_id,alias=self.alias,session=self.session)) | [
"def",
"RootGroup",
"(",
"self",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Group",
"(",
"id",
"=",
"self",
".",
"root_group_id",
",",
"alias",
"=",
"self",
".",
"alias",
",",
"session",
"=",
"self",
".",
"session",
")",
")"
] | Returns group object for datacenter root group.
>>> clc.v2.Datacenter().RootGroup()
<clc.APIv2.group.Group object at 0x105feacd0>
>>> print _
WA1 Hardware | [
"Returns",
"group",
"object",
"for",
"datacenter",
"root",
"group",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/datacenter.py#L81-L91 | train |
pyfca/pyfca | pyfca/implications.py | LL | def LL(n):
"""constructs the LL context"""
if (n<=0):return Context('0')
else:
LL1=LL(n-1)
r1 = C1(3**(n-1),2**(n-1)) - LL1 - LL1
r2 = LL1 - LL1 - LL1
return r1 + r2 | python | def LL(n):
"""constructs the LL context"""
if (n<=0):return Context('0')
else:
LL1=LL(n-1)
r1 = C1(3**(n-1),2**(n-1)) - LL1 - LL1
r2 = LL1 - LL1 - LL1
return r1 + r2 | [
"def",
"LL",
"(",
"n",
")",
":",
"if",
"(",
"n",
"<=",
"0",
")",
":",
"return",
"Context",
"(",
"'0'",
")",
"else",
":",
"LL1",
"=",
"LL",
"(",
"n",
"-",
"1",
")",
"r1",
"=",
"C1",
"(",
"3",
"**",
"(",
"n",
"-",
"1",
")",
",",
"2",
"*... | constructs the LL context | [
"constructs",
"the",
"LL",
"context"
] | cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0 | https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L532-L539 | train |
pyfca/pyfca | pyfca/implications.py | HH | def HH(n):
"""constructs the HH context"""
if (n<=0):return Context('1')
else:
LL1=LL(n-1)
HH1=HH(n-1)
r1 = C1(3**(n-1),2**(n-1)) - LL1 - HH1
r2 = HH1 - HH1 - HH1
return r1 + r2 | python | def HH(n):
"""constructs the HH context"""
if (n<=0):return Context('1')
else:
LL1=LL(n-1)
HH1=HH(n-1)
r1 = C1(3**(n-1),2**(n-1)) - LL1 - HH1
r2 = HH1 - HH1 - HH1
return r1 + r2 | [
"def",
"HH",
"(",
"n",
")",
":",
"if",
"(",
"n",
"<=",
"0",
")",
":",
"return",
"Context",
"(",
"'1'",
")",
"else",
":",
"LL1",
"=",
"LL",
"(",
"n",
"-",
"1",
")",
"HH1",
"=",
"HH",
"(",
"n",
"-",
"1",
")",
"r1",
"=",
"C1",
"(",
"3",
... | constructs the HH context | [
"constructs",
"the",
"HH",
"context"
] | cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0 | https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L540-L548 | train |
pyfca/pyfca | pyfca/implications.py | AA | def AA(n):
"""constructs the AA context"""
if (n<=1):return Context('10\n00')
else:
AA1=AA(n-1)
r1 = C1(2**(n-1),2**(n-1)) - AA1
r2 = AA1 - AA1
return r1 + r2 | python | def AA(n):
"""constructs the AA context"""
if (n<=1):return Context('10\n00')
else:
AA1=AA(n-1)
r1 = C1(2**(n-1),2**(n-1)) - AA1
r2 = AA1 - AA1
return r1 + r2 | [
"def",
"AA",
"(",
"n",
")",
":",
"if",
"(",
"n",
"<=",
"1",
")",
":",
"return",
"Context",
"(",
"'10\\n00'",
")",
"else",
":",
"AA1",
"=",
"AA",
"(",
"n",
"-",
"1",
")",
"r1",
"=",
"C1",
"(",
"2",
"**",
"(",
"n",
"-",
"1",
")",
",",
"2"... | constructs the AA context | [
"constructs",
"the",
"AA",
"context"
] | cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0 | https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L550-L557 | train |
pyfca/pyfca | pyfca/implications.py | BB | def BB(n):
"""constructs the BB context"""
if (n<=1):return Context('0\n1')
else:
BB1=BB(n-1)
AA1=AA(n-1)
r1 = C1((n-1)*2**(n-2),2**(n-1)) - AA1 - BB1
r2 = BB1 - C1(2**(n-1),2**(n-1)) - BB1;
return r1 + r2 | python | def BB(n):
"""constructs the BB context"""
if (n<=1):return Context('0\n1')
else:
BB1=BB(n-1)
AA1=AA(n-1)
r1 = C1((n-1)*2**(n-2),2**(n-1)) - AA1 - BB1
r2 = BB1 - C1(2**(n-1),2**(n-1)) - BB1;
return r1 + r2 | [
"def",
"BB",
"(",
"n",
")",
":",
"if",
"(",
"n",
"<=",
"1",
")",
":",
"return",
"Context",
"(",
"'0\\n1'",
")",
"else",
":",
"BB1",
"=",
"BB",
"(",
"n",
"-",
"1",
")",
"AA1",
"=",
"AA",
"(",
"n",
"-",
"1",
")",
"r1",
"=",
"C1",
"(",
"("... | constructs the BB context | [
"constructs",
"the",
"BB",
"context"
] | cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0 | https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L558-L566 | train |
nickpandolfi/Cyther | cyther/instructions.py | Instruction.processAndSetDefaults | def processAndSetDefaults(self):
"""
The heart of the 'Instruction' object. This method will make sure that
all fields not entered will be defaulted to a correct value. Also
checks for incongruities in the data entered, if it was by the user.
"""
# INPUT, OUTPUT, GIVEN + ... | python | def processAndSetDefaults(self):
"""
The heart of the 'Instruction' object. This method will make sure that
all fields not entered will be defaulted to a correct value. Also
checks for incongruities in the data entered, if it was by the user.
"""
# INPUT, OUTPUT, GIVEN + ... | [
"def",
"processAndSetDefaults",
"(",
"self",
")",
":",
"# INPUT, OUTPUT, GIVEN + BUILDABLE DEPS",
"if",
"not",
"self",
".",
"input",
":",
"raise",
"ValueError",
"(",
"NO_INPUT_FILE",
")",
"if",
"not",
"self",
".",
"output",
":",
"# Build directory must exist, right?",... | The heart of the 'Instruction' object. This method will make sure that
all fields not entered will be defaulted to a correct value. Also
checks for incongruities in the data entered, if it was by the user. | [
"The",
"heart",
"of",
"the",
"Instruction",
"object",
".",
"This",
"method",
"will",
"make",
"sure",
"that",
"all",
"fields",
"not",
"entered",
"will",
"be",
"defaulted",
"to",
"a",
"correct",
"value",
".",
"Also",
"checks",
"for",
"incongruities",
"in",
"... | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/instructions.py#L53-L82 | train |
teepark/greenhouse | greenhouse/scheduler.py | greenlet | def greenlet(func, args=(), kwargs=None):
"""create a new greenlet from a function and arguments
:param func: the function the new greenlet should run
:type func: function
:param args: any positional arguments for the function
:type args: tuple
:param kwargs: any keyword arguments for the funct... | python | def greenlet(func, args=(), kwargs=None):
"""create a new greenlet from a function and arguments
:param func: the function the new greenlet should run
:type func: function
:param args: any positional arguments for the function
:type args: tuple
:param kwargs: any keyword arguments for the funct... | [
"def",
"greenlet",
"(",
"func",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"args",
"or",
"kwargs",
":",
"def",
"target",
"(",
")",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"(",
"kwargs",
"or",
"{",
... | create a new greenlet from a function and arguments
:param func: the function the new greenlet should run
:type func: function
:param args: any positional arguments for the function
:type args: tuple
:param kwargs: any keyword arguments for the function
:type kwargs: dict or None
the only ... | [
"create",
"a",
"new",
"greenlet",
"from",
"a",
"function",
"and",
"arguments"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L208-L228 | train |
teepark/greenhouse | greenhouse/scheduler.py | schedule | def schedule(target=None, args=(), kwargs=None):
"""insert a greenlet into the scheduler
If provided a function, it is wrapped in a new greenlet
:param target: what to schedule
:type target: function or greenlet
:param args:
arguments for the function (only used if ``target`` is a function... | python | def schedule(target=None, args=(), kwargs=None):
"""insert a greenlet into the scheduler
If provided a function, it is wrapped in a new greenlet
:param target: what to schedule
:type target: function or greenlet
:param args:
arguments for the function (only used if ``target`` is a function... | [
"def",
"schedule",
"(",
"target",
"=",
"None",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"target",
"is",
"None",
":",
"def",
"decorator",
"(",
"target",
")",
":",
"return",
"schedule",
"(",
"target",
",",
"args",
"=",
... | insert a greenlet into the scheduler
If provided a function, it is wrapped in a new greenlet
:param target: what to schedule
:type target: function or greenlet
:param args:
arguments for the function (only used if ``target`` is a function)
:type args: tuple
:param kwargs:
keywo... | [
"insert",
"a",
"greenlet",
"into",
"the",
"scheduler"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L263-L300 | train |
teepark/greenhouse | greenhouse/scheduler.py | schedule_at | def schedule_at(unixtime, target=None, args=(), kwargs=None):
"""insert a greenlet into the scheduler to be run at a set time
If provided a function, it is wrapped in a new greenlet
:param unixtime:
the unix timestamp at which the new greenlet should be started
:type unixtime: int or float
... | python | def schedule_at(unixtime, target=None, args=(), kwargs=None):
"""insert a greenlet into the scheduler to be run at a set time
If provided a function, it is wrapped in a new greenlet
:param unixtime:
the unix timestamp at which the new greenlet should be started
:type unixtime: int or float
... | [
"def",
"schedule_at",
"(",
"unixtime",
",",
"target",
"=",
"None",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"target",
"is",
"None",
":",
"def",
"decorator",
"(",
"target",
")",
":",
"return",
"schedule_at",
"(",
"unixti... | insert a greenlet into the scheduler to be run at a set time
If provided a function, it is wrapped in a new greenlet
:param unixtime:
the unix timestamp at which the new greenlet should be started
:type unixtime: int or float
:param target: what to schedule
:type target: function or greenl... | [
"insert",
"a",
"greenlet",
"into",
"the",
"scheduler",
"to",
"be",
"run",
"at",
"a",
"set",
"time"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L303-L344 | train |
teepark/greenhouse | greenhouse/scheduler.py | schedule_in | def schedule_in(secs, target=None, args=(), kwargs=None):
"""insert a greenlet into the scheduler to run after a set time
If provided a function, it is wrapped in a new greenlet
:param secs: the number of seconds to wait before running the target
:type unixtime: int or float
:param target: what to... | python | def schedule_in(secs, target=None, args=(), kwargs=None):
"""insert a greenlet into the scheduler to run after a set time
If provided a function, it is wrapped in a new greenlet
:param secs: the number of seconds to wait before running the target
:type unixtime: int or float
:param target: what to... | [
"def",
"schedule_in",
"(",
"secs",
",",
"target",
"=",
"None",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"None",
")",
":",
"return",
"schedule_at",
"(",
"time",
".",
"time",
"(",
")",
"+",
"secs",
",",
"target",
",",
"args",
",",
"kwargs",
... | insert a greenlet into the scheduler to run after a set time
If provided a function, it is wrapped in a new greenlet
:param secs: the number of seconds to wait before running the target
:type unixtime: int or float
:param target: what to schedule
:type target: function or greenlet
:param args:... | [
"insert",
"a",
"greenlet",
"into",
"the",
"scheduler",
"to",
"run",
"after",
"a",
"set",
"time"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L347-L378 | train |
teepark/greenhouse | greenhouse/scheduler.py | schedule_recurring | def schedule_recurring(interval, target=None, maxtimes=0, starting_at=0,
args=(), kwargs=None):
"""insert a greenlet into the scheduler to run regularly at an interval
If provided a function, it is wrapped in a new greenlet
:param interval: the number of seconds between invocations
... | python | def schedule_recurring(interval, target=None, maxtimes=0, starting_at=0,
args=(), kwargs=None):
"""insert a greenlet into the scheduler to run regularly at an interval
If provided a function, it is wrapped in a new greenlet
:param interval: the number of seconds between invocations
... | [
"def",
"schedule_recurring",
"(",
"interval",
",",
"target",
"=",
"None",
",",
"maxtimes",
"=",
"0",
",",
"starting_at",
"=",
"0",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"None",
")",
":",
"starting_at",
"=",
"starting_at",
"or",
"time",
".",
... | insert a greenlet into the scheduler to run regularly at an interval
If provided a function, it is wrapped in a new greenlet
:param interval: the number of seconds between invocations
:type interval: int or float
:param target: what to schedule
:type target: function or greenlet
:param maxtime... | [
"insert",
"a",
"greenlet",
"into",
"the",
"scheduler",
"to",
"run",
"regularly",
"at",
"an",
"interval"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L381-L442 | train |
teepark/greenhouse | greenhouse/scheduler.py | schedule_exception | def schedule_exception(exception, target):
"""schedule a greenlet to have an exception raised in it immediately
:param exception: the exception to raise in the greenlet
:type exception: Exception
:param target: the greenlet that should receive the exception
:type target: greenlet
"""
if not... | python | def schedule_exception(exception, target):
"""schedule a greenlet to have an exception raised in it immediately
:param exception: the exception to raise in the greenlet
:type exception: Exception
:param target: the greenlet that should receive the exception
:type target: greenlet
"""
if not... | [
"def",
"schedule_exception",
"(",
"exception",
",",
"target",
")",
":",
"if",
"not",
"isinstance",
"(",
"target",
",",
"compat",
".",
"greenlet",
")",
":",
"raise",
"TypeError",
"(",
"\"can only schedule exceptions for greenlets\"",
")",
"if",
"target",
".",
"de... | schedule a greenlet to have an exception raised in it immediately
:param exception: the exception to raise in the greenlet
:type exception: Exception
:param target: the greenlet that should receive the exception
:type target: greenlet | [
"schedule",
"a",
"greenlet",
"to",
"have",
"an",
"exception",
"raised",
"in",
"it",
"immediately"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L445-L458 | train |
teepark/greenhouse | greenhouse/scheduler.py | schedule_exception_at | def schedule_exception_at(unixtime, exception, target):
"""schedule a greenlet to have an exception raised at a unix timestamp
:param unixtime: when to raise the exception in the target
:type unixtime: int or float
:param exception: the exception to raise in the greenlet
:type exception: Exception
... | python | def schedule_exception_at(unixtime, exception, target):
"""schedule a greenlet to have an exception raised at a unix timestamp
:param unixtime: when to raise the exception in the target
:type unixtime: int or float
:param exception: the exception to raise in the greenlet
:type exception: Exception
... | [
"def",
"schedule_exception_at",
"(",
"unixtime",
",",
"exception",
",",
"target",
")",
":",
"if",
"not",
"isinstance",
"(",
"target",
",",
"compat",
".",
"greenlet",
")",
":",
"raise",
"TypeError",
"(",
"\"can only schedule exceptions for greenlets\"",
")",
"if",
... | schedule a greenlet to have an exception raised at a unix timestamp
:param unixtime: when to raise the exception in the target
:type unixtime: int or float
:param exception: the exception to raise in the greenlet
:type exception: Exception
:param target: the greenlet that should receive the excepti... | [
"schedule",
"a",
"greenlet",
"to",
"have",
"an",
"exception",
"raised",
"at",
"a",
"unix",
"timestamp"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L461-L476 | train |
teepark/greenhouse | greenhouse/scheduler.py | schedule_exception_in | def schedule_exception_in(secs, exception, target):
"""schedule a greenlet receive an exception after a number of seconds
:param secs: the number of seconds to wait before raising
:type secs: int or float
:param exception: the exception to raise in the greenlet
:type exception: Exception
:param... | python | def schedule_exception_in(secs, exception, target):
"""schedule a greenlet receive an exception after a number of seconds
:param secs: the number of seconds to wait before raising
:type secs: int or float
:param exception: the exception to raise in the greenlet
:type exception: Exception
:param... | [
"def",
"schedule_exception_in",
"(",
"secs",
",",
"exception",
",",
"target",
")",
":",
"schedule_exception_at",
"(",
"time",
".",
"time",
"(",
")",
"+",
"secs",
",",
"exception",
",",
"target",
")"
] | schedule a greenlet receive an exception after a number of seconds
:param secs: the number of seconds to wait before raising
:type secs: int or float
:param exception: the exception to raise in the greenlet
:type exception: Exception
:param target: the greenlet that should receive the exception
... | [
"schedule",
"a",
"greenlet",
"receive",
"an",
"exception",
"after",
"a",
"number",
"of",
"seconds"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L479-L489 | train |
teepark/greenhouse | greenhouse/scheduler.py | end | def end(target):
"""schedule a greenlet to be stopped immediately
:param target: the greenlet to end
:type target: greenlet
"""
if not isinstance(target, compat.greenlet):
raise TypeError("argument must be a greenlet")
if not target.dead:
schedule(target)
state.to_raise[... | python | def end(target):
"""schedule a greenlet to be stopped immediately
:param target: the greenlet to end
:type target: greenlet
"""
if not isinstance(target, compat.greenlet):
raise TypeError("argument must be a greenlet")
if not target.dead:
schedule(target)
state.to_raise[... | [
"def",
"end",
"(",
"target",
")",
":",
"if",
"not",
"isinstance",
"(",
"target",
",",
"compat",
".",
"greenlet",
")",
":",
"raise",
"TypeError",
"(",
"\"argument must be a greenlet\"",
")",
"if",
"not",
"target",
".",
"dead",
":",
"schedule",
"(",
"target"... | schedule a greenlet to be stopped immediately
:param target: the greenlet to end
:type target: greenlet | [
"schedule",
"a",
"greenlet",
"to",
"be",
"stopped",
"immediately"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L492-L502 | train |
teepark/greenhouse | greenhouse/scheduler.py | handle_exception | def handle_exception(klass, exc, tb, coro=None):
"""run all the registered exception handlers
the first 3 arguments to this function match the output of
``sys.exc_info()``
:param klass: the exception klass
:type klass: type
:param exc: the exception instance
:type exc: Exception
:param... | python | def handle_exception(klass, exc, tb, coro=None):
"""run all the registered exception handlers
the first 3 arguments to this function match the output of
``sys.exc_info()``
:param klass: the exception klass
:type klass: type
:param exc: the exception instance
:type exc: Exception
:param... | [
"def",
"handle_exception",
"(",
"klass",
",",
"exc",
",",
"tb",
",",
"coro",
"=",
"None",
")",
":",
"if",
"coro",
"is",
"None",
":",
"coro",
"=",
"compat",
".",
"getcurrent",
"(",
")",
"replacement",
"=",
"[",
"]",
"for",
"weak",
"in",
"state",
"."... | run all the registered exception handlers
the first 3 arguments to this function match the output of
``sys.exc_info()``
:param klass: the exception klass
:type klass: type
:param exc: the exception instance
:type exc: Exception
:param tb: the traceback object
:type tb: Traceback
:p... | [
"run",
"all",
"the",
"registered",
"exception",
"handlers"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L606-L659 | train |
teepark/greenhouse | greenhouse/scheduler.py | global_exception_handler | def global_exception_handler(handler):
"""add a callback for when an exception goes uncaught in any greenlet
:param handler:
the callback function. must be a function taking 3 arguments:
- ``klass`` the exception class
- ``exc`` the exception instance
- ``tb`` the traceback obj... | python | def global_exception_handler(handler):
"""add a callback for when an exception goes uncaught in any greenlet
:param handler:
the callback function. must be a function taking 3 arguments:
- ``klass`` the exception class
- ``exc`` the exception instance
- ``tb`` the traceback obj... | [
"def",
"global_exception_handler",
"(",
"handler",
")",
":",
"if",
"not",
"hasattr",
"(",
"handler",
",",
"\"__call__\"",
")",
":",
"raise",
"TypeError",
"(",
"\"exception handlers must be callable\"",
")",
"log",
".",
"info",
"(",
"\"setting a new global exception ha... | add a callback for when an exception goes uncaught in any greenlet
:param handler:
the callback function. must be a function taking 3 arguments:
- ``klass`` the exception class
- ``exc`` the exception instance
- ``tb`` the traceback object
:type handler: function
Note also... | [
"add",
"a",
"callback",
"for",
"when",
"an",
"exception",
"goes",
"uncaught",
"in",
"any",
"greenlet"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L662-L682 | train |
teepark/greenhouse | greenhouse/scheduler.py | remove_global_exception_handler | def remove_global_exception_handler(handler):
"""remove a callback from the list of global exception handlers
:param handler:
the callback, previously added via :func:`global_exception_handler`,
to remove
:type handler: function
:returns: bool, whether the handler was found (and theref... | python | def remove_global_exception_handler(handler):
"""remove a callback from the list of global exception handlers
:param handler:
the callback, previously added via :func:`global_exception_handler`,
to remove
:type handler: function
:returns: bool, whether the handler was found (and theref... | [
"def",
"remove_global_exception_handler",
"(",
"handler",
")",
":",
"for",
"i",
",",
"cb",
"in",
"enumerate",
"(",
"state",
".",
"global_exception_handlers",
")",
":",
"cb",
"=",
"cb",
"(",
")",
"if",
"cb",
"is",
"not",
"None",
"and",
"cb",
"is",
"handle... | remove a callback from the list of global exception handlers
:param handler:
the callback, previously added via :func:`global_exception_handler`,
to remove
:type handler: function
:returns: bool, whether the handler was found (and therefore removed) | [
"remove",
"a",
"callback",
"from",
"the",
"list",
"of",
"global",
"exception",
"handlers"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L685-L701 | train |
teepark/greenhouse | greenhouse/scheduler.py | local_exception_handler | def local_exception_handler(handler=None, coro=None):
"""add a callback for when an exception occurs in a particular greenlet
:param handler:
the callback function, must be a function taking 3 arguments:
- ``klass`` the exception class
- ``exc`` the exception instance
- ``tb`` ... | python | def local_exception_handler(handler=None, coro=None):
"""add a callback for when an exception occurs in a particular greenlet
:param handler:
the callback function, must be a function taking 3 arguments:
- ``klass`` the exception class
- ``exc`` the exception instance
- ``tb`` ... | [
"def",
"local_exception_handler",
"(",
"handler",
"=",
"None",
",",
"coro",
"=",
"None",
")",
":",
"if",
"handler",
"is",
"None",
":",
"return",
"lambda",
"h",
":",
"local_exception_handler",
"(",
"h",
",",
"coro",
")",
"if",
"not",
"hasattr",
"(",
"hand... | add a callback for when an exception occurs in a particular greenlet
:param handler:
the callback function, must be a function taking 3 arguments:
- ``klass`` the exception class
- ``exc`` the exception instance
- ``tb`` the traceback object
:type handler: function
:param c... | [
"add",
"a",
"callback",
"for",
"when",
"an",
"exception",
"occurs",
"in",
"a",
"particular",
"greenlet"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L704-L733 | train |
teepark/greenhouse | greenhouse/scheduler.py | remove_local_exception_handler | def remove_local_exception_handler(handler, coro=None):
"""remove a callback from the list of exception handlers for a coroutine
:param handler: the callback to remove
:type handler: function
:param coro: the coroutine for which to remove the local handler
:type coro: greenlet
:returns: bool, ... | python | def remove_local_exception_handler(handler, coro=None):
"""remove a callback from the list of exception handlers for a coroutine
:param handler: the callback to remove
:type handler: function
:param coro: the coroutine for which to remove the local handler
:type coro: greenlet
:returns: bool, ... | [
"def",
"remove_local_exception_handler",
"(",
"handler",
",",
"coro",
"=",
"None",
")",
":",
"if",
"coro",
"is",
"None",
":",
"coro",
"=",
"compat",
".",
"getcurrent",
"(",
")",
"for",
"i",
",",
"cb",
"in",
"enumerate",
"(",
"state",
".",
"local_exceptio... | remove a callback from the list of exception handlers for a coroutine
:param handler: the callback to remove
:type handler: function
:param coro: the coroutine for which to remove the local handler
:type coro: greenlet
:returns: bool, whether the handler was found (and therefore removed) | [
"remove",
"a",
"callback",
"from",
"the",
"list",
"of",
"exception",
"handlers",
"for",
"a",
"coroutine"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L736-L755 | train |
teepark/greenhouse | greenhouse/scheduler.py | global_hook | def global_hook(handler):
"""add a callback to run in every switch between coroutines
:param handler:
the callback function, must be a function taking 2 arguments:
- the greenlet being switched from
- the greenlet being switched to
be aware that only a weak reference to this f... | python | def global_hook(handler):
"""add a callback to run in every switch between coroutines
:param handler:
the callback function, must be a function taking 2 arguments:
- the greenlet being switched from
- the greenlet being switched to
be aware that only a weak reference to this f... | [
"def",
"global_hook",
"(",
"handler",
")",
":",
"if",
"not",
"hasattr",
"(",
"handler",
",",
"\"__call__\"",
")",
":",
"raise",
"TypeError",
"(",
"\"trace hooks must be callable\"",
")",
"log",
".",
"info",
"(",
"\"setting a new global hook callback\"",
")",
"stat... | add a callback to run in every switch between coroutines
:param handler:
the callback function, must be a function taking 2 arguments:
- the greenlet being switched from
- the greenlet being switched to
be aware that only a weak reference to this function will be held.
:type h... | [
"add",
"a",
"callback",
"to",
"run",
"in",
"every",
"switch",
"between",
"coroutines"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L758-L776 | train |
teepark/greenhouse | greenhouse/scheduler.py | remove_global_hook | def remove_global_hook(handler):
"""remove a callback from the list of global hooks
:param handler:
the callback function, previously added with global_hook, to remove
from the list of global hooks
:type handler: function
:returns: bool, whether the handler was removed from the global ... | python | def remove_global_hook(handler):
"""remove a callback from the list of global hooks
:param handler:
the callback function, previously added with global_hook, to remove
from the list of global hooks
:type handler: function
:returns: bool, whether the handler was removed from the global ... | [
"def",
"remove_global_hook",
"(",
"handler",
")",
":",
"for",
"i",
",",
"cb",
"in",
"enumerate",
"(",
"state",
".",
"global_hooks",
")",
":",
"cb",
"=",
"cb",
"(",
")",
"if",
"cb",
"is",
"not",
"None",
"and",
"cb",
"is",
"handler",
":",
"state",
".... | remove a callback from the list of global hooks
:param handler:
the callback function, previously added with global_hook, to remove
from the list of global hooks
:type handler: function
:returns: bool, whether the handler was removed from the global hooks | [
"remove",
"a",
"callback",
"from",
"the",
"list",
"of",
"global",
"hooks"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L779-L795 | train |
teepark/greenhouse | greenhouse/scheduler.py | local_incoming_hook | def local_incoming_hook(handler=None, coro=None):
"""add a callback to run every time a greenlet is about to be switched to
:param handler:
the callback function, must be a function taking 2 arguments:
- an integer indicating whether it is being called as an incoming (1)
hook or an o... | python | def local_incoming_hook(handler=None, coro=None):
"""add a callback to run every time a greenlet is about to be switched to
:param handler:
the callback function, must be a function taking 2 arguments:
- an integer indicating whether it is being called as an incoming (1)
hook or an o... | [
"def",
"local_incoming_hook",
"(",
"handler",
"=",
"None",
",",
"coro",
"=",
"None",
")",
":",
"if",
"handler",
"is",
"None",
":",
"return",
"lambda",
"h",
":",
"local_incoming_hook",
"(",
"h",
",",
"coro",
")",
"if",
"not",
"hasattr",
"(",
"handler",
... | add a callback to run every time a greenlet is about to be switched to
:param handler:
the callback function, must be a function taking 2 arguments:
- an integer indicating whether it is being called as an incoming (1)
hook or an outgoing (2) hook (in this case it will always receive 1).... | [
"add",
"a",
"callback",
"to",
"run",
"every",
"time",
"a",
"greenlet",
"is",
"about",
"to",
"be",
"switched",
"to"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L798-L830 | train |
teepark/greenhouse | greenhouse/scheduler.py | remove_local_incoming_hook | def remove_local_incoming_hook(handler, coro=None):
"""remove a callback from the incoming hooks for a particular coro
:param handler: the callback previously added via local_incoming_hook
:type handler: function
:param coro: the coroutine for which the hook should be removed
:type coro: greenlet
... | python | def remove_local_incoming_hook(handler, coro=None):
"""remove a callback from the incoming hooks for a particular coro
:param handler: the callback previously added via local_incoming_hook
:type handler: function
:param coro: the coroutine for which the hook should be removed
:type coro: greenlet
... | [
"def",
"remove_local_incoming_hook",
"(",
"handler",
",",
"coro",
"=",
"None",
")",
":",
"if",
"coro",
"is",
"None",
":",
"coro",
"=",
"compat",
".",
"getcurrent",
"(",
")",
"for",
"i",
",",
"cb",
"in",
"enumerate",
"(",
"state",
".",
"local_to_hooks",
... | remove a callback from the incoming hooks for a particular coro
:param handler: the callback previously added via local_incoming_hook
:type handler: function
:param coro: the coroutine for which the hook should be removed
:type coro: greenlet
:returns: bool, whether the handler was found and remov... | [
"remove",
"a",
"callback",
"from",
"the",
"incoming",
"hooks",
"for",
"a",
"particular",
"coro"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L833-L852 | train |
teepark/greenhouse | greenhouse/scheduler.py | local_outgoing_hook | def local_outgoing_hook(handler=None, coro=None):
"""add a callback to run every time a greenlet is switched away from
:param handler:
the callback function, must be a function taking 2 arguments:
- an integer indicating whether it is being called as an incoming (1)
hook or as an out... | python | def local_outgoing_hook(handler=None, coro=None):
"""add a callback to run every time a greenlet is switched away from
:param handler:
the callback function, must be a function taking 2 arguments:
- an integer indicating whether it is being called as an incoming (1)
hook or as an out... | [
"def",
"local_outgoing_hook",
"(",
"handler",
"=",
"None",
",",
"coro",
"=",
"None",
")",
":",
"if",
"handler",
"is",
"None",
":",
"return",
"lambda",
"h",
":",
"local_outgoing_hook",
"(",
"h",
",",
"coro",
")",
"if",
"not",
"hasattr",
"(",
"handler",
... | add a callback to run every time a greenlet is switched away from
:param handler:
the callback function, must be a function taking 2 arguments:
- an integer indicating whether it is being called as an incoming (1)
hook or as an outgoing (2) hook (in this case it will always be 2).
... | [
"add",
"a",
"callback",
"to",
"run",
"every",
"time",
"a",
"greenlet",
"is",
"switched",
"away",
"from"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L855-L886 | train |
teepark/greenhouse | greenhouse/scheduler.py | remove_local_outgoing_hook | def remove_local_outgoing_hook(handler, coro=None):
"""remove a callback from the outgoing hooks for a particular coro
:param handler: the callback previously added via local_outgoing_hook
:type handler: function
:param coro: the coroutine for which the hook should be removed
:type coro: greenlet
... | python | def remove_local_outgoing_hook(handler, coro=None):
"""remove a callback from the outgoing hooks for a particular coro
:param handler: the callback previously added via local_outgoing_hook
:type handler: function
:param coro: the coroutine for which the hook should be removed
:type coro: greenlet
... | [
"def",
"remove_local_outgoing_hook",
"(",
"handler",
",",
"coro",
"=",
"None",
")",
":",
"if",
"coro",
"is",
"None",
":",
"coro",
"=",
"compat",
".",
"getcurrent",
"(",
")",
"for",
"i",
",",
"cb",
"in",
"enumerate",
"(",
"state",
".",
"local_from_hooks",... | remove a callback from the outgoing hooks for a particular coro
:param handler: the callback previously added via local_outgoing_hook
:type handler: function
:param coro: the coroutine for which the hook should be removed
:type coro: greenlet
:returns: bool, whether the handler was found and remov... | [
"remove",
"a",
"callback",
"from",
"the",
"outgoing",
"hooks",
"for",
"a",
"particular",
"coro"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L889-L908 | train |
teepark/greenhouse | greenhouse/scheduler.py | set_ignore_interrupts | def set_ignore_interrupts(flag=True):
"""turn off EINTR-raising from emulated syscalls on interruption by signals
due to the nature of greenhouse's system call emulation,
``signal.siginterrupt`` can't be made to work with it. specifically,
greenhouse can't differentiate between different signals. so th... | python | def set_ignore_interrupts(flag=True):
"""turn off EINTR-raising from emulated syscalls on interruption by signals
due to the nature of greenhouse's system call emulation,
``signal.siginterrupt`` can't be made to work with it. specifically,
greenhouse can't differentiate between different signals. so th... | [
"def",
"set_ignore_interrupts",
"(",
"flag",
"=",
"True",
")",
":",
"log",
".",
"info",
"(",
"\"setting ignore_interrupts to %r\"",
"%",
"flag",
")",
"state",
".",
"ignore_interrupts",
"=",
"bool",
"(",
"flag",
")"
] | turn off EINTR-raising from emulated syscalls on interruption by signals
due to the nature of greenhouse's system call emulation,
``signal.siginterrupt`` can't be made to work with it. specifically,
greenhouse can't differentiate between different signals. so this function
toggles whether to restart fo... | [
"turn",
"off",
"EINTR",
"-",
"raising",
"from",
"emulated",
"syscalls",
"on",
"interruption",
"by",
"signals"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L911-L924 | train |
teepark/greenhouse | greenhouse/scheduler.py | reset_poller | def reset_poller(poll=None):
"""replace the scheduler's poller, throwing away any pre-existing state
this is only really a good idea in the new child process after a fork(2).
"""
state.poller = poll or poller.best()
log.info("resetting fd poller, using %s" % type(state.poller).__name__) | python | def reset_poller(poll=None):
"""replace the scheduler's poller, throwing away any pre-existing state
this is only really a good idea in the new child process after a fork(2).
"""
state.poller = poll or poller.best()
log.info("resetting fd poller, using %s" % type(state.poller).__name__) | [
"def",
"reset_poller",
"(",
"poll",
"=",
"None",
")",
":",
"state",
".",
"poller",
"=",
"poll",
"or",
"poller",
".",
"best",
"(",
")",
"log",
".",
"info",
"(",
"\"resetting fd poller, using %s\"",
"%",
"type",
"(",
"state",
".",
"poller",
")",
".",
"__... | replace the scheduler's poller, throwing away any pre-existing state
this is only really a good idea in the new child process after a fork(2). | [
"replace",
"the",
"scheduler",
"s",
"poller",
"throwing",
"away",
"any",
"pre",
"-",
"existing",
"state"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L927-L933 | train |
nickpandolfi/Cyther | cyther/tools.py | find_resource | def find_resource(r, *, pkg='cyther'):
"""
Finds a given cyther resource in the 'test' subdirectory in
'cyther' package
"""
file_path = pkg_resources.resource_filename(pkg, os.path.join('test', r))
if not os.path.isfile(file_path):
msg = "Resource '{}' does not exist"
raise FileN... | python | def find_resource(r, *, pkg='cyther'):
"""
Finds a given cyther resource in the 'test' subdirectory in
'cyther' package
"""
file_path = pkg_resources.resource_filename(pkg, os.path.join('test', r))
if not os.path.isfile(file_path):
msg = "Resource '{}' does not exist"
raise FileN... | [
"def",
"find_resource",
"(",
"r",
",",
"*",
",",
"pkg",
"=",
"'cyther'",
")",
":",
"file_path",
"=",
"pkg_resources",
".",
"resource_filename",
"(",
"pkg",
",",
"os",
".",
"path",
".",
"join",
"(",
"'test'",
",",
"r",
")",
")",
"if",
"not",
"os",
"... | Finds a given cyther resource in the 'test' subdirectory in
'cyther' package | [
"Finds",
"a",
"given",
"cyther",
"resource",
"in",
"the",
"test",
"subdirectory",
"in",
"cyther",
"package"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L17-L26 | train |
nickpandolfi/Cyther | cyther/tools.py | assert_output | def assert_output(output, assert_equal):
"""
Check that two outputs have the same contents as one another, even if they
aren't sorted yet
"""
sorted_output = sorted(output)
sorted_assert = sorted(assert_equal)
if sorted_output != sorted_assert:
raise ValueError(ASSERT_ERROR.format(so... | python | def assert_output(output, assert_equal):
"""
Check that two outputs have the same contents as one another, even if they
aren't sorted yet
"""
sorted_output = sorted(output)
sorted_assert = sorted(assert_equal)
if sorted_output != sorted_assert:
raise ValueError(ASSERT_ERROR.format(so... | [
"def",
"assert_output",
"(",
"output",
",",
"assert_equal",
")",
":",
"sorted_output",
"=",
"sorted",
"(",
"output",
")",
"sorted_assert",
"=",
"sorted",
"(",
"assert_equal",
")",
"if",
"sorted_output",
"!=",
"sorted_assert",
":",
"raise",
"ValueError",
"(",
"... | Check that two outputs have the same contents as one another, even if they
aren't sorted yet | [
"Check",
"that",
"two",
"outputs",
"have",
"the",
"same",
"contents",
"as",
"one",
"another",
"even",
"if",
"they",
"aren",
"t",
"sorted",
"yet"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L78-L86 | train |
nickpandolfi/Cyther | cyther/tools.py | write_dict_to_file | def write_dict_to_file(file_path, obj):
"""
Write a dictionary of string keys to a file
"""
lines = []
for key, value in obj.items():
lines.append(key + ':' + repr(value) + '\n')
with open(file_path, 'w+') as file:
file.writelines(lines)
return None | python | def write_dict_to_file(file_path, obj):
"""
Write a dictionary of string keys to a file
"""
lines = []
for key, value in obj.items():
lines.append(key + ':' + repr(value) + '\n')
with open(file_path, 'w+') as file:
file.writelines(lines)
return None | [
"def",
"write_dict_to_file",
"(",
"file_path",
",",
"obj",
")",
":",
"lines",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"obj",
".",
"items",
"(",
")",
":",
"lines",
".",
"append",
"(",
"key",
"+",
"':'",
"+",
"repr",
"(",
"value",
")",
"+"... | Write a dictionary of string keys to a file | [
"Write",
"a",
"dictionary",
"of",
"string",
"keys",
"to",
"a",
"file"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L89-L100 | train |
nickpandolfi/Cyther | cyther/tools.py | read_dict_from_file | def read_dict_from_file(file_path):
"""
Read a dictionary of strings from a file
"""
with open(file_path) as file:
lines = file.read().splitlines()
obj = {}
for line in lines:
key, value = line.split(':', maxsplit=1)
obj[key] = eval(value)
return obj | python | def read_dict_from_file(file_path):
"""
Read a dictionary of strings from a file
"""
with open(file_path) as file:
lines = file.read().splitlines()
obj = {}
for line in lines:
key, value = line.split(':', maxsplit=1)
obj[key] = eval(value)
return obj | [
"def",
"read_dict_from_file",
"(",
"file_path",
")",
":",
"with",
"open",
"(",
"file_path",
")",
"as",
"file",
":",
"lines",
"=",
"file",
".",
"read",
"(",
")",
".",
"splitlines",
"(",
")",
"obj",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"... | Read a dictionary of strings from a file | [
"Read",
"a",
"dictionary",
"of",
"strings",
"from",
"a",
"file"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L103-L115 | train |
nickpandolfi/Cyther | cyther/tools.py | get_input | def get_input(prompt, check, *, redo_prompt=None, repeat_prompt=False):
"""
Ask the user to input something on the terminal level, check their response
and ask again if they didn't answer correctly
"""
if isinstance(check, str):
check = (check,)
to_join = []
for item in check:
... | python | def get_input(prompt, check, *, redo_prompt=None, repeat_prompt=False):
"""
Ask the user to input something on the terminal level, check their response
and ask again if they didn't answer correctly
"""
if isinstance(check, str):
check = (check,)
to_join = []
for item in check:
... | [
"def",
"get_input",
"(",
"prompt",
",",
"check",
",",
"*",
",",
"redo_prompt",
"=",
"None",
",",
"repeat_prompt",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"check",
",",
"str",
")",
":",
"check",
"=",
"(",
"check",
",",
")",
"to_join",
"=",
... | Ask the user to input something on the terminal level, check their response
and ask again if they didn't answer correctly | [
"Ask",
"the",
"user",
"to",
"input",
"something",
"on",
"the",
"terminal",
"level",
"check",
"their",
"response",
"and",
"ask",
"again",
"if",
"they",
"didn",
"t",
"answer",
"correctly"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L121-L155 | train |
nickpandolfi/Cyther | cyther/tools.py | get_choice | def get_choice(prompt, choices):
"""
Asks for a single choice out of multiple items.
Given those items, and a prompt to ask the user with
"""
print()
checker = []
for offset, choice in enumerate(choices):
number = offset + 1
print("\t{}): '{}'\n".format(number, choice))
... | python | def get_choice(prompt, choices):
"""
Asks for a single choice out of multiple items.
Given those items, and a prompt to ask the user with
"""
print()
checker = []
for offset, choice in enumerate(choices):
number = offset + 1
print("\t{}): '{}'\n".format(number, choice))
... | [
"def",
"get_choice",
"(",
"prompt",
",",
"choices",
")",
":",
"print",
"(",
")",
"checker",
"=",
"[",
"]",
"for",
"offset",
",",
"choice",
"in",
"enumerate",
"(",
"choices",
")",
":",
"number",
"=",
"offset",
"+",
"1",
"print",
"(",
"\"\\t{}): '{}'\\n\... | Asks for a single choice out of multiple items.
Given those items, and a prompt to ask the user with | [
"Asks",
"for",
"a",
"single",
"choice",
"out",
"of",
"multiple",
"items",
".",
"Given",
"those",
"items",
"and",
"a",
"prompt",
"to",
"ask",
"the",
"user",
"with"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L158-L178 | train |
nickpandolfi/Cyther | cyther/tools.py | generateBatches | def generateBatches(tasks, givens):
"""
A function to generate a batch of commands to run in a specific order as to
meet all the dependencies for each command. For example, the commands with
no dependencies are run first, and the commands with the most deep
dependencies are run last
"""
_rem... | python | def generateBatches(tasks, givens):
"""
A function to generate a batch of commands to run in a specific order as to
meet all the dependencies for each command. For example, the commands with
no dependencies are run first, and the commands with the most deep
dependencies are run last
"""
_rem... | [
"def",
"generateBatches",
"(",
"tasks",
",",
"givens",
")",
":",
"_removeGivensFromTasks",
"(",
"tasks",
",",
"givens",
")",
"batches",
"=",
"[",
"]",
"while",
"tasks",
":",
"batch",
"=",
"set",
"(",
")",
"for",
"task",
",",
"dependencies",
"in",
"tasks"... | A function to generate a batch of commands to run in a specific order as to
meet all the dependencies for each command. For example, the commands with
no dependencies are run first, and the commands with the most deep
dependencies are run last | [
"A",
"function",
"to",
"generate",
"a",
"batch",
"of",
"commands",
"to",
"run",
"in",
"a",
"specific",
"order",
"as",
"to",
"meet",
"all",
"the",
"dependencies",
"for",
"each",
"command",
".",
"For",
"example",
"the",
"commands",
"with",
"no",
"dependencie... | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L191-L219 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/group.py | Groups.Get | def Get(self,key):
"""Get group by providing name, ID, description or other unique key.
If key is not unique and finds multiple matches only the first
will be returned
>>> clc.v2.Datacenter().Groups().Get("Default Group")
<clc.APIv2.group.Group object at 0x1065e5250>
"""
for group in self.groups:
i... | python | def Get(self,key):
"""Get group by providing name, ID, description or other unique key.
If key is not unique and finds multiple matches only the first
will be returned
>>> clc.v2.Datacenter().Groups().Get("Default Group")
<clc.APIv2.group.Group object at 0x1065e5250>
"""
for group in self.groups:
i... | [
"def",
"Get",
"(",
"self",
",",
"key",
")",
":",
"for",
"group",
"in",
"self",
".",
"groups",
":",
"if",
"group",
".",
"id",
".",
"lower",
"(",
")",
"==",
"key",
".",
"lower",
"(",
")",
":",
"return",
"(",
"group",
")",
"elif",
"group",
".",
... | Get group by providing name, ID, description or other unique key.
If key is not unique and finds multiple matches only the first
will be returned
>>> clc.v2.Datacenter().Groups().Get("Default Group")
<clc.APIv2.group.Group object at 0x1065e5250> | [
"Get",
"group",
"by",
"providing",
"name",
"ID",
"description",
"or",
"other",
"unique",
"key",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L65-L81 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/group.py | Groups.Search | def Search(self,key):
"""Search group list by providing partial name, ID, description or other key.
>>> clc.v2.Datacenter().Groups().Search("Default Group")
[<clc.APIv2.group.Group object at 0x1065b0f50>, <clc.APIv2.group.Group object at 0x1065b0d10>]
"""
results = []
for group in self.groups:
if grou... | python | def Search(self,key):
"""Search group list by providing partial name, ID, description or other key.
>>> clc.v2.Datacenter().Groups().Search("Default Group")
[<clc.APIv2.group.Group object at 0x1065b0f50>, <clc.APIv2.group.Group object at 0x1065b0d10>]
"""
results = []
for group in self.groups:
if grou... | [
"def",
"Search",
"(",
"self",
",",
"key",
")",
":",
"results",
"=",
"[",
"]",
"for",
"group",
"in",
"self",
".",
"groups",
":",
"if",
"group",
".",
"id",
".",
"lower",
"(",
")",
".",
"find",
"(",
"key",
".",
"lower",
"(",
")",
")",
"!=",
"-",... | Search group list by providing partial name, ID, description or other key.
>>> clc.v2.Datacenter().Groups().Search("Default Group")
[<clc.APIv2.group.Group object at 0x1065b0f50>, <clc.APIv2.group.Group object at 0x1065b0d10>] | [
"Search",
"group",
"list",
"by",
"providing",
"partial",
"name",
"ID",
"description",
"or",
"other",
"key",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L84-L98 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/group.py | Group.GetAll | def GetAll(root_group_id,alias=None,session=None):
"""Gets a list of groups within a given account.
>>> clc.v2.Group.GetAll("wa1-4416")
[<clc.APIv2.group.Group object at 0x1065b0190>, <clc.APIv2.group.Group object at 0x1065b0dd0>]
"""
if not alias: alias = clc.v2.Account.GetAlias(session=session)
groups... | python | def GetAll(root_group_id,alias=None,session=None):
"""Gets a list of groups within a given account.
>>> clc.v2.Group.GetAll("wa1-4416")
[<clc.APIv2.group.Group object at 0x1065b0190>, <clc.APIv2.group.Group object at 0x1065b0dd0>]
"""
if not alias: alias = clc.v2.Account.GetAlias(session=session)
groups... | [
"def",
"GetAll",
"(",
"root_group_id",
",",
"alias",
"=",
"None",
",",
"session",
"=",
"None",
")",
":",
"if",
"not",
"alias",
":",
"alias",
"=",
"clc",
".",
"v2",
".",
"Account",
".",
"GetAlias",
"(",
"session",
"=",
"session",
")",
"groups",
"=",
... | Gets a list of groups within a given account.
>>> clc.v2.Group.GetAll("wa1-4416")
[<clc.APIv2.group.Group object at 0x1065b0190>, <clc.APIv2.group.Group object at 0x1065b0dd0>] | [
"Gets",
"a",
"list",
"of",
"groups",
"within",
"a",
"given",
"account",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L105-L118 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/group.py | Group.Refresh | def Refresh(self):
"""Reloads the group object to synchronize with cloud representation.
>>> clc.v2.Group("wa-1234").Refresh()
"""
self.dirty = False
self.data = clc.v2.API.Call('GET','groups/%s/%s' % (self.alias,self.id), session=self.session)
self.data['changeInfo']['createdDate'] = clc.v2.time_utils.... | python | def Refresh(self):
"""Reloads the group object to synchronize with cloud representation.
>>> clc.v2.Group("wa-1234").Refresh()
"""
self.dirty = False
self.data = clc.v2.API.Call('GET','groups/%s/%s' % (self.alias,self.id), session=self.session)
self.data['changeInfo']['createdDate'] = clc.v2.time_utils.... | [
"def",
"Refresh",
"(",
"self",
")",
":",
"self",
".",
"dirty",
"=",
"False",
"self",
".",
"data",
"=",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'GET'",
",",
"'groups/%s/%s'",
"%",
"(",
"self",
".",
"alias",
",",
"self",
".",
"id",
")",
... | Reloads the group object to synchronize with cloud representation.
>>> clc.v2.Group("wa-1234").Refresh() | [
"Reloads",
"the",
"group",
"object",
"to",
"synchronize",
"with",
"cloud",
"representation",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L152-L163 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/group.py | Group.Defaults | def Defaults(self,key):
"""Returns default configurations for resources deployed to this group.
If specified key is not defined returns None.
# {"cpu":{"inherited":false},"memoryGB":{"inherited":false},"networkId":{"inherited":false},
# "primaryDns":{"value":"172.17.1.26","inherited":true},"secondaryDns":{"va... | python | def Defaults(self,key):
"""Returns default configurations for resources deployed to this group.
If specified key is not defined returns None.
# {"cpu":{"inherited":false},"memoryGB":{"inherited":false},"networkId":{"inherited":false},
# "primaryDns":{"value":"172.17.1.26","inherited":true},"secondaryDns":{"va... | [
"def",
"Defaults",
"(",
"self",
",",
"key",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'defaults'",
")",
":",
"self",
".",
"defaults",
"=",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'GET'",
",",
"'groups/%s/%s/defaults'",
"%",
"(",
... | Returns default configurations for resources deployed to this group.
If specified key is not defined returns None.
# {"cpu":{"inherited":false},"memoryGB":{"inherited":false},"networkId":{"inherited":false},
# "primaryDns":{"value":"172.17.1.26","inherited":true},"secondaryDns":{"value":"172.17.1.27","inherited... | [
"Returns",
"default",
"configurations",
"for",
"resources",
"deployed",
"to",
"this",
"group",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L166-L181 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/group.py | Group.Subgroups | def Subgroups(self):
"""Returns a Groups object containing all child groups.
>>> clc.v2.Group("wa1-4416").Subgroups()
<clc.APIv2.group.Groups object at 0x105fa27d0>
"""
return(Groups(alias=self.alias,groups_lst=self.data['groups'],session=self.session)) | python | def Subgroups(self):
"""Returns a Groups object containing all child groups.
>>> clc.v2.Group("wa1-4416").Subgroups()
<clc.APIv2.group.Groups object at 0x105fa27d0>
"""
return(Groups(alias=self.alias,groups_lst=self.data['groups'],session=self.session)) | [
"def",
"Subgroups",
"(",
"self",
")",
":",
"return",
"(",
"Groups",
"(",
"alias",
"=",
"self",
".",
"alias",
",",
"groups_lst",
"=",
"self",
".",
"data",
"[",
"'groups'",
"]",
",",
"session",
"=",
"self",
".",
"session",
")",
")"
] | Returns a Groups object containing all child groups.
>>> clc.v2.Group("wa1-4416").Subgroups()
<clc.APIv2.group.Groups object at 0x105fa27d0> | [
"Returns",
"a",
"Groups",
"object",
"containing",
"all",
"child",
"groups",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L184-L192 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/group.py | Group.Servers | def Servers(self):
"""Returns a Servers object containing all servers within the group.
>>> clc.v2.Group("wa1-4416").Servers()
<clc.APIv2.server.Servers object at 0x1065b0f10>
"""
return(clc.v2.Servers(
alias=self.alias,
servers_lst=[obj['id'] for obj in self.data['links'] if obj['rel']=='server'],
... | python | def Servers(self):
"""Returns a Servers object containing all servers within the group.
>>> clc.v2.Group("wa1-4416").Servers()
<clc.APIv2.server.Servers object at 0x1065b0f10>
"""
return(clc.v2.Servers(
alias=self.alias,
servers_lst=[obj['id'] for obj in self.data['links'] if obj['rel']=='server'],
... | [
"def",
"Servers",
"(",
"self",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Servers",
"(",
"alias",
"=",
"self",
".",
"alias",
",",
"servers_lst",
"=",
"[",
"obj",
"[",
"'id'",
"]",
"for",
"obj",
"in",
"self",
".",
"data",
"[",
"'links'",
"]"... | Returns a Servers object containing all servers within the group.
>>> clc.v2.Group("wa1-4416").Servers()
<clc.APIv2.server.Servers object at 0x1065b0f10> | [
"Returns",
"a",
"Servers",
"object",
"containing",
"all",
"servers",
"within",
"the",
"group",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L224-L235 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/queue.py | Queue.List | def List(type='All'):
"""List of Queued requests and their current status details.
https://t3n.zendesk.com/entries/20350251-List-Queue-Requests
:param type: list items in the queue filtered by status (All, Pending, Complete, Error)
"""
r = clc.v1.API.Call('post','Queue/ListQueueRequests',{'ItemStatusType': ... | python | def List(type='All'):
"""List of Queued requests and their current status details.
https://t3n.zendesk.com/entries/20350251-List-Queue-Requests
:param type: list items in the queue filtered by status (All, Pending, Complete, Error)
"""
r = clc.v1.API.Call('post','Queue/ListQueueRequests',{'ItemStatusType': ... | [
"def",
"List",
"(",
"type",
"=",
"'All'",
")",
":",
"r",
"=",
"clc",
".",
"v1",
".",
"API",
".",
"Call",
"(",
"'post'",
",",
"'Queue/ListQueueRequests'",
",",
"{",
"'ItemStatusType'",
":",
"Queue",
".",
"item_status_type_map",
"[",
"type",
"]",
"}",
")... | List of Queued requests and their current status details.
https://t3n.zendesk.com/entries/20350251-List-Queue-Requests
:param type: list items in the queue filtered by status (All, Pending, Complete, Error) | [
"List",
"of",
"Queued",
"requests",
"and",
"their",
"current",
"status",
"details",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/queue.py#L18-L26 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/network.py | Networks._Load | def _Load(self,location):
"""Load all networks associated with the given location.
https://www.centurylinkcloud.com/api-docs/v2/#get-network-list#request
"""
# https://api.ctl.io/v2-experimental/networks/ALIAS/WA1
for network in clc.v2.API.Call('GET','/v2-experimental/networks/%s/%s' % (self.alias,location)... | python | def _Load(self,location):
"""Load all networks associated with the given location.
https://www.centurylinkcloud.com/api-docs/v2/#get-network-list#request
"""
# https://api.ctl.io/v2-experimental/networks/ALIAS/WA1
for network in clc.v2.API.Call('GET','/v2-experimental/networks/%s/%s' % (self.alias,location)... | [
"def",
"_Load",
"(",
"self",
",",
"location",
")",
":",
"# https://api.ctl.io/v2-experimental/networks/ALIAS/WA1",
"for",
"network",
"in",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'GET'",
",",
"'/v2-experimental/networks/%s/%s'",
"%",
"(",
"self",
".",
"... | Load all networks associated with the given location.
https://www.centurylinkcloud.com/api-docs/v2/#get-network-list#request | [
"Load",
"all",
"networks",
"associated",
"with",
"the",
"given",
"location",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L51-L59 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/network.py | Networks.Get | def Get(self,key):
"""Get network by providing name, ID, or other unique key.
If key is not unique and finds multiple matches only the first
will be returned
"""
for network in self.networks:
try:
if network.id == key: return(network)
if network.name == key: return(network)
if network.cidr ... | python | def Get(self,key):
"""Get network by providing name, ID, or other unique key.
If key is not unique and finds multiple matches only the first
will be returned
"""
for network in self.networks:
try:
if network.id == key: return(network)
if network.name == key: return(network)
if network.cidr ... | [
"def",
"Get",
"(",
"self",
",",
"key",
")",
":",
"for",
"network",
"in",
"self",
".",
"networks",
":",
"try",
":",
"if",
"network",
".",
"id",
"==",
"key",
":",
"return",
"(",
"network",
")",
"if",
"network",
".",
"name",
"==",
"key",
":",
"retur... | Get network by providing name, ID, or other unique key.
If key is not unique and finds multiple matches only the first
will be returned | [
"Get",
"network",
"by",
"providing",
"name",
"ID",
"or",
"other",
"unique",
"key",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L62-L76 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/network.py | Network.Create | def Create(alias=None,location=None,session=None):
"""Claims a new network within a given account.
https://www.ctl.io/api-docs/v2/#networks-claim-network
Returns operation id and link to check status
"""
if not alias: alias = clc.v2.Account.GetAlias(session=session)
if not location: location = clc.v2.A... | python | def Create(alias=None,location=None,session=None):
"""Claims a new network within a given account.
https://www.ctl.io/api-docs/v2/#networks-claim-network
Returns operation id and link to check status
"""
if not alias: alias = clc.v2.Account.GetAlias(session=session)
if not location: location = clc.v2.A... | [
"def",
"Create",
"(",
"alias",
"=",
"None",
",",
"location",
"=",
"None",
",",
"session",
"=",
"None",
")",
":",
"if",
"not",
"alias",
":",
"alias",
"=",
"clc",
".",
"v2",
".",
"Account",
".",
"GetAlias",
"(",
"session",
"=",
"session",
")",
"if",
... | Claims a new network within a given account.
https://www.ctl.io/api-docs/v2/#networks-claim-network
Returns operation id and link to check status | [
"Claims",
"a",
"new",
"network",
"within",
"a",
"given",
"account",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L102-L116 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/network.py | Network.Delete | def Delete(self,location=None):
"""Releases the calling network.
https://www.ctl.io/api-docs/v2/#networks-release-network
Returns a 204 and no content
"""
if not location: location = clc.v2.Account.GetLocation(session=self.session)
return clc.v2.API.Call('POST','/v2-experimental/networks/%s/%s/%s/relea... | python | def Delete(self,location=None):
"""Releases the calling network.
https://www.ctl.io/api-docs/v2/#networks-release-network
Returns a 204 and no content
"""
if not location: location = clc.v2.Account.GetLocation(session=self.session)
return clc.v2.API.Call('POST','/v2-experimental/networks/%s/%s/%s/relea... | [
"def",
"Delete",
"(",
"self",
",",
"location",
"=",
"None",
")",
":",
"if",
"not",
"location",
":",
"location",
"=",
"clc",
".",
"v2",
".",
"Account",
".",
"GetLocation",
"(",
"session",
"=",
"self",
".",
"session",
")",
"return",
"clc",
".",
"v2",
... | Releases the calling network.
https://www.ctl.io/api-docs/v2/#networks-release-network
Returns a 204 and no content | [
"Releases",
"the",
"calling",
"network",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L118-L129 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/network.py | Network.Update | def Update(self,name,description=None,location=None):
"""Updates the attributes of a given Network via PUT.
https://www.ctl.io/api-docs/v2/#networks-update-network
{
"name": "VLAN for Development Servers",
"description": "Development Servers on 11.22.33.0/24"
}
Returns a 204 and no content
""... | python | def Update(self,name,description=None,location=None):
"""Updates the attributes of a given Network via PUT.
https://www.ctl.io/api-docs/v2/#networks-update-network
{
"name": "VLAN for Development Servers",
"description": "Development Servers on 11.22.33.0/24"
}
Returns a 204 and no content
""... | [
"def",
"Update",
"(",
"self",
",",
"name",
",",
"description",
"=",
"None",
",",
"location",
"=",
"None",
")",
":",
"if",
"not",
"location",
":",
"location",
"=",
"clc",
".",
"v2",
".",
"Account",
".",
"GetLocation",
"(",
"session",
"=",
"self",
".",... | Updates the attributes of a given Network via PUT.
https://www.ctl.io/api-docs/v2/#networks-update-network
{
"name": "VLAN for Development Servers",
"description": "Development Servers on 11.22.33.0/24"
}
Returns a 204 and no content | [
"Updates",
"the",
"attributes",
"of",
"a",
"given",
"Network",
"via",
"PUT",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L131-L152 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/network.py | Network.Refresh | def Refresh(self, location=None):
"""Reloads the network object to synchronize with cloud representation.
>>> clc.v2.Network("f58148729bd94b02ae8b652f5c5feba3").Refresh()
GET https://api.ctl.io/v2-experimental/networks/{accountAlias}/{dataCenter}/{Network}?ipAddresses=none|claimed|free|all
"""
if not locati... | python | def Refresh(self, location=None):
"""Reloads the network object to synchronize with cloud representation.
>>> clc.v2.Network("f58148729bd94b02ae8b652f5c5feba3").Refresh()
GET https://api.ctl.io/v2-experimental/networks/{accountAlias}/{dataCenter}/{Network}?ipAddresses=none|claimed|free|all
"""
if not locati... | [
"def",
"Refresh",
"(",
"self",
",",
"location",
"=",
"None",
")",
":",
"if",
"not",
"location",
":",
"location",
"=",
"clc",
".",
"v2",
".",
"Account",
".",
"GetLocation",
"(",
"session",
"=",
"self",
".",
"session",
")",
"new_object",
"=",
"clc",
".... | Reloads the network object to synchronize with cloud representation.
>>> clc.v2.Network("f58148729bd94b02ae8b652f5c5feba3").Refresh()
GET https://api.ctl.io/v2-experimental/networks/{accountAlias}/{dataCenter}/{Network}?ipAddresses=none|claimed|free|all | [
"Reloads",
"the",
"network",
"object",
"to",
"synchronize",
"with",
"cloud",
"representation",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L154-L167 | train |
biocommons/uta-align | setup.py | install_build_requires | def install_build_requires(pkg_targets):
"""Iterate through build_requires list and pip install if package is not present
accounting for version"""
def pip_install(pkg_name, pkg_vers=None):
pkg_name_version = '%s==%s' % (pkg_name, pkg_vers) if pkg_vers else pkg_name
print '[WARNING] %s not ... | python | def install_build_requires(pkg_targets):
"""Iterate through build_requires list and pip install if package is not present
accounting for version"""
def pip_install(pkg_name, pkg_vers=None):
pkg_name_version = '%s==%s' % (pkg_name, pkg_vers) if pkg_vers else pkg_name
print '[WARNING] %s not ... | [
"def",
"install_build_requires",
"(",
"pkg_targets",
")",
":",
"def",
"pip_install",
"(",
"pkg_name",
",",
"pkg_vers",
"=",
"None",
")",
":",
"pkg_name_version",
"=",
"'%s==%s'",
"%",
"(",
"pkg_name",
",",
"pkg_vers",
")",
"if",
"pkg_vers",
"else",
"pkg_name",... | Iterate through build_requires list and pip install if package is not present
accounting for version | [
"Iterate",
"through",
"build_requires",
"list",
"and",
"pip",
"install",
"if",
"package",
"is",
"not",
"present",
"accounting",
"for",
"version"
] | c3af0a293bb6ce7d241a8ec9843e4a6bb18d751f | https://github.com/biocommons/uta-align/blob/c3af0a293bb6ce7d241a8ec9843e4a6bb18d751f/setup.py#L32-L61 | train |
nickpandolfi/Cyther | cyther/processing.py | initiateCompilation | def initiateCompilation(args, file):
"""
Starts the entire compilation procedure
"""
####commands = finalizeCommands(args, file)
commands = makeCommands(0, file)
if not args['concise'] and args['print_args']:
print_commands = bool(args['watch'])
response = multiCall(*commands, print_... | python | def initiateCompilation(args, file):
"""
Starts the entire compilation procedure
"""
####commands = finalizeCommands(args, file)
commands = makeCommands(0, file)
if not args['concise'] and args['print_args']:
print_commands = bool(args['watch'])
response = multiCall(*commands, print_... | [
"def",
"initiateCompilation",
"(",
"args",
",",
"file",
")",
":",
"####commands = finalizeCommands(args, file)",
"commands",
"=",
"makeCommands",
"(",
"0",
",",
"file",
")",
"if",
"not",
"args",
"[",
"'concise'",
"]",
"and",
"args",
"[",
"'print_args'",
"]",
"... | Starts the entire compilation procedure | [
"Starts",
"the",
"entire",
"compilation",
"procedure"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/processing.py#L24-L33 | train |
nickpandolfi/Cyther | cyther/processing.py | run | def run(path, timer=False, repeat=3, number=10000, precision=2):
"""
Extracts and runs the '@cyther' code from the given file 'path' name
"""
code = extractAtCyther(path)
if not code:
output = "There was no '@cyther' code collected from the " \
"file '{}'\n".format(path)
... | python | def run(path, timer=False, repeat=3, number=10000, precision=2):
"""
Extracts and runs the '@cyther' code from the given file 'path' name
"""
code = extractAtCyther(path)
if not code:
output = "There was no '@cyther' code collected from the " \
"file '{}'\n".format(path)
... | [
"def",
"run",
"(",
"path",
",",
"timer",
"=",
"False",
",",
"repeat",
"=",
"3",
",",
"number",
"=",
"10000",
",",
"precision",
"=",
"2",
")",
":",
"code",
"=",
"extractAtCyther",
"(",
"path",
")",
"if",
"not",
"code",
":",
"output",
"=",
"\"There w... | Extracts and runs the '@cyther' code from the given file 'path' name | [
"Extracts",
"and",
"runs",
"the"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/processing.py#L140-L166 | train |
nickpandolfi/Cyther | cyther/processing.py | core | def core(args):
"""
The heart of Cyther, this function controls the main loop, and can be
used to perform any Cyther action. You can call if using Cyther
from the module level
"""
args = furtherArgsProcessing(args)
numfiles = len(args['filenames'])
interval = INTERVAL / numfiles
fil... | python | def core(args):
"""
The heart of Cyther, this function controls the main loop, and can be
used to perform any Cyther action. You can call if using Cyther
from the module level
"""
args = furtherArgsProcessing(args)
numfiles = len(args['filenames'])
interval = INTERVAL / numfiles
fil... | [
"def",
"core",
"(",
"args",
")",
":",
"args",
"=",
"furtherArgsProcessing",
"(",
"args",
")",
"numfiles",
"=",
"len",
"(",
"args",
"[",
"'filenames'",
"]",
")",
"interval",
"=",
"INTERVAL",
"/",
"numfiles",
"files",
"=",
"processFiles",
"(",
"args",
")",... | The heart of Cyther, this function controls the main loop, and can be
used to perform any Cyther action. You can call if using Cyther
from the module level | [
"The",
"heart",
"of",
"Cyther",
"this",
"function",
"controls",
"the",
"main",
"loop",
"and",
"can",
"be",
"used",
"to",
"perform",
"any",
"Cyther",
"action",
".",
"You",
"can",
"call",
"if",
"using",
"Cyther",
"from",
"the",
"module",
"level"
] | 9fb0bd77af594008aa6ee8af460aa8c953abf5bc | https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/processing.py#L169-L186 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | Clp.set_timestamp | def set_timestamp(self,timestamp=None):
"""
Set the timestamp of the linguistic processor, set to None for the current time
@type timestamp:string
@param timestamp: version of the linguistic processor
"""
if timestamp is None:
import time
timestamp... | python | def set_timestamp(self,timestamp=None):
"""
Set the timestamp of the linguistic processor, set to None for the current time
@type timestamp:string
@param timestamp: version of the linguistic processor
"""
if timestamp is None:
import time
timestamp... | [
"def",
"set_timestamp",
"(",
"self",
",",
"timestamp",
"=",
"None",
")",
":",
"if",
"timestamp",
"is",
"None",
":",
"import",
"time",
"timestamp",
"=",
"time",
".",
"strftime",
"(",
"'%Y-%m-%dT%H:%M:%S%Z'",
")",
"self",
".",
"node",
".",
"set",
"(",
"'ti... | Set the timestamp of the linguistic processor, set to None for the current time
@type timestamp:string
@param timestamp: version of the linguistic processor | [
"Set",
"the",
"timestamp",
"of",
"the",
"linguistic",
"processor",
"set",
"to",
"None",
"for",
"the",
"current",
"time"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L332-L341 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | Clp.set_beginTimestamp | def set_beginTimestamp(self,btimestamp=None):
"""
Set the begin timestamp of the linguistic processor, set to None for the current time
@type btimestamp: string
@param btimestamp: version of the linguistic processor
"""
if btimestamp is None:
import time
... | python | def set_beginTimestamp(self,btimestamp=None):
"""
Set the begin timestamp of the linguistic processor, set to None for the current time
@type btimestamp: string
@param btimestamp: version of the linguistic processor
"""
if btimestamp is None:
import time
... | [
"def",
"set_beginTimestamp",
"(",
"self",
",",
"btimestamp",
"=",
"None",
")",
":",
"if",
"btimestamp",
"is",
"None",
":",
"import",
"time",
"btimestamp",
"=",
"time",
".",
"strftime",
"(",
"'%Y-%m-%dT%H:%M:%S%Z'",
")",
"self",
".",
"node",
".",
"set",
"("... | Set the begin timestamp of the linguistic processor, set to None for the current time
@type btimestamp: string
@param btimestamp: version of the linguistic processor | [
"Set",
"the",
"begin",
"timestamp",
"of",
"the",
"linguistic",
"processor",
"set",
"to",
"None",
"for",
"the",
"current",
"time"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L352-L361 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | Clp.set_endTimestamp | def set_endTimestamp(self,etimestamp=None):
"""
Set the end timestamp of the linguistic processor, set to None for the current time
@type etimestamp: string
@param etimestamp: version of the linguistic processor
"""
if etimestamp is None:
import time
... | python | def set_endTimestamp(self,etimestamp=None):
"""
Set the end timestamp of the linguistic processor, set to None for the current time
@type etimestamp: string
@param etimestamp: version of the linguistic processor
"""
if etimestamp is None:
import time
... | [
"def",
"set_endTimestamp",
"(",
"self",
",",
"etimestamp",
"=",
"None",
")",
":",
"if",
"etimestamp",
"is",
"None",
":",
"import",
"time",
"etimestamp",
"=",
"time",
".",
"strftime",
"(",
"'%Y-%m-%dT%H:%M:%S%Z'",
")",
"self",
".",
"node",
".",
"set",
"(",
... | Set the end timestamp of the linguistic processor, set to None for the current time
@type etimestamp: string
@param etimestamp: version of the linguistic processor | [
"Set",
"the",
"end",
"timestamp",
"of",
"the",
"linguistic",
"processor",
"set",
"to",
"None",
"for",
"the",
"current",
"time"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L372-L381 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | CHeader.set_publicId | def set_publicId(self,publicId):
'''
Sets the publicId to the public object
@param publicId: a publicId (title of article)
@type publicId: string
'''
publicObj = self.get_public()
if publicObj is not None:
publicObj.set_publicid(publicId)
else:... | python | def set_publicId(self,publicId):
'''
Sets the publicId to the public object
@param publicId: a publicId (title of article)
@type publicId: string
'''
publicObj = self.get_public()
if publicObj is not None:
publicObj.set_publicid(publicId)
else:... | [
"def",
"set_publicId",
"(",
"self",
",",
"publicId",
")",
":",
"publicObj",
"=",
"self",
".",
"get_public",
"(",
")",
"if",
"publicObj",
"is",
"not",
"None",
":",
"publicObj",
".",
"set_publicid",
"(",
"publicId",
")",
"else",
":",
"publicObj",
"=",
"Cpu... | Sets the publicId to the public object
@param publicId: a publicId (title of article)
@type publicId: string | [
"Sets",
"the",
"publicId",
"to",
"the",
"public",
"object"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L559-L571 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | CHeader.set_uri | def set_uri(self, uri):
'''
Sets the uri to the public object
@param uri: a uri
@type uri: string
'''
publicObj = self.get_public()
if publicObj is not None:
publicObj.set_uri(uri)
else:
publicObj = Cpublic()
publicObj.s... | python | def set_uri(self, uri):
'''
Sets the uri to the public object
@param uri: a uri
@type uri: string
'''
publicObj = self.get_public()
if publicObj is not None:
publicObj.set_uri(uri)
else:
publicObj = Cpublic()
publicObj.s... | [
"def",
"set_uri",
"(",
"self",
",",
"uri",
")",
":",
"publicObj",
"=",
"self",
".",
"get_public",
"(",
")",
"if",
"publicObj",
"is",
"not",
"None",
":",
"publicObj",
".",
"set_uri",
"(",
"uri",
")",
"else",
":",
"publicObj",
"=",
"Cpublic",
"(",
")",... | Sets the uri to the public object
@param uri: a uri
@type uri: string | [
"Sets",
"the",
"uri",
"to",
"the",
"public",
"object"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L585-L597 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | CHeader.remove_lp | def remove_lp(self,layer):
"""
Removes the linguistic processors for a given layer
@type layer: string
@param layer: the name of the layer
"""
for this_node in self.node.findall('linguisticProcessors'):
if this_node.get('layer') == layer:
self.... | python | def remove_lp(self,layer):
"""
Removes the linguistic processors for a given layer
@type layer: string
@param layer: the name of the layer
"""
for this_node in self.node.findall('linguisticProcessors'):
if this_node.get('layer') == layer:
self.... | [
"def",
"remove_lp",
"(",
"self",
",",
"layer",
")",
":",
"for",
"this_node",
"in",
"self",
".",
"node",
".",
"findall",
"(",
"'linguisticProcessors'",
")",
":",
"if",
"this_node",
".",
"get",
"(",
"'layer'",
")",
"==",
"layer",
":",
"self",
".",
"node"... | Removes the linguistic processors for a given layer
@type layer: string
@param layer: the name of the layer | [
"Removes",
"the",
"linguistic",
"processors",
"for",
"a",
"given",
"layer"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L620-L629 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | CHeader.add_linguistic_processor | def add_linguistic_processor(self, layer ,my_lp):
"""
Adds a linguistic processor to a certain layer
@type layer: string
@param layer: the name of the layer
@type my_lp: L{Clp}
@param my_lp: the linguistic processor
"""
## Locate the linguisticProcessor el... | python | def add_linguistic_processor(self, layer ,my_lp):
"""
Adds a linguistic processor to a certain layer
@type layer: string
@param layer: the name of the layer
@type my_lp: L{Clp}
@param my_lp: the linguistic processor
"""
## Locate the linguisticProcessor el... | [
"def",
"add_linguistic_processor",
"(",
"self",
",",
"layer",
",",
"my_lp",
")",
":",
"## Locate the linguisticProcessor element for taht layer",
"found_lp_obj",
"=",
"None",
"for",
"this_lp",
"in",
"self",
".",
"node",
".",
"findall",
"(",
"'linguisticProcessors'",
"... | Adds a linguistic processor to a certain layer
@type layer: string
@param layer: the name of the layer
@type my_lp: L{Clp}
@param my_lp: the linguistic processor | [
"Adds",
"a",
"linguistic",
"processor",
"to",
"a",
"certain",
"layer"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L631-L652 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | CHeader.get_fileDesc | def get_fileDesc(self):
'''
Returns the fileDesc object or None if there is no such element
@return: the fileDesc object
@rtype: L{CfileDesc}
'''
node = self.node.find('fileDesc')
if node is not None:
return CfileDesc(node=node)
else:
... | python | def get_fileDesc(self):
'''
Returns the fileDesc object or None if there is no such element
@return: the fileDesc object
@rtype: L{CfileDesc}
'''
node = self.node.find('fileDesc')
if node is not None:
return CfileDesc(node=node)
else:
... | [
"def",
"get_fileDesc",
"(",
"self",
")",
":",
"node",
"=",
"self",
".",
"node",
".",
"find",
"(",
"'fileDesc'",
")",
"if",
"node",
"is",
"not",
"None",
":",
"return",
"CfileDesc",
"(",
"node",
"=",
"node",
")",
"else",
":",
"return",
"None"
] | Returns the fileDesc object or None if there is no such element
@return: the fileDesc object
@rtype: L{CfileDesc} | [
"Returns",
"the",
"fileDesc",
"object",
"or",
"None",
"if",
"there",
"is",
"no",
"such",
"element"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L654-L664 | train |
cltl/KafNafParserPy | KafNafParserPy/header_data.py | CHeader.get_public | def get_public(self):
'''
Returns the public object or None if there is no such element
@return: the public object
@rtype: L{Cpublic}
'''
node = self.node.find('public')
if node is not None:
return Cpublic(node=node)
else:
return No... | python | def get_public(self):
'''
Returns the public object or None if there is no such element
@return: the public object
@rtype: L{Cpublic}
'''
node = self.node.find('public')
if node is not None:
return Cpublic(node=node)
else:
return No... | [
"def",
"get_public",
"(",
"self",
")",
":",
"node",
"=",
"self",
".",
"node",
".",
"find",
"(",
"'public'",
")",
"if",
"node",
"is",
"not",
"None",
":",
"return",
"Cpublic",
"(",
"node",
"=",
"node",
")",
"else",
":",
"return",
"None"
] | Returns the public object or None if there is no such element
@return: the public object
@rtype: L{Cpublic} | [
"Returns",
"the",
"public",
"object",
"or",
"None",
"if",
"there",
"is",
"no",
"such",
"element"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L674-L684 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/blueprint.py | Blueprint.GetPackages | def GetPackages(classification,visibility):
"""Gets a list of Blueprint Packages filtered by classification and visibility.
https://t3n.zendesk.com/entries/20411357-Get-Packages
:param classification: package type filter (System, Script, Software)
:param visibility: package visibility filter (Public, Private,... | python | def GetPackages(classification,visibility):
"""Gets a list of Blueprint Packages filtered by classification and visibility.
https://t3n.zendesk.com/entries/20411357-Get-Packages
:param classification: package type filter (System, Script, Software)
:param visibility: package visibility filter (Public, Private,... | [
"def",
"GetPackages",
"(",
"classification",
",",
"visibility",
")",
":",
"r",
"=",
"clc",
".",
"v1",
".",
"API",
".",
"Call",
"(",
"'post'",
",",
"'Blueprint/GetPackages'",
",",
"{",
"'Classification'",
":",
"Blueprint",
".",
"classification_stoi",
"[",
"cl... | Gets a list of Blueprint Packages filtered by classification and visibility.
https://t3n.zendesk.com/entries/20411357-Get-Packages
:param classification: package type filter (System, Script, Software)
:param visibility: package visibility filter (Public, Private, Shared) | [
"Gets",
"a",
"list",
"of",
"Blueprint",
"Packages",
"filtered",
"by",
"classification",
"and",
"visibility",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L51-L61 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/blueprint.py | Blueprint.GetAllPackages | def GetAllPackages(classification):
"""Gets a list of all Blueprint Packages with a given classification.
https://t3n.zendesk.com/entries/20411357-Get-Packages
:param classification: package type filter (System, Script, Software)
"""
packages = []
for visibility in Blueprint.visibility_stoi.keys():
try... | python | def GetAllPackages(classification):
"""Gets a list of all Blueprint Packages with a given classification.
https://t3n.zendesk.com/entries/20411357-Get-Packages
:param classification: package type filter (System, Script, Software)
"""
packages = []
for visibility in Blueprint.visibility_stoi.keys():
try... | [
"def",
"GetAllPackages",
"(",
"classification",
")",
":",
"packages",
"=",
"[",
"]",
"for",
"visibility",
"in",
"Blueprint",
".",
"visibility_stoi",
".",
"keys",
"(",
")",
":",
"try",
":",
"for",
"r",
"in",
"Blueprint",
".",
"GetPackages",
"(",
"classifica... | Gets a list of all Blueprint Packages with a given classification.
https://t3n.zendesk.com/entries/20411357-Get-Packages
:param classification: package type filter (System, Script, Software) | [
"Gets",
"a",
"list",
"of",
"all",
"Blueprint",
"Packages",
"with",
"a",
"given",
"classification",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L65-L78 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/blueprint.py | Blueprint.PackageUpload | def PackageUpload(package,ftp_url):
"""Uploads specified zip package to cloud endpoint.
See URL below for description on how to properly create a package:
https://t3n.zendesk.com/entries/20348448-Blueprints-Script-and-Software-Package-Management
:param package: path to zip file containing package.manifest and... | python | def PackageUpload(package,ftp_url):
"""Uploads specified zip package to cloud endpoint.
See URL below for description on how to properly create a package:
https://t3n.zendesk.com/entries/20348448-Blueprints-Script-and-Software-Package-Management
:param package: path to zip file containing package.manifest and... | [
"def",
"PackageUpload",
"(",
"package",
",",
"ftp_url",
")",
":",
"#o = urlparse.urlparse(ftp_url)",
"# Very weak URL checking",
"#if o.scheme.lower() != \"ftp\": ",
"#\tclc.v1.output.Status('ERROR',2,'Invalid FTP URL')",
"#\treturn",
"# Confirm file exists ",
"if",
"not",
"os",
"... | Uploads specified zip package to cloud endpoint.
See URL below for description on how to properly create a package:
https://t3n.zendesk.com/entries/20348448-Blueprints-Script-and-Software-Package-Management
:param package: path to zip file containing package.manifest and supporting scripts
:param ftp_url: ftp... | [
"Uploads",
"specified",
"zip",
"package",
"to",
"cloud",
"endpoint",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L107-L139 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/blueprint.py | Blueprint.PackagePublish | def PackagePublish(package,classification,visibility,os):
"""Publishes a Blueprint Package for use within the Blueprint Designer.
https://t3n.zendesk.com/entries/20426453-Publish-Package
:param package: path to zip file containing package.manifest and supporting scripts
:param classification: package type (Sy... | python | def PackagePublish(package,classification,visibility,os):
"""Publishes a Blueprint Package for use within the Blueprint Designer.
https://t3n.zendesk.com/entries/20426453-Publish-Package
:param package: path to zip file containing package.manifest and supporting scripts
:param classification: package type (Sy... | [
"def",
"PackagePublish",
"(",
"package",
",",
"classification",
",",
"visibility",
",",
"os",
")",
":",
"r",
"=",
"clc",
".",
"v1",
".",
"API",
".",
"Call",
"(",
"'post'",
",",
"'Blueprint/PublishPackage'",
",",
"{",
"'Classification'",
":",
"Blueprint",
"... | Publishes a Blueprint Package for use within the Blueprint Designer.
https://t3n.zendesk.com/entries/20426453-Publish-Package
:param package: path to zip file containing package.manifest and supporting scripts
:param classification: package type (System, Script, Software)
:param visibility: package visibility... | [
"Publishes",
"a",
"Blueprint",
"Package",
"for",
"use",
"within",
"the",
"Blueprint",
"Designer",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L143-L156 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/blueprint.py | Blueprint.PackagePublishUI | def PackagePublishUI(package,type,visibility):
"""Publishes a Blueprint Package for use within the Blueprint Designer after interactive OS selection.
Interactive selection of one or more operating systems by name.
:param package: path to zip file containing package.manifest and supporting scripts
:param class... | python | def PackagePublishUI(package,type,visibility):
"""Publishes a Blueprint Package for use within the Blueprint Designer after interactive OS selection.
Interactive selection of one or more operating systems by name.
:param package: path to zip file containing package.manifest and supporting scripts
:param class... | [
"def",
"PackagePublishUI",
"(",
"package",
",",
"type",
",",
"visibility",
")",
":",
"# fetch OS list",
"linux_lst",
"=",
"{",
"'L'",
":",
"{",
"'selected'",
":",
"False",
",",
"'Description'",
":",
"'All Linux'",
"}",
"}",
"windows_lst",
"=",
"{",
"'W'",
... | Publishes a Blueprint Package for use within the Blueprint Designer after interactive OS selection.
Interactive selection of one or more operating systems by name.
:param package: path to zip file containing package.manifest and supporting scripts
:param classification: package type (System, Script, Software)
... | [
"Publishes",
"a",
"Blueprint",
"Package",
"for",
"use",
"within",
"the",
"Blueprint",
"Designer",
"after",
"interactive",
"OS",
"selection",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L214-L255 | train |
srossross/rpmfile | rpmfile/__init__.py | RPMFile.getmembers | def getmembers(self):
'''
Return the members of the archive as a list of RPMInfo objects. The
list has the same order as the members in the archive.
'''
if self._members is None:
self._members = _members = []
g = self.data_file
magic = g.read(2... | python | def getmembers(self):
'''
Return the members of the archive as a list of RPMInfo objects. The
list has the same order as the members in the archive.
'''
if self._members is None:
self._members = _members = []
g = self.data_file
magic = g.read(2... | [
"def",
"getmembers",
"(",
"self",
")",
":",
"if",
"self",
".",
"_members",
"is",
"None",
":",
"self",
".",
"_members",
"=",
"_members",
"=",
"[",
"]",
"g",
"=",
"self",
".",
"data_file",
"magic",
"=",
"g",
".",
"read",
"(",
"2",
")",
"while",
"ma... | Return the members of the archive as a list of RPMInfo objects. The
list has the same order as the members in the archive. | [
"Return",
"the",
"members",
"of",
"the",
"archive",
"as",
"a",
"list",
"of",
"RPMInfo",
"objects",
".",
"The",
"list",
"has",
"the",
"same",
"order",
"as",
"the",
"members",
"in",
"the",
"archive",
"."
] | 3ab96f211da7b56f5e99d8cc248f714a6e542d31 | https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/__init__.py#L111-L133 | train |
srossross/rpmfile | rpmfile/__init__.py | RPMFile.getmember | def getmember(self, name):
'''
Return an RPMInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version.
'''
member... | python | def getmember(self, name):
'''
Return an RPMInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version.
'''
member... | [
"def",
"getmember",
"(",
"self",
",",
"name",
")",
":",
"members",
"=",
"self",
".",
"getmembers",
"(",
")",
"for",
"m",
"in",
"members",
"[",
":",
":",
"-",
"1",
"]",
":",
"if",
"m",
".",
"name",
"==",
"name",
":",
"return",
"m",
"raise",
"Key... | Return an RPMInfo object for member `name'. If `name' can not be
found in the archive, KeyError is raised. If a member occurs more
than once in the archive, its last occurrence is assumed to be the
most up-to-date version. | [
"Return",
"an",
"RPMInfo",
"object",
"for",
"member",
"name",
".",
"If",
"name",
"can",
"not",
"be",
"found",
"in",
"the",
"archive",
"KeyError",
"is",
"raised",
".",
"If",
"a",
"member",
"occurs",
"more",
"than",
"once",
"in",
"the",
"archive",
"its",
... | 3ab96f211da7b56f5e99d8cc248f714a6e542d31 | https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/__init__.py#L135-L147 | train |
srossross/rpmfile | rpmfile/__init__.py | RPMFile.data_file | def data_file(self):
"""Return the uncompressed raw CPIO data of the RPM archive."""
if self._data_file is None:
fileobj = _SubFile(self._fileobj, self.data_offset)
if self.headers["archive_compression"] == b"xz":
if not getattr(sys.modules[__name__], 'lzma', Fa... | python | def data_file(self):
"""Return the uncompressed raw CPIO data of the RPM archive."""
if self._data_file is None:
fileobj = _SubFile(self._fileobj, self.data_offset)
if self.headers["archive_compression"] == b"xz":
if not getattr(sys.modules[__name__], 'lzma', Fa... | [
"def",
"data_file",
"(",
"self",
")",
":",
"if",
"self",
".",
"_data_file",
"is",
"None",
":",
"fileobj",
"=",
"_SubFile",
"(",
"self",
".",
"_fileobj",
",",
"self",
".",
"data_offset",
")",
"if",
"self",
".",
"headers",
"[",
"\"archive_compression\"",
"... | Return the uncompressed raw CPIO data of the RPM archive. | [
"Return",
"the",
"uncompressed",
"raw",
"CPIO",
"data",
"of",
"the",
"RPM",
"archive",
"."
] | 3ab96f211da7b56f5e99d8cc248f714a6e542d31 | https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/__init__.py#L163-L176 | train |
fridex/json2sql | json2sql/utils.py | load_input | def load_input(definition):
"""Load and parse input if needed.
:param definition: definition to use as an input (file, serialized JSON/YAML or dict)
:return: loaded input
:raises json2sql.ParsingInputError: when parsing fails
"""
if isinstance(definition, (str, io.TextIOWrapper)):
try:
... | python | def load_input(definition):
"""Load and parse input if needed.
:param definition: definition to use as an input (file, serialized JSON/YAML or dict)
:return: loaded input
:raises json2sql.ParsingInputError: when parsing fails
"""
if isinstance(definition, (str, io.TextIOWrapper)):
try:
... | [
"def",
"load_input",
"(",
"definition",
")",
":",
"if",
"isinstance",
"(",
"definition",
",",
"(",
"str",
",",
"io",
".",
"TextIOWrapper",
")",
")",
":",
"try",
":",
"definition",
"=",
"yaml",
".",
"safe_load",
"(",
"definition",
")",
"except",
"Exceptio... | Load and parse input if needed.
:param definition: definition to use as an input (file, serialized JSON/YAML or dict)
:return: loaded input
:raises json2sql.ParsingInputError: when parsing fails | [
"Load",
"and",
"parse",
"input",
"if",
"needed",
"."
] | a0851dd79827a684319b03fb899e129f81ff2d3a | https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/utils.py#L19-L32 | train |
fridex/json2sql | json2sql/utils.py | any2sql | def any2sql(func, definition_dict=None, **definition_kwargs):
"""Handle general to SQL conversion.
:param func: function to be called on the given definition
:param definition_dict: statement definition in dict
:param definition_kwargs: statement definition as kwargs
:return: raw SQL statement
... | python | def any2sql(func, definition_dict=None, **definition_kwargs):
"""Handle general to SQL conversion.
:param func: function to be called on the given definition
:param definition_dict: statement definition in dict
:param definition_kwargs: statement definition as kwargs
:return: raw SQL statement
... | [
"def",
"any2sql",
"(",
"func",
",",
"definition_dict",
"=",
"None",
",",
"*",
"*",
"definition_kwargs",
")",
":",
"if",
"definition_dict",
"and",
"definition_kwargs",
":",
"raise",
"InputError",
"(",
"\"Cannot process dict and kwargs input at the same time\"",
")",
"d... | Handle general to SQL conversion.
:param func: function to be called on the given definition
:param definition_dict: statement definition in dict
:param definition_kwargs: statement definition as kwargs
:return: raw SQL statement | [
"Handle",
"general",
"to",
"SQL",
"conversion",
"."
] | a0851dd79827a684319b03fb899e129f81ff2d3a | https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/utils.py#L35-L62 | train |
fridex/json2sql | json2sql/select.py | _expand_join | def _expand_join(join_definition):
"""Expand join definition to `join' call.
:param join_definition: join definition
:return: expanded join definition
"""
join_table_name = join_definition.pop('table')
join_func = getattr(mosql_query, join_definition.pop('join_type', 'join'))
return join_fu... | python | def _expand_join(join_definition):
"""Expand join definition to `join' call.
:param join_definition: join definition
:return: expanded join definition
"""
join_table_name = join_definition.pop('table')
join_func = getattr(mosql_query, join_definition.pop('join_type', 'join'))
return join_fu... | [
"def",
"_expand_join",
"(",
"join_definition",
")",
":",
"join_table_name",
"=",
"join_definition",
".",
"pop",
"(",
"'table'",
")",
"join_func",
"=",
"getattr",
"(",
"mosql_query",
",",
"join_definition",
".",
"pop",
"(",
"'join_type'",
",",
"'join'",
")",
")... | Expand join definition to `join' call.
:param join_definition: join definition
:return: expanded join definition | [
"Expand",
"join",
"definition",
"to",
"join",
"call",
"."
] | a0851dd79827a684319b03fb899e129f81ff2d3a | https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/select.py#L32-L40 | train |
fridex/json2sql | json2sql/select.py | _construct_select_query | def _construct_select_query(**filter_definition):
"""Return SELECT statement that will be used as a filter.
:param filter_definition: definition of a filter that should be used for SELECT construction
:return:
"""
table_name = filter_definition.pop('table')
distinct = filter_definition.pop('dis... | python | def _construct_select_query(**filter_definition):
"""Return SELECT statement that will be used as a filter.
:param filter_definition: definition of a filter that should be used for SELECT construction
:return:
"""
table_name = filter_definition.pop('table')
distinct = filter_definition.pop('dis... | [
"def",
"_construct_select_query",
"(",
"*",
"*",
"filter_definition",
")",
":",
"table_name",
"=",
"filter_definition",
".",
"pop",
"(",
"'table'",
")",
"distinct",
"=",
"filter_definition",
".",
"pop",
"(",
"'distinct'",
",",
"False",
")",
"select_count",
"=",
... | Return SELECT statement that will be used as a filter.
:param filter_definition: definition of a filter that should be used for SELECT construction
:return: | [
"Return",
"SELECT",
"statement",
"that",
"will",
"be",
"used",
"as",
"a",
"filter",
"."
] | a0851dd79827a684319b03fb899e129f81ff2d3a | https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/select.py#L43-L90 | train |
teepark/greenhouse | greenhouse/io/sockets.py | Socket.connect | def connect(self, address):
"""initiate a new connection to a remote socket bound to an address
.. note:: this method will block until the connection has been made
:param address:
the address to which to initiate a connection, the format of which
depends on the socket's... | python | def connect(self, address):
"""initiate a new connection to a remote socket bound to an address
.. note:: this method will block until the connection has been made
:param address:
the address to which to initiate a connection, the format of which
depends on the socket's... | [
"def",
"connect",
"(",
"self",
",",
"address",
")",
":",
"address",
"=",
"_dns_resolve",
"(",
"self",
",",
"address",
")",
"with",
"self",
".",
"_registered",
"(",
"'we'",
")",
":",
"while",
"1",
":",
"err",
"=",
"self",
".",
"_sock",
".",
"connect_e... | initiate a new connection to a remote socket bound to an address
.. note:: this method will block until the connection has been made
:param address:
the address to which to initiate a connection, the format of which
depends on the socket's type; for TCP sockets, this is a
... | [
"initiate",
"a",
"new",
"connection",
"to",
"a",
"remote",
"socket",
"bound",
"to",
"an",
"address"
] | 8fd1be4f5443ba090346b5ec82fdbeb0a060d956 | https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L150-L172 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.