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 listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
shawnsilva/steamwebapi | steamwebapi/api.py | ISteamWebAPIUtil.get_server_info | def get_server_info(self, format=None):
"""Request the Steam Web API status and time.
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {}
if format is not None:
parameters['format'] = format
url = self.create_request_url(self.i... | python | def get_server_info(self, format=None):
"""Request the Steam Web API status and time.
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {}
if format is not None:
parameters['format'] = format
url = self.create_request_url(self.i... | [
"def",
"get_server_info",
"(",
"self",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"}",
"if",
"format",
"is",
"not",
"None",
":",
"parameters",
"[",
"'format'",
"]",
"=",
"format",
"url",
"=",
"self",
".",
"create_request_url",
"(",
"... | Request the Steam Web API status and time.
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"Steam",
"Web",
"API",
"status",
"and",
"time",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L424-L436 | train | 57,800 |
shawnsilva/steamwebapi | steamwebapi/api.py | SteamCommunityXML.create_request_url | def create_request_url(self, profile_type, steamID):
"""Create the url to submit to the Steam Community XML feed."""
regex = re.compile('^\d{17,}$')
if regex.match(steamID):
if profile_type == self.USER:
url = "http://steamcommunity.com/profiles/%s/?xml=1" % (steamID)... | python | def create_request_url(self, profile_type, steamID):
"""Create the url to submit to the Steam Community XML feed."""
regex = re.compile('^\d{17,}$')
if regex.match(steamID):
if profile_type == self.USER:
url = "http://steamcommunity.com/profiles/%s/?xml=1" % (steamID)... | [
"def",
"create_request_url",
"(",
"self",
",",
"profile_type",
",",
"steamID",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"'^\\d{17,}$'",
")",
"if",
"regex",
".",
"match",
"(",
"steamID",
")",
":",
"if",
"profile_type",
"==",
"self",
".",
"USER",... | Create the url to submit to the Steam Community XML feed. | [
"Create",
"the",
"url",
"to",
"submit",
"to",
"the",
"Steam",
"Community",
"XML",
"feed",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L459-L472 | train | 57,801 |
shawnsilva/steamwebapi | steamwebapi/api.py | SteamCommunityXML.get_user_info | def get_user_info(self, steamID):
"""Request the Steam Community XML feed for a specific user."""
url = self.create_request_url(self.USER, steamID)
data = self.retrieve_request(url)
return self.return_data(data, format='xml') | python | def get_user_info(self, steamID):
"""Request the Steam Community XML feed for a specific user."""
url = self.create_request_url(self.USER, steamID)
data = self.retrieve_request(url)
return self.return_data(data, format='xml') | [
"def",
"get_user_info",
"(",
"self",
",",
"steamID",
")",
":",
"url",
"=",
"self",
".",
"create_request_url",
"(",
"self",
".",
"USER",
",",
"steamID",
")",
"data",
"=",
"self",
".",
"retrieve_request",
"(",
"url",
")",
"return",
"self",
".",
"return_dat... | Request the Steam Community XML feed for a specific user. | [
"Request",
"the",
"Steam",
"Community",
"XML",
"feed",
"for",
"a",
"specific",
"user",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L487-L491 | train | 57,802 |
shawnsilva/steamwebapi | steamwebapi/api.py | SteamCommunityXML.get_group_info | def get_group_info(self, steamID):
"""Request the Steam Community XML feed for a specific group."""
url = self.create_request_url(self.GROUP, steamID)
data = self.retrieve_request(url)
return self.return_data(data, format='xml') | python | def get_group_info(self, steamID):
"""Request the Steam Community XML feed for a specific group."""
url = self.create_request_url(self.GROUP, steamID)
data = self.retrieve_request(url)
return self.return_data(data, format='xml') | [
"def",
"get_group_info",
"(",
"self",
",",
"steamID",
")",
":",
"url",
"=",
"self",
".",
"create_request_url",
"(",
"self",
".",
"GROUP",
",",
"steamID",
")",
"data",
"=",
"self",
".",
"retrieve_request",
"(",
"url",
")",
"return",
"self",
".",
"return_d... | Request the Steam Community XML feed for a specific group. | [
"Request",
"the",
"Steam",
"Community",
"XML",
"feed",
"for",
"a",
"specific",
"group",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L493-L497 | train | 57,803 |
asascience-open/paegan-transport | paegan/transport/export.py | Trackline.export | def export(cls, folder, particles, datetimes):
"""
Export trackline data to GeoJSON file
"""
normalized_locations = [particle.normalized_locations(datetimes) for particle in particles]
track_coords = []
for x in xrange(0, len(datetimes)):
points = MultiPo... | python | def export(cls, folder, particles, datetimes):
"""
Export trackline data to GeoJSON file
"""
normalized_locations = [particle.normalized_locations(datetimes) for particle in particles]
track_coords = []
for x in xrange(0, len(datetimes)):
points = MultiPo... | [
"def",
"export",
"(",
"cls",
",",
"folder",
",",
"particles",
",",
"datetimes",
")",
":",
"normalized_locations",
"=",
"[",
"particle",
".",
"normalized_locations",
"(",
"datetimes",
")",
"for",
"particle",
"in",
"particles",
"]",
"track_coords",
"=",
"[",
"... | Export trackline data to GeoJSON file | [
"Export",
"trackline",
"data",
"to",
"GeoJSON",
"file"
] | 99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3 | https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/export.py#L31-L50 | train | 57,804 |
asascience-open/paegan-transport | paegan/transport/export.py | Pickle.export | def export(cls, folder, particles, datetimes):
"""
Export particle and datetime data to Pickled objects.
This can be used to debug or to generate different output
in the future.
"""
if not os.path.exists(folder):
os.makedirs(folder)
partic... | python | def export(cls, folder, particles, datetimes):
"""
Export particle and datetime data to Pickled objects.
This can be used to debug or to generate different output
in the future.
"""
if not os.path.exists(folder):
os.makedirs(folder)
partic... | [
"def",
"export",
"(",
"cls",
",",
"folder",
",",
"particles",
",",
"datetimes",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"folder",
")",
":",
"os",
".",
"makedirs",
"(",
"folder",
")",
"particle_path",
"=",
"os",
".",
"path",
".... | Export particle and datetime data to Pickled objects.
This can be used to debug or to generate different output
in the future. | [
"Export",
"particle",
"and",
"datetime",
"data",
"to",
"Pickled",
"objects",
".",
"This",
"can",
"be",
"used",
"to",
"debug",
"or",
"to",
"generate",
"different",
"output",
"in",
"the",
"future",
"."
] | 99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3 | https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/export.py#L357-L374 | train | 57,805 |
django-fluent/django-fluent-utils | fluent_utils/load.py | import_settings_class | def import_settings_class(setting_name):
"""
Return the class pointed to be an app setting variable.
"""
config_value = getattr(settings, setting_name)
if config_value is None:
raise ImproperlyConfigured("Required setting not found: {0}".format(setting_name))
return import_class(config_... | python | def import_settings_class(setting_name):
"""
Return the class pointed to be an app setting variable.
"""
config_value = getattr(settings, setting_name)
if config_value is None:
raise ImproperlyConfigured("Required setting not found: {0}".format(setting_name))
return import_class(config_... | [
"def",
"import_settings_class",
"(",
"setting_name",
")",
":",
"config_value",
"=",
"getattr",
"(",
"settings",
",",
"setting_name",
")",
"if",
"config_value",
"is",
"None",
":",
"raise",
"ImproperlyConfigured",
"(",
"\"Required setting not found: {0}\"",
".",
"format... | Return the class pointed to be an app setting variable. | [
"Return",
"the",
"class",
"pointed",
"to",
"be",
"an",
"app",
"setting",
"variable",
"."
] | 5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b | https://github.com/django-fluent/django-fluent-utils/blob/5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b/fluent_utils/load.py#L24-L32 | train | 57,806 |
django-fluent/django-fluent-utils | fluent_utils/load.py | import_class | def import_class(import_path, setting_name=None):
"""
Import a class by name.
"""
mod_name, class_name = import_path.rsplit('.', 1)
# import module
mod = import_module_or_none(mod_name)
if mod is not None:
# Loaded module, get attribute
try:
return getattr(mod, c... | python | def import_class(import_path, setting_name=None):
"""
Import a class by name.
"""
mod_name, class_name = import_path.rsplit('.', 1)
# import module
mod = import_module_or_none(mod_name)
if mod is not None:
# Loaded module, get attribute
try:
return getattr(mod, c... | [
"def",
"import_class",
"(",
"import_path",
",",
"setting_name",
"=",
"None",
")",
":",
"mod_name",
",",
"class_name",
"=",
"import_path",
".",
"rsplit",
"(",
"'.'",
",",
"1",
")",
"# import module",
"mod",
"=",
"import_module_or_none",
"(",
"mod_name",
")",
... | Import a class by name. | [
"Import",
"a",
"class",
"by",
"name",
"."
] | 5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b | https://github.com/django-fluent/django-fluent-utils/blob/5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b/fluent_utils/load.py#L35-L54 | train | 57,807 |
django-fluent/django-fluent-utils | fluent_utils/load.py | import_module_or_none | def import_module_or_none(module_label):
"""
Imports the module with the given name.
Returns None if the module doesn't exist,
but it does propagates import errors in deeper modules.
"""
try:
# On Python 3, importlib has much more functionality compared to Python 2.
return impor... | python | def import_module_or_none(module_label):
"""
Imports the module with the given name.
Returns None if the module doesn't exist,
but it does propagates import errors in deeper modules.
"""
try:
# On Python 3, importlib has much more functionality compared to Python 2.
return impor... | [
"def",
"import_module_or_none",
"(",
"module_label",
")",
":",
"try",
":",
"# On Python 3, importlib has much more functionality compared to Python 2.",
"return",
"importlib",
".",
"import_module",
"(",
"module_label",
")",
"except",
"ImportError",
":",
"# Based on code from dj... | Imports the module with the given name.
Returns None if the module doesn't exist,
but it does propagates import errors in deeper modules. | [
"Imports",
"the",
"module",
"with",
"the",
"given",
"name",
"."
] | 5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b | https://github.com/django-fluent/django-fluent-utils/blob/5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b/fluent_utils/load.py#L70-L101 | train | 57,808 |
mitgr81/flog | flog/flog.py | get_logger | def get_logger(name):
"""Gets a logger
Arguments:
name - the name you wish to log as
Returns:
A logger!
"""
logger = logging.getLogger(name)
logger.addHandler(logging.NullHandler())
return logger | python | def get_logger(name):
"""Gets a logger
Arguments:
name - the name you wish to log as
Returns:
A logger!
"""
logger = logging.getLogger(name)
logger.addHandler(logging.NullHandler())
return logger | [
"def",
"get_logger",
"(",
"name",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
")",
"logger",
".",
"addHandler",
"(",
"logging",
".",
"NullHandler",
"(",
")",
")",
"return",
"logger"
] | Gets a logger
Arguments:
name - the name you wish to log as
Returns:
A logger! | [
"Gets",
"a",
"logger"
] | 4c86b98bcc083d6f86741024e2bcad5e94fc9b37 | https://github.com/mitgr81/flog/blob/4c86b98bcc083d6f86741024e2bcad5e94fc9b37/flog/flog.py#L26-L37 | train | 57,809 |
MKLab-ITI/reveal-user-annotation | reveal_user_annotation/twitter/user_lookup.py | check_suspension | def check_suspension(user_twitter_id_list):
"""
Looks up a list of user ids and checks whether they are currently suspended.
Input: - user_twitter_id_list: A python list of Twitter user ids in integer format to be looked-up.
Outputs: - suspended_user_twitter_id_list: A python list of suspended Twitter... | python | def check_suspension(user_twitter_id_list):
"""
Looks up a list of user ids and checks whether they are currently suspended.
Input: - user_twitter_id_list: A python list of Twitter user ids in integer format to be looked-up.
Outputs: - suspended_user_twitter_id_list: A python list of suspended Twitter... | [
"def",
"check_suspension",
"(",
"user_twitter_id_list",
")",
":",
"####################################################################################################################",
"# Log into my application.",
"###################################################################################... | Looks up a list of user ids and checks whether they are currently suspended.
Input: - user_twitter_id_list: A python list of Twitter user ids in integer format to be looked-up.
Outputs: - suspended_user_twitter_id_list: A python list of suspended Twitter user ids in integer format.
- non_suspende... | [
"Looks",
"up",
"a",
"list",
"of",
"user",
"ids",
"and",
"checks",
"whether",
"they",
"are",
"currently",
"suspended",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/user_lookup.py#L12-L74 | train | 57,810 |
andy29485/embypy | embypy/utils/connector.py | WebSocket.handler | async def handler(self):
'''Handle loop, get and process messages'''
self.ws = await websockets.connect(self.url, ssl=self.ssl)
while self.ws:
message = await self.ws.recv()
for handle in self.on_message:
if asyncio.iscoroutinefunction(handle):
await handle(self, message)
... | python | async def handler(self):
'''Handle loop, get and process messages'''
self.ws = await websockets.connect(self.url, ssl=self.ssl)
while self.ws:
message = await self.ws.recv()
for handle in self.on_message:
if asyncio.iscoroutinefunction(handle):
await handle(self, message)
... | [
"async",
"def",
"handler",
"(",
"self",
")",
":",
"self",
".",
"ws",
"=",
"await",
"websockets",
".",
"connect",
"(",
"self",
".",
"url",
",",
"ssl",
"=",
"self",
".",
"ssl",
")",
"while",
"self",
".",
"ws",
":",
"message",
"=",
"await",
"self",
... | Handle loop, get and process messages | [
"Handle",
"loop",
"get",
"and",
"process",
"messages"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L39-L48 | train | 57,811 |
andy29485/embypy | embypy/utils/connector.py | Connector.get_url | def get_url(self, path='/', websocket=False, remote=True,
attach_api_key=True, userId=None, pass_uid=False, **query):
'''construct a url for an emby request
Parameters
----------
path : str
uri path(excluding domain and port) of get request for emby
websocket : bool, optional
... | python | def get_url(self, path='/', websocket=False, remote=True,
attach_api_key=True, userId=None, pass_uid=False, **query):
'''construct a url for an emby request
Parameters
----------
path : str
uri path(excluding domain and port) of get request for emby
websocket : bool, optional
... | [
"def",
"get_url",
"(",
"self",
",",
"path",
"=",
"'/'",
",",
"websocket",
"=",
"False",
",",
"remote",
"=",
"True",
",",
"attach_api_key",
"=",
"True",
",",
"userId",
"=",
"None",
",",
"pass_uid",
"=",
"False",
",",
"*",
"*",
"query",
")",
":",
"us... | construct a url for an emby request
Parameters
----------
path : str
uri path(excluding domain and port) of get request for emby
websocket : bool, optional
if true, then `ws(s)` are used instead of `http(s)`
remote : bool, optional
if true, remote-address is used (default True)
... | [
"construct",
"a",
"url",
"for",
"an",
"emby",
"request"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L201-L257 | train | 57,812 |
andy29485/embypy | embypy/utils/connector.py | Connector.get | async def get(self, path, **query):
'''return a get request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
getJson :
Returns
-------
requests.models.Response
the r... | python | async def get(self, path, **query):
'''return a get request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
getJson :
Returns
-------
requests.models.Response
the r... | [
"async",
"def",
"get",
"(",
"self",
",",
"path",
",",
"*",
"*",
"query",
")",
":",
"url",
"=",
"self",
".",
"get_url",
"(",
"path",
",",
"*",
"*",
"query",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"tries",
"+",
"1",
")",
":",
"try",
... | return a get request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
getJson :
Returns
-------
requests.models.Response
the response that was given | [
"return",
"a",
"get",
"request"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L270-L303 | train | 57,813 |
andy29485/embypy | embypy/utils/connector.py | Connector.post | async def post(self, path, data={}, send_raw=False, **params):
'''sends post request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
Returns
-------
requests.models.Response
... | python | async def post(self, path, data={}, send_raw=False, **params):
'''sends post request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
Returns
-------
requests.models.Response
... | [
"async",
"def",
"post",
"(",
"self",
",",
"path",
",",
"data",
"=",
"{",
"}",
",",
"send_raw",
"=",
"False",
",",
"*",
"*",
"params",
")",
":",
"url",
"=",
"self",
".",
"get_url",
"(",
"path",
",",
"*",
"*",
"params",
")",
"jstr",
"=",
"json",
... | sends post request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
Returns
-------
requests.models.Response
the response that was given | [
"sends",
"post",
"request"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L339-L375 | train | 57,814 |
andy29485/embypy | embypy/utils/connector.py | Connector.getJson | async def getJson(self, path, **query):
'''wrapper for get, parses response as json
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
get :
Returns
-------
dict
the r... | python | async def getJson(self, path, **query):
'''wrapper for get, parses response as json
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
get :
Returns
-------
dict
the r... | [
"async",
"def",
"getJson",
"(",
"self",
",",
"path",
",",
"*",
"*",
"query",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"tries",
"+",
"1",
")",
":",
"try",
":",
"return",
"await",
"(",
"await",
"self",
".",
"get",
"(",
"path",
",",
... | wrapper for get, parses response as json
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
get :
Returns
-------
dict
the response content as a dict | [
"wrapper",
"for",
"get",
"parses",
"response",
"as",
"json"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L378-L403 | train | 57,815 |
limix/geno-sugar | geno_sugar/preprocess.py | standardize | def standardize():
"""
return variant standarize function
"""
def f(G, bim):
G_out = standardize_snps(G)
return G_out, bim
return f | python | def standardize():
"""
return variant standarize function
"""
def f(G, bim):
G_out = standardize_snps(G)
return G_out, bim
return f | [
"def",
"standardize",
"(",
")",
":",
"def",
"f",
"(",
"G",
",",
"bim",
")",
":",
"G_out",
"=",
"standardize_snps",
"(",
"G",
")",
"return",
"G_out",
",",
"bim",
"return",
"f"
] | return variant standarize function | [
"return",
"variant",
"standarize",
"function"
] | 76754e6f103a1fe9883e94ec3993ff7f76e29e2f | https://github.com/limix/geno-sugar/blob/76754e6f103a1fe9883e94ec3993ff7f76e29e2f/geno_sugar/preprocess.py#L37-L46 | train | 57,816 |
limix/geno-sugar | geno_sugar/preprocess.py | impute | def impute(imputer):
"""
return impute function
"""
def f(G, bim):
return imputer.fit_transform(G), bim
return f | python | def impute(imputer):
"""
return impute function
"""
def f(G, bim):
return imputer.fit_transform(G), bim
return f | [
"def",
"impute",
"(",
"imputer",
")",
":",
"def",
"f",
"(",
"G",
",",
"bim",
")",
":",
"return",
"imputer",
".",
"fit_transform",
"(",
"G",
")",
",",
"bim",
"return",
"f"
] | return impute function | [
"return",
"impute",
"function"
] | 76754e6f103a1fe9883e94ec3993ff7f76e29e2f | https://github.com/limix/geno-sugar/blob/76754e6f103a1fe9883e94ec3993ff7f76e29e2f/geno_sugar/preprocess.py#L49-L57 | train | 57,817 |
limix/geno-sugar | geno_sugar/preprocess.py | compose | def compose(func_list):
"""
composion of preprocessing functions
"""
def f(G, bim):
for func in func_list:
G, bim = func(G, bim)
return G, bim
return f | python | def compose(func_list):
"""
composion of preprocessing functions
"""
def f(G, bim):
for func in func_list:
G, bim = func(G, bim)
return G, bim
return f | [
"def",
"compose",
"(",
"func_list",
")",
":",
"def",
"f",
"(",
"G",
",",
"bim",
")",
":",
"for",
"func",
"in",
"func_list",
":",
"G",
",",
"bim",
"=",
"func",
"(",
"G",
",",
"bim",
")",
"return",
"G",
",",
"bim",
"return",
"f"
] | composion of preprocessing functions | [
"composion",
"of",
"preprocessing",
"functions"
] | 76754e6f103a1fe9883e94ec3993ff7f76e29e2f | https://github.com/limix/geno-sugar/blob/76754e6f103a1fe9883e94ec3993ff7f76e29e2f/geno_sugar/preprocess.py#L60-L70 | train | 57,818 |
grimwm/py-dictobj | dictobj.py | DictionaryObject.asdict | def asdict(self):
"""
Copy the data back out of here and into a dict. Then return it.
Some libraries may check specifically for dict objects, such
as the json library; so, this makes it convenient to get the data
back out.
>>> import dictobj
>>> d = {'a':1, 'b':2}
>>> dictobj.Dictionar... | python | def asdict(self):
"""
Copy the data back out of here and into a dict. Then return it.
Some libraries may check specifically for dict objects, such
as the json library; so, this makes it convenient to get the data
back out.
>>> import dictobj
>>> d = {'a':1, 'b':2}
>>> dictobj.Dictionar... | [
"def",
"asdict",
"(",
"self",
")",
":",
"items",
"=",
"{",
"}",
"for",
"name",
"in",
"self",
".",
"_items",
":",
"value",
"=",
"self",
".",
"_items",
"[",
"name",
"]",
"if",
"isinstance",
"(",
"value",
",",
"DictionaryObject",
")",
":",
"items",
"[... | Copy the data back out of here and into a dict. Then return it.
Some libraries may check specifically for dict objects, such
as the json library; so, this makes it convenient to get the data
back out.
>>> import dictobj
>>> d = {'a':1, 'b':2}
>>> dictobj.DictionaryObject(d).asdict() == d
T... | [
"Copy",
"the",
"data",
"back",
"out",
"of",
"here",
"and",
"into",
"a",
"dict",
".",
"Then",
"return",
"it",
".",
"Some",
"libraries",
"may",
"check",
"specifically",
"for",
"dict",
"objects",
"such",
"as",
"the",
"json",
"library",
";",
"so",
"this",
... | d825014e3991a14313e6b4dda65d6a892db3033f | https://github.com/grimwm/py-dictobj/blob/d825014e3991a14313e6b4dda65d6a892db3033f/dictobj.py#L176-L198 | train | 57,819 |
seancallaway/laughs | laughs/laughs.py | get_joke | def get_joke():
"""Return a jokes from one of the random services."""
joke = None
while joke is None:
service_num = randint(1, NUM_SERVICES)
joke = load_joke(service_num)
return joke | python | def get_joke():
"""Return a jokes from one of the random services."""
joke = None
while joke is None:
service_num = randint(1, NUM_SERVICES)
joke = load_joke(service_num)
return joke | [
"def",
"get_joke",
"(",
")",
":",
"joke",
"=",
"None",
"while",
"joke",
"is",
"None",
":",
"service_num",
"=",
"randint",
"(",
"1",
",",
"NUM_SERVICES",
")",
"joke",
"=",
"load_joke",
"(",
"service_num",
")",
"return",
"joke"
] | Return a jokes from one of the random services. | [
"Return",
"a",
"jokes",
"from",
"one",
"of",
"the",
"random",
"services",
"."
] | e13ca6f16b12401b0384bbf1fea86c081e52143d | https://github.com/seancallaway/laughs/blob/e13ca6f16b12401b0384bbf1fea86c081e52143d/laughs/laughs.py#L16-L23 | train | 57,820 |
seancallaway/laughs | laughs/laughs.py | load_joke | def load_joke(service_num=1):
"""Pulls the joke from the service based on the argument.
It is expected that all services used will return a string
when successful or None otherwise.
"""
result = {
1 : ronswanson.get_joke(),
2 : chucknorris.get_joke(),
3 : catfacts.get_joke(),
... | python | def load_joke(service_num=1):
"""Pulls the joke from the service based on the argument.
It is expected that all services used will return a string
when successful or None otherwise.
"""
result = {
1 : ronswanson.get_joke(),
2 : chucknorris.get_joke(),
3 : catfacts.get_joke(),
... | [
"def",
"load_joke",
"(",
"service_num",
"=",
"1",
")",
":",
"result",
"=",
"{",
"1",
":",
"ronswanson",
".",
"get_joke",
"(",
")",
",",
"2",
":",
"chucknorris",
".",
"get_joke",
"(",
")",
",",
"3",
":",
"catfacts",
".",
"get_joke",
"(",
")",
",",
... | Pulls the joke from the service based on the argument.
It is expected that all services used will return a string
when successful or None otherwise. | [
"Pulls",
"the",
"joke",
"from",
"the",
"service",
"based",
"on",
"the",
"argument",
".",
"It",
"is",
"expected",
"that",
"all",
"services",
"used",
"will",
"return",
"a",
"string",
"when",
"successful",
"or",
"None",
"otherwise",
"."
] | e13ca6f16b12401b0384bbf1fea86c081e52143d | https://github.com/seancallaway/laughs/blob/e13ca6f16b12401b0384bbf1fea86c081e52143d/laughs/laughs.py#L26-L39 | train | 57,821 |
brews/snakebacon | snakebacon/records.py | read_14c | def read_14c(fl):
"""Create CalibCurve instance from Bacon curve file
"""
indata = pd.read_csv(fl, index_col=None, skiprows=11, header=None,
names=['calbp', 'c14age', 'error', 'delta14c', 'sigma'])
outcurve = CalibCurve(calbp=indata['calbp'],
c14age=ind... | python | def read_14c(fl):
"""Create CalibCurve instance from Bacon curve file
"""
indata = pd.read_csv(fl, index_col=None, skiprows=11, header=None,
names=['calbp', 'c14age', 'error', 'delta14c', 'sigma'])
outcurve = CalibCurve(calbp=indata['calbp'],
c14age=ind... | [
"def",
"read_14c",
"(",
"fl",
")",
":",
"indata",
"=",
"pd",
".",
"read_csv",
"(",
"fl",
",",
"index_col",
"=",
"None",
",",
"skiprows",
"=",
"11",
",",
"header",
"=",
"None",
",",
"names",
"=",
"[",
"'calbp'",
",",
"'c14age'",
",",
"'error'",
",",... | Create CalibCurve instance from Bacon curve file | [
"Create",
"CalibCurve",
"instance",
"from",
"Bacon",
"curve",
"file"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/records.py#L14-L24 | train | 57,822 |
brews/snakebacon | snakebacon/records.py | read_chron | def read_chron(fl):
"""Create ChronRecord instance from Bacon file
"""
indata = pd.read_csv(fl, sep=r'\s*\,\s*', index_col=None, engine='python')
outcore = ChronRecord(age=indata['age'],
error=indata['error'],
depth=indata['depth'],
... | python | def read_chron(fl):
"""Create ChronRecord instance from Bacon file
"""
indata = pd.read_csv(fl, sep=r'\s*\,\s*', index_col=None, engine='python')
outcore = ChronRecord(age=indata['age'],
error=indata['error'],
depth=indata['depth'],
... | [
"def",
"read_chron",
"(",
"fl",
")",
":",
"indata",
"=",
"pd",
".",
"read_csv",
"(",
"fl",
",",
"sep",
"=",
"r'\\s*\\,\\s*'",
",",
"index_col",
"=",
"None",
",",
"engine",
"=",
"'python'",
")",
"outcore",
"=",
"ChronRecord",
"(",
"age",
"=",
"indata",
... | Create ChronRecord instance from Bacon file | [
"Create",
"ChronRecord",
"instance",
"from",
"Bacon",
"file"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/records.py#L27-L35 | train | 57,823 |
brews/snakebacon | snakebacon/records.py | read_proxy | def read_proxy(fl):
"""Read a file to create a proxy record instance
"""
outcore = ProxyRecord(data=pd.read_csv(fl, sep=r'\s*\,\s*', index_col=None, engine='python'))
return outcore | python | def read_proxy(fl):
"""Read a file to create a proxy record instance
"""
outcore = ProxyRecord(data=pd.read_csv(fl, sep=r'\s*\,\s*', index_col=None, engine='python'))
return outcore | [
"def",
"read_proxy",
"(",
"fl",
")",
":",
"outcore",
"=",
"ProxyRecord",
"(",
"data",
"=",
"pd",
".",
"read_csv",
"(",
"fl",
",",
"sep",
"=",
"r'\\s*\\,\\s*'",
",",
"index_col",
"=",
"None",
",",
"engine",
"=",
"'python'",
")",
")",
"return",
"outcore"... | Read a file to create a proxy record instance | [
"Read",
"a",
"file",
"to",
"create",
"a",
"proxy",
"record",
"instance"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/records.py#L38-L42 | train | 57,824 |
brews/snakebacon | snakebacon/records.py | DatedProxyRecord.to_pandas | def to_pandas(self):
"""Convert record to pandas.DataFrame"""
agedepthdf = pd.DataFrame(self.age, index=self.data.depth)
agedepthdf.columns = list(range(self.n_members()))
out = (agedepthdf.join(self.data.set_index('depth'))
.reset_index()
.melt(id_vars=self... | python | def to_pandas(self):
"""Convert record to pandas.DataFrame"""
agedepthdf = pd.DataFrame(self.age, index=self.data.depth)
agedepthdf.columns = list(range(self.n_members()))
out = (agedepthdf.join(self.data.set_index('depth'))
.reset_index()
.melt(id_vars=self... | [
"def",
"to_pandas",
"(",
"self",
")",
":",
"agedepthdf",
"=",
"pd",
".",
"DataFrame",
"(",
"self",
".",
"age",
",",
"index",
"=",
"self",
".",
"data",
".",
"depth",
")",
"agedepthdf",
".",
"columns",
"=",
"list",
"(",
"range",
"(",
"self",
".",
"n_... | Convert record to pandas.DataFrame | [
"Convert",
"record",
"to",
"pandas",
".",
"DataFrame"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/records.py#L89-L99 | train | 57,825 |
ktdreyer/treq-kerberos | treq_kerberos/__init__.py | negotiate_header | def negotiate_header(url):
"""
Return the "Authorization" HTTP header value to use for this URL.
"""
hostname = urlparse(url).hostname
_, krb_context = kerberos.authGSSClientInit('HTTP@%s' % hostname)
# authGSSClientStep goes over the network to the KDC (ie blocking).
yield threads.deferToTh... | python | def negotiate_header(url):
"""
Return the "Authorization" HTTP header value to use for this URL.
"""
hostname = urlparse(url).hostname
_, krb_context = kerberos.authGSSClientInit('HTTP@%s' % hostname)
# authGSSClientStep goes over the network to the KDC (ie blocking).
yield threads.deferToTh... | [
"def",
"negotiate_header",
"(",
"url",
")",
":",
"hostname",
"=",
"urlparse",
"(",
"url",
")",
".",
"hostname",
"_",
",",
"krb_context",
"=",
"kerberos",
".",
"authGSSClientInit",
"(",
"'HTTP@%s'",
"%",
"hostname",
")",
"# authGSSClientStep goes over the network t... | Return the "Authorization" HTTP header value to use for this URL. | [
"Return",
"the",
"Authorization",
"HTTP",
"header",
"value",
"to",
"use",
"for",
"this",
"URL",
"."
] | 8331867cf2bade6b4f9d6d7035b72679c4eafc28 | https://github.com/ktdreyer/treq-kerberos/blob/8331867cf2bade6b4f9d6d7035b72679c4eafc28/treq_kerberos/__init__.py#L73-L83 | train | 57,826 |
openspending/ckanext-budgets | ckanext/budgets/lib/budgetdatapackage.py | BudgetDataPackage._get_specification | def _get_specification(self, specification):
"""
Read the specification provided. It can either be a url or a file
location.
"""
result = six.moves.urllib.parse.urlparse(specification)
# If the specification has an http or an https scheme we can
# retrieve it via... | python | def _get_specification(self, specification):
"""
Read the specification provided. It can either be a url or a file
location.
"""
result = six.moves.urllib.parse.urlparse(specification)
# If the specification has an http or an https scheme we can
# retrieve it via... | [
"def",
"_get_specification",
"(",
"self",
",",
"specification",
")",
":",
"result",
"=",
"six",
".",
"moves",
".",
"urllib",
".",
"parse",
".",
"urlparse",
"(",
"specification",
")",
"# If the specification has an http or an https scheme we can",
"# retrieve it via an H... | Read the specification provided. It can either be a url or a file
location. | [
"Read",
"the",
"specification",
"provided",
".",
"It",
"can",
"either",
"be",
"a",
"url",
"or",
"a",
"file",
"location",
"."
] | 07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc | https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/lib/budgetdatapackage.py#L25-L42 | train | 57,827 |
openspending/ckanext-budgets | ckanext/budgets/lib/budgetdatapackage.py | BudgetDataPackage._get_headers | def _get_headers(self, resource):
"""
Get CSV file headers from the provided resource.
"""
# If the resource is a file we just open it up with the csv
# reader (after being sure we're reading from the beginning
# of the file
if type(resource) == file:
... | python | def _get_headers(self, resource):
"""
Get CSV file headers from the provided resource.
"""
# If the resource is a file we just open it up with the csv
# reader (after being sure we're reading from the beginning
# of the file
if type(resource) == file:
... | [
"def",
"_get_headers",
"(",
"self",
",",
"resource",
")",
":",
"# If the resource is a file we just open it up with the csv",
"# reader (after being sure we're reading from the beginning",
"# of the file",
"if",
"type",
"(",
"resource",
")",
"==",
"file",
":",
"resource",
"."... | Get CSV file headers from the provided resource. | [
"Get",
"CSV",
"file",
"headers",
"from",
"the",
"provided",
"resource",
"."
] | 07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc | https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/lib/budgetdatapackage.py#L44-L77 | train | 57,828 |
openspending/ckanext-budgets | ckanext/budgets/lib/budgetdatapackage.py | BudgetDataPackage.schema | def schema(self):
"""
The generated budget data package schema for this resource.
If the resource has any fields that do not conform to the
provided specification this will raise a
NotABudgetDataPackageException.
"""
if self.headers is None:
raise exc... | python | def schema(self):
"""
The generated budget data package schema for this resource.
If the resource has any fields that do not conform to the
provided specification this will raise a
NotABudgetDataPackageException.
"""
if self.headers is None:
raise exc... | [
"def",
"schema",
"(",
"self",
")",
":",
"if",
"self",
".",
"headers",
"is",
"None",
":",
"raise",
"exceptions",
".",
"NoResourceLoadedException",
"(",
"'Resource must be loaded to find schema'",
")",
"try",
":",
"fields",
"=",
"self",
".",
"specification",
".",
... | The generated budget data package schema for this resource.
If the resource has any fields that do not conform to the
provided specification this will raise a
NotABudgetDataPackageException. | [
"The",
"generated",
"budget",
"data",
"package",
"schema",
"for",
"this",
"resource",
".",
"If",
"the",
"resource",
"has",
"any",
"fields",
"that",
"do",
"not",
"conform",
"to",
"the",
"provided",
"specification",
"this",
"will",
"raise",
"a",
"NotABudgetDataP... | 07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc | https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/lib/budgetdatapackage.py#L95-L119 | train | 57,829 |
RI-imaging/qpformat | qpformat/file_formats/single_tif_phasics.py | SingleTifPhasics.get_time | def get_time(self, idx=0):
"""Return the time of the tif data since the epoch
The time is stored in the "61238" tag.
"""
timestr = SingleTifPhasics._get_meta_data(path=self.path,
section="acquisition info",
... | python | def get_time(self, idx=0):
"""Return the time of the tif data since the epoch
The time is stored in the "61238" tag.
"""
timestr = SingleTifPhasics._get_meta_data(path=self.path,
section="acquisition info",
... | [
"def",
"get_time",
"(",
"self",
",",
"idx",
"=",
"0",
")",
":",
"timestr",
"=",
"SingleTifPhasics",
".",
"_get_meta_data",
"(",
"path",
"=",
"self",
".",
"path",
",",
"section",
"=",
"\"acquisition info\"",
",",
"name",
"=",
"\"date & heure\"",
")",
"if",
... | Return the time of the tif data since the epoch
The time is stored in the "61238" tag. | [
"Return",
"the",
"time",
"of",
"the",
"tif",
"data",
"since",
"the",
"epoch"
] | 364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb | https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/single_tif_phasics.py#L95-L113 | train | 57,830 |
calmjs/nunja | src/nunja/registry.py | MoldRegistry._generate_and_store_mold_id_map | def _generate_and_store_mold_id_map(self, template_map, molds):
"""
Not a pure generator expression as this has the side effect of
storing the resulting id and map it into a local dict. Produces
a list of all valid mold_ids from the input template_keys.
Internal function; NOT m... | python | def _generate_and_store_mold_id_map(self, template_map, molds):
"""
Not a pure generator expression as this has the side effect of
storing the resulting id and map it into a local dict. Produces
a list of all valid mold_ids from the input template_keys.
Internal function; NOT m... | [
"def",
"_generate_and_store_mold_id_map",
"(",
"self",
",",
"template_map",
",",
"molds",
")",
":",
"name",
"=",
"self",
".",
"req_tmpl_name",
"for",
"key",
"in",
"sorted",
"(",
"template_map",
".",
"keys",
"(",
")",
",",
"reverse",
"=",
"True",
")",
":",
... | Not a pure generator expression as this has the side effect of
storing the resulting id and map it into a local dict. Produces
a list of all valid mold_ids from the input template_keys.
Internal function; NOT meant to be used outside of this class. | [
"Not",
"a",
"pure",
"generator",
"expression",
"as",
"this",
"has",
"the",
"side",
"effect",
"of",
"storing",
"the",
"resulting",
"id",
"and",
"map",
"it",
"into",
"a",
"local",
"dict",
".",
"Produces",
"a",
"list",
"of",
"all",
"valid",
"mold_ids",
"fro... | 37ba114ca2239322718fd9994bb078c037682c33 | https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/registry.py#L134-L148 | train | 57,831 |
calmjs/nunja | src/nunja/registry.py | MoldRegistry.mold_id_to_path | def mold_id_to_path(self, mold_id, default=_marker):
"""
Lookup the filesystem path of a mold identifier.
"""
def handle_default(debug_msg=None):
if debug_msg:
logger.debug('mold_id_to_path:' + debug_msg, mold_id)
if default is _marker:
... | python | def mold_id_to_path(self, mold_id, default=_marker):
"""
Lookup the filesystem path of a mold identifier.
"""
def handle_default(debug_msg=None):
if debug_msg:
logger.debug('mold_id_to_path:' + debug_msg, mold_id)
if default is _marker:
... | [
"def",
"mold_id_to_path",
"(",
"self",
",",
"mold_id",
",",
"default",
"=",
"_marker",
")",
":",
"def",
"handle_default",
"(",
"debug_msg",
"=",
"None",
")",
":",
"if",
"debug_msg",
":",
"logger",
".",
"debug",
"(",
"'mold_id_to_path:'",
"+",
"debug_msg",
... | Lookup the filesystem path of a mold identifier. | [
"Lookup",
"the",
"filesystem",
"path",
"of",
"a",
"mold",
"identifier",
"."
] | 37ba114ca2239322718fd9994bb078c037682c33 | https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/registry.py#L204-L233 | train | 57,832 |
calmjs/nunja | src/nunja/registry.py | MoldRegistry.lookup_path | def lookup_path(self, mold_id_path, default=_marker):
"""
For the given mold_id_path, look up the mold_id and translate
that path to its filesystem equivalent.
"""
fragments = mold_id_path.split('/')
mold_id = '/'.join(fragments[:2])
try:
subpath = []... | python | def lookup_path(self, mold_id_path, default=_marker):
"""
For the given mold_id_path, look up the mold_id and translate
that path to its filesystem equivalent.
"""
fragments = mold_id_path.split('/')
mold_id = '/'.join(fragments[:2])
try:
subpath = []... | [
"def",
"lookup_path",
"(",
"self",
",",
"mold_id_path",
",",
"default",
"=",
"_marker",
")",
":",
"fragments",
"=",
"mold_id_path",
".",
"split",
"(",
"'/'",
")",
"mold_id",
"=",
"'/'",
".",
"join",
"(",
"fragments",
"[",
":",
"2",
"]",
")",
"try",
"... | For the given mold_id_path, look up the mold_id and translate
that path to its filesystem equivalent. | [
"For",
"the",
"given",
"mold_id_path",
"look",
"up",
"the",
"mold_id",
"and",
"translate",
"that",
"path",
"to",
"its",
"filesystem",
"equivalent",
"."
] | 37ba114ca2239322718fd9994bb078c037682c33 | https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/registry.py#L235-L257 | train | 57,833 |
calmjs/nunja | src/nunja/registry.py | MoldRegistry.verify_path | def verify_path(self, mold_id_path):
"""
Lookup and verify path.
"""
try:
path = self.lookup_path(mold_id_path)
if not exists(path):
raise KeyError
except KeyError:
raise_os_error(ENOENT)
return path | python | def verify_path(self, mold_id_path):
"""
Lookup and verify path.
"""
try:
path = self.lookup_path(mold_id_path)
if not exists(path):
raise KeyError
except KeyError:
raise_os_error(ENOENT)
return path | [
"def",
"verify_path",
"(",
"self",
",",
"mold_id_path",
")",
":",
"try",
":",
"path",
"=",
"self",
".",
"lookup_path",
"(",
"mold_id_path",
")",
"if",
"not",
"exists",
"(",
"path",
")",
":",
"raise",
"KeyError",
"except",
"KeyError",
":",
"raise_os_error",... | Lookup and verify path. | [
"Lookup",
"and",
"verify",
"path",
"."
] | 37ba114ca2239322718fd9994bb078c037682c33 | https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/registry.py#L260-L271 | train | 57,834 |
hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._get_skippers | def _get_skippers(configure, file_name=None):
"""
Returns the skippers of configuration.
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure
:param file_name: The file path of skippers configuration.
:type file_name: str
... | python | def _get_skippers(configure, file_name=None):
"""
Returns the skippers of configuration.
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure
:param file_name: The file path of skippers configuration.
:type file_name: str
... | [
"def",
"_get_skippers",
"(",
"configure",
",",
"file_name",
"=",
"None",
")",
":",
"skippers",
"=",
"[",
"]",
"if",
"file_name",
"is",
"None",
":",
"file_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
... | Returns the skippers of configuration.
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure
:param file_name: The file path of skippers configuration.
:type file_name: str
:return: The skippers of configuration.
:rtype: list... | [
"Returns",
"the",
"skippers",
"of",
"configuration",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L134-L163 | train | 57,835 |
hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._generate_list_skippers | def _generate_list_skippers(self):
"""
Generate the list of skippers of page.
:return: The list of skippers of page.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
container = self.parser.find(
'#'
+ AccessibleNavigationImplementati... | python | def _generate_list_skippers(self):
"""
Generate the list of skippers of page.
:return: The list of skippers of page.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
container = self.parser.find(
'#'
+ AccessibleNavigationImplementati... | [
"def",
"_generate_list_skippers",
"(",
"self",
")",
":",
"container",
"=",
"self",
".",
"parser",
".",
"find",
"(",
"'#'",
"+",
"AccessibleNavigationImplementation",
".",
"ID_CONTAINER_SKIPPERS",
")",
".",
"first_result",
"(",
")",
"html_list",
"=",
"None",
"if"... | Generate the list of skippers of page.
:return: The list of skippers of page.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Generate",
"the",
"list",
"of",
"skippers",
"of",
"page",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L165-L196 | train | 57,836 |
hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._generate_list_heading | def _generate_list_heading(self):
"""
Generate the list of heading links of page.
"""
local = self.parser.find('body').first_result()
id_container_heading_before = (
AccessibleNavigationImplementation.ID_CONTAINER_HEADING_BEFORE
)
id_container_heading... | python | def _generate_list_heading(self):
"""
Generate the list of heading links of page.
"""
local = self.parser.find('body').first_result()
id_container_heading_before = (
AccessibleNavigationImplementation.ID_CONTAINER_HEADING_BEFORE
)
id_container_heading... | [
"def",
"_generate_list_heading",
"(",
"self",
")",
":",
"local",
"=",
"self",
".",
"parser",
".",
"find",
"(",
"'body'",
")",
".",
"first_result",
"(",
")",
"id_container_heading_before",
"=",
"(",
"AccessibleNavigationImplementation",
".",
"ID_CONTAINER_HEADING_BEF... | Generate the list of heading links of page. | [
"Generate",
"the",
"list",
"of",
"heading",
"links",
"of",
"page",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L198-L263 | train | 57,837 |
hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._get_heading_level | def _get_heading_level(self, element):
"""
Returns the level of heading.
:param element: The heading.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:return: The level of heading.
:rtype: int
"""
# pylint: disable=no-self-use
tag... | python | def _get_heading_level(self, element):
"""
Returns the level of heading.
:param element: The heading.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:return: The level of heading.
:rtype: int
"""
# pylint: disable=no-self-use
tag... | [
"def",
"_get_heading_level",
"(",
"self",
",",
"element",
")",
":",
"# pylint: disable=no-self-use",
"tag",
"=",
"element",
".",
"get_tag_name",
"(",
")",
"if",
"tag",
"==",
"'H1'",
":",
"return",
"1",
"elif",
"tag",
"==",
"'H2'",
":",
"return",
"2",
"elif... | Returns the level of heading.
:param element: The heading.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:return: The level of heading.
:rtype: int | [
"Returns",
"the",
"level",
"of",
"heading",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L265-L289 | train | 57,838 |
hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._is_valid_heading | def _is_valid_heading(self):
"""
Check that the headings of page are sintatic correct.
:return: True if the headings of page are sintatic correct or False if
not.
:rtype: bool
"""
elements = self.parser.find('h1,h2,h3,h4,h5,h6').list_results()
l... | python | def _is_valid_heading(self):
"""
Check that the headings of page are sintatic correct.
:return: True if the headings of page are sintatic correct or False if
not.
:rtype: bool
"""
elements = self.parser.find('h1,h2,h3,h4,h5,h6').list_results()
l... | [
"def",
"_is_valid_heading",
"(",
"self",
")",
":",
"elements",
"=",
"self",
".",
"parser",
".",
"find",
"(",
"'h1,h2,h3,h4,h5,h6'",
")",
".",
"list_results",
"(",
")",
"last_level",
"=",
"0",
"count_main_heading",
"=",
"0",
"self",
".",
"validate_heading",
"... | Check that the headings of page are sintatic correct.
:return: True if the headings of page are sintatic correct or False if
not.
:rtype: bool | [
"Check",
"that",
"the",
"headings",
"of",
"page",
"are",
"sintatic",
"correct",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L291-L314 | train | 57,839 |
hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._generate_anchor_for | def _generate_anchor_for(self, element, data_attribute, anchor_class):
"""
Generate an anchor for the element.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param data_attribute: The name of attribute that links the element
... | python | def _generate_anchor_for(self, element, data_attribute, anchor_class):
"""
Generate an anchor for the element.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param data_attribute: The name of attribute that links the element
... | [
"def",
"_generate_anchor_for",
"(",
"self",
",",
"element",
",",
"data_attribute",
",",
"anchor_class",
")",
":",
"self",
".",
"id_generator",
".",
"generate_id",
"(",
"element",
")",
"if",
"self",
".",
"parser",
".",
"find",
"(",
"'['",
"+",
"data_attribute... | Generate an anchor for the element.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param data_attribute: The name of attribute that links the element
with the anchor.
:type data_attribute: str
:param a... | [
"Generate",
"an",
"anchor",
"for",
"the",
"element",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L316-L346 | train | 57,840 |
hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._free_shortcut | def _free_shortcut(self, shortcut):
"""
Replace the shortcut of elements, that has the shortcut passed.
:param shortcut: The shortcut.
:type shortcut: str
"""
alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz'
elements = self.parser.find('[accesskey]').list_... | python | def _free_shortcut(self, shortcut):
"""
Replace the shortcut of elements, that has the shortcut passed.
:param shortcut: The shortcut.
:type shortcut: str
"""
alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz'
elements = self.parser.find('[accesskey]').list_... | [
"def",
"_free_shortcut",
"(",
"self",
",",
"shortcut",
")",
":",
"alpha_numbers",
"=",
"'1234567890abcdefghijklmnopqrstuvwxyz'",
"elements",
"=",
"self",
".",
"parser",
".",
"find",
"(",
"'[accesskey]'",
")",
".",
"list_results",
"(",
")",
"found",
"=",
"False",... | Replace the shortcut of elements, that has the shortcut passed.
:param shortcut: The shortcut.
:type shortcut: str | [
"Replace",
"the",
"shortcut",
"of",
"elements",
"that",
"has",
"the",
"shortcut",
"passed",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L348-L375 | train | 57,841 |
danbradham/scrim | scrim/api.py | Scrim._add | def _add(self, name, *args, **kwargs):
'''Appends a command to the scrims list of commands. You should not
need to use this.'''
self.commands.append(Command(name, args, kwargs)) | python | def _add(self, name, *args, **kwargs):
'''Appends a command to the scrims list of commands. You should not
need to use this.'''
self.commands.append(Command(name, args, kwargs)) | [
"def",
"_add",
"(",
"self",
",",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"commands",
".",
"append",
"(",
"Command",
"(",
"name",
",",
"args",
",",
"kwargs",
")",
")"
] | Appends a command to the scrims list of commands. You should not
need to use this. | [
"Appends",
"a",
"command",
"to",
"the",
"scrims",
"list",
"of",
"commands",
".",
"You",
"should",
"not",
"need",
"to",
"use",
"this",
"."
] | 982a5db1db6e4ef40267f15642af2c7ea0e803ae | https://github.com/danbradham/scrim/blob/982a5db1db6e4ef40267f15642af2c7ea0e803ae/scrim/api.py#L63-L67 | train | 57,842 |
danbradham/scrim | scrim/api.py | Scrim.write | def write(self):
'''Write this Scrims commands to its path'''
if self.path is None:
raise Exception('Scrim.path is None')
dirname = os.path.dirname(os.path.abspath(self.path))
if not os.path.exists(dirname):
try:
os.makedirs(dirname)
... | python | def write(self):
'''Write this Scrims commands to its path'''
if self.path is None:
raise Exception('Scrim.path is None')
dirname = os.path.dirname(os.path.abspath(self.path))
if not os.path.exists(dirname):
try:
os.makedirs(dirname)
... | [
"def",
"write",
"(",
"self",
")",
":",
"if",
"self",
".",
"path",
"is",
"None",
":",
"raise",
"Exception",
"(",
"'Scrim.path is None'",
")",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
... | Write this Scrims commands to its path | [
"Write",
"this",
"Scrims",
"commands",
"to",
"its",
"path"
] | 982a5db1db6e4ef40267f15642af2c7ea0e803ae | https://github.com/danbradham/scrim/blob/982a5db1db6e4ef40267f15642af2c7ea0e803ae/scrim/api.py#L225-L239 | train | 57,843 |
tBaxter/activity-monitor | activity_monitor/managers.py | ActivityItemManager.remove_orphans | def remove_orphans(self, instance, **kwargs):
"""
When an item is deleted, first delete any Activity object that has been created
on its behalf.
"""
from activity_monitor.models import Activity
try:
instance_content_type = ContentType.objects.get_for_model(instance)
t... | python | def remove_orphans(self, instance, **kwargs):
"""
When an item is deleted, first delete any Activity object that has been created
on its behalf.
"""
from activity_monitor.models import Activity
try:
instance_content_type = ContentType.objects.get_for_model(instance)
t... | [
"def",
"remove_orphans",
"(",
"self",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"activity_monitor",
".",
"models",
"import",
"Activity",
"try",
":",
"instance_content_type",
"=",
"ContentType",
".",
"objects",
".",
"get_for_model",
"(",
"inst... | When an item is deleted, first delete any Activity object that has been created
on its behalf. | [
"When",
"an",
"item",
"is",
"deleted",
"first",
"delete",
"any",
"Activity",
"object",
"that",
"has",
"been",
"created",
"on",
"its",
"behalf",
"."
] | be6c6edc7c6b4141923b47376502cde0f785eb68 | https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L19-L30 | train | 57,844 |
tBaxter/activity-monitor | activity_monitor/managers.py | ActivityItemManager.follow_model | def follow_model(self, model):
"""
Follow a particular model class, updating associated Activity objects automatically.
"""
if model:
self.models_by_name[model.__name__.lower()] = model
signals.post_save.connect(create_or_update, sender=model)
signals.post_d... | python | def follow_model(self, model):
"""
Follow a particular model class, updating associated Activity objects automatically.
"""
if model:
self.models_by_name[model.__name__.lower()] = model
signals.post_save.connect(create_or_update, sender=model)
signals.post_d... | [
"def",
"follow_model",
"(",
"self",
",",
"model",
")",
":",
"if",
"model",
":",
"self",
".",
"models_by_name",
"[",
"model",
".",
"__name__",
".",
"lower",
"(",
")",
"]",
"=",
"model",
"signals",
".",
"post_save",
".",
"connect",
"(",
"create_or_update",... | Follow a particular model class, updating associated Activity objects automatically. | [
"Follow",
"a",
"particular",
"model",
"class",
"updating",
"associated",
"Activity",
"objects",
"automatically",
"."
] | be6c6edc7c6b4141923b47376502cde0f785eb68 | https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L32-L39 | train | 57,845 |
tBaxter/activity-monitor | activity_monitor/managers.py | ActivityItemManager.get_for_model | def get_for_model(self, model):
"""
Return a QuerySet of only items of a certain type.
"""
return self.filter(content_type=ContentType.objects.get_for_model(model)) | python | def get_for_model(self, model):
"""
Return a QuerySet of only items of a certain type.
"""
return self.filter(content_type=ContentType.objects.get_for_model(model)) | [
"def",
"get_for_model",
"(",
"self",
",",
"model",
")",
":",
"return",
"self",
".",
"filter",
"(",
"content_type",
"=",
"ContentType",
".",
"objects",
".",
"get_for_model",
"(",
"model",
")",
")"
] | Return a QuerySet of only items of a certain type. | [
"Return",
"a",
"QuerySet",
"of",
"only",
"items",
"of",
"a",
"certain",
"type",
"."
] | be6c6edc7c6b4141923b47376502cde0f785eb68 | https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L41-L45 | train | 57,846 |
tBaxter/activity-monitor | activity_monitor/managers.py | ActivityItemManager.get_last_update_of_model | def get_last_update_of_model(self, model, **kwargs):
"""
Return the last time a given model's items were updated. Returns the
epoch if the items were never updated.
"""
qs = self.get_for_model(model)
if kwargs:
qs = qs.filter(**kwargs)
try:
... | python | def get_last_update_of_model(self, model, **kwargs):
"""
Return the last time a given model's items were updated. Returns the
epoch if the items were never updated.
"""
qs = self.get_for_model(model)
if kwargs:
qs = qs.filter(**kwargs)
try:
... | [
"def",
"get_last_update_of_model",
"(",
"self",
",",
"model",
",",
"*",
"*",
"kwargs",
")",
":",
"qs",
"=",
"self",
".",
"get_for_model",
"(",
"model",
")",
"if",
"kwargs",
":",
"qs",
"=",
"qs",
".",
"filter",
"(",
"*",
"*",
"kwargs",
")",
"try",
"... | Return the last time a given model's items were updated. Returns the
epoch if the items were never updated. | [
"Return",
"the",
"last",
"time",
"a",
"given",
"model",
"s",
"items",
"were",
"updated",
".",
"Returns",
"the",
"epoch",
"if",
"the",
"items",
"were",
"never",
"updated",
"."
] | be6c6edc7c6b4141923b47376502cde0f785eb68 | https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L47-L58 | train | 57,847 |
daviesjamie/spout | spout/streams.py | Stream.for_each | def for_each(self, operation, limit=0, verbose=False):
"""
Applies the given Operation to each item in the stream. The Operation executes on the
items in the stream in the order that they appear in the stream.
If the limit is supplied, then processing of the stream will stop after that ... | python | def for_each(self, operation, limit=0, verbose=False):
"""
Applies the given Operation to each item in the stream. The Operation executes on the
items in the stream in the order that they appear in the stream.
If the limit is supplied, then processing of the stream will stop after that ... | [
"def",
"for_each",
"(",
"self",
",",
"operation",
",",
"limit",
"=",
"0",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"limit",
"!=",
"0",
":",
"count",
"=",
"0",
"while",
"self",
".",
"has_next",
"(",
")",
":",
"operation",
".",
"perform",
"(",
... | Applies the given Operation to each item in the stream. The Operation executes on the
items in the stream in the order that they appear in the stream.
If the limit is supplied, then processing of the stream will stop after that many items
have been processed. | [
"Applies",
"the",
"given",
"Operation",
"to",
"each",
"item",
"in",
"the",
"stream",
".",
"The",
"Operation",
"executes",
"on",
"the",
"items",
"in",
"the",
"stream",
"in",
"the",
"order",
"that",
"they",
"appear",
"in",
"the",
"stream",
"."
] | c2c16fc55429c53718f2b2dcd34d93f251680de5 | https://github.com/daviesjamie/spout/blob/c2c16fc55429c53718f2b2dcd34d93f251680de5/spout/streams.py#L11-L30 | train | 57,848 |
thomasw/querylist | querylist/fieldlookup.py | FieldLookup.iregex | def iregex(value, iregex):
"""Returns true if the value case insentively matches agains the
regex.
"""
return re.match(iregex, value, flags=re.I) | python | def iregex(value, iregex):
"""Returns true if the value case insentively matches agains the
regex.
"""
return re.match(iregex, value, flags=re.I) | [
"def",
"iregex",
"(",
"value",
",",
"iregex",
")",
":",
"return",
"re",
".",
"match",
"(",
"iregex",
",",
"value",
",",
"flags",
"=",
"re",
".",
"I",
")"
] | Returns true if the value case insentively matches agains the
regex. | [
"Returns",
"true",
"if",
"the",
"value",
"case",
"insentively",
"matches",
"agains",
"the",
"regex",
"."
] | 4304023ef3330238ef3abccaa530ee97011fba2d | https://github.com/thomasw/querylist/blob/4304023ef3330238ef3abccaa530ee97011fba2d/querylist/fieldlookup.py#L142-L147 | train | 57,849 |
AtomHash/evernode | evernode/functions/utils.py | get_subdirectories | def get_subdirectories(directory):
""" Get subdirectories without pycache """
return [name for name in os.listdir(directory)
if name != '__pycache__'
if os.path.isdir(os.path.join(directory, name))] | python | def get_subdirectories(directory):
""" Get subdirectories without pycache """
return [name for name in os.listdir(directory)
if name != '__pycache__'
if os.path.isdir(os.path.join(directory, name))] | [
"def",
"get_subdirectories",
"(",
"directory",
")",
":",
"return",
"[",
"name",
"for",
"name",
"in",
"os",
".",
"listdir",
"(",
"directory",
")",
"if",
"name",
"!=",
"'__pycache__'",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
... | Get subdirectories without pycache | [
"Get",
"subdirectories",
"without",
"pycache"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/functions/utils.py#L5-L9 | train | 57,850 |
AtomHash/evernode | evernode/functions/utils.py | get_python_path | def get_python_path() -> str:
""" Accurately get python executable """
python_bin = None
if os.name == 'nt':
python_root = os.path.abspath(
os.path.join(os.__file__, os.pardir, os.pardir))
python_bin = os.path.join(python_root, 'python.exe')
else:
python_root ... | python | def get_python_path() -> str:
""" Accurately get python executable """
python_bin = None
if os.name == 'nt':
python_root = os.path.abspath(
os.path.join(os.__file__, os.pardir, os.pardir))
python_bin = os.path.join(python_root, 'python.exe')
else:
python_root ... | [
"def",
"get_python_path",
"(",
")",
"->",
"str",
":",
"python_bin",
"=",
"None",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"python_root",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"__file__",
","... | Accurately get python executable | [
"Accurately",
"get",
"python",
"executable"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/functions/utils.py#L12-L24 | train | 57,851 |
AtomHash/evernode | evernode/classes/user_auth.py | UserAuth.__collect_fields | def __collect_fields(self):
""" Use field values from config.json and collect from request """
form = FormData()
form.add_field(self.__username_field, required=True,
error=self.__username_error)
form.add_field(self.__password_field, required=True,
... | python | def __collect_fields(self):
""" Use field values from config.json and collect from request """
form = FormData()
form.add_field(self.__username_field, required=True,
error=self.__username_error)
form.add_field(self.__password_field, required=True,
... | [
"def",
"__collect_fields",
"(",
"self",
")",
":",
"form",
"=",
"FormData",
"(",
")",
"form",
".",
"add_field",
"(",
"self",
".",
"__username_field",
",",
"required",
"=",
"True",
",",
"error",
"=",
"self",
".",
"__username_error",
")",
"form",
".",
"add_... | Use field values from config.json and collect from request | [
"Use",
"field",
"values",
"from",
"config",
".",
"json",
"and",
"collect",
"from",
"request"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/user_auth.py#L32-L42 | train | 57,852 |
ponty/confduino | confduino/boardinstall.py | install_board | def install_board(board_id, board_options, hwpack='arduino', replace_existing=False):
"""install board in boards.txt.
:param board_id: string identifier
:param board_options: dict like
:param replace_existing: bool
:rtype: None
"""
doaction = 0
if board_id in boards(hwpack).keys():
... | python | def install_board(board_id, board_options, hwpack='arduino', replace_existing=False):
"""install board in boards.txt.
:param board_id: string identifier
:param board_options: dict like
:param replace_existing: bool
:rtype: None
"""
doaction = 0
if board_id in boards(hwpack).keys():
... | [
"def",
"install_board",
"(",
"board_id",
",",
"board_options",
",",
"hwpack",
"=",
"'arduino'",
",",
"replace_existing",
"=",
"False",
")",
":",
"doaction",
"=",
"0",
"if",
"board_id",
"in",
"boards",
"(",
"hwpack",
")",
".",
"keys",
"(",
")",
":",
"log"... | install board in boards.txt.
:param board_id: string identifier
:param board_options: dict like
:param replace_existing: bool
:rtype: None | [
"install",
"board",
"in",
"boards",
".",
"txt",
"."
] | f4c261e5e84997f145a8bdd001f471db74c9054b | https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/boardinstall.py#L11-L32 | train | 57,853 |
asascience-open/paegan-transport | paegan/transport/utils/asasuncycles.py | SunCycles.cycles | def cycles(cls, **kwargs):
"""
Classmethod for convienence in returning both the sunrise and sunset
based on a location and date. Always calculates the sunrise and sunset on the
given date, no matter the time passed into the function in the datetime object.
Parameters:
... | python | def cycles(cls, **kwargs):
"""
Classmethod for convienence in returning both the sunrise and sunset
based on a location and date. Always calculates the sunrise and sunset on the
given date, no matter the time passed into the function in the datetime object.
Parameters:
... | [
"def",
"cycles",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"loc\"",
"not",
"in",
"kwargs",
":",
"if",
"\"point\"",
"not",
"in",
"kwargs",
":",
"if",
"\"lat\"",
"not",
"in",
"kwargs",
"or",
"\"lon\"",
"not",
"in",
"kwargs",
":",
"raise",
... | Classmethod for convienence in returning both the sunrise and sunset
based on a location and date. Always calculates the sunrise and sunset on the
given date, no matter the time passed into the function in the datetime object.
Parameters:
loc = Location4D (object)
O... | [
"Classmethod",
"for",
"convienence",
"in",
"returning",
"both",
"the",
"sunrise",
"and",
"sunset",
"based",
"on",
"a",
"location",
"and",
"date",
".",
"Always",
"calculates",
"the",
"sunrise",
"and",
"sunset",
"on",
"the",
"given",
"date",
"no",
"matter",
"t... | 99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3 | https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/utils/asasuncycles.py#L12-L88 | train | 57,854 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._operation_speak_as_spell_out | def _operation_speak_as_spell_out(self, content, index, children):
"""
The operation method of _speak_as method for spell-out.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type index: int
... | python | def _operation_speak_as_spell_out(self, content, index, children):
"""
The operation method of _speak_as method for spell-out.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type index: int
... | [
"def",
"_operation_speak_as_spell_out",
"(",
"self",
",",
"content",
",",
"index",
",",
"children",
")",
":",
"children",
".",
"append",
"(",
"self",
".",
"_create_content_element",
"(",
"content",
"[",
"0",
":",
"(",
"index",
"+",
"1",
")",
"]",
",",
"'... | The operation method of _speak_as method for spell-out.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type index: int
:param children: The children of element.
:type children: list(hatemile... | [
"The",
"operation",
"method",
"of",
"_speak_as",
"method",
"for",
"spell",
"-",
"out",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L208-L227 | train | 57,855 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._operation_speak_as_literal_punctuation | def _operation_speak_as_literal_punctuation(
self,
content,
index,
children
):
"""
The operation method of _speak_as method for literal-punctuation.
:param content: The text content of element.
:type content: str
:param index: The index of pat... | python | def _operation_speak_as_literal_punctuation(
self,
content,
index,
children
):
"""
The operation method of _speak_as method for literal-punctuation.
:param content: The text content of element.
:type content: str
:param index: The index of pat... | [
"def",
"_operation_speak_as_literal_punctuation",
"(",
"self",
",",
"content",
",",
"index",
",",
"children",
")",
":",
"data_property_value",
"=",
"'literal-punctuation'",
"if",
"index",
"!=",
"0",
":",
"children",
".",
"append",
"(",
"self",
".",
"_create_conten... | The operation method of _speak_as method for literal-punctuation.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type index: int
:param children: The children of element.
:type children: lis... | [
"The",
"operation",
"method",
"of",
"_speak_as",
"method",
"for",
"literal",
"-",
"punctuation",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L229-L266 | train | 57,856 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._operation_speak_as_no_punctuation | def _operation_speak_as_no_punctuation(self, content, index, children):
"""
The operation method of _speak_as method for no-punctuation.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type i... | python | def _operation_speak_as_no_punctuation(self, content, index, children):
"""
The operation method of _speak_as method for no-punctuation.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type i... | [
"def",
"_operation_speak_as_no_punctuation",
"(",
"self",
",",
"content",
",",
"index",
",",
"children",
")",
":",
"if",
"index",
"!=",
"0",
":",
"children",
".",
"append",
"(",
"self",
".",
"_create_content_element",
"(",
"content",
"[",
"0",
":",
"index",
... | The operation method of _speak_as method for no-punctuation.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type index: int
:param children: The children of element.
:type children: list(hat... | [
"The",
"operation",
"method",
"of",
"_speak_as",
"method",
"for",
"no",
"-",
"punctuation",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L268-L290 | train | 57,857 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._operation_speak_as_digits | def _operation_speak_as_digits(self, content, index, children):
"""
The operation method of _speak_as method for digits.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type index: int
... | python | def _operation_speak_as_digits(self, content, index, children):
"""
The operation method of _speak_as method for digits.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type index: int
... | [
"def",
"_operation_speak_as_digits",
"(",
"self",
",",
"content",
",",
"index",
",",
"children",
")",
":",
"data_property_value",
"=",
"'digits'",
"if",
"index",
"!=",
"0",
":",
"children",
".",
"append",
"(",
"self",
".",
"_create_content_element",
"(",
"cont... | The operation method of _speak_as method for digits.
:param content: The text content of element.
:type content: str
:param index: The index of pattern in text content of element.
:type index: int
:param children: The children of element.
:type children: list(hatemile.ut... | [
"The",
"operation",
"method",
"of",
"_speak_as",
"method",
"for",
"digits",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L292-L320 | train | 57,858 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._set_symbols | def _set_symbols(self, file_name, configure):
"""
Load the symbols with configuration.
:param file_name: The file path of symbol configuration.
:type file_name: str
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure
... | python | def _set_symbols(self, file_name, configure):
"""
Load the symbols with configuration.
:param file_name: The file path of symbol configuration.
:type file_name: str
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure
... | [
"def",
"_set_symbols",
"(",
"self",
",",
"file_name",
",",
"configure",
")",
":",
"self",
".",
"symbols",
"=",
"[",
"]",
"if",
"file_name",
"is",
"None",
":",
"file_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
... | Load the symbols with configuration.
:param file_name: The file path of symbol configuration.
:type file_name: str
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure | [
"Load",
"the",
"symbols",
"with",
"configuration",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L322-L347 | train | 57,859 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._get_formated_symbol | def _get_formated_symbol(self, symbol):
"""
Returns the symbol formated to be searched by regular expression.
:param symbol: The symbol.
:type symbol: str
:return: The symbol formated.
:rtype: str
"""
# pylint: disable=no-self-use
old_symbols = [... | python | def _get_formated_symbol(self, symbol):
"""
Returns the symbol formated to be searched by regular expression.
:param symbol: The symbol.
:type symbol: str
:return: The symbol formated.
:rtype: str
"""
# pylint: disable=no-self-use
old_symbols = [... | [
"def",
"_get_formated_symbol",
"(",
"self",
",",
"symbol",
")",
":",
"# pylint: disable=no-self-use",
"old_symbols",
"=",
"[",
"'\\\\'",
",",
"'.'",
",",
"'+'",
",",
"'*'",
",",
"'?'",
",",
"'^'",
",",
"'$'",
",",
"'['",
",",
"']'",
",",
"'{'",
",",
"'... | Returns the symbol formated to be searched by regular expression.
:param symbol: The symbol.
:type symbol: str
:return: The symbol formated.
:rtype: str | [
"Returns",
"the",
"symbol",
"formated",
"to",
"be",
"searched",
"by",
"regular",
"expression",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L349-L406 | train | 57,860 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._get_regular_expression_of_symbols | def _get_regular_expression_of_symbols(self):
"""
Returns the regular expression to search all symbols.
:return: The regular expression to search all symbols.
:rtype: str
"""
regular_expression = None
for symbol in self.symbols:
formated_symbol = sel... | python | def _get_regular_expression_of_symbols(self):
"""
Returns the regular expression to search all symbols.
:return: The regular expression to search all symbols.
:rtype: str
"""
regular_expression = None
for symbol in self.symbols:
formated_symbol = sel... | [
"def",
"_get_regular_expression_of_symbols",
"(",
"self",
")",
":",
"regular_expression",
"=",
"None",
"for",
"symbol",
"in",
"self",
".",
"symbols",
":",
"formated_symbol",
"=",
"self",
".",
"_get_formated_symbol",
"(",
"symbol",
"[",
"'symbol'",
"]",
")",
"if"... | Returns the regular expression to search all symbols.
:return: The regular expression to search all symbols.
:rtype: str | [
"Returns",
"the",
"regular",
"expression",
"to",
"search",
"all",
"symbols",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L423-L443 | train | 57,861 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._is_valid_inherit_element | def _is_valid_inherit_element(self, element):
"""
Check that the children of element can be manipulated to apply the CSS
properties.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:return: True if the children of element can ... | python | def _is_valid_inherit_element(self, element):
"""
Check that the children of element can be manipulated to apply the CSS
properties.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:return: True if the children of element can ... | [
"def",
"_is_valid_inherit_element",
"(",
"self",
",",
"element",
")",
":",
"# pylint: disable=no-self-use",
"tag_name",
"=",
"element",
".",
"get_tag_name",
"(",
")",
"return",
"(",
"(",
"tag_name",
"in",
"AccessibleCSSImplementation",
".",
"VALID_INHERIT_TAGS",
")",
... | Check that the children of element can be manipulated to apply the CSS
properties.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:return: True if the children of element can be manipulated to apply
the CSS properties or Fal... | [
"Check",
"that",
"the",
"children",
"of",
"element",
"can",
"be",
"manipulated",
"to",
"apply",
"the",
"CSS",
"properties",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L445-L463 | train | 57,862 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._isolate_text_node | def _isolate_text_node(self, element):
"""
Isolate text nodes of element nodes.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
if (
(element.has_children_elements())
and (self._is_valid_element(el... | python | def _isolate_text_node(self, element):
"""
Isolate text nodes of element nodes.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
if (
(element.has_children_elements())
and (self._is_valid_element(el... | [
"def",
"_isolate_text_node",
"(",
"self",
",",
"element",
")",
":",
"if",
"(",
"(",
"element",
".",
"has_children_elements",
"(",
")",
")",
"and",
"(",
"self",
".",
"_is_valid_element",
"(",
"element",
")",
")",
")",
":",
"if",
"self",
".",
"_is_valid_el... | Isolate text nodes of element nodes.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Isolate",
"text",
"nodes",
"of",
"element",
"nodes",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L480-L506 | train | 57,863 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._replace_element_by_own_content | def _replace_element_by_own_content(self, element):
"""
Replace the element by own text content.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
# pylint: disable=no-self-use
if element.has_children_elements():
... | python | def _replace_element_by_own_content(self, element):
"""
Replace the element by own text content.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
# pylint: disable=no-self-use
if element.has_children_elements():
... | [
"def",
"_replace_element_by_own_content",
"(",
"self",
",",
"element",
")",
":",
"# pylint: disable=no-self-use",
"if",
"element",
".",
"has_children_elements",
"(",
")",
":",
"children",
"=",
"element",
".",
"get_children_elements",
"(",
")",
"for",
"child",
"in",
... | Replace the element by own text content.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Replace",
"the",
"element",
"by",
"own",
"text",
"content",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L508-L523 | train | 57,864 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._visit | def _visit(self, element, operation):
"""
Visit and execute a operation in element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param operation: The operation to be executed.
:type operation: function
... | python | def _visit(self, element, operation):
"""
Visit and execute a operation in element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param operation: The operation to be executed.
:type operation: function
... | [
"def",
"_visit",
"(",
"self",
",",
"element",
",",
"operation",
")",
":",
"if",
"self",
".",
"_is_valid_inherit_element",
"(",
"element",
")",
":",
"if",
"element",
".",
"has_children_elements",
"(",
")",
":",
"children",
"=",
"element",
".",
"get_children_e... | Visit and execute a operation in element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param operation: The operation to be executed.
:type operation: function | [
"Visit",
"and",
"execute",
"a",
"operation",
"in",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L525-L541 | train | 57,865 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._create_content_element | def _create_content_element(self, content, data_property_value):
"""
Create a element to show the content.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
identi... | python | def _create_content_element(self, content, data_property_value):
"""
Create a element to show the content.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
identi... | [
"def",
"_create_content_element",
"(",
"self",
",",
"content",
",",
"data_property_value",
")",
":",
"content_element",
"=",
"self",
".",
"html_parser",
".",
"create_element",
"(",
"'span'",
")",
"content_element",
".",
"set_attribute",
"(",
"AccessibleCSSImplementati... | Create a element to show the content.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
identify the fix.
:type data_property_value: str
:return: The element to sh... | [
"Create",
"a",
"element",
"to",
"show",
"the",
"content",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L543-L566 | train | 57,866 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._create_aural_content_element | def _create_aural_content_element(self, content, data_property_value):
"""
Create a element to show the content, only to aural displays.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
... | python | def _create_aural_content_element(self, content, data_property_value):
"""
Create a element to show the content, only to aural displays.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
... | [
"def",
"_create_aural_content_element",
"(",
"self",
",",
"content",
",",
"data_property_value",
")",
":",
"content_element",
"=",
"self",
".",
"_create_content_element",
"(",
"content",
",",
"data_property_value",
")",
"content_element",
".",
"set_attribute",
"(",
"'... | Create a element to show the content, only to aural displays.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
identify the fix.
:type data_property_value: str
:r... | [
"Create",
"a",
"element",
"to",
"show",
"the",
"content",
"only",
"to",
"aural",
"displays",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L568-L587 | train | 57,867 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._create_visual_content_element | def _create_visual_content_element(self, content, data_property_value):
"""
Create a element to show the content, only to visual displays.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
... | python | def _create_visual_content_element(self, content, data_property_value):
"""
Create a element to show the content, only to visual displays.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
... | [
"def",
"_create_visual_content_element",
"(",
"self",
",",
"content",
",",
"data_property_value",
")",
":",
"content_element",
"=",
"self",
".",
"_create_content_element",
"(",
"content",
",",
"data_property_value",
")",
"content_element",
".",
"set_attribute",
"(",
"... | Create a element to show the content, only to visual displays.
:param content: The text content of element.
:type content: str
:param data_property_value: The value of custom attribute used to
identify the fix.
:type data_property_value: str
:... | [
"Create",
"a",
"element",
"to",
"show",
"the",
"content",
"only",
"to",
"visual",
"displays",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L589-L608 | train | 57,868 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_normal | def _speak_normal(self, element):
"""
Speak the content of element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
if element.has_attribute(AccessibleCSSImplementation.DATA_SPEAK):
if (
(... | python | def _speak_normal(self, element):
"""
Speak the content of element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
if element.has_attribute(AccessibleCSSImplementation.DATA_SPEAK):
if (
(... | [
"def",
"_speak_normal",
"(",
"self",
",",
"element",
")",
":",
"if",
"element",
".",
"has_attribute",
"(",
"AccessibleCSSImplementation",
".",
"DATA_SPEAK",
")",
":",
"if",
"(",
"(",
"element",
".",
"get_attribute",
"(",
"AccessibleCSSImplementation",
".",
"DATA... | Speak the content of element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Speak",
"the",
"content",
"of",
"element",
"only",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L610-L633 | train | 57,869 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_normal_inherit | def _speak_normal_inherit(self, element):
"""
Speak the content of element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._visit(element, self._speak_normal)
element.normalize() | python | def _speak_normal_inherit(self, element):
"""
Speak the content of element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._visit(element, self._speak_normal)
element.normalize() | [
"def",
"_speak_normal_inherit",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_visit",
"(",
"element",
",",
"self",
".",
"_speak_normal",
")",
"element",
".",
"normalize",
"(",
")"
] | Speak the content of element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Speak",
"the",
"content",
"of",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L635-L645 | train | 57,870 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_none | def _speak_none(self, element):
"""
No speak any content of element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
# pylint: disable=no-self-use
element.set_attribute('role', 'presentation')
element... | python | def _speak_none(self, element):
"""
No speak any content of element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
# pylint: disable=no-self-use
element.set_attribute('role', 'presentation')
element... | [
"def",
"_speak_none",
"(",
"self",
",",
"element",
")",
":",
"# pylint: disable=no-self-use",
"element",
".",
"set_attribute",
"(",
"'role'",
",",
"'presentation'",
")",
"element",
".",
"set_attribute",
"(",
"'aria-hidden'",
",",
"'true'",
")",
"element",
".",
"... | No speak any content of element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"No",
"speak",
"any",
"content",
"of",
"element",
"only",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L647-L658 | train | 57,871 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_none_inherit | def _speak_none_inherit(self, element):
"""
No speak any content of element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._isolate_text_node(element)
self._visit(element, self._speak_none) | python | def _speak_none_inherit(self, element):
"""
No speak any content of element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._isolate_text_node(element)
self._visit(element, self._speak_none) | [
"def",
"_speak_none_inherit",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_isolate_text_node",
"(",
"element",
")",
"self",
".",
"_visit",
"(",
"element",
",",
"self",
".",
"_speak_none",
")"
] | No speak any content of element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"No",
"speak",
"any",
"content",
"of",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L660-L670 | train | 57,872 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_as | def _speak_as(
self,
element,
regular_expression,
data_property_value,
operation
):
"""
Execute a operation by regular expression for element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
... | python | def _speak_as(
self,
element,
regular_expression,
data_property_value,
operation
):
"""
Execute a operation by regular expression for element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
... | [
"def",
"_speak_as",
"(",
"self",
",",
"element",
",",
"regular_expression",
",",
"data_property_value",
",",
"operation",
")",
":",
"children",
"=",
"[",
"]",
"pattern",
"=",
"re",
".",
"compile",
"(",
"regular_expression",
")",
"content",
"=",
"element",
".... | Execute a operation by regular expression for element only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param regular_expression: The regular expression.
:type regular_expression: str
:param data_property_value: The value of cust... | [
"Execute",
"a",
"operation",
"by",
"regular",
"expression",
"for",
"element",
"only",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L672-L715 | train | 57,873 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._reverse_speak_as | def _reverse_speak_as(self, element, data_property_value):
"""
Revert changes of a speak_as method for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param data_property_value: The value of custom attribute ... | python | def _reverse_speak_as(self, element, data_property_value):
"""
Revert changes of a speak_as method for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param data_property_value: The value of custom attribute ... | [
"def",
"_reverse_speak_as",
"(",
"self",
",",
"element",
",",
"data_property_value",
")",
":",
"data_property",
"=",
"(",
"'['",
"+",
"AccessibleCSSImplementation",
".",
"DATA_SPEAK_AS",
"+",
"'=\"'",
"+",
"data_property_value",
"+",
"'\"]'",
")",
"auxiliar_elements... | Revert changes of a speak_as method for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param data_property_value: The value of custom attribute used to
identify the fix.
:type dat... | [
"Revert",
"changes",
"of",
"a",
"speak_as",
"method",
"for",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L717-L756 | train | 57,874 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_as_normal | def _speak_as_normal(self, element):
"""
Use the default speak configuration of user agent for element and
descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'spell-out')
... | python | def _speak_as_normal(self, element):
"""
Use the default speak configuration of user agent for element and
descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'spell-out')
... | [
"def",
"_speak_as_normal",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_reverse_speak_as",
"(",
"element",
",",
"'spell-out'",
")",
"self",
".",
"_reverse_speak_as",
"(",
"element",
",",
"'literal-punctuation'",
")",
"self",
".",
"_reverse_speak_as",
"(... | Use the default speak configuration of user agent for element and
descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Use",
"the",
"default",
"speak",
"configuration",
"of",
"user",
"agent",
"for",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L758-L770 | train | 57,875 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_as_spell_out_inherit | def _speak_as_spell_out_inherit(self, element):
"""
Speak one letter at a time for each word for elements and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'spell-out')
... | python | def _speak_as_spell_out_inherit(self, element):
"""
Speak one letter at a time for each word for elements and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'spell-out')
... | [
"def",
"_speak_as_spell_out_inherit",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_reverse_speak_as",
"(",
"element",
",",
"'spell-out'",
")",
"self",
".",
"_isolate_text_node",
"(",
"element",
")",
"self",
".",
"_visit",
"(",
"element",
",",
"self",
... | Speak one letter at a time for each word for elements and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Speak",
"one",
"letter",
"at",
"a",
"time",
"for",
"each",
"word",
"for",
"elements",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L787-L799 | train | 57,876 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_as_literal_punctuation | def _speak_as_literal_punctuation(self, element):
"""
Speak the punctuation for elements only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._speak_as(
element,
self._get_regular_expression_... | python | def _speak_as_literal_punctuation(self, element):
"""
Speak the punctuation for elements only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._speak_as(
element,
self._get_regular_expression_... | [
"def",
"_speak_as_literal_punctuation",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_speak_as",
"(",
"element",
",",
"self",
".",
"_get_regular_expression_of_symbols",
"(",
")",
",",
"'literal-punctuation'",
",",
"self",
".",
"_operation_speak_as_literal_punc... | Speak the punctuation for elements only.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Speak",
"the",
"punctuation",
"for",
"elements",
"only",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L801-L814 | train | 57,877 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_as_literal_punctuation_inherit | def _speak_as_literal_punctuation_inherit(self, element):
"""
Speak the punctuation for elements and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'literal-punctuation')
... | python | def _speak_as_literal_punctuation_inherit(self, element):
"""
Speak the punctuation for elements and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'literal-punctuation')
... | [
"def",
"_speak_as_literal_punctuation_inherit",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_reverse_speak_as",
"(",
"element",
",",
"'literal-punctuation'",
")",
"self",
".",
"_reverse_speak_as",
"(",
"element",
",",
"'no-punctuation'",
")",
"self",
".",
... | Speak the punctuation for elements and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Speak",
"the",
"punctuation",
"for",
"elements",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L816-L829 | train | 57,878 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_as_no_punctuation_inherit | def _speak_as_no_punctuation_inherit(self, element):
"""
No speak the punctuation for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'literal-punctuation')
... | python | def _speak_as_no_punctuation_inherit(self, element):
"""
No speak the punctuation for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'literal-punctuation')
... | [
"def",
"_speak_as_no_punctuation_inherit",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_reverse_speak_as",
"(",
"element",
",",
"'literal-punctuation'",
")",
"self",
".",
"_reverse_speak_as",
"(",
"element",
",",
"'no-punctuation'",
")",
"self",
".",
"_is... | No speak the punctuation for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"No",
"speak",
"the",
"punctuation",
"for",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L849-L862 | train | 57,879 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_as_digits_inherit | def _speak_as_digits_inherit(self, element):
"""
Speak the digit at a time for each number for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'digits')
se... | python | def _speak_as_digits_inherit(self, element):
"""
Speak the digit at a time for each number for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._reverse_speak_as(element, 'digits')
se... | [
"def",
"_speak_as_digits_inherit",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_reverse_speak_as",
"(",
"element",
",",
"'digits'",
")",
"self",
".",
"_isolate_text_node",
"(",
"element",
")",
"self",
".",
"_visit",
"(",
"element",
",",
"self",
".",... | Speak the digit at a time for each number for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Speak",
"the",
"digit",
"at",
"a",
"time",
"for",
"each",
"number",
"for",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L879-L891 | train | 57,880 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_header_always_inherit | def _speak_header_always_inherit(self, element):
"""
The cells headers will be spoken for every data cell for element and
descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._speak_header_once_inheri... | python | def _speak_header_always_inherit(self, element):
"""
The cells headers will be spoken for every data cell for element and
descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
self._speak_header_once_inheri... | [
"def",
"_speak_header_always_inherit",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_speak_header_once_inherit",
"(",
"element",
")",
"cell_elements",
"=",
"self",
".",
"html_parser",
".",
"find",
"(",
"element",
")",
".",
"find_descendants",
"(",
"'td[h... | The cells headers will be spoken for every data cell for element and
descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"The",
"cells",
"headers",
"will",
"be",
"spoken",
"for",
"every",
"data",
"cell",
"for",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L903-L922 | train | 57,881 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._speak_header_once_inherit | def _speak_header_once_inherit(self, element):
"""
The cells headers will be spoken one time for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
header_elements = self.html_parser.find(element).fi... | python | def _speak_header_once_inherit(self, element):
"""
The cells headers will be spoken one time for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
header_elements = self.html_parser.find(element).fi... | [
"def",
"_speak_header_once_inherit",
"(",
"self",
",",
"element",
")",
":",
"header_elements",
"=",
"self",
".",
"html_parser",
".",
"find",
"(",
"element",
")",
".",
"find_descendants",
"(",
"'['",
"+",
"AccessibleDisplayImplementation",
".",
"DATA_ATTRIBUTE_HEADER... | The cells headers will be spoken one time for element and descendants.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"The",
"cells",
"headers",
"will",
"be",
"spoken",
"one",
"time",
"for",
"element",
"and",
"descendants",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L924-L938 | train | 57,882 |
hatemile/hatemile-for-python | hatemile/implementation/css.py | AccessibleCSSImplementation._provide_speak_properties_with_rule | def _provide_speak_properties_with_rule(self, element, rule):
"""
Provide the CSS features of speaking and speech properties in element.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param rule: The stylesheet rule.
:type r... | python | def _provide_speak_properties_with_rule(self, element, rule):
"""
Provide the CSS features of speaking and speech properties in element.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param rule: The stylesheet rule.
:type r... | [
"def",
"_provide_speak_properties_with_rule",
"(",
"self",
",",
"element",
",",
"rule",
")",
":",
"if",
"rule",
".",
"has_property",
"(",
"'speak'",
")",
":",
"declarations",
"=",
"rule",
".",
"get_declarations",
"(",
"'speak'",
")",
"for",
"declaration",
"in"... | Provide the CSS features of speaking and speech properties in element.
:param element: The element.
:type element: hatemile.util.html.htmldomelement.HTMLDOMElement
:param rule: The stylesheet rule.
:type rule: hatemile.util.css.stylesheetrule.StyleSheetRule | [
"Provide",
"the",
"CSS",
"features",
"of",
"speaking",
"and",
"speech",
"properties",
"in",
"element",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L940-L997 | train | 57,883 |
SeattleTestbed/seash | pyreadline/modes/emacs.py | commonprefix | def commonprefix(m):
u"Given a list of pathnames, returns the longest common leading component"
if not m:
return ''
prefix = m[0]
for item in m:
for i in range(len(prefix)):
if prefix[:i + 1].lower() != item[:i + 1].lower():
prefix = prefix[:i]
... | python | def commonprefix(m):
u"Given a list of pathnames, returns the longest common leading component"
if not m:
return ''
prefix = m[0]
for item in m:
for i in range(len(prefix)):
if prefix[:i + 1].lower() != item[:i + 1].lower():
prefix = prefix[:i]
... | [
"def",
"commonprefix",
"(",
"m",
")",
":",
"if",
"not",
"m",
":",
"return",
"''",
"prefix",
"=",
"m",
"[",
"0",
"]",
"for",
"item",
"in",
"m",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"prefix",
")",
")",
":",
"if",
"prefix",
"[",
":",... | u"Given a list of pathnames, returns the longest common leading component | [
"u",
"Given",
"a",
"list",
"of",
"pathnames",
"returns",
"the",
"longest",
"common",
"leading",
"component"
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L718-L730 | train | 57,884 |
SeattleTestbed/seash | pyreadline/modes/emacs.py | IncrementalSearchPromptMode._init_incremental_search | def _init_incremental_search(self, searchfun, init_event):
u"""Initialize search prompt
"""
log("init_incremental_search")
self.subsearch_query = u''
self.subsearch_fun = searchfun
self.subsearch_old_line = self.l_buffer.get_line_text()
queue = self.proce... | python | def _init_incremental_search(self, searchfun, init_event):
u"""Initialize search prompt
"""
log("init_incremental_search")
self.subsearch_query = u''
self.subsearch_fun = searchfun
self.subsearch_old_line = self.l_buffer.get_line_text()
queue = self.proce... | [
"def",
"_init_incremental_search",
"(",
"self",
",",
"searchfun",
",",
"init_event",
")",
":",
"log",
"(",
"\"init_incremental_search\"",
")",
"self",
".",
"subsearch_query",
"=",
"u''",
"self",
".",
"subsearch_fun",
"=",
"searchfun",
"self",
".",
"subsearch_old_l... | u"""Initialize search prompt | [
"u",
"Initialize",
"search",
"prompt"
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L80-L107 | train | 57,885 |
SeattleTestbed/seash | pyreadline/modes/emacs.py | DigitArgumentMode._init_digit_argument | def _init_digit_argument(self, keyinfo):
"""Initialize search prompt
"""
c = self.console
line = self.l_buffer.get_line_text()
self._digit_argument_oldprompt = self.prompt
queue = self.process_keyevent_queue
queue = self.process_keyevent_queue
queu... | python | def _init_digit_argument(self, keyinfo):
"""Initialize search prompt
"""
c = self.console
line = self.l_buffer.get_line_text()
self._digit_argument_oldprompt = self.prompt
queue = self.process_keyevent_queue
queue = self.process_keyevent_queue
queu... | [
"def",
"_init_digit_argument",
"(",
"self",
",",
"keyinfo",
")",
":",
"c",
"=",
"self",
".",
"console",
"line",
"=",
"self",
".",
"l_buffer",
".",
"get_line_text",
"(",
")",
"self",
".",
"_digit_argument_oldprompt",
"=",
"self",
".",
"prompt",
"queue",
"="... | Initialize search prompt | [
"Initialize",
"search",
"prompt"
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L196-L212 | train | 57,886 |
SeattleTestbed/seash | pyreadline/modes/emacs.py | EmacsMode._process_keyevent | def _process_keyevent(self, keyinfo):
u"""return True when line is final
"""
#Process exit keys. Only exit on empty line
log(u"_process_keyevent <%s>"%keyinfo)
def nop(e):
pass
if self.next_meta:
self.next_meta = False
keyinf... | python | def _process_keyevent(self, keyinfo):
u"""return True when line is final
"""
#Process exit keys. Only exit on empty line
log(u"_process_keyevent <%s>"%keyinfo)
def nop(e):
pass
if self.next_meta:
self.next_meta = False
keyinf... | [
"def",
"_process_keyevent",
"(",
"self",
",",
"keyinfo",
")",
":",
"#Process exit keys. Only exit on empty line\r",
"log",
"(",
"u\"_process_keyevent <%s>\"",
"%",
"keyinfo",
")",
"def",
"nop",
"(",
"e",
")",
":",
"pass",
"if",
"self",
".",
"next_meta",
":",
"se... | u"""return True when line is final | [
"u",
"return",
"True",
"when",
"line",
"is",
"final"
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L251-L290 | train | 57,887 |
SeattleTestbed/seash | pyreadline/modes/emacs.py | EmacsMode.reverse_search_history | def reverse_search_history(self, e): # (C-r)
u'''Search backward starting at the current line and moving up
through the history as necessary. This is an incremental search.'''
log("rev_search_history")
self._init_incremental_search(self._history.reverse_search_history, e)
s... | python | def reverse_search_history(self, e): # (C-r)
u'''Search backward starting at the current line and moving up
through the history as necessary. This is an incremental search.'''
log("rev_search_history")
self._init_incremental_search(self._history.reverse_search_history, e)
s... | [
"def",
"reverse_search_history",
"(",
"self",
",",
"e",
")",
":",
"# (C-r)\r",
"log",
"(",
"\"rev_search_history\"",
")",
"self",
".",
"_init_incremental_search",
"(",
"self",
".",
"_history",
".",
"reverse_search_history",
",",
"e",
")",
"self",
".",
"finalize"... | u'''Search backward starting at the current line and moving up
through the history as necessary. This is an incremental search. | [
"u",
"Search",
"backward",
"starting",
"at",
"the",
"current",
"line",
"and",
"moving",
"up",
"through",
"the",
"history",
"as",
"necessary",
".",
"This",
"is",
"an",
"incremental",
"search",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L317-L322 | train | 57,888 |
SeattleTestbed/seash | pyreadline/modes/emacs.py | EmacsMode.forward_search_history | def forward_search_history(self, e): # (C-s)
u'''Search forward starting at the current line and moving down
through the the history as necessary. This is an incremental
search.'''
log("fwd_search_history")
self._init_incremental_search(self._history.forward_search_history,... | python | def forward_search_history(self, e): # (C-s)
u'''Search forward starting at the current line and moving down
through the the history as necessary. This is an incremental
search.'''
log("fwd_search_history")
self._init_incremental_search(self._history.forward_search_history,... | [
"def",
"forward_search_history",
"(",
"self",
",",
"e",
")",
":",
"# (C-s)\r",
"log",
"(",
"\"fwd_search_history\"",
")",
"self",
".",
"_init_incremental_search",
"(",
"self",
".",
"_history",
".",
"forward_search_history",
",",
"e",
")",
"self",
".",
"finalize"... | u'''Search forward starting at the current line and moving down
through the the history as necessary. This is an incremental
search. | [
"u",
"Search",
"forward",
"starting",
"at",
"the",
"current",
"line",
"and",
"moving",
"down",
"through",
"the",
"the",
"history",
"as",
"necessary",
".",
"This",
"is",
"an",
"incremental",
"search",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L324-L330 | train | 57,889 |
SeattleTestbed/seash | pyreadline/modes/emacs.py | EmacsMode.tab_insert | def tab_insert(self, e): # (M-TAB)
u'''Insert a tab character. '''
cursor = min(self.l_buffer.point, len(self.l_buffer.line_buffer))
ws = ' ' * (self.tabstop - (cursor % self.tabstop))
self.insert_text(ws)
self.finalize() | python | def tab_insert(self, e): # (M-TAB)
u'''Insert a tab character. '''
cursor = min(self.l_buffer.point, len(self.l_buffer.line_buffer))
ws = ' ' * (self.tabstop - (cursor % self.tabstop))
self.insert_text(ws)
self.finalize() | [
"def",
"tab_insert",
"(",
"self",
",",
"e",
")",
":",
"# (M-TAB)\r",
"cursor",
"=",
"min",
"(",
"self",
".",
"l_buffer",
".",
"point",
",",
"len",
"(",
"self",
".",
"l_buffer",
".",
"line_buffer",
")",
")",
"ws",
"=",
"' '",
"*",
"(",
"self",
".",
... | u'''Insert a tab character. | [
"u",
"Insert",
"a",
"tab",
"character",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L389-L394 | train | 57,890 |
envi-idl/envipyarclib | envipyarclib/gptool/help.py | create | def create(filename, task, alias):
"""Creates a gptool help xml file."""
metadata = ET.Element('metadata', {'xml:lang': 'en'})
tool = ET.SubElement(metadata, 'tool', name=task.name,
displayname=task.display_name,
toolboxalias=alias)
summary = ET.SubEle... | python | def create(filename, task, alias):
"""Creates a gptool help xml file."""
metadata = ET.Element('metadata', {'xml:lang': 'en'})
tool = ET.SubElement(metadata, 'tool', name=task.name,
displayname=task.display_name,
toolboxalias=alias)
summary = ET.SubEle... | [
"def",
"create",
"(",
"filename",
",",
"task",
",",
"alias",
")",
":",
"metadata",
"=",
"ET",
".",
"Element",
"(",
"'metadata'",
",",
"{",
"'xml:lang'",
":",
"'en'",
"}",
")",
"tool",
"=",
"ET",
".",
"SubElement",
"(",
"metadata",
",",
"'tool'",
",",... | Creates a gptool help xml file. | [
"Creates",
"a",
"gptool",
"help",
"xml",
"file",
"."
] | 90135652510c3d53c5f51177252c1fea2639bf22 | https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptool/help.py#L10-L47 | train | 57,891 |
solocompt/plugs-core | plugs_core/clients.py | PlugsAPIClient.parse_params | def parse_params(self, params):
"""
Parsing params, params is a dict
and the dict value can be a string
or an iterable, namely a list, we
need to process those iterables
"""
for (key, value) in params.items():
if not isinstance(value, str):
... | python | def parse_params(self, params):
"""
Parsing params, params is a dict
and the dict value can be a string
or an iterable, namely a list, we
need to process those iterables
"""
for (key, value) in params.items():
if not isinstance(value, str):
... | [
"def",
"parse_params",
"(",
"self",
",",
"params",
")",
":",
"for",
"(",
"key",
",",
"value",
")",
"in",
"params",
".",
"items",
"(",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"string_params",
"=",
"self",
".",
"to_st... | Parsing params, params is a dict
and the dict value can be a string
or an iterable, namely a list, we
need to process those iterables | [
"Parsing",
"params",
"params",
"is",
"a",
"dict",
"and",
"the",
"dict",
"value",
"can",
"be",
"a",
"string",
"or",
"an",
"iterable",
"namely",
"a",
"list",
"we",
"need",
"to",
"process",
"those",
"iterables"
] | 19fd23101fcfdabe657485f0a22e6b63e2b44f9d | https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/clients.py#L14-L25 | train | 57,892 |
solocompt/plugs-core | plugs_core/clients.py | PlugsAPIClient.to_string | def to_string(self, obj):
"""
Picks up an object and transforms it
into a string, by coercing each element
in an iterable to a string and then joining
them, or by trying to coerce the object directly
"""
try:
converted = [str(element) for element in ob... | python | def to_string(self, obj):
"""
Picks up an object and transforms it
into a string, by coercing each element
in an iterable to a string and then joining
them, or by trying to coerce the object directly
"""
try:
converted = [str(element) for element in ob... | [
"def",
"to_string",
"(",
"self",
",",
"obj",
")",
":",
"try",
":",
"converted",
"=",
"[",
"str",
"(",
"element",
")",
"for",
"element",
"in",
"obj",
"]",
"string",
"=",
"','",
".",
"join",
"(",
"converted",
")",
"except",
"TypeError",
":",
"# for now... | Picks up an object and transforms it
into a string, by coercing each element
in an iterable to a string and then joining
them, or by trying to coerce the object directly | [
"Picks",
"up",
"an",
"object",
"and",
"transforms",
"it",
"into",
"a",
"string",
"by",
"coercing",
"each",
"element",
"in",
"an",
"iterable",
"to",
"a",
"string",
"and",
"then",
"joining",
"them",
"or",
"by",
"trying",
"to",
"coerce",
"the",
"object",
"d... | 19fd23101fcfdabe657485f0a22e6b63e2b44f9d | https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/clients.py#L27-L40 | train | 57,893 |
solocompt/plugs-core | plugs_core/clients.py | PlugsAPIClient.filter | def filter(self, endpoint, params):
"""
Makes a get request by construction
the path from an endpoint and a dict
with filter query params
e.g.
params = {'category__in': [1,2]}
response = self.client.filter('/experiences/', params)
"""
params = sel... | python | def filter(self, endpoint, params):
"""
Makes a get request by construction
the path from an endpoint and a dict
with filter query params
e.g.
params = {'category__in': [1,2]}
response = self.client.filter('/experiences/', params)
"""
params = sel... | [
"def",
"filter",
"(",
"self",
",",
"endpoint",
",",
"params",
")",
":",
"params",
"=",
"self",
".",
"parse_params",
"(",
"params",
")",
"params",
"=",
"urlencode",
"(",
"params",
")",
"path",
"=",
"'{0}?{1}'",
".",
"format",
"(",
"endpoint",
",",
"para... | Makes a get request by construction
the path from an endpoint and a dict
with filter query params
e.g.
params = {'category__in': [1,2]}
response = self.client.filter('/experiences/', params) | [
"Makes",
"a",
"get",
"request",
"by",
"construction",
"the",
"path",
"from",
"an",
"endpoint",
"and",
"a",
"dict",
"with",
"filter",
"query",
"params"
] | 19fd23101fcfdabe657485f0a22e6b63e2b44f9d | https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/clients.py#L42-L55 | train | 57,894 |
helixyte/everest | everest/entities/attributes.py | is_domain_class_member_attribute | def is_domain_class_member_attribute(ent, attr_name):
"""
Checks if the given attribute name is a entity attribute of the given
registered resource.
"""
attr = get_domain_class_attribute(ent, attr_name)
return attr.kind == RESOURCE_ATTRIBUTE_KINDS.MEMBER | python | def is_domain_class_member_attribute(ent, attr_name):
"""
Checks if the given attribute name is a entity attribute of the given
registered resource.
"""
attr = get_domain_class_attribute(ent, attr_name)
return attr.kind == RESOURCE_ATTRIBUTE_KINDS.MEMBER | [
"def",
"is_domain_class_member_attribute",
"(",
"ent",
",",
"attr_name",
")",
":",
"attr",
"=",
"get_domain_class_attribute",
"(",
"ent",
",",
"attr_name",
")",
"return",
"attr",
".",
"kind",
"==",
"RESOURCE_ATTRIBUTE_KINDS",
".",
"MEMBER"
] | Checks if the given attribute name is a entity attribute of the given
registered resource. | [
"Checks",
"if",
"the",
"given",
"attribute",
"name",
"is",
"a",
"entity",
"attribute",
"of",
"the",
"given",
"registered",
"resource",
"."
] | 70c9b93c3061db5cb62428349d18b8fb8566411b | https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/entities/attributes.py#L52-L58 | train | 57,895 |
helixyte/everest | everest/entities/attributes.py | is_domain_class_collection_attribute | def is_domain_class_collection_attribute(ent, attr_name):
"""
Checks if the given attribute name is a aggregate attribute of the given
registered resource.
"""
attr = get_domain_class_attribute(ent, attr_name)
return attr.kind == RESOURCE_ATTRIBUTE_KINDS.COLLECTION | python | def is_domain_class_collection_attribute(ent, attr_name):
"""
Checks if the given attribute name is a aggregate attribute of the given
registered resource.
"""
attr = get_domain_class_attribute(ent, attr_name)
return attr.kind == RESOURCE_ATTRIBUTE_KINDS.COLLECTION | [
"def",
"is_domain_class_collection_attribute",
"(",
"ent",
",",
"attr_name",
")",
":",
"attr",
"=",
"get_domain_class_attribute",
"(",
"ent",
",",
"attr_name",
")",
"return",
"attr",
".",
"kind",
"==",
"RESOURCE_ATTRIBUTE_KINDS",
".",
"COLLECTION"
] | Checks if the given attribute name is a aggregate attribute of the given
registered resource. | [
"Checks",
"if",
"the",
"given",
"attribute",
"name",
"is",
"a",
"aggregate",
"attribute",
"of",
"the",
"given",
"registered",
"resource",
"."
] | 70c9b93c3061db5cb62428349d18b8fb8566411b | https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/entities/attributes.py#L61-L67 | train | 57,896 |
AtomHash/evernode | evernode/models/base_user_model.py | BaseUserModel.set_password | def set_password(self, password):
""" Set user password with hash """
self.password = Security.hash(password)
self.save() | python | def set_password(self, password):
""" Set user password with hash """
self.password = Security.hash(password)
self.save() | [
"def",
"set_password",
"(",
"self",
",",
"password",
")",
":",
"self",
".",
"password",
"=",
"Security",
".",
"hash",
"(",
"password",
")",
"self",
".",
"save",
"(",
")"
] | Set user password with hash | [
"Set",
"user",
"password",
"with",
"hash"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_user_model.py#L34-L37 | train | 57,897 |
AtomHash/evernode | evernode/models/base_user_model.py | BaseUserModel.create_password_reset | def create_password_reset(cls, email, valid_for=3600) -> str:
"""
Create a password reset request in the user_password_resets
database table. Hashed code gets stored in the database.
Returns unhashed reset code
"""
user = cls.where_email(email)
if user is N... | python | def create_password_reset(cls, email, valid_for=3600) -> str:
"""
Create a password reset request in the user_password_resets
database table. Hashed code gets stored in the database.
Returns unhashed reset code
"""
user = cls.where_email(email)
if user is N... | [
"def",
"create_password_reset",
"(",
"cls",
",",
"email",
",",
"valid_for",
"=",
"3600",
")",
"->",
"str",
":",
"user",
"=",
"cls",
".",
"where_email",
"(",
"email",
")",
"if",
"user",
"is",
"None",
":",
"return",
"None",
"PasswordResetModel",
".",
"dele... | Create a password reset request in the user_password_resets
database table. Hashed code gets stored in the database.
Returns unhashed reset code | [
"Create",
"a",
"password",
"reset",
"request",
"in",
"the",
"user_password_resets",
"database",
"table",
".",
"Hashed",
"code",
"gets",
"stored",
"in",
"the",
"database",
".",
"Returns",
"unhashed",
"reset",
"code"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_user_model.py#L40-L60 | train | 57,898 |
AtomHash/evernode | evernode/models/base_user_model.py | BaseUserModel.validate_password_reset | def validate_password_reset(cls, code, new_password):
"""
Validates an unhashed code against a hashed code.
Once the code has been validated and confirmed
new_password will replace the old users password
"""
password_reset_model = \
PasswordResetModel.w... | python | def validate_password_reset(cls, code, new_password):
"""
Validates an unhashed code against a hashed code.
Once the code has been validated and confirmed
new_password will replace the old users password
"""
password_reset_model = \
PasswordResetModel.w... | [
"def",
"validate_password_reset",
"(",
"cls",
",",
"code",
",",
"new_password",
")",
":",
"password_reset_model",
"=",
"PasswordResetModel",
".",
"where_code",
"(",
"code",
")",
"if",
"password_reset_model",
"is",
"None",
":",
"return",
"None",
"jwt",
"=",
"JWT"... | Validates an unhashed code against a hashed code.
Once the code has been validated and confirmed
new_password will replace the old users password | [
"Validates",
"an",
"unhashed",
"code",
"against",
"a",
"hashed",
"code",
".",
"Once",
"the",
"code",
"has",
"been",
"validated",
"and",
"confirmed",
"new_password",
"will",
"replace",
"the",
"old",
"users",
"password"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_user_model.py#L63-L81 | train | 57,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.