repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
mukulhase/WebWhatsapp-Wrapper | webwhatsapi/__init__.py | WhatsAPIDriver.get_profile_pic_small_from_id | def get_profile_pic_small_from_id(self, id):
"""
Get small profile pic from an id
The ID must be on your contact book to
successfully get their profile picture.
:param id: ID
:type id: str
"""
profile_pic_small = self.wapi_functions.getProfilePicSmallFrom... | python | def get_profile_pic_small_from_id(self, id):
"""
Get small profile pic from an id
The ID must be on your contact book to
successfully get their profile picture.
:param id: ID
:type id: str
"""
profile_pic_small = self.wapi_functions.getProfilePicSmallFrom... | [
"def",
"get_profile_pic_small_from_id",
"(",
"self",
",",
"id",
")",
":",
"profile_pic_small",
"=",
"self",
".",
"wapi_functions",
".",
"getProfilePicSmallFromId",
"(",
"id",
")",
"if",
"profile_pic",
":",
"return",
"b64decode",
"(",
"profile_pic_small",
")",
"els... | Get small profile pic from an id
The ID must be on your contact book to
successfully get their profile picture.
:param id: ID
:type id: str | [
"Get",
"small",
"profile",
"pic",
"from",
"an",
"id",
"The",
"ID",
"must",
"be",
"on",
"your",
"contact",
"book",
"to",
"successfully",
"get",
"their",
"profile",
"picture",
"."
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L638-L651 | train |
mukulhase/WebWhatsapp-Wrapper | webwhatsapi/__init__.py | WhatsAPIDriver.delete_message | def delete_message(self, chat_id, message_array, revoke=False):
"""
Delete a chat
:param chat_id: id of chat
:param message_array: one or more message(s) id
:param revoke: Set to true so the message will be deleted for everyone, not only you
:return:
"""
... | python | def delete_message(self, chat_id, message_array, revoke=False):
"""
Delete a chat
:param chat_id: id of chat
:param message_array: one or more message(s) id
:param revoke: Set to true so the message will be deleted for everyone, not only you
:return:
"""
... | [
"def",
"delete_message",
"(",
"self",
",",
"chat_id",
",",
"message_array",
",",
"revoke",
"=",
"False",
")",
":",
"return",
"self",
".",
"wapi_functions",
".",
"deleteMessage",
"(",
"chat_id",
",",
"message_array",
",",
"revoke",
"=",
"False",
")"
] | Delete a chat
:param chat_id: id of chat
:param message_array: one or more message(s) id
:param revoke: Set to true so the message will be deleted for everyone, not only you
:return: | [
"Delete",
"a",
"chat"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L719-L728 | train |
mukulhase/WebWhatsapp-Wrapper | webwhatsapi/__init__.py | WhatsAPIDriver.check_number_status | def check_number_status(self, number_id):
"""
Check if a number is valid/registered in the whatsapp service
:param number_id: number id
:return:
"""
number_status = self.wapi_functions.checkNumberStatus(number_id)
return NumberStatus(number_status, self) | python | def check_number_status(self, number_id):
"""
Check if a number is valid/registered in the whatsapp service
:param number_id: number id
:return:
"""
number_status = self.wapi_functions.checkNumberStatus(number_id)
return NumberStatus(number_status, self) | [
"def",
"check_number_status",
"(",
"self",
",",
"number_id",
")",
":",
"number_status",
"=",
"self",
".",
"wapi_functions",
".",
"checkNumberStatus",
"(",
"number_id",
")",
"return",
"NumberStatus",
"(",
"number_status",
",",
"self",
")"
] | Check if a number is valid/registered in the whatsapp service
:param number_id: number id
:return: | [
"Check",
"if",
"a",
"number",
"is",
"valid",
"/",
"registered",
"in",
"the",
"whatsapp",
"service"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L730-L738 | train |
mukulhase/WebWhatsapp-Wrapper | webwhatsapi/objects/chat.py | factory_chat | def factory_chat(js_obj, driver=None):
"""Factory function for creating appropriate object given selenium JS object"""
if js_obj["kind"] not in ["chat", "group", "broadcast"]:
raise AssertionError("Expected chat, group or broadcast object, got {0}".format(js_obj["kind"]))
if js_obj["isGroup"]:
... | python | def factory_chat(js_obj, driver=None):
"""Factory function for creating appropriate object given selenium JS object"""
if js_obj["kind"] not in ["chat", "group", "broadcast"]:
raise AssertionError("Expected chat, group or broadcast object, got {0}".format(js_obj["kind"]))
if js_obj["isGroup"]:
... | [
"def",
"factory_chat",
"(",
"js_obj",
",",
"driver",
"=",
"None",
")",
":",
"if",
"js_obj",
"[",
"\"kind\"",
"]",
"not",
"in",
"[",
"\"chat\"",
",",
"\"group\"",
",",
"\"broadcast\"",
"]",
":",
"raise",
"AssertionError",
"(",
"\"Expected chat, group or broadca... | Factory function for creating appropriate object given selenium JS object | [
"Factory",
"function",
"for",
"creating",
"appropriate",
"object",
"given",
"selenium",
"JS",
"object"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/chat.py#L7-L18 | train |
mukulhase/WebWhatsapp-Wrapper | webwhatsapi/objects/chat.py | Chat.get_unread_messages | def get_unread_messages(self,
include_me=False,
include_notifications=False):
"""
I fetch unread messages.
:param include_me: if user's messages are to be included
:type include_me: bool
:param include_notifications: if e... | python | def get_unread_messages(self,
include_me=False,
include_notifications=False):
"""
I fetch unread messages.
:param include_me: if user's messages are to be included
:type include_me: bool
:param include_notifications: if e... | [
"def",
"get_unread_messages",
"(",
"self",
",",
"include_me",
"=",
"False",
",",
"include_notifications",
"=",
"False",
")",
":",
"return",
"list",
"(",
"self",
".",
"driver",
".",
"get_unread_messages_in_chat",
"(",
"self",
".",
"id",
",",
"include_me",
",",
... | I fetch unread messages.
:param include_me: if user's messages are to be included
:type include_me: bool
:param include_notifications: if events happening on chat are to be included
:type include_notifications: bool
:return: list of unread messages
:rtype: list | [
"I",
"fetch",
"unread",
"messages",
"."
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/chat.py#L42-L61 | train |
mukulhase/WebWhatsapp-Wrapper | webwhatsapi/objects/chat.py | Chat.load_earlier_messages_till | def load_earlier_messages_till(self, last):
"""
Triggers loading of messages till a specific point in time
:param last: Datetime object for the last message to be loaded
:type last: datetime
:return: Nothing
:rtype: None
"""
timestamp = time.mktime(last.t... | python | def load_earlier_messages_till(self, last):
"""
Triggers loading of messages till a specific point in time
:param last: Datetime object for the last message to be loaded
:type last: datetime
:return: Nothing
:rtype: None
"""
timestamp = time.mktime(last.t... | [
"def",
"load_earlier_messages_till",
"(",
"self",
",",
"last",
")",
":",
"timestamp",
"=",
"time",
".",
"mktime",
"(",
"last",
".",
"timetuple",
"(",
")",
")",
"self",
".",
"driver",
".",
"wapi_functions",
".",
"loadEarlierMessagesTillDate",
"(",
"self",
"."... | Triggers loading of messages till a specific point in time
:param last: Datetime object for the last message to be loaded
:type last: datetime
:return: Nothing
:rtype: None | [
"Triggers",
"loading",
"of",
"messages",
"till",
"a",
"specific",
"point",
"in",
"time"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/chat.py#L71-L81 | train |
mukulhase/WebWhatsapp-Wrapper | webwhatsapi/objects/message.py | factory_message | def factory_message(js_obj, driver):
"""Factory function for creating appropriate object given selenium JS object"""
if js_obj is None:
return
if "lat" in js_obj and "lng" in js_obj and js_obj["lat"] and js_obj["lng"]:
return GeoMessage(js_obj, driver)
if js_obj["isMedia"]:
ret... | python | def factory_message(js_obj, driver):
"""Factory function for creating appropriate object given selenium JS object"""
if js_obj is None:
return
if "lat" in js_obj and "lng" in js_obj and js_obj["lat"] and js_obj["lng"]:
return GeoMessage(js_obj, driver)
if js_obj["isMedia"]:
ret... | [
"def",
"factory_message",
"(",
"js_obj",
",",
"driver",
")",
":",
"if",
"js_obj",
"is",
"None",
":",
"return",
"if",
"\"lat\"",
"in",
"js_obj",
"and",
"\"lng\"",
"in",
"js_obj",
"and",
"js_obj",
"[",
"\"lat\"",
"]",
"and",
"js_obj",
"[",
"\"lng\"",
"]",
... | Factory function for creating appropriate object given selenium JS object | [
"Factory",
"function",
"for",
"creating",
"appropriate",
"object",
"given",
"selenium",
"JS",
"object"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/message.py#L21-L41 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | create_logger | def create_logger():
"""Initial the global logger variable"""
global logger
formatter = logging.Formatter('%(asctime)s|%(levelname)s|%(message)s')
handler = TimedRotatingFileHandler(log_file, when="midnight", interval=1)
handler.setFormatter(formatter)
handler.setLevel(log_level)
handler.su... | python | def create_logger():
"""Initial the global logger variable"""
global logger
formatter = logging.Formatter('%(asctime)s|%(levelname)s|%(message)s')
handler = TimedRotatingFileHandler(log_file, when="midnight", interval=1)
handler.setFormatter(formatter)
handler.setLevel(log_level)
handler.su... | [
"def",
"create_logger",
"(",
")",
":",
"global",
"logger",
"formatter",
"=",
"logging",
".",
"Formatter",
"(",
"'%(asctime)s|%(levelname)s|%(message)s'",
")",
"handler",
"=",
"TimedRotatingFileHandler",
"(",
"log_file",
",",
"when",
"=",
"\"midnight\"",
",",
"interv... | Initial the global logger variable | [
"Initial",
"the",
"global",
"logger",
"variable"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L156-L167 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | init_driver | def init_driver(client_id):
"""Initialises a new driver via webwhatsapi module
@param client_id: ID of user client
@return webwhatsapi object
"""
# Create profile directory if it does not exist
profile_path = CHROME_CACHE_PATH + str(client_id)
if not os.path.exists(profile_path):
... | python | def init_driver(client_id):
"""Initialises a new driver via webwhatsapi module
@param client_id: ID of user client
@return webwhatsapi object
"""
# Create profile directory if it does not exist
profile_path = CHROME_CACHE_PATH + str(client_id)
if not os.path.exists(profile_path):
... | [
"def",
"init_driver",
"(",
"client_id",
")",
":",
"# Create profile directory if it does not exist",
"profile_path",
"=",
"CHROME_CACHE_PATH",
"+",
"str",
"(",
"client_id",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"profile_path",
")",
":",
"os",
... | Initialises a new driver via webwhatsapi module
@param client_id: ID of user client
@return webwhatsapi object | [
"Initialises",
"a",
"new",
"driver",
"via",
"webwhatsapi",
"module"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L170-L199 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | init_client | def init_client(client_id):
"""Initialse a driver for client and store for future reference
@param client_id: ID of client user
@return whebwhatsapi object
"""
if client_id not in drivers:
drivers[client_id] = init_driver(client_id)
return drivers[client_id] | python | def init_client(client_id):
"""Initialse a driver for client and store for future reference
@param client_id: ID of client user
@return whebwhatsapi object
"""
if client_id not in drivers:
drivers[client_id] = init_driver(client_id)
return drivers[client_id] | [
"def",
"init_client",
"(",
"client_id",
")",
":",
"if",
"client_id",
"not",
"in",
"drivers",
":",
"drivers",
"[",
"client_id",
"]",
"=",
"init_driver",
"(",
"client_id",
")",
"return",
"drivers",
"[",
"client_id",
"]"
] | Initialse a driver for client and store for future reference
@param client_id: ID of client user
@return whebwhatsapi object | [
"Initialse",
"a",
"driver",
"for",
"client",
"and",
"store",
"for",
"future",
"reference"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L202-L210 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | delete_client | def delete_client(client_id, preserve_cache):
"""Delete all objects related to client
@param client_id: ID of client user
@param preserve_cache: Boolean, whether to delete the chrome profile folder or not
"""
if client_id in drivers:
drivers.pop(client_id).quit()
try:
... | python | def delete_client(client_id, preserve_cache):
"""Delete all objects related to client
@param client_id: ID of client user
@param preserve_cache: Boolean, whether to delete the chrome profile folder or not
"""
if client_id in drivers:
drivers.pop(client_id).quit()
try:
... | [
"def",
"delete_client",
"(",
"client_id",
",",
"preserve_cache",
")",
":",
"if",
"client_id",
"in",
"drivers",
":",
"drivers",
".",
"pop",
"(",
"client_id",
")",
".",
"quit",
"(",
")",
"try",
":",
"timers",
"[",
"client_id",
"]",
".",
"stop",
"(",
")",... | Delete all objects related to client
@param client_id: ID of client user
@param preserve_cache: Boolean, whether to delete the chrome profile folder or not | [
"Delete",
"all",
"objects",
"related",
"to",
"client"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L213-L231 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | init_timer | def init_timer(client_id):
"""Create a timer for the client driver to watch for events
@param client_id: ID of clinet user
"""
if client_id in timers and timers[client_id]:
timers[client_id].start()
return
# Create a timer to call check_new_message function after every 2 seconds... | python | def init_timer(client_id):
"""Create a timer for the client driver to watch for events
@param client_id: ID of clinet user
"""
if client_id in timers and timers[client_id]:
timers[client_id].start()
return
# Create a timer to call check_new_message function after every 2 seconds... | [
"def",
"init_timer",
"(",
"client_id",
")",
":",
"if",
"client_id",
"in",
"timers",
"and",
"timers",
"[",
"client_id",
"]",
":",
"timers",
"[",
"client_id",
"]",
".",
"start",
"(",
")",
"return",
"# Create a timer to call check_new_message function after every 2 sec... | Create a timer for the client driver to watch for events
@param client_id: ID of clinet user | [
"Create",
"a",
"timer",
"for",
"the",
"client",
"driver",
"to",
"watch",
"for",
"events"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L234-L244 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | check_new_messages | def check_new_messages(client_id):
"""Check for new unread messages and send them to the custom api
@param client_id: ID of client user
"""
# Return if driver is not defined or if whatsapp is not logged in.
# Stop the timer as well
if client_id not in drivers or not drivers[client_id] or not dr... | python | def check_new_messages(client_id):
"""Check for new unread messages and send them to the custom api
@param client_id: ID of client user
"""
# Return if driver is not defined or if whatsapp is not logged in.
# Stop the timer as well
if client_id not in drivers or not drivers[client_id] or not dr... | [
"def",
"check_new_messages",
"(",
"client_id",
")",
":",
"# Return if driver is not defined or if whatsapp is not logged in.",
"# Stop the timer as well",
"if",
"client_id",
"not",
"in",
"drivers",
"or",
"not",
"drivers",
"[",
"client_id",
"]",
"or",
"not",
"drivers",
"["... | Check for new unread messages and send them to the custom api
@param client_id: ID of client user | [
"Check",
"for",
"new",
"unread",
"messages",
"and",
"send",
"them",
"to",
"the",
"custom",
"api"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L247-L277 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | get_client_info | def get_client_info(client_id):
"""Get the status of a perticular client, as to he/she is connected or not
@param client_id: ID of client user
@return JSON object {
"driver_status": webdriver status
"is_alive": if driver is active or not
"is_logged_in": if user is logged in or n... | python | def get_client_info(client_id):
"""Get the status of a perticular client, as to he/she is connected or not
@param client_id: ID of client user
@return JSON object {
"driver_status": webdriver status
"is_alive": if driver is active or not
"is_logged_in": if user is logged in or n... | [
"def",
"get_client_info",
"(",
"client_id",
")",
":",
"if",
"client_id",
"not",
"in",
"drivers",
":",
"return",
"None",
"driver_status",
"=",
"drivers",
"[",
"client_id",
"]",
".",
"get_status",
"(",
")",
"is_alive",
"=",
"False",
"is_logged_in",
"=",
"False... | Get the status of a perticular client, as to he/she is connected or not
@param client_id: ID of client user
@return JSON object {
"driver_status": webdriver status
"is_alive": if driver is active or not
"is_logged_in": if user is logged in or not
"is_timer": if timer is runn... | [
"Get",
"the",
"status",
"of",
"a",
"perticular",
"client",
"as",
"to",
"he",
"/",
"she",
"is",
"connected",
"or",
"not"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L280-L307 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | create_static_profile_path | def create_static_profile_path(client_id):
"""Create a profile path folder if not exist
@param client_id: ID of client user
@return string profile path
"""
profile_path = os.path.join(STATIC_FILES_PATH, str(client_id))
if not os.path.exists(profile_path):
os.makedirs(profile_path)
... | python | def create_static_profile_path(client_id):
"""Create a profile path folder if not exist
@param client_id: ID of client user
@return string profile path
"""
profile_path = os.path.join(STATIC_FILES_PATH, str(client_id))
if not os.path.exists(profile_path):
os.makedirs(profile_path)
... | [
"def",
"create_static_profile_path",
"(",
"client_id",
")",
":",
"profile_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"STATIC_FILES_PATH",
",",
"str",
"(",
"client_id",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"profile_path",
")",... | Create a profile path folder if not exist
@param client_id: ID of client user
@return string profile path | [
"Create",
"a",
"profile",
"path",
"folder",
"if",
"not",
"exist"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L354-L363 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | before_request | def before_request():
"""This runs before every API request. The function take cares of creating
driver object is not already created. Also it checks for few prerequisits
parameters and set global variables for other functions to use
Required paramters for an API hit are:
auth-key: key string t... | python | def before_request():
"""This runs before every API request. The function take cares of creating
driver object is not already created. Also it checks for few prerequisits
parameters and set global variables for other functions to use
Required paramters for an API hit are:
auth-key: key string t... | [
"def",
"before_request",
"(",
")",
":",
"global",
"logger",
"if",
"not",
"request",
".",
"url_rule",
":",
"abort",
"(",
"404",
")",
"if",
"logger",
"==",
"None",
":",
"create_logger",
"(",
")",
"logger",
".",
"info",
"(",
"\"API call \"",
"+",
"request",... | This runs before every API request. The function take cares of creating
driver object is not already created. Also it checks for few prerequisits
parameters and set global variables for other functions to use
Required paramters for an API hit are:
auth-key: key string to identify valid request
... | [
"This",
"runs",
"before",
"every",
"API",
"request",
".",
"The",
"function",
"take",
"cares",
"of",
"creating",
"driver",
"object",
"is",
"not",
"already",
"created",
".",
"Also",
"it",
"checks",
"for",
"few",
"prerequisits",
"parameters",
"and",
"set",
"glo... | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L390-L438 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | create_client | def create_client():
"""Create a new client driver. The driver is automatically created in
before_request function."""
result = False
if g.client_id in drivers:
result = True
return jsonify({'Success': result}) | python | def create_client():
"""Create a new client driver. The driver is automatically created in
before_request function."""
result = False
if g.client_id in drivers:
result = True
return jsonify({'Success': result}) | [
"def",
"create_client",
"(",
")",
":",
"result",
"=",
"False",
"if",
"g",
".",
"client_id",
"in",
"drivers",
":",
"result",
"=",
"True",
"return",
"jsonify",
"(",
"{",
"'Success'",
":",
"result",
"}",
")"
] | Create a new client driver. The driver is automatically created in
before_request function. | [
"Create",
"a",
"new",
"client",
"driver",
".",
"The",
"driver",
"is",
"automatically",
"created",
"in",
"before_request",
"function",
"."
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L473-L479 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | delete_client | def delete_client():
"""Delete all objects related to client"""
preserve_cache = request.args.get('preserve_cache', False)
delete_client(g.client_id, preserve_cache)
return jsonify({'Success': True}) | python | def delete_client():
"""Delete all objects related to client"""
preserve_cache = request.args.get('preserve_cache', False)
delete_client(g.client_id, preserve_cache)
return jsonify({'Success': True}) | [
"def",
"delete_client",
"(",
")",
":",
"preserve_cache",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'preserve_cache'",
",",
"False",
")",
"delete_client",
"(",
"g",
".",
"client_id",
",",
"preserve_cache",
")",
"return",
"jsonify",
"(",
"{",
"'Success'",... | Delete all objects related to client | [
"Delete",
"all",
"objects",
"related",
"to",
"client"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L483-L487 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | get_screen | def get_screen():
"""Capture chrome screen image and send it back. If the screen is currently
at qr scanning phase, return the image of qr only, else return image of full
screen"""
img_title = 'screen_' + g.client_id + '.png'
image_path = STATIC_FILES_PATH + img_title
if g.driver_status != What... | python | def get_screen():
"""Capture chrome screen image and send it back. If the screen is currently
at qr scanning phase, return the image of qr only, else return image of full
screen"""
img_title = 'screen_' + g.client_id + '.png'
image_path = STATIC_FILES_PATH + img_title
if g.driver_status != What... | [
"def",
"get_screen",
"(",
")",
":",
"img_title",
"=",
"'screen_'",
"+",
"g",
".",
"client_id",
"+",
"'.png'",
"image_path",
"=",
"STATIC_FILES_PATH",
"+",
"img_title",
"if",
"g",
".",
"driver_status",
"!=",
"WhatsAPIDriverStatus",
".",
"LoggedIn",
":",
"try",
... | Capture chrome screen image and send it back. If the screen is currently
at qr scanning phase, return the image of qr only, else return image of full
screen | [
"Capture",
"chrome",
"screen",
"image",
"and",
"send",
"it",
"back",
".",
"If",
"the",
"screen",
"is",
"currently",
"at",
"qr",
"scanning",
"phase",
"return",
"the",
"image",
"of",
"qr",
"only",
"else",
"return",
"image",
"of",
"full",
"screen"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L493-L506 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | get_unread_messages | def get_unread_messages():
"""Get all unread messages"""
mark_seen = request.args.get('mark_seen', True)
unread_msg = g.driver.get_unread()
if mark_seen:
for msg in unread_msg:
msg.chat.send_seen()
return jsonify(unread_msg) | python | def get_unread_messages():
"""Get all unread messages"""
mark_seen = request.args.get('mark_seen', True)
unread_msg = g.driver.get_unread()
if mark_seen:
for msg in unread_msg:
msg.chat.send_seen()
return jsonify(unread_msg) | [
"def",
"get_unread_messages",
"(",
")",
":",
"mark_seen",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'mark_seen'",
",",
"True",
")",
"unread_msg",
"=",
"g",
".",
"driver",
".",
"get_unread",
"(",
")",
"if",
"mark_seen",
":",
"for",
"msg",
"in",
"un... | Get all unread messages | [
"Get",
"all",
"unread",
"messages"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L518-L527 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | get_messages | def get_messages(chat_id):
"""Return all of the chat messages"""
mark_seen = request.args.get('mark_seen', True)
chat = g.driver.get_chat_from_id(chat_id)
msgs = list(g.driver.get_all_messages_in_chat(chat))
for msg in msgs:
print(msg.id)
if mark_seen:
for msg in msgs:
... | python | def get_messages(chat_id):
"""Return all of the chat messages"""
mark_seen = request.args.get('mark_seen', True)
chat = g.driver.get_chat_from_id(chat_id)
msgs = list(g.driver.get_all_messages_in_chat(chat))
for msg in msgs:
print(msg.id)
if mark_seen:
for msg in msgs:
... | [
"def",
"get_messages",
"(",
"chat_id",
")",
":",
"mark_seen",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'mark_seen'",
",",
"True",
")",
"chat",
"=",
"g",
".",
"driver",
".",
"get_chat_from_id",
"(",
"chat_id",
")",
"msgs",
"=",
"list",
"(",
"g",
... | Return all of the chat messages | [
"Return",
"all",
"of",
"the",
"chat",
"messages"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L549-L567 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | send_message | def send_message(chat_id):
"""Send a message to a chat
If a media file is found, send_media is called, else a simple text message
is sent
"""
files = request.files
if files:
res = send_media(chat_id, request)
else:
message = request.form.get('message')
res = g.drive... | python | def send_message(chat_id):
"""Send a message to a chat
If a media file is found, send_media is called, else a simple text message
is sent
"""
files = request.files
if files:
res = send_media(chat_id, request)
else:
message = request.form.get('message')
res = g.drive... | [
"def",
"send_message",
"(",
"chat_id",
")",
":",
"files",
"=",
"request",
".",
"files",
"if",
"files",
":",
"res",
"=",
"send_media",
"(",
"chat_id",
",",
"request",
")",
"else",
":",
"message",
"=",
"request",
".",
"form",
".",
"get",
"(",
"'message'"... | Send a message to a chat
If a media file is found, send_media is called, else a simple text message
is sent | [
"Send",
"a",
"message",
"to",
"a",
"chat",
"If",
"a",
"media",
"file",
"is",
"found",
"send_media",
"is",
"called",
"else",
"a",
"simple",
"text",
"message",
"is",
"sent"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L572-L589 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | download_message_media | def download_message_media(msg_id):
"""Download a media file"""
message = g.driver.get_message_by_id(msg_id)
if not message or not message.mime:
abort(404)
profile_path = create_static_profile_path(g.client_id)
filename = message.save_media(profile_path, True)
if os.path.exists(filena... | python | def download_message_media(msg_id):
"""Download a media file"""
message = g.driver.get_message_by_id(msg_id)
if not message or not message.mime:
abort(404)
profile_path = create_static_profile_path(g.client_id)
filename = message.save_media(profile_path, True)
if os.path.exists(filena... | [
"def",
"download_message_media",
"(",
"msg_id",
")",
":",
"message",
"=",
"g",
".",
"driver",
".",
"get_message_by_id",
"(",
"msg_id",
")",
"if",
"not",
"message",
"or",
"not",
"message",
".",
"mime",
":",
"abort",
"(",
"404",
")",
"profile_path",
"=",
"... | Download a media file | [
"Download",
"a",
"media",
"file"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L594-L607 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | get_active_clients | def get_active_clients():
"""Get a list of all active clients and their status"""
global drivers
if not drivers:
return jsonify([])
result = {client: get_client_info(client) for client in drivers}
return jsonify(result) | python | def get_active_clients():
"""Get a list of all active clients and their status"""
global drivers
if not drivers:
return jsonify([])
result = {client: get_client_info(client) for client in drivers}
return jsonify(result) | [
"def",
"get_active_clients",
"(",
")",
":",
"global",
"drivers",
"if",
"not",
"drivers",
":",
"return",
"jsonify",
"(",
"[",
"]",
")",
"result",
"=",
"{",
"client",
":",
"get_client_info",
"(",
"client",
")",
"for",
"client",
"in",
"drivers",
"}",
"retur... | Get a list of all active clients and their status | [
"Get",
"a",
"list",
"of",
"all",
"active",
"clients",
"and",
"their",
"status"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L613-L621 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | run_clients | def run_clients():
"""Force create driver for client """
clients = request.form.get('clients')
if not clients:
return jsonify({'Error': 'no clients provided'})
result = {}
for client_id in clients.split(','):
if client_id not in drivers:
init_client(client_id)
... | python | def run_clients():
"""Force create driver for client """
clients = request.form.get('clients')
if not clients:
return jsonify({'Error': 'no clients provided'})
result = {}
for client_id in clients.split(','):
if client_id not in drivers:
init_client(client_id)
... | [
"def",
"run_clients",
"(",
")",
":",
"clients",
"=",
"request",
".",
"form",
".",
"get",
"(",
"'clients'",
")",
"if",
"not",
"clients",
":",
"return",
"jsonify",
"(",
"{",
"'Error'",
":",
"'no clients provided'",
"}",
")",
"result",
"=",
"{",
"}",
"for... | Force create driver for client | [
"Force",
"create",
"driver",
"for",
"client"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L625-L639 | train |
mukulhase/WebWhatsapp-Wrapper | sample/flask/webapi.py | kill_clients | def kill_clients():
"""Force kill driver and other objects for a perticular clien"""
clients = request.form.get('clients').split(',')
kill_dead = request.args.get('kill_dead', default=False)
kill_dead = kill_dead and kill_dead in ['true', '1']
if not kill_dead and not clients:
return jsonif... | python | def kill_clients():
"""Force kill driver and other objects for a perticular clien"""
clients = request.form.get('clients').split(',')
kill_dead = request.args.get('kill_dead', default=False)
kill_dead = kill_dead and kill_dead in ['true', '1']
if not kill_dead and not clients:
return jsonif... | [
"def",
"kill_clients",
"(",
")",
":",
"clients",
"=",
"request",
".",
"form",
".",
"get",
"(",
"'clients'",
")",
".",
"split",
"(",
"','",
")",
"kill_dead",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'kill_dead'",
",",
"default",
"=",
"False",
")... | Force kill driver and other objects for a perticular clien | [
"Force",
"kill",
"driver",
"and",
"other",
"objects",
"for",
"a",
"perticular",
"clien"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L643-L663 | train |
mukulhase/WebWhatsapp-Wrapper | webwhatsapi/objects/whatsapp_object.py | driver_needed | def driver_needed(func):
"""
Decorator for WhatsappObjectWithId methods that need to communicate with the browser
It ensures that the object receives a driver instance at construction
:param func: WhatsappObjectWithId method
:return: Wrapped method
"""
def wrapped(self, *args):
if... | python | def driver_needed(func):
"""
Decorator for WhatsappObjectWithId methods that need to communicate with the browser
It ensures that the object receives a driver instance at construction
:param func: WhatsappObjectWithId method
:return: Wrapped method
"""
def wrapped(self, *args):
if... | [
"def",
"driver_needed",
"(",
"func",
")",
":",
"def",
"wrapped",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"self",
".",
"driver",
":",
"raise",
"AttributeError",
"(",
"\"No driver passed to object\"",
")",
"return",
"func",
"(",
"self",
",",
... | Decorator for WhatsappObjectWithId methods that need to communicate with the browser
It ensures that the object receives a driver instance at construction
:param func: WhatsappObjectWithId method
:return: Wrapped method | [
"Decorator",
"for",
"WhatsappObjectWithId",
"methods",
"that",
"need",
"to",
"communicate",
"with",
"the",
"browser"
] | 81b918ee4e0cd0cb563807a72baa167f670d70cb | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/whatsapp_object.py#L4-L20 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.dist_dir | def dist_dir(self):
'''The dist dir at which to place the finished distribution.'''
if self.distribution is None:
warning('Tried to access {}.dist_dir, but {}.distribution '
'is None'.format(self, self))
exit(1)
return self.distribution.dist_dir | python | def dist_dir(self):
'''The dist dir at which to place the finished distribution.'''
if self.distribution is None:
warning('Tried to access {}.dist_dir, but {}.distribution '
'is None'.format(self, self))
exit(1)
return self.distribution.dist_dir | [
"def",
"dist_dir",
"(",
"self",
")",
":",
"if",
"self",
".",
"distribution",
"is",
"None",
":",
"warning",
"(",
"'Tried to access {}.dist_dir, but {}.distribution '",
"'is None'",
".",
"format",
"(",
"self",
",",
"self",
")",
")",
"exit",
"(",
"1",
")",
"ret... | The dist dir at which to place the finished distribution. | [
"The",
"dist",
"dir",
"at",
"which",
"to",
"place",
"the",
"finished",
"distribution",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L70-L76 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.check_recipe_choices | def check_recipe_choices(self):
'''Checks what recipes are being built to see which of the alternative
and optional dependencies are being used,
and returns a list of these.'''
recipes = []
built_recipes = self.ctx.recipe_build_order
for recipe in self.recipe_depends:
... | python | def check_recipe_choices(self):
'''Checks what recipes are being built to see which of the alternative
and optional dependencies are being used,
and returns a list of these.'''
recipes = []
built_recipes = self.ctx.recipe_build_order
for recipe in self.recipe_depends:
... | [
"def",
"check_recipe_choices",
"(",
"self",
")",
":",
"recipes",
"=",
"[",
"]",
"built_recipes",
"=",
"self",
".",
"ctx",
".",
"recipe_build_order",
"for",
"recipe",
"in",
"self",
".",
"recipe_depends",
":",
"if",
"isinstance",
"(",
"recipe",
",",
"(",
"tu... | Checks what recipes are being built to see which of the alternative
and optional dependencies are being used,
and returns a list of these. | [
"Checks",
"what",
"recipes",
"are",
"being",
"built",
"to",
"see",
"which",
"of",
"the",
"alternative",
"and",
"optional",
"dependencies",
"are",
"being",
"used",
"and",
"returns",
"a",
"list",
"of",
"these",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L82-L94 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.prepare_build_dir | def prepare_build_dir(self):
'''Ensure that a build dir exists for the recipe. This same single
dir will be used for building all different archs.'''
self.build_dir = self.get_build_dir()
self.common_dir = self.get_common_dir()
copy_files(join(self.bootstrap_dir, 'build'), self.b... | python | def prepare_build_dir(self):
'''Ensure that a build dir exists for the recipe. This same single
dir will be used for building all different archs.'''
self.build_dir = self.get_build_dir()
self.common_dir = self.get_common_dir()
copy_files(join(self.bootstrap_dir, 'build'), self.b... | [
"def",
"prepare_build_dir",
"(",
"self",
")",
":",
"self",
".",
"build_dir",
"=",
"self",
".",
"get_build_dir",
"(",
")",
"self",
".",
"common_dir",
"=",
"self",
".",
"get_common_dir",
"(",
")",
"copy_files",
"(",
"join",
"(",
"self",
".",
"bootstrap_dir",... | Ensure that a build dir exists for the recipe. This same single
dir will be used for building all different archs. | [
"Ensure",
"that",
"a",
"build",
"dir",
"exists",
"for",
"the",
"recipe",
".",
"This",
"same",
"single",
"dir",
"will",
"be",
"used",
"for",
"building",
"all",
"different",
"archs",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L115-L132 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.list_bootstraps | def list_bootstraps(cls):
'''Find all the available bootstraps and return them.'''
forbidden_dirs = ('__pycache__', 'common')
bootstraps_dir = join(dirname(__file__), 'bootstraps')
for name in listdir(bootstraps_dir):
if name in forbidden_dirs:
continue
... | python | def list_bootstraps(cls):
'''Find all the available bootstraps and return them.'''
forbidden_dirs = ('__pycache__', 'common')
bootstraps_dir = join(dirname(__file__), 'bootstraps')
for name in listdir(bootstraps_dir):
if name in forbidden_dirs:
continue
... | [
"def",
"list_bootstraps",
"(",
"cls",
")",
":",
"forbidden_dirs",
"=",
"(",
"'__pycache__'",
",",
"'common'",
")",
"bootstraps_dir",
"=",
"join",
"(",
"dirname",
"(",
"__file__",
")",
",",
"'bootstraps'",
")",
"for",
"name",
"in",
"listdir",
"(",
"bootstraps... | Find all the available bootstraps and return them. | [
"Find",
"all",
"the",
"available",
"bootstraps",
"and",
"return",
"them",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L141-L150 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.get_bootstrap_from_recipes | def get_bootstrap_from_recipes(cls, recipes, ctx):
'''Returns a bootstrap whose recipe requirements do not conflict with
the given recipes.'''
info('Trying to find a bootstrap that matches the given recipes.')
bootstraps = [cls.get_bootstrap(name, ctx)
for name in c... | python | def get_bootstrap_from_recipes(cls, recipes, ctx):
'''Returns a bootstrap whose recipe requirements do not conflict with
the given recipes.'''
info('Trying to find a bootstrap that matches the given recipes.')
bootstraps = [cls.get_bootstrap(name, ctx)
for name in c... | [
"def",
"get_bootstrap_from_recipes",
"(",
"cls",
",",
"recipes",
",",
"ctx",
")",
":",
"info",
"(",
"'Trying to find a bootstrap that matches the given recipes.'",
")",
"bootstraps",
"=",
"[",
"cls",
".",
"get_bootstrap",
"(",
"name",
",",
"ctx",
")",
"for",
"name... | Returns a bootstrap whose recipe requirements do not conflict with
the given recipes. | [
"Returns",
"a",
"bootstrap",
"whose",
"recipe",
"requirements",
"do",
"not",
"conflict",
"with",
"the",
"given",
"recipes",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L153-L191 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.get_bootstrap | def get_bootstrap(cls, name, ctx):
'''Returns an instance of a bootstrap with the given name.
This is the only way you should access a bootstrap class, as
it sets the bootstrap directory correctly.
'''
if name is None:
return None
if not hasattr(cls, 'bootstr... | python | def get_bootstrap(cls, name, ctx):
'''Returns an instance of a bootstrap with the given name.
This is the only way you should access a bootstrap class, as
it sets the bootstrap directory correctly.
'''
if name is None:
return None
if not hasattr(cls, 'bootstr... | [
"def",
"get_bootstrap",
"(",
"cls",
",",
"name",
",",
"ctx",
")",
":",
"if",
"name",
"is",
"None",
":",
"return",
"None",
"if",
"not",
"hasattr",
"(",
"cls",
",",
"'bootstraps'",
")",
":",
"cls",
".",
"bootstraps",
"=",
"{",
"}",
"if",
"name",
"in"... | Returns an instance of a bootstrap with the given name.
This is the only way you should access a bootstrap class, as
it sets the bootstrap directory correctly. | [
"Returns",
"an",
"instance",
"of",
"a",
"bootstrap",
"with",
"the",
"given",
"name",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L194-L213 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.distribute_libs | def distribute_libs(self, arch, src_dirs, wildcard='*', dest_dir="libs"):
'''Copy existing arch libs from build dirs to current dist dir.'''
info('Copying libs')
tgt_dir = join(dest_dir, arch.arch)
ensure_dir(tgt_dir)
for src_dir in src_dirs:
for lib in glob.glob(join... | python | def distribute_libs(self, arch, src_dirs, wildcard='*', dest_dir="libs"):
'''Copy existing arch libs from build dirs to current dist dir.'''
info('Copying libs')
tgt_dir = join(dest_dir, arch.arch)
ensure_dir(tgt_dir)
for src_dir in src_dirs:
for lib in glob.glob(join... | [
"def",
"distribute_libs",
"(",
"self",
",",
"arch",
",",
"src_dirs",
",",
"wildcard",
"=",
"'*'",
",",
"dest_dir",
"=",
"\"libs\"",
")",
":",
"info",
"(",
"'Copying libs'",
")",
"tgt_dir",
"=",
"join",
"(",
"dest_dir",
",",
"arch",
".",
"arch",
")",
"e... | Copy existing arch libs from build dirs to current dist dir. | [
"Copy",
"existing",
"arch",
"libs",
"from",
"build",
"dirs",
"to",
"current",
"dist",
"dir",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L215-L222 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.distribute_javaclasses | def distribute_javaclasses(self, javaclass_dir, dest_dir="src"):
'''Copy existing javaclasses from build dir to current dist dir.'''
info('Copying java files')
ensure_dir(dest_dir)
for filename in glob.glob(javaclass_dir):
shprint(sh.cp, '-a', filename, dest_dir) | python | def distribute_javaclasses(self, javaclass_dir, dest_dir="src"):
'''Copy existing javaclasses from build dir to current dist dir.'''
info('Copying java files')
ensure_dir(dest_dir)
for filename in glob.glob(javaclass_dir):
shprint(sh.cp, '-a', filename, dest_dir) | [
"def",
"distribute_javaclasses",
"(",
"self",
",",
"javaclass_dir",
",",
"dest_dir",
"=",
"\"src\"",
")",
":",
"info",
"(",
"'Copying java files'",
")",
"ensure_dir",
"(",
"dest_dir",
")",
"for",
"filename",
"in",
"glob",
".",
"glob",
"(",
"javaclass_dir",
")"... | Copy existing javaclasses from build dir to current dist dir. | [
"Copy",
"existing",
"javaclasses",
"from",
"build",
"dir",
"to",
"current",
"dist",
"dir",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L224-L229 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap.distribute_aars | def distribute_aars(self, arch):
'''Process existing .aar bundles and copy to current dist dir.'''
info('Unpacking aars')
for aar in glob.glob(join(self.ctx.aars_dir, '*.aar')):
self._unpack_aar(aar, arch) | python | def distribute_aars(self, arch):
'''Process existing .aar bundles and copy to current dist dir.'''
info('Unpacking aars')
for aar in glob.glob(join(self.ctx.aars_dir, '*.aar')):
self._unpack_aar(aar, arch) | [
"def",
"distribute_aars",
"(",
"self",
",",
"arch",
")",
":",
"info",
"(",
"'Unpacking aars'",
")",
"for",
"aar",
"in",
"glob",
".",
"glob",
"(",
"join",
"(",
"self",
".",
"ctx",
".",
"aars_dir",
",",
"'*.aar'",
")",
")",
":",
"self",
".",
"_unpack_a... | Process existing .aar bundles and copy to current dist dir. | [
"Process",
"existing",
".",
"aar",
"bundles",
"and",
"copy",
"to",
"current",
"dist",
"dir",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L231-L235 | train |
kivy/python-for-android | pythonforandroid/bootstrap.py | Bootstrap._unpack_aar | def _unpack_aar(self, aar, arch):
'''Unpack content of .aar bundle and copy to current dist dir.'''
with temp_directory() as temp_dir:
name = splitext(basename(aar))[0]
jar_name = name + '.jar'
info("unpack {} aar".format(name))
debug(" from {}".format(aa... | python | def _unpack_aar(self, aar, arch):
'''Unpack content of .aar bundle and copy to current dist dir.'''
with temp_directory() as temp_dir:
name = splitext(basename(aar))[0]
jar_name = name + '.jar'
info("unpack {} aar".format(name))
debug(" from {}".format(aa... | [
"def",
"_unpack_aar",
"(",
"self",
",",
"aar",
",",
"arch",
")",
":",
"with",
"temp_directory",
"(",
")",
"as",
"temp_dir",
":",
"name",
"=",
"splitext",
"(",
"basename",
"(",
"aar",
")",
")",
"[",
"0",
"]",
"jar_name",
"=",
"name",
"+",
"'.jar'",
... | Unpack content of .aar bundle and copy to current dist dir. | [
"Unpack",
"content",
"of",
".",
"aar",
"bundle",
"and",
"copy",
"to",
"current",
"dist",
"dir",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L237-L263 | train |
kivy/python-for-android | ci/rebuild_updated_recipes.py | modified_recipes | def modified_recipes(branch='origin/master'):
"""
Returns a set of modified recipes between the current branch and the one
in param.
"""
# using the contrib version on purpose rather than sh.git, since it comes
# with a bunch of fixes, e.g. disabled TTY, see:
# https://stackoverflow.com/a/20... | python | def modified_recipes(branch='origin/master'):
"""
Returns a set of modified recipes between the current branch and the one
in param.
"""
# using the contrib version on purpose rather than sh.git, since it comes
# with a bunch of fixes, e.g. disabled TTY, see:
# https://stackoverflow.com/a/20... | [
"def",
"modified_recipes",
"(",
"branch",
"=",
"'origin/master'",
")",
":",
"# using the contrib version on purpose rather than sh.git, since it comes",
"# with a bunch of fixes, e.g. disabled TTY, see:",
"# https://stackoverflow.com/a/20128598/185510",
"git_diff",
"=",
"sh",
".",
"con... | Returns a set of modified recipes between the current branch and the one
in param. | [
"Returns",
"a",
"set",
"of",
"modified",
"recipes",
"between",
"the",
"current",
"branch",
"and",
"the",
"one",
"in",
"param",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/ci/rebuild_updated_recipes.py#L34-L48 | train |
kivy/python-for-android | ci/rebuild_updated_recipes.py | build | def build(target_python, requirements):
"""
Builds an APK given a target Python and a set of requirements.
"""
if not requirements:
return
testapp = 'setup_testapp_python2.py'
android_sdk_home = os.environ['ANDROID_SDK_HOME']
android_ndk_home = os.environ['ANDROID_NDK_HOME']
if t... | python | def build(target_python, requirements):
"""
Builds an APK given a target Python and a set of requirements.
"""
if not requirements:
return
testapp = 'setup_testapp_python2.py'
android_sdk_home = os.environ['ANDROID_SDK_HOME']
android_ndk_home = os.environ['ANDROID_NDK_HOME']
if t... | [
"def",
"build",
"(",
"target_python",
",",
"requirements",
")",
":",
"if",
"not",
"requirements",
":",
"return",
"testapp",
"=",
"'setup_testapp_python2.py'",
"android_sdk_home",
"=",
"os",
".",
"environ",
"[",
"'ANDROID_SDK_HOME'",
"]",
"android_ndk_home",
"=",
"... | Builds an APK given a target Python and a set of requirements. | [
"Builds",
"an",
"APK",
"given",
"a",
"target",
"Python",
"and",
"a",
"set",
"of",
"requirements",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/ci/rebuild_updated_recipes.py#L51-L71 | train |
kivy/python-for-android | pythonforandroid/recipes/gevent/__init__.py | GeventRecipe.get_recipe_env | def get_recipe_env(self, arch=None, with_flags_in_cc=True):
"""
- Moves all -I<inc> -D<macro> from CFLAGS to CPPFLAGS environment.
- Moves all -l<lib> from LDFLAGS to LIBS environment.
- Fixes linker name (use cross compiler) and flags (appends LIBS)
"""
env = super(Geve... | python | def get_recipe_env(self, arch=None, with_flags_in_cc=True):
"""
- Moves all -I<inc> -D<macro> from CFLAGS to CPPFLAGS environment.
- Moves all -l<lib> from LDFLAGS to LIBS environment.
- Fixes linker name (use cross compiler) and flags (appends LIBS)
"""
env = super(Geve... | [
"def",
"get_recipe_env",
"(",
"self",
",",
"arch",
"=",
"None",
",",
"with_flags_in_cc",
"=",
"True",
")",
":",
"env",
"=",
"super",
"(",
"GeventRecipe",
",",
"self",
")",
".",
"get_recipe_env",
"(",
"arch",
",",
"with_flags_in_cc",
")",
"# CFLAGS may only b... | - Moves all -I<inc> -D<macro> from CFLAGS to CPPFLAGS environment.
- Moves all -l<lib> from LDFLAGS to LIBS environment.
- Fixes linker name (use cross compiler) and flags (appends LIBS) | [
"-",
"Moves",
"all",
"-",
"I<inc",
">",
"-",
"D<macro",
">",
"from",
"CFLAGS",
"to",
"CPPFLAGS",
"environment",
".",
"-",
"Moves",
"all",
"-",
"l<lib",
">",
"from",
"LDFLAGS",
"to",
"LIBS",
"environment",
".",
"-",
"Fixes",
"linker",
"name",
"(",
"use"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/gevent/__init__.py#L12-L29 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py | extract_from_ast | def extract_from_ast(node, gettext_functions=GETTEXT_FUNCTIONS,
babel_style=True):
"""Extract localizable strings from the given template node. Per
default this function returns matches in babel style that means non string
parameters as well as keyword arguments are returned as `None`.... | python | def extract_from_ast(node, gettext_functions=GETTEXT_FUNCTIONS,
babel_style=True):
"""Extract localizable strings from the given template node. Per
default this function returns matches in babel style that means non string
parameters as well as keyword arguments are returned as `None`.... | [
"def",
"extract_from_ast",
"(",
"node",
",",
"gettext_functions",
"=",
"GETTEXT_FUNCTIONS",
",",
"babel_style",
"=",
"True",
")",
":",
"for",
"node",
"in",
"node",
".",
"find_all",
"(",
"nodes",
".",
"Call",
")",
":",
"if",
"not",
"isinstance",
"(",
"node"... | Extract localizable strings from the given template node. Per
default this function returns matches in babel style that means non string
parameters as well as keyword arguments are returned as `None`. This
allows Babel to figure out what you really meant if you are using
gettext functions that allow k... | [
"Extract",
"localizable",
"strings",
"from",
"the",
"given",
"template",
"node",
".",
"Per",
"default",
"this",
"function",
"returns",
"matches",
"in",
"babel",
"style",
"that",
"means",
"non",
"string",
"parameters",
"as",
"well",
"as",
"keyword",
"arguments",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py#L381-L446 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py | babel_extract | def babel_extract(fileobj, keywords, comment_tags, options):
"""Babel extraction method for Jinja templates.
.. versionchanged:: 2.3
Basic support for translation comments was added. If `comment_tags`
is now set to a list of keywords for extraction, the extractor will
try to find the best... | python | def babel_extract(fileobj, keywords, comment_tags, options):
"""Babel extraction method for Jinja templates.
.. versionchanged:: 2.3
Basic support for translation comments was added. If `comment_tags`
is now set to a list of keywords for extraction, the extractor will
try to find the best... | [
"def",
"babel_extract",
"(",
"fileobj",
",",
"keywords",
",",
"comment_tags",
",",
"options",
")",
":",
"extensions",
"=",
"set",
"(",
")",
"for",
"extension",
"in",
"options",
".",
"get",
"(",
"'extensions'",
",",
"''",
")",
".",
"split",
"(",
"','",
... | Babel extraction method for Jinja templates.
.. versionchanged:: 2.3
Basic support for translation comments was added. If `comment_tags`
is now set to a list of keywords for extraction, the extractor will
try to find the best preceeding comment that begins with one of the
keywords. Fo... | [
"Babel",
"extraction",
"method",
"for",
"Jinja",
"templates",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py#L486-L545 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py | InternationalizationExtension.parse | def parse(self, parser):
"""Parse a translatable tag."""
lineno = next(parser.stream).lineno
# find all the variables referenced. Additionally a variable can be
# defined in the body of the trans block too, but this is checked at
# a later state.
plural_expr = None
... | python | def parse(self, parser):
"""Parse a translatable tag."""
lineno = next(parser.stream).lineno
# find all the variables referenced. Additionally a variable can be
# defined in the body of the trans block too, but this is checked at
# a later state.
plural_expr = None
... | [
"def",
"parse",
"(",
"self",
",",
"parser",
")",
":",
"lineno",
"=",
"next",
"(",
"parser",
".",
"stream",
")",
".",
"lineno",
"# find all the variables referenced. Additionally a variable can be",
"# defined in the body of the trans block too, but this is checked at",
"# a ... | Parse a translatable tag. | [
"Parse",
"a",
"translatable",
"tag",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py#L175-L262 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py | InternationalizationExtension._make_node | def _make_node(self, singular, plural, variables, plural_expr):
"""Generates a useful node from the data provided."""
# singular only:
if plural_expr is None:
gettext = nodes.Name('gettext', 'load')
node = nodes.Call(gettext, [nodes.Const(singular)],
... | python | def _make_node(self, singular, plural, variables, plural_expr):
"""Generates a useful node from the data provided."""
# singular only:
if plural_expr is None:
gettext = nodes.Name('gettext', 'load')
node = nodes.Call(gettext, [nodes.Const(singular)],
... | [
"def",
"_make_node",
"(",
"self",
",",
"singular",
",",
"plural",
",",
"variables",
",",
"plural_expr",
")",
":",
"# singular only:",
"if",
"plural_expr",
"is",
"None",
":",
"gettext",
"=",
"nodes",
".",
"Name",
"(",
"'gettext'",
",",
"'load'",
")",
"node"... | Generates a useful node from the data provided. | [
"Generates",
"a",
"useful",
"node",
"from",
"the",
"data",
"provided",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py#L296-L320 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | load_extensions | def load_extensions(environment, extensions):
"""Load the extensions from the list and bind it to the environment.
Returns a dict of instanciated environments.
"""
result = {}
for extension in extensions:
if isinstance(extension, basestring):
extension = import_string(extension)
... | python | def load_extensions(environment, extensions):
"""Load the extensions from the list and bind it to the environment.
Returns a dict of instanciated environments.
"""
result = {}
for extension in extensions:
if isinstance(extension, basestring):
extension = import_string(extension)
... | [
"def",
"load_extensions",
"(",
"environment",
",",
"extensions",
")",
":",
"result",
"=",
"{",
"}",
"for",
"extension",
"in",
"extensions",
":",
"if",
"isinstance",
"(",
"extension",
",",
"basestring",
")",
":",
"extension",
"=",
"import_string",
"(",
"exten... | Load the extensions from the list and bind it to the environment.
Returns a dict of instanciated environments. | [
"Load",
"the",
"extensions",
"from",
"the",
"list",
"and",
"bind",
"it",
"to",
"the",
"environment",
".",
"Returns",
"a",
"dict",
"of",
"instanciated",
"environments",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L68-L77 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Environment.extend | def extend(self, **attributes):
"""Add the items to the instance of the environment if they do not exist
yet. This is used by :ref:`extensions <writing-extensions>` to register
callbacks and configuration values without breaking inheritance.
"""
for key, value in attributes.iter... | python | def extend(self, **attributes):
"""Add the items to the instance of the environment if they do not exist
yet. This is used by :ref:`extensions <writing-extensions>` to register
callbacks and configuration values without breaking inheritance.
"""
for key, value in attributes.iter... | [
"def",
"extend",
"(",
"self",
",",
"*",
"*",
"attributes",
")",
":",
"for",
"key",
",",
"value",
"in",
"attributes",
".",
"iteritems",
"(",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"key",
")",
":",
"setattr",
"(",
"self",
",",
"key",
"... | Add the items to the instance of the environment if they do not exist
yet. This is used by :ref:`extensions <writing-extensions>` to register
callbacks and configuration values without breaking inheritance. | [
"Add",
"the",
"items",
"to",
"the",
"instance",
"of",
"the",
"environment",
"if",
"they",
"do",
"not",
"exist",
"yet",
".",
"This",
"is",
"used",
"by",
":",
"ref",
":",
"extensions",
"<writing",
"-",
"extensions",
">",
"to",
"register",
"callbacks",
"and... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L282-L289 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Environment._parse | def _parse(self, source, name, filename):
"""Internal parsing function used by `parse` and `compile`."""
return Parser(self, source, name, _encode_filename(filename)).parse() | python | def _parse(self, source, name, filename):
"""Internal parsing function used by `parse` and `compile`."""
return Parser(self, source, name, _encode_filename(filename)).parse() | [
"def",
"_parse",
"(",
"self",
",",
"source",
",",
"name",
",",
"filename",
")",
":",
"return",
"Parser",
"(",
"self",
",",
"source",
",",
"name",
",",
"_encode_filename",
"(",
"filename",
")",
")",
".",
"parse",
"(",
")"
] | Internal parsing function used by `parse` and `compile`. | [
"Internal",
"parsing",
"function",
"used",
"by",
"parse",
"and",
"compile",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L388-L390 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Environment.preprocess | def preprocess(self, source, name=None, filename=None):
"""Preprocesses the source with all extensions. This is automatically
called for all parsing and compiling methods but *not* for :meth:`lex`
because there you usually only want the actual source tokenized.
"""
return reduce... | python | def preprocess(self, source, name=None, filename=None):
"""Preprocesses the source with all extensions. This is automatically
called for all parsing and compiling methods but *not* for :meth:`lex`
because there you usually only want the actual source tokenized.
"""
return reduce... | [
"def",
"preprocess",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"return",
"reduce",
"(",
"lambda",
"s",
",",
"e",
":",
"e",
".",
"preprocess",
"(",
"s",
",",
"name",
",",
"filename",
")",
",",
"s... | Preprocesses the source with all extensions. This is automatically
called for all parsing and compiling methods but *not* for :meth:`lex`
because there you usually only want the actual source tokenized. | [
"Preprocesses",
"the",
"source",
"with",
"all",
"extensions",
".",
"This",
"is",
"automatically",
"called",
"for",
"all",
"parsing",
"and",
"compiling",
"methods",
"but",
"*",
"not",
"*",
"for",
":",
"meth",
":",
"lex",
"because",
"there",
"you",
"usually",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L409-L415 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Environment.compile | def compile(self, source, name=None, filename=None, raw=False,
defer_init=False):
"""Compile a node or template source code. The `name` parameter is
the load name of the template after it was joined using
:meth:`join_path` if necessary, not the filename on the file system.
... | python | def compile(self, source, name=None, filename=None, raw=False,
defer_init=False):
"""Compile a node or template source code. The `name` parameter is
the load name of the template after it was joined using
:meth:`join_path` if necessary, not the filename on the file system.
... | [
"def",
"compile",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"raw",
"=",
"False",
",",
"defer_init",
"=",
"False",
")",
":",
"source_hint",
"=",
"None",
"try",
":",
"if",
"isinstance",
"(",
"source",
",",... | Compile a node or template source code. The `name` parameter is
the load name of the template after it was joined using
:meth:`join_path` if necessary, not the filename on the file system.
the `filename` parameter is the estimated filename of the template on
the file system. If the tem... | [
"Compile",
"a",
"node",
"or",
"template",
"source",
"code",
".",
"The",
"name",
"parameter",
"is",
"the",
"load",
"name",
"of",
"the",
"template",
"after",
"it",
"was",
"joined",
"using",
":",
"meth",
":",
"join_path",
"if",
"necessary",
"not",
"the",
"f... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L430-L469 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Environment.handle_exception | def handle_exception(self, exc_info=None, rendered=False, source_hint=None):
"""Exception handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template.
"""
global _make_traceback
if exc_info is None:
ex... | python | def handle_exception(self, exc_info=None, rendered=False, source_hint=None):
"""Exception handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template.
"""
global _make_traceback
if exc_info is None:
ex... | [
"def",
"handle_exception",
"(",
"self",
",",
"exc_info",
"=",
"None",
",",
"rendered",
"=",
"False",
",",
"source_hint",
"=",
"None",
")",
":",
"global",
"_make_traceback",
"if",
"exc_info",
"is",
"None",
":",
"exc_info",
"=",
"sys",
".",
"exc_info",
"(",
... | Exception handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template. | [
"Exception",
"handling",
"helper",
".",
"This",
"is",
"used",
"internally",
"to",
"either",
"raise",
"rewritten",
"exceptions",
"or",
"return",
"a",
"rendered",
"traceback",
"for",
"the",
"template",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L624-L644 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Template.from_code | def from_code(cls, environment, code, globals, uptodate=None):
"""Creates a template object from compiled code and the globals. This
is used by the loaders and environment to create a template object.
"""
namespace = {
'environment': environment,
'__file__': ... | python | def from_code(cls, environment, code, globals, uptodate=None):
"""Creates a template object from compiled code and the globals. This
is used by the loaders and environment to create a template object.
"""
namespace = {
'environment': environment,
'__file__': ... | [
"def",
"from_code",
"(",
"cls",
",",
"environment",
",",
"code",
",",
"globals",
",",
"uptodate",
"=",
"None",
")",
":",
"namespace",
"=",
"{",
"'environment'",
":",
"environment",
",",
"'__file__'",
":",
"code",
".",
"co_filename",
"}",
"exec",
"code",
... | Creates a template object from compiled code and the globals. This
is used by the loaders and environment to create a template object. | [
"Creates",
"a",
"template",
"object",
"from",
"compiled",
"code",
"and",
"the",
"globals",
".",
"This",
"is",
"used",
"by",
"the",
"loaders",
"and",
"environment",
"to",
"create",
"a",
"template",
"object",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L808-L819 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Template.render | def render(self, *args, **kwargs):
"""This method accepts the same arguments as the `dict` constructor:
A dict, a dict subclass or some keyword arguments. If no arguments
are given the context will be empty. These two calls do the same::
template.render(knights='that say nih')
... | python | def render(self, *args, **kwargs):
"""This method accepts the same arguments as the `dict` constructor:
A dict, a dict subclass or some keyword arguments. If no arguments
are given the context will be empty. These two calls do the same::
template.render(knights='that say nih')
... | [
"def",
"render",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"vars",
"=",
"dict",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"return",
"concat",
"(",
"self",
".",
"root_render_func",
"(",
"self",
".",
"new_c... | This method accepts the same arguments as the `dict` constructor:
A dict, a dict subclass or some keyword arguments. If no arguments
are given the context will be empty. These two calls do the same::
template.render(knights='that say nih')
template.render({'knights': 'that say... | [
"This",
"method",
"accepts",
"the",
"same",
"arguments",
"as",
"the",
"dict",
"constructor",
":",
"A",
"dict",
"a",
"dict",
"subclass",
"or",
"some",
"keyword",
"arguments",
".",
"If",
"no",
"arguments",
"are",
"given",
"the",
"context",
"will",
"be",
"emp... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L853-L868 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Template.generate | def generate(self, *args, **kwargs):
"""For very large templates it can be useful to not render the whole
template at once but evaluate each statement after another and yield
piece for piece. This method basically does exactly that and returns
a generator that yields one item after anot... | python | def generate(self, *args, **kwargs):
"""For very large templates it can be useful to not render the whole
template at once but evaluate each statement after another and yield
piece for piece. This method basically does exactly that and returns
a generator that yields one item after anot... | [
"def",
"generate",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"vars",
"=",
"dict",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"for",
"event",
"in",
"self",
".",
"root_render_func",
"(",
"self",
".",
"new_co... | For very large templates it can be useful to not render the whole
template at once but evaluate each statement after another and yield
piece for piece. This method basically does exactly that and returns
a generator that yields one item after another as unicode strings.
It accepts the ... | [
"For",
"very",
"large",
"templates",
"it",
"can",
"be",
"useful",
"to",
"not",
"render",
"the",
"whole",
"template",
"at",
"once",
"but",
"evaluate",
"each",
"statement",
"after",
"another",
"and",
"yield",
"piece",
"for",
"piece",
".",
"This",
"method",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L876-L892 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Template.module | def module(self):
"""The template as module. This is used for imports in the
template runtime but is also useful if one wants to access
exported template variables from the Python layer:
>>> t = Template('{% macro foo() %}42{% endmacro %}23')
>>> unicode(t.module)
u'23'... | python | def module(self):
"""The template as module. This is used for imports in the
template runtime but is also useful if one wants to access
exported template variables from the Python layer:
>>> t = Template('{% macro foo() %}42{% endmacro %}23')
>>> unicode(t.module)
u'23'... | [
"def",
"module",
"(",
"self",
")",
":",
"if",
"self",
".",
"_module",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_module",
"self",
".",
"_module",
"=",
"rv",
"=",
"self",
".",
"make_module",
"(",
")",
"return",
"rv"
] | The template as module. This is used for imports in the
template runtime but is also useful if one wants to access
exported template variables from the Python layer:
>>> t = Template('{% macro foo() %}42{% endmacro %}23')
>>> unicode(t.module)
u'23'
>>> t.module.foo()
... | [
"The",
"template",
"as",
"module",
".",
"This",
"is",
"used",
"for",
"imports",
"in",
"the",
"template",
"runtime",
"but",
"is",
"also",
"useful",
"if",
"one",
"wants",
"to",
"access",
"exported",
"template",
"variables",
"from",
"the",
"Python",
"layer",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L915-L929 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | Template.debug_info | def debug_info(self):
"""The debug info mapping."""
return [tuple(map(int, x.split('='))) for x in
self._debug_info.split('&')] | python | def debug_info(self):
"""The debug info mapping."""
return [tuple(map(int, x.split('='))) for x in
self._debug_info.split('&')] | [
"def",
"debug_info",
"(",
"self",
")",
":",
"return",
"[",
"tuple",
"(",
"map",
"(",
"int",
",",
"x",
".",
"split",
"(",
"'='",
")",
")",
")",
"for",
"x",
"in",
"self",
".",
"_debug_info",
".",
"split",
"(",
"'&'",
")",
"]"
] | The debug info mapping. | [
"The",
"debug",
"info",
"mapping",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L948-L951 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | TemplateStream.dump | def dump(self, fp, encoding=None, errors='strict'):
"""Dump the complete stream into a file or file-like object.
Per default unicode strings are written, if you want to encode
before writing specifiy an `encoding`.
Example usage::
Template('Hello {{ name }}!').stream(name='... | python | def dump(self, fp, encoding=None, errors='strict'):
"""Dump the complete stream into a file or file-like object.
Per default unicode strings are written, if you want to encode
before writing specifiy an `encoding`.
Example usage::
Template('Hello {{ name }}!').stream(name='... | [
"def",
"dump",
"(",
"self",
",",
"fp",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
")",
":",
"close",
"=",
"False",
"if",
"isinstance",
"(",
"fp",
",",
"basestring",
")",
":",
"fp",
"=",
"file",
"(",
"fp",
",",
"'w'",
")",
"clos... | Dump the complete stream into a file or file-like object.
Per default unicode strings are written, if you want to encode
before writing specifiy an `encoding`.
Example usage::
Template('Hello {{ name }}!').stream(name='foo').dump('hello.html') | [
"Dump",
"the",
"complete",
"stream",
"into",
"a",
"file",
"or",
"file",
"-",
"like",
"object",
".",
"Per",
"default",
"unicode",
"strings",
"are",
"written",
"if",
"you",
"want",
"to",
"encode",
"before",
"writing",
"specifiy",
"an",
"encoding",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L1027-L1052 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | TemplateStream.disable_buffering | def disable_buffering(self):
"""Disable the output buffering."""
self._next = self._gen.next
self.buffered = False | python | def disable_buffering(self):
"""Disable the output buffering."""
self._next = self._gen.next
self.buffered = False | [
"def",
"disable_buffering",
"(",
"self",
")",
":",
"self",
".",
"_next",
"=",
"self",
".",
"_gen",
".",
"next",
"self",
".",
"buffered",
"=",
"False"
] | Disable the output buffering. | [
"Disable",
"the",
"output",
"buffering",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L1054-L1057 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | TemplateStream.enable_buffering | def enable_buffering(self, size=5):
"""Enable buffering. Buffer `size` items before yielding them."""
if size <= 1:
raise ValueError('buffer size too small')
def generator(next):
buf = []
c_size = 0
push = buf.append
while 1:
... | python | def enable_buffering(self, size=5):
"""Enable buffering. Buffer `size` items before yielding them."""
if size <= 1:
raise ValueError('buffer size too small')
def generator(next):
buf = []
c_size = 0
push = buf.append
while 1:
... | [
"def",
"enable_buffering",
"(",
"self",
",",
"size",
"=",
"5",
")",
":",
"if",
"size",
"<=",
"1",
":",
"raise",
"ValueError",
"(",
"'buffer size too small'",
")",
"def",
"generator",
"(",
"next",
")",
":",
"buf",
"=",
"[",
"]",
"c_size",
"=",
"0",
"p... | Enable buffering. Buffer `size` items before yielding them. | [
"Enable",
"buffering",
".",
"Buffer",
"size",
"items",
"before",
"yielding",
"them",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L1059-L1084 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | require_prebuilt_dist | def require_prebuilt_dist(func):
"""Decorator for ToolchainCL methods. If present, the method will
automatically make sure a dist has been built before continuing
or, if no dists are present or can be obtained, will raise an
error.
"""
@wraps(func)
def wrapper_func(self, args):
ctx ... | python | def require_prebuilt_dist(func):
"""Decorator for ToolchainCL methods. If present, the method will
automatically make sure a dist has been built before continuing
or, if no dists are present or can be obtained, will raise an
error.
"""
@wraps(func)
def wrapper_func(self, args):
ctx ... | [
"def",
"require_prebuilt_dist",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper_func",
"(",
"self",
",",
"args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"ctx",
".",
"set_archs",
"(",
"self",
".",
"_archs",
")",
"ctx",
".",
... | Decorator for ToolchainCL methods. If present, the method will
automatically make sure a dist has been built before continuing
or, if no dists are present or can be obtained, will raise an
error. | [
"Decorator",
"for",
"ToolchainCL",
"methods",
".",
"If",
"present",
"the",
"method",
"will",
"automatically",
"make",
"sure",
"a",
"dist",
"has",
"been",
"built",
"before",
"continuing",
"or",
"if",
"no",
"dists",
"are",
"present",
"or",
"can",
"be",
"obtain... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L131-L154 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | dist_from_args | def dist_from_args(ctx, args):
"""Parses out any distribution-related arguments, and uses them to
obtain a Distribution class instance for the build.
"""
return Distribution.get_distribution(
ctx,
name=args.dist_name,
recipes=split_argument_list(args.requirements),
ndk_ap... | python | def dist_from_args(ctx, args):
"""Parses out any distribution-related arguments, and uses them to
obtain a Distribution class instance for the build.
"""
return Distribution.get_distribution(
ctx,
name=args.dist_name,
recipes=split_argument_list(args.requirements),
ndk_ap... | [
"def",
"dist_from_args",
"(",
"ctx",
",",
"args",
")",
":",
"return",
"Distribution",
".",
"get_distribution",
"(",
"ctx",
",",
"name",
"=",
"args",
".",
"dist_name",
",",
"recipes",
"=",
"split_argument_list",
"(",
"args",
".",
"requirements",
")",
",",
"... | Parses out any distribution-related arguments, and uses them to
obtain a Distribution class instance for the build. | [
"Parses",
"out",
"any",
"distribution",
"-",
"related",
"arguments",
"and",
"uses",
"them",
"to",
"obtain",
"a",
"Distribution",
"class",
"instance",
"for",
"the",
"build",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L157-L168 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | build_dist_from_args | def build_dist_from_args(ctx, dist, args):
"""Parses out any bootstrap related arguments, and uses them to build
a dist."""
bs = Bootstrap.get_bootstrap(args.bootstrap, ctx)
blacklist = getattr(args, "blacklist_requirements", "").split(",")
if len(blacklist) == 1 and blacklist[0] == "":
blac... | python | def build_dist_from_args(ctx, dist, args):
"""Parses out any bootstrap related arguments, and uses them to build
a dist."""
bs = Bootstrap.get_bootstrap(args.bootstrap, ctx)
blacklist = getattr(args, "blacklist_requirements", "").split(",")
if len(blacklist) == 1 and blacklist[0] == "":
blac... | [
"def",
"build_dist_from_args",
"(",
"ctx",
",",
"dist",
",",
"args",
")",
":",
"bs",
"=",
"Bootstrap",
".",
"get_bootstrap",
"(",
"args",
".",
"bootstrap",
",",
"ctx",
")",
"blacklist",
"=",
"getattr",
"(",
"args",
",",
"\"blacklist_requirements\"",
",",
"... | Parses out any bootstrap related arguments, and uses them to build
a dist. | [
"Parses",
"out",
"any",
"bootstrap",
"related",
"arguments",
"and",
"uses",
"them",
"to",
"build",
"a",
"dist",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L171-L210 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.warn_on_deprecated_args | def warn_on_deprecated_args(self, args):
"""
Print warning messages for any deprecated arguments that were passed.
"""
# Output warning if setup.py is present and neither --ignore-setup-py
# nor --use-setup-py was specified.
if getattr(args, "private", None) is not None ... | python | def warn_on_deprecated_args(self, args):
"""
Print warning messages for any deprecated arguments that were passed.
"""
# Output warning if setup.py is present and neither --ignore-setup-py
# nor --use-setup-py was specified.
if getattr(args, "private", None) is not None ... | [
"def",
"warn_on_deprecated_args",
"(",
"self",
",",
"args",
")",
":",
"# Output warning if setup.py is present and neither --ignore-setup-py",
"# nor --use-setup-py was specified.",
"if",
"getattr",
"(",
"args",
",",
"\"private\"",
",",
"None",
")",
"is",
"not",
"None",
"... | Print warning messages for any deprecated arguments that were passed. | [
"Print",
"warning",
"messages",
"for",
"any",
"deprecated",
"arguments",
"that",
"were",
"passed",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L669-L699 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.bootstraps | def bootstraps(self, _args):
"""List all the bootstraps available to build with."""
for bs in Bootstrap.list_bootstraps():
bs = Bootstrap.get_bootstrap(bs, self.ctx)
print('{Fore.BLUE}{Style.BRIGHT}{bs.name}{Style.RESET_ALL}'
.format(bs=bs, Fore=Out_Fore, Style=... | python | def bootstraps(self, _args):
"""List all the bootstraps available to build with."""
for bs in Bootstrap.list_bootstraps():
bs = Bootstrap.get_bootstrap(bs, self.ctx)
print('{Fore.BLUE}{Style.BRIGHT}{bs.name}{Style.RESET_ALL}'
.format(bs=bs, Fore=Out_Fore, Style=... | [
"def",
"bootstraps",
"(",
"self",
",",
"_args",
")",
":",
"for",
"bs",
"in",
"Bootstrap",
".",
"list_bootstraps",
"(",
")",
":",
"bs",
"=",
"Bootstrap",
".",
"get_bootstrap",
"(",
"bs",
",",
"self",
".",
"ctx",
")",
"print",
"(",
"'{Fore.BLUE}{Style.BRIG... | List all the bootstraps available to build with. | [
"List",
"all",
"the",
"bootstraps",
"available",
"to",
"build",
"with",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L767-L774 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.clean_all | def clean_all(self, args):
"""Delete all build components; the package cache, package builds,
bootstrap builds and distributions."""
self.clean_dists(args)
self.clean_builds(args)
self.clean_download_cache(args) | python | def clean_all(self, args):
"""Delete all build components; the package cache, package builds,
bootstrap builds and distributions."""
self.clean_dists(args)
self.clean_builds(args)
self.clean_download_cache(args) | [
"def",
"clean_all",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"clean_dists",
"(",
"args",
")",
"self",
".",
"clean_builds",
"(",
"args",
")",
"self",
".",
"clean_download_cache",
"(",
"args",
")"
] | Delete all build components; the package cache, package builds,
bootstrap builds and distributions. | [
"Delete",
"all",
"build",
"components",
";",
"the",
"package",
"cache",
"package",
"builds",
"bootstrap",
"builds",
"and",
"distributions",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L794-L799 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.clean_dists | def clean_dists(self, _args):
"""Delete all compiled distributions in the internal distribution
directory."""
ctx = self.ctx
if exists(ctx.dist_dir):
shutil.rmtree(ctx.dist_dir) | python | def clean_dists(self, _args):
"""Delete all compiled distributions in the internal distribution
directory."""
ctx = self.ctx
if exists(ctx.dist_dir):
shutil.rmtree(ctx.dist_dir) | [
"def",
"clean_dists",
"(",
"self",
",",
"_args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"if",
"exists",
"(",
"ctx",
".",
"dist_dir",
")",
":",
"shutil",
".",
"rmtree",
"(",
"ctx",
".",
"dist_dir",
")"
] | Delete all compiled distributions in the internal distribution
directory. | [
"Delete",
"all",
"compiled",
"distributions",
"in",
"the",
"internal",
"distribution",
"directory",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L801-L806 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.clean_bootstrap_builds | def clean_bootstrap_builds(self, _args):
"""Delete all the bootstrap builds."""
if exists(join(self.ctx.build_dir, 'bootstrap_builds')):
shutil.rmtree(join(self.ctx.build_dir, 'bootstrap_builds')) | python | def clean_bootstrap_builds(self, _args):
"""Delete all the bootstrap builds."""
if exists(join(self.ctx.build_dir, 'bootstrap_builds')):
shutil.rmtree(join(self.ctx.build_dir, 'bootstrap_builds')) | [
"def",
"clean_bootstrap_builds",
"(",
"self",
",",
"_args",
")",
":",
"if",
"exists",
"(",
"join",
"(",
"self",
".",
"ctx",
".",
"build_dir",
",",
"'bootstrap_builds'",
")",
")",
":",
"shutil",
".",
"rmtree",
"(",
"join",
"(",
"self",
".",
"ctx",
".",
... | Delete all the bootstrap builds. | [
"Delete",
"all",
"the",
"bootstrap",
"builds",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L808-L811 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.clean_builds | def clean_builds(self, _args):
"""Delete all build caches for each recipe, python-install, java code
and compiled libs collection.
This does *not* delete the package download cache or the final
distributions. You can also use clean_recipe_build to delete the build
of a specific... | python | def clean_builds(self, _args):
"""Delete all build caches for each recipe, python-install, java code
and compiled libs collection.
This does *not* delete the package download cache or the final
distributions. You can also use clean_recipe_build to delete the build
of a specific... | [
"def",
"clean_builds",
"(",
"self",
",",
"_args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"if",
"exists",
"(",
"ctx",
".",
"build_dir",
")",
":",
"shutil",
".",
"rmtree",
"(",
"ctx",
".",
"build_dir",
")",
"if",
"exists",
"(",
"ctx",
".",
"python... | Delete all build caches for each recipe, python-install, java code
and compiled libs collection.
This does *not* delete the package download cache or the final
distributions. You can also use clean_recipe_build to delete the build
of a specific recipe. | [
"Delete",
"all",
"build",
"caches",
"for",
"each",
"recipe",
"python",
"-",
"install",
"java",
"code",
"and",
"compiled",
"libs",
"collection",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L818-L833 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.clean_recipe_build | def clean_recipe_build(self, args):
"""Deletes the build files of the given recipe.
This is intended for debug purposes. You may experience
strange behaviour or problems with some recipes if their
build has made unexpected state changes. If this happens, run
clean_builds, or att... | python | def clean_recipe_build(self, args):
"""Deletes the build files of the given recipe.
This is intended for debug purposes. You may experience
strange behaviour or problems with some recipes if their
build has made unexpected state changes. If this happens, run
clean_builds, or att... | [
"def",
"clean_recipe_build",
"(",
"self",
",",
"args",
")",
":",
"recipe",
"=",
"Recipe",
".",
"get_recipe",
"(",
"args",
".",
"recipe",
",",
"self",
".",
"ctx",
")",
"info",
"(",
"'Cleaning build for {} recipe.'",
".",
"format",
"(",
"recipe",
".",
"name"... | Deletes the build files of the given recipe.
This is intended for debug purposes. You may experience
strange behaviour or problems with some recipes if their
build has made unexpected state changes. If this happens, run
clean_builds, or attempt to clean other recipes until things
... | [
"Deletes",
"the",
"build",
"files",
"of",
"the",
"given",
"recipe",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L835-L848 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.clean_download_cache | def clean_download_cache(self, args):
""" Deletes a download cache for recipes passed as arguments. If no
argument is passed, it'll delete *all* downloaded caches. ::
p4a clean_download_cache kivy,pyjnius
This does *not* delete the build caches or final distributions.
"""
... | python | def clean_download_cache(self, args):
""" Deletes a download cache for recipes passed as arguments. If no
argument is passed, it'll delete *all* downloaded caches. ::
p4a clean_download_cache kivy,pyjnius
This does *not* delete the build caches or final distributions.
"""
... | [
"def",
"clean_download_cache",
"(",
"self",
",",
"args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"if",
"hasattr",
"(",
"args",
",",
"'recipes'",
")",
"and",
"args",
".",
"recipes",
":",
"for",
"package",
"in",
"args",
".",
"recipes",
":",
"remove_pat... | Deletes a download cache for recipes passed as arguments. If no
argument is passed, it'll delete *all* downloaded caches. ::
p4a clean_download_cache kivy,pyjnius
This does *not* delete the build caches or final distributions. | [
"Deletes",
"a",
"download",
"cache",
"for",
"recipes",
"passed",
"as",
"arguments",
".",
"If",
"no",
"argument",
"is",
"passed",
"it",
"ll",
"delete",
"*",
"all",
"*",
"downloaded",
"caches",
".",
"::"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L850-L873 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.export_dist | def export_dist(self, args):
"""Copies a created dist to an output dir.
This makes it easy to navigate to the dist to investigate it
or call build.py, though you do not in general need to do this
and can use the apk command instead.
"""
ctx = self.ctx
dist = dist... | python | def export_dist(self, args):
"""Copies a created dist to an output dir.
This makes it easy to navigate to the dist to investigate it
or call build.py, though you do not in general need to do this
and can use the apk command instead.
"""
ctx = self.ctx
dist = dist... | [
"def",
"export_dist",
"(",
"self",
",",
"args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"dist",
"=",
"dist_from_args",
"(",
"ctx",
",",
"args",
")",
"if",
"dist",
".",
"needs_build",
":",
"raise",
"BuildInterruptingException",
"(",
"'You asked to export a ... | Copies a created dist to an output dir.
This makes it easy to navigate to the dist to investigate it
or call build.py, though you do not in general need to do this
and can use the apk command instead. | [
"Copies",
"a",
"created",
"dist",
"to",
"an",
"output",
"dir",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L876-L893 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.apk | def apk(self, args):
"""Create an APK using the given distribution."""
ctx = self.ctx
dist = self._dist
# Manually fixing these arguments at the string stage is
# unsatisfactory and should probably be changed somehow, but
# we can't leave it until later as the build.py ... | python | def apk(self, args):
"""Create an APK using the given distribution."""
ctx = self.ctx
dist = self._dist
# Manually fixing these arguments at the string stage is
# unsatisfactory and should probably be changed somehow, but
# we can't leave it until later as the build.py ... | [
"def",
"apk",
"(",
"self",
",",
"args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"dist",
"=",
"self",
".",
"_dist",
"# Manually fixing these arguments at the string stage is",
"# unsatisfactory and should probably be changed somehow, but",
"# we can't leave it until later as... | Create an APK using the given distribution. | [
"Create",
"an",
"APK",
"using",
"the",
"given",
"distribution",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L902-L1055 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.archs | def archs(self, _args):
"""List the target architectures available to be built for."""
print('{Style.BRIGHT}Available target architectures are:'
'{Style.RESET_ALL}'.format(Style=Out_Style))
for arch in self.ctx.archs:
print(' {}'.format(arch.arch)) | python | def archs(self, _args):
"""List the target architectures available to be built for."""
print('{Style.BRIGHT}Available target architectures are:'
'{Style.RESET_ALL}'.format(Style=Out_Style))
for arch in self.ctx.archs:
print(' {}'.format(arch.arch)) | [
"def",
"archs",
"(",
"self",
",",
"_args",
")",
":",
"print",
"(",
"'{Style.BRIGHT}Available target architectures are:'",
"'{Style.RESET_ALL}'",
".",
"format",
"(",
"Style",
"=",
"Out_Style",
")",
")",
"for",
"arch",
"in",
"self",
".",
"ctx",
".",
"archs",
":"... | List the target architectures available to be built for. | [
"List",
"the",
"target",
"architectures",
"available",
"to",
"be",
"built",
"for",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1064-L1069 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.distributions | def distributions(self, _args):
"""Lists all distributions currently available (i.e. that have already
been built)."""
ctx = self.ctx
dists = Distribution.get_distributions(ctx)
if dists:
print('{Style.BRIGHT}Distributions currently installed are:'
... | python | def distributions(self, _args):
"""Lists all distributions currently available (i.e. that have already
been built)."""
ctx = self.ctx
dists = Distribution.get_distributions(ctx)
if dists:
print('{Style.BRIGHT}Distributions currently installed are:'
... | [
"def",
"distributions",
"(",
"self",
",",
"_args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"dists",
"=",
"Distribution",
".",
"get_distributions",
"(",
"ctx",
")",
"if",
"dists",
":",
"print",
"(",
"'{Style.BRIGHT}Distributions currently installed are:'",
"'{S... | Lists all distributions currently available (i.e. that have already
been built). | [
"Lists",
"all",
"distributions",
"currently",
"available",
"(",
"i",
".",
"e",
".",
"that",
"have",
"already",
"been",
"built",
")",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1075-L1087 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.sdk_tools | def sdk_tools(self, args):
"""Runs the android binary from the detected SDK directory, passing
all arguments straight to it. This binary is used to install
e.g. platform-tools for different API level targets. This is
intended as a convenience function if android is not in your
$P... | python | def sdk_tools(self, args):
"""Runs the android binary from the detected SDK directory, passing
all arguments straight to it. This binary is used to install
e.g. platform-tools for different API level targets. This is
intended as a convenience function if android is not in your
$P... | [
"def",
"sdk_tools",
"(",
"self",
",",
"args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"ctx",
".",
"prepare_build_environment",
"(",
"user_sdk_dir",
"=",
"self",
".",
"sdk_dir",
",",
"user_ndk_dir",
"=",
"self",
".",
"ndk_dir",
",",
"user_android_api",
"=... | Runs the android binary from the detected SDK directory, passing
all arguments straight to it. This binary is used to install
e.g. platform-tools for different API level targets. This is
intended as a convenience function if android is not in your
$PATH. | [
"Runs",
"the",
"android",
"binary",
"from",
"the",
"detected",
"SDK",
"directory",
"passing",
"all",
"arguments",
"straight",
"to",
"it",
".",
"This",
"binary",
"is",
"used",
"to",
"install",
"e",
".",
"g",
".",
"platform",
"-",
"tools",
"for",
"different"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1097-L1114 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL._adb | def _adb(self, commands):
"""Call the adb executable from the SDK, passing the given commands as
arguments."""
ctx = self.ctx
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
user_ndk_dir=self.ndk_dir,
us... | python | def _adb(self, commands):
"""Call the adb executable from the SDK, passing the given commands as
arguments."""
ctx = self.ctx
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
user_ndk_dir=self.ndk_dir,
us... | [
"def",
"_adb",
"(",
"self",
",",
"commands",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"ctx",
".",
"prepare_build_environment",
"(",
"user_sdk_dir",
"=",
"self",
".",
"sdk_dir",
",",
"user_ndk_dir",
"=",
"self",
".",
"ndk_dir",
",",
"user_android_api",
"="... | Call the adb executable from the SDK, passing the given commands as
arguments. | [
"Call",
"the",
"adb",
"executable",
"from",
"the",
"SDK",
"passing",
"the",
"given",
"commands",
"as",
"arguments",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1128-L1144 | train |
kivy/python-for-android | pythonforandroid/toolchain.py | ToolchainCL.build_status | def build_status(self, _args):
"""Print the status of the specified build. """
print('{Style.BRIGHT}Bootstraps whose core components are probably '
'already built:{Style.RESET_ALL}'.format(Style=Out_Style))
bootstrap_dir = join(self.ctx.build_dir, 'bootstrap_builds')
if ex... | python | def build_status(self, _args):
"""Print the status of the specified build. """
print('{Style.BRIGHT}Bootstraps whose core components are probably '
'already built:{Style.RESET_ALL}'.format(Style=Out_Style))
bootstrap_dir = join(self.ctx.build_dir, 'bootstrap_builds')
if ex... | [
"def",
"build_status",
"(",
"self",
",",
"_args",
")",
":",
"print",
"(",
"'{Style.BRIGHT}Bootstraps whose core components are probably '",
"'already built:{Style.RESET_ALL}'",
".",
"format",
"(",
"Style",
"=",
"Out_Style",
")",
")",
"bootstrap_dir",
"=",
"join",
"(",
... | Print the status of the specified build. | [
"Print",
"the",
"status",
"of",
"the",
"specified",
"build",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1146-L1172 | train |
kivy/python-for-android | pythonforandroid/recipes/ifaddrs/__init__.py | IFAddrRecipe.prebuild_arch | def prebuild_arch(self, arch):
"""Make the build and target directories"""
path = self.get_build_dir(arch.arch)
if not exists(path):
info("creating {}".format(path))
shprint(sh.mkdir, '-p', path) | python | def prebuild_arch(self, arch):
"""Make the build and target directories"""
path = self.get_build_dir(arch.arch)
if not exists(path):
info("creating {}".format(path))
shprint(sh.mkdir, '-p', path) | [
"def",
"prebuild_arch",
"(",
"self",
",",
"arch",
")",
":",
"path",
"=",
"self",
".",
"get_build_dir",
"(",
"arch",
".",
"arch",
")",
"if",
"not",
"exists",
"(",
"path",
")",
":",
"info",
"(",
"\"creating {}\"",
".",
"format",
"(",
"path",
")",
")",
... | Make the build and target directories | [
"Make",
"the",
"build",
"and",
"target",
"directories"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/ifaddrs/__init__.py#L19-L24 | train |
kivy/python-for-android | pythonforandroid/recipes/ifaddrs/__init__.py | IFAddrRecipe.build_arch | def build_arch(self, arch):
"""simple shared compile"""
env = self.get_recipe_env(arch, with_flags_in_cc=False)
for path in (
self.get_build_dir(arch.arch),
join(self.ctx.python_recipe.get_build_dir(arch.arch), 'Lib'),
join(self.ctx.python_recipe.g... | python | def build_arch(self, arch):
"""simple shared compile"""
env = self.get_recipe_env(arch, with_flags_in_cc=False)
for path in (
self.get_build_dir(arch.arch),
join(self.ctx.python_recipe.get_build_dir(arch.arch), 'Lib'),
join(self.ctx.python_recipe.g... | [
"def",
"build_arch",
"(",
"self",
",",
"arch",
")",
":",
"env",
"=",
"self",
".",
"get_recipe_env",
"(",
"arch",
",",
"with_flags_in_cc",
"=",
"False",
")",
"for",
"path",
"in",
"(",
"self",
".",
"get_build_dir",
"(",
"arch",
".",
"arch",
")",
",",
"... | simple shared compile | [
"simple",
"shared",
"compile"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/ifaddrs/__init__.py#L26-L51 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py | Context.resolve | def resolve(self, key):
"""Looks up a variable like `__getitem__` or `get` but returns an
:class:`Undefined` object with the name of the name looked up.
"""
if key in self.vars:
return self.vars[key]
if key in self.parent:
return self.parent[key]
r... | python | def resolve(self, key):
"""Looks up a variable like `__getitem__` or `get` but returns an
:class:`Undefined` object with the name of the name looked up.
"""
if key in self.vars:
return self.vars[key]
if key in self.parent:
return self.parent[key]
r... | [
"def",
"resolve",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"vars",
":",
"return",
"self",
".",
"vars",
"[",
"key",
"]",
"if",
"key",
"in",
"self",
".",
"parent",
":",
"return",
"self",
".",
"parent",
"[",
"key",
"]",
"... | Looks up a variable like `__getitem__` or `get` but returns an
:class:`Undefined` object with the name of the name looked up. | [
"Looks",
"up",
"a",
"variable",
"like",
"__getitem__",
"or",
"get",
"but",
"returns",
"an",
":",
"class",
":",
"Undefined",
"object",
"with",
"the",
"name",
"of",
"the",
"name",
"looked",
"up",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py#L148-L156 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py | Context.call | def call(__self, __obj, *args, **kwargs):
"""Call the callable with the arguments and keyword arguments
provided but inject the active context or environment as first
argument if the callable is a :func:`contextfunction` or
:func:`environmentfunction`.
"""
if __debug__:
... | python | def call(__self, __obj, *args, **kwargs):
"""Call the callable with the arguments and keyword arguments
provided but inject the active context or environment as first
argument if the callable is a :func:`contextfunction` or
:func:`environmentfunction`.
"""
if __debug__:
... | [
"def",
"call",
"(",
"__self",
",",
"__obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"__debug__",
":",
"__traceback_hide__",
"=",
"True",
"if",
"isinstance",
"(",
"__obj",
",",
"_context_function_types",
")",
":",
"if",
"getattr",
"(",
... | Call the callable with the arguments and keyword arguments
provided but inject the active context or environment as first
argument if the callable is a :func:`contextfunction` or
:func:`environmentfunction`. | [
"Call",
"the",
"callable",
"with",
"the",
"arguments",
"and",
"keyword",
"arguments",
"provided",
"but",
"inject",
"the",
"active",
"context",
"or",
"environment",
"as",
"first",
"argument",
"if",
"the",
"callable",
"is",
"a",
":",
"func",
":",
"contextfunctio... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py#L169-L184 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py | Undefined._fail_with_undefined_error | def _fail_with_undefined_error(self, *args, **kwargs):
"""Regular callback function for undefined objects that raises an
`UndefinedError` on call.
"""
if self._undefined_hint is None:
if self._undefined_obj is missing:
hint = '%r is undefined' % self._undefine... | python | def _fail_with_undefined_error(self, *args, **kwargs):
"""Regular callback function for undefined objects that raises an
`UndefinedError` on call.
"""
if self._undefined_hint is None:
if self._undefined_obj is missing:
hint = '%r is undefined' % self._undefine... | [
"def",
"_fail_with_undefined_error",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_undefined_hint",
"is",
"None",
":",
"if",
"self",
".",
"_undefined_obj",
"is",
"missing",
":",
"hint",
"=",
"'%r is undefined'",
"%"... | Regular callback function for undefined objects that raises an
`UndefinedError` on call. | [
"Regular",
"callback",
"function",
"for",
"undefined",
"objects",
"that",
"raises",
"an",
"UndefinedError",
"on",
"call",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py#L433-L452 | train |
kivy/python-for-android | pythonforandroid/graph.py | fix_deplist | def fix_deplist(deps):
""" Turn a dependency list into lowercase, and make sure all entries
that are just a string become a tuple of strings
"""
deps = [
((dep.lower(),)
if not isinstance(dep, (list, tuple))
else tuple([dep_entry.lower()
for dep_entry i... | python | def fix_deplist(deps):
""" Turn a dependency list into lowercase, and make sure all entries
that are just a string become a tuple of strings
"""
deps = [
((dep.lower(),)
if not isinstance(dep, (list, tuple))
else tuple([dep_entry.lower()
for dep_entry i... | [
"def",
"fix_deplist",
"(",
"deps",
")",
":",
"deps",
"=",
"[",
"(",
"(",
"dep",
".",
"lower",
"(",
")",
",",
")",
"if",
"not",
"isinstance",
"(",
"dep",
",",
"(",
"list",
",",
"tuple",
")",
")",
"else",
"tuple",
"(",
"[",
"dep_entry",
".",
"low... | Turn a dependency list into lowercase, and make sure all entries
that are just a string become a tuple of strings | [
"Turn",
"a",
"dependency",
"list",
"into",
"lowercase",
"and",
"make",
"sure",
"all",
"entries",
"that",
"are",
"just",
"a",
"string",
"become",
"a",
"tuple",
"of",
"strings"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L10-L22 | train |
kivy/python-for-android | pythonforandroid/graph.py | get_dependency_tuple_list_for_recipe | def get_dependency_tuple_list_for_recipe(recipe, blacklist=None):
""" Get the dependencies of a recipe with filtered out blacklist, and
turned into tuples with fix_deplist()
"""
if blacklist is None:
blacklist = set()
assert(type(blacklist) == set)
if recipe.depends is None:
... | python | def get_dependency_tuple_list_for_recipe(recipe, blacklist=None):
""" Get the dependencies of a recipe with filtered out blacklist, and
turned into tuples with fix_deplist()
"""
if blacklist is None:
blacklist = set()
assert(type(blacklist) == set)
if recipe.depends is None:
... | [
"def",
"get_dependency_tuple_list_for_recipe",
"(",
"recipe",
",",
"blacklist",
"=",
"None",
")",
":",
"if",
"blacklist",
"is",
"None",
":",
"blacklist",
"=",
"set",
"(",
")",
"assert",
"(",
"type",
"(",
"blacklist",
")",
"==",
"set",
")",
"if",
"recipe",
... | Get the dependencies of a recipe with filtered out blacklist, and
turned into tuples with fix_deplist() | [
"Get",
"the",
"dependencies",
"of",
"a",
"recipe",
"with",
"filtered",
"out",
"blacklist",
"and",
"turned",
"into",
"tuples",
"with",
"fix_deplist",
"()"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L42-L61 | train |
kivy/python-for-android | pythonforandroid/graph.py | recursively_collect_orders | def recursively_collect_orders(
name, ctx, all_inputs, orders=None, blacklist=None
):
'''For each possible recipe ordering, try to add the new recipe name
to that order. Recursively do the same thing with all the
dependencies of each recipe.
'''
name = name.lower()
if orders is ... | python | def recursively_collect_orders(
name, ctx, all_inputs, orders=None, blacklist=None
):
'''For each possible recipe ordering, try to add the new recipe name
to that order. Recursively do the same thing with all the
dependencies of each recipe.
'''
name = name.lower()
if orders is ... | [
"def",
"recursively_collect_orders",
"(",
"name",
",",
"ctx",
",",
"all_inputs",
",",
"orders",
"=",
"None",
",",
"blacklist",
"=",
"None",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"if",
"orders",
"is",
"None",
":",
"orders",
"=",
"[",
... | For each possible recipe ordering, try to add the new recipe name
to that order. Recursively do the same thing with all the
dependencies of each recipe. | [
"For",
"each",
"possible",
"recipe",
"ordering",
"try",
"to",
"add",
"the",
"new",
"recipe",
"name",
"to",
"that",
"order",
".",
"Recursively",
"do",
"the",
"same",
"thing",
"with",
"all",
"the",
"dependencies",
"of",
"each",
"recipe",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L64-L124 | train |
kivy/python-for-android | pythonforandroid/graph.py | find_order | def find_order(graph):
'''
Do a topological sort on the dependency graph dict.
'''
while graph:
# Find all items without a parent
leftmost = [l for l, s in graph.items() if not s]
if not leftmost:
raise ValueError('Dependency cycle detected! %s' % graph)
# If ... | python | def find_order(graph):
'''
Do a topological sort on the dependency graph dict.
'''
while graph:
# Find all items without a parent
leftmost = [l for l, s in graph.items() if not s]
if not leftmost:
raise ValueError('Dependency cycle detected! %s' % graph)
# If ... | [
"def",
"find_order",
"(",
"graph",
")",
":",
"while",
"graph",
":",
"# Find all items without a parent",
"leftmost",
"=",
"[",
"l",
"for",
"l",
",",
"s",
"in",
"graph",
".",
"items",
"(",
")",
"if",
"not",
"s",
"]",
"if",
"not",
"leftmost",
":",
"raise... | Do a topological sort on the dependency graph dict. | [
"Do",
"a",
"topological",
"sort",
"on",
"the",
"dependency",
"graph",
"dict",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L127-L143 | train |
kivy/python-for-android | pythonforandroid/graph.py | obvious_conflict_checker | def obvious_conflict_checker(ctx, name_tuples, blacklist=None):
""" This is a pre-flight check function that will completely ignore
recipe order or choosing an actual value in any of the multiple
choice tuples/dependencies, and just do a very basic obvious
conflict check.
"""
deps_we... | python | def obvious_conflict_checker(ctx, name_tuples, blacklist=None):
""" This is a pre-flight check function that will completely ignore
recipe order or choosing an actual value in any of the multiple
choice tuples/dependencies, and just do a very basic obvious
conflict check.
"""
deps_we... | [
"def",
"obvious_conflict_checker",
"(",
"ctx",
",",
"name_tuples",
",",
"blacklist",
"=",
"None",
")",
":",
"deps_were_added_by",
"=",
"dict",
"(",
")",
"deps",
"=",
"set",
"(",
")",
"if",
"blacklist",
"is",
"None",
":",
"blacklist",
"=",
"set",
"(",
")"... | This is a pre-flight check function that will completely ignore
recipe order or choosing an actual value in any of the multiple
choice tuples/dependencies, and just do a very basic obvious
conflict check. | [
"This",
"is",
"a",
"pre",
"-",
"flight",
"check",
"function",
"that",
"will",
"completely",
"ignore",
"recipe",
"order",
"or",
"choosing",
"an",
"actual",
"value",
"in",
"any",
"of",
"the",
"multiple",
"choice",
"tuples",
"/",
"dependencies",
"and",
"just",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L146-L240 | train |
kivy/python-for-android | pythonforandroid/recipes/openssl/__init__.py | OpenSSLRecipe.include_flags | def include_flags(self, arch):
'''Returns a string with the include folders'''
openssl_includes = join(self.get_build_dir(arch.arch), 'include')
return (' -I' + openssl_includes +
' -I' + join(openssl_includes, 'internal') +
' -I' + join(openssl_includes, 'openssl... | python | def include_flags(self, arch):
'''Returns a string with the include folders'''
openssl_includes = join(self.get_build_dir(arch.arch), 'include')
return (' -I' + openssl_includes +
' -I' + join(openssl_includes, 'internal') +
' -I' + join(openssl_includes, 'openssl... | [
"def",
"include_flags",
"(",
"self",
",",
"arch",
")",
":",
"openssl_includes",
"=",
"join",
"(",
"self",
".",
"get_build_dir",
"(",
"arch",
".",
"arch",
")",
",",
"'include'",
")",
"return",
"(",
"' -I'",
"+",
"openssl_includes",
"+",
"' -I'",
"+",
"joi... | Returns a string with the include folders | [
"Returns",
"a",
"string",
"with",
"the",
"include",
"folders"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/openssl/__init__.py#L88-L93 | train |
kivy/python-for-android | pythonforandroid/python.py | GuestPythonRecipe.set_libs_flags | def set_libs_flags(self, env, arch):
'''Takes care to properly link libraries with python depending on our
requirements and the attribute :attr:`opt_depends`.
'''
def add_flags(include_flags, link_dirs, link_libs):
env['CPPFLAGS'] = env.get('CPPFLAGS', '') + include_flags
... | python | def set_libs_flags(self, env, arch):
'''Takes care to properly link libraries with python depending on our
requirements and the attribute :attr:`opt_depends`.
'''
def add_flags(include_flags, link_dirs, link_libs):
env['CPPFLAGS'] = env.get('CPPFLAGS', '') + include_flags
... | [
"def",
"set_libs_flags",
"(",
"self",
",",
"env",
",",
"arch",
")",
":",
"def",
"add_flags",
"(",
"include_flags",
",",
"link_dirs",
",",
"link_libs",
")",
":",
"env",
"[",
"'CPPFLAGS'",
"]",
"=",
"env",
".",
"get",
"(",
"'CPPFLAGS'",
",",
"''",
")",
... | Takes care to properly link libraries with python depending on our
requirements and the attribute :attr:`opt_depends`. | [
"Takes",
"care",
"to",
"properly",
"link",
"libraries",
"with",
"python",
"depending",
"on",
"our",
"requirements",
"and",
"the",
"attribute",
":",
"attr",
":",
"opt_depends",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/python.py#L183-L214 | train |
kivy/python-for-android | pythonforandroid/python.py | GuestPythonRecipe.compile_python_files | def compile_python_files(self, dir):
'''
Compile the python files (recursively) for the python files inside
a given folder.
.. note:: python2 compiles the files into extension .pyo, but in
python3, and as of Python 3.5, the .pyo filename extension is no
longer us... | python | def compile_python_files(self, dir):
'''
Compile the python files (recursively) for the python files inside
a given folder.
.. note:: python2 compiles the files into extension .pyo, but in
python3, and as of Python 3.5, the .pyo filename extension is no
longer us... | [
"def",
"compile_python_files",
"(",
"self",
",",
"dir",
")",
":",
"args",
"=",
"[",
"self",
".",
"ctx",
".",
"hostpython",
"]",
"if",
"self",
".",
"ctx",
".",
"python_recipe",
".",
"name",
"==",
"'python3'",
":",
"args",
"+=",
"[",
"'-OO'",
",",
"'-m... | Compile the python files (recursively) for the python files inside
a given folder.
.. note:: python2 compiles the files into extension .pyo, but in
python3, and as of Python 3.5, the .pyo filename extension is no
longer used...uses .pyc (https://www.python.org/dev/peps/pep-0488) | [
"Compile",
"the",
"python",
"files",
"(",
"recursively",
")",
"for",
"the",
"python",
"files",
"inside",
"a",
"given",
"folder",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/python.py#L276-L290 | train |
kivy/python-for-android | pythonforandroid/python.py | GuestPythonRecipe.create_python_bundle | def create_python_bundle(self, dirn, arch):
"""
Create a packaged python bundle in the target directory, by
copying all the modules and standard library to the right
place.
"""
# Todo: find a better way to find the build libs folder
modules_build_dir = join(
... | python | def create_python_bundle(self, dirn, arch):
"""
Create a packaged python bundle in the target directory, by
copying all the modules and standard library to the right
place.
"""
# Todo: find a better way to find the build libs folder
modules_build_dir = join(
... | [
"def",
"create_python_bundle",
"(",
"self",
",",
"dirn",
",",
"arch",
")",
":",
"# Todo: find a better way to find the build libs folder",
"modules_build_dir",
"=",
"join",
"(",
"self",
".",
"get_build_dir",
"(",
"arch",
".",
"arch",
")",
",",
"'android-build'",
","... | Create a packaged python bundle in the target directory, by
copying all the modules and standard library to the right
place. | [
"Create",
"a",
"packaged",
"python",
"bundle",
"in",
"the",
"target",
"directory",
"by",
"copying",
"all",
"the",
"modules",
"and",
"standard",
"library",
"to",
"the",
"right",
"place",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/python.py#L292-L361 | train |
kivy/python-for-android | pythonforandroid/recipes/scrypt/__init__.py | ScryptRecipe.get_recipe_env | def get_recipe_env(self, arch, with_flags_in_cc=True):
"""
Adds openssl recipe to include and library path.
"""
env = super(ScryptRecipe, self).get_recipe_env(arch, with_flags_in_cc)
openssl_recipe = self.get_recipe('openssl', self.ctx)
env['CFLAGS'] += openssl_recipe.inc... | python | def get_recipe_env(self, arch, with_flags_in_cc=True):
"""
Adds openssl recipe to include and library path.
"""
env = super(ScryptRecipe, self).get_recipe_env(arch, with_flags_in_cc)
openssl_recipe = self.get_recipe('openssl', self.ctx)
env['CFLAGS'] += openssl_recipe.inc... | [
"def",
"get_recipe_env",
"(",
"self",
",",
"arch",
",",
"with_flags_in_cc",
"=",
"True",
")",
":",
"env",
"=",
"super",
"(",
"ScryptRecipe",
",",
"self",
")",
".",
"get_recipe_env",
"(",
"arch",
",",
"with_flags_in_cc",
")",
"openssl_recipe",
"=",
"self",
... | Adds openssl recipe to include and library path. | [
"Adds",
"openssl",
"recipe",
"to",
"include",
"and",
"library",
"path",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/scrypt/__init__.py#L12-L23 | train |
kivy/python-for-android | pythonforandroid/util.py | walk_valid_filens | def walk_valid_filens(base_dir, invalid_dir_names, invalid_file_patterns):
"""Recursively walks all the files and directories in ``dirn``,
ignoring directories that match any pattern in ``invalid_dirns``
and files that patch any pattern in ``invalid_filens``.
``invalid_dirns`` and ``invalid_filens`` sh... | python | def walk_valid_filens(base_dir, invalid_dir_names, invalid_file_patterns):
"""Recursively walks all the files and directories in ``dirn``,
ignoring directories that match any pattern in ``invalid_dirns``
and files that patch any pattern in ``invalid_filens``.
``invalid_dirns`` and ``invalid_filens`` sh... | [
"def",
"walk_valid_filens",
"(",
"base_dir",
",",
"invalid_dir_names",
",",
"invalid_file_patterns",
")",
":",
"for",
"dirn",
",",
"subdirs",
",",
"filens",
"in",
"walk",
"(",
"base_dir",
")",
":",
"# Remove invalid subdirs so that they will not be walked",
"for",
"i"... | Recursively walks all the files and directories in ``dirn``,
ignoring directories that match any pattern in ``invalid_dirns``
and files that patch any pattern in ``invalid_filens``.
``invalid_dirns`` and ``invalid_filens`` should both be lists of
strings to match. ``invalid_dir_patterns`` expects a lis... | [
"Recursively",
"walks",
"all",
"the",
"files",
"and",
"directories",
"in",
"dirn",
"ignoring",
"directories",
"that",
"match",
"any",
"pattern",
"in",
"invalid_dirns",
"and",
"files",
"that",
"patch",
"any",
"pattern",
"in",
"invalid_filens",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/util.py#L149-L176 | train |
kivy/python-for-android | pythonforandroid/util.py | handle_build_exception | def handle_build_exception(exception):
"""
Handles a raised BuildInterruptingException by printing its error
message and associated instructions, if any, then exiting.
"""
error('Build failed: {}'.format(exception.message))
if exception.instructions is not None:
info('Instructions: {}'.f... | python | def handle_build_exception(exception):
"""
Handles a raised BuildInterruptingException by printing its error
message and associated instructions, if any, then exiting.
"""
error('Build failed: {}'.format(exception.message))
if exception.instructions is not None:
info('Instructions: {}'.f... | [
"def",
"handle_build_exception",
"(",
"exception",
")",
":",
"error",
"(",
"'Build failed: {}'",
".",
"format",
"(",
"exception",
".",
"message",
")",
")",
"if",
"exception",
".",
"instructions",
"is",
"not",
"None",
":",
"info",
"(",
"'Instructions: {}'",
"."... | Handles a raised BuildInterruptingException by printing its error
message and associated instructions, if any, then exiting. | [
"Handles",
"a",
"raised",
"BuildInterruptingException",
"by",
"printing",
"its",
"error",
"message",
"and",
"associated",
"instructions",
"if",
"any",
"then",
"exiting",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/util.py#L186-L194 | train |
kivy/python-for-android | pythonforandroid/bootstraps/common/build/build.py | render | def render(template, dest, **kwargs):
'''Using jinja2, render `template` to the filename `dest`, supplying the
keyword arguments as template parameters.
'''
dest_dir = dirname(dest)
if dest_dir and not exists(dest_dir):
makedirs(dest_dir)
template = environment.get_template(template)
... | python | def render(template, dest, **kwargs):
'''Using jinja2, render `template` to the filename `dest`, supplying the
keyword arguments as template parameters.
'''
dest_dir = dirname(dest)
if dest_dir and not exists(dest_dir):
makedirs(dest_dir)
template = environment.get_template(template)
... | [
"def",
"render",
"(",
"template",
",",
"dest",
",",
"*",
"*",
"kwargs",
")",
":",
"dest_dir",
"=",
"dirname",
"(",
"dest",
")",
"if",
"dest_dir",
"and",
"not",
"exists",
"(",
"dest_dir",
")",
":",
"makedirs",
"(",
"dest_dir",
")",
"template",
"=",
"e... | Using jinja2, render `template` to the filename `dest`, supplying the
keyword arguments as template parameters. | [
"Using",
"jinja2",
"render",
"template",
"to",
"the",
"filename",
"dest",
"supplying",
"the"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/common/build/build.py#L107-L122 | train |
kivy/python-for-android | pythonforandroid/bootstraps/common/build/build.py | make_python_zip | def make_python_zip():
'''
Search for all the python related files, and construct the pythonXX.zip
According to
# http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
site-packages, config and lib-dynload will be not included.
'''
if not exists('private'):
print... | python | def make_python_zip():
'''
Search for all the python related files, and construct the pythonXX.zip
According to
# http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
site-packages, config and lib-dynload will be not included.
'''
if not exists('private'):
print... | [
"def",
"make_python_zip",
"(",
")",
":",
"if",
"not",
"exists",
"(",
"'private'",
")",
":",
"print",
"(",
"'No compiled python is present to zip, skipping.'",
")",
"return",
"global",
"python_files",
"d",
"=",
"realpath",
"(",
"join",
"(",
"'private'",
",",
"'li... | Search for all the python related files, and construct the pythonXX.zip
According to
# http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
site-packages, config and lib-dynload will be not included. | [
"Search",
"for",
"all",
"the",
"python",
"related",
"files",
"and",
"construct",
"the",
"pythonXX",
".",
"zip",
"According",
"to",
"#",
"http",
":",
"//",
"randomsplat",
".",
"com",
"/",
"id5",
"-",
"cross",
"-",
"compiling",
"-",
"python",
"-",
"for",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/common/build/build.py#L159-L198 | train |
kivy/python-for-android | pythonforandroid/bootstraps/common/build/build.py | make_tar | def make_tar(tfn, source_dirs, ignore_path=[], optimize_python=True):
'''
Make a zip file `fn` from the contents of source_dis.
'''
# selector function
def select(fn):
rfn = realpath(fn)
for p in ignore_path:
if p.endswith('/'):
p = p[:-1]
if ... | python | def make_tar(tfn, source_dirs, ignore_path=[], optimize_python=True):
'''
Make a zip file `fn` from the contents of source_dis.
'''
# selector function
def select(fn):
rfn = realpath(fn)
for p in ignore_path:
if p.endswith('/'):
p = p[:-1]
if ... | [
"def",
"make_tar",
"(",
"tfn",
",",
"source_dirs",
",",
"ignore_path",
"=",
"[",
"]",
",",
"optimize_python",
"=",
"True",
")",
":",
"# selector function",
"def",
"select",
"(",
"fn",
")",
":",
"rfn",
"=",
"realpath",
"(",
"fn",
")",
"for",
"p",
"in",
... | Make a zip file `fn` from the contents of source_dis. | [
"Make",
"a",
"zip",
"file",
"fn",
"from",
"the",
"contents",
"of",
"source_dis",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/common/build/build.py#L201-L247 | train |
kivy/python-for-android | pythonforandroid/bootstraps/common/build/build.py | compile_dir | def compile_dir(dfn, optimize_python=True):
'''
Compile *.py in directory `dfn` to *.pyo
'''
if PYTHON is None:
return
if int(PYTHON_VERSION[0]) >= 3:
args = [PYTHON, '-m', 'compileall', '-b', '-f', dfn]
else:
args = [PYTHON, '-m', 'compileall', '-f', dfn]
if optimi... | python | def compile_dir(dfn, optimize_python=True):
'''
Compile *.py in directory `dfn` to *.pyo
'''
if PYTHON is None:
return
if int(PYTHON_VERSION[0]) >= 3:
args = [PYTHON, '-m', 'compileall', '-b', '-f', dfn]
else:
args = [PYTHON, '-m', 'compileall', '-f', dfn]
if optimi... | [
"def",
"compile_dir",
"(",
"dfn",
",",
"optimize_python",
"=",
"True",
")",
":",
"if",
"PYTHON",
"is",
"None",
":",
"return",
"if",
"int",
"(",
"PYTHON_VERSION",
"[",
"0",
"]",
")",
">=",
"3",
":",
"args",
"=",
"[",
"PYTHON",
",",
"'-m'",
",",
"'co... | Compile *.py in directory `dfn` to *.pyo | [
"Compile",
"*",
".",
"py",
"in",
"directory",
"dfn",
"to",
"*",
".",
"pyo"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/common/build/build.py#L250-L271 | train |
kivy/python-for-android | pythonforandroid/recipes/hostpython3crystax/__init__.py | Hostpython3CrystaXRecipe.build_arch | def build_arch(self, arch):
"""
Creates expected build and symlinks system Python version.
"""
self.ctx.hostpython = '/usr/bin/false'
# creates the sub buildir (used by other recipes)
# https://github.com/kivy/python-for-android/issues/1154
sub_build_dir = join(se... | python | def build_arch(self, arch):
"""
Creates expected build and symlinks system Python version.
"""
self.ctx.hostpython = '/usr/bin/false'
# creates the sub buildir (used by other recipes)
# https://github.com/kivy/python-for-android/issues/1154
sub_build_dir = join(se... | [
"def",
"build_arch",
"(",
"self",
",",
"arch",
")",
":",
"self",
".",
"ctx",
".",
"hostpython",
"=",
"'/usr/bin/false'",
"# creates the sub buildir (used by other recipes)",
"# https://github.com/kivy/python-for-android/issues/1154",
"sub_build_dir",
"=",
"join",
"(",
"self... | Creates expected build and symlinks system Python version. | [
"Creates",
"expected",
"build",
"and",
"symlinks",
"system",
"Python",
"version",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/hostpython3crystax/__init__.py#L25-L41 | train |
kivy/python-for-android | pythonforandroid/bootstraps/pygame/build/build.py | render | def render(template, dest, **kwargs):
'''Using jinja2, render `template` to the filename `dest`, supplying the
keyword arguments as template parameters.
'''
template = environment.get_template(template)
text = template.render(**kwargs)
f = open(dest, 'wb')
f.write(text.encode('utf-8'))
... | python | def render(template, dest, **kwargs):
'''Using jinja2, render `template` to the filename `dest`, supplying the
keyword arguments as template parameters.
'''
template = environment.get_template(template)
text = template.render(**kwargs)
f = open(dest, 'wb')
f.write(text.encode('utf-8'))
... | [
"def",
"render",
"(",
"template",
",",
"dest",
",",
"*",
"*",
"kwargs",
")",
":",
"template",
"=",
"environment",
".",
"get_template",
"(",
"template",
")",
"text",
"=",
"template",
".",
"render",
"(",
"*",
"*",
"kwargs",
")",
"f",
"=",
"open",
"(",
... | Using jinja2, render `template` to the filename `dest`, supplying the
keyword arguments as template parameters. | [
"Using",
"jinja2",
"render",
"template",
"to",
"the",
"filename",
"dest",
"supplying",
"the"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/build.py#L62-L73 | train |
kivy/python-for-android | pythonforandroid/recipe.py | md5sum | def md5sum(filen):
'''Calculate the md5sum of a file.
'''
with open(filen, 'rb') as fileh:
md5 = hashlib.md5(fileh.read())
return md5.hexdigest() | python | def md5sum(filen):
'''Calculate the md5sum of a file.
'''
with open(filen, 'rb') as fileh:
md5 = hashlib.md5(fileh.read())
return md5.hexdigest() | [
"def",
"md5sum",
"(",
"filen",
")",
":",
"with",
"open",
"(",
"filen",
",",
"'rb'",
")",
"as",
"fileh",
":",
"md5",
"=",
"hashlib",
".",
"md5",
"(",
"fileh",
".",
"read",
"(",
")",
")",
"return",
"md5",
".",
"hexdigest",
"(",
")"
] | Calculate the md5sum of a file. | [
"Calculate",
"the",
"md5sum",
"of",
"a",
"file",
"."
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L1167-L1173 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.