repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.versioned_url
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...
python
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", ")", ":", "if", "self", ".", "url", "is", "None", ":", "return", "None", "return", "self", ".", "url", ".", "format", "(", "version", "=", "self", ".", "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 the url directly.
[ "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...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L120-L126
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.download_file
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)...
python
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", ")", ":", "if", "not", "url", ":", "return", "info", "(", "'Downloading {} from {}'", ".", "format", "(", "self", ".", "name", ",", "url", ")", ")", "if", "cwd",...
(internal) Download an ``url`` to a ``target``.
[ "(", "internal", ")", "Download", "an", "url", "to", "a", "target", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L128-L185
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.apply_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 {}...
python
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", ")", ":", "info", "(", "\"Applying patch {}\"", ".", "format", "(", "filename", ")", ")", "build_dir", "=", "build_dir", "if", "build_dir", "else", "self", ".",...
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`'''
[ "Apply", "a", "patch", "from", "the", "current", "recipe", "directory", "into", "the", "current", "build", "directory", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L187-L199
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.filtered_archs
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
python
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", ")", ":", "result", "=", "[", "]", "for", "arch", "in", "self", ".", "ctx", ".", "archs", ":", "if", "not", "self", ".", "archs", "or", "(", "arch", ".", "arch", "in", "self", ".", "archs", ")", ":", "result"...
Return archs of self.ctx that are valid build archs for the Recipe.
[ "Return", "archs", "of", "self", ".", "ctx", "that", "are", "valid", "build", "archs", "for", "the", "Recipe", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L223-L230
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.check_recipe_choices
def check_recipe_choices(self): '''Checks what recipes are being built to see which of the alternative and optional dependencies are being used, and returns a list of these.''' recipes = [] built_recipes = self.ctx.recipe_build_order for recipe in self.depends: ...
python
def check_recipe_choices(self): '''Checks what recipes are being built to see which of the alternative and optional dependencies are being used, and returns a list of these.''' recipes = [] built_recipes = self.ctx.recipe_build_order for recipe in self.depends: ...
[ "def", "check_recipe_choices", "(", "self", ")", ":", "recipes", "=", "[", "]", "built_recipes", "=", "self", ".", "ctx", ".", "recipe_build_order", "for", "recipe", "in", "self", ".", "depends", ":", "if", "isinstance", "(", "recipe", ",", "(", "tuple", ...
Checks what recipes are being built to see which of the alternative and optional dependencies are being used, and returns a list of these.
[ "Checks", "what", "recipes", "are", "being", "built", "to", "see", "which", "of", "the", "alternative", "and", "optional", "dependencies", "are", "being", "used", "and", "returns", "a", "list", "of", "these", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L232-L247
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.get_build_container_dir
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...
python
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", ")", ":", "dir_name", "=", "self", ".", "get_dir_name", "(", ")", "return", "join", "(", "self", ".", "ctx", ".", "build_dir", ",", "'other_builds'", ",", "dir_name", ",", "'{}__ndk_target_{}'", "."...
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.
[ "Given", "the", "arch", "name", "returns", "the", "directory", "where", "it", "will", "be", "built", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L255-L264
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.get_recipe_dir
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...
python
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", ")", ":", "if", "self", ".", "ctx", ".", "local_recipes", "is", "not", "None", ":", "local_recipe_dir", "=", "join", "(", "self", ".", "ctx", ".", "local_recipes", ",", "self", ".", "name", ")", "if", "exists", "("...
Returns the local recipe directory or defaults to the core recipe directory.
[ "Returns", "the", "local", "recipe", "directory", "or", "defaults", "to", "the", "core", "recipe", "directory", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L277-L286
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.get_recipe_env
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)
python
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", ")", ":", "if", "arch", "is", "None", ":", "arch", "=", "self", ".", "filtered_archs", "[", "0", "]", "return", "arch", ...
Return the env specialized for the recipe
[ "Return", "the", "env", "specialized", "for", "the", "recipe" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L433-L438
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.prebuild_arch
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...
python
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", ")", ":", "prebuild", "=", "\"prebuild_{}\"", ".", "format", "(", "arch", ".", "arch", ".", "replace", "(", "'-'", ",", "'_'", ")", ")", "if", "hasattr", "(", "self", ",", "prebuild", ")", ":", "getat...
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.
[ "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", ...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L440-L448
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.apply_patches
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...
python
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", ")", ":", "if", "self", ".", "patches", ":", "info_main", "(", "'Applying patches for {}[{}]'", ".", "format", "(", "self", ".", "name", ",", "arch", ".", "arch", ")", ")", ...
Apply any patches for the Recipe. .. versionchanged:: 0.6.0 Add ability to apply patches from any dir via kwarg `build_dir`
[ "Apply", "any", "patches", "for", "the", "Recipe", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L454-L478
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.build_arch
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...
python
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", ")", ":", "build", "=", "\"build_{}\"", ".", "format", "(", "arch", ".", "arch", ")", "if", "hasattr", "(", "self", ",", "build", ")", ":", "getattr", "(", "self", ",", "build", ")", "(", ")" ]
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.
[ "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", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L487-L493
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.postbuild_arch
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,...
python
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", ")", ":", "postbuild", "=", "\"postbuild_{}\"", ".", "format", "(", "arch", ".", "arch", ")", "if", "hasattr", "(", "self", ",", "postbuild", ")", ":", "getattr", "(", "self", ",", "postbuild", ")", "(...
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.
[ "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",...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L495-L502
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.clean_build
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...
python
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", ")", ":", "if", "arch", "is", "None", ":", "base_dir", "=", "join", "(", "self", ".", "ctx", ".", "build_dir", ",", "'other_builds'", ",", "self", ".", "name", ")", "else", ":", "base_dir",...
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 ...
[ "Deletes", "all", "the", "build", "information", "of", "the", "recipe", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L512-L544
train
kivy/python-for-android
pythonforandroid/recipe.py
Recipe.get_recipe
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...
python
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", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "if", "not", "hasattr", "(", "cls", ",", "\"recipes\"", ")", ":", "cls", ".", "recipes", "=", "{", "}", "if", "name", "in", "cls", ...
Returns the Recipe with the given name, if it exists.
[ "Returns", "the", "Recipe", "with", "the", "given", "name", "if", "it", "exists", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L580-L612
train
kivy/python-for-android
pythonforandroid/recipe.py
PythonRecipe.folder_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
python
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", ")", ":", "name", "=", "self", ".", "site_packages_name", "if", "name", "is", "None", ":", "name", "=", "self", ".", "name", "return", "name" ]
The name of the build folders containing this recipe.
[ "The", "name", "of", "the", "build", "folders", "containing", "this", "recipe", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L769-L774
train
kivy/python-for-android
pythonforandroid/recipe.py
PythonRecipe.build_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)
python
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", ")", ":", "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.
[ "Install", "the", "Python", "module", "by", "calling", "setup", ".", "py", "install", "with", "the", "target", "Python", "dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L834-L838
train
kivy/python-for-android
pythonforandroid/recipe.py
PythonRecipe.install_python_package
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...
python
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", ")", ":", "# arch = self.filtered_archs[0] # old kivy-ios way", "if", "name", "is", "None", ":", "name", "=", "self", "...
Automate the installation of a Python package (or a cython package where the cython components are pre-built).
[ "Automate", "the", "installation", "of", "a", "Python", "package", "(", "or", "a", "cython", "package", "where", "the", "cython", "components", "are", "pre", "-", "built", ")", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L840-L877
train
kivy/python-for-android
pythonforandroid/recipe.py
CompiledComponentsPythonRecipe.build_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)
python
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", ")", ":", "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.
[ "Build", "any", "cython", "components", "then", "install", "the", "Python", "module", "by", "calling", "setup", ".", "py", "install", "with", "the", "target", "Python", "dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L898-L904
train
kivy/python-for-android
pythonforandroid/recipe.py
CythonRecipe.build_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)
python
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", ")", ":", "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.
[ "Build", "any", "cython", "components", "then", "install", "the", "Python", "module", "by", "calling", "setup", ".", "py", "install", "with", "the", "target", "Python", "dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L981-L987
train
kivy/python-for-android
pythonforandroid/recipe.py
TargetPythonRecipe.reduce_object_file_names
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...
python
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", ")", ":", "py_so_files", "=", "shprint", "(", "sh", ".", "find", ",", "dirn", ",", "'-iname'", ",", "'*.so'", ")", "filens", "=", "py_so_files", ".", "stdout", ".", "decode", "(", "'utf-8'", ")...
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.
[ "Recursively", "renames", "all", "files", "named", "XXX", ".", "cpython", "-", "...", "-", "linux", "-", "gnu", ".", "so", "to", "XXX", ".", "so", "i", ".", "e", ".", "removing", "the", "erroneous", "architecture", "name", "coming", "from", "the", "loc...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L1152-L1164
train
kivy/python-for-android
pythonforandroid/recipes/android/src/android/runnable.py
run_on_ui_thread
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
python
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", ")", ":", "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.
[ "Decorator", "to", "create", "automatically", "a", ":", "class", ":", "Runnable", "object", "with", "the", "function", ".", "The", "function", "will", "be", "delayed", "and", "call", "into", "the", "Activity", "thread", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/android/src/android/runnable.py#L43-L49
train
kivy/python-for-android
pythonforandroid/recipes/android/src/android/mixer.py
Channel
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
python
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", ")", ":", "rv", "=", "channels", ".", "get", "(", "n", ",", "None", ")", "if", "rv", "is", "None", ":", "rv", "=", "ChannelImpl", "(", "n", ")", "channels", "[", "n", "]", "=", "rv", "return", "rv" ]
Gets the channel with the given number.
[ "Gets", "the", "channel", "with", "the", "given", "number", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/android/src/android/mixer.py#L184-L194
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
generate
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, ...
python
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", ")", ":", "if", "not", "isinstance", "(", "node", ",", "nodes", ".", "Template", ")", ":", "raise", "TypeErro...
Generate the python source for a node tree.
[ "Generate", "the", "python", "source", "for", "a", "node", "tree", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L57-L65
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
Identifiers.add_special
def add_special(self, name): """Register a special name like `loop`.""" self.undeclared.discard(name) self.declared.add(name)
python
def add_special(self, name): """Register a special name like `loop`.""" self.undeclared.discard(name) self.declared.add(name)
[ "def", "add_special", "(", "self", ",", "name", ")", ":", "self", ".", "undeclared", ".", "discard", "(", "name", ")", "self", ".", "declared", ".", "add", "(", "name", ")" ]
Register a special name like `loop`.
[ "Register", "a", "special", "name", "like", "loop", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L125-L128
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
Identifiers.is_declared
def is_declared(self, name, local_only=False): """Check if a name is declared in this or an outer scope.""" if name in self.declared_locally or name in self.declared_parameter: return True if local_only: return False return name in self.declared
python
def is_declared(self, name, local_only=False): """Check if a name is declared in this or an outer scope.""" if name in self.declared_locally or name in self.declared_parameter: return True if local_only: return False return name in self.declared
[ "def", "is_declared", "(", "self", ",", "name", ",", "local_only", "=", "False", ")", ":", "if", "name", "in", "self", ".", "declared_locally", "or", "name", "in", "self", ".", "declared_parameter", ":", "return", "True", "if", "local_only", ":", "return",...
Check if a name is declared in this or an outer scope.
[ "Check", "if", "a", "name", "is", "declared", "in", "this", "or", "an", "outer", "scope", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L130-L136
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
Frame.copy
def copy(self): """Create a copy of the current one.""" rv = object.__new__(self.__class__) rv.__dict__.update(self.__dict__) rv.identifiers = object.__new__(self.identifiers.__class__) rv.identifiers.__dict__.update(self.identifiers.__dict__) return rv
python
def copy(self): """Create a copy of the current one.""" rv = object.__new__(self.__class__) rv.__dict__.update(self.__dict__) rv.identifiers = object.__new__(self.identifiers.__class__) rv.identifiers.__dict__.update(self.identifiers.__dict__) return rv
[ "def", "copy", "(", "self", ")", ":", "rv", "=", "object", ".", "__new__", "(", "self", ".", "__class__", ")", "rv", ".", "__dict__", ".", "update", "(", "self", ".", "__dict__", ")", "rv", ".", "identifiers", "=", "object", ".", "__new__", "(", "s...
Create a copy of the current one.
[ "Create", "a", "copy", "of", "the", "current", "one", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L188-L194
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
Frame.find_shadowed
def find_shadowed(self, extra=()): """Find all the shadowed names. extra is an iterable of variables that may be defined with `add_special` which may occour scoped. """ i = self.identifiers return (i.declared | i.outer_undeclared) & \ (i.declared_locally | i.decla...
python
def find_shadowed(self, extra=()): """Find all the shadowed names. extra is an iterable of variables that may be defined with `add_special` which may occour scoped. """ i = self.identifiers return (i.declared | i.outer_undeclared) & \ (i.declared_locally | i.decla...
[ "def", "find_shadowed", "(", "self", ",", "extra", "=", "(", ")", ")", ":", "i", "=", "self", ".", "identifiers", "return", "(", "i", ".", "declared", "|", "i", ".", "outer_undeclared", ")", "&", "(", "i", ".", "declared_locally", "|", "i", ".", "d...
Find all the shadowed names. extra is an iterable of variables that may be defined with `add_special` which may occour scoped.
[ "Find", "all", "the", "shadowed", "names", ".", "extra", "is", "an", "iterable", "of", "variables", "that", "may", "be", "defined", "with", "add_special", "which", "may", "occour", "scoped", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L205-L212
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.blockvisit
def blockvisit(self, nodes, frame): """Visit a list of nodes as block in a frame. If the current frame is no buffer a dummy ``if 0: yield None`` is written automatically unless the force_generator parameter is set to False. """ if frame.buffer is None: self.writeline...
python
def blockvisit(self, nodes, frame): """Visit a list of nodes as block in a frame. If the current frame is no buffer a dummy ``if 0: yield None`` is written automatically unless the force_generator parameter is set to False. """ if frame.buffer is None: self.writeline...
[ "def", "blockvisit", "(", "self", ",", "nodes", ",", "frame", ")", ":", "if", "frame", ".", "buffer", "is", "None", ":", "self", ".", "writeline", "(", "'if 0: yield None'", ")", "else", ":", "self", ".", "writeline", "(", "'pass'", ")", "try", ":", ...
Visit a list of nodes as block in a frame. If the current frame is no buffer a dummy ``if 0: yield None`` is written automatically unless the force_generator parameter is set to False.
[ "Visit", "a", "list", "of", "nodes", "as", "block", "in", "a", "frame", ".", "If", "the", "current", "frame", "is", "no", "buffer", "a", "dummy", "if", "0", ":", "yield", "None", "is", "written", "automatically", "unless", "the", "force_generator", "para...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L482-L495
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.pull_locals
def pull_locals(self, frame): """Pull all the references identifiers into the local scope.""" for name in frame.identifiers.undeclared: self.writeline('l_%s = context.resolve(%r)' % (name, name))
python
def pull_locals(self, frame): """Pull all the references identifiers into the local scope.""" for name in frame.identifiers.undeclared: self.writeline('l_%s = context.resolve(%r)' % (name, name))
[ "def", "pull_locals", "(", "self", ",", "frame", ")", ":", "for", "name", "in", "frame", ".", "identifiers", ".", "undeclared", ":", "self", ".", "writeline", "(", "'l_%s = context.resolve(%r)'", "%", "(", "name", ",", "name", ")", ")" ]
Pull all the references identifiers into the local scope.
[ "Pull", "all", "the", "references", "identifiers", "into", "the", "local", "scope", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L577-L580
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.unoptimize_scope
def unoptimize_scope(self, frame): """Disable Python optimizations for the frame.""" # XXX: this is not that nice but it has no real overhead. It # mainly works because python finds the locals before dead code # is removed. If that breaks we have to add a dummy function # that ...
python
def unoptimize_scope(self, frame): """Disable Python optimizations for the frame.""" # XXX: this is not that nice but it has no real overhead. It # mainly works because python finds the locals before dead code # is removed. If that breaks we have to add a dummy function # that ...
[ "def", "unoptimize_scope", "(", "self", ",", "frame", ")", ":", "# XXX: this is not that nice but it has no real overhead. It", "# mainly works because python finds the locals before dead code", "# is removed. If that breaks we have to add a dummy function", "# that just accepts the argument...
Disable Python optimizations for the frame.
[ "Disable", "Python", "optimizations", "for", "the", "frame", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L595-L605
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.push_scope
def push_scope(self, frame, extra_vars=()): """This function returns all the shadowed variables in a dict in the form name: alias and will write the required assignments into the current scope. No indentation takes place. This also predefines locally declared variables from the loop ...
python
def push_scope(self, frame, extra_vars=()): """This function returns all the shadowed variables in a dict in the form name: alias and will write the required assignments into the current scope. No indentation takes place. This also predefines locally declared variables from the loop ...
[ "def", "push_scope", "(", "self", ",", "frame", ",", "extra_vars", "=", "(", ")", ")", ":", "aliases", "=", "{", "}", "for", "name", "in", "frame", ".", "find_shadowed", "(", "extra_vars", ")", ":", "aliases", "[", "name", "]", "=", "ident", "=", "...
This function returns all the shadowed variables in a dict in the form name: alias and will write the required assignments into the current scope. No indentation takes place. This also predefines locally declared variables from the loop body because under some circumstances it may be t...
[ "This", "function", "returns", "all", "the", "shadowed", "variables", "in", "a", "dict", "in", "the", "form", "name", ":", "alias", "and", "will", "write", "the", "required", "assignments", "into", "the", "current", "scope", ".", "No", "indentation", "takes"...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L607-L627
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.pop_scope
def pop_scope(self, aliases, frame): """Restore all aliases and delete unused variables.""" for name, alias in aliases.iteritems(): self.writeline('l_%s = %s' % (name, alias)) to_delete = set() for name in frame.identifiers.declared_locally: if name not in aliases...
python
def pop_scope(self, aliases, frame): """Restore all aliases and delete unused variables.""" for name, alias in aliases.iteritems(): self.writeline('l_%s = %s' % (name, alias)) to_delete = set() for name in frame.identifiers.declared_locally: if name not in aliases...
[ "def", "pop_scope", "(", "self", ",", "aliases", ",", "frame", ")", ":", "for", "name", ",", "alias", "in", "aliases", ".", "iteritems", "(", ")", ":", "self", ".", "writeline", "(", "'l_%s = %s'", "%", "(", "name", ",", "alias", ")", ")", "to_delete...
Restore all aliases and delete unused variables.
[ "Restore", "all", "aliases", "and", "delete", "unused", "variables", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L629-L641
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.function_scoping
def function_scoping(self, node, frame, children=None, find_special=True): """In Jinja a few statements require the help of anonymous functions. Those are currently macros and call blocks and in the future also recursive loops. As there is currently technical l...
python
def function_scoping(self, node, frame, children=None, find_special=True): """In Jinja a few statements require the help of anonymous functions. Those are currently macros and call blocks and in the future also recursive loops. As there is currently technical l...
[ "def", "function_scoping", "(", "self", ",", "node", ",", "frame", ",", "children", "=", "None", ",", "find_special", "=", "True", ")", ":", "# we have to iterate twice over it, make sure that works", "if", "children", "is", "None", ":", "children", "=", "node", ...
In Jinja a few statements require the help of anonymous functions. Those are currently macros and call blocks and in the future also recursive loops. As there is currently technical limitation that doesn't allow reading and writing a variable in a scope where the initial value is comin...
[ "In", "Jinja", "a", "few", "statements", "require", "the", "help", "of", "anonymous", "functions", ".", "Those", "are", "currently", "macros", "and", "call", "blocks", "and", "in", "the", "future", "also", "recursive", "loops", ".", "As", "there", "is", "c...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L643-L710
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.macro_body
def macro_body(self, node, frame, children=None): """Dump the function def of a macro or call block.""" frame = self.function_scoping(node, frame, children) # macros are delayed, they never require output checks frame.require_output_check = False args = frame.arguments # ...
python
def macro_body(self, node, frame, children=None): """Dump the function def of a macro or call block.""" frame = self.function_scoping(node, frame, children) # macros are delayed, they never require output checks frame.require_output_check = False args = frame.arguments # ...
[ "def", "macro_body", "(", "self", ",", "node", ",", "frame", ",", "children", "=", "None", ")", ":", "frame", "=", "self", ".", "function_scoping", "(", "node", ",", "frame", ",", "children", ")", "# macros are delayed, they never require output checks", "frame"...
Dump the function def of a macro or call block.
[ "Dump", "the", "function", "def", "of", "a", "macro", "or", "call", "block", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L712-L734
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.macro_def
def macro_def(self, node, frame): """Dump the macro definition for the def created by macro_body.""" arg_tuple = ', '.join(repr(x.name) for x in node.args) name = getattr(node, 'name', None) if len(node.args) == 1: arg_tuple += ',' self.write('Macro(environment, macro...
python
def macro_def(self, node, frame): """Dump the macro definition for the def created by macro_body.""" arg_tuple = ', '.join(repr(x.name) for x in node.args) name = getattr(node, 'name', None) if len(node.args) == 1: arg_tuple += ',' self.write('Macro(environment, macro...
[ "def", "macro_def", "(", "self", ",", "node", ",", "frame", ")", ":", "arg_tuple", "=", "', '", ".", "join", "(", "repr", "(", "x", ".", "name", ")", "for", "x", "in", "node", ".", "args", ")", "name", "=", "getattr", "(", "node", ",", "'name'", ...
Dump the macro definition for the def created by macro_body.
[ "Dump", "the", "macro", "definition", "for", "the", "def", "created", "by", "macro_body", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L736-L751
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.visit_Block
def visit_Block(self, node, frame): """Call a block and register it for the template.""" level = 1 if frame.toplevel: # if we know that we are a child template, there is no need to # check if we are one if self.has_known_extends: return ...
python
def visit_Block(self, node, frame): """Call a block and register it for the template.""" level = 1 if frame.toplevel: # if we know that we are a child template, there is no need to # check if we are one if self.has_known_extends: return ...
[ "def", "visit_Block", "(", "self", ",", "node", ",", "frame", ")", ":", "level", "=", "1", "if", "frame", ".", "toplevel", ":", "# if we know that we are a child template, there is no need to", "# check if we are one", "if", "self", ".", "has_known_extends", ":", "r...
Call a block and register it for the template.
[ "Call", "a", "block", "and", "register", "it", "for", "the", "template", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L861-L878
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py
CodeGenerator.visit_Import
def visit_Import(self, node, frame): """Visit regular imports.""" if node.with_context: self.unoptimize_scope(frame) self.writeline('l_%s = ' % node.target, node) if frame.toplevel: self.write('context.vars[%r] = ' % node.target) self.write('environment.ge...
python
def visit_Import(self, node, frame): """Visit regular imports.""" if node.with_context: self.unoptimize_scope(frame) self.writeline('l_%s = ' % node.target, node) if frame.toplevel: self.write('context.vars[%r] = ' % node.target) self.write('environment.ge...
[ "def", "visit_Import", "(", "self", ",", "node", ",", "frame", ")", ":", "if", "node", ".", "with_context", ":", "self", ".", "unoptimize_scope", "(", "frame", ")", "self", ".", "writeline", "(", "'l_%s = '", "%", "node", ".", "target", ",", "node", ")...
Visit regular imports.
[ "Visit", "regular", "imports", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/compiler.py#L969-L985
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py
safe_range
def safe_range(*args): """A range that can't generate ranges with a length of more than MAX_RANGE items. """ rng = xrange(*args) if len(rng) > MAX_RANGE: raise OverflowError('range too big, maximum size for range is %d' % MAX_RANGE) return rng
python
def safe_range(*args): """A range that can't generate ranges with a length of more than MAX_RANGE items. """ rng = xrange(*args) if len(rng) > MAX_RANGE: raise OverflowError('range too big, maximum size for range is %d' % MAX_RANGE) return rng
[ "def", "safe_range", "(", "*", "args", ")", ":", "rng", "=", "xrange", "(", "*", "args", ")", "if", "len", "(", "rng", ")", ">", "MAX_RANGE", ":", "raise", "OverflowError", "(", "'range too big, maximum size for range is %d'", "%", "MAX_RANGE", ")", "return"...
A range that can't generate ranges with a length of more than MAX_RANGE items.
[ "A", "range", "that", "can", "t", "generate", "ranges", "with", "a", "length", "of", "more", "than", "MAX_RANGE", "items", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py#L90-L98
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py
is_internal_attribute
def is_internal_attribute(obj, attr): """Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overriden. >>...
python
def is_internal_attribute(obj, attr): """Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overriden. >>...
[ "def", "is_internal_attribute", "(", "obj", ",", "attr", ")", ":", "if", "isinstance", "(", "obj", ",", "FunctionType", ")", ":", "if", "attr", "in", "UNSAFE_FUNCTION_ATTRIBUTES", ":", "return", "True", "elif", "isinstance", "(", "obj", ",", "MethodType", ")...
Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overriden. >>> from jinja2.sandbox import is_internal_attr...
[ "Test", "if", "the", "attribute", "given", "is", "an", "internal", "python", "attribute", ".", "For", "example", "this", "function", "returns", "True", "for", "the", "func_code", "attribute", "of", "python", "objects", ".", "This", "is", "useful", "if", "the...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py#L113-L142
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py
SandboxedEnvironment.getitem
def getitem(self, obj, argument): """Subscribe an object from sandboxed code.""" try: return obj[argument] except (TypeError, LookupError): if isinstance(argument, basestring): try: attr = str(argument) except: ...
python
def getitem(self, obj, argument): """Subscribe an object from sandboxed code.""" try: return obj[argument] except (TypeError, LookupError): if isinstance(argument, basestring): try: attr = str(argument) except: ...
[ "def", "getitem", "(", "self", ",", "obj", ",", "argument", ")", ":", "try", ":", "return", "obj", "[", "argument", "]", "except", "(", "TypeError", ",", "LookupError", ")", ":", "if", "isinstance", "(", "argument", ",", "basestring", ")", ":", "try", ...
Subscribe an object from sandboxed code.
[ "Subscribe", "an", "object", "from", "sandboxed", "code", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py#L207-L226
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py
SandboxedEnvironment.call
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" # the double prefixes are to avoid double keyword argument # errors when proxying the call. if not __self.is_safe_callable(__obj): raise SecurityError('%r is not safely callable' % ...
python
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" # the double prefixes are to avoid double keyword argument # errors when proxying the call. if not __self.is_safe_callable(__obj): raise SecurityError('%r is not safely callable' % ...
[ "def", "call", "(", "__self", ",", "__context", ",", "__obj", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# the double prefixes are to avoid double keyword argument", "# errors when proxying the call.", "if", "not", "__self", ".", "is_safe_callable", "(", ...
Call an object from sandboxed code.
[ "Call", "an", "object", "from", "sandboxed", "code", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py#L253-L259
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py
open_if_exists
def open_if_exists(filename, mode='rb'): """Returns a file descriptor for the filename if that file exists, otherwise `None`. """ try: return open(filename, mode) except IOError, e: if e.errno not in (errno.ENOENT, errno.EISDIR): raise
python
def open_if_exists(filename, mode='rb'): """Returns a file descriptor for the filename if that file exists, otherwise `None`. """ try: return open(filename, mode) except IOError, e: if e.errno not in (errno.ENOENT, errno.EISDIR): raise
[ "def", "open_if_exists", "(", "filename", ",", "mode", "=", "'rb'", ")", ":", "try", ":", "return", "open", "(", "filename", ",", "mode", ")", "except", "IOError", ",", "e", ":", "if", "e", ".", "errno", "not", "in", "(", "errno", ".", "ENOENT", ",...
Returns a file descriptor for the filename if that file exists, otherwise `None`.
[ "Returns", "a", "file", "descriptor", "for", "the", "filename", "if", "that", "file", "exists", "otherwise", "None", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py#L219-L227
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py
object_type_repr
def object_type_repr(obj): """Returns the name of the object's type. For some recognized singletons the name of the object is returned instead. (For example for `None` and `Ellipsis`). """ if obj is None: return 'None' elif obj is Ellipsis: return 'Ellipsis' if obj.__class__...
python
def object_type_repr(obj): """Returns the name of the object's type. For some recognized singletons the name of the object is returned instead. (For example for `None` and `Ellipsis`). """ if obj is None: return 'None' elif obj is Ellipsis: return 'Ellipsis' if obj.__class__...
[ "def", "object_type_repr", "(", "obj", ")", ":", "if", "obj", "is", "None", ":", "return", "'None'", "elif", "obj", "is", "Ellipsis", ":", "return", "'Ellipsis'", "if", "obj", ".", "__class__", ".", "__module__", "==", "'__builtin__'", ":", "name", "=", ...
Returns the name of the object's type. For some recognized singletons the name of the object is returned instead. (For example for `None` and `Ellipsis`).
[ "Returns", "the", "name", "of", "the", "object", "s", "type", ".", "For", "some", "recognized", "singletons", "the", "name", "of", "the", "object", "is", "returned", "instead", ".", "(", "For", "example", "for", "None", "and", "Ellipsis", ")", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py#L230-L243
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py
urlize
def urlize(text, trim_url_limit=None, nofollow=False): """Converts any URLs in text into clickable links. Works on http://, https:// and www. links. Links can have trailing punctuation (periods, commas, close-parens) and leading punctuation (opening parens) and it'll still do the right thing. If tr...
python
def urlize(text, trim_url_limit=None, nofollow=False): """Converts any URLs in text into clickable links. Works on http://, https:// and www. links. Links can have trailing punctuation (periods, commas, close-parens) and leading punctuation (opening parens) and it'll still do the right thing. If tr...
[ "def", "urlize", "(", "text", ",", "trim_url_limit", "=", "None", ",", "nofollow", "=", "False", ")", ":", "trim_url", "=", "lambda", "x", ",", "limit", "=", "trim_url_limit", ":", "limit", "is", "not", "None", "and", "(", "x", "[", ":", "limit", "]"...
Converts any URLs in text into clickable links. Works on http://, https:// and www. links. Links can have trailing punctuation (periods, commas, close-parens) and leading punctuation (opening parens) and it'll still do the right thing. If trim_url_limit is not None, the URLs in link text will be limite...
[ "Converts", "any", "URLs", "in", "text", "into", "clickable", "links", ".", "Works", "on", "http", ":", "//", "https", ":", "//", "and", "www", ".", "links", ".", "Links", "can", "have", "trailing", "punctuation", "(", "periods", "commas", "close", "-", ...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py#L258-L299
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py
generate_lorem_ipsum
def generate_lorem_ipsum(n=5, html=True, min=20, max=100): """Generate some lorem impsum for the template.""" from jinja2.constants import LOREM_IPSUM_WORDS from random import choice, randrange words = LOREM_IPSUM_WORDS.split() result = [] for _ in xrange(n): next_capitalized = True ...
python
def generate_lorem_ipsum(n=5, html=True, min=20, max=100): """Generate some lorem impsum for the template.""" from jinja2.constants import LOREM_IPSUM_WORDS from random import choice, randrange words = LOREM_IPSUM_WORDS.split() result = [] for _ in xrange(n): next_capitalized = True ...
[ "def", "generate_lorem_ipsum", "(", "n", "=", "5", ",", "html", "=", "True", ",", "min", "=", "20", ",", "max", "=", "100", ")", ":", "from", "jinja2", ".", "constants", "import", "LOREM_IPSUM_WORDS", "from", "random", "import", "choice", ",", "randrange...
Generate some lorem impsum for the template.
[ "Generate", "some", "lorem", "impsum", "for", "the", "template", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py#L302-L348
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py
Markup.unescape
def unescape(self): r"""Unescape markup again into an unicode string. This also resolves known HTML4 and XHTML entities: >>> Markup("Main &raquo; <em>About</em>").unescape() u'Main \xbb <em>About</em>' """ from jinja2.constants import HTML_ENTITIES def handle_ma...
python
def unescape(self): r"""Unescape markup again into an unicode string. This also resolves known HTML4 and XHTML entities: >>> Markup("Main &raquo; <em>About</em>").unescape() u'Main \xbb <em>About</em>' """ from jinja2.constants import HTML_ENTITIES def handle_ma...
[ "def", "unescape", "(", "self", ")", ":", "from", "jinja2", ".", "constants", "import", "HTML_ENTITIES", "def", "handle_match", "(", "m", ")", ":", "name", "=", "m", ".", "group", "(", "1", ")", "if", "name", "in", "HTML_ENTITIES", ":", "return", "unic...
r"""Unescape markup again into an unicode string. This also resolves known HTML4 and XHTML entities: >>> Markup("Main &raquo; <em>About</em>").unescape() u'Main \xbb <em>About</em>'
[ "r", "Unescape", "markup", "again", "into", "an", "unicode", "string", ".", "This", "also", "resolves", "known", "HTML4", "and", "XHTML", "entities", ":" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py#L452-L472
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py
Markup.striptags
def striptags(self): r"""Unescape markup into an unicode string and strip all tags. This also resolves known HTML4 and XHTML entities. Whitespace is normalized to one: >>> Markup("Main &raquo; <em>About</em>").striptags() u'Main \xbb About' """ stripped = u' '...
python
def striptags(self): r"""Unescape markup into an unicode string and strip all tags. This also resolves known HTML4 and XHTML entities. Whitespace is normalized to one: >>> Markup("Main &raquo; <em>About</em>").striptags() u'Main \xbb About' """ stripped = u' '...
[ "def", "striptags", "(", "self", ")", ":", "stripped", "=", "u' '", ".", "join", "(", "_striptags_re", ".", "sub", "(", "''", ",", "self", ")", ".", "split", "(", ")", ")", "return", "Markup", "(", "stripped", ")", ".", "unescape", "(", ")" ]
r"""Unescape markup into an unicode string and strip all tags. This also resolves known HTML4 and XHTML entities. Whitespace is normalized to one: >>> Markup("Main &raquo; <em>About</em>").striptags() u'Main \xbb About'
[ "r", "Unescape", "markup", "into", "an", "unicode", "string", "and", "strip", "all", "tags", ".", "This", "also", "resolves", "known", "HTML4", "and", "XHTML", "entities", ".", "Whitespace", "is", "normalized", "to", "one", ":" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py#L474-L483
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py
LRUCache._remove
def _remove(self, obj): """Python 2.4 compatibility.""" for idx, item in enumerate(self._queue): if item == obj: del self._queue[idx] break
python
def _remove(self, obj): """Python 2.4 compatibility.""" for idx, item in enumerate(self._queue): if item == obj: del self._queue[idx] break
[ "def", "_remove", "(", "self", ",", "obj", ")", ":", "for", "idx", ",", "item", "in", "enumerate", "(", "self", ".", "_queue", ")", ":", "if", "item", "==", "obj", ":", "del", "self", ".", "_queue", "[", "idx", "]", "break" ]
Python 2.4 compatibility.
[ "Python", "2", ".", "4", "compatibility", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py#L572-L577
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py
Cycler.next
def next(self): """Goes one item ahead and returns it.""" rv = self.current self.pos = (self.pos + 1) % len(self.items) return rv
python
def next(self): """Goes one item ahead and returns it.""" rv = self.current self.pos = (self.pos + 1) % len(self.items) return rv
[ "def", "next", "(", "self", ")", ":", "rv", "=", "self", ".", "current", "self", ".", "pos", "=", "(", "self", ".", "pos", "+", "1", ")", "%", "len", "(", "self", ".", "items", ")", "return", "rv" ]
Goes one item ahead and returns it.
[ "Goes", "one", "item", "ahead", "and", "returns", "it", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/utils.py#L757-L761
train
kivy/python-for-android
pythonforandroid/recipes/libtorrent/__init__.py
get_lib_from
def get_lib_from(search_directory, lib_extension='.so'): '''Scan directories recursively until find any file with the given extension. The default extension to search is ``.so``.''' for root, dirs, files in walk(search_directory): for file in files: if file.endswith(lib_extension): ...
python
def get_lib_from(search_directory, lib_extension='.so'): '''Scan directories recursively until find any file with the given extension. The default extension to search is ``.so``.''' for root, dirs, files in walk(search_directory): for file in files: if file.endswith(lib_extension): ...
[ "def", "get_lib_from", "(", "search_directory", ",", "lib_extension", "=", "'.so'", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "walk", "(", "search_directory", ")", ":", "for", "file", "in", "files", ":", "if", "file", ".", "endswith", "("...
Scan directories recursively until find any file with the given extension. The default extension to search is ``.so``.
[ "Scan", "directories", "recursively", "until", "find", "any", "file", "with", "the", "given", "extension", ".", "The", "default", "extension", "to", "search", "is", ".", "so", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/libtorrent/__init__.py#L12-L21
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/parser.py
Parser.parse_set
def parse_set(self): """Parse an assign statement.""" lineno = next(self.stream).lineno target = self.parse_assign_target() self.stream.expect('assign') expr = self.parse_tuple() return nodes.Assign(target, expr, lineno=lineno)
python
def parse_set(self): """Parse an assign statement.""" lineno = next(self.stream).lineno target = self.parse_assign_target() self.stream.expect('assign') expr = self.parse_tuple() return nodes.Assign(target, expr, lineno=lineno)
[ "def", "parse_set", "(", "self", ")", ":", "lineno", "=", "next", "(", "self", ".", "stream", ")", ".", "lineno", "target", "=", "self", ".", "parse_assign_target", "(", ")", "self", ".", "stream", ".", "expect", "(", "'assign'", ")", "expr", "=", "s...
Parse an assign statement.
[ "Parse", "an", "assign", "statement", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/parser.py#L168-L174
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/parser.py
Parser.parse_assign_target
def parse_assign_target(self, with_tuple=True, name_only=False, extra_end_rules=None): """Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tuples are parsed, that c...
python
def parse_assign_target(self, with_tuple=True, name_only=False, extra_end_rules=None): """Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tuples are parsed, that c...
[ "def", "parse_assign_target", "(", "self", ",", "with_tuple", "=", "True", ",", "name_only", "=", "False", ",", "extra_end_rules", "=", "None", ")", ":", "if", "name_only", ":", "token", "=", "self", ".", "stream", ".", "expect", "(", "'name'", ")", "tar...
Parse an assignment target. As Jinja2 allows assignments to tuples, this function can parse all allowed assignment targets. Per default assignments to tuples are parsed, that can be disable however by setting `with_tuple` to `False`. If only assignments to names are wanted `name_only`...
[ "Parse", "an", "assignment", "target", ".", "As", "Jinja2", "allows", "assignments", "to", "tuples", "this", "function", "can", "parse", "all", "allowed", "assignment", "targets", ".", "Per", "default", "assignments", "to", "tuples", "are", "parsed", "that", "...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/parser.py#L356-L378
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/parser.py
Parser.parse_tuple
def parse_tuple(self, simplified=False, with_condexpr=True, extra_end_rules=None, explicit_parentheses=False): """Works like `parse_expression` but if multiple expressions are delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created. This method could also return a...
python
def parse_tuple(self, simplified=False, with_condexpr=True, extra_end_rules=None, explicit_parentheses=False): """Works like `parse_expression` but if multiple expressions are delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created. This method could also return a...
[ "def", "parse_tuple", "(", "self", ",", "simplified", "=", "False", ",", "with_condexpr", "=", "True", ",", "extra_end_rules", "=", "None", ",", "explicit_parentheses", "=", "False", ")", ":", "lineno", "=", "self", ".", "stream", ".", "current", ".", "lin...
Works like `parse_expression` but if multiple expressions are delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created. This method could also return a regular expression instead of a tuple if no commas where found. The default parsing mode is a full tuple. If `simplified` i...
[ "Works", "like", "parse_expression", "but", "if", "multiple", "expressions", "are", "delimited", "by", "a", "comma", "a", ":", "class", ":", "~jinja2", ".", "nodes", ".", "Tuple", "node", "is", "created", ".", "This", "method", "could", "also", "return", "...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/parser.py#L577-L630
train
kivy/python-for-android
pythonforandroid/distribution.py
Distribution.get_distribution
def get_distribution(cls, ctx, name=None, recipes=[], ndk_api=None, force_build=False, extra_dist_dirs=[], require_perfect_match=False, allow_replace_dist=True): '''Takes information abou...
python
def get_distribution(cls, ctx, name=None, recipes=[], ndk_api=None, force_build=False, extra_dist_dirs=[], require_perfect_match=False, allow_replace_dist=True): '''Takes information abou...
[ "def", "get_distribution", "(", "cls", ",", "ctx", ",", "name", "=", "None", ",", "recipes", "=", "[", "]", ",", "ndk_api", "=", "None", ",", "force_build", "=", "False", ",", "extra_dist_dirs", "=", "[", "]", ",", "require_perfect_match", "=", "False", ...
Takes information about the distribution, and decides what kind of distribution it will be. If parameters conflict (e.g. a dist with that name already exists, but doesn't have the right set of recipes), an error is thrown. Parameters ---------- name : str ...
[ "Takes", "information", "about", "the", "distribution", "and", "decides", "what", "kind", "of", "distribution", "it", "will", "be", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/distribution.py#L45-L159
train
kivy/python-for-android
pythonforandroid/distribution.py
Distribution.get_distributions
def get_distributions(cls, ctx, extra_dist_dirs=[]): '''Returns all the distributions found locally.''' if extra_dist_dirs: raise BuildInterruptingException( 'extra_dist_dirs argument to get_distributions ' 'is not yet implemented') dist_dir = ctx.dist...
python
def get_distributions(cls, ctx, extra_dist_dirs=[]): '''Returns all the distributions found locally.''' if extra_dist_dirs: raise BuildInterruptingException( 'extra_dist_dirs argument to get_distributions ' 'is not yet implemented') dist_dir = ctx.dist...
[ "def", "get_distributions", "(", "cls", ",", "ctx", ",", "extra_dist_dirs", "=", "[", "]", ")", ":", "if", "extra_dist_dirs", ":", "raise", "BuildInterruptingException", "(", "'extra_dist_dirs argument to get_distributions '", "'is not yet implemented'", ")", "dist_dir", ...
Returns all the distributions found locally.
[ "Returns", "all", "the", "distributions", "found", "locally", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/distribution.py#L168-L204
train
kivy/python-for-android
pythonforandroid/distribution.py
Distribution.save_info
def save_info(self, dirn): ''' Save information about the distribution in its dist_dir. ''' with current_directory(dirn): info('Saving distribution info') with open('dist_info.json', 'w') as fileh: json.dump({'dist_name': self.ctx.dist_name, ...
python
def save_info(self, dirn): ''' Save information about the distribution in its dist_dir. ''' with current_directory(dirn): info('Saving distribution info') with open('dist_info.json', 'w') as fileh: json.dump({'dist_name': self.ctx.dist_name, ...
[ "def", "save_info", "(", "self", ",", "dirn", ")", ":", "with", "current_directory", "(", "dirn", ")", ":", "info", "(", "'Saving distribution info'", ")", "with", "open", "(", "'dist_info.json'", ",", "'w'", ")", "as", "fileh", ":", "json", ".", "dump", ...
Save information about the distribution in its dist_dir.
[ "Save", "information", "about", "the", "distribution", "in", "its", "dist_dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/distribution.py#L206-L221
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/bccache.py
Bucket.load_bytecode
def load_bytecode(self, f): """Loads bytecode from a file or file like object.""" # make sure the magic header is correct magic = f.read(len(bc_magic)) if magic != bc_magic: self.reset() return # the source code of the file changed, we need to reload ...
python
def load_bytecode(self, f): """Loads bytecode from a file or file like object.""" # make sure the magic header is correct magic = f.read(len(bc_magic)) if magic != bc_magic: self.reset() return # the source code of the file changed, we need to reload ...
[ "def", "load_bytecode", "(", "self", ",", "f", ")", ":", "# make sure the magic header is correct", "magic", "=", "f", ".", "read", "(", "len", "(", "bc_magic", ")", ")", "if", "magic", "!=", "bc_magic", ":", "self", ".", "reset", "(", ")", "return", "# ...
Loads bytecode from a file or file like object.
[ "Loads", "bytecode", "from", "a", "file", "or", "file", "like", "object", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/bccache.py#L53-L70
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/bccache.py
Bucket.write_bytecode
def write_bytecode(self, f): """Dump the bytecode into the file or file like object passed.""" if self.code is None: raise TypeError('can\'t write empty bucket') f.write(bc_magic) pickle.dump(self.checksum, f, 2) if isinstance(f, file): marshal.dump(self.c...
python
def write_bytecode(self, f): """Dump the bytecode into the file or file like object passed.""" if self.code is None: raise TypeError('can\'t write empty bucket') f.write(bc_magic) pickle.dump(self.checksum, f, 2) if isinstance(f, file): marshal.dump(self.c...
[ "def", "write_bytecode", "(", "self", ",", "f", ")", ":", "if", "self", ".", "code", "is", "None", ":", "raise", "TypeError", "(", "'can\\'t write empty bucket'", ")", "f", ".", "write", "(", "bc_magic", ")", "pickle", ".", "dump", "(", "self", ".", "c...
Dump the bytecode into the file or file like object passed.
[ "Dump", "the", "bytecode", "into", "the", "file", "or", "file", "like", "object", "passed", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/bccache.py#L72-L81
train
kivy/python-for-android
pythonforandroid/recipes/psycopg2/__init__.py
Psycopg2Recipe.install_python_package
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).''' if env is None: env = self.get_recipe_env(arch) with current_directory(self.get_buil...
python
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).''' if env is None: env = self.get_recipe_env(arch) with current_directory(self.get_buil...
[ "def", "install_python_package", "(", "self", ",", "arch", ",", "name", "=", "None", ",", "env", "=", "None", ",", "is_dir", "=", "True", ")", ":", "if", "env", "is", "None", ":", "env", "=", "self", ".", "get_recipe_env", "(", "arch", ")", "with", ...
Automate the installation of a Python package (or a cython package where the cython components are pre-built).
[ "Automate", "the", "installation", "of", "a", "Python", "package", "(", "or", "a", "cython", "package", "where", "the", "cython", "components", "are", "pre", "-", "built", ")", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/psycopg2/__init__.py#L34-L47
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py
translate_exception
def translate_exception(exc_info, initial_skip=0): """If passed an exc_info it will automatically rewrite the exceptions all the way down to the correct line numbers and frames. """ tb = exc_info[2] frames = [] # skip some internal frames if wanted for x in xrange(initial_skip): if ...
python
def translate_exception(exc_info, initial_skip=0): """If passed an exc_info it will automatically rewrite the exceptions all the way down to the correct line numbers and frames. """ tb = exc_info[2] frames = [] # skip some internal frames if wanted for x in xrange(initial_skip): if ...
[ "def", "translate_exception", "(", "exc_info", ",", "initial_skip", "=", "0", ")", ":", "tb", "=", "exc_info", "[", "2", "]", "frames", "=", "[", "]", "# skip some internal frames if wanted", "for", "x", "in", "xrange", "(", "initial_skip", ")", ":", "if", ...
If passed an exc_info it will automatically rewrite the exceptions all the way down to the correct line numbers and frames.
[ "If", "passed", "an", "exc_info", "it", "will", "automatically", "rewrite", "the", "exceptions", "all", "the", "way", "down", "to", "the", "correct", "line", "numbers", "and", "frames", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py#L123-L167
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py
fake_exc_info
def fake_exc_info(exc_info, filename, lineno): """Helper for `translate_exception`.""" exc_type, exc_value, tb = exc_info # figure the real context out if tb is not None: real_locals = tb.tb_frame.f_locals.copy() ctx = real_locals.get('context') if ctx: locals = ctx....
python
def fake_exc_info(exc_info, filename, lineno): """Helper for `translate_exception`.""" exc_type, exc_value, tb = exc_info # figure the real context out if tb is not None: real_locals = tb.tb_frame.f_locals.copy() ctx = real_locals.get('context') if ctx: locals = ctx....
[ "def", "fake_exc_info", "(", "exc_info", ",", "filename", ",", "lineno", ")", ":", "exc_type", ",", "exc_value", ",", "tb", "=", "exc_info", "# figure the real context out", "if", "tb", "is", "not", "None", ":", "real_locals", "=", "tb", ".", "tb_frame", "."...
Helper for `translate_exception`.
[ "Helper", "for", "translate_exception", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py#L170-L236
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py
_init_ugly_crap
def _init_ugly_crap(): """This function implements a few ugly things so that we can patch the traceback objects. The function returned allows resetting `tb_next` on any python traceback object. """ import ctypes from types import TracebackType # figure out side of _Py_ssize_t if hasatt...
python
def _init_ugly_crap(): """This function implements a few ugly things so that we can patch the traceback objects. The function returned allows resetting `tb_next` on any python traceback object. """ import ctypes from types import TracebackType # figure out side of _Py_ssize_t if hasatt...
[ "def", "_init_ugly_crap", "(", ")", ":", "import", "ctypes", "from", "types", "import", "TracebackType", "# figure out side of _Py_ssize_t", "if", "hasattr", "(", "ctypes", ".", "pythonapi", ",", "'Py_InitModule4_64'", ")", ":", "_Py_ssize_t", "=", "ctypes", ".", ...
This function implements a few ugly things so that we can patch the traceback objects. The function returned allows resetting `tb_next` on any python traceback object.
[ "This", "function", "implements", "a", "few", "ugly", "things", "so", "that", "we", "can", "patch", "the", "traceback", "objects", ".", "The", "function", "returned", "allows", "resetting", "tb_next", "on", "any", "python", "traceback", "object", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py#L239-L297
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py
ProcessedTraceback.chain_frames
def chain_frames(self): """Chains the frames. Requires ctypes or the speedups extension.""" prev_tb = None for tb in self.frames: if prev_tb is not None: prev_tb.tb_next = tb prev_tb = tb prev_tb.tb_next = None
python
def chain_frames(self): """Chains the frames. Requires ctypes or the speedups extension.""" prev_tb = None for tb in self.frames: if prev_tb is not None: prev_tb.tb_next = tb prev_tb = tb prev_tb.tb_next = None
[ "def", "chain_frames", "(", "self", ")", ":", "prev_tb", "=", "None", "for", "tb", "in", "self", ".", "frames", ":", "if", "prev_tb", "is", "not", "None", ":", "prev_tb", ".", "tb_next", "=", "tb", "prev_tb", "=", "tb", "prev_tb", ".", "tb_next", "="...
Chains the frames. Requires ctypes or the speedups extension.
[ "Chains", "the", "frames", ".", "Requires", "ctypes", "or", "the", "speedups", "extension", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py#L62-L69
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py
compile_rules
def compile_rules(environment): """Compiles all the rules from the environment into a list of rules.""" e = re.escape rules = [ (len(environment.comment_start_string), 'comment', e(environment.comment_start_string)), (len(environment.block_start_string), 'block', e(environm...
python
def compile_rules(environment): """Compiles all the rules from the environment into a list of rules.""" e = re.escape rules = [ (len(environment.comment_start_string), 'comment', e(environment.comment_start_string)), (len(environment.block_start_string), 'block', e(environm...
[ "def", "compile_rules", "(", "environment", ")", ":", "e", "=", "re", ".", "escape", "rules", "=", "[", "(", "len", "(", "environment", ".", "comment_start_string", ")", ",", "'comment'", ",", "e", "(", "environment", ".", "comment_start_string", ")", ")",...
Compiles all the rules from the environment into a list of rules.
[ "Compiles", "all", "the", "rules", "from", "the", "environment", "into", "a", "list", "of", "rules", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py#L186-L206
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py
TokenStream.look
def look(self): """Look at the next token.""" old_token = next(self) result = self.current self.push(result) self.current = old_token return result
python
def look(self): """Look at the next token.""" old_token = next(self) result = self.current self.push(result) self.current = old_token return result
[ "def", "look", "(", "self", ")", ":", "old_token", "=", "next", "(", "self", ")", "result", "=", "self", ".", "current", "self", ".", "push", "(", "result", ")", "self", ".", "current", "=", "old_token", "return", "result" ]
Look at the next token.
[ "Look", "at", "the", "next", "token", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py#L312-L318
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py
TokenStream.next
def next(self): """Go one token ahead and return the old one""" rv = self.current if self._pushed: self.current = self._pushed.popleft() elif self.current.type is not TOKEN_EOF: try: self.current = self._next() except StopIteration: ...
python
def next(self): """Go one token ahead and return the old one""" rv = self.current if self._pushed: self.current = self._pushed.popleft() elif self.current.type is not TOKEN_EOF: try: self.current = self._next() except StopIteration: ...
[ "def", "next", "(", "self", ")", ":", "rv", "=", "self", ".", "current", "if", "self", ".", "_pushed", ":", "self", ".", "current", "=", "self", ".", "_pushed", ".", "popleft", "(", ")", "elif", "self", ".", "current", ".", "type", "is", "not", "...
Go one token ahead and return the old one
[ "Go", "one", "token", "ahead", "and", "return", "the", "old", "one" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py#L336-L346
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py
TokenStream.close
def close(self): """Close the stream.""" self.current = Token(self.current.lineno, TOKEN_EOF, '') self._next = None self.closed = True
python
def close(self): """Close the stream.""" self.current = Token(self.current.lineno, TOKEN_EOF, '') self._next = None self.closed = True
[ "def", "close", "(", "self", ")", ":", "self", ".", "current", "=", "Token", "(", "self", ".", "current", ".", "lineno", ",", "TOKEN_EOF", ",", "''", ")", "self", ".", "_next", "=", "None", "self", ".", "closed", "=", "True" ]
Close the stream.
[ "Close", "the", "stream", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py#L348-L352
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py
TokenStream.expect
def expect(self, expr): """Expect a given token type and return it. This accepts the same argument as :meth:`jinja2.lexer.Token.test`. """ if not self.current.test(expr): expr = describe_token_expr(expr) if self.current.type is TOKEN_EOF: raise Te...
python
def expect(self, expr): """Expect a given token type and return it. This accepts the same argument as :meth:`jinja2.lexer.Token.test`. """ if not self.current.test(expr): expr = describe_token_expr(expr) if self.current.type is TOKEN_EOF: raise Te...
[ "def", "expect", "(", "self", ",", "expr", ")", ":", "if", "not", "self", ".", "current", ".", "test", "(", "expr", ")", ":", "expr", "=", "describe_token_expr", "(", "expr", ")", "if", "self", ".", "current", ".", "type", "is", "TOKEN_EOF", ":", "...
Expect a given token type and return it. This accepts the same argument as :meth:`jinja2.lexer.Token.test`.
[ "Expect", "a", "given", "token", "type", "and", "return", "it", ".", "This", "accepts", "the", "same", "argument", "as", ":", "meth", ":", "jinja2", ".", "lexer", ".", "Token", ".", "test", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py#L354-L372
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py
Lexer.tokeniter
def tokeniter(self, source, name, filename=None, state=None): """This method tokenizes the text and returns the tokens in a generator. Use this method if you just want to tokenize a template. """ source = '\n'.join(unicode(source).splitlines()) pos = 0 lineno = 1 ...
python
def tokeniter(self, source, name, filename=None, state=None): """This method tokenizes the text and returns the tokens in a generator. Use this method if you just want to tokenize a template. """ source = '\n'.join(unicode(source).splitlines()) pos = 0 lineno = 1 ...
[ "def", "tokeniter", "(", "self", ",", "source", ",", "name", ",", "filename", "=", "None", ",", "state", "=", "None", ")", ":", "source", "=", "'\\n'", ".", "join", "(", "unicode", "(", "source", ")", ".", "splitlines", "(", ")", ")", "pos", "=", ...
This method tokenizes the text and returns the tokens in a generator. Use this method if you just want to tokenize a template.
[ "This", "method", "tokenizes", "the", "text", "and", "returns", "the", "tokens", "in", "a", "generator", ".", "Use", "this", "method", "if", "you", "just", "want", "to", "tokenize", "a", "template", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/lexer.py#L547-L680
train
kivy/python-for-android
pythonforandroid/recipes/shapely/__init__.py
ShapelyRecipe.get_recipe_env
def get_recipe_env(self, arch, with_flags_in_cc=True): """ Add libgeos headers to path """ env = super(ShapelyRecipe, self).get_recipe_env(arch, with_flags_in_cc) libgeos_dir = Recipe.get_recipe('libgeos', self.ctx).get_build_dir(arch.arch) env['CFLAGS'] += " -I{}/dist/include".format(li...
python
def get_recipe_env(self, arch, with_flags_in_cc=True): """ Add libgeos headers to path """ env = super(ShapelyRecipe, self).get_recipe_env(arch, with_flags_in_cc) libgeos_dir = Recipe.get_recipe('libgeos', self.ctx).get_build_dir(arch.arch) env['CFLAGS'] += " -I{}/dist/include".format(li...
[ "def", "get_recipe_env", "(", "self", ",", "arch", ",", "with_flags_in_cc", "=", "True", ")", ":", "env", "=", "super", "(", "ShapelyRecipe", ",", "self", ")", ".", "get_recipe_env", "(", "arch", ",", "with_flags_in_cc", ")", "libgeos_dir", "=", "Recipe", ...
Add libgeos headers to path
[ "Add", "libgeos", "headers", "to", "path" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipes/shapely/__init__.py#L14-L19
train
kivy/python-for-android
pythonforandroid/recommendations.py
read_ndk_version
def read_ndk_version(ndk_dir): """Read the NDK version from the NDK dir, if possible""" try: with open(join(ndk_dir, 'source.properties')) as fileh: ndk_data = fileh.read() except IOError: info('Could not determine NDK version, no source.properties ' 'in the NDK dir'...
python
def read_ndk_version(ndk_dir): """Read the NDK version from the NDK dir, if possible""" try: with open(join(ndk_dir, 'source.properties')) as fileh: ndk_data = fileh.read() except IOError: info('Could not determine NDK version, no source.properties ' 'in the NDK dir'...
[ "def", "read_ndk_version", "(", "ndk_dir", ")", ":", "try", ":", "with", "open", "(", "join", "(", "ndk_dir", ",", "'source.properties'", ")", ")", "as", "fileh", ":", "ndk_data", "=", "fileh", ".", "read", "(", ")", "except", "IOError", ":", "info", "...
Read the NDK version from the NDK dir, if possible
[ "Read", "the", "NDK", "version", "from", "the", "NDK", "dir", "if", "possible" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recommendations.py#L38-L59
train
kivy/python-for-android
pythonforandroid/recommendations.py
check_target_api
def check_target_api(api, arch): """Warn if the user's target API is less than the current minimum recommendation """ if api >= ARMEABI_MAX_TARGET_API and arch == 'armeabi': raise BuildInterruptingException( 'Asked to build for armeabi architecture with API ' '{}, but AP...
python
def check_target_api(api, arch): """Warn if the user's target API is less than the current minimum recommendation """ if api >= ARMEABI_MAX_TARGET_API and arch == 'armeabi': raise BuildInterruptingException( 'Asked to build for armeabi architecture with API ' '{}, but AP...
[ "def", "check_target_api", "(", "api", ",", "arch", ")", ":", "if", "api", ">=", "ARMEABI_MAX_TARGET_API", "and", "arch", "==", "'armeabi'", ":", "raise", "BuildInterruptingException", "(", "'Asked to build for armeabi architecture with API '", "'{}, but API {} or greater d...
Warn if the user's target API is less than the current minimum recommendation
[ "Warn", "if", "the", "user", "s", "target", "API", "is", "less", "than", "the", "current", "minimum", "recommendation" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recommendations.py#L75-L89
train
kivy/python-for-android
pythonforandroid/recommendations.py
check_ndk_api
def check_ndk_api(ndk_api, android_api): """Warn if the user's NDK is too high or low.""" if ndk_api > android_api: raise BuildInterruptingException( 'Target NDK API is {}, higher than the target Android API {}.'.format( ndk_api, android_api), instructions=('The N...
python
def check_ndk_api(ndk_api, android_api): """Warn if the user's NDK is too high or low.""" if ndk_api > android_api: raise BuildInterruptingException( 'Target NDK API is {}, higher than the target Android API {}.'.format( ndk_api, android_api), instructions=('The N...
[ "def", "check_ndk_api", "(", "ndk_api", ",", "android_api", ")", ":", "if", "ndk_api", ">", "android_api", ":", "raise", "BuildInterruptingException", "(", "'Target NDK API is {}, higher than the target Android API {}.'", ".", "format", "(", "ndk_api", ",", "android_api",...
Warn if the user's NDK is too high or low.
[ "Warn", "if", "the", "user", "s", "NDK", "is", "too", "high", "or", "low", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recommendations.py#L97-L107
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/optimizer.py
Optimizer.visit_If
def visit_If(self, node): """Eliminate dead code.""" # do not optimize ifs that have a block inside so that it doesn't # break super(). if node.find(nodes.Block) is not None: return self.generic_visit(node) try: val = self.visit(node.test).as_const() ...
python
def visit_If(self, node): """Eliminate dead code.""" # do not optimize ifs that have a block inside so that it doesn't # break super(). if node.find(nodes.Block) is not None: return self.generic_visit(node) try: val = self.visit(node.test).as_const() ...
[ "def", "visit_If", "(", "self", ",", "node", ")", ":", "# do not optimize ifs that have a block inside so that it doesn't", "# break super().", "if", "node", ".", "find", "(", "nodes", ".", "Block", ")", "is", "not", "None", ":", "return", "self", ".", "generic_vi...
Eliminate dead code.
[ "Eliminate", "dead", "code", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/optimizer.py#L35-L52
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/optimizer.py
Optimizer.fold
def fold(self, node): """Do constant folding.""" node = self.generic_visit(node) try: return nodes.Const.from_untrusted(node.as_const(), lineno=node.lineno, environment=self.environment) ...
python
def fold(self, node): """Do constant folding.""" node = self.generic_visit(node) try: return nodes.Const.from_untrusted(node.as_const(), lineno=node.lineno, environment=self.environment) ...
[ "def", "fold", "(", "self", ",", "node", ")", ":", "node", "=", "self", ".", "generic_visit", "(", "node", ")", "try", ":", "return", "nodes", ".", "Const", ".", "from_untrusted", "(", "node", ".", "as_const", "(", ")", ",", "lineno", "=", "node", ...
Do constant folding.
[ "Do", "constant", "folding", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/optimizer.py#L54-L62
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_forceescape
def do_forceescape(value): """Enforce HTML escaping. This will probably double escape variables.""" if hasattr(value, '__html__'): value = value.__html__() return escape(unicode(value))
python
def do_forceescape(value): """Enforce HTML escaping. This will probably double escape variables.""" if hasattr(value, '__html__'): value = value.__html__() return escape(unicode(value))
[ "def", "do_forceescape", "(", "value", ")", ":", "if", "hasattr", "(", "value", ",", "'__html__'", ")", ":", "value", "=", "value", ".", "__html__", "(", ")", "return", "escape", "(", "unicode", "(", "value", ")", ")" ]
Enforce HTML escaping. This will probably double escape variables.
[ "Enforce", "HTML", "escaping", ".", "This", "will", "probably", "double", "escape", "variables", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L51-L55
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_replace
def do_replace(eval_ctx, s, old, new, count=None): """Return a copy of the value with all occurrences of a substring replaced with a new one. The first argument is the substring that should be replaced, the second is the replacement string. If the optional third argument ``count`` is given, only the fir...
python
def do_replace(eval_ctx, s, old, new, count=None): """Return a copy of the value with all occurrences of a substring replaced with a new one. The first argument is the substring that should be replaced, the second is the replacement string. If the optional third argument ``count`` is given, only the fir...
[ "def", "do_replace", "(", "eval_ctx", ",", "s", ",", "old", ",", "new", ",", "count", "=", "None", ")", ":", "if", "count", "is", "None", ":", "count", "=", "-", "1", "if", "not", "eval_ctx", ".", "autoescape", ":", "return", "unicode", "(", "s", ...
Return a copy of the value with all occurrences of a substring replaced with a new one. The first argument is the substring that should be replaced, the second is the replacement string. If the optional third argument ``count`` is given, only the first ``count`` occurrences are replaced: .. sourcec...
[ "Return", "a", "copy", "of", "the", "value", "with", "all", "occurrences", "of", "a", "substring", "replaced", "with", "a", "new", "one", ".", "The", "first", "argument", "is", "the", "substring", "that", "should", "be", "replaced", "the", "second", "is", ...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L59-L83
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_xmlattr
def do_xmlattr(_eval_ctx, d, autospace=True): """Create an SGML/XML attribute string based on the items in a dict. All values that are neither `none` nor `undefined` are automatically escaped: .. sourcecode:: html+jinja <ul{{ {'class': 'my_list', 'missing': none, 'id': 'list-%d...
python
def do_xmlattr(_eval_ctx, d, autospace=True): """Create an SGML/XML attribute string based on the items in a dict. All values that are neither `none` nor `undefined` are automatically escaped: .. sourcecode:: html+jinja <ul{{ {'class': 'my_list', 'missing': none, 'id': 'list-%d...
[ "def", "do_xmlattr", "(", "_eval_ctx", ",", "d", ",", "autospace", "=", "True", ")", ":", "rv", "=", "u' '", ".", "join", "(", "u'%s=\"%s\"'", "%", "(", "escape", "(", "key", ")", ",", "escape", "(", "value", ")", ")", "for", "key", ",", "value", ...
Create an SGML/XML attribute string based on the items in a dict. All values that are neither `none` nor `undefined` are automatically escaped: .. sourcecode:: html+jinja <ul{{ {'class': 'my_list', 'missing': none, 'id': 'list-%d'|format(variable)}|xmlattr }}> ... <...
[ "Create", "an", "SGML", "/", "XML", "attribute", "string", "based", "on", "the", "items", "in", "a", "dict", ".", "All", "values", "that", "are", "neither", "none", "nor", "undefined", "are", "automatically", "escaped", ":" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L97-L129
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_sort
def do_sort(value, case_sensitive=False): """Sort an iterable. If the iterable is made of strings the second parameter can be used to control the case sensitiveness of the comparison which is disabled by default. .. sourcecode:: jinja {% for item in iterable|sort %} ... {%...
python
def do_sort(value, case_sensitive=False): """Sort an iterable. If the iterable is made of strings the second parameter can be used to control the case sensitiveness of the comparison which is disabled by default. .. sourcecode:: jinja {% for item in iterable|sort %} ... {%...
[ "def", "do_sort", "(", "value", ",", "case_sensitive", "=", "False", ")", ":", "if", "not", "case_sensitive", ":", "def", "sort_func", "(", "item", ")", ":", "if", "isinstance", "(", "item", ",", "basestring", ")", ":", "item", "=", "item", ".", "lower...
Sort an iterable. If the iterable is made of strings the second parameter can be used to control the case sensitiveness of the comparison which is disabled by default. .. sourcecode:: jinja {% for item in iterable|sort %} ... {% endfor %}
[ "Sort", "an", "iterable", ".", "If", "the", "iterable", "is", "made", "of", "strings", "the", "second", "parameter", "can", "be", "used", "to", "control", "the", "case", "sensitiveness", "of", "the", "comparison", "which", "is", "disabled", "by", "default", ...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L179-L197
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_default
def do_default(value, default_value=u'', boolean=False): """If the value is undefined it will return the passed default value, otherwise the value of the variable: .. sourcecode:: jinja {{ my_variable|default('my_variable is not defined') }} This will output the value of ``my_variable`` if th...
python
def do_default(value, default_value=u'', boolean=False): """If the value is undefined it will return the passed default value, otherwise the value of the variable: .. sourcecode:: jinja {{ my_variable|default('my_variable is not defined') }} This will output the value of ``my_variable`` if th...
[ "def", "do_default", "(", "value", ",", "default_value", "=", "u''", ",", "boolean", "=", "False", ")", ":", "if", "(", "boolean", "and", "not", "value", ")", "or", "isinstance", "(", "value", ",", "Undefined", ")", ":", "return", "default_value", "retur...
If the value is undefined it will return the passed default value, otherwise the value of the variable: .. sourcecode:: jinja {{ my_variable|default('my_variable is not defined') }} This will output the value of ``my_variable`` if the variable was defined, otherwise ``'my_variable is not defi...
[ "If", "the", "value", "is", "undefined", "it", "will", "return", "the", "passed", "default", "value", "otherwise", "the", "value", "of", "the", "variable", ":" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L200-L219
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_join
def do_join(eval_ctx, value, d=u''): """Return a string which is the concatenation of the strings in the sequence. The separator between elements is an empty string per default, you can define it with the optional parameter: .. sourcecode:: jinja {{ [1, 2, 3]|join('|') }} -> 1|2|3 ...
python
def do_join(eval_ctx, value, d=u''): """Return a string which is the concatenation of the strings in the sequence. The separator between elements is an empty string per default, you can define it with the optional parameter: .. sourcecode:: jinja {{ [1, 2, 3]|join('|') }} -> 1|2|3 ...
[ "def", "do_join", "(", "eval_ctx", ",", "value", ",", "d", "=", "u''", ")", ":", "# no automatic escaping? joining is a lot eaiser then", "if", "not", "eval_ctx", ".", "autoescape", ":", "return", "unicode", "(", "d", ")", ".", "join", "(", "imap", "(", "un...
Return a string which is the concatenation of the strings in the sequence. The separator between elements is an empty string per default, you can define it with the optional parameter: .. sourcecode:: jinja {{ [1, 2, 3]|join('|') }} -> 1|2|3 {{ [1, 2, 3]|join }} ->...
[ "Return", "a", "string", "which", "is", "the", "concatenation", "of", "the", "strings", "in", "the", "sequence", ".", "The", "separator", "between", "elements", "is", "an", "empty", "string", "per", "default", "you", "can", "define", "it", "with", "the", "...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L223-L257
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_filesizeformat
def do_filesizeformat(value, binary=False): """Format the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc). Per default decimal prefixes are used (mega, giga, etc.), if the second parameter is set to `True` the binary prefixes are used (mebi, gibi). """ bytes = float...
python
def do_filesizeformat(value, binary=False): """Format the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc). Per default decimal prefixes are used (mega, giga, etc.), if the second parameter is set to `True` the binary prefixes are used (mebi, gibi). """ bytes = float...
[ "def", "do_filesizeformat", "(", "value", ",", "binary", "=", "False", ")", ":", "bytes", "=", "float", "(", "value", ")", "base", "=", "binary", "and", "1024", "or", "1000", "middle", "=", "binary", "and", "'i'", "or", "''", "if", "bytes", "<", "bas...
Format the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc). Per default decimal prefixes are used (mega, giga, etc.), if the second parameter is set to `True` the binary prefixes are used (mebi, gibi).
[ "Format", "the", "value", "like", "a", "human", "-", "readable", "file", "size", "(", "i", ".", "e", ".", "13", "KB", "4", ".", "1", "MB", "102", "bytes", "etc", ")", ".", "Per", "default", "decimal", "prefixes", "are", "used", "(", "mega", "giga",...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L292-L307
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_urlize
def do_urlize(eval_ctx, value, trim_url_limit=None, nofollow=False): """Converts URLs in plain text into clickable links. If you pass the filter an additional integer it will shorten the urls to that number. Also a third argument exists that makes the urls "nofollow": .. sourcecode:: jinja ...
python
def do_urlize(eval_ctx, value, trim_url_limit=None, nofollow=False): """Converts URLs in plain text into clickable links. If you pass the filter an additional integer it will shorten the urls to that number. Also a third argument exists that makes the urls "nofollow": .. sourcecode:: jinja ...
[ "def", "do_urlize", "(", "eval_ctx", ",", "value", ",", "trim_url_limit", "=", "None", ",", "nofollow", "=", "False", ")", ":", "rv", "=", "urlize", "(", "value", ",", "trim_url_limit", ",", "nofollow", ")", "if", "eval_ctx", ".", "autoescape", ":", "rv"...
Converts URLs in plain text into clickable links. If you pass the filter an additional integer it will shorten the urls to that number. Also a third argument exists that makes the urls "nofollow": .. sourcecode:: jinja {{ mytext|urlize(40, true) }} links are shortened to 40 chars ...
[ "Converts", "URLs", "in", "plain", "text", "into", "clickable", "links", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L320-L335
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_indent
def do_indent(s, width=4, indentfirst=False): """Return a copy of the passed string, each line indented by 4 spaces. The first line is not indented. If you want to change the number of spaces or indent the first line too you can pass additional parameters to the filter: .. sourcecode:: jinja ...
python
def do_indent(s, width=4, indentfirst=False): """Return a copy of the passed string, each line indented by 4 spaces. The first line is not indented. If you want to change the number of spaces or indent the first line too you can pass additional parameters to the filter: .. sourcecode:: jinja ...
[ "def", "do_indent", "(", "s", ",", "width", "=", "4", ",", "indentfirst", "=", "False", ")", ":", "indention", "=", "u' '", "*", "width", "rv", "=", "(", "u'\\n'", "+", "indention", ")", ".", "join", "(", "s", ".", "splitlines", "(", ")", ")", "i...
Return a copy of the passed string, each line indented by 4 spaces. The first line is not indented. If you want to change the number of spaces or indent the first line too you can pass additional parameters to the filter: .. sourcecode:: jinja {{ mytext|indent(2, true) }} indent by...
[ "Return", "a", "copy", "of", "the", "passed", "string", "each", "line", "indented", "by", "4", "spaces", ".", "The", "first", "line", "is", "not", "indented", ".", "If", "you", "want", "to", "change", "the", "number", "of", "spaces", "or", "indent", "t...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L338-L353
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_truncate
def do_truncate(s, length=255, killwords=False, end='...'): """Return a truncated copy of the string. The length is specified with the first parameter which defaults to ``255``. If the second parameter is ``true`` the filter will cut the text at length. Otherwise it will try to save the last word. If th...
python
def do_truncate(s, length=255, killwords=False, end='...'): """Return a truncated copy of the string. The length is specified with the first parameter which defaults to ``255``. If the second parameter is ``true`` the filter will cut the text at length. Otherwise it will try to save the last word. If th...
[ "def", "do_truncate", "(", "s", ",", "length", "=", "255", ",", "killwords", "=", "False", ",", "end", "=", "'...'", ")", ":", "if", "len", "(", "s", ")", "<=", "length", ":", "return", "s", "elif", "killwords", ":", "return", "s", "[", ":", "len...
Return a truncated copy of the string. The length is specified with the first parameter which defaults to ``255``. If the second parameter is ``true`` the filter will cut the text at length. Otherwise it will try to save the last word. If the text was in fact truncated it will append an ellipsis sign (`...
[ "Return", "a", "truncated", "copy", "of", "the", "string", ".", "The", "length", "is", "specified", "with", "the", "first", "parameter", "which", "defaults", "to", "255", ".", "If", "the", "second", "parameter", "is", "true", "the", "filter", "will", "cut"...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L356-L384
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_wordwrap
def do_wordwrap(s, width=79, break_long_words=True): """ Return a copy of the string passed to the filter wrapped after ``79`` characters. You can override this default using the first parameter. If you set the second parameter to `false` Jinja will not split words apart if they are longer than `w...
python
def do_wordwrap(s, width=79, break_long_words=True): """ Return a copy of the string passed to the filter wrapped after ``79`` characters. You can override this default using the first parameter. If you set the second parameter to `false` Jinja will not split words apart if they are longer than `w...
[ "def", "do_wordwrap", "(", "s", ",", "width", "=", "79", ",", "break_long_words", "=", "True", ")", ":", "import", "textwrap", "return", "u'\\n'", ".", "join", "(", "textwrap", ".", "wrap", "(", "s", ",", "width", "=", "width", ",", "expand_tabs", "=",...
Return a copy of the string passed to the filter wrapped after ``79`` characters. You can override this default using the first parameter. If you set the second parameter to `false` Jinja will not split words apart if they are longer than `width`.
[ "Return", "a", "copy", "of", "the", "string", "passed", "to", "the", "filter", "wrapped", "after", "79", "characters", ".", "You", "can", "override", "this", "default", "using", "the", "first", "parameter", ".", "If", "you", "set", "the", "second", "parame...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L387-L397
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_int
def do_int(value, default=0): """Convert the value into an integer. If the conversion doesn't work it will return ``0``. You can override this default using the first parameter. """ try: return int(value) except (TypeError, ValueError): # this quirk is necessary so that "42.23"|i...
python
def do_int(value, default=0): """Convert the value into an integer. If the conversion doesn't work it will return ``0``. You can override this default using the first parameter. """ try: return int(value) except (TypeError, ValueError): # this quirk is necessary so that "42.23"|i...
[ "def", "do_int", "(", "value", ",", "default", "=", "0", ")", ":", "try", ":", "return", "int", "(", "value", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "# this quirk is necessary so that \"42.23\"|int gives 42.", "try", ":", "return", "int"...
Convert the value into an integer. If the conversion doesn't work it will return ``0``. You can override this default using the first parameter.
[ "Convert", "the", "value", "into", "an", "integer", ".", "If", "the", "conversion", "doesn", "t", "work", "it", "will", "return", "0", ".", "You", "can", "override", "this", "default", "using", "the", "first", "parameter", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L405-L417
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_striptags
def do_striptags(value): """Strip SGML/XML tags and replace adjacent whitespace by one space. """ if hasattr(value, '__html__'): value = value.__html__() return Markup(unicode(value)).striptags()
python
def do_striptags(value): """Strip SGML/XML tags and replace adjacent whitespace by one space. """ if hasattr(value, '__html__'): value = value.__html__() return Markup(unicode(value)).striptags()
[ "def", "do_striptags", "(", "value", ")", ":", "if", "hasattr", "(", "value", ",", "'__html__'", ")", ":", "value", "=", "value", ".", "__html__", "(", ")", "return", "Markup", "(", "unicode", "(", "value", ")", ")", ".", "striptags", "(", ")" ]
Strip SGML/XML tags and replace adjacent whitespace by one space.
[ "Strip", "SGML", "/", "XML", "tags", "and", "replace", "adjacent", "whitespace", "by", "one", "space", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L451-L456
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
do_groupby
def do_groupby(environment, value, attribute): """Group a sequence of objects by a common attribute. If you for example have a list of dicts or objects that represent persons with `gender`, `first_name` and `last_name` attributes and you want to group all users by genders you can do something like the ...
python
def do_groupby(environment, value, attribute): """Group a sequence of objects by a common attribute. If you for example have a list of dicts or objects that represent persons with `gender`, `first_name` and `last_name` attributes and you want to group all users by genders you can do something like the ...
[ "def", "do_groupby", "(", "environment", ",", "value", ",", "attribute", ")", ":", "expr", "=", "lambda", "x", ":", "environment", ".", "getitem", "(", "x", ",", "attribute", ")", "return", "sorted", "(", "map", "(", "_GroupTuple", ",", "groupby", "(", ...
Group a sequence of objects by a common attribute. If you for example have a list of dicts or objects that represent persons with `gender`, `first_name` and `last_name` attributes and you want to group all users by genders you can do something like the following snippet: .. sourcecode:: html+jinja...
[ "Group", "a", "sequence", "of", "objects", "by", "a", "common", "attribute", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L575-L610
train
kivy/python-for-android
pythonforandroid/pythonpackage.py
extract_metainfo_files_from_package
def extract_metainfo_files_from_package( package, output_folder, debug=False ): """ Extracts metdata files from the given package to the given folder, which may be referenced in any way that is permitted in a requirements.txt file or install_requires=[] listing. ...
python
def extract_metainfo_files_from_package( package, output_folder, debug=False ): """ Extracts metdata files from the given package to the given folder, which may be referenced in any way that is permitted in a requirements.txt file or install_requires=[] listing. ...
[ "def", "extract_metainfo_files_from_package", "(", "package", ",", "output_folder", ",", "debug", "=", "False", ")", ":", "if", "package", "is", "None", ":", "raise", "ValueError", "(", "\"package cannot be None\"", ")", "if", "not", "os", ".", "path", ".", "e...
Extracts metdata files from the given package to the given folder, which may be referenced in any way that is permitted in a requirements.txt file or install_requires=[] listing. Current supported metadata files that will be extracted: - pytoml.yml (only if package wasn't obtained as ...
[ "Extracts", "metdata", "files", "from", "the", "given", "package", "to", "the", "given", "folder", "which", "may", "be", "referenced", "in", "any", "way", "that", "is", "permitted", "in", "a", "requirements", ".", "txt", "file", "or", "install_requires", "="...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/pythonpackage.py#L74-L143
train
kivy/python-for-android
pythonforandroid/pythonpackage.py
_get_system_python_executable
def _get_system_python_executable(): """ Returns the path the system-wide python binary. (In case we're running in a virtualenv or venv) """ # This function is required by get_package_as_folder() to work # inside a virtualenv, since venv creation will fail with # the virtualenv's local pytho...
python
def _get_system_python_executable(): """ Returns the path the system-wide python binary. (In case we're running in a virtualenv or venv) """ # This function is required by get_package_as_folder() to work # inside a virtualenv, since venv creation will fail with # the virtualenv's local pytho...
[ "def", "_get_system_python_executable", "(", ")", ":", "# This function is required by get_package_as_folder() to work", "# inside a virtualenv, since venv creation will fail with", "# the virtualenv's local python binary.", "# (venv/virtualenv incompatibility)", "# Abort if not in virtualenv or v...
Returns the path the system-wide python binary. (In case we're running in a virtualenv or venv)
[ "Returns", "the", "path", "the", "system", "-", "wide", "python", "binary", ".", "(", "In", "case", "we", "re", "running", "in", "a", "virtualenv", "or", "venv", ")" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/pythonpackage.py#L146-L231
train
kivy/python-for-android
pythonforandroid/pythonpackage.py
get_package_as_folder
def get_package_as_folder(dependency): """ This function downloads the given package / dependency and extracts the raw contents into a folder. Afterwards, it returns a tuple with the type of distribution obtained, and the temporary folder it extracted to. It is the caller's responsi...
python
def get_package_as_folder(dependency): """ This function downloads the given package / dependency and extracts the raw contents into a folder. Afterwards, it returns a tuple with the type of distribution obtained, and the temporary folder it extracted to. It is the caller's responsi...
[ "def", "get_package_as_folder", "(", "dependency", ")", ":", "venv_parent", "=", "tempfile", ".", "mkdtemp", "(", "prefix", "=", "\"pythonpackage-venv-\"", ")", "try", ":", "# Create a venv to install into:", "try", ":", "if", "int", "(", "sys", ".", "version", ...
This function downloads the given package / dependency and extracts the raw contents into a folder. Afterwards, it returns a tuple with the type of distribution obtained, and the temporary folder it extracted to. It is the caller's responsibility to delete the returned temp folder after...
[ "This", "function", "downloads", "the", "given", "package", "/", "dependency", "and", "extracts", "the", "raw", "contents", "into", "a", "folder", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/pythonpackage.py#L234-L386
train
kivy/python-for-android
pythonforandroid/pythonpackage.py
parse_as_folder_reference
def parse_as_folder_reference(dep): """ See if a dependency reference refers to a folder path. If it does, return the folder path (which parses and resolves file:// urls in the process). If it doesn't, return None. """ # Special case: pep508 urls if dep.find("@") > 0 and ( ...
python
def parse_as_folder_reference(dep): """ See if a dependency reference refers to a folder path. If it does, return the folder path (which parses and resolves file:// urls in the process). If it doesn't, return None. """ # Special case: pep508 urls if dep.find("@") > 0 and ( ...
[ "def", "parse_as_folder_reference", "(", "dep", ")", ":", "# Special case: pep508 urls", "if", "dep", ".", "find", "(", "\"@\"", ")", ">", "0", "and", "(", "(", "dep", ".", "find", "(", "\"@\"", ")", "<", "dep", ".", "find", "(", "\"/\"", ")", "or", ...
See if a dependency reference refers to a folder path. If it does, return the folder path (which parses and resolves file:// urls in the process). If it doesn't, return None.
[ "See", "if", "a", "dependency", "reference", "refers", "to", "a", "folder", "path", ".", "If", "it", "does", "return", "the", "folder", "path", "(", "which", "parses", "and", "resolves", "file", ":", "//", "urls", "in", "the", "process", ")", ".", "If"...
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/pythonpackage.py#L479-L501
train
kivy/python-for-android
pythonforandroid/pythonpackage.py
_extract_info_from_package
def _extract_info_from_package(dependency, extract_type=None, debug=False, include_build_requirements=False ): """ Internal function to extract metainfo from a package. Currently suppo...
python
def _extract_info_from_package(dependency, extract_type=None, debug=False, include_build_requirements=False ): """ Internal function to extract metainfo from a package. Currently suppo...
[ "def", "_extract_info_from_package", "(", "dependency", ",", "extract_type", "=", "None", ",", "debug", "=", "False", ",", "include_build_requirements", "=", "False", ")", ":", "output_folder", "=", "tempfile", ".", "mkdtemp", "(", "prefix", "=", "\"pythonpackage-...
Internal function to extract metainfo from a package. Currently supported info types: - name - dependencies (a list of dependencies)
[ "Internal", "function", "to", "extract", "metainfo", "from", "a", "package", ".", "Currently", "supported", "info", "types", ":" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/pythonpackage.py#L504-L554
train
kivy/python-for-android
pythonforandroid/pythonpackage.py
get_package_dependencies
def get_package_dependencies(package, recursive=False, verbose=False, include_build_requirements=False): """ Obtain the dependencies from a package. Please note this function is possibly SLOW, especially if you enable ...
python
def get_package_dependencies(package, recursive=False, verbose=False, include_build_requirements=False): """ Obtain the dependencies from a package. Please note this function is possibly SLOW, especially if you enable ...
[ "def", "get_package_dependencies", "(", "package", ",", "recursive", "=", "False", ",", "verbose", "=", "False", ",", "include_build_requirements", "=", "False", ")", ":", "packages_processed", "=", "set", "(", ")", "package_queue", "=", "[", "package", "]", "...
Obtain the dependencies from a package. Please note this function is possibly SLOW, especially if you enable the recursive mode.
[ "Obtain", "the", "dependencies", "from", "a", "package", ".", "Please", "note", "this", "function", "is", "possibly", "SLOW", "especially", "if", "you", "enable", "the", "recursive", "mode", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/pythonpackage.py#L578-L653
train
kivy/python-for-android
pythonforandroid/pythonpackage.py
get_dep_names_of_package
def get_dep_names_of_package( package, keep_version_pins=False, recursive=False, verbose=False, include_build_requirements=False ): """ Gets the dependencies from the package in the given folder, then attempts to deduce the actual package name resulting ...
python
def get_dep_names_of_package( package, keep_version_pins=False, recursive=False, verbose=False, include_build_requirements=False ): """ Gets the dependencies from the package in the given folder, then attempts to deduce the actual package name resulting ...
[ "def", "get_dep_names_of_package", "(", "package", ",", "keep_version_pins", "=", "False", ",", "recursive", "=", "False", ",", "verbose", "=", "False", ",", "include_build_requirements", "=", "False", ")", ":", "# First, obtain the dependencies:", "dependencies", "="...
Gets the dependencies from the package in the given folder, then attempts to deduce the actual package name resulting from each dependency line, stripping away everything else.
[ "Gets", "the", "dependencies", "from", "the", "package", "in", "the", "given", "folder", "then", "attempts", "to", "deduce", "the", "actual", "package", "name", "resulting", "from", "each", "dependency", "line", "stripping", "away", "everything", "else", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/pythonpackage.py#L656-L693
train
kivy/python-for-android
pythonforandroid/build.py
run_pymodules_install
def run_pymodules_install(ctx, modules, project_dir, ignore_setup_py=False): """ This function will take care of all non-recipe things, by: 1. Processing them from --requirements (the modules argument) and installing them 2. Installing the user project/app itself via setup.py if ...
python
def run_pymodules_install(ctx, modules, project_dir, ignore_setup_py=False): """ This function will take care of all non-recipe things, by: 1. Processing them from --requirements (the modules argument) and installing them 2. Installing the user project/app itself via setup.py if ...
[ "def", "run_pymodules_install", "(", "ctx", ",", "modules", ",", "project_dir", ",", "ignore_setup_py", "=", "False", ")", ":", "info", "(", "'*** PYTHON PACKAGE / PROJECT INSTALL STAGE ***'", ")", "modules", "=", "list", "(", "filter", "(", "ctx", ".", "not_has_p...
This function will take care of all non-recipe things, by: 1. Processing them from --requirements (the modules argument) and installing them 2. Installing the user project/app itself via setup.py if ignore_setup_py=True
[ "This", "function", "will", "take", "care", "of", "all", "non", "-", "recipe", "things", "by", ":" ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/build.py#L596-L806
train
kivy/python-for-android
pythonforandroid/build.py
Context.setup_dirs
def setup_dirs(self, storage_dir): '''Calculates all the storage and build dirs, and makes sure the directories exist where necessary.''' self.storage_dir = expanduser(storage_dir) if ' ' in self.storage_dir: raise ValueError('storage dir path cannot contain spaces, please ' ...
python
def setup_dirs(self, storage_dir): '''Calculates all the storage and build dirs, and makes sure the directories exist where necessary.''' self.storage_dir = expanduser(storage_dir) if ' ' in self.storage_dir: raise ValueError('storage dir path cannot contain spaces, please ' ...
[ "def", "setup_dirs", "(", "self", ",", "storage_dir", ")", ":", "self", ".", "storage_dir", "=", "expanduser", "(", "storage_dir", ")", "if", "' '", "in", "self", ".", "storage_dir", ":", "raise", "ValueError", "(", "'storage dir path cannot contain spaces, please...
Calculates all the storage and build dirs, and makes sure the directories exist where necessary.
[ "Calculates", "all", "the", "storage", "and", "build", "dirs", "and", "makes", "sure", "the", "directories", "exist", "where", "necessary", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/build.py#L107-L115
train
kivy/python-for-android
pythonforandroid/build.py
Context.prepare_build_environment
def prepare_build_environment(self, user_sdk_dir, user_ndk_dir, user_android_api, user_ndk_api): '''Checks that build dependencies exist and sets internal variables for...
python
def prepare_build_environment(self, user_sdk_dir, user_ndk_dir, user_android_api, user_ndk_api): '''Checks that build dependencies exist and sets internal variables for...
[ "def", "prepare_build_environment", "(", "self", ",", "user_sdk_dir", ",", "user_ndk_dir", ",", "user_android_api", ",", "user_ndk_api", ")", ":", "self", ".", "ensure_dirs", "(", ")", "if", "self", ".", "_build_env_prepared", ":", "return", "ok", "=", "True", ...
Checks that build dependencies exist and sets internal variables for the Android SDK etc. ..warning:: This *must* be called before trying any build stuff
[ "Checks", "that", "build", "dependencies", "exist", "and", "sets", "internal", "variables", "for", "the", "Android", "SDK", "etc", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/build.py#L176-L409
train
kivy/python-for-android
pythonforandroid/build.py
Context.get_site_packages_dir
def get_site_packages_dir(self, arch=None): '''Returns the location of site-packages in the python-install build dir. ''' if self.python_recipe.name == 'python2legacy': return join(self.get_python_install_dir(), 'lib', 'python2.7', 'site-packages') ...
python
def get_site_packages_dir(self, arch=None): '''Returns the location of site-packages in the python-install build dir. ''' if self.python_recipe.name == 'python2legacy': return join(self.get_python_install_dir(), 'lib', 'python2.7', 'site-packages') ...
[ "def", "get_site_packages_dir", "(", "self", ",", "arch", "=", "None", ")", ":", "if", "self", ".", "python_recipe", ".", "name", "==", "'python2legacy'", ":", "return", "join", "(", "self", ".", "get_python_install_dir", "(", ")", ",", "'lib'", ",", "'pyt...
Returns the location of site-packages in the python-install build dir.
[ "Returns", "the", "location", "of", "site", "-", "packages", "in", "the", "python", "-", "install", "build", "dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/build.py#L470-L477
train