Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
run
( async_fn, *args, clock=None, instruments=(), restrict_keyboard_interrupt_to_checkpoints=False, )
Run a Trio-flavored async function, and return the result. Calling:: run(async_fn, *args) is the equivalent of:: await async_fn(*args) except that :func:`run` can (and must) be called from a synchronous context. This is Trio's main entry point. Almost every other function in Trio...
Run a Trio-flavored async function, and return the result.
def run( async_fn, *args, clock=None, instruments=(), restrict_keyboard_interrupt_to_checkpoints=False, ): """Run a Trio-flavored async function, and return the result. Calling:: run(async_fn, *args) is the equivalent of:: await async_fn(*args) except that :func:`r...
[ "def", "run", "(", "async_fn", ",", "*", "args", ",", "clock", "=", "None", ",", "instruments", "=", "(", ")", ",", "restrict_keyboard_interrupt_to_checkpoints", "=", "False", ",", ")", ":", "__tracebackhide__", "=", "True", "runner", "=", "setup_runner", "(...
[ 1842, 0 ]
[ 1936, 44 ]
python
en
['en', 'en', 'en']
True
start_guest_run
( async_fn, *args, run_sync_soon_threadsafe, done_callback, run_sync_soon_not_threadsafe=None, host_uses_signal_set_wakeup_fd=False, clock=None, instruments=(), restrict_keyboard_interrupt_to_checkpoints=False, )
Start a "guest" run of Trio on top of some other "host" event loop. Each host loop can only have one guest run at a time. You should always let the Trio run finish before stopping the host loop; if not, it may leave Trio's internal data structures in an inconsistent state. You might be able to get awa...
Start a "guest" run of Trio on top of some other "host" event loop.
def start_guest_run( async_fn, *args, run_sync_soon_threadsafe, done_callback, run_sync_soon_not_threadsafe=None, host_uses_signal_set_wakeup_fd=False, clock=None, instruments=(), restrict_keyboard_interrupt_to_checkpoints=False, ): """Start a "guest" run of Trio on top of some o...
[ "def", "start_guest_run", "(", "async_fn", ",", "*", "args", ",", "run_sync_soon_threadsafe", ",", "done_callback", ",", "run_sync_soon_not_threadsafe", "=", "None", ",", "host_uses_signal_set_wakeup_fd", "=", "False", ",", "clock", "=", "None", ",", "instruments", ...
[ 1939, 0 ]
[ 2020, 56 ]
python
en
['en', 'en', 'en']
True
current_task
()
Return the :class:`Task` object representing the current task. Returns: Task: the :class:`Task` that called :func:`current_task`.
Return the :class:`Task` object representing the current task.
def current_task(): """Return the :class:`Task` object representing the current task. Returns: Task: the :class:`Task` that called :func:`current_task`. """ try: return GLOBAL_RUN_CONTEXT.task except AttributeError: raise RuntimeError("must be called from async context") fro...
[ "def", "current_task", "(", ")", ":", "try", ":", "return", "GLOBAL_RUN_CONTEXT", ".", "task", "except", "AttributeError", ":", "raise", "RuntimeError", "(", "\"must be called from async context\"", ")", "from", "None" ]
[ 2264, 0 ]
[ 2275, 73 ]
python
en
['en', 'en', 'en']
True
current_effective_deadline
()
Returns the current effective deadline for the current task. This function examines all the cancellation scopes that are currently in effect (taking into account shielding), and returns the deadline that will expire first. One example of where this might be is useful is if your code is trying to d...
Returns the current effective deadline for the current task.
def current_effective_deadline(): """Returns the current effective deadline for the current task. This function examines all the cancellation scopes that are currently in effect (taking into account shielding), and returns the deadline that will expire first. One example of where this might be is ...
[ "def", "current_effective_deadline", "(", ")", ":", "return", "current_task", "(", ")", ".", "_cancel_status", ".", "effective_deadline", "(", ")" ]
[ 2278, 0 ]
[ 2302, 61 ]
python
en
['en', 'en', 'en']
True
checkpoint
()
A pure :ref:`checkpoint <checkpoints>`. This checks for cancellation and allows other tasks to be scheduled, without otherwise blocking. Note that the scheduler has the option of ignoring this and continuing to run the current task if it decides this is appropriate (e.g. for increased efficiency)....
A pure :ref:`checkpoint <checkpoints>`.
async def checkpoint(): """A pure :ref:`checkpoint <checkpoints>`. This checks for cancellation and allows other tasks to be scheduled, without otherwise blocking. Note that the scheduler has the option of ignoring this and continuing to run the current task if it decides this is appropriate (e.g....
[ "async", "def", "checkpoint", "(", ")", ":", "# The scheduler is what checks timeouts and converts them into", "# cancellations. So by doing the schedule point first, we ensure that the", "# cancel point has the most up-to-date info.", "await", "cancel_shielded_checkpoint", "(", ")", "task...
[ 2305, 0 ]
[ 2329, 78 ]
python
en
['en', 'en', 'en']
True
checkpoint_if_cancelled
()
Issue a :ref:`checkpoint <checkpoints>` if the calling context has been cancelled. Equivalent to (but potentially more efficient than):: if trio.current_deadline() == -inf: await trio.lowlevel.checkpoint() This is either a no-op, or else it allow other tasks to be scheduled and th...
Issue a :ref:`checkpoint <checkpoints>` if the calling context has been cancelled.
async def checkpoint_if_cancelled(): """Issue a :ref:`checkpoint <checkpoints>` if the calling context has been cancelled. Equivalent to (but potentially more efficient than):: if trio.current_deadline() == -inf: await trio.lowlevel.checkpoint() This is either a no-op, or else it ...
[ "async", "def", "checkpoint_if_cancelled", "(", ")", ":", "task", "=", "current_task", "(", ")", "if", "task", ".", "_cancel_status", ".", "effectively_cancelled", "or", "(", "task", "is", "task", ".", "_runner", ".", "main_task", "and", "task", ".", "_runne...
[ 2332, 0 ]
[ 2353, 28 ]
python
en
['en', 'en', 'en']
True
Nursery.child_tasks
(self)
(`frozenset`): Contains all the child :class:`~trio.lowlevel.Task` objects which are still running.
(`frozenset`): Contains all the child :class:`~trio.lowlevel.Task` objects which are still running.
def child_tasks(self): """(`frozenset`): Contains all the child :class:`~trio.lowlevel.Task` objects which are still running.""" return frozenset(self._children)
[ "def", "child_tasks", "(", "self", ")", ":", "return", "frozenset", "(", "self", ".", "_children", ")" ]
[ 883, 4 ]
[ 886, 40 ]
python
en
['en', 'en', 'en']
True
Nursery.parent_task
(self)
(`~trio.lowlevel.Task`): The Task that opened this nursery.
(`~trio.lowlevel.Task`): The Task that opened this nursery.
def parent_task(self): "(`~trio.lowlevel.Task`): The Task that opened this nursery." return self._parent_task
[ "def", "parent_task", "(", "self", ")", ":", "return", "self", ".", "_parent_task" ]
[ 889, 4 ]
[ 891, 32 ]
python
en
['en', 'en', 'en']
True
Nursery._nested_child_finished
(self, nested_child_exc)
Returns MultiError instance if there are pending exceptions.
Returns MultiError instance if there are pending exceptions.
async def _nested_child_finished(self, nested_child_exc): """Returns MultiError instance if there are pending exceptions.""" if nested_child_exc is not None: self._add_exc(nested_child_exc) self._nested_child_running = False self._check_nursery_closed() if not self._...
[ "async", "def", "_nested_child_finished", "(", "self", ",", "nested_child_exc", ")", ":", "if", "nested_child_exc", "is", "not", "None", ":", "self", ".", "_add_exc", "(", "nested_child_exc", ")", "self", ".", "_nested_child_running", "=", "False", "self", ".", ...
[ 910, 4 ]
[ 939, 49 ]
python
en
['en', 'en', 'en']
True
Nursery.start_soon
(self, async_fn, *args, name=None)
Creates a child task, scheduling ``await async_fn(*args)``. This and :meth:`start` are the two fundamental methods for creating concurrent tasks in Trio. Note that this is *not* an async function and you don't use await when calling it. It sets up the new task, but then returns ...
Creates a child task, scheduling ``await async_fn(*args)``.
def start_soon(self, async_fn, *args, name=None): """Creates a child task, scheduling ``await async_fn(*args)``. This and :meth:`start` are the two fundamental methods for creating concurrent tasks in Trio. Note that this is *not* an async function and you don't use await when ...
[ "def", "start_soon", "(", "self", ",", "async_fn", ",", "*", "args", ",", "name", "=", "None", ")", ":", "GLOBAL_RUN_CONTEXT", ".", "runner", ".", "spawn_impl", "(", "async_fn", ",", "args", ",", "self", ",", "name", ")" ]
[ 941, 4 ]
[ 982, 72 ]
python
en
['en', 'en', 'en']
True
Nursery.start
(self, async_fn, *args, name=None)
r"""Creates and initalizes a child task. Like :meth:`start_soon`, but blocks until the new task has finished initializing itself, and optionally returns some information from it. The ``async_fn`` must accept a ``task_status`` keyword argument, and it must make sure that it (or ...
r"""Creates and initalizes a child task.
async def start(self, async_fn, *args, name=None): r"""Creates and initalizes a child task. Like :meth:`start_soon`, but blocks until the new task has finished initializing itself, and optionally returns some information from it. The ``async_fn`` must accept a ``task_status`` k...
[ "async", "def", "start", "(", "self", ",", "async_fn", ",", "*", "args", ",", "name", "=", "None", ")", ":", "if", "self", ".", "_closed", ":", "raise", "RuntimeError", "(", "\"Nursery is closed to new arrivals\"", ")", "try", ":", "self", ".", "_pending_s...
[ 984, 4 ]
[ 1046, 40 ]
python
en
['en', 'en', 'en']
True
CalculateVariables
(default_variables, params)
Calculate additional variables for use in the build (called by gyp).
Calculate additional variables for use in the build (called by gyp).
def CalculateVariables(default_variables, params): """Calculate additional variables for use in the build (called by gyp).""" flavor = gyp.common.GetFlavor(params) if flavor == 'mac': default_variables.setdefault('OS', 'mac') default_variables.setdefault('SHARED_LIB_SUFFIX', '.dylib') default_variable...
[ "def", "CalculateVariables", "(", "default_variables", ",", "params", ")", ":", "flavor", "=", "gyp", ".", "common", ".", "GetFlavor", "(", "params", ")", "if", "flavor", "==", "'mac'", ":", "default_variables", ".", "setdefault", "(", "'OS'", ",", "'mac'", ...
[ 65, 0 ]
[ 99, 64 ]
python
en
['en', 'en', 'en']
True
CalculateGeneratorInputInfo
(params)
Calculate the generator specific info that gets fed to input (called by gyp).
Calculate the generator specific info that gets fed to input (called by gyp).
def CalculateGeneratorInputInfo(params): """Calculate the generator specific info that gets fed to input (called by gyp).""" generator_flags = params.get('generator_flags', {}) android_ndk_version = generator_flags.get('android_ndk_version', None) # Android NDK requires a strict link order. if android_ndk_v...
[ "def", "CalculateGeneratorInputInfo", "(", "params", ")", ":", "generator_flags", "=", "params", ".", "get", "(", "'generator_flags'", ",", "{", "}", ")", "android_ndk_version", "=", "generator_flags", ".", "get", "(", "'android_ndk_version'", ",", "None", ")", ...
[ 102, 0 ]
[ 122, 3 ]
python
en
['en', 'en', 'en']
True
Compilable
(filename)
Return true if the file is compilable (should be in OBJS).
Return true if the file is compilable (should be in OBJS).
def Compilable(filename): """Return true if the file is compilable (should be in OBJS).""" for res in (filename.endswith(e) for e in COMPILABLE_EXTENSIONS): if res: return True return False
[ "def", "Compilable", "(", "filename", ")", ":", "for", "res", "in", "(", "filename", ".", "endswith", "(", "e", ")", "for", "e", "in", "COMPILABLE_EXTENSIONS", ")", ":", "if", "res", ":", "return", "True", "return", "False" ]
[ 582, 0 ]
[ 587, 14 ]
python
en
['en', 'en', 'en']
True
Linkable
(filename)
Return true if the file is linkable (should be on the link line).
Return true if the file is linkable (should be on the link line).
def Linkable(filename): """Return true if the file is linkable (should be on the link line).""" return filename.endswith('.o')
[ "def", "Linkable", "(", "filename", ")", ":", "return", "filename", ".", "endswith", "(", "'.o'", ")" ]
[ 590, 0 ]
[ 592, 32 ]
python
en
['en', 'en', 'en']
True
Target
(filename)
Translate a compilable filename to its .o target.
Translate a compilable filename to its .o target.
def Target(filename): """Translate a compilable filename to its .o target.""" return os.path.splitext(filename)[0] + '.o'
[ "def", "Target", "(", "filename", ")", ":", "return", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "0", "]", "+", "'.o'" ]
[ 595, 0 ]
[ 597, 45 ]
python
en
['en', 'en', 'en']
True
EscapeShellArgument
(s)
Quotes an argument so that it will be interpreted literally by a POSIX shell. Taken from http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
Quotes an argument so that it will be interpreted literally by a POSIX shell. Taken from http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
def EscapeShellArgument(s): """Quotes an argument so that it will be interpreted literally by a POSIX shell. Taken from http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python """ return "'" + s.replace("'", "'\\''") + "'"
[ "def", "EscapeShellArgument", "(", "s", ")", ":", "return", "\"'\"", "+", "s", ".", "replace", "(", "\"'\"", ",", "\"'\\\\''\"", ")", "+", "\"'\"" ]
[ 600, 0 ]
[ 605, 44 ]
python
en
['en', 'en', 'en']
True
EscapeMakeVariableExpansion
(s)
Make has its own variable expansion syntax using $. We must escape it for string to be interpreted literally.
Make has its own variable expansion syntax using $. We must escape it for string to be interpreted literally.
def EscapeMakeVariableExpansion(s): """Make has its own variable expansion syntax using $. We must escape it for string to be interpreted literally.""" return s.replace('$', '$$')
[ "def", "EscapeMakeVariableExpansion", "(", "s", ")", ":", "return", "s", ".", "replace", "(", "'$'", ",", "'$$'", ")" ]
[ 608, 0 ]
[ 611, 29 ]
python
en
['en', 'en', 'en']
True
EscapeCppDefine
(s)
Escapes a CPP define so that it will reach the compiler unaltered.
Escapes a CPP define so that it will reach the compiler unaltered.
def EscapeCppDefine(s): """Escapes a CPP define so that it will reach the compiler unaltered.""" s = EscapeShellArgument(s) s = EscapeMakeVariableExpansion(s) # '#' characters must be escaped even embedded in a string, else Make will # treat it as the start of a comment. return s.replace('#', r'\#')
[ "def", "EscapeCppDefine", "(", "s", ")", ":", "s", "=", "EscapeShellArgument", "(", "s", ")", "s", "=", "EscapeMakeVariableExpansion", "(", "s", ")", "# '#' characters must be escaped even embedded in a string, else Make will", "# treat it as the start of a comment.", "return...
[ 614, 0 ]
[ 620, 30 ]
python
en
['en', 'en', 'en']
True
QuoteIfNecessary
(string)
TODO: Should this ideally be replaced with one or more of the above functions?
TODO: Should this ideally be replaced with one or more of the above functions?
def QuoteIfNecessary(string): """TODO: Should this ideally be replaced with one or more of the above functions?""" if '"' in string: string = '"' + string.replace('"', '\\"') + '"' return string
[ "def", "QuoteIfNecessary", "(", "string", ")", ":", "if", "'\"'", "in", "string", ":", "string", "=", "'\"'", "+", "string", ".", "replace", "(", "'\"'", ",", "'\\\\\"'", ")", "+", "'\"'", "return", "string" ]
[ 623, 0 ]
[ 628, 15 ]
python
en
['en', 'en', 'en']
True
StringToMakefileVariable
(string)
Convert a string to a value that is acceptable as a make variable name.
Convert a string to a value that is acceptable as a make variable name.
def StringToMakefileVariable(string): """Convert a string to a value that is acceptable as a make variable name.""" return re.sub('[^a-zA-Z0-9_]', '_', string)
[ "def", "StringToMakefileVariable", "(", "string", ")", ":", "return", "re", ".", "sub", "(", "'[^a-zA-Z0-9_]'", ",", "'_'", ",", "string", ")" ]
[ 631, 0 ]
[ 633, 45 ]
python
en
['en', 'en', 'en']
True
Sourceify
(path)
Convert a path to its source directory form.
Convert a path to its source directory form.
def Sourceify(path): """Convert a path to its source directory form.""" if '$(' in path: return path if os.path.isabs(path): return path return srcdir_prefix + path
[ "def", "Sourceify", "(", "path", ")", ":", "if", "'$('", "in", "path", ":", "return", "path", "if", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "return", "path", "return", "srcdir_prefix", "+", "path" ]
[ 637, 0 ]
[ 643, 29 ]
python
en
['en', 'en', 'en']
True
SourceifyAndQuoteSpaces
(path)
Convert a path to its source directory form and quote spaces.
Convert a path to its source directory form and quote spaces.
def SourceifyAndQuoteSpaces(path): """Convert a path to its source directory form and quote spaces.""" return QuoteSpaces(Sourceify(path))
[ "def", "SourceifyAndQuoteSpaces", "(", "path", ")", ":", "return", "QuoteSpaces", "(", "Sourceify", "(", "path", ")", ")" ]
[ 649, 0 ]
[ 651, 37 ]
python
en
['en', 'en', 'en']
True
_ValidateSourcesForOSX
(spec, all_sources)
Makes sure if duplicate basenames are not specified in the source list. Arguments: spec: The target dictionary containing the properties of the target.
Makes sure if duplicate basenames are not specified in the source list.
def _ValidateSourcesForOSX(spec, all_sources): """Makes sure if duplicate basenames are not specified in the source list. Arguments: spec: The target dictionary containing the properties of the target. """ if spec.get('type', None) != 'static_library': return basenames = {} for source in all_sourc...
[ "def", "_ValidateSourcesForOSX", "(", "spec", ",", "all_sources", ")", ":", "if", "spec", ".", "get", "(", "'type'", ",", "None", ")", "!=", "'static_library'", ":", "return", "basenames", "=", "{", "}", "for", "source", "in", "all_sources", ":", "name", ...
[ 654, 0 ]
[ 682, 76 ]
python
en
['en', 'en', 'en']
True
WriteAutoRegenerationRule
(params, root_makefile, makefile_name, build_files)
Write the target to regenerate the Makefile.
Write the target to regenerate the Makefile.
def WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files): """Write the target to regenerate the Makefile.""" options = params['options'] build_files_args = [gyp.common.RelativePath(filename, options.toplevel_dir) for filename in params['b...
[ "def", "WriteAutoRegenerationRule", "(", "params", ",", "root_makefile", ",", "makefile_name", ",", "build_files", ")", ":", "options", "=", "params", "[", "'options'", "]", "build_files_args", "=", "[", "gyp", ".", "common", ".", "RelativePath", "(", "filename"...
[ 1962, 0 ]
[ 1984, 40 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.Write
(self, qualified_target, base_path, output_filename, spec, configs, part_of_all)
The main entry point: writes a .mk file for a single target. Arguments: qualified_target: target we're generating base_path: path relative to source root we're building in, used to resolve target-relative paths output_filename: output .mk file name to write spec, configs: g...
The main entry point: writes a .mk file for a single target.
def Write(self, qualified_target, base_path, output_filename, spec, configs, part_of_all): """The main entry point: writes a .mk file for a single target. Arguments: qualified_target: target we're generating base_path: path relative to source root we're building in, used to resolve ...
[ "def", "Write", "(", "self", ",", "qualified_target", ",", "base_path", ",", "output_filename", ",", "spec", ",", "configs", ",", "part_of_all", ")", ":", "gyp", ".", "common", ".", "EnsureDirExists", "(", "output_filename", ")", "self", ".", "fp", "=", "o...
[ 727, 2 ]
[ 857, 19 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteSubMake
(self, output_filename, makefile_path, targets, build_dir)
Write a "sub-project" Makefile. This is a small, wrapper Makefile that calls the top-level Makefile to build the targets from a single gyp file (i.e. a sub-project). Arguments: output_filename: sub-project Makefile name to write makefile_path: path to the top-level Makefile targets: list...
Write a "sub-project" Makefile.
def WriteSubMake(self, output_filename, makefile_path, targets, build_dir): """Write a "sub-project" Makefile. This is a small, wrapper Makefile that calls the top-level Makefile to build the targets from a single gyp file (i.e. a sub-project). Arguments: output_filename: sub-project Makefile na...
[ "def", "WriteSubMake", "(", "self", ",", "output_filename", ",", "makefile_path", ",", "targets", ",", "build_dir", ")", ":", "gyp", ".", "common", ".", "EnsureDirExists", "(", "output_filename", ")", "self", ".", "fp", "=", "open", "(", "output_filename", "...
[ 860, 2 ]
[ 884, 19 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteActions
(self, actions, extra_sources, extra_outputs, extra_mac_bundle_resources, part_of_all)
Write Makefile code for any 'actions' from the gyp input. extra_sources: a list that will be filled in with newly generated source files, if any extra_outputs: a list that will be filled in with any outputs of these actions (used to make other pieces dependent on these ...
Write Makefile code for any 'actions' from the gyp input.
def WriteActions(self, actions, extra_sources, extra_outputs, extra_mac_bundle_resources, part_of_all): """Write Makefile code for any 'actions' from the gyp input. extra_sources: a list that will be filled in with newly generated source files, if any extra_outputs: a ...
[ "def", "WriteActions", "(", "self", ",", "actions", ",", "extra_sources", ",", "extra_outputs", ",", "extra_mac_bundle_resources", ",", "part_of_all", ")", ":", "env", "=", "self", ".", "GetSortedXcodeEnv", "(", ")", "for", "action", "in", "actions", ":", "nam...
[ 887, 2 ]
[ 984, 18 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteRules
(self, rules, extra_sources, extra_outputs, extra_mac_bundle_resources, part_of_all)
Write Makefile code for any 'rules' from the gyp input. extra_sources: a list that will be filled in with newly generated source files, if any extra_outputs: a list that will be filled in with any outputs of these rules (used to make other pieces dependent on these rules) ...
Write Makefile code for any 'rules' from the gyp input.
def WriteRules(self, rules, extra_sources, extra_outputs, extra_mac_bundle_resources, part_of_all): """Write Makefile code for any 'rules' from the gyp input. extra_sources: a list that will be filled in with newly generated source files, if any extra_outputs: a list tha...
[ "def", "WriteRules", "(", "self", ",", "rules", ",", "extra_sources", ",", "extra_outputs", ",", "extra_mac_bundle_resources", ",", "part_of_all", ")", ":", "env", "=", "self", ".", "GetSortedXcodeEnv", "(", ")", "for", "rule", "in", "rules", ":", "name", "=...
[ 987, 2 ]
[ 1112, 20 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteCopies
(self, copies, extra_outputs, part_of_all)
Write Makefile code for any 'copies' from the gyp input. extra_outputs: a list that will be filled in with any outputs of this action (used to make other pieces dependent on this action) part_of_all: flag indicating this target is part of 'all'
Write Makefile code for any 'copies' from the gyp input.
def WriteCopies(self, copies, extra_outputs, part_of_all): """Write Makefile code for any 'copies' from the gyp input. extra_outputs: a list that will be filled in with any outputs of this action (used to make other pieces dependent on this action) part_of_all: flag indicating this targe...
[ "def", "WriteCopies", "(", "self", ",", "copies", ",", "extra_outputs", ",", "part_of_all", ")", ":", "self", ".", "WriteLn", "(", "'### Generated for copy rule.'", ")", "variable", "=", "StringToMakefileVariable", "(", "self", ".", "qualified_target", "+", "'_cop...
[ 1115, 2 ]
[ 1150, 18 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteMacBundleResources
(self, resources, bundle_deps)
Writes Makefile code for 'mac_bundle_resources'.
Writes Makefile code for 'mac_bundle_resources'.
def WriteMacBundleResources(self, resources, bundle_deps): """Writes Makefile code for 'mac_bundle_resources'.""" self.WriteLn('### Generated for mac_bundle_resources') for output, res in gyp.xcode_emulation.GetMacBundleResources( generator_default_variables['PRODUCT_DIR'], self.xcode_settings, ...
[ "def", "WriteMacBundleResources", "(", "self", ",", "resources", ",", "bundle_deps", ")", ":", "self", ".", "WriteLn", "(", "'### Generated for mac_bundle_resources'", ")", "for", "output", ",", "res", "in", "gyp", ".", "xcode_emulation", ".", "GetMacBundleResources...
[ 1153, 2 ]
[ 1165, 34 ]
python
en
['da', 'en', 'en']
True
MakefileWriter.WriteMacInfoPlist
(self, bundle_deps)
Write Makefile code for bundle Info.plist files.
Write Makefile code for bundle Info.plist files.
def WriteMacInfoPlist(self, bundle_deps): """Write Makefile code for bundle Info.plist files.""" info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( generator_default_variables['PRODUCT_DIR'], self.xcode_settings, lambda p: Sourceify(self.Absolutify(p))) if not info_pl...
[ "def", "WriteMacInfoPlist", "(", "self", ",", "bundle_deps", ")", ":", "info_plist", ",", "out", ",", "defines", ",", "extra_env", "=", "gyp", ".", "xcode_emulation", ".", "GetMacInfoPlist", "(", "generator_default_variables", "[", "'PRODUCT_DIR'", "]", ",", "se...
[ 1168, 2 ]
[ 1192, 27 ]
python
da
['da', 'it', 'en']
False
MakefileWriter.WriteSources
(self, configs, deps, sources, extra_outputs, extra_link_deps, part_of_all, precompiled_header)
Write Makefile code for any 'sources' from the gyp input. These are source files necessary to build the current target. configs, deps, sources: input from gyp. extra_outputs: a list of extra outputs this action should be dependent on; used to serialize action/rules before compilation ...
Write Makefile code for any 'sources' from the gyp input. These are source files necessary to build the current target.
def WriteSources(self, configs, deps, sources, extra_outputs, extra_link_deps, part_of_all, precompiled_header): """Write Makefile code for any 'sources' from the gyp input. These are source files necessary to build the current target. configs, deps, sources: input fro...
[ "def", "WriteSources", "(", "self", ",", "configs", ",", "deps", ",", "sources", ",", "extra_outputs", ",", "extra_link_deps", ",", "part_of_all", ",", "precompiled_header", ")", ":", "# Write configuration-specific variables for CFLAGS, etc.", "for", "configname", "in"...
[ 1195, 2 ]
[ 1317, 18 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WritePchTargets
(self, pch_commands)
Writes make rules to compile prefix headers.
Writes make rules to compile prefix headers.
def WritePchTargets(self, pch_commands): """Writes make rules to compile prefix headers.""" if not pch_commands: return for gch, lang_flag, lang, input in pch_commands: extra_flags = { 'c': '$(CFLAGS_C_$(BUILDTYPE))', 'cc': '$(CFLAGS_CC_$(BUILDTYPE))', 'm': '$(CFLAGS_C_$...
[ "def", "WritePchTargets", "(", "self", ",", "pch_commands", ")", ":", "if", "not", "pch_commands", ":", "return", "for", "gch", ",", "lang_flag", ",", "lang", ",", "input", "in", "pch_commands", ":", "extra_flags", "=", "{", "'c'", ":", "'$(CFLAGS_C_$(BUILDT...
[ 1319, 2 ]
[ 1349, 22 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.ComputeOutputBasename
(self, spec)
Return the 'output basename' of a gyp spec. E.g., the loadable module 'foobar' in directory 'baz' will produce 'libfoobar.so'
Return the 'output basename' of a gyp spec.
def ComputeOutputBasename(self, spec): """Return the 'output basename' of a gyp spec. E.g., the loadable module 'foobar' in directory 'baz' will produce 'libfoobar.so' """ assert not self.is_mac_bundle if self.flavor == 'mac' and self.type in ( 'static_library', 'executable', 'shared...
[ "def", "ComputeOutputBasename", "(", "self", ",", "spec", ")", ":", "assert", "not", "self", ".", "is_mac_bundle", "if", "self", ".", "flavor", "==", "'mac'", "and", "self", ".", "type", "in", "(", "'static_library'", ",", "'executable'", ",", "'shared_libra...
[ 1352, 2 ]
[ 1392, 46 ]
python
en
['en', 'haw', 'en']
True
MakefileWriter.ComputeOutput
(self, spec)
Return the 'output' (full output path) of a gyp spec. E.g., the loadable module 'foobar' in directory 'baz' will produce '$(obj)/baz/libfoobar.so'
Return the 'output' (full output path) of a gyp spec.
def ComputeOutput(self, spec): """Return the 'output' (full output path) of a gyp spec. E.g., the loadable module 'foobar' in directory 'baz' will produce '$(obj)/baz/libfoobar.so' """ assert not self.is_mac_bundle path = os.path.join('$(obj).' + self.toolset, self.path) if self.type == ...
[ "def", "ComputeOutput", "(", "self", ",", "spec", ")", ":", "assert", "not", "self", ".", "is_mac_bundle", "path", "=", "os", ".", "path", ".", "join", "(", "'$(obj).'", "+", "self", ".", "toolset", ",", "self", ".", "path", ")", "if", "self", ".", ...
[ 1400, 2 ]
[ 1412, 63 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.ComputeMacBundleOutput
(self, spec)
Return the 'output' (full output path) to a bundle output directory.
Return the 'output' (full output path) to a bundle output directory.
def ComputeMacBundleOutput(self, spec): """Return the 'output' (full output path) to a bundle output directory.""" assert self.is_mac_bundle path = generator_default_variables['PRODUCT_DIR'] return os.path.join(path, self.xcode_settings.GetWrapperName())
[ "def", "ComputeMacBundleOutput", "(", "self", ",", "spec", ")", ":", "assert", "self", ".", "is_mac_bundle", "path", "=", "generator_default_variables", "[", "'PRODUCT_DIR'", "]", "return", "os", ".", "path", ".", "join", "(", "path", ",", "self", ".", "xcod...
[ 1415, 2 ]
[ 1419, 67 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.ComputeMacBundleBinaryOutput
(self, spec)
Return the 'output' (full output path) to the binary in a bundle.
Return the 'output' (full output path) to the binary in a bundle.
def ComputeMacBundleBinaryOutput(self, spec): """Return the 'output' (full output path) to the binary in a bundle.""" path = generator_default_variables['PRODUCT_DIR'] return os.path.join(path, self.xcode_settings.GetExecutablePath())
[ "def", "ComputeMacBundleBinaryOutput", "(", "self", ",", "spec", ")", ":", "path", "=", "generator_default_variables", "[", "'PRODUCT_DIR'", "]", "return", "os", ".", "path", ".", "join", "(", "path", ",", "self", ".", "xcode_settings", ".", "GetExecutablePath",...
[ 1422, 2 ]
[ 1425, 70 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.ComputeDeps
(self, spec)
Compute the dependencies of a gyp spec. Returns a tuple (deps, link_deps), where each is a list of filenames that will need to be put in front of make for either building (deps) or linking (link_deps).
Compute the dependencies of a gyp spec.
def ComputeDeps(self, spec): """Compute the dependencies of a gyp spec. Returns a tuple (deps, link_deps), where each is a list of filenames that will need to be put in front of make for either building (deps) or linking (link_deps). """ deps = [] link_deps = [] if 'dependencies' in spe...
[ "def", "ComputeDeps", "(", "self", ",", "spec", ")", ":", "deps", "=", "[", "]", "link_deps", "=", "[", "]", "if", "'dependencies'", "in", "spec", ":", "deps", ".", "extend", "(", "[", "target_outputs", "[", "dep", "]", "for", "dep", "in", "spec", ...
[ 1428, 2 ]
[ 1447, 68 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteTarget
(self, spec, configs, deps, link_deps, bundle_deps, extra_outputs, part_of_all)
Write Makefile code to produce the final target of the gyp spec. spec, configs: input from gyp. deps, link_deps: dependency lists; see ComputeDeps() extra_outputs: any extra outputs that our target should depend on part_of_all: flag indicating this target is part of 'all'
Write Makefile code to produce the final target of the gyp spec.
def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps, extra_outputs, part_of_all): """Write Makefile code to produce the final target of the gyp spec. spec, configs: input from gyp. deps, link_deps: dependency lists; see ComputeDeps() extra_outputs: any extra outputs that...
[ "def", "WriteTarget", "(", "self", ",", "spec", ",", "configs", ",", "deps", ",", "link_deps", ",", "bundle_deps", ",", "extra_outputs", ",", "part_of_all", ")", ":", "self", ".", "WriteLn", "(", "'### Rules for final target.'", ")", "if", "extra_outputs", ":"...
[ 1456, 2 ]
[ 1689, 40 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteList
(self, value_list, variable=None, prefix='', quoter=QuoteIfNecessary)
Write a variable definition that is a list of values. E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out foo = blaha blahb but in a pretty-printed style.
Write a variable definition that is a list of values.
def WriteList(self, value_list, variable=None, prefix='', quoter=QuoteIfNecessary): """Write a variable definition that is a list of values. E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out foo = blaha blahb but in a pretty-printed style. """ values = '' if va...
[ "def", "WriteList", "(", "self", ",", "value_list", ",", "variable", "=", "None", ",", "prefix", "=", "''", ",", "quoter", "=", "QuoteIfNecessary", ")", ":", "values", "=", "''", "if", "value_list", ":", "value_list", "=", "[", "quoter", "(", "prefix", ...
[ 1692, 2 ]
[ 1704, 53 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteDoCmd
(self, outputs, inputs, command, part_of_all, comment=None, postbuilds=False)
Write a Makefile rule that uses do_cmd. This makes the outputs dependent on the command line that was run, as well as support the V= make command line flag.
Write a Makefile rule that uses do_cmd.
def WriteDoCmd(self, outputs, inputs, command, part_of_all, comment=None, postbuilds=False): """Write a Makefile rule that uses do_cmd. This makes the outputs dependent on the command line that was run, as well as support the V= make command line flag. """ suffix = '' if postbu...
[ "def", "WriteDoCmd", "(", "self", ",", "outputs", ",", "inputs", ",", "command", ",", "part_of_all", ",", "comment", "=", "None", ",", "postbuilds", "=", "False", ")", ":", "suffix", "=", "''", "if", "postbuilds", ":", "assert", "','", "not", "in", "co...
[ 1707, 2 ]
[ 1728, 54 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteMakeRule
(self, outputs, inputs, actions=None, comment=None, order_only=False, force=False, phony=False, command=None)
Write a Makefile rule, with some extra tricks. outputs: a list of outputs for the rule (note: this is not directly supported by make; see comments below) inputs: a list of inputs for the rule actions: a list of shell commands to run for the rule comment: a comment to put in the Makefile ab...
Write a Makefile rule, with some extra tricks.
def WriteMakeRule(self, outputs, inputs, actions=None, comment=None, order_only=False, force=False, phony=False, command=None): """Write a Makefile rule, with some extra tricks. outputs: a list of outputs for the rule (note: this is not directly supported by make; see comments ...
[ "def", "WriteMakeRule", "(", "self", ",", "outputs", ",", "inputs", ",", "actions", "=", "None", ",", "comment", "=", "None", ",", "order_only", "=", "False", ",", "force", "=", "False", ",", "phony", "=", "False", ",", "command", "=", "None", ")", "...
[ 1731, 2 ]
[ 1789, 18 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.WriteAndroidNdkModuleRule
(self, module_name, all_sources, link_deps)
Write a set of LOCAL_XXX definitions for Android NDK. These variable definitions will be used by Android NDK but do nothing for non-Android applications. Arguments: module_name: Android NDK module name, which must be unique among all module names. all_sources: A list of source files ...
Write a set of LOCAL_XXX definitions for Android NDK.
def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): """Write a set of LOCAL_XXX definitions for Android NDK. These variable definitions will be used by Android NDK but do nothing for non-Android applications. Arguments: module_name: Android NDK module name, which must be un...
[ "def", "WriteAndroidNdkModuleRule", "(", "self", ",", "module_name", ",", "all_sources", ",", "link_deps", ")", ":", "if", "self", ".", "type", "not", "in", "(", "'executable'", ",", "'shared_library'", ",", "'static_library'", ")", ":", "return", "self", ".",...
[ 1792, 2 ]
[ 1872, 18 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.Objectify
(self, path)
Convert a path to its output directory form.
Convert a path to its output directory form.
def Objectify(self, path): """Convert a path to its output directory form.""" if '$(' in path: path = path.replace('$(obj)/', '$(obj).%s/$(TARGET)/' % self.toolset) if not '$(obj)' in path: path = '$(obj).%s/$(TARGET)/%s' % (self.toolset, path) return path
[ "def", "Objectify", "(", "self", ",", "path", ")", ":", "if", "'$('", "in", "path", ":", "path", "=", "path", ".", "replace", "(", "'$(obj)/'", ",", "'$(obj).%s/$(TARGET)/'", "%", "self", ".", "toolset", ")", "if", "not", "'$(obj)'", "in", "path", ":",...
[ 1908, 2 ]
[ 1914, 15 ]
python
en
['en', 'en', 'en']
True
MakefileWriter.Pchify
(self, path, lang)
Convert a prefix header path to its output directory form.
Convert a prefix header path to its output directory form.
def Pchify(self, path, lang): """Convert a prefix header path to its output directory form.""" path = self.Absolutify(path) if '$(' in path: path = path.replace('$(obj)/', '$(obj).%s/$(TARGET)/pch-%s' % (self.toolset, lang)) return path return '$(obj).%s/$(TARGET)/p...
[ "def", "Pchify", "(", "self", ",", "path", ",", "lang", ")", ":", "path", "=", "self", ".", "Absolutify", "(", "path", ")", "if", "'$('", "in", "path", ":", "path", "=", "path", ".", "replace", "(", "'$(obj)/'", ",", "'$(obj).%s/$(TARGET)/pch-%s'", "%"...
[ 1917, 2 ]
[ 1924, 71 ]
python
en
['en', 'lb', 'en']
True
MakefileWriter.Absolutify
(self, path)
Convert a subdirectory-relative path into a base-relative path. Skips over paths that contain variables.
Convert a subdirectory-relative path into a base-relative path. Skips over paths that contain variables.
def Absolutify(self, path): """Convert a subdirectory-relative path into a base-relative path. Skips over paths that contain variables.""" if '$(' in path: # Don't call normpath in this case, as it might collapse the # path too aggressively if it features '..'. However it's still # importa...
[ "def", "Absolutify", "(", "self", ",", "path", ")", ":", "if", "'$('", "in", "path", ":", "# Don't call normpath in this case, as it might collapse the", "# path too aggressively if it features '..'. However it's still", "# important to strip trailing slashes.", "return", "path", ...
[ 1927, 2 ]
[ 1935, 58 ]
python
en
['it', 'en', 'en']
True
MakefileWriter._InstallableTargetInstallPath
(self)
Returns the location of the final output for an installable target.
Returns the location of the final output for an installable target.
def _InstallableTargetInstallPath(self): """Returns the location of the final output for an installable target.""" # Xcode puts shared_library results into PRODUCT_DIR, and some gyp files # rely on this. Emulate this behavior for mac. # XXX(TooTallNate): disabling this code since we don't want this beh...
[ "def", "_InstallableTargetInstallPath", "(", "self", ")", ":", "# Xcode puts shared_library results into PRODUCT_DIR, and some gyp files", "# rely on this. Emulate this behavior for mac.", "# XXX(TooTallNate): disabling this code since we don't want this behavior...", "#if (self.type == 'shared_li...
[ 1948, 2 ]
[ 1959, 38 ]
python
en
['en', 'en', 'en']
True
ExpectColumnStdevToBeBetween.validate_configuration
(self, configuration: Optional[ExpectationConfiguration])
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. Args: configuration (OPTIONAL[ExpectationConfiguration]): \ An opt...
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.
def validate_configuration(self, configuration: Optional[ExpectationConfiguration]): """ Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. ...
[ "def", "validate_configuration", "(", "self", ",", "configuration", ":", "Optional", "[", "ExpectationConfiguration", "]", ")", ":", "super", "(", ")", ".", "validate_configuration", "(", "configuration", ")", "self", ".", "validate_metric_value_between_configuration", ...
[ 102, 4 ]
[ 114, 85 ]
python
en
['en', 'error', 'th']
False
preprocess
( project_directory, output_directory, all_files, show_progress=True)
Call preprocessor on selected files.
Call preprocessor on selected files.
def preprocess( project_directory, output_directory, all_files, show_progress=True): """ Call preprocessor on selected files. """ for filepath in all_files: preprocessor(project_directory, output_directory, filepath) if show_progress: print( ...
[ "def", "preprocess", "(", "project_directory", ",", "output_directory", ",", "all_files", ",", "show_progress", "=", "True", ")", ":", "for", "filepath", "in", "all_files", ":", "preprocessor", "(", "project_directory", ",", "output_directory", ",", "filepath", ")...
[ 83, 0 ]
[ 99, 58 ]
python
en
['en', 'error', 'th']
False
add_dim3
(kernel_string, cuda_kernel)
adds dim3() to the second and third arguments in the kernel launch
adds dim3() to the second and third arguments in the kernel launch
def add_dim3(kernel_string, cuda_kernel): '''adds dim3() to the second and third arguments in the kernel launch''' count = 0 closure = 0 kernel_string = kernel_string.replace("<<<", "").replace(">>>", "") arg_locs = [{} for _ in range(2)] arg_locs[count]['start'] = 0 for ind, c in enumerate(...
[ "def", "add_dim3", "(", "kernel_string", ",", "cuda_kernel", ")", ":", "count", "=", "0", "closure", "=", "0", "kernel_string", "=", "kernel_string", ".", "replace", "(", "\"<<<\"", ",", "\"\"", ")", ".", "replace", "(", "\">>>\"", ",", "\"\"", ")", "arg...
[ 102, 0 ]
[ 134, 22 ]
python
en
['en', 'en', 'en']
True
processKernelLaunches
(string)
Replace the CUDA style Kernel launches with the HIP style kernel launches.
Replace the CUDA style Kernel launches with the HIP style kernel launches.
def processKernelLaunches(string): """ Replace the CUDA style Kernel launches with the HIP style kernel launches.""" # Concat the namespace with the kernel names. (Find cleaner way of doing this later). string = RE_KERNEL_LAUNCH.sub(lambda inp: "{0}{1}::".format(inp.group(1), inp.group(2)), string) def...
[ "def", "processKernelLaunches", "(", "string", ")", ":", "# Concat the namespace with the kernel names. (Find cleaner way of doing this later).", "string", "=", "RE_KERNEL_LAUNCH", ".", "sub", "(", "lambda", "inp", ":", "\"{0}{1}::\"", ".", "format", "(", "inp", ".", "gro...
[ 140, 0 ]
[ 250, 24 ]
python
en
['en', 'en', 'en']
True
get_hip_file_path
(filepath)
Returns the new name of the hipified file
Returns the new name of the hipified file
def get_hip_file_path(filepath): """ Returns the new name of the hipified file """ dirpath, filename = os.path.split(filepath) root, ext = os.path.splitext(filename) # Concretely, we do the following: # # - If there is a directory component named "cuda", replace # it with "hip...
[ "def", "get_hip_file_path", "(", "filepath", ")", ":", "dirpath", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "filepath", ")", "root", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "# Concretely, we do the follo...
[ 253, 0 ]
[ 281, 44 ]
python
en
['en', 'error', 'th']
False
preprocessor
(project_directory, output_directory, filepath)
Executes the CUDA -> HIP conversion on the specified file.
Executes the CUDA -> HIP conversion on the specified file.
def preprocessor(project_directory, output_directory, filepath): """ Executes the CUDA -> HIP conversion on the specified file. """ fin_path = os.path.join(project_directory, filepath) with open(fin_path, 'r') as fin: output_source = fin.read() fout_path = os.path.join(output_directory, get_hip...
[ "def", "preprocessor", "(", "project_directory", ",", "output_directory", ",", "filepath", ")", ":", "fin_path", "=", "os", ".", "path", ".", "join", "(", "project_directory", ",", "filepath", ")", "with", "open", "(", "fin_path", ",", "'r'", ")", "as", "f...
[ 362, 0 ]
[ 379, 33 ]
python
en
['en', 'en', 'en']
True
extract_arguments
(start, string)
Return the list of arguments in the upcoming function parameter closure. Example: string (input): '(blocks, threads, 0, THCState_getCurrentStream(state))' arguments (output): '[{'start': 1, 'end': 7}, {'start': 8, 'end': 16}, {'start': 17, 'end': 19}, ...
Return the list of arguments in the upcoming function parameter closure. Example: string (input): '(blocks, threads, 0, THCState_getCurrentStream(state))' arguments (output): '[{'start': 1, 'end': 7}, {'start': 8, 'end': 16}, {'start': 17, 'end': 19}, ...
def extract_arguments(start, string): """ Return the list of arguments in the upcoming function parameter closure. Example: string (input): '(blocks, threads, 0, THCState_getCurrentStream(state))' arguments (output): '[{'start': 1, 'end': 7}, {'start': 8, 'end': 16}, ...
[ "def", "extract_arguments", "(", "start", ",", "string", ")", ":", "arguments", "=", "[", "]", "closures", "=", "{", "\"<\"", ":", "0", ",", "\"(\"", ":", "0", "}", "current_position", "=", "start", "argument_start_pos", "=", "current_position", "+", "1", ...
[ 382, 0 ]
[ 425, 20 ]
python
en
['en', 'en', 'en']
True
Parent.expectation
(cls, func)
Manages configuration and running of expectation objects.
Manages configuration and running of expectation objects.
def expectation(cls, func): """Manages configuration and running of expectation objects.""" @wraps(func) def wrapper(*args, **kwargs): # wrapper logic func(*args, **kwargs) return wrapper
[ "def", "expectation", "(", "cls", ",", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# wrapper logic", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "...
[ 105, 4 ]
[ 113, 22 ]
python
en
['en', 'en', 'en']
True
Parent.override_me
(self)
Parent method docstring Returns: Unattainable abiding satisfaction.
Parent method docstring Returns: Unattainable abiding satisfaction.
def override_me(self): """Parent method docstring Returns: Unattainable abiding satisfaction. """ raise NotImplementedError
[ "def", "override_me", "(", "self", ")", ":", "raise", "NotImplementedError" ]
[ 115, 4 ]
[ 120, 33 ]
python
en
['en', 'da', 'en']
True
Child.override_me
(self)
Child method docstring Returns: Real, instantiable, abiding satisfaction.
Child method docstring Returns: Real, instantiable, abiding satisfaction.
def override_me(self): """Child method docstring Returns: Real, instantiable, abiding satisfaction. """
[ "def", "override_me", "(", "self", ")", ":" ]
[ 130, 4 ]
[ 134, 11 ]
python
en
['en', 'da', 'en']
True
SimpleColumnSuffixDomainBuilder.__init__
( self, data_context: DataContext, batch_request: Optional[Union[BatchRequest, dict]] = None, column_name_suffixes: Optional[List[str]] = None, )
Args: data_context: DataContext batch_request: specified in DomainBuilder configuration to get Batch objects for domain computation.
Args: data_context: DataContext batch_request: specified in DomainBuilder configuration to get Batch objects for domain computation.
def __init__( self, data_context: DataContext, batch_request: Optional[Union[BatchRequest, dict]] = None, column_name_suffixes: Optional[List[str]] = None, ): """ Args: data_context: DataContext batch_request: specified in DomainBuilder configu...
[ "def", "__init__", "(", "self", ",", "data_context", ":", "DataContext", ",", "batch_request", ":", "Optional", "[", "Union", "[", "BatchRequest", ",", "dict", "]", "]", "=", "None", ",", "column_name_suffixes", ":", "Optional", "[", "List", "[", "str", "]...
[ 15, 4 ]
[ 34, 57 ]
python
en
['en', 'error', 'th']
False
SimpleColumnSuffixDomainBuilder._get_domains
( self, variables: Optional[ParameterContainer] = None, )
Find the column suffix for each column and return all domains matching the specified suffix.
Find the column suffix for each column and return all domains matching the specified suffix.
def _get_domains( self, variables: Optional[ParameterContainer] = None, ) -> List[Domain]: """ Find the column suffix for each column and return all domains matching the specified suffix. """ column_name_suffixes: Union[ str, Iterable, List[str] ] ...
[ "def", "_get_domains", "(", "self", ",", "variables", ":", "Optional", "[", "ParameterContainer", "]", "=", "None", ",", ")", "->", "List", "[", "Domain", "]", ":", "column_name_suffixes", ":", "Union", "[", "str", ",", "Iterable", ",", "List", "[", "str...
[ 36, 4 ]
[ 88, 22 ]
python
en
['en', 'error', 'th']
False
CheckpointNewNotebookRenderer._find_datasource_with_asset
(self)
Find a Datasource with a configured Asset. Useful to pre-populate a working sample Checkpoint for notebook users.
Find a Datasource with a configured Asset.
def _find_datasource_with_asset(self) -> Dict[str, str]: """ Find a Datasource with a configured Asset. Useful to pre-populate a working sample Checkpoint for notebook users. """ datasource_candidate = None for datasource_name, datasource in self.context.datasources.item...
[ "def", "_find_datasource_with_asset", "(", "self", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "datasource_candidate", "=", "None", "for", "datasource_name", ",", "datasource", "in", "self", ".", "context", ".", "datasources", ".", "items", "(", ")"...
[ 14, 4 ]
[ 35, 35 ]
python
en
['en', 'error', 'th']
False
PublicTagsApiTests.test_login_required
(self)
Test that the login is required from retrieving tags
Test that the login is required from retrieving tags
def test_login_required(self): """Test that the login is required from retrieving tags""" res = self.client.get(TAGS_URL) self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
[ "def", "test_login_required", "(", "self", ")", ":", "res", "=", "self", ".", "client", ".", "get", "(", "TAGS_URL", ")", "self", ".", "assertEqual", "(", "res", ".", "status_code", ",", "status", ".", "HTTP_401_UNAUTHORIZED", ")" ]
[ 21, 4 ]
[ 25, 71 ]
python
en
['en', 'en', 'en']
True
PrivateTagsApiTests.test_retrieve_tags
(self)
Test retrieving tags
Test retrieving tags
def test_retrieve_tags(self): """Test retrieving tags""" Tag.objects.create(user=self.user, name='Vegan') Tag.objects.create(user=self.user, name='Dessert') res = self.client.get(TAGS_URL) tags = Tag.objects.all().order_by('-name') serializer = TagSerializer(tags, many=...
[ "def", "test_retrieve_tags", "(", "self", ")", ":", "Tag", ".", "objects", ".", "create", "(", "user", "=", "self", ".", "user", ",", "name", "=", "'Vegan'", ")", "Tag", ".", "objects", ".", "create", "(", "user", "=", "self", ".", "user", ",", "na...
[ 39, 4 ]
[ 49, 51 ]
python
en
['en', 'hmn', 'en']
True
PrivateTagsApiTests.test_tags_limited_to_user
(self)
Test that tags returned are for the authenticated user
Test that tags returned are for the authenticated user
def test_tags_limited_to_user(self): """Test that tags returned are for the authenticated user""" user2 = get_user_model().objects.create_user( 'test2@testmail.com', 'testpass' ) Tag.objects.create(user=user2, name='Fruity') tag = Tag.objects.create(user=s...
[ "def", "test_tags_limited_to_user", "(", "self", ")", ":", "user2", "=", "get_user_model", "(", ")", ".", "objects", ".", "create_user", "(", "'test2@testmail.com'", ",", "'testpass'", ")", "Tag", ".", "objects", ".", "create", "(", "user", "=", "user2", ","...
[ 51, 4 ]
[ 64, 55 ]
python
en
['en', 'en', 'en']
True
PrivateTagsApiTests.test_create_tags_successful
(self)
Test creating a new tag
Test creating a new tag
def test_create_tags_successful(self): """Test creating a new tag""" payload = {'name': 'Test tag'} self.client.post(TAGS_URL, payload) exists = Tag.objects.filter( user=self.user, name=payload['name'] ).exists() self.assertTrue(exists)
[ "def", "test_create_tags_successful", "(", "self", ")", ":", "payload", "=", "{", "'name'", ":", "'Test tag'", "}", "self", ".", "client", ".", "post", "(", "TAGS_URL", ",", "payload", ")", "exists", "=", "Tag", ".", "objects", ".", "filter", "(", "user"...
[ 66, 4 ]
[ 76, 31 ]
python
en
['en', 'en', 'en']
True
PrivateTagsApiTests.test_create_tags_invalid
(self)
Test creating a new tag with invalid payload
Test creating a new tag with invalid payload
def test_create_tags_invalid(self): """Test creating a new tag with invalid payload""" payload = {'name': ''} res = self.client.post(TAGS_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
[ "def", "test_create_tags_invalid", "(", "self", ")", ":", "payload", "=", "{", "'name'", ":", "''", "}", "res", "=", "self", ".", "client", ".", "post", "(", "TAGS_URL", ",", "payload", ")", "self", ".", "assertEqual", "(", "res", ".", "status_code", "...
[ 78, 4 ]
[ 83, 70 ]
python
en
['en', 'en', 'en']
True
PrivateTagsApiTests.test_retrieve_tags_assigned_to_recipes
(self)
Test filtering tags by those assigned to recipes
Test filtering tags by those assigned to recipes
def test_retrieve_tags_assigned_to_recipes(self): """Test filtering tags by those assigned to recipes""" tag1 = Tag.objects.create(user=self.user, name='Confort Food') tag2 = Tag.objects.create(user=self.user, name='Lunch') recipe = Recipe.objects.create( title='Coriander egg...
[ "def", "test_retrieve_tags_assigned_to_recipes", "(", "self", ")", ":", "tag1", "=", "Tag", ".", "objects", ".", "create", "(", "user", "=", "self", ".", "user", ",", "name", "=", "'Confort Food'", ")", "tag2", "=", "Tag", ".", "objects", ".", "create", ...
[ 85, 4 ]
[ 102, 52 ]
python
en
['en', 'en', 'en']
True
PrivateTagsApiTests.test_retrieve_tags_assigned_unique
(self)
Test filtering tags by those assigned unique items
Test filtering tags by those assigned unique items
def test_retrieve_tags_assigned_unique(self): """Test filtering tags by those assigned unique items""" tag = Tag.objects.create(user=self.user, name='Confort Food') Tag.objects.create(user=self.user, name='Lunch') recipe1 = Recipe.objects.create( title='Coriander eggs on toas...
[ "def", "test_retrieve_tags_assigned_unique", "(", "self", ")", ":", "tag", "=", "Tag", ".", "objects", ".", "create", "(", "user", "=", "self", ".", "user", ",", "name", "=", "'Confort Food'", ")", "Tag", ".", "objects", ".", "create", "(", "user", "=", ...
[ 104, 4 ]
[ 125, 42 ]
python
en
['en', 'en', 'en']
True
test_docs_clean_and_build_raises_helpful_errors
( mock_emit, mock_webbrowser, invocation, expected_error, expected_usage_event_begin, expected_usage_event_end, caplog, monkeypatch, context_with_site_built, )
Test helpful error messages for docs build and docs clean - invalid site names are specified via --site-name For docs clean: - invalid combinations of the --all and --site-name flags are used
Test helpful error messages for docs build and docs clean - invalid site names are specified via --site-name
def test_docs_clean_and_build_raises_helpful_errors( mock_emit, mock_webbrowser, invocation, expected_error, expected_usage_event_begin, expected_usage_event_end, caplog, monkeypatch, context_with_site_built, ): """ Test helpful error messages for docs build and docs clean ...
[ "def", "test_docs_clean_and_build_raises_helpful_errors", "(", "mock_emit", ",", "mock_webbrowser", ",", "invocation", ",", "expected_error", ",", "expected_usage_event_begin", ",", "expected_usage_event_end", ",", "caplog", ",", "monkeypatch", ",", "context_with_site_built", ...
[ 549, 0 ]
[ 603, 5 ]
python
en
['en', 'error', 'th']
False
DatabaseManager.__init__
(self, database_env='test', conf_creds=None)
Create a connection to the MySQL DB.
Create a connection to the MySQL DB.
def __init__(self, database_env='test', conf_creds=None): """ Create a connection to the MySQL DB. """ import pymysql db_server = settings.DB_HOST db_port = settings.DB_PORT db_user = settings.DB_USERNAME db_pass = settings.DB_PASSWORD db_schema = ...
[ "def", "__init__", "(", "self", ",", "database_env", "=", "'test'", ",", "conf_creds", "=", "None", ")", ":", "import", "pymysql", "db_server", "=", "settings", ".", "DB_HOST", "db_port", "=", "settings", ".", "DB_PORT", "db_user", "=", "settings", ".", "D...
[ 15, 4 ]
[ 54, 77 ]
python
en
['en', 'error', 'th']
False
DatabaseManager.query_fetch_all
(self, query, values)
Executes a db query, gets all the values, and closes the connection.
Executes a db query, gets all the values, and closes the connection.
def query_fetch_all(self, query, values): """ Executes a db query, gets all the values, and closes the connection. """ self.cursor.execute(query, values) retval = self.cursor.fetchall() self.__close_db() return retval
[ "def", "query_fetch_all", "(", "self", ",", "query", ",", "values", ")", ":", "self", ".", "cursor", ".", "execute", "(", "query", ",", "values", ")", "retval", "=", "self", ".", "cursor", ".", "fetchall", "(", ")", "self", ".", "__close_db", "(", ")...
[ 56, 4 ]
[ 63, 21 ]
python
en
['en', 'error', 'th']
False
DatabaseManager.query_fetch_one
(self, query, values)
Executes a db query, gets the first value, and closes the connection.
Executes a db query, gets the first value, and closes the connection.
def query_fetch_one(self, query, values): """ Executes a db query, gets the first value, and closes the connection. """ self.cursor.execute(query, values) retval = self.cursor.fetchone() self.__close_db() return retval
[ "def", "query_fetch_one", "(", "self", ",", "query", ",", "values", ")", ":", "self", ".", "cursor", ".", "execute", "(", "query", ",", "values", ")", "retval", "=", "self", ".", "cursor", ".", "fetchone", "(", ")", "self", ".", "__close_db", "(", ")...
[ 65, 4 ]
[ 72, 21 ]
python
en
['en', 'error', 'th']
False
DatabaseManager.execute_query
(self, query, values)
Executes a query to the test_db and closes the connection afterwards.
Executes a query to the test_db and closes the connection afterwards.
def execute_query(self, query, values): """ Executes a query to the test_db and closes the connection afterwards. """ retval = self.cursor.execute(query, values) self.__close_db() return retval
[ "def", "execute_query", "(", "self", ",", "query", ",", "values", ")", ":", "retval", "=", "self", ".", "cursor", ".", "execute", "(", "query", ",", "values", ")", "self", ".", "__close_db", "(", ")", "return", "retval" ]
[ 74, 4 ]
[ 80, 21 ]
python
en
['en', 'error', 'th']
False
find_best_lexer
(text, min_confidence=0.85)
Like the built in pygments guess_lexer, except has a minimum confidence level. If that is not met, it falls back to plain text to avoid bad highlighting. :returns: Lexer instance
Like the built in pygments guess_lexer, except has a minimum confidence level. If that is not met, it falls back to plain text to avoid bad highlighting.
def find_best_lexer(text, min_confidence=0.85): """ Like the built in pygments guess_lexer, except has a minimum confidence level. If that is not met, it falls back to plain text to avoid bad highlighting. :returns: Lexer instance """ current_best_confidence = 0.0 current_best_lexer = ...
[ "def", "find_best_lexer", "(", "text", ",", "min_confidence", "=", "0.85", ")", ":", "current_best_confidence", "=", "0.0", "current_best_lexer", "=", "None", "for", "lexer", "in", "_iter_lexerclasses", "(", ")", ":", "confidence", "=", "lexer", ".", "analyse_te...
[ 71, 0 ]
[ 92, 26 ]
python
en
['en', 'error', 'th']
False
WheelDistribution.get_pkg_resources_distribution
(self)
Loads the metadata from the wheel file into memory and returns a Distribution that uses it, not relying on the wheel file or requirement.
Loads the metadata from the wheel file into memory and returns a Distribution that uses it, not relying on the wheel file or requirement.
def get_pkg_resources_distribution(self) -> Distribution: """Loads the metadata from the wheel file into memory and returns a Distribution that uses it, not relying on the wheel file or requirement. """ # Set as part of preparation during download. assert self.req.local_f...
[ "def", "get_pkg_resources_distribution", "(", "self", ")", "->", "Distribution", ":", "# Set as part of preparation during download.", "assert", "self", ".", "req", ".", "local_file_path", "# Wheels are never unnamed.", "assert", "self", ".", "req", ".", "name", "with", ...
[ 15, 4 ]
[ 28, 13 ]
python
en
['en', 'en', 'en']
True
_length_hint
(obj)
Returns the length hint of an object.
Returns the length hint of an object.
def _length_hint(obj): """Returns the length hint of an object.""" try: return len(obj) except (AttributeError, TypeError): try: get_hint = type(obj).__length_hint__ except AttributeError: return None try: hint = get_hint(obj) excep...
[ "def", "_length_hint", "(", "obj", ")", ":", "try", ":", "return", "len", "(", "obj", ")", "except", "(", "AttributeError", ",", "TypeError", ")", ":", "try", ":", "get_hint", "=", "type", "(", "obj", ")", ".", "__length_hint__", "except", "AttributeErro...
[ 33, 0 ]
[ 50, 19 ]
python
en
['en', 'en', 'en']
True
pager
(generator, color=None)
Decide what method to use for paging through text.
Decide what method to use for paging through text.
def pager(generator, color=None): """Decide what method to use for paging through text.""" stdout = _default_text_stdout() if not isatty(sys.stdin) or not isatty(stdout): return _nullpager(stdout, generator, color) pager_cmd = (os.environ.get('PAGER', None) or '').strip() if pager_cmd: ...
[ "def", "pager", "(", "generator", ",", "color", "=", "None", ")", ":", "stdout", "=", "_default_text_stdout", "(", ")", "if", "not", "isatty", "(", "sys", ".", "stdin", ")", "or", "not", "isatty", "(", "stdout", ")", ":", "return", "_nullpager", "(", ...
[ 292, 0 ]
[ 317, 27 ]
python
en
['en', 'en', 'en']
True
_pipepager
(generator, cmd, color)
Page through text by feeding it to another program. Invoking a pager through this might support colors.
Page through text by feeding it to another program. Invoking a pager through this might support colors.
def _pipepager(generator, cmd, color): """Page through text by feeding it to another program. Invoking a pager through this might support colors. """ import subprocess env = dict(os.environ) # If we're piping to less we might support colors under the # condition that cmd_detail = cmd.r...
[ "def", "_pipepager", "(", "generator", ",", "cmd", ",", "color", ")", ":", "import", "subprocess", "env", "=", "dict", "(", "os", ".", "environ", ")", "# If we're piping to less we might support colors under the", "# condition that", "cmd_detail", "=", "cmd", ".", ...
[ 320, 0 ]
[ 366, 17 ]
python
en
['en', 'en', 'en']
True
_tempfilepager
(generator, cmd, color)
Page through text by invoking a program on a temporary file.
Page through text by invoking a program on a temporary file.
def _tempfilepager(generator, cmd, color): """Page through text by invoking a program on a temporary file.""" import tempfile filename = tempfile.mktemp() # TODO: This never terminates if the passed generator never terminates. text = "".join(generator) if not color: text = strip_ansi(tex...
[ "def", "_tempfilepager", "(", "generator", ",", "cmd", ",", "color", ")", ":", "import", "tempfile", "filename", "=", "tempfile", ".", "mktemp", "(", ")", "# TODO: This never terminates if the passed generator never terminates.", "text", "=", "\"\"", ".", "join", "(...
[ 369, 0 ]
[ 383, 27 ]
python
en
['en', 'en', 'en']
True
_nullpager
(stream, generator, color)
Simply print unformatted text. This is the ultimate fallback.
Simply print unformatted text. This is the ultimate fallback.
def _nullpager(stream, generator, color): """Simply print unformatted text. This is the ultimate fallback.""" for text in generator: if not color: text = strip_ansi(text) stream.write(text)
[ "def", "_nullpager", "(", "stream", ",", "generator", ",", "color", ")", ":", "for", "text", "in", "generator", ":", "if", "not", "color", ":", "text", "=", "strip_ansi", "(", "text", ")", "stream", ".", "write", "(", "text", ")" ]
[ 386, 0 ]
[ 391, 26 ]
python
en
['en', 'en', 'en']
True
ProgressBar.generator
(self)
Returns a generator which yields the items added to the bar during construction, and updates the progress bar *after* the yielded block returns.
Returns a generator which yields the items added to the bar during construction, and updates the progress bar *after* the yielded block returns.
def generator(self): """ Returns a generator which yields the items added to the bar during construction, and updates the progress bar *after* the yielded block returns. """ if not self.entered: raise RuntimeError('You need to use progress bars in a with block...
[ "def", "generator", "(", "self", ")", ":", "if", "not", "self", ".", "entered", ":", "raise", "RuntimeError", "(", "'You need to use progress bars in a with block.'", ")", "if", "self", ".", "is_hidden", ":", "for", "rv", "in", "self", ".", "iter", ":", "yie...
[ 271, 4 ]
[ 289, 34 ]
python
en
['en', 'error', 'th']
False
Cache.get
(self, url)
Gets the content from the memcache with a given key. Args: url: string, the key for the cache. Returns: object, the value in the cache for the given key, or None if the key is not in the cache.
Gets the content from the memcache with a given key.
def get(self, url): """Gets the content from the memcache with a given key. Args: url: string, the key for the cache. Returns: object, the value in the cache for the given key, or None if the key is not in the cache. """ raise NotImplementedError()
[ "def", "get", "(", "self", ",", "url", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 24, 2 ]
[ 34, 31 ]
python
en
['en', 'en', 'en']
True
Cache.set
(self, url, content)
Sets the given key and content in the cache. Args: url: string, the key for the cache. content: string, the discovery document.
Sets the given key and content in the cache.
def set(self, url, content): """Sets the given key and content in the cache. Args: url: string, the key for the cache. content: string, the discovery document. """ raise NotImplementedError()
[ "def", "set", "(", "self", ",", "url", ",", "content", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 37, 2 ]
[ 44, 31 ]
python
en
['en', 'en', 'en']
True
Point.__init__
(self, x=None, y=None, z=None, srid=None)
The Point object may be initialized with either a tuple, or individual parameters. For example: >>> p = Point((5, 23)) # 2D point, passed in as a tuple >>> p = Point(5, 23, 8) # 3D point, passed in with individual parameters
The Point object may be initialized with either a tuple, or individual parameters.
def __init__(self, x=None, y=None, z=None, srid=None): """ The Point object may be initialized with either a tuple, or individual parameters. For example: >>> p = Point((5, 23)) # 2D point, passed in as a tuple >>> p = Point(5, 23, 8) # 3D point, passed in with individ...
[ "def", "__init__", "(", "self", ",", "x", "=", "None", ",", "y", "=", "None", ",", "z", "=", "None", ",", "srid", "=", "None", ")", ":", "if", "x", "is", "None", ":", "coords", "=", "[", "]", "elif", "isinstance", "(", "x", ",", "(", "tuple",...
[ 13, 4 ]
[ 40, 42 ]
python
en
['en', 'error', 'th']
False
Point._create_point
(cls, ndim, coords)
Create a coordinate sequence, set X, Y, [Z], and create point
Create a coordinate sequence, set X, Y, [Z], and create point
def _create_point(cls, ndim, coords): """ Create a coordinate sequence, set X, Y, [Z], and create point """ if not ndim: return capi.create_point(None) if ndim < 2 or ndim > 3: raise TypeError('Invalid point dimension: %s' % ndim) cs = capi.creat...
[ "def", "_create_point", "(", "cls", ",", "ndim", ",", "coords", ")", ":", "if", "not", "ndim", ":", "return", "capi", ".", "create_point", "(", "None", ")", "if", "ndim", "<", "2", "or", "ndim", ">", "3", ":", "raise", "TypeError", "(", "'Invalid poi...
[ 56, 4 ]
[ 73, 36 ]
python
en
['en', 'error', 'th']
False
Point.__iter__
(self)
Iterate over coordinates of this Point.
Iterate over coordinates of this Point.
def __iter__(self): "Iterate over coordinates of this Point." for i in range(len(self)): yield self[i]
[ "def", "__iter__", "(", "self", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ")", ")", ":", "yield", "self", "[", "i", "]" ]
[ 91, 4 ]
[ 94, 25 ]
python
en
['en', 'en', 'en']
True
Point.__len__
(self)
Return the number of dimensions for this Point (either 0, 2 or 3).
Return the number of dimensions for this Point (either 0, 2 or 3).
def __len__(self): "Return the number of dimensions for this Point (either 0, 2 or 3)." if self.empty: return 0 if self.hasz: return 3 else: return 2
[ "def", "__len__", "(", "self", ")", ":", "if", "self", ".", "empty", ":", "return", "0", "if", "self", ".", "hasz", ":", "return", "3", "else", ":", "return", "2" ]
[ 96, 4 ]
[ 103, 20 ]
python
en
['en', 'en', 'en']
True
Point.x
(self)
Return the X component of the Point.
Return the X component of the Point.
def x(self): "Return the X component of the Point." return self._cs.getOrdinate(0, 0)
[ "def", "x", "(", "self", ")", ":", "return", "self", ".", "_cs", ".", "getOrdinate", "(", "0", ",", "0", ")" ]
[ 116, 4 ]
[ 118, 41 ]
python
en
['en', 'en', 'en']
True
Point.x
(self, value)
Set the X component of the Point.
Set the X component of the Point.
def x(self, value): "Set the X component of the Point." self._cs.setOrdinate(0, 0, value)
[ "def", "x", "(", "self", ",", "value", ")", ":", "self", ".", "_cs", ".", "setOrdinate", "(", "0", ",", "0", ",", "value", ")" ]
[ 121, 4 ]
[ 123, 41 ]
python
en
['en', 'en', 'en']
True
Point.y
(self)
Return the Y component of the Point.
Return the Y component of the Point.
def y(self): "Return the Y component of the Point." return self._cs.getOrdinate(1, 0)
[ "def", "y", "(", "self", ")", ":", "return", "self", ".", "_cs", ".", "getOrdinate", "(", "1", ",", "0", ")" ]
[ 126, 4 ]
[ 128, 41 ]
python
en
['en', 'en', 'en']
True
Point.y
(self, value)
Set the Y component of the Point.
Set the Y component of the Point.
def y(self, value): "Set the Y component of the Point." self._cs.setOrdinate(1, 0, value)
[ "def", "y", "(", "self", ",", "value", ")", ":", "self", ".", "_cs", ".", "setOrdinate", "(", "1", ",", "0", ",", "value", ")" ]
[ 131, 4 ]
[ 133, 41 ]
python
en
['en', 'en', 'en']
True
Point.z
(self)
Return the Z component of the Point.
Return the Z component of the Point.
def z(self): "Return the Z component of the Point." return self._cs.getOrdinate(2, 0) if self.hasz else None
[ "def", "z", "(", "self", ")", ":", "return", "self", ".", "_cs", ".", "getOrdinate", "(", "2", ",", "0", ")", "if", "self", ".", "hasz", "else", "None" ]
[ 136, 4 ]
[ 138, 64 ]
python
en
['en', 'en', 'en']
True
Point.z
(self, value)
Set the Z component of the Point.
Set the Z component of the Point.
def z(self, value): "Set the Z component of the Point." if not self.hasz: raise GEOSException('Cannot set Z on 2D Point.') self._cs.setOrdinate(2, 0, value)
[ "def", "z", "(", "self", ",", "value", ")", ":", "if", "not", "self", ".", "hasz", ":", "raise", "GEOSException", "(", "'Cannot set Z on 2D Point.'", ")", "self", ".", "_cs", ".", "setOrdinate", "(", "2", ",", "0", ",", "value", ")" ]
[ 141, 4 ]
[ 145, 41 ]
python
en
['en', 'en', 'en']
True
Point.tuple
(self)
Return a tuple of the point.
Return a tuple of the point.
def tuple(self): "Return a tuple of the point." return self._cs.tuple
[ "def", "tuple", "(", "self", ")", ":", "return", "self", ".", "_cs", ".", "tuple" ]
[ 149, 4 ]
[ 151, 29 ]
python
en
['en', 'en', 'en']
True
Point.tuple
(self, tup)
Set the coordinates of the point with the given tuple.
Set the coordinates of the point with the given tuple.
def tuple(self, tup): "Set the coordinates of the point with the given tuple." self._cs[0] = tup
[ "def", "tuple", "(", "self", ",", "tup", ")", ":", "self", ".", "_cs", "[", "0", "]", "=", "tup" ]
[ 154, 4 ]
[ 156, 25 ]
python
en
['en', 'en', 'en']
True
Layer.__init__
(self, layer_ptr, ds)
Initialize on an OGR C pointer to the Layer and the `DataSource` object that owns this layer. The `DataSource` object is required so that a reference to it is kept with this Layer. This prevents garbage collection of the `DataSource` while this Layer is still active.
Initialize on an OGR C pointer to the Layer and the `DataSource` object that owns this layer. The `DataSource` object is required so that a reference to it is kept with this Layer. This prevents garbage collection of the `DataSource` while this Layer is still active.
def __init__(self, layer_ptr, ds): """ Initialize on an OGR C pointer to the Layer and the `DataSource` object that owns this layer. The `DataSource` object is required so that a reference to it is kept with this Layer. This prevents garbage collection of the `DataSource` while...
[ "def", "__init__", "(", "self", ",", "layer_ptr", ",", "ds", ")", ":", "if", "not", "layer_ptr", ":", "raise", "GDALException", "(", "'Cannot create Layer, invalid pointer given'", ")", "self", ".", "ptr", "=", "layer_ptr", "self", ".", "_ds", "=", "ds", "se...
[ 23, 4 ]
[ 36, 63 ]
python
en
['en', 'error', 'th']
False
Layer.__getitem__
(self, index)
Get the Feature at the specified index.
Get the Feature at the specified index.
def __getitem__(self, index): "Get the Feature at the specified index." if isinstance(index, int): # An integer index was given -- we cannot do a check based on the # number of features because the beginning and ending feature IDs # are not guaranteed to be 0 and len(...
[ "def", "__getitem__", "(", "self", ",", "index", ")", ":", "if", "isinstance", "(", "index", ",", "int", ")", ":", "# An integer index was given -- we cannot do a check based on the", "# number of features because the beginning and ending feature IDs", "# are not guaranteed to be...
[ 38, 4 ]
[ 52, 93 ]
python
en
['en', 'en', 'en']
True
Layer.__iter__
(self)
Iterate over each Feature in the Layer.
Iterate over each Feature in the Layer.
def __iter__(self): "Iterate over each Feature in the Layer." # ResetReading() must be called before iteration is to begin. capi.reset_reading(self._ptr) for i in range(self.num_feat): yield Feature(capi.get_next_feature(self._ptr), self)
[ "def", "__iter__", "(", "self", ")", ":", "# ResetReading() must be called before iteration is to begin.", "capi", ".", "reset_reading", "(", "self", ".", "_ptr", ")", "for", "i", "in", "range", "(", "self", ".", "num_feat", ")", ":", "yield", "Feature", "(", ...
[ 54, 4 ]
[ 59, 65 ]
python
en
['en', 'en', 'en']
True
Layer.__len__
(self)
The length is the number of features.
The length is the number of features.
def __len__(self): "The length is the number of features." return self.num_feat
[ "def", "__len__", "(", "self", ")", ":", "return", "self", ".", "num_feat" ]
[ 61, 4 ]
[ 63, 28 ]
python
en
['en', 'en', 'en']
True
Layer.__str__
(self)
The string name of the layer.
The string name of the layer.
def __str__(self): "The string name of the layer." return self.name
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "name" ]
[ 65, 4 ]
[ 67, 24 ]
python
en
['en', 'en', 'en']
True