Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
RunnerManager._prepare_runner_class
(self)
Возвращает класс ранера
Возвращает класс ранера
def _prepare_runner_class(self) -> Type[BaseRunner]: """ Возвращает класс ранера """ return BaseRunner
[ "def", "_prepare_runner_class", "(", "self", ")", "->", "Type", "[", "BaseRunner", "]", ":", "return", "BaseRunner" ]
[ 37, 4 ]
[ 41, 25 ]
python
en
['en', 'error', 'th']
False
RunnerManager._create_runner
(self, *args, **kwargs)
Метод создания пусковика
Метод создания пусковика
def _create_runner(self, *args, **kwargs): """ Метод создания пусковика """ if issubclass(self._runner_class, BaseRunner): self._runner = self._runner_class(*args, **kwargs) else: self._runner = BaseRunner(*args, **kwargs)
[ "def", "_create_runner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "issubclass", "(", "self", ".", "_runner_class", ",", "BaseRunner", ")", ":", "self", ".", "_runner", "=", "self", ".", "_runner_class", "(", "*", "args", ...
[ 43, 4 ]
[ 50, 54 ]
python
en
['en', 'error', 'th']
False
RunnerManager._after_create_runner
(self, *args, **kwargs)
Точка расширения поведения менеджера ранера после создания ранера
Точка расширения поведения менеджера ранера после создания ранера
def _after_create_runner(self, *args, **kwargs): """ Точка расширения поведения менеджера ранера после создания ранера """
[ "def", "_after_create_runner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
[ 52, 4 ]
[ 55, 11 ]
python
en
['en', 'error', 'th']
False
RunnerManager._before_prepare_runner
(self, *args, **kwargs)
Точка расширения поведения менеджера ранера перед подготовкой ранера
Точка расширения поведения менеджера ранера перед подготовкой ранера
def _before_prepare_runner(self, *args, **kwargs): """ Точка расширения поведения менеджера ранера перед подготовкой ранера """
[ "def", "_before_prepare_runner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
[ 57, 4 ]
[ 60, 11 ]
python
en
['en', 'error', 'th']
False
RunnerManager._prepare_runner
(self, *args, **kwargs)
Метод подготовки пусковика к запуску Чаще всего используется для создания задач и заполнения ими очереди пусковика
Метод подготовки пусковика к запуску
def _prepare_runner(self, *args, **kwargs): """ Метод подготовки пусковика к запуску Чаще всего используется для создания задач и заполнения ими очереди пусковика """
[ "def", "_prepare_runner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
[ 63, 4 ]
[ 69, 11 ]
python
en
['en', 'error', 'th']
False
RunnerManager._after_prepare_runner
(self, *args, **kwargs)
Точка расширения поведения менеджера ранера после подготовки ранера
Точка расширения поведения менеджера ранера после подготовки ранера
def _after_prepare_runner(self, *args, **kwargs): """ Точка расширения поведения менеджера ранера после подготовки ранера """
[ "def", "_after_prepare_runner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
[ 71, 4 ]
[ 74, 11 ]
python
en
['en', 'error', 'th']
False
RunnerManager._before_start_runner
(self, *args, **kwargs)
Точка расширения поведения менеджера ранера перед запуском ранера
Точка расширения поведения менеджера ранера перед запуском ранера
def _before_start_runner(self, *args, **kwargs): """ Точка расширения поведения менеджера ранера перед запуском ранера """
[ "def", "_before_start_runner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
[ 76, 4 ]
[ 79, 10 ]
python
en
['en', 'error', 'th']
False
RunnerManager._start_runner
(self, *args, **kwargs)
Точка расширения в месте запуска пусковика
Точка расширения в месте запуска пусковика
def _start_runner(self, *args, **kwargs): """ Точка расширения в месте запуска пусковика """ if self._runner: self._runner.run(*args, **kwargs)
[ "def", "_start_runner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_runner", ":", "self", ".", "_runner", ".", "run", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 81, 4 ]
[ 86, 45 ]
python
en
['en', 'error', 'th']
False
RunnerManager._after_start_runner
(self, *args, **kwargs)
Точка расширения поведения менеджера ранера после запуска ранера
Точка расширения поведения менеджера ранера после запуска ранера
def _after_start_runner(self, *args, **kwargs): """ Точка расширения поведения менеджера ранера после запуска ранера """
[ "def", "_after_start_runner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
[ 88, 4 ]
[ 91, 10 ]
python
en
['en', 'error', 'th']
False
LazySavingRunnerManager._before_do_save
(self, *args, **kwargs)
Точка расширения поведения менеджера ранера перед запуском сохранения объектов
Точка расширения поведения менеджера ранера перед запуском сохранения объектов
def _before_do_save(self, *args, **kwargs): """ Точка расширения поведения менеджера ранера перед запуском сохранения объектов """
[ "def", "_before_do_save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
[ 114, 4 ]
[ 117, 11 ]
python
en
['en', 'error', 'th']
False
LazySavingRunnerManager._do_save
(self, *args, **kwargs)
Запуск сохранения пусковика
Запуск сохранения пусковика
def _do_save(self, *args, **kwargs): """ Запуск сохранения пусковика """ self._runner.do_save(*args, **kwargs)
[ "def", "_do_save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_runner", ".", "do_save", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 119, 4 ]
[ 123, 45 ]
python
en
['en', 'error', 'th']
False
LazySavingRunnerManager._after_do_save
(self, *args, **kwargs)
Точка расширения поведения менеджера ранера после запуска сохранения объектов
Точка расширения поведения менеджера ранера после запуска сохранения объектов
def _after_do_save(self, *args, **kwargs): """ Точка расширения поведения менеджера ранера после запуска сохранения объектов """
[ "def", "_after_do_save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
[ 125, 4 ]
[ 128, 11 ]
python
en
['en', 'error', 'th']
False
synthesize
(sequence, sample_rate, wave=np.sin)
Synthesizes audio from a music_pb2.NoteSequence using a waveform. This uses the pretty_midi `synthesize` method. Sound quality will be lower than using `fluidsynth` with a good SoundFont. Args: sequence: A music_pb2.NoteSequence to synthesize. sample_rate: An integer audio sampling rate in Hz. wave:...
Synthesizes audio from a music_pb2.NoteSequence using a waveform.
def synthesize(sequence, sample_rate, wave=np.sin): """Synthesizes audio from a music_pb2.NoteSequence using a waveform. This uses the pretty_midi `synthesize` method. Sound quality will be lower than using `fluidsynth` with a good SoundFont. Args: sequence: A music_pb2.NoteSequence to synthesize. sam...
[ "def", "synthesize", "(", "sequence", ",", "sample_rate", ",", "wave", "=", "np", ".", "sin", ")", ":", "midi", "=", "midi_io", ".", "note_sequence_to_pretty_midi", "(", "sequence", ")", "return", "midi", ".", "synthesize", "(", "fs", "=", "sample_rate", "...
[ 20, 0 ]
[ 35, 51 ]
python
en
['en', 'en', 'en']
True
fluidsynth
(sequence, sample_rate, sf2_path=None)
Synthesizes audio from a music_pb2.NoteSequence using FluidSynth. This uses the pretty_midi `fluidsynth` method. In order to use this synth, you must have FluidSynth and pyFluidSynth installed. Args: sequence: A music_pb2.NoteSequence to synthesize. sample_rate: An integer audio sampling rate in Hz. ...
Synthesizes audio from a music_pb2.NoteSequence using FluidSynth.
def fluidsynth(sequence, sample_rate, sf2_path=None): """Synthesizes audio from a music_pb2.NoteSequence using FluidSynth. This uses the pretty_midi `fluidsynth` method. In order to use this synth, you must have FluidSynth and pyFluidSynth installed. Args: sequence: A music_pb2.NoteSequence to synthesize....
[ "def", "fluidsynth", "(", "sequence", ",", "sample_rate", ",", "sf2_path", "=", "None", ")", ":", "midi", "=", "midi_io", ".", "note_sequence_to_pretty_midi", "(", "sequence", ")", "return", "midi", ".", "fluidsynth", "(", "fs", "=", "sample_rate", ",", "sf2...
[ 38, 0 ]
[ 54, 59 ]
python
en
['en', 'en', 'en']
True
decide_user_install
( use_user_site, # type: Optional[bool] prefix_path=None, # type: Optional[str] target_dir=None, # type: Optional[str] root_path=None, # type: Optional[str] isolated_mode=False, # type: bool )
Determine whether to do a user install based on the input options. If use_user_site is False, no additional checks are done. If use_user_site is True, it is checked for compatibility with other options. If use_user_site is None, the default behaviour depends on the environment, which is provided by...
Determine whether to do a user install based on the input options.
def decide_user_install( use_user_site, # type: Optional[bool] prefix_path=None, # type: Optional[str] target_dir=None, # type: Optional[str] root_path=None, # type: Optional[str] isolated_mode=False, # type: bool ): # type: (...) -> bool """Determine whether to do a user install based ...
[ "def", "decide_user_install", "(", "use_user_site", ",", "# type: Optional[bool]", "prefix_path", "=", "None", ",", "# type: Optional[str]", "target_dir", "=", "None", ",", "# type: Optional[str]", "root_path", "=", "None", ",", "# type: Optional[str]", "isolated_mode", "...
[ 612, 0 ]
[ 669, 15 ]
python
en
['en', 'en', 'en']
True
reject_location_related_install_options
(requirements, options)
If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning.
If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning.
def reject_location_related_install_options(requirements, options): # type: (List[InstallRequirement], Optional[List[str]]) -> None """If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. """ def format_options(opti...
[ "def", "reject_location_related_install_options", "(", "requirements", ",", "options", ")", ":", "# type: (List[InstallRequirement], Optional[List[str]]) -> None", "def", "format_options", "(", "option_names", ")", ":", "# type: (Iterable[str]) -> List[str]", "return", "[", "\"--...
[ 672, 0 ]
[ 711, 5 ]
python
en
['en', 'en', 'en']
True
create_env_error_message
(error, show_traceback, using_user_site)
Format an error message for an EnvironmentError It may occur anytime during the execution of the install command.
Format an error message for an EnvironmentError
def create_env_error_message(error, show_traceback, using_user_site): # type: (EnvironmentError, bool, bool) -> str """Format an error message for an EnvironmentError It may occur anytime during the execution of the install command. """ parts = [] # Mention the error if we are not going to sho...
[ "def", "create_env_error_message", "(", "error", ",", "show_traceback", ",", "using_user_site", ")", ":", "# type: (EnvironmentError, bool, bool) -> str", "parts", "=", "[", "]", "# Mention the error if we are not going to show a traceback", "parts", ".", "append", "(", "\"Co...
[ 714, 0 ]
[ 748, 40 ]
python
br
['br', 'gl', 'en']
False
validate_port_or_colon_separated_port_range
(port_range)
Accepts a port number or a single-colon separated range.
Accepts a port number or a single-colon separated range.
def validate_port_or_colon_separated_port_range(port_range): """Accepts a port number or a single-colon separated range.""" if port_range.count(':') > 1: raise ValidationError(_("One colon allowed in port range")) ports = port_range.split(':') for port in ports: validate_port_range(port)
[ "def", "validate_port_or_colon_separated_port_range", "(", "port_range", ")", ":", "if", "port_range", ".", "count", "(", "':'", ")", ">", "1", ":", "raise", "ValidationError", "(", "_", "(", "\"One colon allowed in port range\"", ")", ")", "ports", "=", "port_ran...
[ 57, 0 ]
[ 63, 33 ]
python
en
['en', 'en', 'en']
True
HTMLElement.get_default_classes
(self)
Returns an iterable of default classes. They will be combined with any other declared classes.
Returns an iterable of default classes.
def get_default_classes(self): """Returns an iterable of default classes. They will be combined with any other declared classes. """ return []
[ "def", "get_default_classes", "(", "self", ")", ":", "return", "[", "]" ]
[ 23, 4 ]
[ 28, 17 ]
python
en
['en', 'en', 'en']
True
HTMLElement.get_default_attrs
(self)
Returns a dict of default attributes. They will be combined with other declared attributes.
Returns a dict of default attributes.
def get_default_attrs(self): """Returns a dict of default attributes. They will be combined with other declared attributes. """ return {}
[ "def", "get_default_attrs", "(", "self", ")", ":", "return", "{", "}" ]
[ 30, 4 ]
[ 35, 17 ]
python
en
['en', 'ca', 'en']
True
HTMLElement.get_final_attrs
(self, classes=True)
Returns a dict containing the final attributes to be rendered.
Returns a dict containing the final attributes to be rendered.
def get_final_attrs(self, classes=True): """Returns a dict containing the final attributes to be rendered.""" final_attrs = copy.copy(self.get_default_attrs()) final_attrs.update(self.attrs) if classes: final_attrs['class'] = self.get_final_css() else: fin...
[ "def", "get_final_attrs", "(", "self", ",", "classes", "=", "True", ")", ":", "final_attrs", "=", "copy", ".", "copy", "(", "self", ".", "get_default_attrs", "(", ")", ")", "final_attrs", ".", "update", "(", "self", ".", "attrs", ")", "if", "classes", ...
[ 37, 4 ]
[ 46, 26 ]
python
en
['en', 'en', 'en']
True
HTMLElement.get_final_css
(self)
Returns a final css class concatenated string.
Returns a final css class concatenated string.
def get_final_css(self): """Returns a final css class concatenated string.""" default = " ".join(self.get_default_classes()) defined = self.attrs.get('class', '') additional = " ".join(getattr(self, "classes", [])) non_empty = [test for test in (defined, default, additional) if t...
[ "def", "get_final_css", "(", "self", ")", ":", "default", "=", "\" \"", ".", "join", "(", "self", ".", "get_default_classes", "(", ")", ")", "defined", "=", "self", ".", "attrs", ".", "get", "(", "'class'", ",", "''", ")", "additional", "=", "\" \"", ...
[ 48, 4 ]
[ 55, 28 ]
python
en
['en', 'en', 'en']
True
HTMLElement.attr_string
(self)
Returns a flattened string of HTML attributes. HTML attributes are flattened based on the ``attrs`` dict provided to the class.
Returns a flattened string of HTML attributes.
def attr_string(self): """Returns a flattened string of HTML attributes. HTML attributes are flattened based on the ``attrs`` dict provided to the class. """ return flatatt(self.get_final_attrs())
[ "def", "attr_string", "(", "self", ")", ":", "return", "flatatt", "(", "self", ".", "get_final_attrs", "(", ")", ")" ]
[ 58, 4 ]
[ 64, 46 ]
python
en
['en', 'en', 'en']
True
HTMLElement.attr_string_nc
(self)
Returns a flattened string of HTML attributes. HTML attributes are flattened based on the ``attrs`` dict provided to the class.
Returns a flattened string of HTML attributes.
def attr_string_nc(self): """Returns a flattened string of HTML attributes. HTML attributes are flattened based on the ``attrs`` dict provided to the class. """ return flatatt(self.get_final_attrs(False))
[ "def", "attr_string_nc", "(", "self", ")", ":", "return", "flatatt", "(", "self", ".", "get_final_attrs", "(", "False", ")", ")" ]
[ 67, 4 ]
[ 73, 51 ]
python
en
['en', 'en', 'en']
True
HTMLElement.class_string
(self)
Returns a list of class name of HTML Element in string.
Returns a list of class name of HTML Element in string.
def class_string(self): """Returns a list of class name of HTML Element in string.""" classes_str = " ".join(self.classes) return classes_str
[ "def", "class_string", "(", "self", ")", ":", "classes_str", "=", "\" \"", ".", "join", "(", "self", ".", "classes", ")", "return", "classes_str" ]
[ 76, 4 ]
[ 79, 26 ]
python
en
['en', 'en', 'en']
True
is_fp_closed
(obj)
Checks whether a given file-like object is closed. :param obj: The file-like object to check.
Checks whether a given file-like object is closed.
def is_fp_closed(obj): """ Checks whether a given file-like object is closed. :param obj: The file-like object to check. """ try: # Check `isclosed()` first, in case Python3 doesn't set `closed`. # GH Issue #928 return obj.isclosed() except AttributeError: ...
[ "def", "is_fp_closed", "(", "obj", ")", ":", "try", ":", "# Check `isclosed()` first, in case Python3 doesn't set `closed`.", "# GH Issue #928", "return", "obj", ".", "isclosed", "(", ")", "except", "AttributeError", ":", "pass", "try", ":", "# Check via the official file...
[ 6, 0 ]
[ 34, 65 ]
python
en
['en', 'error', 'th']
False
assert_header_parsing
(headers)
Asserts whether all headers have been successfully parsed. Extracts encountered errors from the result of parsing headers. Only works on Python 3. :param headers: Headers to verify. :type headers: `httplib.HTTPMessage`. :raises urllib3.exceptions.HeaderParsingError: If parsing errors...
Asserts whether all headers have been successfully parsed. Extracts encountered errors from the result of parsing headers.
def assert_header_parsing(headers): """ Asserts whether all headers have been successfully parsed. Extracts encountered errors from the result of parsing headers. Only works on Python 3. :param headers: Headers to verify. :type headers: `httplib.HTTPMessage`. :raises urllib3.exceptions.He...
[ "def", "assert_header_parsing", "(", "headers", ")", ":", "# This will fail silently if we pass in the wrong kind of parameter.", "# To make debugging easier add an explicit check.", "if", "not", "isinstance", "(", "headers", ",", "httplib", ".", "HTTPMessage", ")", ":", "raise...
[ 37, 0 ]
[ 70, 78 ]
python
en
['en', 'error', 'th']
False
is_response_to_head
(response)
Checks whether the request of a response has been a HEAD-request. Handles the quirks of AppEngine. :param conn: :type conn: :class:`httplib.HTTPResponse`
Checks whether the request of a response has been a HEAD-request. Handles the quirks of AppEngine.
def is_response_to_head(response): """ Checks whether the request of a response has been a HEAD-request. Handles the quirks of AppEngine. :param conn: :type conn: :class:`httplib.HTTPResponse` """ # FIXME: Can we do this somehow without accessing private httplib _method? method = respon...
[ "def", "is_response_to_head", "(", "response", ")", ":", "# FIXME: Can we do this somehow without accessing private httplib _method?", "method", "=", "response", ".", "_method", "if", "isinstance", "(", "method", ",", "int", ")", ":", "# Platform-specific: Appengine", "retu...
[ 73, 0 ]
[ 85, 35 ]
python
en
['en', 'error', 'th']
False
SentryClient.process
(self, **kwargs)
Processes the message before passing it on to the server
Processes the message before passing it on to the server
def process(self, **kwargs): "Processes the message before passing it on to the server" from sentry.utils import get_filters if kwargs.get('data'): # Ensure we're not changing the original data which was passed # to Sentry kwargs['data'] = kwargs['data'].copy...
[ "def", "process", "(", "self", ",", "*", "*", "kwargs", ")", ":", "from", "sentry", ".", "utils", "import", "get_filters", "if", "kwargs", ".", "get", "(", "'data'", ")", ":", "# Ensure we're not changing the original data which was passed", "# to Sentry", "kwargs...
[ 89, 4 ]
[ 243, 25 ]
python
en
['en', 'en', 'en']
True
SentryClient.send
(self, **kwargs)
Sends the message to the server.
Sends the message to the server.
def send(self, **kwargs): "Sends the message to the server." if settings.SERVERS: message = base64.b64encode(json.dumps(kwargs).encode('zlib')) for url in settings.SERVERS: timestamp = time.time() signature = get_signature(message, timestamp) ...
[ "def", "send", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "settings", ".", "SERVERS", ":", "message", "=", "base64", ".", "b64encode", "(", "json", ".", "dumps", "(", "kwargs", ")", ".", "encode", "(", "'zlib'", ")", ")", "for", "url", ...
[ 253, 4 ]
[ 279, 63 ]
python
en
['en', 'en', 'en']
True
SentryClient.create_from_record
(self, record, **kwargs)
Creates an error log for a ``logging`` module ``record`` instance.
Creates an error log for a ``logging`` module ``record`` instance.
def create_from_record(self, record, **kwargs): """ Creates an error log for a ``logging`` module ``record`` instance. """ for k in ('url', 'view', 'request', 'data'): if not kwargs.get(k): kwargs[k] = record.__dict__.get(k) kwargs.update({ ...
[ "def", "create_from_record", "(", "self", ",", "record", ",", "*", "*", "kwargs", ")", ":", "for", "k", "in", "(", "'url'", ",", "'view'", ",", "'request'", ",", "'data'", ")", ":", "if", "not", "kwargs", ".", "get", "(", "k", ")", ":", "kwargs", ...
[ 281, 4 ]
[ 331, 9 ]
python
en
['en', 'error', 'th']
False
SentryClient.create_from_text
(self, message, **kwargs)
Creates an error log for from ``message``.
Creates an error log for from ``message``.
def create_from_text(self, message, **kwargs): """ Creates an error log for from ``message``. """ return self.process( message=message, **kwargs )
[ "def", "create_from_text", "(", "self", ",", "message", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "process", "(", "message", "=", "message", ",", "*", "*", "kwargs", ")" ]
[ 333, 4 ]
[ 340, 9 ]
python
en
['en', 'error', 'th']
False
SentryClient.create_from_exception
(self, exc_info=None, **kwargs)
Creates an error log from an exception.
Creates an error log from an exception.
def create_from_exception(self, exc_info=None, **kwargs): """ Creates an error log from an exception. """ new_exc = bool(exc_info) if not exc_info or exc_info is True: exc_info = sys.exc_info() data = kwargs.pop('data', {}) or {} try: exc...
[ "def", "create_from_exception", "(", "self", ",", "exc_info", "=", "None", ",", "*", "*", "kwargs", ")", ":", "new_exc", "=", "bool", "(", "exc_info", ")", "if", "not", "exc_info", "or", "exc_info", "is", "True", ":", "exc_info", "=", "sys", ".", "exc_...
[ 342, 4 ]
[ 389, 39 ]
python
en
['en', 'error', 'th']
False
prune_internal_data
(events: List[Dict[str, Any]])
Prunes the internal_data data structures, which are not intended to be exposed to API clients.
Prunes the internal_data data structures, which are not intended to be exposed to API clients.
def prune_internal_data(events: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Prunes the internal_data data structures, which are not intended to be exposed to API clients. """ events = copy.deepcopy(events) for event in events: if event["type"] == "message" and "internal_data" in event:...
[ "def", "prune_internal_data", "(", "events", ":", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "events", "=", "copy", ".", "deepcopy", "(", "events", ")", "for", "ev...
[ 384, 0 ]
[ 392, 17 ]
python
en
['en', 'en', 'en']
True
missedmessage_hook
( user_profile_id: int, client: ClientDescriptor, last_for_client: bool )
The receiver_is_off_zulip logic used to determine whether a user has no active client suffers from a somewhat fundamental race condition. If the client is no longer on the Internet, receiver_is_off_zulip will still return False for DEFAULT_EVENT_QUEUE_TIMEOUT_SECS, until the queue is garbage-collec...
The receiver_is_off_zulip logic used to determine whether a user has no active client suffers from a somewhat fundamental race condition. If the client is no longer on the Internet, receiver_is_off_zulip will still return False for DEFAULT_EVENT_QUEUE_TIMEOUT_SECS, until the queue is garbage-collec...
def missedmessage_hook( user_profile_id: int, client: ClientDescriptor, last_for_client: bool ) -> None: """The receiver_is_off_zulip logic used to determine whether a user has no active client suffers from a somewhat fundamental race condition. If the client is no longer on the Internet, receiver_...
[ "def", "missedmessage_hook", "(", "user_profile_id", ":", "int", ",", "client", ":", "ClientDescriptor", ",", "last_for_client", ":", "bool", ")", "->", "None", ":", "# Only process missedmessage hook when the last queue for a", "# client has been garbage collected", "if", ...
[ 705, 0 ]
[ 778, 9 ]
python
en
['en', 'en', 'en']
True
maybe_enqueue_notifications
( user_profile_id: int, message_id: int, private_message: bool, mentioned: bool, wildcard_mention_notify: bool, stream_push_notify: bool, stream_email_notify: bool, stream_name: Optional[str], always_push_notify: bool, idle: bool, already_notified: Dict[str, bool], )
This function has a complete unit test suite in `test_enqueue_notifications` that should be expanded as we add more features here. See https://zulip.readthedocs.io/en/latest/subsystems/notifications.html for high-level design documentation.
This function has a complete unit test suite in `test_enqueue_notifications` that should be expanded as we add more features here.
def maybe_enqueue_notifications( user_profile_id: int, message_id: int, private_message: bool, mentioned: bool, wildcard_mention_notify: bool, stream_push_notify: bool, stream_email_notify: bool, stream_name: Optional[str], always_push_notify: bool, idle: bool, already_notifi...
[ "def", "maybe_enqueue_notifications", "(", "user_profile_id", ":", "int", ",", "message_id", ":", "int", ",", "private_message", ":", "bool", ",", "mentioned", ":", "bool", ",", "wildcard_mention_notify", ":", "bool", ",", "stream_push_notify", ":", "bool", ",", ...
[ 792, 0 ]
[ 854, 19 ]
python
en
['en', 'en', 'en']
True
get_client_info_for_message_event
( event_template: Mapping[str, Any], users: Iterable[Mapping[str, Any]] )
Return client info for all the clients interested in a message. This basically includes clients for users who are recipients of the message, with some nuances for bots that auto-subscribe to all streams, plus users who may be mentioned, etc.
Return client info for all the clients interested in a message. This basically includes clients for users who are recipients of the message, with some nuances for bots that auto-subscribe to all streams, plus users who may be mentioned, etc.
def get_client_info_for_message_event( event_template: Mapping[str, Any], users: Iterable[Mapping[str, Any]] ) -> Dict[str, ClientInfo]: """ Return client info for all the clients interested in a message. This basically includes clients for users who are recipients of the message, with some nuances ...
[ "def", "get_client_info_for_message_event", "(", "event_template", ":", "Mapping", "[", "str", ",", "Any", "]", ",", "users", ":", "Iterable", "[", "Mapping", "[", "str", ",", "Any", "]", "]", ")", "->", "Dict", "[", "str", ",", "ClientInfo", "]", ":", ...
[ 863, 0 ]
[ 902, 26 ]
python
en
['en', 'error', 'th']
False
process_message_event
( event_template: Mapping[str, Any], users: Collection[Mapping[str, Any]] )
See https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html for high-level documentation on this subsystem.
See https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html for high-level documentation on this subsystem.
def process_message_event( event_template: Mapping[str, Any], users: Collection[Mapping[str, Any]] ) -> None: """See https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html for high-level documentation on this subsystem. """ send_to_clients = get_client_info_for_message_event(eve...
[ "def", "process_message_event", "(", "event_template", ":", "Mapping", "[", "str", ",", "Any", "]", ",", "users", ":", "Collection", "[", "Mapping", "[", "str", ",", "Any", "]", "]", ")", "->", "None", ":", "send_to_clients", "=", "get_client_info_for_messag...
[ 905, 0 ]
[ 1027, 36 ]
python
en
['en', 'en', 'ur']
False
FeatureDescriptor.__init__
(self, features_descriptions_dict)
Create FeatureDescriptor object. If features_descriptions_dict is not None, set initialized attribute to True. Args: features_descriptions_dict (dict): dictionary that should follow structure described in `class` docstring
Create FeatureDescriptor object. If features_descriptions_dict is not None, set initialized attribute to True.
def __init__(self, features_descriptions_dict): """Create FeatureDescriptor object. If features_descriptions_dict is not None, set initialized attribute to True. Args: features_descriptions_dict (dict): dictionary that should follow structure described in `class` docstring "...
[ "def", "__init__", "(", "self", ",", "features_descriptions_dict", ")", ":", "self", ".", "initialized", "=", "False", "if", "features_descriptions_dict", ":", "self", ".", "features_descriptions", "=", "features_descriptions_dict", "self", ".", "initialized", "=", ...
[ 26, 4 ]
[ 36, 35 ]
python
en
['en', 'en', 'en']
True
FeatureDescriptor.mapping
(self, arg)
Return _mapping attribute value from internal dictionary of arg in features_descriptions attribute. If _mapping key does not exist in internal dictionary, return None. Args: arg (str): Feature name, key in features_descriptions attribute dictionary Returns: {dict, None}...
Return _mapping attribute value from internal dictionary of arg in features_descriptions attribute. If _mapping key does not exist in internal dictionary, return None.
def mapping(self, arg): """Return _mapping attribute value from internal dictionary of arg in features_descriptions attribute. If _mapping key does not exist in internal dictionary, return None. Args: arg (str): Feature name, key in features_descriptions attribute dictionary ...
[ "def", "mapping", "(", "self", ",", "arg", ")", ":", "if", "arg", "not", "in", "self", ".", "features_descriptions", ":", "raise", "KeyError", "try", ":", "return", "self", ".", "features_descriptions", "[", "arg", "]", "[", "self", ".", "_mapping", "]",...
[ 38, 4 ]
[ 57, 23 ]
python
en
['en', 'en', 'en']
True
FeatureDescriptor.description
(self, arg)
Return _description attribute value from internal dictionary of arg in features_descriptions attribute. If _description key does not exist in internal dictionary, return None. Args: arg (str): Feature name, key in features_descriptions attribute dictionary Returns: {str...
Return _description attribute value from internal dictionary of arg in features_descriptions attribute. If _description key does not exist in internal dictionary, return None.
def description(self, arg): """Return _description attribute value from internal dictionary of arg in features_descriptions attribute. If _description key does not exist in internal dictionary, return None. Args: arg (str): Feature name, key in features_descriptions attribute dictio...
[ "def", "description", "(", "self", ",", "arg", ")", ":", "if", "arg", "not", "in", "self", ".", "features_descriptions", ":", "raise", "KeyError", "try", ":", "return", "self", ".", "features_descriptions", "[", "arg", "]", "[", "self", ".", "_description"...
[ 59, 4 ]
[ 78, 23 ]
python
en
['en', 'en', 'en']
True
FeatureDescriptor.category
(self, arg)
Return _category attribute value from internal dictionary of arg in features_descriptions attribute. If _category key does not exist in internal dictionary, return None. Args: arg (str): Feature name, key in features_descriptions attribute dictionary Returns: {str, None...
Return _category attribute value from internal dictionary of arg in features_descriptions attribute. If _category key does not exist in internal dictionary, return None.
def category(self, arg): """Return _category attribute value from internal dictionary of arg in features_descriptions attribute. If _category key does not exist in internal dictionary, return None. Args: arg (str): Feature name, key in features_descriptions attribute dictionary ...
[ "def", "category", "(", "self", ",", "arg", ")", ":", "if", "arg", "not", "in", "self", ".", "features_descriptions", ":", "raise", "KeyError", "try", ":", "return", "self", ".", "features_descriptions", "[", "arg", "]", "[", "self", ".", "_category", "]...
[ 80, 4 ]
[ 99, 23 ]
python
en
['en', 'en', 'en']
True
FeatureDescriptor.keys
(self)
Return keys from features_descriptions dictionary. Returns: dict_keys: keys from features_descriptions
Return keys from features_descriptions dictionary.
def keys(self): """Return keys from features_descriptions dictionary. Returns: dict_keys: keys from features_descriptions """ return self.features_descriptions.keys()
[ "def", "keys", "(", "self", ")", ":", "return", "self", ".", "features_descriptions", ".", "keys", "(", ")" ]
[ 101, 4 ]
[ 107, 48 ]
python
en
['en', 'en', 'en']
True
FeatureDescriptor.__getitem__
(self, arg)
Return arg item from features_descriptions attribute dictionary. Returns: dict: internal dictionary of arg from features_descriptions Raises: KeyError: if arg is not present in features_descriptions keys
Return arg item from features_descriptions attribute dictionary.
def __getitem__(self, arg): """Return arg item from features_descriptions attribute dictionary. Returns: dict: internal dictionary of arg from features_descriptions Raises: KeyError: if arg is not present in features_descriptions keys """ if arg not in ...
[ "def", "__getitem__", "(", "self", ",", "arg", ")", ":", "if", "arg", "not", "in", "self", ".", "features_descriptions", ":", "raise", "KeyError", "return", "self", ".", "features_descriptions", "[", "arg", "]" ]
[ 109, 4 ]
[ 121, 46 ]
python
en
['en', 'en', 'en']
True
FeatureDescriptor.__iter__
(self)
Implement iterator protocol with features_descriptions.keys() as iterable.
Implement iterator protocol with features_descriptions.keys() as iterable.
def __iter__(self): """Implement iterator protocol with features_descriptions.keys() as iterable.""" self.__iter_items = list(sorted(self.features_descriptions.keys())) self.__counter = 0 return self
[ "def", "__iter__", "(", "self", ")", ":", "self", ".", "__iter_items", "=", "list", "(", "sorted", "(", "self", ".", "features_descriptions", ".", "keys", "(", ")", ")", ")", "self", ".", "__counter", "=", "0", "return", "self" ]
[ 123, 4 ]
[ 127, 19 ]
python
en
['en', 'en', 'en']
True
FeatureDescriptor.__next__
(self)
Implement iterator protocol with features_descriptions.keys() as iterable. Raises: StopIteration: on IndexError
Implement iterator protocol with features_descriptions.keys() as iterable.
def __next__(self): """Implement iterator protocol with features_descriptions.keys() as iterable. Raises: StopIteration: on IndexError """ try: self.__counter += 1 return self.__iter_items[self.__counter - 1] except IndexError: rai...
[ "def", "__next__", "(", "self", ")", ":", "try", ":", "self", ".", "__counter", "+=", "1", "return", "self", ".", "__iter_items", "[", "self", ".", "__counter", "-", "1", "]", "except", "IndexError", ":", "raise", "StopIteration" ]
[ 129, 4 ]
[ 139, 31 ]
python
en
['en', 'en', 'en']
True
display_list
(values: List[str], display_limit: int)
Given a list of values, return a string nicely formatting those values, summarizing when you have more than `display_limit`. Eg, for a `display_limit` of 3 we get the following possible cases: Jessica Jessica and Waseem Jessica, Waseem, and Tim Jessica, Waseem, Tim, and 1 other Jessica...
Given a list of values, return a string nicely formatting those values, summarizing when you have more than `display_limit`. Eg, for a `display_limit` of 3 we get the following possible cases:
def display_list(values: List[str], display_limit: int) -> str: """ Given a list of values, return a string nicely formatting those values, summarizing when you have more than `display_limit`. Eg, for a `display_limit` of 3 we get the following possible cases: Jessica Jessica and Waseem Jes...
[ "def", "display_list", "(", "values", ":", "List", "[", "str", "]", ",", "display_limit", ":", "int", ")", "->", "str", ":", "if", "len", "(", "values", ")", "==", "1", ":", "# One value, show it.", "display_string", "=", "f\"{values[0]}\"", "elif", "len",...
[ 40, 0 ]
[ 64, 25 ]
python
en
['en', 'error', 'th']
False
render_markdown_path
( markdown_file_path: str, context: Mapping[str, Any] = {}, pure_markdown: bool = False )
Given a path to a Markdown file, return the rendered HTML. Note that this assumes that any HTML in the Markdown file is trusted; it is intended to be used for documentation, not user data.
Given a path to a Markdown file, return the rendered HTML.
def render_markdown_path( markdown_file_path: str, context: Mapping[str, Any] = {}, pure_markdown: bool = False ) -> str: """Given a path to a Markdown file, return the rendered HTML. Note that this assumes that any HTML in the Markdown file is trusted; it is intended to be used for documentation, not ...
[ "def", "render_markdown_path", "(", "markdown_file_path", ":", "str", ",", "context", ":", "Mapping", "[", "str", ",", "Any", "]", "=", "{", "}", ",", "pure_markdown", ":", "bool", "=", "False", ")", "->", "str", ":", "# We set this global hackishly", "from"...
[ 83, 0 ]
[ 172, 35 ]
python
en
['en', 'en', 'en']
True
install._called_from_setup
(run_frame)
Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might...
Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might...
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any ...
[ "def", "_called_from_setup", "(", "run_frame", ")", ":", "if", "run_frame", "is", "None", ":", "msg", "=", "\"Call stack not available. bdist_* commands may fail.\"", "warnings", ".", "warn", "(", "msg", ")", "if", "platform", ".", "python_implementation", "(", ")",...
[ 69, 4 ]
[ 93, 9 ]
python
en
['en', 'error', 'th']
False
get_supported_platform
()
Return this platform's maximum compatible version. distutils.util.get_platform() normally reports the minimum version of macOS that would be required to *use* extensions produced by distutils. But what we want when checking compatibility is to know the version of macOS that we are *running*. To allow...
Return this platform's maximum compatible version.
def get_supported_platform(): """Return this platform's maximum compatible version. distutils.util.get_platform() normally reports the minimum version of macOS that would be required to *use* extensions produced by distutils. But what we want when checking compatibility is to know the version of m...
[ "def", "get_supported_platform", "(", ")", ":", "plat", "=", "get_build_platform", "(", ")", "m", "=", "macosVersionString", ".", "match", "(", "plat", ")", "if", "m", "is", "not", "None", "and", "sys", ".", "platform", "==", "\"darwin\"", ":", "try", ":...
[ 160, 0 ]
[ 181, 15 ]
python
en
['en', 'la', 'en']
True
register_loader_type
(loader_type, provider_factory)
Register `provider_factory` to make providers for `loader_type` `loader_type` is the type or class of a PEP 302 ``module.__loader__``, and `provider_factory` is a function that, passed a *module* object, returns an ``IResourceProvider`` for that module.
Register `provider_factory` to make providers for `loader_type`
def register_loader_type(loader_type, provider_factory): """Register `provider_factory` to make providers for `loader_type` `loader_type` is the type or class of a PEP 302 ``module.__loader__``, and `provider_factory` is a function that, passed a *module* object, returns an ``IResourceProvider`` for th...
[ "def", "register_loader_type", "(", "loader_type", ",", "provider_factory", ")", ":", "_provider_factories", "[", "loader_type", "]", "=", "provider_factory" ]
[ 327, 0 ]
[ 334, 55 ]
python
en
['en', 'no', 'en']
True
get_provider
(moduleOrReq)
Return an IResourceProvider for the named module or requirement
Return an IResourceProvider for the named module or requirement
def get_provider(moduleOrReq): """Return an IResourceProvider for the named module or requirement""" if isinstance(moduleOrReq, Requirement): return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] try: module = sys.modules[moduleOrReq] except KeyError: __import__(mo...
[ "def", "get_provider", "(", "moduleOrReq", ")", ":", "if", "isinstance", "(", "moduleOrReq", ",", "Requirement", ")", ":", "return", "working_set", ".", "find", "(", "moduleOrReq", ")", "or", "require", "(", "str", "(", "moduleOrReq", ")", ")", "[", "0", ...
[ 337, 0 ]
[ 347, 61 ]
python
en
['en', 'en', 'en']
True
get_build_platform
()
Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and macOS.
Return this platform's string for platform-specific distributions
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and macOS. """ from sysconfig import get_platform plat = get_platform() if sys.platform == "...
[ "def", "get_build_platform", "(", ")", ":", "from", "sysconfig", "import", "get_platform", "plat", "=", "get_platform", "(", ")", "if", "sys", ".", "platform", "==", "\"darwin\"", "and", "not", "plat", ".", "startswith", "(", "'macosx-'", ")", ":", "try", ...
[ 370, 0 ]
[ 391, 15 ]
python
en
['en', 'da', 'en']
True
compatible_platforms
(provided, required)
Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes.
Can code for the `provided` platform run on the `required` platform?
def compatible_platforms(provided, required): """Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes. """ if provided is None or required is None ...
[ "def", "compatible_platforms", "(", "provided", ",", "required", ")", ":", "if", "provided", "is", "None", "or", "required", "is", "None", "or", "provided", "==", "required", ":", "# easy case", "return", "True", "# macOS special cases", "reqMac", "=", "macosVer...
[ 400, 0 ]
[ 443, 16 ]
python
en
['en', 'en', 'en']
True
run_script
(dist_spec, script_name)
Locate distribution `dist_spec` and run its `script_name` script
Locate distribution `dist_spec` and run its `script_name` script
def run_script(dist_spec, script_name): """Locate distribution `dist_spec` and run its `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name require(dist_spec)[0].run_script(script_name, ns)
[ "def", "run_script", "(", "dist_spec", ",", "script_name", ")", ":", "ns", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "name", "=", "ns", "[", "'__name__'", "]", "ns", ".", "clear", "(", ")", "ns", "[", "'__name__'", "]", "=", "n...
[ 446, 0 ]
[ 452, 53 ]
python
en
['en', 'co', 'en']
True
get_distribution
(dist)
Return a current distribution object for a Requirement or string
Return a current distribution object for a Requirement or string
def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist, str): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) if not isinstance(dist, Distribution): raise TypeError("Expected...
[ "def", "get_distribution", "(", "dist", ")", ":", "if", "isinstance", "(", "dist", ",", "str", ")", ":", "dist", "=", "Requirement", ".", "parse", "(", "dist", ")", "if", "isinstance", "(", "dist", ",", "Requirement", ")", ":", "dist", "=", "get_provid...
[ 459, 0 ]
[ 467, 15 ]
python
en
['en', 'en', 'en']
True
load_entry_point
(dist, group, name)
Return `name` entry point of `group` for `dist` or raise ImportError
Return `name` entry point of `group` for `dist` or raise ImportError
def load_entry_point(dist, group, name): """Return `name` entry point of `group` for `dist` or raise ImportError""" return get_distribution(dist).load_entry_point(group, name)
[ "def", "load_entry_point", "(", "dist", ",", "group", ",", "name", ")", ":", "return", "get_distribution", "(", "dist", ")", ".", "load_entry_point", "(", "group", ",", "name", ")" ]
[ 470, 0 ]
[ 472, 63 ]
python
en
['en', 'en', 'en']
True
get_entry_map
(dist, group=None)
Return the entry point map for `group`, or the full entry map
Return the entry point map for `group`, or the full entry map
def get_entry_map(dist, group=None): """Return the entry point map for `group`, or the full entry map""" return get_distribution(dist).get_entry_map(group)
[ "def", "get_entry_map", "(", "dist", ",", "group", "=", "None", ")", ":", "return", "get_distribution", "(", "dist", ")", ".", "get_entry_map", "(", "group", ")" ]
[ 475, 0 ]
[ 477, 54 ]
python
en
['en', 'en', 'en']
True
get_entry_info
(dist, group, name)
Return the EntryPoint object for `group`+`name`, or ``None``
Return the EntryPoint object for `group`+`name`, or ``None``
def get_entry_info(dist, group, name): """Return the EntryPoint object for `group`+`name`, or ``None``""" return get_distribution(dist).get_entry_info(group, name)
[ "def", "get_entry_info", "(", "dist", ",", "group", ",", "name", ")", ":", "return", "get_distribution", "(", "dist", ")", ".", "get_entry_info", "(", "group", ",", "name", ")" ]
[ 480, 0 ]
[ 482, 61 ]
python
en
['en', 'en', 'en']
True
get_default_cache
()
Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs".
Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs".
def get_default_cache(): """ Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs". """ return ( os.environ.get('PYTHON_EGG_CACHE') or appdirs.user_cache_dir(appname='Python-Eggs') )
[ "def", "get_default_cache", "(", ")", ":", "return", "(", "os", ".", "environ", ".", "get", "(", "'PYTHON_EGG_CACHE'", ")", "or", "appdirs", ".", "user_cache_dir", "(", "appname", "=", "'Python-Eggs'", ")", ")" ]
[ 1289, 0 ]
[ 1298, 5 ]
python
en
['en', 'error', 'th']
False
safe_name
(name)
Convert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'.
Convert an arbitrary string to a standard distribution name
def safe_name(name): """Convert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. """ return re.sub('[^A-Za-z0-9.]+', '-', name)
[ "def", "safe_name", "(", "name", ")", ":", "return", "re", ".", "sub", "(", "'[^A-Za-z0-9.]+'", ",", "'-'", ",", "name", ")" ]
[ 1301, 0 ]
[ 1306, 46 ]
python
en
['en', 'en', 'en']
True
safe_version
(version)
Convert an arbitrary string to a standard version string
Convert an arbitrary string to a standard version string
def safe_version(version): """ Convert an arbitrary string to a standard version string """ try: # normalize the version return str(packaging.version.Version(version)) except packaging.version.InvalidVersion: version = version.replace(' ', '.') return re.sub('[^A-Za-z...
[ "def", "safe_version", "(", "version", ")", ":", "try", ":", "# normalize the version", "return", "str", "(", "packaging", ".", "version", ".", "Version", "(", "version", ")", ")", "except", "packaging", ".", "version", ".", "InvalidVersion", ":", "version", ...
[ 1309, 0 ]
[ 1318, 53 ]
python
en
['en', 'error', 'th']
False
safe_extra
(extra)
Convert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased.
Convert an arbitrary string to a standard 'extra' name
def safe_extra(extra): """Convert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased. """ return re.sub('[^A-Za-z0-9.-]+', '_', extra).lower()
[ "def", "safe_extra", "(", "extra", ")", ":", "return", "re", ".", "sub", "(", "'[^A-Za-z0-9.-]+'", ",", "'_'", ",", "extra", ")", ".", "lower", "(", ")" ]
[ 1321, 0 ]
[ 1327, 56 ]
python
en
['en', 'en', 'en']
True
to_filename
(name)
Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'.
Convert a project or version name to its filename-escaped form
def to_filename(name): """Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. """ return name.replace('-', '_')
[ "def", "to_filename", "(", "name", ")", ":", "return", "name", ".", "replace", "(", "'-'", ",", "'_'", ")" ]
[ 1330, 0 ]
[ 1335, 33 ]
python
en
['en', 'en', 'en']
True
invalid_marker
(text)
Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise.
Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise.
def invalid_marker(text): """ Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. """ try: evaluate_marker(text) except SyntaxError as e: e.filename = None e.lineno = None return e return False
[ "def", "invalid_marker", "(", "text", ")", ":", "try", ":", "evaluate_marker", "(", "text", ")", "except", "SyntaxError", "as", "e", ":", "e", ".", "filename", "=", "None", "e", ".", "lineno", "=", "None", "return", "e", "return", "False" ]
[ 1338, 0 ]
[ 1349, 16 ]
python
en
['en', 'error', 'th']
False
evaluate_marker
(text, extra=None)
Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module.
Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid.
def evaluate_marker(text, extra=None): """ Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module. """ try: marker = packaging.markers.Marker(te...
[ "def", "evaluate_marker", "(", "text", ",", "extra", "=", "None", ")", ":", "try", ":", "marker", "=", "packaging", ".", "markers", ".", "Marker", "(", "text", ")", "return", "marker", ".", "evaluate", "(", ")", "except", "packaging", ".", "markers", "...
[ 1352, 0 ]
[ 1364, 35 ]
python
en
['en', 'error', 'th']
False
_parents
(path)
yield all parents of path including path
yield all parents of path including path
def _parents(path): """ yield all parents of path including path """ last = None while path != last: yield path last = path path, _ = os.path.split(path)
[ "def", "_parents", "(", "path", ")", ":", "last", "=", "None", "while", "path", "!=", "last", ":", "yield", "path", "last", "=", "path", "path", ",", "_", "=", "os", ".", "path", ".", "split", "(", "path", ")" ]
[ 1561, 0 ]
[ 1569, 37 ]
python
en
['en', 'error', 'th']
False
register_finder
(importer_type, distribution_finder)
Register `distribution_finder` to find distributions in sys.path items `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item handler), and `distribution_finder` is a callable that, passed a path item and the importer instance, yields ``Distribution`` instances found on that path i...
Register `distribution_finder` to find distributions in sys.path items
def register_finder(importer_type, distribution_finder): """Register `distribution_finder` to find distributions in sys.path items `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item handler), and `distribution_finder` is a callable that, passed a path item and the importer inst...
[ "def", "register_finder", "(", "importer_type", ",", "distribution_finder", ")", ":", "_distribution_finders", "[", "importer_type", "]", "=", "distribution_finder" ]
[ 1948, 0 ]
[ 1955, 62 ]
python
en
['en', 'en', 'en']
True
find_distributions
(path_item, only=False)
Yield distributions accessible via `path_item`
Yield distributions accessible via `path_item`
def find_distributions(path_item, only=False): """Yield distributions accessible via `path_item`""" importer = get_importer(path_item) finder = _find_adapter(_distribution_finders, importer) return finder(importer, path_item, only)
[ "def", "find_distributions", "(", "path_item", ",", "only", "=", "False", ")", ":", "importer", "=", "get_importer", "(", "path_item", ")", "finder", "=", "_find_adapter", "(", "_distribution_finders", ",", "importer", ")", "return", "finder", "(", "importer", ...
[ 1958, 0 ]
[ 1962, 44 ]
python
en
['en', 'en', 'en']
True
find_eggs_in_zip
(importer, path_item, only=False)
Find eggs in zip files; possibly multiple nested eggs.
Find eggs in zip files; possibly multiple nested eggs.
def find_eggs_in_zip(importer, path_item, only=False): """ Find eggs in zip files; possibly multiple nested eggs. """ if importer.archive.endswith('.whl'): # wheels are not supported with this finder # they don't have PKG-INFO metadata, and won't ever contain eggs return meta...
[ "def", "find_eggs_in_zip", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "if", "importer", ".", "archive", ".", "endswith", "(", "'.whl'", ")", ":", "# wheels are not supported with this finder", "# they don't have PKG-INFO metadata, and won't ...
[ 1965, 0 ]
[ 1989, 73 ]
python
en
['en', 'error', 'th']
False
_by_version_descending
(names)
Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.egg'...
Given a list of filenames, return them in descending order by version number.
def _by_version_descending(names): """ Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setup...
[ "def", "_by_version_descending", "(", "names", ")", ":", "def", "_by_version", "(", "name", ")", ":", "\"\"\"\n Parse each component of the filename\n \"\"\"", "name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "name", ")", "parts", "=...
[ 2002, 0 ]
[ 2025, 55 ]
python
en
['en', 'error', 'th']
False
find_on_path
(importer, path_item, only=False)
Yield distributions accessible on a sys.path directory
Yield distributions accessible on a sys.path directory
def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) if _is_unpacked_egg(path_item): yield Distribution.from_filename( path_item, metadata=PathMetadata( path_item, os.path...
[ "def", "find_on_path", "(", "importer", ",", "path_item", ",", "only", "=", "False", ")", ":", "path_item", "=", "_normalize_cached", "(", "path_item", ")", "if", "_is_unpacked_egg", "(", "path_item", ")", ":", "yield", "Distribution", ".", "from_filename", "(...
[ 2028, 0 ]
[ 2060, 22 ]
python
en
['en', 'en', 'en']
True
dist_factory
(path_item, entry, only)
Return a dist_factory for the given entry.
Return a dist_factory for the given entry.
def dist_factory(path_item, entry, only): """Return a dist_factory for the given entry.""" lower = entry.lower() is_egg_info = lower.endswith('.egg-info') is_dist_info = ( lower.endswith('.dist-info') and os.path.isdir(os.path.join(path_item, entry)) ) is_meta = is_egg_info or is...
[ "def", "dist_factory", "(", "path_item", ",", "entry", ",", "only", ")", ":", "lower", "=", "entry", ".", "lower", "(", ")", "is_egg_info", "=", "lower", ".", "endswith", "(", "'.egg-info'", ")", "is_dist_info", "=", "(", "lower", ".", "endswith", "(", ...
[ 2063, 0 ]
[ 2080, 5 ]
python
en
['en', 'en', 'en']
True
safe_listdir
(path)
Attempt to list contents of path, but suppress some exceptions.
Attempt to list contents of path, but suppress some exceptions.
def safe_listdir(path): """ Attempt to list contents of path, but suppress some exceptions. """ try: return os.listdir(path) except (PermissionError, NotADirectoryError): pass except OSError as e: # Ignore the directory if does not exist, not a directory or # perm...
[ "def", "safe_listdir", "(", "path", ")", ":", "try", ":", "return", "os", ".", "listdir", "(", "path", ")", "except", "(", "PermissionError", ",", "NotADirectoryError", ")", ":", "pass", "except", "OSError", "as", "e", ":", "# Ignore the directory if does not ...
[ 2098, 0 ]
[ 2111, 13 ]
python
en
['en', 'error', 'th']
False
non_empty_lines
(path)
Yield non-empty lines from file at path
Yield non-empty lines from file at path
def non_empty_lines(path): """ Yield non-empty lines from file at path """ with open(path) as f: for line in f: line = line.strip() if line: yield line
[ "def", "non_empty_lines", "(", "path", ")", ":", "with", "open", "(", "path", ")", "as", "f", ":", "for", "line", "in", "f", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "line", ":", "yield", "line" ]
[ 2129, 0 ]
[ 2137, 26 ]
python
en
['en', 'error', 'th']
False
resolve_egg_link
(path)
Given a path to an .egg-link, resolve distributions present in the referenced path.
Given a path to an .egg-link, resolve distributions present in the referenced path.
def resolve_egg_link(path): """ Given a path to an .egg-link, resolve distributions present in the referenced path. """ referenced_paths = non_empty_lines(path) resolved_paths = ( os.path.join(os.path.dirname(path), ref) for ref in referenced_paths ) dist_groups = map(fin...
[ "def", "resolve_egg_link", "(", "path", ")", ":", "referenced_paths", "=", "non_empty_lines", "(", "path", ")", "resolved_paths", "=", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ",", "ref", ")", "for"...
[ 2140, 0 ]
[ 2151, 32 ]
python
en
['en', 'error', 'th']
False
register_namespace_handler
(importer_type, namespace_handler)
Register `namespace_handler` to declare namespace packages `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item handler), and `namespace_handler` is a callable like this:: def namespace_handler(importer, path_entry, moduleName, module): # return a path_entry to use f...
Register `namespace_handler` to declare namespace packages
def register_namespace_handler(importer_type, namespace_handler): """Register `namespace_handler` to declare namespace packages `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item handler), and `namespace_handler` is a callable like this:: def namespace_handler(importer, pa...
[ "def", "register_namespace_handler", "(", "importer_type", ",", "namespace_handler", ")", ":", "_namespace_handlers", "[", "importer_type", "]", "=", "namespace_handler" ]
[ 2163, 0 ]
[ 2178, 58 ]
python
en
['it', 'en', 'en']
True
_handle_ns
(packageName, path_item)
Ensure that named package includes a subpath of path_item (if needed)
Ensure that named package includes a subpath of path_item (if needed)
def _handle_ns(packageName, path_item): """Ensure that named package includes a subpath of path_item (if needed)""" importer = get_importer(path_item) if importer is None: return None # use find_spec (PEP 451) and fall-back to find_module (PEP 302) try: loader = importer.find_spec(...
[ "def", "_handle_ns", "(", "packageName", ",", "path_item", ")", ":", "importer", "=", "get_importer", "(", "path_item", ")", "if", "importer", "is", "None", ":", "return", "None", "# use find_spec (PEP 451) and fall-back to find_module (PEP 302)", "try", ":", "loader"...
[ 2181, 0 ]
[ 2213, 18 ]
python
en
['en', 'en', 'en']
True
_rebuild_mod_path
(orig_path, package_name, module)
Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order
Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order
def _rebuild_mod_path(orig_path, package_name, module): """ Rebuild module.__path__ ensuring that all entries are ordered corresponding to their sys.path order """ sys_path = [_normalize_cached(p) for p in sys.path] def safe_sys_path_index(entry): """ Workaround for #520 and #51...
[ "def", "_rebuild_mod_path", "(", "orig_path", ",", "package_name", ",", "module", ")", ":", "sys_path", "=", "[", "_normalize_cached", "(", "p", ")", "for", "p", "in", "sys", ".", "path", "]", "def", "safe_sys_path_index", "(", "entry", ")", ":", "\"\"\"\n...
[ 2216, 0 ]
[ 2247, 34 ]
python
en
['en', 'error', 'th']
False
declare_namespace
(packageName)
Declare that package 'packageName' is a namespace package
Declare that package 'packageName' is a namespace package
def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" _imp.acquire_lock() try: if packageName in _namespace_packages: return path = sys.path parent, _, _ = packageName.rpartition('.') if parent: declare_...
[ "def", "declare_namespace", "(", "packageName", ")", ":", "_imp", ".", "acquire_lock", "(", ")", "try", ":", "if", "packageName", "in", "_namespace_packages", ":", "return", "path", "=", "sys", ".", "path", "parent", ",", "_", ",", "_", "=", "packageName",...
[ 2250, 0 ]
[ 2281, 27 ]
python
en
['en', 'en', 'en']
True
fixup_namespace_packages
(path_item, parent=None)
Ensure that previously-declared namespace packages include path_item
Ensure that previously-declared namespace packages include path_item
def fixup_namespace_packages(path_item, parent=None): """Ensure that previously-declared namespace packages include path_item""" _imp.acquire_lock() try: for package in _namespace_packages.get(parent, ()): subpath = _handle_ns(package, path_item) if subpath: f...
[ "def", "fixup_namespace_packages", "(", "path_item", ",", "parent", "=", "None", ")", ":", "_imp", ".", "acquire_lock", "(", ")", "try", ":", "for", "package", "in", "_namespace_packages", ".", "get", "(", "parent", ",", "(", ")", ")", ":", "subpath", "=...
[ 2284, 0 ]
[ 2293, 27 ]
python
en
['en', 'en', 'en']
True
file_ns_handler
(importer, path_item, packageName, module)
Compute an ns-package subpath for a filesystem or zipfile importer
Compute an ns-package subpath for a filesystem or zipfile importer
def file_ns_handler(importer, path_item, packageName, module): """Compute an ns-package subpath for a filesystem or zipfile importer""" subpath = os.path.join(path_item, packageName.split('.')[-1]) normalized = _normalize_cached(subpath) for item in module.__path__: if _normalize_cached(item) =...
[ "def", "file_ns_handler", "(", "importer", ",", "path_item", ",", "packageName", ",", "module", ")", ":", "subpath", "=", "os", ".", "path", ".", "join", "(", "path_item", ",", "packageName", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ")", "n...
[ 2296, 0 ]
[ 2306, 22 ]
python
en
['en', 'en', 'en']
True
normalize_path
(filename)
Normalize a file/dir name for comparison purposes
Normalize a file/dir name for comparison purposes
def normalize_path(filename): """Normalize a file/dir name for comparison purposes""" return os.path.normcase(os.path.realpath(os.path.normpath( _cygwin_patch(filename))))
[ "def", "normalize_path", "(", "filename", ")", ":", "return", "os", ".", "path", ".", "normcase", "(", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "normpath", "(", "_cygwin_patch", "(", "filename", ")", ")", ")", ")" ]
[ 2323, 0 ]
[ 2326, 34 ]
python
en
['en', 'it', 'en']
True
_cygwin_patch
(filename)
Contrary to POSIX 2008, on Cygwin, getcwd (3) contains symlink components. Using os.path.abspath() works around this limitation. A fix in os.getcwd() would probably better, in Cygwin even more so, except that this seems to be by design...
Contrary to POSIX 2008, on Cygwin, getcwd (3) contains symlink components. Using os.path.abspath() works around this limitation. A fix in os.getcwd() would probably better, in Cygwin even more so, except that this seems to be by design...
def _cygwin_patch(filename): # pragma: nocover """ Contrary to POSIX 2008, on Cygwin, getcwd (3) contains symlink components. Using os.path.abspath() works around this limitation. A fix in os.getcwd() would probably better, in Cygwin even more so, except that this seems to be by design... "...
[ "def", "_cygwin_patch", "(", "filename", ")", ":", "# pragma: nocover", "return", "os", ".", "path", ".", "abspath", "(", "filename", ")", "if", "sys", ".", "platform", "==", "'cygwin'", "else", "filename" ]
[ 2329, 0 ]
[ 2337, 78 ]
python
en
['en', 'error', 'th']
False
_is_egg_path
(path)
Determine if given path appears to be an egg.
Determine if given path appears to be an egg.
def _is_egg_path(path): """ Determine if given path appears to be an egg. """ return _is_zip_egg(path) or _is_unpacked_egg(path)
[ "def", "_is_egg_path", "(", "path", ")", ":", "return", "_is_zip_egg", "(", "path", ")", "or", "_is_unpacked_egg", "(", "path", ")" ]
[ 2348, 0 ]
[ 2352, 54 ]
python
en
['en', 'error', 'th']
False
_is_unpacked_egg
(path)
Determine if given path appears to be an unpacked egg.
Determine if given path appears to be an unpacked egg.
def _is_unpacked_egg(path): """ Determine if given path appears to be an unpacked egg. """ return ( path.lower().endswith('.egg') and os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO')) )
[ "def", "_is_unpacked_egg", "(", "path", ")", ":", "return", "(", "path", ".", "lower", "(", ")", ".", "endswith", "(", "'.egg'", ")", "and", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "path", ",", "'EGG-INFO'", ",",...
[ 2363, 0 ]
[ 2370, 5 ]
python
en
['en', 'error', 'th']
False
yield_lines
(strs)
Yield non-empty/non-comment lines of a string or sequence
Yield non-empty/non-comment lines of a string or sequence
def yield_lines(strs): """Yield non-empty/non-comment lines of a string or sequence""" if isinstance(strs, str): for s in strs.splitlines(): s = s.strip() # skip blank lines/comments if s and not s.startswith('#'): yield s else: for ss in s...
[ "def", "yield_lines", "(", "strs", ")", ":", "if", "isinstance", "(", "strs", ",", "str", ")", ":", "for", "s", "in", "strs", ".", "splitlines", "(", ")", ":", "s", "=", "s", ".", "strip", "(", ")", "# skip blank lines/comments", "if", "s", "and", ...
[ 2381, 0 ]
[ 2392, 23 ]
python
en
['en', 'en', 'en']
True
_version_from_file
(lines)
Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise.
Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise.
def _version_from_file(lines): """ Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise. """ def is_version_line(line): return line.lower().startswith('version:') version_lines = filter(is_version_line, lines) line = ne...
[ "def", "_version_from_file", "(", "lines", ")", ":", "def", "is_version_line", "(", "line", ")", ":", "return", "line", ".", "lower", "(", ")", ".", "startswith", "(", "'version:'", ")", "version_lines", "=", "filter", "(", "is_version_line", ",", "lines", ...
[ 2542, 0 ]
[ 2552, 46 ]
python
en
['en', 'error', 'th']
False
_parsed_pkg_info
(self)
Parse and cache metadata
Parse and cache metadata
def _parsed_pkg_info(self): """Parse and cache metadata""" try: return self._pkg_info except AttributeError: metadata = self.get_metadata(self.PKG_INFO) self._pkg_info = email.parser.Parser().parsestr(metadata) return self._pkg_info
[ "def", "_parsed_pkg_info", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_pkg_info", "except", "AttributeError", ":", "metadata", "=", "self", ".", "get_metadata", "(", "self", ".", "PKG_INFO", ")", "self", ".", "_pkg_info", "=", "email", ".",...
[ 2999, 4 ]
[ 3006, 33 ]
python
en
['en', 'la', 'en']
True
VersionConflict.with_context
(self, required_by)
If required_by is non-empty, return a version of self that is a ContextualVersionConflict.
If required_by is non-empty, return a version of self that is a ContextualVersionConflict.
def with_context(self, required_by): """ If required_by is non-empty, return a version of self that is a ContextualVersionConflict. """ if not required_by: return self args = self.args + (required_by,) return ContextualVersionConflict(*args)
[ "def", "with_context", "(", "self", ",", "required_by", ")", ":", "if", "not", "required_by", ":", "return", "self", "args", "=", "self", ".", "args", "+", "(", "required_by", ",", ")", "return", "ContextualVersionConflict", "(", "*", "args", ")" ]
[ 262, 4 ]
[ 270, 47 ]
python
en
['en', 'error', 'th']
False
IMetadataProvider.has_metadata
(name)
Does the package's distribution contain the named metadata?
Does the package's distribution contain the named metadata?
def has_metadata(name): """Does the package's distribution contain the named metadata?"""
[ "def", "has_metadata", "(", "name", ")", ":" ]
[ 486, 4 ]
[ 487, 73 ]
python
en
['en', 'en', 'en']
True
IMetadataProvider.get_metadata
(name)
The named metadata resource as a string
The named metadata resource as a string
def get_metadata(name): """The named metadata resource as a string"""
[ "def", "get_metadata", "(", "name", ")", ":" ]
[ 489, 4 ]
[ 490, 53 ]
python
en
['en', 'en', 'en']
True
IMetadataProvider.get_metadata_lines
(name)
Yield named metadata resource as list of non-blank non-comment lines Leading and trailing whitespace is stripped from each line, and lines with ``#`` as the first non-blank character are omitted.
Yield named metadata resource as list of non-blank non-comment lines
def get_metadata_lines(name): """Yield named metadata resource as list of non-blank non-comment lines Leading and trailing whitespace is stripped from each line, and lines with ``#`` as the first non-blank character are omitted."""
[ "def", "get_metadata_lines", "(", "name", ")", ":" ]
[ 492, 4 ]
[ 496, 66 ]
python
en
['en', 'en', 'en']
True
IMetadataProvider.metadata_isdir
(name)
Is the named metadata a directory? (like ``os.path.isdir()``)
Is the named metadata a directory? (like ``os.path.isdir()``)
def metadata_isdir(name): """Is the named metadata a directory? (like ``os.path.isdir()``)"""
[ "def", "metadata_isdir", "(", "name", ")", ":" ]
[ 498, 4 ]
[ 499, 76 ]
python
en
['en', 'en', 'en']
True
IMetadataProvider.metadata_listdir
(name)
List of metadata names in the directory (like ``os.listdir()``)
List of metadata names in the directory (like ``os.listdir()``)
def metadata_listdir(name): """List of metadata names in the directory (like ``os.listdir()``)"""
[ "def", "metadata_listdir", "(", "name", ")", ":" ]
[ 501, 4 ]
[ 502, 77 ]
python
en
['en', 'en', 'en']
True
IMetadataProvider.run_script
(script_name, namespace)
Execute the named script in the supplied namespace dictionary
Execute the named script in the supplied namespace dictionary
def run_script(script_name, namespace): """Execute the named script in the supplied namespace dictionary"""
[ "def", "run_script", "(", "script_name", ",", "namespace", ")", ":" ]
[ 504, 4 ]
[ 505, 75 ]
python
en
['en', 'en', 'en']
True
IResourceProvider.get_resource_filename
(manager, resource_name)
Return a true filesystem path for `resource_name` `manager` must be an ``IResourceManager``
Return a true filesystem path for `resource_name`
def get_resource_filename(manager, resource_name): """Return a true filesystem path for `resource_name` `manager` must be an ``IResourceManager``"""
[ "def", "get_resource_filename", "(", "manager", ",", "resource_name", ")", ":" ]
[ 511, 4 ]
[ 514, 52 ]
python
en
['en', 'en', 'en']
True
IResourceProvider.get_resource_stream
(manager, resource_name)
Return a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``
Return a readable file-like object for `resource_name`
def get_resource_stream(manager, resource_name): """Return a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``"""
[ "def", "get_resource_stream", "(", "manager", ",", "resource_name", ")", ":" ]
[ 516, 4 ]
[ 519, 52 ]
python
en
['en', 'en', 'en']
True
IResourceProvider.get_resource_string
(manager, resource_name)
Return a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``
Return a string containing the contents of `resource_name`
def get_resource_string(manager, resource_name): """Return a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``"""
[ "def", "get_resource_string", "(", "manager", ",", "resource_name", ")", ":" ]
[ 521, 4 ]
[ 524, 52 ]
python
en
['en', 'en', 'en']
True
IResourceProvider.has_resource
(resource_name)
Does the package contain the named resource?
Does the package contain the named resource?
def has_resource(resource_name): """Does the package contain the named resource?"""
[ "def", "has_resource", "(", "resource_name", ")", ":" ]
[ 526, 4 ]
[ 527, 58 ]
python
en
['en', 'en', 'en']
True