id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
51
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
246,100
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
TTSCache.get
def get(self, fragment_info): """ Get the value associated with the given key. :param fragment_info: the text key :type fragment_info: tuple of str ``(language, text)`` :raises: KeyError if the key is not present in the cache """ if not self.is_cached(fragment_i...
python
def get(self, fragment_info): if not self.is_cached(fragment_info): raise KeyError(u"Attempt to get text not cached") return self.cache[fragment_info]
[ "def", "get", "(", "self", ",", "fragment_info", ")", ":", "if", "not", "self", ".", "is_cached", "(", "fragment_info", ")", ":", "raise", "KeyError", "(", "u\"Attempt to get text not cached\"", ")", "return", "self", ".", "cache", "[", "fragment_info", "]" ]
Get the value associated with the given key. :param fragment_info: the text key :type fragment_info: tuple of str ``(language, text)`` :raises: KeyError if the key is not present in the cache
[ "Get", "the", "value", "associated", "with", "the", "given", "key", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L116-L126
246,101
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
TTSCache.clear
def clear(self): """ Clear the cache and remove all the files from disk. """ self.log(u"Clearing cache...") for file_handler, file_info in self.cache.values(): self.log([u" Removing file '%s'", file_info]) gf.delete_file(file_handler, file_info) s...
python
def clear(self): self.log(u"Clearing cache...") for file_handler, file_info in self.cache.values(): self.log([u" Removing file '%s'", file_info]) gf.delete_file(file_handler, file_info) self._initialize_cache() self.log(u"Clearing cache... done")
[ "def", "clear", "(", "self", ")", ":", "self", ".", "log", "(", "u\"Clearing cache...\"", ")", "for", "file_handler", ",", "file_info", "in", "self", ".", "cache", ".", "values", "(", ")", ":", "self", ".", "log", "(", "[", "u\" Removing file '%s'\"", "...
Clear the cache and remove all the files from disk.
[ "Clear", "the", "cache", "and", "remove", "all", "the", "files", "from", "disk", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L128-L137
246,102
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper._language_to_voice_code
def _language_to_voice_code(self, language): """ Translate a language value to a voice code. If you want to mock support for a language by using a voice for a similar language, please add it to the ``LANGUAGE_TO_VOICE_CODE`` dictionary. :param language: the requested la...
python
def _language_to_voice_code(self, language): voice_code = self.rconf[RuntimeConfiguration.TTS_VOICE_CODE] if voice_code is None: try: voice_code = self.LANGUAGE_TO_VOICE_CODE[language] except KeyError as exc: self.log_exc(u"Language code '%s' not f...
[ "def", "_language_to_voice_code", "(", "self", ",", "language", ")", ":", "voice_code", "=", "self", ".", "rconf", "[", "RuntimeConfiguration", ".", "TTS_VOICE_CODE", "]", "if", "voice_code", "is", "None", ":", "try", ":", "voice_code", "=", "self", ".", "LA...
Translate a language value to a voice code. If you want to mock support for a language by using a voice for a similar language, please add it to the ``LANGUAGE_TO_VOICE_CODE`` dictionary. :param language: the requested language :type language: :class:`~aeneas.language.Language...
[ "Translate", "a", "language", "value", "to", "a", "voice", "code", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L299-L322
246,103
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper.clear_cache
def clear_cache(self): """ Clear the TTS cache, removing all cache files from disk. .. versionadded:: 1.6.0 """ if self.use_cache: self.log(u"Requested to clear TTS cache") self.cache.clear()
python
def clear_cache(self): if self.use_cache: self.log(u"Requested to clear TTS cache") self.cache.clear()
[ "def", "clear_cache", "(", "self", ")", ":", "if", "self", ".", "use_cache", ":", "self", ".", "log", "(", "u\"Requested to clear TTS cache\"", ")", "self", ".", "cache", ".", "clear", "(", ")" ]
Clear the TTS cache, removing all cache files from disk. .. versionadded:: 1.6.0
[ "Clear", "the", "TTS", "cache", "removing", "all", "cache", "files", "from", "disk", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L331-L339
246,104
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper.set_subprocess_arguments
def set_subprocess_arguments(self, subprocess_arguments): """ Set the list of arguments that the wrapper will pass to ``subprocess``. Placeholders ``CLI_PARAMETER_*`` can be used, and they will be replaced by actual values in the ``_synthesize_multiple_subprocess()`` and ``_synt...
python
def set_subprocess_arguments(self, subprocess_arguments): # NOTE this is a method because we might need to access self.rconf, # so we cannot specify the list of arguments as a class field self.subprocess_arguments = subprocess_arguments self.log([u"Subprocess arguments: %s", subproc...
[ "def", "set_subprocess_arguments", "(", "self", ",", "subprocess_arguments", ")", ":", "# NOTE this is a method because we might need to access self.rconf,", "# so we cannot specify the list of arguments as a class field", "self", ".", "subprocess_arguments", "=", "subprocess_argume...
Set the list of arguments that the wrapper will pass to ``subprocess``. Placeholders ``CLI_PARAMETER_*`` can be used, and they will be replaced by actual values in the ``_synthesize_multiple_subprocess()`` and ``_synthesize_single_subprocess()`` built-in functions. Literal parameters wi...
[ "Set", "the", "list", "of", "arguments", "that", "the", "wrapper", "will", "pass", "to", "subprocess", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L341-L361
246,105
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper.synthesize_multiple
def synthesize_multiple(self, text_file, output_file_path, quit_after=None, backwards=False): """ Synthesize the text contained in the given fragment list into a WAVE file. Return a tuple (anchors, total_time, num_chars). Concrete subclasses must implement at least one ...
python
def synthesize_multiple(self, text_file, output_file_path, quit_after=None, backwards=False): if text_file is None: self.log_exc(u"text_file is None", None, True, TypeError) if len(text_file) < 1: self.log_exc(u"The text file has no fragments", None, True, ValueError) if ...
[ "def", "synthesize_multiple", "(", "self", ",", "text_file", ",", "output_file_path", ",", "quit_after", "=", "None", ",", "backwards", "=", "False", ")", ":", "if", "text_file", "is", "None", ":", "self", ".", "log_exc", "(", "u\"text_file is None\"", ",", ...
Synthesize the text contained in the given fragment list into a WAVE file. Return a tuple (anchors, total_time, num_chars). Concrete subclasses must implement at least one of the following private functions: 1. ``_synthesize_multiple_python()`` 2. ``_synthesize...
[ "Synthesize", "the", "text", "contained", "in", "the", "given", "fragment", "list", "into", "a", "WAVE", "file", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L363-L443
246,106
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper._synthesize_multiple_python
def _synthesize_multiple_python(self, text_file, output_file_path, quit_after=None, backwards=False): """ Synthesize multiple fragments via a Python call. :rtype: tuple (result, (anchors, current_time, num_chars)) """ self.log(u"Synthesizing multiple via a Python call...") ...
python
def _synthesize_multiple_python(self, text_file, output_file_path, quit_after=None, backwards=False): self.log(u"Synthesizing multiple via a Python call...") ret = self._synthesize_multiple_generic( helper_function=self._synthesize_single_python_helper, text_file=text_file, ...
[ "def", "_synthesize_multiple_python", "(", "self", ",", "text_file", ",", "output_file_path", ",", "quit_after", "=", "None", ",", "backwards", "=", "False", ")", ":", "self", ".", "log", "(", "u\"Synthesizing multiple via a Python call...\"", ")", "ret", "=", "se...
Synthesize multiple fragments via a Python call. :rtype: tuple (result, (anchors, current_time, num_chars))
[ "Synthesize", "multiple", "fragments", "via", "a", "Python", "call", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L445-L460
246,107
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper._synthesize_multiple_subprocess
def _synthesize_multiple_subprocess(self, text_file, output_file_path, quit_after=None, backwards=False): """ Synthesize multiple fragments via ``subprocess``. :rtype: tuple (result, (anchors, current_time, num_chars)) """ self.log(u"Synthesizing multiple via subprocess...") ...
python
def _synthesize_multiple_subprocess(self, text_file, output_file_path, quit_after=None, backwards=False): self.log(u"Synthesizing multiple via subprocess...") ret = self._synthesize_multiple_generic( helper_function=self._synthesize_single_subprocess_helper, text_file=text_file, ...
[ "def", "_synthesize_multiple_subprocess", "(", "self", ",", "text_file", ",", "output_file_path", ",", "quit_after", "=", "None", ",", "backwards", "=", "False", ")", ":", "self", ".", "log", "(", "u\"Synthesizing multiple via subprocess...\"", ")", "ret", "=", "s...
Synthesize multiple fragments via ``subprocess``. :rtype: tuple (result, (anchors, current_time, num_chars))
[ "Synthesize", "multiple", "fragments", "via", "subprocess", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L496-L511
246,108
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper._read_audio_data
def _read_audio_data(self, file_path): """ Read audio data from file. :rtype: tuple (True, (duration, sample_rate, codec, data)) or (False, None) on exception """ try: self.log(u"Reading audio data...") # if we know the TTS outputs to PCM16 mono WAVE ...
python
def _read_audio_data(self, file_path): try: self.log(u"Reading audio data...") # if we know the TTS outputs to PCM16 mono WAVE # with the correct sample rate, # we can read samples directly from it, # without an intermediate conversion through ffmpeg ...
[ "def", "_read_audio_data", "(", "self", ",", "file_path", ")", ":", "try", ":", "self", ".", "log", "(", "u\"Reading audio data...\"", ")", "# if we know the TTS outputs to PCM16 mono WAVE", "# with the correct sample rate,", "# we can read samples directly from it,", "# withou...
Read audio data from file. :rtype: tuple (True, (duration, sample_rate, codec, data)) or (False, None) on exception
[ "Read", "audio", "data", "from", "file", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L639-L668
246,109
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper._loop_no_cache
def _loop_no_cache(self, helper_function, num, fragment): """ Synthesize all fragments without using the cache """ self.log([u"Examining fragment %d (no cache)...", num]) # synthesize and get the duration of the output file voice_code = self._language_to_voice_code(fragment.language) ...
python
def _loop_no_cache(self, helper_function, num, fragment): self.log([u"Examining fragment %d (no cache)...", num]) # synthesize and get the duration of the output file voice_code = self._language_to_voice_code(fragment.language) self.log(u"Calling helper function") succeeded, data...
[ "def", "_loop_no_cache", "(", "self", ",", "helper_function", ",", "num", ",", "fragment", ")", ":", "self", ".", "log", "(", "[", "u\"Examining fragment %d (no cache)...\"", ",", "num", "]", ")", "# synthesize and get the duration of the output file", "voice_code", "...
Synthesize all fragments without using the cache
[ "Synthesize", "all", "fragments", "without", "using", "the", "cache" ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L769-L786
246,110
readbeyond/aeneas
aeneas/ttswrappers/basettswrapper.py
BaseTTSWrapper._loop_use_cache
def _loop_use_cache(self, helper_function, num, fragment): """ Synthesize all fragments using the cache """ self.log([u"Examining fragment %d (cache)...", num]) fragment_info = (fragment.language, fragment.filtered_text) if self.cache.is_cached(fragment_info): self.log(u"Frag...
python
def _loop_use_cache(self, helper_function, num, fragment): self.log([u"Examining fragment %d (cache)...", num]) fragment_info = (fragment.language, fragment.filtered_text) if self.cache.is_cached(fragment_info): self.log(u"Fragment cached: retrieving audio data from cache") ...
[ "def", "_loop_use_cache", "(", "self", ",", "helper_function", ",", "num", ",", "fragment", ")", ":", "self", ".", "log", "(", "[", "u\"Examining fragment %d (cache)...\"", ",", "num", "]", ")", "fragment_info", "=", "(", "fragment", ".", "language", ",", "f...
Synthesize all fragments using the cache
[ "Synthesize", "all", "fragments", "using", "the", "cache" ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/ttswrappers/basettswrapper.py#L788-L835
246,111
readbeyond/aeneas
aeneas/adjustboundaryalgorithm.py
AdjustBoundaryAlgorithm.adjust
def adjust( self, aba_parameters, boundary_indices, real_wave_mfcc, text_file, allow_arbitrary_shift=False ): """ Adjust the boundaries of the text map using the algorithm and parameters specified in the constructor, storing the...
python
def adjust( self, aba_parameters, boundary_indices, real_wave_mfcc, text_file, allow_arbitrary_shift=False ): self.log(u"Called adjust") if boundary_indices is None: self.log_exc(u"boundary_indices is None", None, True, TypeError) i...
[ "def", "adjust", "(", "self", ",", "aba_parameters", ",", "boundary_indices", ",", "real_wave_mfcc", ",", "text_file", ",", "allow_arbitrary_shift", "=", "False", ")", ":", "self", ".", "log", "(", "u\"Called adjust\"", ")", "if", "boundary_indices", "is", "None...
Adjust the boundaries of the text map using the algorithm and parameters specified in the constructor, storing the sync map fragment list internally. :param dict aba_parameters: a dictionary containing the algorithm and its parameters, as produced by ...
[ "Adjust", "the", "boundaries", "of", "the", "text", "map", "using", "the", "algorithm", "and", "parameters", "specified", "in", "the", "constructor", "storing", "the", "sync", "map", "fragment", "list", "internally", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/adjustboundaryalgorithm.py#L236-L310
246,112
readbeyond/aeneas
aeneas/adjustboundaryalgorithm.py
AdjustBoundaryAlgorithm.append_fragment_list_to_sync_root
def append_fragment_list_to_sync_root(self, sync_root): """ Append the sync map fragment list to the given node from a sync map tree. :param sync_root: the root of the sync map tree to which the new nodes should be appended :type sync_root: :class:`~aeneas.tree.Tree` ""...
python
def append_fragment_list_to_sync_root(self, sync_root): if not isinstance(sync_root, Tree): self.log_exc(u"sync_root is not a Tree object", None, True, TypeError) self.log(u"Appending fragment list to sync root...") for fragment in self.smflist: sync_root.add_child(Tree(...
[ "def", "append_fragment_list_to_sync_root", "(", "self", ",", "sync_root", ")", ":", "if", "not", "isinstance", "(", "sync_root", ",", "Tree", ")", ":", "self", ".", "log_exc", "(", "u\"sync_root is not a Tree object\"", ",", "None", ",", "True", ",", "TypeError...
Append the sync map fragment list to the given node from a sync map tree. :param sync_root: the root of the sync map tree to which the new nodes should be appended :type sync_root: :class:`~aeneas.tree.Tree`
[ "Append", "the", "sync", "map", "fragment", "list", "to", "the", "given", "node", "from", "a", "sync", "map", "tree", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/adjustboundaryalgorithm.py#L387-L401
246,113
readbeyond/aeneas
aeneas/adjustboundaryalgorithm.py
AdjustBoundaryAlgorithm._process_zero_length
def _process_zero_length(self, nozero, allow_arbitrary_shift): """ If ``nozero`` is ``True``, modify the sync map fragment list so that no fragment will have zero length. """ self.log(u"Called _process_zero_length") if not nozero: self.log(u"Processing zero le...
python
def _process_zero_length(self, nozero, allow_arbitrary_shift): self.log(u"Called _process_zero_length") if not nozero: self.log(u"Processing zero length intervals not requested: returning") return self.log(u"Processing zero length intervals requested") self.log(u"...
[ "def", "_process_zero_length", "(", "self", ",", "nozero", ",", "allow_arbitrary_shift", ")", ":", "self", ".", "log", "(", "u\"Called _process_zero_length\"", ")", "if", "not", "nozero", ":", "self", ".", "log", "(", "u\"Processing zero length intervals not requested...
If ``nozero`` is ``True``, modify the sync map fragment list so that no fragment will have zero length.
[ "If", "nozero", "is", "True", "modify", "the", "sync", "map", "fragment", "list", "so", "that", "no", "fragment", "will", "have", "zero", "length", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/adjustboundaryalgorithm.py#L407-L435
246,114
readbeyond/aeneas
pyinstaller-aeneas-cli.py
main
def main(): """ This is the aeneas-cli "hydra" script, to be compiled by pyinstaller. """ if FROZEN: HydraCLI(invoke="aeneas-cli").run( arguments=sys.argv, show_help=False ) else: HydraCLI(invoke="pyinstaller-aeneas-cli.py").run( argume...
python
def main(): if FROZEN: HydraCLI(invoke="aeneas-cli").run( arguments=sys.argv, show_help=False ) else: HydraCLI(invoke="pyinstaller-aeneas-cli.py").run( arguments=sys.argv, show_help=False )
[ "def", "main", "(", ")", ":", "if", "FROZEN", ":", "HydraCLI", "(", "invoke", "=", "\"aeneas-cli\"", ")", ".", "run", "(", "arguments", "=", "sys", ".", "argv", ",", "show_help", "=", "False", ")", "else", ":", "HydraCLI", "(", "invoke", "=", "\"pyin...
This is the aeneas-cli "hydra" script, to be compiled by pyinstaller.
[ "This", "is", "the", "aeneas", "-", "cli", "hydra", "script", "to", "be", "compiled", "by", "pyinstaller", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/pyinstaller-aeneas-cli.py#L48-L62
246,115
readbeyond/aeneas
aeneas/vad.py
VAD.run_vad
def run_vad( self, wave_energy, log_energy_threshold=None, min_nonspeech_length=None, extend_before=None, extend_after=None ): """ Compute the time intervals containing speech and nonspeech, and return a boolean mask with speech frames set to `...
python
def run_vad( self, wave_energy, log_energy_threshold=None, min_nonspeech_length=None, extend_before=None, extend_after=None ): self.log(u"Computing VAD for wave") mfcc_window_shift = self.rconf.mws self.log([u"MFCC window shift (s): %.3...
[ "def", "run_vad", "(", "self", ",", "wave_energy", ",", "log_energy_threshold", "=", "None", ",", "min_nonspeech_length", "=", "None", ",", "extend_before", "=", "None", ",", "extend_after", "=", "None", ")", ":", "self", ".", "log", "(", "u\"Computing VAD for...
Compute the time intervals containing speech and nonspeech, and return a boolean mask with speech frames set to ``True``, and nonspeech frames set to ``False``. The last four parameters might be ``None``: in this case, the corresponding RuntimeConfiguration values are applied. ...
[ "Compute", "the", "time", "intervals", "containing", "speech", "and", "nonspeech", "and", "return", "a", "boolean", "mask", "with", "speech", "frames", "set", "to", "True", "and", "nonspeech", "frames", "set", "to", "False", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/vad.py#L60-L131
246,116
readbeyond/aeneas
aeneas/vad.py
VAD._compute_runs
def _compute_runs(self, array): """ Compute runs as a list of arrays, each containing the indices of a contiguous run. :param array: the data array :type array: numpy 1D array :rtype: list of numpy 1D arrays """ if len(array) < 1: return [] ...
python
def _compute_runs(self, array): if len(array) < 1: return [] return numpy.split(array, numpy.where(numpy.diff(array) != 1)[0] + 1)
[ "def", "_compute_runs", "(", "self", ",", "array", ")", ":", "if", "len", "(", "array", ")", "<", "1", ":", "return", "[", "]", "return", "numpy", ".", "split", "(", "array", ",", "numpy", ".", "where", "(", "numpy", ".", "diff", "(", "array", ")...
Compute runs as a list of arrays, each containing the indices of a contiguous run. :param array: the data array :type array: numpy 1D array :rtype: list of numpy 1D arrays
[ "Compute", "runs", "as", "a", "list", "of", "arrays", "each", "containing", "the", "indices", "of", "a", "contiguous", "run", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/vad.py#L134-L145
246,117
readbeyond/aeneas
aeneas/vad.py
VAD._rolling_window
def _rolling_window(self, array, size): """ Compute rolling windows of width ``size`` of the given array. Return a numpy 2D stride array, where rows are the windows, each of ``size`` elements. :param array: the data array :type array: numpy 1D array (n) :param ...
python
def _rolling_window(self, array, size): shape = array.shape[:-1] + (array.shape[-1] - size + 1, size) strides = array.strides + (array.strides[-1],) return numpy.lib.stride_tricks.as_strided(array, shape=shape, strides=strides)
[ "def", "_rolling_window", "(", "self", ",", "array", ",", "size", ")", ":", "shape", "=", "array", ".", "shape", "[", ":", "-", "1", "]", "+", "(", "array", ".", "shape", "[", "-", "1", "]", "-", "size", "+", "1", ",", "size", ")", "strides", ...
Compute rolling windows of width ``size`` of the given array. Return a numpy 2D stride array, where rows are the windows, each of ``size`` elements. :param array: the data array :type array: numpy 1D array (n) :param int size: the width of each window :rtype: numpy 2D ...
[ "Compute", "rolling", "windows", "of", "width", "size", "of", "the", "given", "array", "." ]
9d95535ad63eef4a98530cfdff033b8c35315ee1
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/vad.py#L148-L162
246,118
pysam-developers/pysam
pysam/utils.py
PysamDispatcher.usage
def usage(self): '''return the samtools usage information for this command''' retval, stderr, stdout = _pysam_dispatch( self.collection, self.dispatch, is_usage=True, catch_stdout=True) # some tools write usage to stderr, such as mpileup if...
python
def usage(self): '''return the samtools usage information for this command''' retval, stderr, stdout = _pysam_dispatch( self.collection, self.dispatch, is_usage=True, catch_stdout=True) # some tools write usage to stderr, such as mpileup if...
[ "def", "usage", "(", "self", ")", ":", "retval", ",", "stderr", ",", "stdout", "=", "_pysam_dispatch", "(", "self", ".", "collection", ",", "self", ".", "dispatch", ",", "is_usage", "=", "True", ",", "catch_stdout", "=", "True", ")", "# some tools write us...
return the samtools usage information for this command
[ "return", "the", "samtools", "usage", "information", "for", "this", "command" ]
9961bebd4cd1f2bf5e42817df25699a6e6344b5a
https://github.com/pysam-developers/pysam/blob/9961bebd4cd1f2bf5e42817df25699a6e6344b5a/pysam/utils.py#L93-L104
246,119
pysam-developers/pysam
pysam/Pileup.py
iterate
def iterate(infile): '''iterate over ``samtools pileup -c`` formatted file. *infile* can be any iterator over a lines. The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution` or :class:`pysam.Pileup.PileupIndel`. .. note:: The parser converts to 0-based coord...
python
def iterate(infile): '''iterate over ``samtools pileup -c`` formatted file. *infile* can be any iterator over a lines. The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution` or :class:`pysam.Pileup.PileupIndel`. .. note:: The parser converts to 0-based coord...
[ "def", "iterate", "(", "infile", ")", ":", "conv_subst", "=", "(", "str", ",", "lambda", "x", ":", "int", "(", "x", ")", "-", "1", ",", "str", ",", "str", ",", "int", ",", "int", ",", "int", ",", "int", ",", "str", ",", "str", ")", "conv_inde...
iterate over ``samtools pileup -c`` formatted file. *infile* can be any iterator over a lines. The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution` or :class:`pysam.Pileup.PileupIndel`. .. note:: The parser converts to 0-based coordinates
[ "iterate", "over", "samtools", "pileup", "-", "c", "formatted", "file", "." ]
9961bebd4cd1f2bf5e42817df25699a6e6344b5a
https://github.com/pysam-developers/pysam/blob/9961bebd4cd1f2bf5e42817df25699a6e6344b5a/pysam/Pileup.py#L35-L64
246,120
pysam-developers/pysam
pysam/Pileup.py
vcf2pileup
def vcf2pileup(vcf, sample): '''convert vcf record to pileup record.''' chromosome = vcf.contig pos = vcf.pos reference = vcf.ref allelles = [reference] + vcf.alt data = vcf[sample] # get genotype genotypes = data["GT"] if len(genotypes) > 1: raise ValueError("only single ...
python
def vcf2pileup(vcf, sample): '''convert vcf record to pileup record.''' chromosome = vcf.contig pos = vcf.pos reference = vcf.ref allelles = [reference] + vcf.alt data = vcf[sample] # get genotype genotypes = data["GT"] if len(genotypes) > 1: raise ValueError("only single ...
[ "def", "vcf2pileup", "(", "vcf", ",", "sample", ")", ":", "chromosome", "=", "vcf", ".", "contig", "pos", "=", "vcf", ".", "pos", "reference", "=", "vcf", ".", "ref", "allelles", "=", "[", "reference", "]", "+", "vcf", ".", "alt", "data", "=", "vcf...
convert vcf record to pileup record.
[ "convert", "vcf", "record", "to", "pileup", "record", "." ]
9961bebd4cd1f2bf5e42817df25699a6e6344b5a
https://github.com/pysam-developers/pysam/blob/9961bebd4cd1f2bf5e42817df25699a6e6344b5a/pysam/Pileup.py#L198-L253
246,121
pysam-developers/pysam
pysam/Pileup.py
iterate_from_vcf
def iterate_from_vcf(infile, sample): '''iterate over a vcf-formatted file. *infile* can be any iterator over a lines. The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution` or :class:`pysam.Pileup.PileupIndel`. Positions without a snp will be skipped. This...
python
def iterate_from_vcf(infile, sample): '''iterate over a vcf-formatted file. *infile* can be any iterator over a lines. The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution` or :class:`pysam.Pileup.PileupIndel`. Positions without a snp will be skipped. This...
[ "def", "iterate_from_vcf", "(", "infile", ",", "sample", ")", ":", "vcf", "=", "pysam", ".", "VCF", "(", ")", "vcf", ".", "connect", "(", "infile", ")", "if", "sample", "not", "in", "vcf", ".", "getsamples", "(", ")", ":", "raise", "KeyError", "(", ...
iterate over a vcf-formatted file. *infile* can be any iterator over a lines. The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution` or :class:`pysam.Pileup.PileupIndel`. Positions without a snp will be skipped. This method is wasteful and written to support sa...
[ "iterate", "over", "a", "vcf", "-", "formatted", "file", "." ]
9961bebd4cd1f2bf5e42817df25699a6e6344b5a
https://github.com/pysam-developers/pysam/blob/9961bebd4cd1f2bf5e42817df25699a6e6344b5a/pysam/Pileup.py#L256-L282
246,122
pysam-developers/pysam
devtools/import.py
_update_pysam_files
def _update_pysam_files(cf, destdir): '''update pysam files applying redirection of ouput''' basename = os.path.basename(destdir) for filename in cf: if not filename: continue dest = filename + ".pysam.c" with open(filename, encoding="utf-8") as infile: lines ...
python
def _update_pysam_files(cf, destdir): '''update pysam files applying redirection of ouput''' basename = os.path.basename(destdir) for filename in cf: if not filename: continue dest = filename + ".pysam.c" with open(filename, encoding="utf-8") as infile: lines ...
[ "def", "_update_pysam_files", "(", "cf", ",", "destdir", ")", ":", "basename", "=", "os", ".", "path", ".", "basename", "(", "destdir", ")", "for", "filename", "in", "cf", ":", "if", "not", "filename", ":", "continue", "dest", "=", "filename", "+", "\"...
update pysam files applying redirection of ouput
[ "update", "pysam", "files", "applying", "redirection", "of", "ouput" ]
9961bebd4cd1f2bf5e42817df25699a6e6344b5a
https://github.com/pysam-developers/pysam/blob/9961bebd4cd1f2bf5e42817df25699a6e6344b5a/devtools/import.py#L83-L134
246,123
pysam-developers/pysam
pysam/__init__.py
get_include
def get_include(): '''return a list of include directories.''' dirname = os.path.abspath(os.path.join(os.path.dirname(__file__))) # # Header files may be stored in different relative locations # depending on installation mode (e.g., `python setup.py install`, # `python setup.py develop`. The fi...
python
def get_include(): '''return a list of include directories.''' dirname = os.path.abspath(os.path.join(os.path.dirname(__file__))) # # Header files may be stored in different relative locations # depending on installation mode (e.g., `python setup.py install`, # `python setup.py develop`. The fi...
[ "def", "get_include", "(", ")", ":", "dirname", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", ")", "#", "# Header files may be stored in different relative lo...
return a list of include directories.
[ "return", "a", "list", "of", "include", "directories", "." ]
9961bebd4cd1f2bf5e42817df25699a6e6344b5a
https://github.com/pysam-developers/pysam/blob/9961bebd4cd1f2bf5e42817df25699a6e6344b5a/pysam/__init__.py#L53-L75
246,124
pysam-developers/pysam
pysam/__init__.py
get_libraries
def get_libraries(): '''return a list of libraries to link against.''' # Note that this list does not include libcsamtools.so as there are # numerous name conflicts with libchtslib.so. dirname = os.path.abspath(os.path.join(os.path.dirname(__file__))) pysam_libs = ['libctabixproxies', ...
python
def get_libraries(): '''return a list of libraries to link against.''' # Note that this list does not include libcsamtools.so as there are # numerous name conflicts with libchtslib.so. dirname = os.path.abspath(os.path.join(os.path.dirname(__file__))) pysam_libs = ['libctabixproxies', ...
[ "def", "get_libraries", "(", ")", ":", "# Note that this list does not include libcsamtools.so as there are", "# numerous name conflicts with libchtslib.so.", "dirname", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path",...
return a list of libraries to link against.
[ "return", "a", "list", "of", "libraries", "to", "link", "against", "." ]
9961bebd4cd1f2bf5e42817df25699a6e6344b5a
https://github.com/pysam-developers/pysam/blob/9961bebd4cd1f2bf5e42817df25699a6e6344b5a/pysam/__init__.py#L85-L100
246,125
nerdvegas/rez
src/rez/vendor/pygraph/classes/digraph.py
digraph.has_edge
def has_edge(self, edge): """ Return whether an edge exists. @type edge: tuple @param edge: Edge. @rtype: boolean @return: Truth-value for edge existence. """ u, v = edge return (u, v) in self.edge_properties
python
def has_edge(self, edge): u, v = edge return (u, v) in self.edge_properties
[ "def", "has_edge", "(", "self", ",", "edge", ")", ":", "u", ",", "v", "=", "edge", "return", "(", "u", ",", "v", ")", "in", "self", ".", "edge_properties" ]
Return whether an edge exists. @type edge: tuple @param edge: Edge. @rtype: boolean @return: Truth-value for edge existence.
[ "Return", "whether", "an", "edge", "exists", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/classes/digraph.py#L214-L225
246,126
nerdvegas/rez
src/rez/package_serialise.py
dump_package_data
def dump_package_data(data, buf, format_=FileFormat.py, skip_attributes=None): """Write package data to `buf`. Args: data (dict): Data source - must conform to `package_serialise_schema`. buf (file-like object): Destination stream. format_ (`FileFormat`): Format to dump data in. ...
python
def dump_package_data(data, buf, format_=FileFormat.py, skip_attributes=None): if format_ == FileFormat.txt: raise ValueError("'txt' format not supported for packages.") data_ = dict((k, v) for k, v in data.iteritems() if v is not None) data_ = package_serialise_schema.validate(data_) skip = se...
[ "def", "dump_package_data", "(", "data", ",", "buf", ",", "format_", "=", "FileFormat", ".", "py", ",", "skip_attributes", "=", "None", ")", ":", "if", "format_", "==", "FileFormat", ".", "txt", ":", "raise", "ValueError", "(", "\"'txt' format not supported fo...
Write package data to `buf`. Args: data (dict): Data source - must conform to `package_serialise_schema`. buf (file-like object): Destination stream. format_ (`FileFormat`): Format to dump data in. skip_attributes (list of str): List of attributes to not print.
[ "Write", "package", "data", "to", "buf", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_serialise.py#L97-L126
246,127
nerdvegas/rez
src/rez/vendor/distlib/_backport/sysconfig.py
get_config_vars
def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values ...
python
def get_config_vars(*args): global _CONFIG_VARS if _CONFIG_VARS is None: _CONFIG_VARS = {} # Normalized versions of prefix and exec_prefix are handy to have; # in fact, these are the standard versions used most places in the # distutils2 module. _CONFIG_VARS['prefix'] = _...
[ "def", "get_config_vars", "(", "*", "args", ")", ":", "global", "_CONFIG_VARS", "if", "_CONFIG_VARS", "is", "None", ":", "_CONFIG_VARS", "=", "{", "}", "# Normalized versions of prefix and exec_prefix are handy to have;", "# in fact, these are the standard versions used most pl...
With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up eac...
[ "With", "no", "arguments", "return", "a", "dictionary", "of", "all", "configuration", "variables", "relevant", "for", "the", "current", "platform", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/distlib/_backport/sysconfig.py#L463-L591
246,128
nerdvegas/rez
src/support/package_utils/set_authors.py
set_authors
def set_authors(data): """Add 'authors' attribute based on repo contributions """ if "authors" in data: return shfile = os.path.join(os.path.dirname(__file__), "get_committers.sh") p = subprocess.Popen(["bash", shfile], stdout=subprocess.PIPE) out, _ = p.communicate() if p.returnco...
python
def set_authors(data): if "authors" in data: return shfile = os.path.join(os.path.dirname(__file__), "get_committers.sh") p = subprocess.Popen(["bash", shfile], stdout=subprocess.PIPE) out, _ = p.communicate() if p.returncode: return authors = out.strip().split('\n') autho...
[ "def", "set_authors", "(", "data", ")", ":", "if", "\"authors\"", "in", "data", ":", "return", "shfile", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"get_committers.sh\"", ")", "p", "=", "...
Add 'authors' attribute based on repo contributions
[ "Add", "authors", "attribute", "based", "on", "repo", "contributions" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/support/package_utils/set_authors.py#L5-L21
246,129
nerdvegas/rez
src/rez/package_maker__.py
make_package
def make_package(name, path, make_base=None, make_root=None, skip_existing=True, warn_on_skip=True): """Make and install a package. Example: >>> def make_root(variant, path): >>> os.symlink("/foo_payload/misc/python27", "ext") >>> >>> with make_package('foo...
python
def make_package(name, path, make_base=None, make_root=None, skip_existing=True, warn_on_skip=True): maker = PackageMaker(name) yield maker # post-with-block: # package = maker.get_package() cwd = os.getcwd() src_variants = [] # skip those variants that already exist ...
[ "def", "make_package", "(", "name", ",", "path", ",", "make_base", "=", "None", ",", "make_root", "=", "None", ",", "skip_existing", "=", "True", ",", "warn_on_skip", "=", "True", ")", ":", "maker", "=", "PackageMaker", "(", "name", ")", "yield", "maker"...
Make and install a package. Example: >>> def make_root(variant, path): >>> os.symlink("/foo_payload/misc/python27", "ext") >>> >>> with make_package('foo', '/packages', make_root=make_root) as pkg: >>> pkg.version = '1.0.0' >>> pkg.description = 'does fo...
[ "Make", "and", "install", "a", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_maker__.py#L140-L219
246,130
nerdvegas/rez
src/rez/package_maker__.py
PackageMaker.get_package
def get_package(self): """Create the analogous package. Returns: `Package` object. """ # get and validate package data package_data = self._get_data() package_data = package_schema.validate(package_data) # check compatibility with rez version ...
python
def get_package(self): # get and validate package data package_data = self._get_data() package_data = package_schema.validate(package_data) # check compatibility with rez version if "requires_rez_version" in package_data: ver = package_data.pop("requires_rez_version"...
[ "def", "get_package", "(", "self", ")", ":", "# get and validate package data", "package_data", "=", "self", ".", "_get_data", "(", ")", "package_data", "=", "package_schema", ".", "validate", "(", "package_data", ")", "# check compatibility with rez version", "if", "...
Create the analogous package. Returns: `Package` object.
[ "Create", "the", "analogous", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_maker__.py#L93-L126
246,131
nerdvegas/rez
src/rez/vendor/pyparsing/pyparsing.py
getTokensEndLoc
def getTokensEndLoc(): """Method to be called from within a parse action to determine the end location of the parsed tokens.""" import inspect fstack = inspect.stack() try: # search up the stack (through intervening argument normalizers) for correct calling routine for f in...
python
def getTokensEndLoc(): import inspect fstack = inspect.stack() try: # search up the stack (through intervening argument normalizers) for correct calling routine for f in fstack[2:]: if f[3] == "_parseNoCache": endloc = f[0].f_locals["loc"] ...
[ "def", "getTokensEndLoc", "(", ")", ":", "import", "inspect", "fstack", "=", "inspect", ".", "stack", "(", ")", "try", ":", "# search up the stack (through intervening argument normalizers) for correct calling routine\r", "for", "f", "in", "fstack", "[", "2", ":", "]"...
Method to be called from within a parse action to determine the end location of the parsed tokens.
[ "Method", "to", "be", "called", "from", "within", "a", "parse", "action", "to", "determine", "the", "end", "location", "of", "the", "parsed", "tokens", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pyparsing/pyparsing.py#L3350-L3364
246,132
nerdvegas/rez
src/rez/utils/schema.py
schema_keys
def schema_keys(schema): """Get the string values of keys in a dict-based schema. Non-string keys are ignored. Returns: Set of string keys of a schema which is in the form (eg): schema = Schema({Required("foo"): int, Optional("bah"): basestring}) """ ...
python
def schema_keys(schema): def _get_leaf(value): if isinstance(value, Schema): return _get_leaf(value._schema) return value keys = set() dict_ = schema._schema assert isinstance(dict_, dict) for key in dict_.iterkeys(): key_ = _get_leaf(key) if isinstance(...
[ "def", "schema_keys", "(", "schema", ")", ":", "def", "_get_leaf", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "Schema", ")", ":", "return", "_get_leaf", "(", "value", ".", "_schema", ")", "return", "value", "keys", "=", "set", "(", ...
Get the string values of keys in a dict-based schema. Non-string keys are ignored. Returns: Set of string keys of a schema which is in the form (eg): schema = Schema({Required("foo"): int, Optional("bah"): basestring})
[ "Get", "the", "string", "values", "of", "keys", "in", "a", "dict", "-", "based", "schema", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/schema.py#L12-L37
246,133
nerdvegas/rez
src/rez/utils/schema.py
dict_to_schema
def dict_to_schema(schema_dict, required, allow_custom_keys=True, modifier=None): """Convert a dict of Schemas into a Schema. Args: required (bool): Whether to make schema keys optional or required. allow_custom_keys (bool, optional): If True, creates a schema that allows custom ite...
python
def dict_to_schema(schema_dict, required, allow_custom_keys=True, modifier=None): if modifier: modifier = Use(modifier) def _to(value): if isinstance(value, dict): d = {} for k, v in value.iteritems(): if isinstance(k, basestring): k =...
[ "def", "dict_to_schema", "(", "schema_dict", ",", "required", ",", "allow_custom_keys", "=", "True", ",", "modifier", "=", "None", ")", ":", "if", "modifier", ":", "modifier", "=", "Use", "(", "modifier", ")", "def", "_to", "(", "value", ")", ":", "if", ...
Convert a dict of Schemas into a Schema. Args: required (bool): Whether to make schema keys optional or required. allow_custom_keys (bool, optional): If True, creates a schema that allows custom items in dicts. modifier (callable): Functor to apply to dict values - it is applied...
[ "Convert", "a", "dict", "of", "Schemas", "into", "a", "Schema", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/schema.py#L40-L72
246,134
nerdvegas/rez
src/rezgui/widgets/ContextTableWidget.py
ContextTableWidget.enter_diff_mode
def enter_diff_mode(self, context_model=None): """Enter diff mode. Args: context_model (`ContextModel`): Context to diff against. If None, a copy of the current context is used. """ assert not self.diff_mode self.diff_mode = True if context_model...
python
def enter_diff_mode(self, context_model=None): assert not self.diff_mode self.diff_mode = True if context_model is None: self.diff_from_source = True self.diff_context_model = self.context_model.copy() else: self.diff_from_source = False s...
[ "def", "enter_diff_mode", "(", "self", ",", "context_model", "=", "None", ")", ":", "assert", "not", "self", ".", "diff_mode", "self", ".", "diff_mode", "=", "True", "if", "context_model", "is", "None", ":", "self", ".", "diff_from_source", "=", "True", "s...
Enter diff mode. Args: context_model (`ContextModel`): Context to diff against. If None, a copy of the current context is used.
[ "Enter", "diff", "mode", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/widgets/ContextTableWidget.py#L349-L368
246,135
nerdvegas/rez
src/rezgui/widgets/ContextTableWidget.py
ContextTableWidget.leave_diff_mode
def leave_diff_mode(self): """Leave diff mode.""" assert self.diff_mode self.diff_mode = False self.diff_context_model = None self.diff_from_source = False self.setColumnCount(2) self.refresh()
python
def leave_diff_mode(self): assert self.diff_mode self.diff_mode = False self.diff_context_model = None self.diff_from_source = False self.setColumnCount(2) self.refresh()
[ "def", "leave_diff_mode", "(", "self", ")", ":", "assert", "self", ".", "diff_mode", "self", ".", "diff_mode", "=", "False", "self", ".", "diff_context_model", "=", "None", "self", ".", "diff_from_source", "=", "False", "self", ".", "setColumnCount", "(", "2...
Leave diff mode.
[ "Leave", "diff", "mode", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/widgets/ContextTableWidget.py#L370-L377
246,136
nerdvegas/rez
src/rezgui/widgets/ContextTableWidget.py
ContextTableWidget.get_title
def get_title(self): """Returns a string suitable for titling a window containing this table.""" def _title(context_model): context = context_model.context() if context is None: return "new context*" title = os.path.basename(context.load_path) if conte...
python
def get_title(self): def _title(context_model): context = context_model.context() if context is None: return "new context*" title = os.path.basename(context.load_path) if context.load_path \ else "new context" if context_model.is_mo...
[ "def", "get_title", "(", "self", ")", ":", "def", "_title", "(", "context_model", ")", ":", "context", "=", "context_model", ".", "context", "(", ")", "if", "context", "is", "None", ":", "return", "\"new context*\"", "title", "=", "os", ".", "path", ".",...
Returns a string suitable for titling a window containing this table.
[ "Returns", "a", "string", "suitable", "for", "titling", "a", "window", "containing", "this", "table", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/widgets/ContextTableWidget.py#L390-L409
246,137
nerdvegas/rez
src/rez/utils/colorize.py
_color_level
def _color_level(str_, level): """ Return the string wrapped with the appropriate styling for the message level. The styling will be determined based on the rez configuration. Args: str_ (str): The string to be wrapped. level (str): The message level. Should be one of 'critical', 'error', ...
python
def _color_level(str_, level): fore_color, back_color, styles = _get_style_from_config(level) return _color(str_, fore_color, back_color, styles)
[ "def", "_color_level", "(", "str_", ",", "level", ")", ":", "fore_color", ",", "back_color", ",", "styles", "=", "_get_style_from_config", "(", "level", ")", "return", "_color", "(", "str_", ",", "fore_color", ",", "back_color", ",", "styles", ")" ]
Return the string wrapped with the appropriate styling for the message level. The styling will be determined based on the rez configuration. Args: str_ (str): The string to be wrapped. level (str): The message level. Should be one of 'critical', 'error', 'warning', 'info' or 'debug'. ...
[ "Return", "the", "string", "wrapped", "with", "the", "appropriate", "styling", "for", "the", "message", "level", ".", "The", "styling", "will", "be", "determined", "based", "on", "the", "rez", "configuration", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/colorize.py#L160-L173
246,138
nerdvegas/rez
src/rez/utils/colorize.py
_color
def _color(str_, fore_color=None, back_color=None, styles=None): """ Return the string wrapped with the appropriate styling escape sequences. Args: str_ (str): The string to be wrapped. fore_color (str, optional): Any foreground color supported by the `Colorama`_ module. back_color (s...
python
def _color(str_, fore_color=None, back_color=None, styles=None): # TODO: Colorama is documented to work on Windows and trivial test case # proves this to be the case, but it doesn't work in Rez. If the initialise # is called in sec/rez/__init__.py then it does work, however as discussed # in the follow...
[ "def", "_color", "(", "str_", ",", "fore_color", "=", "None", ",", "back_color", "=", "None", ",", "styles", "=", "None", ")", ":", "# TODO: Colorama is documented to work on Windows and trivial test case", "# proves this to be the case, but it doesn't work in Rez. If the init...
Return the string wrapped with the appropriate styling escape sequences. Args: str_ (str): The string to be wrapped. fore_color (str, optional): Any foreground color supported by the `Colorama`_ module. back_color (str, optional): Any background color supported by the `Colorama`_ ...
[ "Return", "the", "string", "wrapped", "with", "the", "appropriate", "styling", "escape", "sequences", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/colorize.py#L176-L219
246,139
nerdvegas/rez
src/rez/utils/sourcecode.py
late
def late(): """Used by functions in package.py that are evaluated lazily. The term 'late' refers to the fact these package attributes are evaluated late, ie when the attribute is queried for the first time. If you want to implement a package.py attribute as a function, you MUST use this decorator ...
python
def late(): from rez.package_resources_ import package_rex_keys def decorated(fn): # this is done here rather than in standard schema validation because # the latter causes a very obfuscated error message if fn.__name__ in package_rex_keys: raise ValueError("Cannot use @lat...
[ "def", "late", "(", ")", ":", "from", "rez", ".", "package_resources_", "import", "package_rex_keys", "def", "decorated", "(", "fn", ")", ":", "# this is done here rather than in standard schema validation because", "# the latter causes a very obfuscated error message", "if", ...
Used by functions in package.py that are evaluated lazily. The term 'late' refers to the fact these package attributes are evaluated late, ie when the attribute is queried for the first time. If you want to implement a package.py attribute as a function, you MUST use this decorator - otherwise it is u...
[ "Used", "by", "functions", "in", "package", ".", "py", "that", "are", "evaluated", "lazily", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/sourcecode.py#L25-L49
246,140
nerdvegas/rez
src/rez/utils/sourcecode.py
include
def include(module_name, *module_names): """Used by functions in package.py to have access to named modules. See the 'package_definition_python_path' config setting for more info. """ def decorated(fn): _add_decorator(fn, "include", nargs=[module_name] + list(module_names)) return fn ...
python
def include(module_name, *module_names): def decorated(fn): _add_decorator(fn, "include", nargs=[module_name] + list(module_names)) return fn return decorated
[ "def", "include", "(", "module_name", ",", "*", "module_names", ")", ":", "def", "decorated", "(", "fn", ")", ":", "_add_decorator", "(", "fn", ",", "\"include\"", ",", "nargs", "=", "[", "module_name", "]", "+", "list", "(", "module_names", ")", ")", ...
Used by functions in package.py to have access to named modules. See the 'package_definition_python_path' config setting for more info.
[ "Used", "by", "functions", "in", "package", ".", "py", "to", "have", "access", "to", "named", "modules", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/sourcecode.py#L52-L61
246,141
nerdvegas/rez
src/rez/packages_.py
iter_package_families
def iter_package_families(paths=None): """Iterate over package families, in no particular order. Note that multiple package families with the same name can be returned. Unlike packages, families later in the searchpath are not hidden by earlier families. Args: paths (list of str, optional)...
python
def iter_package_families(paths=None): for path in (paths or config.packages_path): repo = package_repository_manager.get_repository(path) for resource in repo.iter_package_families(): yield PackageFamily(resource)
[ "def", "iter_package_families", "(", "paths", "=", "None", ")", ":", "for", "path", "in", "(", "paths", "or", "config", ".", "packages_path", ")", ":", "repo", "=", "package_repository_manager", ".", "get_repository", "(", "path", ")", "for", "resource", "in...
Iterate over package families, in no particular order. Note that multiple package families with the same name can be returned. Unlike packages, families later in the searchpath are not hidden by earlier families. Args: paths (list of str, optional): paths to search for package families, ...
[ "Iterate", "over", "package", "families", "in", "no", "particular", "order", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L465-L482
246,142
nerdvegas/rez
src/rez/packages_.py
iter_packages
def iter_packages(name, range_=None, paths=None): """Iterate over `Package` instances, in no particular order. Packages of the same name and version earlier in the search path take precedence - equivalent packages later in the paths are ignored. Packages are not returned in any specific order. Arg...
python
def iter_packages(name, range_=None, paths=None): entries = _get_families(name, paths) seen = set() for repo, family_resource in entries: for package_resource in repo.iter_packages(family_resource): key = (package_resource.name, package_resource.version) if key in seen: ...
[ "def", "iter_packages", "(", "name", ",", "range_", "=", "None", ",", "paths", "=", "None", ")", ":", "entries", "=", "_get_families", "(", "name", ",", "paths", ")", "seen", "=", "set", "(", ")", "for", "repo", ",", "family_resource", "in", "entries",...
Iterate over `Package` instances, in no particular order. Packages of the same name and version earlier in the search path take precedence - equivalent packages later in the paths are ignored. Packages are not returned in any specific order. Args: name (str): Name of the package, eg 'maya'. ...
[ "Iterate", "over", "Package", "instances", "in", "no", "particular", "order", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L485-L518
246,143
nerdvegas/rez
src/rez/packages_.py
get_package
def get_package(name, version, paths=None): """Get an exact version of a package. Args: name (str): Name of the package, eg 'maya'. version (Version or str): Version of the package, eg '1.0.0' paths (list of str, optional): paths to search for package, defaults to `config.pa...
python
def get_package(name, version, paths=None): if isinstance(version, basestring): range_ = VersionRange("==%s" % version) else: range_ = VersionRange.from_version(version, "==") it = iter_packages(name, range_, paths) try: return it.next() except StopIteration: return ...
[ "def", "get_package", "(", "name", ",", "version", ",", "paths", "=", "None", ")", ":", "if", "isinstance", "(", "version", ",", "basestring", ")", ":", "range_", "=", "VersionRange", "(", "\"==%s\"", "%", "version", ")", "else", ":", "range_", "=", "V...
Get an exact version of a package. Args: name (str): Name of the package, eg 'maya'. version (Version or str): Version of the package, eg '1.0.0' paths (list of str, optional): paths to search for package, defaults to `config.packages_path`. Returns: `Package` objec...
[ "Get", "an", "exact", "version", "of", "a", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L521-L542
246,144
nerdvegas/rez
src/rez/packages_.py
get_package_from_string
def get_package_from_string(txt, paths=None): """Get a package given a string. Args: txt (str): String such as 'foo', 'bah-1.3'. paths (list of str, optional): paths to search for package, defaults to `config.packages_path`. Returns: `Package` instance, or None if no pa...
python
def get_package_from_string(txt, paths=None): o = VersionedObject(txt) return get_package(o.name, o.version, paths=paths)
[ "def", "get_package_from_string", "(", "txt", ",", "paths", "=", "None", ")", ":", "o", "=", "VersionedObject", "(", "txt", ")", "return", "get_package", "(", "o", ".", "name", ",", "o", ".", "version", ",", "paths", "=", "paths", ")" ]
Get a package given a string. Args: txt (str): String such as 'foo', 'bah-1.3'. paths (list of str, optional): paths to search for package, defaults to `config.packages_path`. Returns: `Package` instance, or None if no package was found.
[ "Get", "a", "package", "given", "a", "string", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L563-L575
246,145
nerdvegas/rez
src/rez/packages_.py
get_developer_package
def get_developer_package(path, format=None): """Create a developer package. Args: path (str): Path to dir containing package definition file. format (str): Package definition file format, detected if None. Returns: `DeveloperPackage`. """ from rez.developer_package import ...
python
def get_developer_package(path, format=None): from rez.developer_package import DeveloperPackage return DeveloperPackage.from_path(path, format=format)
[ "def", "get_developer_package", "(", "path", ",", "format", "=", "None", ")", ":", "from", "rez", ".", "developer_package", "import", "DeveloperPackage", "return", "DeveloperPackage", ".", "from_path", "(", "path", ",", "format", "=", "format", ")" ]
Create a developer package. Args: path (str): Path to dir containing package definition file. format (str): Package definition file format, detected if None. Returns: `DeveloperPackage`.
[ "Create", "a", "developer", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L578-L589
246,146
nerdvegas/rez
src/rez/packages_.py
create_package
def create_package(name, data, package_cls=None): """Create a package given package data. Args: name (str): Package name. data (dict): Package data. Must conform to `package_maker.package_schema`. Returns: `Package` object. """ from rez.package_maker__ import PackageMaker ...
python
def create_package(name, data, package_cls=None): from rez.package_maker__ import PackageMaker maker = PackageMaker(name, data, package_cls=package_cls) return maker.get_package()
[ "def", "create_package", "(", "name", ",", "data", ",", "package_cls", "=", "None", ")", ":", "from", "rez", ".", "package_maker__", "import", "PackageMaker", "maker", "=", "PackageMaker", "(", "name", ",", "data", ",", "package_cls", "=", "package_cls", ")"...
Create a package given package data. Args: name (str): Package name. data (dict): Package data. Must conform to `package_maker.package_schema`. Returns: `Package` object.
[ "Create", "a", "package", "given", "package", "data", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L592-L604
246,147
nerdvegas/rez
src/rez/packages_.py
get_last_release_time
def get_last_release_time(name, paths=None): """Returns the most recent time this package was released. Note that releasing a variant into an already-released package is also considered a package release. Returns: int: Epoch time of last package release, or zero if this cannot be deter...
python
def get_last_release_time(name, paths=None): entries = _get_families(name, paths) max_time = 0 for repo, family_resource in entries: time_ = repo.get_last_release_time(family_resource) if time_ == 0: return 0 max_time = max(max_time, time_) return max_time
[ "def", "get_last_release_time", "(", "name", ",", "paths", "=", "None", ")", ":", "entries", "=", "_get_families", "(", "name", ",", "paths", ")", "max_time", "=", "0", "for", "repo", ",", "family_resource", "in", "entries", ":", "time_", "=", "repo", "....
Returns the most recent time this package was released. Note that releasing a variant into an already-released package is also considered a package release. Returns: int: Epoch time of last package release, or zero if this cannot be determined.
[ "Returns", "the", "most", "recent", "time", "this", "package", "was", "released", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L628-L646
246,148
nerdvegas/rez
src/rez/packages_.py
get_completions
def get_completions(prefix, paths=None, family_only=False): """Get autocompletion options given a prefix string. Example: >>> get_completions("may") set(["maya", "maya_utils"]) >>> get_completions("maya-") set(["maya-2013.1", "maya-2015.0.sp1"]) Args: prefix (str):...
python
def get_completions(prefix, paths=None, family_only=False): op = None if prefix: if prefix[0] in ('!', '~'): if family_only: return set() op = prefix[0] prefix = prefix[1:] fam = None for ch in ('-', '@', '#'): if ch in prefix: ...
[ "def", "get_completions", "(", "prefix", ",", "paths", "=", "None", ",", "family_only", "=", "False", ")", ":", "op", "=", "None", "if", "prefix", ":", "if", "prefix", "[", "0", "]", "in", "(", "'!'", ",", "'~'", ")", ":", "if", "family_only", ":",...
Get autocompletion options given a prefix string. Example: >>> get_completions("may") set(["maya", "maya_utils"]) >>> get_completions("maya-") set(["maya-2013.1", "maya-2015.0.sp1"]) Args: prefix (str): Prefix to match. paths (list of str): paths to search for ...
[ "Get", "autocompletion", "options", "given", "a", "prefix", "string", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L649-L702
246,149
nerdvegas/rez
src/rez/packages_.py
PackageFamily.iter_packages
def iter_packages(self): """Iterate over the packages within this family, in no particular order. Returns: `Package` iterator. """ for package in self.repository.iter_packages(self.resource): yield Package(package)
python
def iter_packages(self): for package in self.repository.iter_packages(self.resource): yield Package(package)
[ "def", "iter_packages", "(", "self", ")", ":", "for", "package", "in", "self", ".", "repository", ".", "iter_packages", "(", "self", ".", "resource", ")", ":", "yield", "Package", "(", "package", ")" ]
Iterate over the packages within this family, in no particular order. Returns: `Package` iterator.
[ "Iterate", "over", "the", "packages", "within", "this", "family", "in", "no", "particular", "order", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L55-L62
246,150
nerdvegas/rez
src/rez/packages_.py
PackageBaseResourceWrapper.is_local
def is_local(self): """Returns True if the package is in the local package repository""" local_repo = package_repository_manager.get_repository( self.config.local_packages_path) return (self.resource._repository.uid == local_repo.uid)
python
def is_local(self): local_repo = package_repository_manager.get_repository( self.config.local_packages_path) return (self.resource._repository.uid == local_repo.uid)
[ "def", "is_local", "(", "self", ")", ":", "local_repo", "=", "package_repository_manager", ".", "get_repository", "(", "self", ".", "config", ".", "local_packages_path", ")", "return", "(", "self", ".", "resource", ".", "_repository", ".", "uid", "==", "local_...
Returns True if the package is in the local package repository
[ "Returns", "True", "if", "the", "package", "is", "in", "the", "local", "package", "repository" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L99-L103
246,151
nerdvegas/rez
src/rez/packages_.py
PackageBaseResourceWrapper.print_info
def print_info(self, buf=None, format_=FileFormat.yaml, skip_attributes=None, include_release=False): """Print the contents of the package. Args: buf (file-like object): Stream to write to. format_ (`FileFormat`): Format to write in. skip_attribute...
python
def print_info(self, buf=None, format_=FileFormat.yaml, skip_attributes=None, include_release=False): data = self.validated_data().copy() # config is a special case. We only really want to show any config settings # that were in the package.py, not the entire Config contents ...
[ "def", "print_info", "(", "self", ",", "buf", "=", "None", ",", "format_", "=", "FileFormat", ".", "yaml", ",", "skip_attributes", "=", "None", ",", "include_release", "=", "False", ")", ":", "data", "=", "self", ".", "validated_data", "(", ")", ".", "...
Print the contents of the package. Args: buf (file-like object): Stream to write to. format_ (`FileFormat`): Format to write in. skip_attributes (list of str): List of attributes to not print. include_release (bool): If True, include release-related attributes, ...
[ "Print", "the", "contents", "of", "the", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L105-L135
246,152
nerdvegas/rez
src/rez/packages_.py
Package.qualified_name
def qualified_name(self): """Get the qualified name of the package. Returns: str: Name of the package with version, eg "maya-2016.1". """ o = VersionedObject.construct(self.name, self.version) return str(o)
python
def qualified_name(self): o = VersionedObject.construct(self.name, self.version) return str(o)
[ "def", "qualified_name", "(", "self", ")", ":", "o", "=", "VersionedObject", ".", "construct", "(", "self", ".", "name", ",", "self", ".", "version", ")", "return", "str", "(", "o", ")" ]
Get the qualified name of the package. Returns: str: Name of the package with version, eg "maya-2016.1".
[ "Get", "the", "qualified", "name", "of", "the", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L218-L225
246,153
nerdvegas/rez
src/rez/packages_.py
Package.parent
def parent(self): """Get the parent package family. Returns: `PackageFamily`. """ family = self.repository.get_parent_package_family(self.resource) return PackageFamily(family) if family else None
python
def parent(self): family = self.repository.get_parent_package_family(self.resource) return PackageFamily(family) if family else None
[ "def", "parent", "(", "self", ")", ":", "family", "=", "self", ".", "repository", ".", "get_parent_package_family", "(", "self", ".", "resource", ")", "return", "PackageFamily", "(", "family", ")", "if", "family", "else", "None" ]
Get the parent package family. Returns: `PackageFamily`.
[ "Get", "the", "parent", "package", "family", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L228-L235
246,154
nerdvegas/rez
src/rez/packages_.py
Package.iter_variants
def iter_variants(self): """Iterate over the variants within this package, in index order. Returns: `Variant` iterator. """ for variant in self.repository.iter_variants(self.resource): yield Variant(variant, context=self.context, parent=self)
python
def iter_variants(self): for variant in self.repository.iter_variants(self.resource): yield Variant(variant, context=self.context, parent=self)
[ "def", "iter_variants", "(", "self", ")", ":", "for", "variant", "in", "self", ".", "repository", ".", "iter_variants", "(", "self", ".", "resource", ")", ":", "yield", "Variant", "(", "variant", ",", "context", "=", "self", ".", "context", ",", "parent"...
Iterate over the variants within this package, in index order. Returns: `Variant` iterator.
[ "Iterate", "over", "the", "variants", "within", "this", "package", "in", "index", "order", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L250-L257
246,155
nerdvegas/rez
src/rez/packages_.py
Package.get_variant
def get_variant(self, index=None): """Get the variant with the associated index. Returns: `Variant` object, or None if no variant with the given index exists. """ for variant in self.iter_variants(): if variant.index == index: return variant
python
def get_variant(self, index=None): for variant in self.iter_variants(): if variant.index == index: return variant
[ "def", "get_variant", "(", "self", ",", "index", "=", "None", ")", ":", "for", "variant", "in", "self", ".", "iter_variants", "(", ")", ":", "if", "variant", ".", "index", "==", "index", ":", "return", "variant" ]
Get the variant with the associated index. Returns: `Variant` object, or None if no variant with the given index exists.
[ "Get", "the", "variant", "with", "the", "associated", "index", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L259-L267
246,156
nerdvegas/rez
src/rez/packages_.py
Variant.qualified_name
def qualified_name(self): """Get the qualified name of the variant. Returns: str: Name of the variant with version and index, eg "maya-2016.1[1]". """ idxstr = '' if self.index is None else str(self.index) return "%s[%s]" % (self.qualified_package_name, idxstr)
python
def qualified_name(self): idxstr = '' if self.index is None else str(self.index) return "%s[%s]" % (self.qualified_package_name, idxstr)
[ "def", "qualified_name", "(", "self", ")", ":", "idxstr", "=", "''", "if", "self", ".", "index", "is", "None", "else", "str", "(", "self", ".", "index", ")", "return", "\"%s[%s]\"", "%", "(", "self", ".", "qualified_package_name", ",", "idxstr", ")" ]
Get the qualified name of the variant. Returns: str: Name of the variant with version and index, eg "maya-2016.1[1]".
[ "Get", "the", "qualified", "name", "of", "the", "variant", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L305-L312
246,157
nerdvegas/rez
src/rez/packages_.py
Variant.parent
def parent(self): """Get the parent package. Returns: `Package`. """ if self._parent is not None: return self._parent try: package = self.repository.get_parent_package(self.resource) self._parent = Package(package, context=self.co...
python
def parent(self): if self._parent is not None: return self._parent try: package = self.repository.get_parent_package(self.resource) self._parent = Package(package, context=self.context) except AttributeError as e: reraise(e, ValueError) r...
[ "def", "parent", "(", "self", ")", ":", "if", "self", ".", "_parent", "is", "not", "None", ":", "return", "self", ".", "_parent", "try", ":", "package", "=", "self", ".", "repository", ".", "get_parent_package", "(", "self", ".", "resource", ")", "self...
Get the parent package. Returns: `Package`.
[ "Get", "the", "parent", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L315-L330
246,158
nerdvegas/rez
src/rez/packages_.py
Variant.get_requires
def get_requires(self, build_requires=False, private_build_requires=False): """Get the requirements of the variant. Args: build_requires (bool): If True, include build requirements. private_build_requires (bool): If True, include private build requirements. ...
python
def get_requires(self, build_requires=False, private_build_requires=False): requires = self.requires or [] if build_requires: requires = requires + (self.build_requires or []) if private_build_requires: requires = requires + (self.private_build_requires or []) r...
[ "def", "get_requires", "(", "self", ",", "build_requires", "=", "False", ",", "private_build_requires", "=", "False", ")", ":", "requires", "=", "self", ".", "requires", "or", "[", "]", "if", "build_requires", ":", "requires", "=", "requires", "+", "(", "s...
Get the requirements of the variant. Args: build_requires (bool): If True, include build requirements. private_build_requires (bool): If True, include private build requirements. Returns: List of `Requirement` objects.
[ "Get", "the", "requirements", "of", "the", "variant", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L358-L376
246,159
nerdvegas/rez
src/rez/packages_.py
Variant.install
def install(self, path, dry_run=False, overrides=None): """Install this variant into another package repository. If the package already exists, this variant will be correctly merged into the package. If the variant already exists in this package, the existing variant is returned. ...
python
def install(self, path, dry_run=False, overrides=None): repo = package_repository_manager.get_repository(path) resource = repo.install_variant(self.resource, dry_run=dry_run, overrides=overrides) if resource is None:...
[ "def", "install", "(", "self", ",", "path", ",", "dry_run", "=", "False", ",", "overrides", "=", "None", ")", ":", "repo", "=", "package_repository_manager", ".", "get_repository", "(", "path", ")", "resource", "=", "repo", ".", "install_variant", "(", "se...
Install this variant into another package repository. If the package already exists, this variant will be correctly merged into the package. If the variant already exists in this package, the existing variant is returned. Args: path (str): Path to destination package reposi...
[ "Install", "this", "variant", "into", "another", "package", "repository", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L378-L407
246,160
nerdvegas/rez
src/rez/serialise.py
open_file_for_write
def open_file_for_write(filepath, mode=None): """Writes both to given filepath, and tmpdir location. This is to get around the problem with some NFS's where immediately reading a file that has just been written is problematic. Instead, any files that we write, we also write to /tmp, and reads of these ...
python
def open_file_for_write(filepath, mode=None): stream = StringIO() yield stream content = stream.getvalue() filepath = os.path.realpath(filepath) tmpdir = tmpdir_manager.mkdtemp() cache_filepath = os.path.join(tmpdir, os.path.basename(filepath)) debug_print("Writing to %s (local cache of %s...
[ "def", "open_file_for_write", "(", "filepath", ",", "mode", "=", "None", ")", ":", "stream", "=", "StringIO", "(", ")", "yield", "stream", "content", "=", "stream", ".", "getvalue", "(", ")", "filepath", "=", "os", ".", "path", ".", "realpath", "(", "f...
Writes both to given filepath, and tmpdir location. This is to get around the problem with some NFS's where immediately reading a file that has just been written is problematic. Instead, any files that we write, we also write to /tmp, and reads of these files are redirected there. Args: filepa...
[ "Writes", "both", "to", "given", "filepath", "and", "tmpdir", "location", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/serialise.py#L43-L76
246,161
nerdvegas/rez
src/rez/serialise.py
load_py
def load_py(stream, filepath=None): """Load python-formatted data from a stream. Args: stream (file-like object). Returns: dict. """ with add_sys_paths(config.package_definition_build_python_paths): return _load_py(stream, filepath=filepath)
python
def load_py(stream, filepath=None): with add_sys_paths(config.package_definition_build_python_paths): return _load_py(stream, filepath=filepath)
[ "def", "load_py", "(", "stream", ",", "filepath", "=", "None", ")", ":", "with", "add_sys_paths", "(", "config", ".", "package_definition_build_python_paths", ")", ":", "return", "_load_py", "(", "stream", ",", "filepath", "=", "filepath", ")" ]
Load python-formatted data from a stream. Args: stream (file-like object). Returns: dict.
[ "Load", "python", "-", "formatted", "data", "from", "a", "stream", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/serialise.py#L193-L203
246,162
nerdvegas/rez
src/rez/serialise.py
process_python_objects
def process_python_objects(data, filepath=None): """Replace certain values in the given package data dict. Does things like: * evaluates @early decorated functions, and replaces with return value; * converts functions into `SourceCode` instances so they can be serialized out to installed packages...
python
def process_python_objects(data, filepath=None): def _process(value): if isinstance(value, dict): for k, v in value.items(): value[k] = _process(v) return value elif isfunction(value): func = value if hasattr(func, "_early"): ...
[ "def", "process_python_objects", "(", "data", ",", "filepath", "=", "None", ")", ":", "def", "_process", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "for", "k", ",", "v", "in", "value", ".", "items", "(", ")", "...
Replace certain values in the given package data dict. Does things like: * evaluates @early decorated functions, and replaces with return value; * converts functions into `SourceCode` instances so they can be serialized out to installed packages, and evaluated later; * strips some values (modules...
[ "Replace", "certain", "values", "in", "the", "given", "package", "data", "dict", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/serialise.py#L266-L366
246,163
nerdvegas/rez
src/rez/serialise.py
load_yaml
def load_yaml(stream, **kwargs): """Load yaml-formatted data from a stream. Args: stream (file-like object). Returns: dict. """ # if there's an error parsing the yaml, and you pass yaml.load a string, # it will print lines of context, but will print "<string>" instead of a ...
python
def load_yaml(stream, **kwargs): # if there's an error parsing the yaml, and you pass yaml.load a string, # it will print lines of context, but will print "<string>" instead of a # filename; if you pass a stream, it will print the filename, but no lines # of context. # Get the best of both worlds, b...
[ "def", "load_yaml", "(", "stream", ",", "*", "*", "kwargs", ")", ":", "# if there's an error parsing the yaml, and you pass yaml.load a string,", "# it will print lines of context, but will print \"<string>\" instead of a", "# filename; if you pass a stream, it will print the filename, but n...
Load yaml-formatted data from a stream. Args: stream (file-like object). Returns: dict.
[ "Load", "yaml", "-", "formatted", "data", "from", "a", "stream", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/serialise.py#L369-L395
246,164
nerdvegas/rez
src/rez/vendor/amqp/connection.py
Connection._blocked
def _blocked(self, args): """RabbitMQ Extension.""" reason = args.read_shortstr() if self.on_blocked: return self.on_blocked(reason)
python
def _blocked(self, args): reason = args.read_shortstr() if self.on_blocked: return self.on_blocked(reason)
[ "def", "_blocked", "(", "self", ",", "args", ")", ":", "reason", "=", "args", ".", "read_shortstr", "(", ")", "if", "self", ".", "on_blocked", ":", "return", "self", ".", "on_blocked", "(", "reason", ")" ]
RabbitMQ Extension.
[ "RabbitMQ", "Extension", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L532-L536
246,165
nerdvegas/rez
src/rez/vendor/amqp/connection.py
Connection._x_secure_ok
def _x_secure_ok(self, response): """Security mechanism response This method attempts to authenticate, passing a block of SASL data for the security mechanism at the server side. PARAMETERS: response: longstr security response data A block ...
python
def _x_secure_ok(self, response): args = AMQPWriter() args.write_longstr(response) self._send_method((10, 21), args)
[ "def", "_x_secure_ok", "(", "self", ",", "response", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_longstr", "(", "response", ")", "self", ".", "_send_method", "(", "(", "10", ",", "21", ")", ",", "args", ")" ]
Security mechanism response This method attempts to authenticate, passing a block of SASL data for the security mechanism at the server side. PARAMETERS: response: longstr security response data A block of opaque data passed to the security ...
[ "Security", "mechanism", "response" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L662-L680
246,166
nerdvegas/rez
src/rez/vendor/amqp/connection.py
Connection._x_start_ok
def _x_start_ok(self, client_properties, mechanism, response, locale): """Select security mechanism and locale This method selects a SASL security mechanism. ASL uses SASL (RFC2222) to negotiate authentication and encryption. PARAMETERS: client_properties: table ...
python
def _x_start_ok(self, client_properties, mechanism, response, locale): if self.server_capabilities.get('consumer_cancel_notify'): if 'capabilities' not in client_properties: client_properties['capabilities'] = {} client_properties['capabilities']['consumer_cancel_notify']...
[ "def", "_x_start_ok", "(", "self", ",", "client_properties", ",", "mechanism", ",", "response", ",", "locale", ")", ":", "if", "self", ".", "server_capabilities", ".", "get", "(", "'consumer_cancel_notify'", ")", ":", "if", "'capabilities'", "not", "in", "clie...
Select security mechanism and locale This method selects a SASL security mechanism. ASL uses SASL (RFC2222) to negotiate authentication and encryption. PARAMETERS: client_properties: table client properties mechanism: shortstr selected...
[ "Select", "security", "mechanism", "and", "locale" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L758-L820
246,167
nerdvegas/rez
src/rez/vendor/amqp/connection.py
Connection._tune
def _tune(self, args): """Propose connection tuning parameters This method proposes a set of connection configuration values to the client. The client can accept and/or adjust these. PARAMETERS: channel_max: short proposed maximum channels ...
python
def _tune(self, args): client_heartbeat = self.client_heartbeat or 0 self.channel_max = args.read_short() or self.channel_max self.frame_max = args.read_long() or self.frame_max self.method_writer.frame_max = self.frame_max self.server_heartbeat = args.read_short() or 0 ...
[ "def", "_tune", "(", "self", ",", "args", ")", ":", "client_heartbeat", "=", "self", ".", "client_heartbeat", "or", "0", "self", ".", "channel_max", "=", "args", ".", "read_short", "(", ")", "or", "self", ".", "channel_max", "self", ".", "frame_max", "="...
Propose connection tuning parameters This method proposes a set of connection configuration values to the client. The client can accept and/or adjust these. PARAMETERS: channel_max: short proposed maximum channels The maximum total number of chann...
[ "Propose", "connection", "tuning", "parameters" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L822-L881
246,168
nerdvegas/rez
src/rez/vendor/amqp/connection.py
Connection.heartbeat_tick
def heartbeat_tick(self, rate=2): """Send heartbeat packets, if necessary, and fail if none have been received recently. This should be called frequently, on the order of once per second. :keyword rate: Ignored """ if not self.heartbeat: return # tr...
python
def heartbeat_tick(self, rate=2): if not self.heartbeat: return # treat actual data exchange in either direction as a heartbeat sent_now = self.method_writer.bytes_sent recv_now = self.method_reader.bytes_recv if self.prev_sent is None or self.prev_sent != sent_now: ...
[ "def", "heartbeat_tick", "(", "self", ",", "rate", "=", "2", ")", ":", "if", "not", "self", ".", "heartbeat", ":", "return", "# treat actual data exchange in either direction as a heartbeat", "sent_now", "=", "self", ".", "method_writer", ".", "bytes_sent", "recv_no...
Send heartbeat packets, if necessary, and fail if none have been received recently. This should be called frequently, on the order of once per second. :keyword rate: Ignored
[ "Send", "heartbeat", "packets", "if", "necessary", "and", "fail", "if", "none", "have", "been", "received", "recently", ".", "This", "should", "be", "called", "frequently", "on", "the", "order", "of", "once", "per", "second", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L886-L915
246,169
nerdvegas/rez
src/rez/vendor/amqp/connection.py
Connection._x_tune_ok
def _x_tune_ok(self, channel_max, frame_max, heartbeat): """Negotiate connection tuning parameters This method sends the client's connection tuning parameters to the server. Certain fields are negotiated, others provide capability information. PARAMETERS: channel_ma...
python
def _x_tune_ok(self, channel_max, frame_max, heartbeat): args = AMQPWriter() args.write_short(channel_max) args.write_long(frame_max) args.write_short(heartbeat or 0) self._send_method((10, 31), args) self._wait_tune_ok = False
[ "def", "_x_tune_ok", "(", "self", ",", "channel_max", ",", "frame_max", ",", "heartbeat", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_short", "(", "channel_max", ")", "args", ".", "write_long", "(", "frame_max", ")", "args", ".", "...
Negotiate connection tuning parameters This method sends the client's connection tuning parameters to the server. Certain fields are negotiated, others provide capability information. PARAMETERS: channel_max: short negotiated maximum channels ...
[ "Negotiate", "connection", "tuning", "parameters" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/connection.py#L917-L971
246,170
nerdvegas/rez
src/rez/status.py
Status.parent_suite
def parent_suite(self): """Get the current parent suite. A parent suite exists when a context within a suite is active. That is, during execution of a tool within a suite, or after a user has entered an interactive shell in a suite context, for example via the command- line synt...
python
def parent_suite(self): if self.context and self.context.parent_suite_path: return Suite.load(self.context.parent_suite_path) return None
[ "def", "parent_suite", "(", "self", ")", ":", "if", "self", ".", "context", "and", "self", ".", "context", ".", "parent_suite_path", ":", "return", "Suite", ".", "load", "(", "self", ".", "context", ".", "parent_suite_path", ")", "return", "None" ]
Get the current parent suite. A parent suite exists when a context within a suite is active. That is, during execution of a tool within a suite, or after a user has entered an interactive shell in a suite context, for example via the command- line syntax 'tool +i', where 'tool' is an al...
[ "Get", "the", "current", "parent", "suite", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/status.py#L56-L69
246,171
nerdvegas/rez
src/rez/status.py
Status.print_info
def print_info(self, obj=None, buf=sys.stdout): """Print a status message about the given object. If an object is not provided, status info is shown about the current environment - what the active context is if any, and what suites are visible. Args: obj (str): Stri...
python
def print_info(self, obj=None, buf=sys.stdout): if not obj: self._print_info(buf) return True b = False for fn in (self._print_tool_info, self._print_package_info, self._print_suite_info, self._print_context_info):...
[ "def", "print_info", "(", "self", ",", "obj", "=", "None", ",", "buf", "=", "sys", ".", "stdout", ")", ":", "if", "not", "obj", ":", "self", ".", "_print_info", "(", "buf", ")", "return", "True", "b", "=", "False", "for", "fn", "in", "(", "self",...
Print a status message about the given object. If an object is not provided, status info is shown about the current environment - what the active context is if any, and what suites are visible. Args: obj (str): String which may be one of the following: - A t...
[ "Print", "a", "status", "message", "about", "the", "given", "object", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/status.py#L87-L118
246,172
nerdvegas/rez
src/rez/status.py
Status.print_tools
def print_tools(self, pattern=None, buf=sys.stdout): """Print a list of visible tools. Args: pattern (str): Only list tools that match this glob pattern. """ seen = set() rows = [] context = self.context if context: data = context.get_too...
python
def print_tools(self, pattern=None, buf=sys.stdout): seen = set() rows = [] context = self.context if context: data = context.get_tools() conflicts = set(context.get_conflicting_tools().keys()) for _, (variant, tools) in sorted(data.items()): ...
[ "def", "print_tools", "(", "self", ",", "pattern", "=", "None", ",", "buf", "=", "sys", ".", "stdout", ")", ":", "seen", "=", "set", "(", ")", "rows", "=", "[", "]", "context", "=", "self", ".", "context", "if", "context", ":", "data", "=", "cont...
Print a list of visible tools. Args: pattern (str): Only list tools that match this glob pattern.
[ "Print", "a", "list", "of", "visible", "tools", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/status.py#L120-L193
246,173
nerdvegas/rez
src/rez/developer_package.py
DeveloperPackage.from_path
def from_path(cls, path, format=None): """Load a developer package. A developer package may for example be a package.yaml or package.py in a user's source directory. Args: path: Directory containing the package definition file, or file path for the package f...
python
def from_path(cls, path, format=None): name = None data = None if format is None: formats = (FileFormat.py, FileFormat.yaml) else: formats = (format,) try: mode = os.stat(path).st_mode except (IOError, OSError): raise Pack...
[ "def", "from_path", "(", "cls", ",", "path", ",", "format", "=", "None", ")", ":", "name", "=", "None", "data", "=", "None", "if", "format", "is", "None", ":", "formats", "=", "(", "FileFormat", ".", "py", ",", "FileFormat", ".", "yaml", ")", "else...
Load a developer package. A developer package may for example be a package.yaml or package.py in a user's source directory. Args: path: Directory containing the package definition file, or file path for the package file itself format: which FileFormat to...
[ "Load", "a", "developer", "package", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/developer_package.py#L35-L119
246,174
nerdvegas/rez
src/rez/vendor/yaml/__init__.py
dump_all
def dump_all(documents, stream=None, Dumper=Dumper, default_style=None, default_flow_style=None, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding='utf-8', explicit_start=None, explicit_end=None, version=None, tags=None): """ Serialize...
python
def dump_all(documents, stream=None, Dumper=Dumper, default_style=None, default_flow_style=None, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding='utf-8', explicit_start=None, explicit_end=None, version=None, tags=None): getvalue = None ...
[ "def", "dump_all", "(", "documents", ",", "stream", "=", "None", ",", "Dumper", "=", "Dumper", ",", "default_style", "=", "None", ",", "default_flow_style", "=", "None", ",", "canonical", "=", "None", ",", "indent", "=", "None", ",", "width", "=", "None"...
Serialize a sequence of Python objects into a YAML stream. If stream is None, return the produced string instead.
[ "Serialize", "a", "sequence", "of", "Python", "objects", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/yaml/__init__.py#L163-L195
246,175
nerdvegas/rez
src/rezgui/objects/ProcessTrackerThread.py
ProcessTrackerThread.running_instances
def running_instances(self, context, process_name): """Get a list of running instances. Args: context (`ResolvedContext`): Context the process is running in. process_name (str): Name of the process. Returns: List of (`subprocess.Popen`, start-time) 2-tuples,...
python
def running_instances(self, context, process_name): handle = (id(context), process_name) it = self.processes.get(handle, {}).itervalues() entries = [x for x in it if x[0].poll() is None] return entries
[ "def", "running_instances", "(", "self", ",", "context", ",", "process_name", ")", ":", "handle", "=", "(", "id", "(", "context", ")", ",", "process_name", ")", "it", "=", "self", ".", "processes", ".", "get", "(", "handle", ",", "{", "}", ")", ".", ...
Get a list of running instances. Args: context (`ResolvedContext`): Context the process is running in. process_name (str): Name of the process. Returns: List of (`subprocess.Popen`, start-time) 2-tuples, where start_time is the epoch time the process was...
[ "Get", "a", "list", "of", "running", "instances", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/ProcessTrackerThread.py#L24-L38
246,176
nerdvegas/rez
src/rez/rex.py
ActionManager.get_public_methods
def get_public_methods(self): """ return a list of methods on this class which should be exposed in the rex API. """ return self.get_action_methods() + [ ('getenv', self.getenv), ('expandvars', self.expandvars), ('defined', self.defined), ...
python
def get_public_methods(self): return self.get_action_methods() + [ ('getenv', self.getenv), ('expandvars', self.expandvars), ('defined', self.defined), ('undefined', self.undefined)]
[ "def", "get_public_methods", "(", "self", ")", ":", "return", "self", ".", "get_action_methods", "(", ")", "+", "[", "(", "'getenv'", ",", "self", ".", "getenv", ")", ",", "(", "'expandvars'", ",", "self", ".", "expandvars", ")", ",", "(", "'defined'", ...
return a list of methods on this class which should be exposed in the rex API.
[ "return", "a", "list", "of", "methods", "on", "this", "class", "which", "should", "be", "exposed", "in", "the", "rex", "API", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L205-L214
246,177
nerdvegas/rez
src/rez/rex.py
Python.apply_environ
def apply_environ(self): """Apply changes to target environ. """ if self.manager is None: raise RezSystemError("You must call 'set_manager' on a Python rex " "interpreter before using it.") self.target_environ.update(self.manager.environ)
python
def apply_environ(self): if self.manager is None: raise RezSystemError("You must call 'set_manager' on a Python rex " "interpreter before using it.") self.target_environ.update(self.manager.environ)
[ "def", "apply_environ", "(", "self", ")", ":", "if", "self", ".", "manager", "is", "None", ":", "raise", "RezSystemError", "(", "\"You must call 'set_manager' on a Python rex \"", "\"interpreter before using it.\"", ")", "self", ".", "target_environ", ".", "update", "...
Apply changes to target environ.
[ "Apply", "changes", "to", "target", "environ", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L564-L571
246,178
nerdvegas/rez
src/rez/rex.py
EscapedString.formatted
def formatted(self, func): """Return the string with non-literal parts formatted. Args: func (callable): Callable that translates a string into a formatted string. Returns: `EscapedString` object. """ other = EscapedString.__new__(Escaped...
python
def formatted(self, func): other = EscapedString.__new__(EscapedString) other.strings = [] for is_literal, value in self.strings: if not is_literal: value = func(value) other.strings.append((is_literal, value)) return other
[ "def", "formatted", "(", "self", ",", "func", ")", ":", "other", "=", "EscapedString", ".", "__new__", "(", "EscapedString", ")", "other", ".", "strings", "=", "[", "]", "for", "is_literal", ",", "value", "in", "self", ".", "strings", ":", "if", "not",...
Return the string with non-literal parts formatted. Args: func (callable): Callable that translates a string into a formatted string. Returns: `EscapedString` object.
[ "Return", "the", "string", "with", "non", "-", "literal", "parts", "formatted", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L764-L781
246,179
nerdvegas/rez
src/rez/rex.py
RexExecutor.execute_code
def execute_code(self, code, filename=None, isolate=False): """Execute code within the execution context. Args: code (str or SourceCode): Rex code to execute. filename (str): Filename to report if there are syntax errors. isolate (bool): If True, do not affect `self....
python
def execute_code(self, code, filename=None, isolate=False): def _apply(): self.compile_code(code=code, filename=filename, exec_namespace=self.globals) # we want to execute the code using self.globals - if for no other # rea...
[ "def", "execute_code", "(", "self", ",", "code", ",", "filename", "=", "None", ",", "isolate", "=", "False", ")", ":", "def", "_apply", "(", ")", ":", "self", ".", "compile_code", "(", "code", "=", "code", ",", "filename", "=", "filename", ",", "exec...
Execute code within the execution context. Args: code (str or SourceCode): Rex code to execute. filename (str): Filename to report if there are syntax errors. isolate (bool): If True, do not affect `self.globals` by executing this code.
[ "Execute", "code", "within", "the", "execution", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L1187-L1217
246,180
nerdvegas/rez
src/rez/rex.py
RexExecutor.execute_function
def execute_function(self, func, *nargs, **kwargs): """ Execute a function object within the execution context. @returns The result of the function call. """ # makes a copy of the func import types fn = types.FunctionType(func.func_code, ...
python
def execute_function(self, func, *nargs, **kwargs): # makes a copy of the func import types fn = types.FunctionType(func.func_code, func.func_globals.copy(), name=func.func_name, argdefs=func.func_def...
[ "def", "execute_function", "(", "self", ",", "func", ",", "*", "nargs", ",", "*", "*", "kwargs", ")", ":", "# makes a copy of the func", "import", "types", "fn", "=", "types", ".", "FunctionType", "(", "func", ".", "func_code", ",", "func", ".", "func_glob...
Execute a function object within the execution context. @returns The result of the function call.
[ "Execute", "a", "function", "object", "within", "the", "execution", "context", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L1219-L1245
246,181
nerdvegas/rez
src/rez/rex.py
RexExecutor.get_output
def get_output(self, style=OutputStyle.file): """Returns the result of all previous calls to execute_code.""" return self.manager.get_output(style=style)
python
def get_output(self, style=OutputStyle.file): return self.manager.get_output(style=style)
[ "def", "get_output", "(", "self", ",", "style", "=", "OutputStyle", ".", "file", ")", ":", "return", "self", ".", "manager", ".", "get_output", "(", "style", "=", "style", ")" ]
Returns the result of all previous calls to execute_code.
[ "Returns", "the", "result", "of", "all", "previous", "calls", "to", "execute_code", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L1247-L1249
246,182
nerdvegas/rez
src/rez/vendor/pygraph/algorithms/filters/find.py
find.configure
def configure(self, graph, spanning_tree): """ Configure the filter. @type graph: graph @param graph: Graph. @type spanning_tree: dictionary @param spanning_tree: Spanning tree. """ self.graph = graph self.spanning_tree = spanni...
python
def configure(self, graph, spanning_tree): self.graph = graph self.spanning_tree = spanning_tree
[ "def", "configure", "(", "self", ",", "graph", ",", "spanning_tree", ")", ":", "self", ".", "graph", "=", "graph", "self", ".", "spanning_tree", "=", "spanning_tree" ]
Configure the filter. @type graph: graph @param graph: Graph. @type spanning_tree: dictionary @param spanning_tree: Spanning tree.
[ "Configure", "the", "filter", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pygraph/algorithms/filters/find.py#L47-L58
246,183
nerdvegas/rez
src/rez/package_filter.py
PackageFilterBase.iter_packages
def iter_packages(self, name, range_=None, paths=None): """Same as iter_packages in packages.py, but also applies this filter. Args: name (str): Name of the package, eg 'maya'. range_ (VersionRange or str): If provided, limits the versions returned to those in `r...
python
def iter_packages(self, name, range_=None, paths=None): for package in iter_packages(name, range_, paths): if not self.excludes(package): yield package
[ "def", "iter_packages", "(", "self", ",", "name", ",", "range_", "=", "None", ",", "paths", "=", "None", ")", ":", "for", "package", "in", "iter_packages", "(", "name", ",", "range_", ",", "paths", ")", ":", "if", "not", "self", ".", "excludes", "(",...
Same as iter_packages in packages.py, but also applies this filter. Args: name (str): Name of the package, eg 'maya'. range_ (VersionRange or str): If provided, limits the versions returned to those in `range_`. paths (list of str, optional): paths to search ...
[ "Same", "as", "iter_packages", "in", "packages", ".", "py", "but", "also", "applies", "this", "filter", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L49-L64
246,184
nerdvegas/rez
src/rez/package_filter.py
PackageFilter.copy
def copy(self): """Return a shallow copy of the filter. Adding rules to the copy will not alter the source. """ other = PackageFilter.__new__(PackageFilter) other._excludes = self._excludes.copy() other._includes = self._includes.copy() return other
python
def copy(self): other = PackageFilter.__new__(PackageFilter) other._excludes = self._excludes.copy() other._includes = self._includes.copy() return other
[ "def", "copy", "(", "self", ")", ":", "other", "=", "PackageFilter", ".", "__new__", "(", "PackageFilter", ")", "other", ".", "_excludes", "=", "self", ".", "_excludes", ".", "copy", "(", ")", "other", ".", "_includes", "=", "self", ".", "_includes", "...
Return a shallow copy of the filter. Adding rules to the copy will not alter the source.
[ "Return", "a", "shallow", "copy", "of", "the", "filter", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L126-L134
246,185
nerdvegas/rez
src/rez/package_filter.py
PackageFilter.cost
def cost(self): """Get the approximate cost of this filter. Cost is the total cost of the exclusion rules in this filter. The cost of family-specific filters is divided by 10. Returns: float: The approximate cost of the filter. """ total = 0.0 for fa...
python
def cost(self): total = 0.0 for family, rules in self._excludes.iteritems(): cost = sum(x.cost() for x in rules) if family: cost = cost / float(10) total += cost return total
[ "def", "cost", "(", "self", ")", ":", "total", "=", "0.0", "for", "family", ",", "rules", "in", "self", ".", "_excludes", ".", "iteritems", "(", ")", ":", "cost", "=", "sum", "(", "x", ".", "cost", "(", ")", "for", "x", "in", "rules", ")", "if"...
Get the approximate cost of this filter. Cost is the total cost of the exclusion rules in this filter. The cost of family-specific filters is divided by 10. Returns: float: The approximate cost of the filter.
[ "Get", "the", "approximate", "cost", "of", "this", "filter", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L149-L164
246,186
nerdvegas/rez
src/rez/package_filter.py
PackageFilterList.add_filter
def add_filter(self, package_filter): """Add a filter to the list. Args: package_filter (`PackageFilter`): Filter to add. """ filters = self.filters + [package_filter] self.filters = sorted(filters, key=lambda x: x.cost)
python
def add_filter(self, package_filter): filters = self.filters + [package_filter] self.filters = sorted(filters, key=lambda x: x.cost)
[ "def", "add_filter", "(", "self", ",", "package_filter", ")", ":", "filters", "=", "self", ".", "filters", "+", "[", "package_filter", "]", "self", ".", "filters", "=", "sorted", "(", "filters", ",", "key", "=", "lambda", "x", ":", "x", ".", "cost", ...
Add a filter to the list. Args: package_filter (`PackageFilter`): Filter to add.
[ "Add", "a", "filter", "to", "the", "list", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L210-L217
246,187
nerdvegas/rez
src/rez/package_filter.py
PackageFilterList.copy
def copy(self): """Return a copy of the filter list. Adding rules to the copy will not alter the source. """ other = PackageFilterList.__new__(PackageFilterList) other.filters = [x.copy() for x in self.filters] return other
python
def copy(self): other = PackageFilterList.__new__(PackageFilterList) other.filters = [x.copy() for x in self.filters] return other
[ "def", "copy", "(", "self", ")", ":", "other", "=", "PackageFilterList", ".", "__new__", "(", "PackageFilterList", ")", "other", ".", "filters", "=", "[", "x", ".", "copy", "(", ")", "for", "x", "in", "self", ".", "filters", "]", "return", "other" ]
Return a copy of the filter list. Adding rules to the copy will not alter the source.
[ "Return", "a", "copy", "of", "the", "filter", "list", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L244-L251
246,188
nerdvegas/rez
src/rez/package_filter.py
Rule.parse_rule
def parse_rule(cls, txt): """Parse a rule from a string. See rezconfig.package_filter for an overview of valid strings. Args: txt (str): String to parse. Returns: `Rule` instance. """ types = {"glob": GlobRule, "regex": RegexRul...
python
def parse_rule(cls, txt): types = {"glob": GlobRule, "regex": RegexRule, "range": RangeRule, "before": TimestampRule, "after": TimestampRule} # parse form 'x(y)' into x, y label, txt = Rule._parse_label(txt) if label is...
[ "def", "parse_rule", "(", "cls", ",", "txt", ")", ":", "types", "=", "{", "\"glob\"", ":", "GlobRule", ",", "\"regex\"", ":", "RegexRule", ",", "\"range\"", ":", "RangeRule", ",", "\"before\"", ":", "TimestampRule", ",", "\"after\"", ":", "TimestampRule", ...
Parse a rule from a string. See rezconfig.package_filter for an overview of valid strings. Args: txt (str): String to parse. Returns: `Rule` instance.
[ "Parse", "a", "rule", "from", "a", "string", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_filter.py#L309-L345
246,189
nerdvegas/rez
src/rez/vendor/amqp/serialization.py
AMQPReader.read_bit
def read_bit(self): """Read a single boolean value.""" if not self.bitcount: self.bits = ord(self.input.read(1)) self.bitcount = 8 result = (self.bits & 1) == 1 self.bits >>= 1 self.bitcount -= 1 return result
python
def read_bit(self): if not self.bitcount: self.bits = ord(self.input.read(1)) self.bitcount = 8 result = (self.bits & 1) == 1 self.bits >>= 1 self.bitcount -= 1 return result
[ "def", "read_bit", "(", "self", ")", ":", "if", "not", "self", ".", "bitcount", ":", "self", ".", "bits", "=", "ord", "(", "self", ".", "input", ".", "read", "(", "1", ")", ")", "self", ".", "bitcount", "=", "8", "result", "=", "(", "self", "."...
Read a single boolean value.
[ "Read", "a", "single", "boolean", "value", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L76-L84
246,190
nerdvegas/rez
src/rez/vendor/amqp/serialization.py
AMQPReader.read_long
def read_long(self): """Read an unsigned 32-bit integer""" self.bitcount = self.bits = 0 return unpack('>I', self.input.read(4))[0]
python
def read_long(self): self.bitcount = self.bits = 0 return unpack('>I', self.input.read(4))[0]
[ "def", "read_long", "(", "self", ")", ":", "self", ".", "bitcount", "=", "self", ".", "bits", "=", "0", "return", "unpack", "(", "'>I'", ",", "self", ".", "input", ".", "read", "(", "4", ")", ")", "[", "0", "]" ]
Read an unsigned 32-bit integer
[ "Read", "an", "unsigned", "32", "-", "bit", "integer" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L96-L99
246,191
nerdvegas/rez
src/rez/vendor/amqp/serialization.py
AMQPReader.read_longlong
def read_longlong(self): """Read an unsigned 64-bit integer""" self.bitcount = self.bits = 0 return unpack('>Q', self.input.read(8))[0]
python
def read_longlong(self): self.bitcount = self.bits = 0 return unpack('>Q', self.input.read(8))[0]
[ "def", "read_longlong", "(", "self", ")", ":", "self", ".", "bitcount", "=", "self", ".", "bits", "=", "0", "return", "unpack", "(", "'>Q'", ",", "self", ".", "input", ".", "read", "(", "8", ")", ")", "[", "0", "]" ]
Read an unsigned 64-bit integer
[ "Read", "an", "unsigned", "64", "-", "bit", "integer" ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L101-L104
246,192
nerdvegas/rez
src/rez/vendor/amqp/serialization.py
AMQPReader.read_float
def read_float(self): """Read float value.""" self.bitcount = self.bits = 0 return unpack('>d', self.input.read(8))[0]
python
def read_float(self): self.bitcount = self.bits = 0 return unpack('>d', self.input.read(8))[0]
[ "def", "read_float", "(", "self", ")", ":", "self", ".", "bitcount", "=", "self", ".", "bits", "=", "0", "return", "unpack", "(", "'>d'", ",", "self", ".", "input", ".", "read", "(", "8", ")", ")", "[", "0", "]" ]
Read float value.
[ "Read", "float", "value", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L106-L109
246,193
nerdvegas/rez
src/rez/vendor/amqp/serialization.py
AMQPReader.read_shortstr
def read_shortstr(self): """Read a short string that's stored in up to 255 bytes. The encoding isn't specified in the AMQP spec, so assume it's utf-8 """ self.bitcount = self.bits = 0 slen = unpack('B', self.input.read(1))[0] return self.input.read(slen).decode(...
python
def read_shortstr(self): self.bitcount = self.bits = 0 slen = unpack('B', self.input.read(1))[0] return self.input.read(slen).decode('utf-8')
[ "def", "read_shortstr", "(", "self", ")", ":", "self", ".", "bitcount", "=", "self", ".", "bits", "=", "0", "slen", "=", "unpack", "(", "'B'", ",", "self", ".", "input", ".", "read", "(", "1", ")", ")", "[", "0", "]", "return", "self", ".", "in...
Read a short string that's stored in up to 255 bytes. The encoding isn't specified in the AMQP spec, so assume it's utf-8
[ "Read", "a", "short", "string", "that", "s", "stored", "in", "up", "to", "255", "bytes", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L111-L120
246,194
nerdvegas/rez
src/rez/vendor/amqp/serialization.py
GenericContent._load_properties
def _load_properties(self, raw_bytes): """Given the raw bytes containing the property-flags and property-list from a content-frame-header, parse and insert into a dictionary stored in this object as an attribute named 'properties'.""" r = AMQPReader(raw_bytes) # # Read 1...
python
def _load_properties(self, raw_bytes): r = AMQPReader(raw_bytes) # # Read 16-bit shorts until we get one with a low bit set to zero # flags = [] while 1: flag_bits = r.read_short() flags.append(flag_bits) if flag_bits & 1 == 0: ...
[ "def", "_load_properties", "(", "self", ",", "raw_bytes", ")", ":", "r", "=", "AMQPReader", "(", "raw_bytes", ")", "#", "# Read 16-bit shorts until we get one with a low bit set to zero", "#", "flags", "=", "[", "]", "while", "1", ":", "flag_bits", "=", "r", "."...
Given the raw bytes containing the property-flags and property-list from a content-frame-header, parse and insert into a dictionary stored in this object as an attribute named 'properties'.
[ "Given", "the", "raw", "bytes", "containing", "the", "property", "-", "flags", "and", "property", "-", "list", "from", "a", "content", "-", "frame", "-", "header", "parse", "and", "insert", "into", "a", "dictionary", "stored", "in", "this", "object", "as",...
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L451-L479
246,195
nerdvegas/rez
src/rez/util.py
create_executable_script
def create_executable_script(filepath, body, program=None): """Create an executable script. Args: filepath (str): File to create. body (str or callable): Contents of the script. If a callable, its code is used as the script body. program (str): Name of program to launch the ...
python
def create_executable_script(filepath, body, program=None): program = program or "python" if callable(body): from rez.utils.sourcecode import SourceCode code = SourceCode(func=body) body = code.source if not body.endswith('\n'): body += '\n' with open(filepath, 'w') as ...
[ "def", "create_executable_script", "(", "filepath", ",", "body", ",", "program", "=", "None", ")", ":", "program", "=", "program", "or", "\"python\"", "if", "callable", "(", "body", ")", ":", "from", "rez", ".", "utils", ".", "sourcecode", "import", "Sourc...
Create an executable script. Args: filepath (str): File to create. body (str or callable): Contents of the script. If a callable, its code is used as the script body. program (str): Name of program to launch the script, 'python' if None
[ "Create", "an", "executable", "script", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L31-L60
246,196
nerdvegas/rez
src/rez/util.py
create_forwarding_script
def create_forwarding_script(filepath, module, func_name, *nargs, **kwargs): """Create a 'forwarding' script. A forwarding script is one that executes some arbitrary Rez function. This is used internally by Rez to dynamically create a script that uses Rez, even though the parent environment may not be ...
python
def create_forwarding_script(filepath, module, func_name, *nargs, **kwargs): doc = dict( module=module, func_name=func_name) if nargs: doc["nargs"] = nargs if kwargs: doc["kwargs"] = kwargs body = dump_yaml(doc) create_executable_script(filepath, body, "_rez_fwd")
[ "def", "create_forwarding_script", "(", "filepath", ",", "module", ",", "func_name", ",", "*", "nargs", ",", "*", "*", "kwargs", ")", ":", "doc", "=", "dict", "(", "module", "=", "module", ",", "func_name", "=", "func_name", ")", "if", "nargs", ":", "d...
Create a 'forwarding' script. A forwarding script is one that executes some arbitrary Rez function. This is used internally by Rez to dynamically create a script that uses Rez, even though the parent environment may not be configured to do so.
[ "Create", "a", "forwarding", "script", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L63-L80
246,197
nerdvegas/rez
src/rez/util.py
dedup
def dedup(seq): """Remove duplicates from a list while keeping order.""" seen = set() for item in seq: if item not in seen: seen.add(item) yield item
python
def dedup(seq): seen = set() for item in seq: if item not in seen: seen.add(item) yield item
[ "def", "dedup", "(", "seq", ")", ":", "seen", "=", "set", "(", ")", "for", "item", "in", "seq", ":", "if", "item", "not", "in", "seen", ":", "seen", ".", "add", "(", "item", ")", "yield", "item" ]
Remove duplicates from a list while keeping order.
[ "Remove", "duplicates", "from", "a", "list", "while", "keeping", "order", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L83-L89
246,198
nerdvegas/rez
src/rez/util.py
find_last_sublist
def find_last_sublist(list_, sublist): """Given a list, find the last occurance of a sublist within it. Returns: Index where the sublist starts, or None if there is no match. """ for i in reversed(range(len(list_) - len(sublist) + 1)): if list_[i] == sublist[0] and list_[i:i + len(subli...
python
def find_last_sublist(list_, sublist): for i in reversed(range(len(list_) - len(sublist) + 1)): if list_[i] == sublist[0] and list_[i:i + len(sublist)] == sublist: return i return None
[ "def", "find_last_sublist", "(", "list_", ",", "sublist", ")", ":", "for", "i", "in", "reversed", "(", "range", "(", "len", "(", "list_", ")", "-", "len", "(", "sublist", ")", "+", "1", ")", ")", ":", "if", "list_", "[", "i", "]", "==", "sublist"...
Given a list, find the last occurance of a sublist within it. Returns: Index where the sublist starts, or None if there is no match.
[ "Given", "a", "list", "find", "the", "last", "occurance", "of", "a", "sublist", "within", "it", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L157-L166
246,199
nerdvegas/rez
src/rez/package_help.py
PackageHelp.open
def open(self, section_index=0): """Launch a help section.""" uri = self._sections[section_index][1] if len(uri.split()) == 1: self._open_url(uri) else: if self._verbose: print "running command: %s" % uri p = popen(uri, shell=True) ...
python
def open(self, section_index=0): uri = self._sections[section_index][1] if len(uri.split()) == 1: self._open_url(uri) else: if self._verbose: print "running command: %s" % uri p = popen(uri, shell=True) p.wait()
[ "def", "open", "(", "self", ",", "section_index", "=", "0", ")", ":", "uri", "=", "self", ".", "_sections", "[", "section_index", "]", "[", "1", "]", "if", "len", "(", "uri", ".", "split", "(", ")", ")", "==", "1", ":", "self", ".", "_open_url", ...
Launch a help section.
[ "Launch", "a", "help", "section", "." ]
1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_help.py#L88-L97