partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | run_clients | Force create driver for client | sample/flask/webapi.py | 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():
"""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)
... | [
"Force",
"create",
"driver",
"for",
"client"
] | mukulhase/WebWhatsapp-Wrapper | python | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L625-L639 | [
"def",
"run_clients",
"(",
")",
":",
"clients",
"=",
"request",
".",
"form",
".",
"get",
"(",
"'clients'",
")",
"if",
"not",
"clients",
":",
"return",
"jsonify",
"(",
"{",
"'Error'",
":",
"'no clients provided'",
"}",
")",
"result",
"=",
"{",
"}",
"for... | 81b918ee4e0cd0cb563807a72baa167f670d70cb |
train | kill_clients | Force kill driver and other objects for a perticular clien | sample/flask/webapi.py | 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():
"""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... | [
"Force",
"kill",
"driver",
"and",
"other",
"objects",
"for",
"a",
"perticular",
"clien"
] | mukulhase/WebWhatsapp-Wrapper | python | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L643-L663 | [
"def",
"kill_clients",
"(",
")",
":",
"clients",
"=",
"request",
".",
"form",
".",
"get",
"(",
"'clients'",
")",
".",
"split",
"(",
"','",
")",
"kill_dead",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'kill_dead'",
",",
"default",
"=",
"False",
")... | 81b918ee4e0cd0cb563807a72baa167f670d70cb |
train | driver_needed | 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 | webwhatsapi/objects/whatsapp_object.py | 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):
"""
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... | [
"Decorator",
"for",
"WhatsappObjectWithId",
"methods",
"that",
"need",
"to",
"communicate",
"with",
"the",
"browser"
] | mukulhase/WebWhatsapp-Wrapper | python | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/whatsapp_object.py#L4-L20 | [
"def",
"driver_needed",
"(",
"func",
")",
":",
"def",
"wrapped",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"self",
".",
"driver",
":",
"raise",
"AttributeError",
"(",
"\"No driver passed to object\"",
")",
"return",
"func",
"(",
"self",
",",
... | 81b918ee4e0cd0cb563807a72baa167f670d70cb |
train | Bootstrap.dist_dir | The dist dir at which to place the finished distribution. | pythonforandroid/bootstrap.py | 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):
'''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 | [
"The",
"dist",
"dir",
"at",
"which",
"to",
"place",
"the",
"finished",
"distribution",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L70-L76 | [
"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... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap.check_recipe_choices | Checks what recipes are being built to see which of the alternative
and optional dependencies are being used,
and returns a list of these. | pythonforandroid/bootstrap.py | 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):
'''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:
... | [
"Checks",
"what",
"recipes",
"are",
"being",
"built",
"to",
"see",
"which",
"of",
"the",
"alternative",
"and",
"optional",
"dependencies",
"are",
"being",
"used",
"and",
"returns",
"a",
"list",
"of",
"these",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L82-L94 | [
"def",
"check_recipe_choices",
"(",
"self",
")",
":",
"recipes",
"=",
"[",
"]",
"built_recipes",
"=",
"self",
".",
"ctx",
".",
"recipe_build_order",
"for",
"recipe",
"in",
"self",
".",
"recipe_depends",
":",
"if",
"isinstance",
"(",
"recipe",
",",
"(",
"tu... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap.prepare_build_dir | Ensure that a build dir exists for the recipe. This same single
dir will be used for building all different archs. | pythonforandroid/bootstrap.py | 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):
'''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... | [
"Ensure",
"that",
"a",
"build",
"dir",
"exists",
"for",
"the",
"recipe",
".",
"This",
"same",
"single",
"dir",
"will",
"be",
"used",
"for",
"building",
"all",
"different",
"archs",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L115-L132 | [
"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",... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap.list_bootstraps | Find all the available bootstraps and return them. | pythonforandroid/bootstrap.py | 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):
'''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
... | [
"Find",
"all",
"the",
"available",
"bootstraps",
"and",
"return",
"them",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L141-L150 | [
"def",
"list_bootstraps",
"(",
"cls",
")",
":",
"forbidden_dirs",
"=",
"(",
"'__pycache__'",
",",
"'common'",
")",
"bootstraps_dir",
"=",
"join",
"(",
"dirname",
"(",
"__file__",
")",
",",
"'bootstraps'",
")",
"for",
"name",
"in",
"listdir",
"(",
"bootstraps... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap.get_bootstrap_from_recipes | Returns a bootstrap whose recipe requirements do not conflict with
the given recipes. | pythonforandroid/bootstrap.py | 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):
'''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... | [
"Returns",
"a",
"bootstrap",
"whose",
"recipe",
"requirements",
"do",
"not",
"conflict",
"with",
"the",
"given",
"recipes",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L153-L191 | [
"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... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap.get_bootstrap | 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. | pythonforandroid/bootstrap.py | 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):
'''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... | [
"Returns",
"an",
"instance",
"of",
"a",
"bootstrap",
"with",
"the",
"given",
"name",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L194-L213 | [
"def",
"get_bootstrap",
"(",
"cls",
",",
"name",
",",
"ctx",
")",
":",
"if",
"name",
"is",
"None",
":",
"return",
"None",
"if",
"not",
"hasattr",
"(",
"cls",
",",
"'bootstraps'",
")",
":",
"cls",
".",
"bootstraps",
"=",
"{",
"}",
"if",
"name",
"in"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap.distribute_libs | Copy existing arch libs from build dirs to current dist dir. | pythonforandroid/bootstrap.py | 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"):
'''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... | [
"Copy",
"existing",
"arch",
"libs",
"from",
"build",
"dirs",
"to",
"current",
"dist",
"dir",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L215-L222 | [
"def",
"distribute_libs",
"(",
"self",
",",
"arch",
",",
"src_dirs",
",",
"wildcard",
"=",
"'*'",
",",
"dest_dir",
"=",
"\"libs\"",
")",
":",
"info",
"(",
"'Copying libs'",
")",
"tgt_dir",
"=",
"join",
"(",
"dest_dir",
",",
"arch",
".",
"arch",
")",
"e... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap.distribute_javaclasses | Copy existing javaclasses from build dir to current dist dir. | pythonforandroid/bootstrap.py | 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"):
'''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) | [
"Copy",
"existing",
"javaclasses",
"from",
"build",
"dir",
"to",
"current",
"dist",
"dir",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L224-L229 | [
"def",
"distribute_javaclasses",
"(",
"self",
",",
"javaclass_dir",
",",
"dest_dir",
"=",
"\"src\"",
")",
":",
"info",
"(",
"'Copying java files'",
")",
"ensure_dir",
"(",
"dest_dir",
")",
"for",
"filename",
"in",
"glob",
".",
"glob",
"(",
"javaclass_dir",
")"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap.distribute_aars | Process existing .aar bundles and copy to current dist dir. | pythonforandroid/bootstrap.py | 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):
'''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) | [
"Process",
"existing",
".",
"aar",
"bundles",
"and",
"copy",
"to",
"current",
"dist",
"dir",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L231-L235 | [
"def",
"distribute_aars",
"(",
"self",
",",
"arch",
")",
":",
"info",
"(",
"'Unpacking aars'",
")",
"for",
"aar",
"in",
"glob",
".",
"glob",
"(",
"join",
"(",
"self",
".",
"ctx",
".",
"aars_dir",
",",
"'*.aar'",
")",
")",
":",
"self",
".",
"_unpack_a... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Bootstrap._unpack_aar | Unpack content of .aar bundle and copy to current dist dir. | pythonforandroid/bootstrap.py | 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):
'''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... | [
"Unpack",
"content",
"of",
".",
"aar",
"bundle",
"and",
"copy",
"to",
"current",
"dist",
"dir",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L237-L263 | [
"def",
"_unpack_aar",
"(",
"self",
",",
"aar",
",",
"arch",
")",
":",
"with",
"temp_directory",
"(",
")",
"as",
"temp_dir",
":",
"name",
"=",
"splitext",
"(",
"basename",
"(",
"aar",
")",
")",
"[",
"0",
"]",
"jar_name",
"=",
"name",
"+",
"'.jar'",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | modified_recipes | Returns a set of modified recipes between the current branch and the one
in param. | ci/rebuild_updated_recipes.py | 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'):
"""
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... | [
"Returns",
"a",
"set",
"of",
"modified",
"recipes",
"between",
"the",
"current",
"branch",
"and",
"the",
"one",
"in",
"param",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/ci/rebuild_updated_recipes.py#L34-L48 | [
"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... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | build | Builds an APK given a target Python and a set of requirements. | ci/rebuild_updated_recipes.py | 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):
"""
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... | [
"Builds",
"an",
"APK",
"given",
"a",
"target",
"Python",
"and",
"a",
"set",
"of",
"requirements",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/ci/rebuild_updated_recipes.py#L51-L71 | [
"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",
"=",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | GeventRecipe.get_recipe_env | - 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) | pythonforandroid/recipes/gevent/__init__.py | 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):
"""
- 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... | [
"-",
"Moves",
"all",
"-",
"I<inc",
">",
"-",
"D<macro",
">",
"from",
"CFLAGS",
"to",
"CPPFLAGS",
"environment",
".",
"-",
"Moves",
"all",
"-",
"l<lib",
">",
"from",
"LDFLAGS",
"to",
"LIBS",
"environment",
".",
"-",
"Fixes",
"linker",
"name",
"(",
"use"... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/gevent/__init__.py#L12-L29 | [
"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... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | extract_from_ast | 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... | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py | 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):
"""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`.... | [
"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",
... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py#L381-L446 | [
"def",
"extract_from_ast",
"(",
"node",
",",
"gettext_functions",
"=",
"GETTEXT_FUNCTIONS",
",",
"babel_style",
"=",
"True",
")",
":",
"for",
"node",
"in",
"node",
".",
"find_all",
"(",
"nodes",
".",
"Call",
")",
":",
"if",
"not",
"isinstance",
"(",
"node"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | babel_extract | 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... | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py | 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):
"""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... | [
"Babel",
"extraction",
"method",
"for",
"Jinja",
"templates",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py#L486-L545 | [
"def",
"babel_extract",
"(",
"fileobj",
",",
"keywords",
",",
"comment_tags",
",",
"options",
")",
":",
"extensions",
"=",
"set",
"(",
")",
"for",
"extension",
"in",
"options",
".",
"get",
"(",
"'extensions'",
",",
"''",
")",
".",
"split",
"(",
"','",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | InternationalizationExtension.parse | Parse a translatable tag. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py | 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):
"""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
... | [
"Parse",
"a",
"translatable",
"tag",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py#L175-L262 | [
"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 ... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | InternationalizationExtension._make_node | Generates a useful node from the data provided. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py | 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):
"""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)],
... | [
"Generates",
"a",
"useful",
"node",
"from",
"the",
"data",
"provided",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/ext.py#L296-L320 | [
"def",
"_make_node",
"(",
"self",
",",
"singular",
",",
"plural",
",",
"variables",
",",
"plural_expr",
")",
":",
"# singular only:",
"if",
"plural_expr",
"is",
"None",
":",
"gettext",
"=",
"nodes",
".",
"Name",
"(",
"'gettext'",
",",
"'load'",
")",
"node"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | load_extensions | Load the extensions from the list and bind it to the environment.
Returns a dict of instanciated environments. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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)
... | [
"Load",
"the",
"extensions",
"from",
"the",
"list",
"and",
"bind",
"it",
"to",
"the",
"environment",
".",
"Returns",
"a",
"dict",
"of",
"instanciated",
"environments",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L68-L77 | [
"def",
"load_extensions",
"(",
"environment",
",",
"extensions",
")",
":",
"result",
"=",
"{",
"}",
"for",
"extension",
"in",
"extensions",
":",
"if",
"isinstance",
"(",
"extension",
",",
"basestring",
")",
":",
"extension",
"=",
"import_string",
"(",
"exten... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Environment.extend | 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. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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... | [
"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... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L282-L289 | [
"def",
"extend",
"(",
"self",
",",
"*",
"*",
"attributes",
")",
":",
"for",
"key",
",",
"value",
"in",
"attributes",
".",
"iteritems",
"(",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"key",
")",
":",
"setattr",
"(",
"self",
",",
"key",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Environment._parse | Internal parsing function used by `parse` and `compile`. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""Internal parsing function used by `parse` and `compile`."""
return Parser(self, source, name, _encode_filename(filename)).parse() | [
"Internal",
"parsing",
"function",
"used",
"by",
"parse",
"and",
"compile",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L388-L390 | [
"def",
"_parse",
"(",
"self",
",",
"source",
",",
"name",
",",
"filename",
")",
":",
"return",
"Parser",
"(",
"self",
",",
"source",
",",
"name",
",",
"_encode_filename",
"(",
"filename",
")",
")",
".",
"parse",
"(",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Environment.preprocess | 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. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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... | [
"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",
... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L409-L415 | [
"def",
"preprocess",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"return",
"reduce",
"(",
"lambda",
"s",
",",
"e",
":",
"e",
".",
"preprocess",
"(",
"s",
",",
"name",
",",
"filename",
")",
",",
"s... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Environment.compile | 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... | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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.
... | [
"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... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L430-L469 | [
"def",
"compile",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"raw",
"=",
"False",
",",
"defer_init",
"=",
"False",
")",
":",
"source_hint",
"=",
"None",
"try",
":",
"if",
"isinstance",
"(",
"source",
",",... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Environment.handle_exception | Exception handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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... | [
"Exception",
"handling",
"helper",
".",
"This",
"is",
"used",
"internally",
"to",
"either",
"raise",
"rewritten",
"exceptions",
"or",
"return",
"a",
"rendered",
"traceback",
"for",
"the",
"template",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L624-L644 | [
"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",
"(",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Template.from_code | Creates a template object from compiled code and the globals. This
is used by the loaders and environment to create a template object. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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__': ... | [
"Creates",
"a",
"template",
"object",
"from",
"compiled",
"code",
"and",
"the",
"globals",
".",
"This",
"is",
"used",
"by",
"the",
"loaders",
"and",
"environment",
"to",
"create",
"a",
"template",
"object",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L808-L819 | [
"def",
"from_code",
"(",
"cls",
",",
"environment",
",",
"code",
",",
"globals",
",",
"uptodate",
"=",
"None",
")",
":",
"namespace",
"=",
"{",
"'environment'",
":",
"environment",
",",
"'__file__'",
":",
"code",
".",
"co_filename",
"}",
"exec",
"code",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Template.render | 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... | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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')
... | [
"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... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L853-L868 | [
"def",
"render",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"vars",
"=",
"dict",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"return",
"concat",
"(",
"self",
".",
"root_render_func",
"(",
"self",
".",
"new_c... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Template.generate | 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 ... | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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... | [
"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",
"... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L876-L892 | [
"def",
"generate",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"vars",
"=",
"dict",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"for",
"event",
"in",
"self",
".",
"root_render_func",
"(",
"self",
".",
"new_co... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Template.module | 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()
... | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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'... | [
"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",
... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L915-L929 | [
"def",
"module",
"(",
"self",
")",
":",
"if",
"self",
".",
"_module",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_module",
"self",
".",
"_module",
"=",
"rv",
"=",
"self",
".",
"make_module",
"(",
")",
"return",
"rv"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Template.debug_info | The debug info mapping. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""The debug info mapping."""
return [tuple(map(int, x.split('='))) for x in
self._debug_info.split('&')] | [
"The",
"debug",
"info",
"mapping",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L948-L951 | [
"def",
"debug_info",
"(",
"self",
")",
":",
"return",
"[",
"tuple",
"(",
"map",
"(",
"int",
",",
"x",
".",
"split",
"(",
"'='",
")",
")",
")",
"for",
"x",
"in",
"self",
".",
"_debug_info",
".",
"split",
"(",
"'&'",
")",
"]"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | TemplateStream.dump | 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') | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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'):
"""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='... | [
"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",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L1027-L1052 | [
"def",
"dump",
"(",
"self",
",",
"fp",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
")",
":",
"close",
"=",
"False",
"if",
"isinstance",
"(",
"fp",
",",
"basestring",
")",
":",
"fp",
"=",
"file",
"(",
"fp",
",",
"'w'",
")",
"clos... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | TemplateStream.disable_buffering | Disable the output buffering. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | def disable_buffering(self):
"""Disable the output buffering."""
self._next = self._gen.next
self.buffered = False | def disable_buffering(self):
"""Disable the output buffering."""
self._next = self._gen.next
self.buffered = False | [
"Disable",
"the",
"output",
"buffering",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L1054-L1057 | [
"def",
"disable_buffering",
"(",
"self",
")",
":",
"self",
".",
"_next",
"=",
"self",
".",
"_gen",
".",
"next",
"self",
".",
"buffered",
"=",
"False"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | TemplateStream.enable_buffering | Enable buffering. Buffer `size` items before yielding them. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py | 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):
"""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:
... | [
"Enable",
"buffering",
".",
"Buffer",
"size",
"items",
"before",
"yielding",
"them",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/environment.py#L1059-L1084 | [
"def",
"enable_buffering",
"(",
"self",
",",
"size",
"=",
"5",
")",
":",
"if",
"size",
"<=",
"1",
":",
"raise",
"ValueError",
"(",
"'buffer size too small'",
")",
"def",
"generator",
"(",
"next",
")",
":",
"buf",
"=",
"[",
"]",
"c_size",
"=",
"0",
"p... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | require_prebuilt_dist | 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. | pythonforandroid/toolchain.py | 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):
"""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 ... | [
"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... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L131-L154 | [
"def",
"require_prebuilt_dist",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper_func",
"(",
"self",
",",
"args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"ctx",
".",
"set_archs",
"(",
"self",
".",
"_archs",
")",
"ctx",
".",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | dist_from_args | Parses out any distribution-related arguments, and uses them to
obtain a Distribution class instance for the build. | pythonforandroid/toolchain.py | 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):
"""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... | [
"Parses",
"out",
"any",
"distribution",
"-",
"related",
"arguments",
"and",
"uses",
"them",
"to",
"obtain",
"a",
"Distribution",
"class",
"instance",
"for",
"the",
"build",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L157-L168 | [
"def",
"dist_from_args",
"(",
"ctx",
",",
"args",
")",
":",
"return",
"Distribution",
".",
"get_distribution",
"(",
"ctx",
",",
"name",
"=",
"args",
".",
"dist_name",
",",
"recipes",
"=",
"split_argument_list",
"(",
"args",
".",
"requirements",
")",
",",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | build_dist_from_args | Parses out any bootstrap related arguments, and uses them to build
a dist. | pythonforandroid/toolchain.py | 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):
"""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... | [
"Parses",
"out",
"any",
"bootstrap",
"related",
"arguments",
"and",
"uses",
"them",
"to",
"build",
"a",
"dist",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L171-L210 | [
"def",
"build_dist_from_args",
"(",
"ctx",
",",
"dist",
",",
"args",
")",
":",
"bs",
"=",
"Bootstrap",
".",
"get_bootstrap",
"(",
"args",
".",
"bootstrap",
",",
"ctx",
")",
"blacklist",
"=",
"getattr",
"(",
"args",
",",
"\"blacklist_requirements\"",
",",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.warn_on_deprecated_args | Print warning messages for any deprecated arguments that were passed. | pythonforandroid/toolchain.py | 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):
"""
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 ... | [
"Print",
"warning",
"messages",
"for",
"any",
"deprecated",
"arguments",
"that",
"were",
"passed",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L669-L699 | [
"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",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.bootstraps | List all the bootstraps available to build with. | pythonforandroid/toolchain.py | 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):
"""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=... | [
"List",
"all",
"the",
"bootstraps",
"available",
"to",
"build",
"with",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L767-L774 | [
"def",
"bootstraps",
"(",
"self",
",",
"_args",
")",
":",
"for",
"bs",
"in",
"Bootstrap",
".",
"list_bootstraps",
"(",
")",
":",
"bs",
"=",
"Bootstrap",
".",
"get_bootstrap",
"(",
"bs",
",",
"self",
".",
"ctx",
")",
"print",
"(",
"'{Fore.BLUE}{Style.BRIG... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.clean_all | Delete all build components; the package cache, package builds,
bootstrap builds and distributions. | pythonforandroid/toolchain.py | 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):
"""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) | [
"Delete",
"all",
"build",
"components",
";",
"the",
"package",
"cache",
"package",
"builds",
"bootstrap",
"builds",
"and",
"distributions",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L794-L799 | [
"def",
"clean_all",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"clean_dists",
"(",
"args",
")",
"self",
".",
"clean_builds",
"(",
"args",
")",
"self",
".",
"clean_download_cache",
"(",
"args",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.clean_dists | Delete all compiled distributions in the internal distribution
directory. | pythonforandroid/toolchain.py | 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):
"""Delete all compiled distributions in the internal distribution
directory."""
ctx = self.ctx
if exists(ctx.dist_dir):
shutil.rmtree(ctx.dist_dir) | [
"Delete",
"all",
"compiled",
"distributions",
"in",
"the",
"internal",
"distribution",
"directory",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L801-L806 | [
"def",
"clean_dists",
"(",
"self",
",",
"_args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"if",
"exists",
"(",
"ctx",
".",
"dist_dir",
")",
":",
"shutil",
".",
"rmtree",
"(",
"ctx",
".",
"dist_dir",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.clean_bootstrap_builds | Delete all the bootstrap builds. | pythonforandroid/toolchain.py | 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):
"""Delete all the bootstrap builds."""
if exists(join(self.ctx.build_dir, 'bootstrap_builds')):
shutil.rmtree(join(self.ctx.build_dir, 'bootstrap_builds')) | [
"Delete",
"all",
"the",
"bootstrap",
"builds",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L808-L811 | [
"def",
"clean_bootstrap_builds",
"(",
"self",
",",
"_args",
")",
":",
"if",
"exists",
"(",
"join",
"(",
"self",
".",
"ctx",
".",
"build_dir",
",",
"'bootstrap_builds'",
")",
")",
":",
"shutil",
".",
"rmtree",
"(",
"join",
"(",
"self",
".",
"ctx",
".",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.clean_builds | 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. | pythonforandroid/toolchain.py | 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):
"""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... | [
"Delete",
"all",
"build",
"caches",
"for",
"each",
"recipe",
"python",
"-",
"install",
"java",
"code",
"and",
"compiled",
"libs",
"collection",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L818-L833 | [
"def",
"clean_builds",
"(",
"self",
",",
"_args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"if",
"exists",
"(",
"ctx",
".",
"build_dir",
")",
":",
"shutil",
".",
"rmtree",
"(",
"ctx",
".",
"build_dir",
")",
"if",
"exists",
"(",
"ctx",
".",
"python... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.clean_recipe_build | 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
... | pythonforandroid/toolchain.py | 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):
"""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... | [
"Deletes",
"the",
"build",
"files",
"of",
"the",
"given",
"recipe",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L835-L848 | [
"def",
"clean_recipe_build",
"(",
"self",
",",
"args",
")",
":",
"recipe",
"=",
"Recipe",
".",
"get_recipe",
"(",
"args",
".",
"recipe",
",",
"self",
".",
"ctx",
")",
"info",
"(",
"'Cleaning build for {} recipe.'",
".",
"format",
"(",
"recipe",
".",
"name"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.clean_download_cache | 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. | pythonforandroid/toolchain.py | 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):
""" 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",
".",
"::"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L850-L873 | [
"def",
"clean_download_cache",
"(",
"self",
",",
"args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"if",
"hasattr",
"(",
"args",
",",
"'recipes'",
")",
"and",
"args",
".",
"recipes",
":",
"for",
"package",
"in",
"args",
".",
"recipes",
":",
"remove_pat... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.export_dist | 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. | pythonforandroid/toolchain.py | 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):
"""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... | [
"Copies",
"a",
"created",
"dist",
"to",
"an",
"output",
"dir",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L876-L893 | [
"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 ... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.apk | Create an APK using the given distribution. | pythonforandroid/toolchain.py | 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):
"""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 ... | [
"Create",
"an",
"APK",
"using",
"the",
"given",
"distribution",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L902-L1055 | [
"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... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.archs | List the target architectures available to be built for. | pythonforandroid/toolchain.py | 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):
"""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)) | [
"List",
"the",
"target",
"architectures",
"available",
"to",
"be",
"built",
"for",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1064-L1069 | [
"def",
"archs",
"(",
"self",
",",
"_args",
")",
":",
"print",
"(",
"'{Style.BRIGHT}Available target architectures are:'",
"'{Style.RESET_ALL}'",
".",
"format",
"(",
"Style",
"=",
"Out_Style",
")",
")",
"for",
"arch",
"in",
"self",
".",
"ctx",
".",
"archs",
":"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.distributions | Lists all distributions currently available (i.e. that have already
been built). | pythonforandroid/toolchain.py | 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):
"""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:'
... | [
"Lists",
"all",
"distributions",
"currently",
"available",
"(",
"i",
".",
"e",
".",
"that",
"have",
"already",
"been",
"built",
")",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1075-L1087 | [
"def",
"distributions",
"(",
"self",
",",
"_args",
")",
":",
"ctx",
"=",
"self",
".",
"ctx",
"dists",
"=",
"Distribution",
".",
"get_distributions",
"(",
"ctx",
")",
"if",
"dists",
":",
"print",
"(",
"'{Style.BRIGHT}Distributions currently installed are:'",
"'{S... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.sdk_tools | 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. | pythonforandroid/toolchain.py | 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):
"""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... | [
"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"... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1097-L1114 | [
"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",
"=... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL._adb | Call the adb executable from the SDK, passing the given commands as
arguments. | pythonforandroid/toolchain.py | 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):
"""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... | [
"Call",
"the",
"adb",
"executable",
"from",
"the",
"SDK",
"passing",
"the",
"given",
"commands",
"as",
"arguments",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1128-L1144 | [
"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",
"="... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ToolchainCL.build_status | Print the status of the specified build. | pythonforandroid/toolchain.py | 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 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... | [
"Print",
"the",
"status",
"of",
"the",
"specified",
"build",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/toolchain.py#L1146-L1172 | [
"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",
"(",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | IFAddrRecipe.prebuild_arch | Make the build and target directories | pythonforandroid/recipes/ifaddrs/__init__.py | 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):
"""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) | [
"Make",
"the",
"build",
"and",
"target",
"directories"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/ifaddrs/__init__.py#L19-L24 | [
"def",
"prebuild_arch",
"(",
"self",
",",
"arch",
")",
":",
"path",
"=",
"self",
".",
"get_build_dir",
"(",
"arch",
".",
"arch",
")",
"if",
"not",
"exists",
"(",
"path",
")",
":",
"info",
"(",
"\"creating {}\"",
".",
"format",
"(",
"path",
")",
")",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | IFAddrRecipe.build_arch | simple shared compile | pythonforandroid/recipes/ifaddrs/__init__.py | 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):
"""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... | [
"simple",
"shared",
"compile"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/ifaddrs/__init__.py#L26-L51 | [
"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",
")",
",",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Context.resolve | Looks up a variable like `__getitem__` or `get` but returns an
:class:`Undefined` object with the name of the name looked up. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py | 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):
"""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... | [
"Looks",
"up",
"a",
"variable",
"like",
"__getitem__",
"or",
"get",
"but",
"returns",
"an",
":",
"class",
":",
"Undefined",
"object",
"with",
"the",
"name",
"of",
"the",
"name",
"looked",
"up",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py#L148-L156 | [
"def",
"resolve",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"vars",
":",
"return",
"self",
".",
"vars",
"[",
"key",
"]",
"if",
"key",
"in",
"self",
".",
"parent",
":",
"return",
"self",
".",
"parent",
"[",
"key",
"]",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Context.call | 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`. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py | 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):
"""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__:
... | [
"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... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py#L169-L184 | [
"def",
"call",
"(",
"__self",
",",
"__obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"__debug__",
":",
"__traceback_hide__",
"=",
"True",
"if",
"isinstance",
"(",
"__obj",
",",
"_context_function_types",
")",
":",
"if",
"getattr",
"(",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Undefined._fail_with_undefined_error | Regular callback function for undefined objects that raises an
`UndefinedError` on call. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py | 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):
"""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... | [
"Regular",
"callback",
"function",
"for",
"undefined",
"objects",
"that",
"raises",
"an",
"UndefinedError",
"on",
"call",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/runtime.py#L433-L452 | [
"def",
"_fail_with_undefined_error",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_undefined_hint",
"is",
"None",
":",
"if",
"self",
".",
"_undefined_obj",
"is",
"missing",
":",
"hint",
"=",
"'%r is undefined'",
"%"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | fix_deplist | Turn a dependency list into lowercase, and make sure all entries
that are just a string become a tuple of strings | pythonforandroid/graph.py | 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):
""" 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... | [
"Turn",
"a",
"dependency",
"list",
"into",
"lowercase",
"and",
"make",
"sure",
"all",
"entries",
"that",
"are",
"just",
"a",
"string",
"become",
"a",
"tuple",
"of",
"strings"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L10-L22 | [
"def",
"fix_deplist",
"(",
"deps",
")",
":",
"deps",
"=",
"[",
"(",
"(",
"dep",
".",
"lower",
"(",
")",
",",
")",
"if",
"not",
"isinstance",
"(",
"dep",
",",
"(",
"list",
",",
"tuple",
")",
")",
"else",
"tuple",
"(",
"[",
"dep_entry",
".",
"low... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | get_dependency_tuple_list_for_recipe | Get the dependencies of a recipe with filtered out blacklist, and
turned into tuples with fix_deplist() | pythonforandroid/graph.py | 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):
""" 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:
... | [
"Get",
"the",
"dependencies",
"of",
"a",
"recipe",
"with",
"filtered",
"out",
"blacklist",
"and",
"turned",
"into",
"tuples",
"with",
"fix_deplist",
"()"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L42-L61 | [
"def",
"get_dependency_tuple_list_for_recipe",
"(",
"recipe",
",",
"blacklist",
"=",
"None",
")",
":",
"if",
"blacklist",
"is",
"None",
":",
"blacklist",
"=",
"set",
"(",
")",
"assert",
"(",
"type",
"(",
"blacklist",
")",
"==",
"set",
")",
"if",
"recipe",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | recursively_collect_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. | pythonforandroid/graph.py | 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
):
'''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 ... | [
"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",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L64-L124 | [
"def",
"recursively_collect_orders",
"(",
"name",
",",
"ctx",
",",
"all_inputs",
",",
"orders",
"=",
"None",
",",
"blacklist",
"=",
"None",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"if",
"orders",
"is",
"None",
":",
"orders",
"=",
"[",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | find_order | Do a topological sort on the dependency graph dict. | pythonforandroid/graph.py | 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):
'''
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 ... | [
"Do",
"a",
"topological",
"sort",
"on",
"the",
"dependency",
"graph",
"dict",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L127-L143 | [
"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... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | obvious_conflict_checker | 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. | pythonforandroid/graph.py | 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):
""" 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... | [
"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",
... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L146-L240 | [
"def",
"obvious_conflict_checker",
"(",
"ctx",
",",
"name_tuples",
",",
"blacklist",
"=",
"None",
")",
":",
"deps_were_added_by",
"=",
"dict",
"(",
")",
"deps",
"=",
"set",
"(",
")",
"if",
"blacklist",
"is",
"None",
":",
"blacklist",
"=",
"set",
"(",
")"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | OpenSSLRecipe.include_flags | Returns a string with the include folders | pythonforandroid/recipes/openssl/__init__.py | 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):
'''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... | [
"Returns",
"a",
"string",
"with",
"the",
"include",
"folders"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/openssl/__init__.py#L88-L93 | [
"def",
"include_flags",
"(",
"self",
",",
"arch",
")",
":",
"openssl_includes",
"=",
"join",
"(",
"self",
".",
"get_build_dir",
"(",
"arch",
".",
"arch",
")",
",",
"'include'",
")",
"return",
"(",
"' -I'",
"+",
"openssl_includes",
"+",
"' -I'",
"+",
"joi... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | GuestPythonRecipe.set_libs_flags | Takes care to properly link libraries with python depending on our
requirements and the attribute :attr:`opt_depends`. | pythonforandroid/python.py | 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):
'''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
... | [
"Takes",
"care",
"to",
"properly",
"link",
"libraries",
"with",
"python",
"depending",
"on",
"our",
"requirements",
"and",
"the",
"attribute",
":",
"attr",
":",
"opt_depends",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/python.py#L183-L214 | [
"def",
"set_libs_flags",
"(",
"self",
",",
"env",
",",
"arch",
")",
":",
"def",
"add_flags",
"(",
"include_flags",
",",
"link_dirs",
",",
"link_libs",
")",
":",
"env",
"[",
"'CPPFLAGS'",
"]",
"=",
"env",
".",
"get",
"(",
"'CPPFLAGS'",
",",
"''",
")",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | GuestPythonRecipe.compile_python_files | 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) | pythonforandroid/python.py | 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):
'''
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... | [
"Compile",
"the",
"python",
"files",
"(",
"recursively",
")",
"for",
"the",
"python",
"files",
"inside",
"a",
"given",
"folder",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/python.py#L276-L290 | [
"def",
"compile_python_files",
"(",
"self",
",",
"dir",
")",
":",
"args",
"=",
"[",
"self",
".",
"ctx",
".",
"hostpython",
"]",
"if",
"self",
".",
"ctx",
".",
"python_recipe",
".",
"name",
"==",
"'python3'",
":",
"args",
"+=",
"[",
"'-OO'",
",",
"'-m... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | GuestPythonRecipe.create_python_bundle | Create a packaged python bundle in the target directory, by
copying all the modules and standard library to the right
place. | pythonforandroid/python.py | 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):
"""
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(
... | [
"Create",
"a",
"packaged",
"python",
"bundle",
"in",
"the",
"target",
"directory",
"by",
"copying",
"all",
"the",
"modules",
"and",
"standard",
"library",
"to",
"the",
"right",
"place",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/python.py#L292-L361 | [
"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'",
","... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | ScryptRecipe.get_recipe_env | Adds openssl recipe to include and library path. | pythonforandroid/recipes/scrypt/__init__.py | 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):
"""
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... | [
"Adds",
"openssl",
"recipe",
"to",
"include",
"and",
"library",
"path",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/scrypt/__init__.py#L12-L23 | [
"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",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | walk_valid_filens | 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... | pythonforandroid/util.py | 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):
"""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... | [
"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",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/util.py#L149-L176 | [
"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"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | handle_build_exception | Handles a raised BuildInterruptingException by printing its error
message and associated instructions, if any, then exiting. | pythonforandroid/util.py | 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):
"""
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... | [
"Handles",
"a",
"raised",
"BuildInterruptingException",
"by",
"printing",
"its",
"error",
"message",
"and",
"associated",
"instructions",
"if",
"any",
"then",
"exiting",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/util.py#L186-L194 | [
"def",
"handle_build_exception",
"(",
"exception",
")",
":",
"error",
"(",
"'Build failed: {}'",
".",
"format",
"(",
"exception",
".",
"message",
")",
")",
"if",
"exception",
".",
"instructions",
"is",
"not",
"None",
":",
"info",
"(",
"'Instructions: {}'",
"."... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | render | Using jinja2, render `template` to the filename `dest`, supplying the
keyword arguments as template parameters. | pythonforandroid/bootstraps/common/build/build.py | 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):
'''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)
... | [
"Using",
"jinja2",
"render",
"template",
"to",
"the",
"filename",
"dest",
"supplying",
"the"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/common/build/build.py#L107-L122 | [
"def",
"render",
"(",
"template",
",",
"dest",
",",
"*",
"*",
"kwargs",
")",
":",
"dest_dir",
"=",
"dirname",
"(",
"dest",
")",
"if",
"dest_dir",
"and",
"not",
"exists",
"(",
"dest_dir",
")",
":",
"makedirs",
"(",
"dest_dir",
")",
"template",
"=",
"e... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | 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. | pythonforandroid/bootstraps/common/build/build.py | 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():
'''
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... | [
"Search",
"for",
"all",
"the",
"python",
"related",
"files",
"and",
"construct",
"the",
"pythonXX",
".",
"zip",
"According",
"to",
"#",
"http",
":",
"//",
"randomsplat",
".",
"com",
"/",
"id5",
"-",
"cross",
"-",
"compiling",
"-",
"python",
"-",
"for",
... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/common/build/build.py#L159-L198 | [
"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... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | make_tar | Make a zip file `fn` from the contents of source_dis. | pythonforandroid/bootstraps/common/build/build.py | 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):
'''
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 ... | [
"Make",
"a",
"zip",
"file",
"fn",
"from",
"the",
"contents",
"of",
"source_dis",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/common/build/build.py#L201-L247 | [
"def",
"make_tar",
"(",
"tfn",
",",
"source_dirs",
",",
"ignore_path",
"=",
"[",
"]",
",",
"optimize_python",
"=",
"True",
")",
":",
"# selector function",
"def",
"select",
"(",
"fn",
")",
":",
"rfn",
"=",
"realpath",
"(",
"fn",
")",
"for",
"p",
"in",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | compile_dir | Compile *.py in directory `dfn` to *.pyo | pythonforandroid/bootstraps/common/build/build.py | 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):
'''
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... | [
"Compile",
"*",
".",
"py",
"in",
"directory",
"dfn",
"to",
"*",
".",
"pyo"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/common/build/build.py#L250-L271 | [
"def",
"compile_dir",
"(",
"dfn",
",",
"optimize_python",
"=",
"True",
")",
":",
"if",
"PYTHON",
"is",
"None",
":",
"return",
"if",
"int",
"(",
"PYTHON_VERSION",
"[",
"0",
"]",
")",
">=",
"3",
":",
"args",
"=",
"[",
"PYTHON",
",",
"'-m'",
",",
"'co... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Hostpython3CrystaXRecipe.build_arch | Creates expected build and symlinks system Python version. | pythonforandroid/recipes/hostpython3crystax/__init__.py | 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):
"""
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... | [
"Creates",
"expected",
"build",
"and",
"symlinks",
"system",
"Python",
"version",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/hostpython3crystax/__init__.py#L25-L41 | [
"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... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | render | Using jinja2, render `template` to the filename `dest`, supplying the
keyword arguments as template parameters. | pythonforandroid/bootstraps/pygame/build/build.py | 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):
'''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'))
... | [
"Using",
"jinja2",
"render",
"template",
"to",
"the",
"filename",
"dest",
"supplying",
"the"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/build.py#L62-L73 | [
"def",
"render",
"(",
"template",
",",
"dest",
",",
"*",
"*",
"kwargs",
")",
":",
"template",
"=",
"environment",
".",
"get_template",
"(",
"template",
")",
"text",
"=",
"template",
".",
"render",
"(",
"*",
"*",
"kwargs",
")",
"f",
"=",
"open",
"(",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | md5sum | Calculate the md5sum of a file. | pythonforandroid/recipe.py | 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):
'''Calculate the md5sum of a file.
'''
with open(filen, 'rb') as fileh:
md5 = hashlib.md5(fileh.read())
return md5.hexdigest() | [
"Calculate",
"the",
"md5sum",
"of",
"a",
"file",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L1167-L1173 | [
"def",
"md5sum",
"(",
"filen",
")",
":",
"with",
"open",
"(",
"filen",
",",
"'rb'",
")",
"as",
"fileh",
":",
"md5",
"=",
"hashlib",
".",
"md5",
"(",
"fileh",
".",
"read",
"(",
")",
")",
"return",
"md5",
".",
"hexdigest",
"(",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.versioned_url | A property returning the url of the recipe with ``{version}``
replaced by the :attr:`url`. If accessing the url, you should use this
property, *not* access the url directly. | pythonforandroid/recipe.py | def versioned_url(self):
'''A property returning the url of the recipe with ``{version}``
replaced by the :attr:`url`. If accessing the url, you should use this
property, *not* access the url directly.'''
if self.url is None:
return None
return self.url.format(version... | def versioned_url(self):
'''A property returning the url of the recipe with ``{version}``
replaced by the :attr:`url`. If accessing the url, you should use this
property, *not* access the url directly.'''
if self.url is None:
return None
return self.url.format(version... | [
"A",
"property",
"returning",
"the",
"url",
"of",
"the",
"recipe",
"with",
"{",
"version",
"}",
"replaced",
"by",
"the",
":",
"attr",
":",
"url",
".",
"If",
"accessing",
"the",
"url",
"you",
"should",
"use",
"this",
"property",
"*",
"not",
"*",
"access... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L120-L126 | [
"def",
"versioned_url",
"(",
"self",
")",
":",
"if",
"self",
".",
"url",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"url",
".",
"format",
"(",
"version",
"=",
"self",
".",
"version",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.download_file | (internal) Download an ``url`` to a ``target``. | pythonforandroid/recipe.py | def download_file(self, url, target, cwd=None):
"""
(internal) Download an ``url`` to a ``target``.
"""
if not url:
return
info('Downloading {} from {}'.format(self.name, url))
if cwd:
target = join(cwd, target)
parsed_url = urlparse(url)... | def download_file(self, url, target, cwd=None):
"""
(internal) Download an ``url`` to a ``target``.
"""
if not url:
return
info('Downloading {} from {}'.format(self.name, url))
if cwd:
target = join(cwd, target)
parsed_url = urlparse(url)... | [
"(",
"internal",
")",
"Download",
"an",
"url",
"to",
"a",
"target",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L128-L185 | [
"def",
"download_file",
"(",
"self",
",",
"url",
",",
"target",
",",
"cwd",
"=",
"None",
")",
":",
"if",
"not",
"url",
":",
"return",
"info",
"(",
"'Downloading {} from {}'",
".",
"format",
"(",
"self",
".",
"name",
",",
"url",
")",
")",
"if",
"cwd",... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.apply_patch | Apply a patch from the current recipe directory into the current
build directory.
.. versionchanged:: 0.6.0
Add ability to apply patch from any dir via kwarg `build_dir`''' | pythonforandroid/recipe.py | def apply_patch(self, filename, arch, build_dir=None):
"""
Apply a patch from the current recipe directory into the current
build directory.
.. versionchanged:: 0.6.0
Add ability to apply patch from any dir via kwarg `build_dir`'''
"""
info("Applying patch {}... | def apply_patch(self, filename, arch, build_dir=None):
"""
Apply a patch from the current recipe directory into the current
build directory.
.. versionchanged:: 0.6.0
Add ability to apply patch from any dir via kwarg `build_dir`'''
"""
info("Applying patch {}... | [
"Apply",
"a",
"patch",
"from",
"the",
"current",
"recipe",
"directory",
"into",
"the",
"current",
"build",
"directory",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L187-L199 | [
"def",
"apply_patch",
"(",
"self",
",",
"filename",
",",
"arch",
",",
"build_dir",
"=",
"None",
")",
":",
"info",
"(",
"\"Applying patch {}\"",
".",
"format",
"(",
"filename",
")",
")",
"build_dir",
"=",
"build_dir",
"if",
"build_dir",
"else",
"self",
".",... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.filtered_archs | Return archs of self.ctx that are valid build archs
for the Recipe. | pythonforandroid/recipe.py | def filtered_archs(self):
'''Return archs of self.ctx that are valid build archs
for the Recipe.'''
result = []
for arch in self.ctx.archs:
if not self.archs or (arch.arch in self.archs):
result.append(arch)
return result | def filtered_archs(self):
'''Return archs of self.ctx that are valid build archs
for the Recipe.'''
result = []
for arch in self.ctx.archs:
if not self.archs or (arch.arch in self.archs):
result.append(arch)
return result | [
"Return",
"archs",
"of",
"self",
".",
"ctx",
"that",
"are",
"valid",
"build",
"archs",
"for",
"the",
"Recipe",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L223-L230 | [
"def",
"filtered_archs",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"for",
"arch",
"in",
"self",
".",
"ctx",
".",
"archs",
":",
"if",
"not",
"self",
".",
"archs",
"or",
"(",
"arch",
".",
"arch",
"in",
"self",
".",
"archs",
")",
":",
"result"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.check_recipe_choices | Checks what recipes are being built to see which of the alternative
and optional dependencies are being used,
and returns a list of these. | pythonforandroid/recipe.py | 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.depends:
... | 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.depends:
... | [
"Checks",
"what",
"recipes",
"are",
"being",
"built",
"to",
"see",
"which",
"of",
"the",
"alternative",
"and",
"optional",
"dependencies",
"are",
"being",
"used",
"and",
"returns",
"a",
"list",
"of",
"these",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L232-L247 | [
"def",
"check_recipe_choices",
"(",
"self",
")",
":",
"recipes",
"=",
"[",
"]",
"built_recipes",
"=",
"self",
".",
"ctx",
".",
"recipe_build_order",
"for",
"recipe",
"in",
"self",
".",
"depends",
":",
"if",
"isinstance",
"(",
"recipe",
",",
"(",
"tuple",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.get_build_container_dir | Given the arch name, returns the directory where it will be
built.
This returns a different directory depending on what
alternative or optional dependencies are being built. | pythonforandroid/recipe.py | def get_build_container_dir(self, arch):
'''Given the arch name, returns the directory where it will be
built.
This returns a different directory depending on what
alternative or optional dependencies are being built.
'''
dir_name = self.get_dir_name()
return joi... | def get_build_container_dir(self, arch):
'''Given the arch name, returns the directory where it will be
built.
This returns a different directory depending on what
alternative or optional dependencies are being built.
'''
dir_name = self.get_dir_name()
return joi... | [
"Given",
"the",
"arch",
"name",
"returns",
"the",
"directory",
"where",
"it",
"will",
"be",
"built",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L255-L264 | [
"def",
"get_build_container_dir",
"(",
"self",
",",
"arch",
")",
":",
"dir_name",
"=",
"self",
".",
"get_dir_name",
"(",
")",
"return",
"join",
"(",
"self",
".",
"ctx",
".",
"build_dir",
",",
"'other_builds'",
",",
"dir_name",
",",
"'{}__ndk_target_{}'",
"."... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.get_recipe_dir | Returns the local recipe directory or defaults to the core recipe
directory. | pythonforandroid/recipe.py | def get_recipe_dir(self):
"""
Returns the local recipe directory or defaults to the core recipe
directory.
"""
if self.ctx.local_recipes is not None:
local_recipe_dir = join(self.ctx.local_recipes, self.name)
if exists(local_recipe_dir):
re... | def get_recipe_dir(self):
"""
Returns the local recipe directory or defaults to the core recipe
directory.
"""
if self.ctx.local_recipes is not None:
local_recipe_dir = join(self.ctx.local_recipes, self.name)
if exists(local_recipe_dir):
re... | [
"Returns",
"the",
"local",
"recipe",
"directory",
"or",
"defaults",
"to",
"the",
"core",
"recipe",
"directory",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L277-L286 | [
"def",
"get_recipe_dir",
"(",
"self",
")",
":",
"if",
"self",
".",
"ctx",
".",
"local_recipes",
"is",
"not",
"None",
":",
"local_recipe_dir",
"=",
"join",
"(",
"self",
".",
"ctx",
".",
"local_recipes",
",",
"self",
".",
"name",
")",
"if",
"exists",
"("... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.get_recipe_env | Return the env specialized for the recipe | pythonforandroid/recipe.py | def get_recipe_env(self, arch=None, with_flags_in_cc=True, clang=False):
"""Return the env specialized for the recipe
"""
if arch is None:
arch = self.filtered_archs[0]
return arch.get_env(with_flags_in_cc=with_flags_in_cc, clang=clang) | def get_recipe_env(self, arch=None, with_flags_in_cc=True, clang=False):
"""Return the env specialized for the recipe
"""
if arch is None:
arch = self.filtered_archs[0]
return arch.get_env(with_flags_in_cc=with_flags_in_cc, clang=clang) | [
"Return",
"the",
"env",
"specialized",
"for",
"the",
"recipe"
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L433-L438 | [
"def",
"get_recipe_env",
"(",
"self",
",",
"arch",
"=",
"None",
",",
"with_flags_in_cc",
"=",
"True",
",",
"clang",
"=",
"False",
")",
":",
"if",
"arch",
"is",
"None",
":",
"arch",
"=",
"self",
".",
"filtered_archs",
"[",
"0",
"]",
"return",
"arch",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.prebuild_arch | Run any pre-build tasks for the Recipe. By default, this checks if
any prebuild_archname methods exist for the archname of the current
architecture, and runs them if so. | pythonforandroid/recipe.py | def prebuild_arch(self, arch):
'''Run any pre-build tasks for the Recipe. By default, this checks if
any prebuild_archname methods exist for the archname of the current
architecture, and runs them if so.'''
prebuild = "prebuild_{}".format(arch.arch.replace('-', '_'))
if hasattr(s... | def prebuild_arch(self, arch):
'''Run any pre-build tasks for the Recipe. By default, this checks if
any prebuild_archname methods exist for the archname of the current
architecture, and runs them if so.'''
prebuild = "prebuild_{}".format(arch.arch.replace('-', '_'))
if hasattr(s... | [
"Run",
"any",
"pre",
"-",
"build",
"tasks",
"for",
"the",
"Recipe",
".",
"By",
"default",
"this",
"checks",
"if",
"any",
"prebuild_archname",
"methods",
"exist",
"for",
"the",
"archname",
"of",
"the",
"current",
"architecture",
"and",
"runs",
"them",
"if",
... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L440-L448 | [
"def",
"prebuild_arch",
"(",
"self",
",",
"arch",
")",
":",
"prebuild",
"=",
"\"prebuild_{}\"",
".",
"format",
"(",
"arch",
".",
"arch",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")",
")",
"if",
"hasattr",
"(",
"self",
",",
"prebuild",
")",
":",
"getat... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.apply_patches | Apply any patches for the Recipe.
.. versionchanged:: 0.6.0
Add ability to apply patches from any dir via kwarg `build_dir` | pythonforandroid/recipe.py | def apply_patches(self, arch, build_dir=None):
'''Apply any patches for the Recipe.
.. versionchanged:: 0.6.0
Add ability to apply patches from any dir via kwarg `build_dir`'''
if self.patches:
info_main('Applying patches for {}[{}]'
.format(self.na... | def apply_patches(self, arch, build_dir=None):
'''Apply any patches for the Recipe.
.. versionchanged:: 0.6.0
Add ability to apply patches from any dir via kwarg `build_dir`'''
if self.patches:
info_main('Applying patches for {}[{}]'
.format(self.na... | [
"Apply",
"any",
"patches",
"for",
"the",
"Recipe",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L454-L478 | [
"def",
"apply_patches",
"(",
"self",
",",
"arch",
",",
"build_dir",
"=",
"None",
")",
":",
"if",
"self",
".",
"patches",
":",
"info_main",
"(",
"'Applying patches for {}[{}]'",
".",
"format",
"(",
"self",
".",
"name",
",",
"arch",
".",
"arch",
")",
")",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.build_arch | Run any build tasks for the Recipe. By default, this checks if
any build_archname methods exist for the archname of the current
architecture, and runs them if so. | pythonforandroid/recipe.py | def build_arch(self, arch):
'''Run any build tasks for the Recipe. By default, this checks if
any build_archname methods exist for the archname of the current
architecture, and runs them if so.'''
build = "build_{}".format(arch.arch)
if hasattr(self, build):
getattr(s... | def build_arch(self, arch):
'''Run any build tasks for the Recipe. By default, this checks if
any build_archname methods exist for the archname of the current
architecture, and runs them if so.'''
build = "build_{}".format(arch.arch)
if hasattr(self, build):
getattr(s... | [
"Run",
"any",
"build",
"tasks",
"for",
"the",
"Recipe",
".",
"By",
"default",
"this",
"checks",
"if",
"any",
"build_archname",
"methods",
"exist",
"for",
"the",
"archname",
"of",
"the",
"current",
"architecture",
"and",
"runs",
"them",
"if",
"so",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L487-L493 | [
"def",
"build_arch",
"(",
"self",
",",
"arch",
")",
":",
"build",
"=",
"\"build_{}\"",
".",
"format",
"(",
"arch",
".",
"arch",
")",
"if",
"hasattr",
"(",
"self",
",",
"build",
")",
":",
"getattr",
"(",
"self",
",",
"build",
")",
"(",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.postbuild_arch | Run any post-build tasks for the Recipe. By default, this checks if
any postbuild_archname methods exist for the archname of the
current architecture, and runs them if so. | pythonforandroid/recipe.py | def postbuild_arch(self, arch):
'''Run any post-build tasks for the Recipe. By default, this checks if
any postbuild_archname methods exist for the archname of the
current architecture, and runs them if so.
'''
postbuild = "postbuild_{}".format(arch.arch)
if hasattr(self,... | def postbuild_arch(self, arch):
'''Run any post-build tasks for the Recipe. By default, this checks if
any postbuild_archname methods exist for the archname of the
current architecture, and runs them if so.
'''
postbuild = "postbuild_{}".format(arch.arch)
if hasattr(self,... | [
"Run",
"any",
"post",
"-",
"build",
"tasks",
"for",
"the",
"Recipe",
".",
"By",
"default",
"this",
"checks",
"if",
"any",
"postbuild_archname",
"methods",
"exist",
"for",
"the",
"archname",
"of",
"the",
"current",
"architecture",
"and",
"runs",
"them",
"if",... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L495-L502 | [
"def",
"postbuild_arch",
"(",
"self",
",",
"arch",
")",
":",
"postbuild",
"=",
"\"postbuild_{}\"",
".",
"format",
"(",
"arch",
".",
"arch",
")",
"if",
"hasattr",
"(",
"self",
",",
"postbuild",
")",
":",
"getattr",
"(",
"self",
",",
"postbuild",
")",
"(... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.clean_build | Deletes all the build information of the recipe.
If arch is not None, only this arch dir is deleted. Otherwise
(the default) all builds for all archs are deleted.
By default, this just deletes the main build dir. If the
recipe has e.g. object files biglinked, or .so files stored
... | pythonforandroid/recipe.py | def clean_build(self, arch=None):
'''Deletes all the build information of the recipe.
If arch is not None, only this arch dir is deleted. Otherwise
(the default) all builds for all archs are deleted.
By default, this just deletes the main build dir. If the
recipe has e.g. objec... | def clean_build(self, arch=None):
'''Deletes all the build information of the recipe.
If arch is not None, only this arch dir is deleted. Otherwise
(the default) all builds for all archs are deleted.
By default, this just deletes the main build dir. If the
recipe has e.g. objec... | [
"Deletes",
"all",
"the",
"build",
"information",
"of",
"the",
"recipe",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L512-L544 | [
"def",
"clean_build",
"(",
"self",
",",
"arch",
"=",
"None",
")",
":",
"if",
"arch",
"is",
"None",
":",
"base_dir",
"=",
"join",
"(",
"self",
".",
"ctx",
".",
"build_dir",
",",
"'other_builds'",
",",
"self",
".",
"name",
")",
"else",
":",
"base_dir",... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Recipe.get_recipe | Returns the Recipe with the given name, if it exists. | pythonforandroid/recipe.py | def get_recipe(cls, name, ctx):
'''Returns the Recipe with the given name, if it exists.'''
name = name.lower()
if not hasattr(cls, "recipes"):
cls.recipes = {}
if name in cls.recipes:
return cls.recipes[name]
recipe_file = None
for recipes_dir in... | def get_recipe(cls, name, ctx):
'''Returns the Recipe with the given name, if it exists.'''
name = name.lower()
if not hasattr(cls, "recipes"):
cls.recipes = {}
if name in cls.recipes:
return cls.recipes[name]
recipe_file = None
for recipes_dir in... | [
"Returns",
"the",
"Recipe",
"with",
"the",
"given",
"name",
"if",
"it",
"exists",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L580-L612 | [
"def",
"get_recipe",
"(",
"cls",
",",
"name",
",",
"ctx",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"if",
"not",
"hasattr",
"(",
"cls",
",",
"\"recipes\"",
")",
":",
"cls",
".",
"recipes",
"=",
"{",
"}",
"if",
"name",
"in",
"cls",
... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | PythonRecipe.folder_name | The name of the build folders containing this recipe. | pythonforandroid/recipe.py | def folder_name(self):
'''The name of the build folders containing this recipe.'''
name = self.site_packages_name
if name is None:
name = self.name
return name | def folder_name(self):
'''The name of the build folders containing this recipe.'''
name = self.site_packages_name
if name is None:
name = self.name
return name | [
"The",
"name",
"of",
"the",
"build",
"folders",
"containing",
"this",
"recipe",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L769-L774 | [
"def",
"folder_name",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"site_packages_name",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"self",
".",
"name",
"return",
"name"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | PythonRecipe.build_arch | Install the Python module by calling setup.py install with
the target Python dir. | pythonforandroid/recipe.py | def build_arch(self, arch):
'''Install the Python module by calling setup.py install with
the target Python dir.'''
super(PythonRecipe, self).build_arch(arch)
self.install_python_package(arch) | def build_arch(self, arch):
'''Install the Python module by calling setup.py install with
the target Python dir.'''
super(PythonRecipe, self).build_arch(arch)
self.install_python_package(arch) | [
"Install",
"the",
"Python",
"module",
"by",
"calling",
"setup",
".",
"py",
"install",
"with",
"the",
"target",
"Python",
"dir",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L834-L838 | [
"def",
"build_arch",
"(",
"self",
",",
"arch",
")",
":",
"super",
"(",
"PythonRecipe",
",",
"self",
")",
".",
"build_arch",
"(",
"arch",
")",
"self",
".",
"install_python_package",
"(",
"arch",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | PythonRecipe.install_python_package | Automate the installation of a Python package (or a cython
package where the cython components are pre-built). | pythonforandroid/recipe.py | def install_python_package(self, arch, name=None, env=None, is_dir=True):
'''Automate the installation of a Python package (or a cython
package where the cython components are pre-built).'''
# arch = self.filtered_archs[0] # old kivy-ios way
if name is None:
name = self.name... | def install_python_package(self, arch, name=None, env=None, is_dir=True):
'''Automate the installation of a Python package (or a cython
package where the cython components are pre-built).'''
# arch = self.filtered_archs[0] # old kivy-ios way
if name is None:
name = self.name... | [
"Automate",
"the",
"installation",
"of",
"a",
"Python",
"package",
"(",
"or",
"a",
"cython",
"package",
"where",
"the",
"cython",
"components",
"are",
"pre",
"-",
"built",
")",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L840-L877 | [
"def",
"install_python_package",
"(",
"self",
",",
"arch",
",",
"name",
"=",
"None",
",",
"env",
"=",
"None",
",",
"is_dir",
"=",
"True",
")",
":",
"# arch = self.filtered_archs[0] # old kivy-ios way",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"self",
"... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | CompiledComponentsPythonRecipe.build_arch | Build any cython components, then install the Python module by
calling setup.py install with the target Python dir. | pythonforandroid/recipe.py | def build_arch(self, arch):
'''Build any cython components, then install the Python module by
calling setup.py install with the target Python dir.
'''
Recipe.build_arch(self, arch)
self.build_compiled_components(arch)
self.install_python_package(arch) | def build_arch(self, arch):
'''Build any cython components, then install the Python module by
calling setup.py install with the target Python dir.
'''
Recipe.build_arch(self, arch)
self.build_compiled_components(arch)
self.install_python_package(arch) | [
"Build",
"any",
"cython",
"components",
"then",
"install",
"the",
"Python",
"module",
"by",
"calling",
"setup",
".",
"py",
"install",
"with",
"the",
"target",
"Python",
"dir",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L898-L904 | [
"def",
"build_arch",
"(",
"self",
",",
"arch",
")",
":",
"Recipe",
".",
"build_arch",
"(",
"self",
",",
"arch",
")",
"self",
".",
"build_compiled_components",
"(",
"arch",
")",
"self",
".",
"install_python_package",
"(",
"arch",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | CythonRecipe.build_arch | Build any cython components, then install the Python module by
calling setup.py install with the target Python dir. | pythonforandroid/recipe.py | def build_arch(self, arch):
'''Build any cython components, then install the Python module by
calling setup.py install with the target Python dir.
'''
Recipe.build_arch(self, arch)
self.build_cython_components(arch)
self.install_python_package(arch) | def build_arch(self, arch):
'''Build any cython components, then install the Python module by
calling setup.py install with the target Python dir.
'''
Recipe.build_arch(self, arch)
self.build_cython_components(arch)
self.install_python_package(arch) | [
"Build",
"any",
"cython",
"components",
"then",
"install",
"the",
"Python",
"module",
"by",
"calling",
"setup",
".",
"py",
"install",
"with",
"the",
"target",
"Python",
"dir",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L981-L987 | [
"def",
"build_arch",
"(",
"self",
",",
"arch",
")",
":",
"Recipe",
".",
"build_arch",
"(",
"self",
",",
"arch",
")",
"self",
".",
"build_cython_components",
"(",
"arch",
")",
"self",
".",
"install_python_package",
"(",
"arch",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | TargetPythonRecipe.reduce_object_file_names | Recursively renames all files named XXX.cpython-...-linux-gnu.so"
to "XXX.so", i.e. removing the erroneous architecture name
coming from the local system. | pythonforandroid/recipe.py | def reduce_object_file_names(self, dirn):
"""Recursively renames all files named XXX.cpython-...-linux-gnu.so"
to "XXX.so", i.e. removing the erroneous architecture name
coming from the local system.
"""
py_so_files = shprint(sh.find, dirn, '-iname', '*.so')
filens = py_s... | def reduce_object_file_names(self, dirn):
"""Recursively renames all files named XXX.cpython-...-linux-gnu.so"
to "XXX.so", i.e. removing the erroneous architecture name
coming from the local system.
"""
py_so_files = shprint(sh.find, dirn, '-iname', '*.so')
filens = py_s... | [
"Recursively",
"renames",
"all",
"files",
"named",
"XXX",
".",
"cpython",
"-",
"...",
"-",
"linux",
"-",
"gnu",
".",
"so",
"to",
"XXX",
".",
"so",
"i",
".",
"e",
".",
"removing",
"the",
"erroneous",
"architecture",
"name",
"coming",
"from",
"the",
"loc... | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L1152-L1164 | [
"def",
"reduce_object_file_names",
"(",
"self",
",",
"dirn",
")",
":",
"py_so_files",
"=",
"shprint",
"(",
"sh",
".",
"find",
",",
"dirn",
",",
"'-iname'",
",",
"'*.so'",
")",
"filens",
"=",
"py_so_files",
".",
"stdout",
".",
"decode",
"(",
"'utf-8'",
")... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | run_on_ui_thread | Decorator to create automatically a :class:`Runnable` object with the
function. The function will be delayed and call into the Activity thread. | pythonforandroid/recipes/android/src/android/runnable.py | def run_on_ui_thread(f):
'''Decorator to create automatically a :class:`Runnable` object with the
function. The function will be delayed and call into the Activity thread.
'''
def f2(*args, **kwargs):
Runnable(f)(*args, **kwargs)
return f2 | def run_on_ui_thread(f):
'''Decorator to create automatically a :class:`Runnable` object with the
function. The function will be delayed and call into the Activity thread.
'''
def f2(*args, **kwargs):
Runnable(f)(*args, **kwargs)
return f2 | [
"Decorator",
"to",
"create",
"automatically",
"a",
":",
"class",
":",
"Runnable",
"object",
"with",
"the",
"function",
".",
"The",
"function",
"will",
"be",
"delayed",
"and",
"call",
"into",
"the",
"Activity",
"thread",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/android/src/android/runnable.py#L43-L49 | [
"def",
"run_on_ui_thread",
"(",
"f",
")",
":",
"def",
"f2",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"Runnable",
"(",
"f",
")",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"f2"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Channel | Gets the channel with the given number. | pythonforandroid/recipes/android/src/android/mixer.py | def Channel(n):
"""
Gets the channel with the given number.
"""
rv = channels.get(n, None)
if rv is None:
rv = ChannelImpl(n)
channels[n] = rv
return rv | def Channel(n):
"""
Gets the channel with the given number.
"""
rv = channels.get(n, None)
if rv is None:
rv = ChannelImpl(n)
channels[n] = rv
return rv | [
"Gets",
"the",
"channel",
"with",
"the",
"given",
"number",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/android/src/android/mixer.py#L184-L194 | [
"def",
"Channel",
"(",
"n",
")",
":",
"rv",
"=",
"channels",
".",
"get",
"(",
"n",
",",
"None",
")",
"if",
"rv",
"is",
"None",
":",
"rv",
"=",
"ChannelImpl",
"(",
"n",
")",
"channels",
"[",
"n",
"]",
"=",
"rv",
"return",
"rv"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | generate | Generate the python source for a node tree. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py | def generate(node, environment, name, filename, stream=None,
defer_init=False):
"""Generate the python source for a node tree."""
if not isinstance(node, nodes.Template):
raise TypeError('Can\'t compile non template nodes')
generator = CodeGenerator(environment, name, filename, stream, ... | def generate(node, environment, name, filename, stream=None,
defer_init=False):
"""Generate the python source for a node tree."""
if not isinstance(node, nodes.Template):
raise TypeError('Can\'t compile non template nodes')
generator = CodeGenerator(environment, name, filename, stream, ... | [
"Generate",
"the",
"python",
"source",
"for",
"a",
"node",
"tree",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L57-L65 | [
"def",
"generate",
"(",
"node",
",",
"environment",
",",
"name",
",",
"filename",
",",
"stream",
"=",
"None",
",",
"defer_init",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"node",
",",
"nodes",
".",
"Template",
")",
":",
"raise",
"TypeErro... | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
train | Identifiers.add_special | Register a special name like `loop`. | pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py | def add_special(self, name):
"""Register a special name like `loop`."""
self.undeclared.discard(name)
self.declared.add(name) | def add_special(self, name):
"""Register a special name like `loop`."""
self.undeclared.discard(name)
self.declared.add(name) | [
"Register",
"a",
"special",
"name",
"like",
"loop",
"."
] | kivy/python-for-android | python | https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L125-L128 | [
"def",
"add_special",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"undeclared",
".",
"discard",
"(",
"name",
")",
"self",
".",
"declared",
".",
"add",
"(",
"name",
")"
] | 8e0e8056bc22e4d5bd3398a6b0301f38ff167933 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.