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
Collector.collect
(self, objs, source=None, nullable=False, collect_related=True, source_attr=None, reverse_dependency=False, keep_parents=False)
Adds 'objs' to the collection of objects to be deleted as well as all parent instances. 'objs' must be a homogeneous iterable collection of model instances (e.g. a QuerySet). If 'collect_related' is True, related objects will be handled by their respective on_delete handler. ...
Adds 'objs' to the collection of objects to be deleted as well as all parent instances. 'objs' must be a homogeneous iterable collection of model instances (e.g. a QuerySet). If 'collect_related' is True, related objects will be handled by their respective on_delete handler.
def collect(self, objs, source=None, nullable=False, collect_related=True, source_attr=None, reverse_dependency=False, keep_parents=False): """ Adds 'objs' to the collection of objects to be deleted as well as all parent instances. 'objs' must be a homogeneous iterable collectio...
[ "def", "collect", "(", "self", ",", "objs", ",", "source", "=", "None", ",", "nullable", "=", "False", ",", "collect_related", "=", "True", ",", "source_attr", "=", "None", ",", "reverse_dependency", "=", "False", ",", "keep_parents", "=", "False", ")", ...
[ 167, 4 ]
[ 227, 71 ]
python
en
['en', 'error', 'th']
False
Collector.related_objects
(self, related, objs)
Gets a QuerySet of objects related to ``objs`` via the relation ``related``.
Gets a QuerySet of objects related to ``objs`` via the relation ``related``.
def related_objects(self, related, objs): """ Gets a QuerySet of objects related to ``objs`` via the relation ``related``. """ return related.related_model._base_manager.using(self.using).filter( **{"%s__in" % related.field.name: objs} )
[ "def", "related_objects", "(", "self", ",", "related", ",", "objs", ")", ":", "return", "related", ".", "related_model", ".", "_base_manager", ".", "using", "(", "self", ".", "using", ")", ".", "filter", "(", "*", "*", "{", "\"%s__in\"", "%", "related", ...
[ 229, 4 ]
[ 235, 9 ]
python
en
['en', 'error', 'th']
False
validate_system
(system)
Ensure build system has the requisite fields.
Ensure build system has the requisite fields.
def validate_system(system): """ Ensure build system has the requisite fields. """ required = {'requires', 'build-backend'} if not (required <= set(system)): message = "Missing required fields: {missing}".format( missing=required-set(system), ) raise ValueError(me...
[ "def", "validate_system", "(", "system", ")", ":", "required", "=", "{", "'requires'", ",", "'build-backend'", "}", "if", "not", "(", "required", "<=", "set", "(", "system", ")", ")", ":", "message", "=", "\"Missing required fields: {missing}\"", ".", "format"...
[ 16, 0 ]
[ 25, 33 ]
python
en
['en', 'error', 'th']
False
load_system
(source_dir)
Load the build system from a source dir (pyproject.toml).
Load the build system from a source dir (pyproject.toml).
def load_system(source_dir): """ Load the build system from a source dir (pyproject.toml). """ pyproject = os.path.join(source_dir, 'pyproject.toml') with open(pyproject) as f: pyproject_data = toml.load(f) return pyproject_data['build-system']
[ "def", "load_system", "(", "source_dir", ")", ":", "pyproject", "=", "os", ".", "path", ".", "join", "(", "source_dir", ",", "'pyproject.toml'", ")", "with", "open", "(", "pyproject", ")", "as", "f", ":", "pyproject_data", "=", "toml", ".", "load", "(", ...
[ 28, 0 ]
[ 35, 41 ]
python
en
['en', 'error', 'th']
False
compat_system
(source_dir)
Given a source dir, attempt to get a build system backend and requirements from pyproject.toml. Fallback to setuptools but only if the file was not found or a build system was not indicated.
Given a source dir, attempt to get a build system backend and requirements from pyproject.toml. Fallback to setuptools but only if the file was not found or a build system was not indicated.
def compat_system(source_dir): """ Given a source dir, attempt to get a build system backend and requirements from pyproject.toml. Fallback to setuptools but only if the file was not found or a build system was not indicated. """ try: system = load_system(source_dir) except (File...
[ "def", "compat_system", "(", "source_dir", ")", ":", "try", ":", "system", "=", "load_system", "(", "source_dir", ")", "except", "(", "FileNotFoundError", ",", "KeyError", ")", ":", "system", "=", "{", "}", "system", ".", "setdefault", "(", "'build-backend'"...
[ 38, 0 ]
[ 54, 17 ]
python
en
['en', 'error', 'th']
False
Helix.__init__
(self, client_id: str, client_secret: str = None, use_cache: bool = False, cache_duration: Optional[timedelta] = None, handle_rate_limit: bool = True, bearer_token: Optional[str] = None)
Helix API (New Twitch API) https://dev.twitch.tv/docs/api/ :param client_id: Twitch client ID :param client_secret: Twitch client secret :param use_cache: Cache API requests (recommended) :param cache_duration: Cache duration :param bearer_token: API bearer toke...
Helix API (New Twitch API) https://dev.twitch.tv/docs/api/
def __init__(self, client_id: str, client_secret: str = None, use_cache: bool = False, cache_duration: Optional[timedelta] = None, handle_rate_limit: bool = True, bearer_token: Optional[str] = None): """ ...
[ "def", "__init__", "(", "self", ",", "client_id", ":", "str", ",", "client_secret", ":", "str", "=", "None", ",", "use_cache", ":", "bool", "=", "False", ",", "cache_duration", ":", "Optional", "[", "timedelta", "]", "=", "None", ",", "handle_rate_limit", ...
[ 12, 4 ]
[ 49, 77 ]
python
en
['en', 'error', 'th']
False
is_type_SpecificOptional
(f_type)
Returns true for types such as Optional[T], but not Optional, or T.
Returns true for types such as Optional[T], but not Optional, or T.
def is_type_SpecificOptional(f_type) -> bool: """ Returns true for types such as Optional[T], but not Optional, or T. """ return get_origin(f_type) is not None and f_type.__origin__ == Union and get_args(f_type)[1]() is None
[ "def", "is_type_SpecificOptional", "(", "f_type", ")", "->", "bool", ":", "return", "get_origin", "(", "f_type", ")", "is", "not", "None", "and", "f_type", ".", "__origin__", "==", "Union", "and", "get_args", "(", "f_type", ")", "[", "1", "]", "(", ")", ...
[ 22, 0 ]
[ 26, 106 ]
python
en
['en', 'error', 'th']
False
ContentTypeManager.get_for_model
(self, model, for_concrete_model=True)
Returns the ContentType object for a given model, creating the ContentType if necessary. Lookups are cached so that subsequent lookups for the same model don't hit the database.
Returns the ContentType object for a given model, creating the ContentType if necessary. Lookups are cached so that subsequent lookups for the same model don't hit the database.
def get_for_model(self, model, for_concrete_model=True): """ Returns the ContentType object for a given model, creating the ContentType if necessary. Lookups are cached so that subsequent lookups for the same model don't hit the database. """ opts = self._get_opts(model, ...
[ "def", "get_for_model", "(", "self", ",", "model", ",", "for_concrete_model", "=", "True", ")", ":", "opts", "=", "self", ".", "_get_opts", "(", "model", ",", "for_concrete_model", ")", "try", ":", "return", "self", ".", "_get_from_cache", "(", "opts", ")"...
[ 36, 4 ]
[ 62, 17 ]
python
en
['en', 'error', 'th']
False
ContentTypeManager.get_for_models
(self, *models, **kwargs)
Given *models, returns a dictionary mapping {model: content_type}.
Given *models, returns a dictionary mapping {model: content_type}.
def get_for_models(self, *models, **kwargs): """ Given *models, returns a dictionary mapping {model: content_type}. """ for_concrete_models = kwargs.pop('for_concrete_models', True) results = {} # Models that aren't already in the cache. needed_app_labels = set() ...
[ "def", "get_for_models", "(", "self", ",", "*", "models", ",", "*", "*", "kwargs", ")", ":", "for_concrete_models", "=", "kwargs", ".", "pop", "(", "'for_concrete_models'", ",", "True", ")", "results", "=", "{", "}", "# Models that aren't already in the cache.",...
[ 64, 4 ]
[ 106, 22 ]
python
en
['en', 'error', 'th']
False
ContentTypeManager.get_for_id
(self, id)
Lookup a ContentType by ID. Uses the same shared cache as get_for_model (though ContentTypes are obviously not created on-the-fly by get_by_id).
Lookup a ContentType by ID. Uses the same shared cache as get_for_model (though ContentTypes are obviously not created on-the-fly by get_by_id).
def get_for_id(self, id): """ Lookup a ContentType by ID. Uses the same shared cache as get_for_model (though ContentTypes are obviously not created on-the-fly by get_by_id). """ try: ct = self._cache[self.db][id] except KeyError: # This could rais...
[ "def", "get_for_id", "(", "self", ",", "id", ")", ":", "try", ":", "ct", "=", "self", ".", "_cache", "[", "self", ".", "db", "]", "[", "id", "]", "except", "KeyError", ":", "# This could raise a DoesNotExist; that's correct behavior and will", "# make sure that ...
[ 108, 4 ]
[ 120, 17 ]
python
en
['en', 'error', 'th']
False
ContentTypeManager.clear_cache
(self)
Clear out the content-type cache.
Clear out the content-type cache.
def clear_cache(self): """ Clear out the content-type cache. """ self._cache.clear()
[ "def", "clear_cache", "(", "self", ")", ":", "self", ".", "_cache", ".", "clear", "(", ")" ]
[ 122, 4 ]
[ 126, 27 ]
python
en
['en', 'error', 'th']
False
ContentTypeManager._add_to_cache
(self, using, ct)
Insert a ContentType into the cache.
Insert a ContentType into the cache.
def _add_to_cache(self, using, ct): """Insert a ContentType into the cache.""" # Note it's possible for ContentType objects to be stale; model_class() will return None. # Hence, there is no reliance on model._meta.app_label here, just using the model fields instead. key = (ct.app_label, ...
[ "def", "_add_to_cache", "(", "self", ",", "using", ",", "ct", ")", ":", "# Note it's possible for ContentType objects to be stale; model_class() will return None.", "# Hence, there is no reliance on model._meta.app_label here, just using the model fields instead.", "key", "=", "(", "ct...
[ 128, 4 ]
[ 134, 53 ]
python
en
['en', 'en', 'en']
True
gravatar_hash
(email: str)
Compute the Gravatar hash for an email address.
Compute the Gravatar hash for an email address.
def gravatar_hash(email: str) -> str: """Compute the Gravatar hash for an email address.""" # Non-ASCII characters aren't permitted by the currently active e-mail # RFCs. However, the IETF has published https://tools.ietf.org/html/rfc4952, # outlining internationalization of email addresses, and regardl...
[ "def", "gravatar_hash", "(", "email", ":", "str", ")", "->", "str", ":", "# Non-ASCII characters aren't permitted by the currently active e-mail", "# RFCs. However, the IETF has published https://tools.ietf.org/html/rfc4952,", "# outlining internationalization of email addresses, and regardl...
[ 8, 0 ]
[ 15, 55 ]
python
en
['en', 'en', 'en']
True
get
(name: str)
r"""Returns an optimizer class from its name. Case insensitive. Args: name: the optimizer name.
r"""Returns an optimizer class from its name. Case insensitive.
def get(name: str) -> Type[Optimizer]: r"""Returns an optimizer class from its name. Case insensitive. Args: name: the optimizer name. """ optimizer_class = _NAME_OPTIM_MAP.get(name.lower()) if optimizer_class is None: raise ValueError('Optimizer {} not found'.format(name)) retu...
[ "def", "get", "(", "name", ":", "str", ")", "->", "Type", "[", "Optimizer", "]", ":", "optimizer_class", "=", "_NAME_OPTIM_MAP", ".", "get", "(", "name", ".", "lower", "(", ")", ")", "if", "optimizer_class", "is", "None", ":", "raise", "ValueError", "(...
[ 109, 0 ]
[ 118, 26 ]
python
en
['en', 'en', 'en']
True
WalletUserStore.get_all_wallet_info_entries
(self)
Return a set containing all wallets
Return a set containing all wallets
async def get_all_wallet_info_entries(self) -> List[WalletInfo]: """ Return a set containing all wallets """ cursor = await self.db_connection.execute("SELECT * from users_wallets") rows = await cursor.fetchall() await cursor.close() result = [] for row ...
[ "async", "def", "get_all_wallet_info_entries", "(", "self", ")", "->", "List", "[", "WalletInfo", "]", ":", "cursor", "=", "await", "self", ".", "db_connection", ".", "execute", "(", "\"SELECT * from users_wallets\"", ")", "rows", "=", "await", "cursor", ".", ...
[ 104, 4 ]
[ 117, 21 ]
python
en
['en', 'error', 'th']
False
WalletUserStore.get_wallet_by_id
(self, id: int)
Return a wallet by id
Return a wallet by id
async def get_wallet_by_id(self, id: int) -> Optional[WalletInfo]: """ Return a wallet by id """ cursor = await self.db_connection.execute("SELECT * from users_wallets WHERE id=?", (id,)) row = await cursor.fetchone() await cursor.close() if row is None: ...
[ "async", "def", "get_wallet_by_id", "(", "self", ",", "id", ":", "int", ")", "->", "Optional", "[", "WalletInfo", "]", ":", "cursor", "=", "await", "self", ".", "db_connection", ".", "execute", "(", "\"SELECT * from users_wallets WHERE id=?\"", ",", "(", "id",...
[ 119, 4 ]
[ 131, 57 ]
python
en
['en', 'error', 'th']
False
Runner.__init__
(self, distributor, cores=0)
Args: distributor: the name of the distribution method, example multiproc
Args: distributor: the name of the distribution method, example multiproc
def __init__(self, distributor, cores=0): """ Args: distributor: the name of the distribution method, example multiproc """ logger.debug("Using %s distribution method" % distributor) self.distributor = distributor self.mod_path = __name__ + '.' + distributor ...
[ "def", "__init__", "(", "self", ",", "distributor", ",", "cores", "=", "0", ")", ":", "logger", ".", "debug", "(", "\"Using %s distribution method\"", "%", "distributor", ")", "self", ".", "distributor", "=", "distributor", "self", ".", "mod_path", "=", "__n...
[ 14, 4 ]
[ 29, 36 ]
python
en
['en', 'error', 'th']
False
Runner.map
(self, func_name, iterable, args=[])
args: func: The function to be called iterable: a list of objects to iterate over arguments: list of arguments to give to the function returns: the results of all mapped functions
args: func: The function to be called iterable: a list of objects to iterate over arguments: list of arguments to give to the function returns: the results of all mapped functions
def map(self, func_name, iterable, args=[]): """ args: func: The function to be called iterable: a list of objects to iterate over arguments: list of arguments to give to the function returns: the results of all mapped functions """ ...
[ "def", "map", "(", "self", ",", "func_name", ",", "iterable", ",", "args", "=", "[", "]", ")", ":", "func", "=", "self", ".", "get_func", "(", "func_name", ")", "return", "self", ".", "module", ".", "map", "(", "func", ",", "iterable", ",", "args",...
[ 31, 4 ]
[ 41, 52 ]
python
en
['en', 'error', 'th']
False
submittable_timestamp
(timestamp)
Helper function to translate a possibly-timezone-aware datetime into the format used in the go_live_at / expire_at form fields - "YYYY-MM-DD hh:mm", with no timezone indicator. This will be interpreted as being in the server's timezone (settings.TIME_ZONE), so we need to pass it through timezone.localt...
Helper function to translate a possibly-timezone-aware datetime into the format used in the go_live_at / expire_at form fields - "YYYY-MM-DD hh:mm", with no timezone indicator. This will be interpreted as being in the server's timezone (settings.TIME_ZONE), so we need to pass it through timezone.localt...
def submittable_timestamp(timestamp): """ Helper function to translate a possibly-timezone-aware datetime into the format used in the go_live_at / expire_at form fields - "YYYY-MM-DD hh:mm", with no timezone indicator. This will be interpreted as being in the server's timezone (settings.TIME_ZONE), so w...
[ "def", "submittable_timestamp", "(", "timestamp", ")", ":", "if", "timezone", ".", "is_aware", "(", "timestamp", ")", ":", "return", "timezone", ".", "localtime", "(", "timestamp", ")", ".", "strftime", "(", "\"%Y-%m-%d %H:%M\"", ")", "else", ":", "return", ...
[ 5, 0 ]
[ 16, 51 ]
python
en
['en', 'error', 'th']
False
get_edit_handler
(cls)
Get the EditHandler to use in the Wagtail admin when editing this page type.
Get the EditHandler to use in the Wagtail admin when editing this page type.
def get_edit_handler(cls): """ Get the EditHandler to use in the Wagtail admin when editing this page type. """ if hasattr(cls, 'edit_handler'): edit_handler = cls.edit_handler else: # construct a TabbedInterface made up of content_panels, promote_panels # and settings_panels...
[ "def", "get_edit_handler", "(", "cls", ")", ":", "if", "hasattr", "(", "cls", ",", "'edit_handler'", ")", ":", "edit_handler", "=", "cls", ".", "edit_handler", "else", ":", "# construct a TabbedInterface made up of content_panels, promote_panels", "# and settings_panels, ...
[ 941, 0 ]
[ 965, 42 ]
python
en
['en', 'error', 'th']
False
reset_page_edit_handler_cache
(**kwargs)
Clear page edit handler cache when global WAGTAILADMIN_COMMENTS_ENABLED settings are changed
Clear page edit handler cache when global WAGTAILADMIN_COMMENTS_ENABLED settings are changed
def reset_page_edit_handler_cache(**kwargs): """ Clear page edit handler cache when global WAGTAILADMIN_COMMENTS_ENABLED settings are changed """ if kwargs["setting"] == 'WAGTAILADMIN_COMMENTS_ENABLED': set_default_page_edit_handlers(Page) for model in apps.get_models(): if i...
[ "def", "reset_page_edit_handler_cache", "(", "*", "*", "kwargs", ")", ":", "if", "kwargs", "[", "\"setting\"", "]", "==", "'WAGTAILADMIN_COMMENTS_ENABLED'", ":", "set_default_page_edit_handlers", "(", "Page", ")", "for", "model", "in", "apps", ".", "get_models", "...
[ 972, 0 ]
[ 980, 52 ]
python
en
['en', 'error', 'th']
False
EditHandler.classes
(self)
Additional CSS classnames to add to whatever kind of object this is at output. Subclasses of EditHandler should override this, invoking super().classes() to append more classes specific to the situation.
Additional CSS classnames to add to whatever kind of object this is at output. Subclasses of EditHandler should override this, invoking super().classes() to append more classes specific to the situation.
def classes(self): """ Additional CSS classnames to add to whatever kind of object this is at output. Subclasses of EditHandler should override this, invoking super().classes() to append more classes specific to the situation. """ if self.classname: return [se...
[ "def", "classes", "(", "self", ")", ":", "if", "self", ".", "classname", ":", "return", "[", "self", ".", "classname", "]", "return", "[", "]" ]
[ 184, 4 ]
[ 192, 17 ]
python
en
['en', 'error', 'th']
False
EditHandler.field_type
(self)
The kind of field it is e.g boolean_field. Useful for better semantic markup of field display based on type
The kind of field it is e.g boolean_field. Useful for better semantic markup of field display based on type
def field_type(self): """ The kind of field it is e.g boolean_field. Useful for better semantic markup of field display based on type """ return ""
[ "def", "field_type", "(", "self", ")", ":", "return", "\"\"" ]
[ 194, 4 ]
[ 198, 17 ]
python
en
['en', 'error', 'th']
False
EditHandler.id_for_label
(self)
The ID to be used as the 'for' attribute of any <label> elements that refer to this object but are rendered outside of it. Leave blank if this object does not render as a single input field.
The ID to be used as the 'for' attribute of any <label> elements that refer to this object but are rendered outside of it. Leave blank if this object does not render as a single input field.
def id_for_label(self): """ The ID to be used as the 'for' attribute of any <label> elements that refer to this object but are rendered outside of it. Leave blank if this object does not render as a single input field. """ return ""
[ "def", "id_for_label", "(", "self", ")", ":", "return", "\"\"" ]
[ 200, 4 ]
[ 206, 17 ]
python
en
['en', 'error', 'th']
False
EditHandler.render_as_object
(self)
Render this object as it should appear within an ObjectList. Should not include the <h2> heading or help text - ObjectList will supply those
Render this object as it should appear within an ObjectList. Should not include the <h2> heading or help text - ObjectList will supply those
def render_as_object(self): """ Render this object as it should appear within an ObjectList. Should not include the <h2> heading or help text - ObjectList will supply those """ # by default, assume that the subclass provides a catch-all render() method return self.render(...
[ "def", "render_as_object", "(", "self", ")", ":", "# by default, assume that the subclass provides a catch-all render() method", "return", "self", ".", "render", "(", ")" ]
[ 208, 4 ]
[ 214, 28 ]
python
en
['en', 'error', 'th']
False
EditHandler.render_as_field
(self)
Render this object as it should appear within a <ul class="fields"> list item
Render this object as it should appear within a <ul class="fields"> list item
def render_as_field(self): """ Render this object as it should appear within a <ul class="fields"> list item """ # by default, assume that the subclass provides a catch-all render() method return self.render()
[ "def", "render_as_field", "(", "self", ")", ":", "# by default, assume that the subclass provides a catch-all render() method", "return", "self", ".", "render", "(", ")" ]
[ 216, 4 ]
[ 221, 28 ]
python
en
['en', 'error', 'th']
False
EditHandler.render_missing_fields
(self)
Helper function: render all of the fields that are defined on the form but not "claimed" by any panels via required_fields. These fields are most likely to be hidden fields introduced by the forms framework itself, such as ORDER / DELETE fields on formset members. (If they aren't actua...
Helper function: render all of the fields that are defined on the form but not "claimed" by any panels via required_fields. These fields are most likely to be hidden fields introduced by the forms framework itself, such as ORDER / DELETE fields on formset members.
def render_missing_fields(self): """ Helper function: render all of the fields that are defined on the form but not "claimed" by any panels via required_fields. These fields are most likely to be hidden fields introduced by the forms framework itself, such as ORDER / DELETE fields on for...
[ "def", "render_missing_fields", "(", "self", ")", ":", "rendered_fields", "=", "self", ".", "required_fields", "(", ")", "missing_fields_html", "=", "[", "str", "(", "self", ".", "form", "[", "field_name", "]", ")", "for", "field_name", "in", "self", ".", ...
[ 223, 4 ]
[ 239, 54 ]
python
en
['en', 'error', 'th']
False
EditHandler.render_form_content
(self)
Render this as an 'object', ensuring that all fields necessary for a valid form submission are included
Render this as an 'object', ensuring that all fields necessary for a valid form submission are included
def render_form_content(self): """ Render this as an 'object', ensuring that all fields necessary for a valid form submission are included """ return mark_safe(self.render_as_object() + self.render_missing_fields())
[ "def", "render_form_content", "(", "self", ")", ":", "return", "mark_safe", "(", "self", ".", "render_as_object", "(", ")", "+", "self", ".", "render_missing_fields", "(", ")", ")" ]
[ 241, 4 ]
[ 246, 80 ]
python
en
['en', 'error', 'th']
False
BaseFormEditHandler.get_form_class
(self)
Construct a form class that has all the fields and formsets named in the children of this edit handler.
Construct a form class that has all the fields and formsets named in the children of this edit handler.
def get_form_class(self): """ Construct a form class that has all the fields and formsets named in the children of this edit handler. """ if self.model is None: raise AttributeError( '%s is not bound to a model yet. Use `.bind_to(model=model)` ' ...
[ "def", "get_form_class", "(", "self", ")", ":", "if", "self", ".", "model", "is", "None", ":", "raise", "AttributeError", "(", "'%s is not bound to a model yet. Use `.bind_to(model=model)` '", "'before using this method.'", "%", "self", ".", "__class__", ".", "__name__"...
[ 342, 4 ]
[ 363, 44 ]
python
en
['en', 'error', 'th']
False
FieldPanel.widget_overrides
(self)
check if a specific widget has been defined for this field
check if a specific widget has been defined for this field
def widget_overrides(self): """check if a specific widget has been defined for this field""" if hasattr(self, 'widget'): return {self.field_name: self.widget} return {}
[ "def", "widget_overrides", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'widget'", ")", ":", "return", "{", "self", ".", "field_name", ":", "self", ".", "widget", "}", "return", "{", "}" ]
[ 464, 4 ]
[ 468, 17 ]
python
en
['en', 'en', 'en']
True
TestSkyRegionAssociation.test_new_skyregion_insertion
(self)
Here we test the association logic executed upon insertion of a new skyregion. We expect that any pre-existing entries in the runningcatalog which lie within the field of view will be marked as 'within this region', through the presence of an entry in table ``assocskyrgn``. ...
Here we test the association logic executed upon insertion of a new skyregion.
def test_new_skyregion_insertion(self): """Here we test the association logic executed upon insertion of a new skyregion. We expect that any pre-existing entries in the runningcatalog which lie within the field of view will be marked as 'within this region', through the presence...
[ "def", "test_new_skyregion_insertion", "(", "self", ")", ":", "n_images", "=", "6", "im_params", "=", "db_subs", ".", "generate_timespaced_dbimages_data", "(", "n_images", ")", "src_in_img0", "=", "db_subs", ".", "example_extractedsource_tuple", "(", "ra", "=", "im_...
[ 82, 4 ]
[ 129, 40 ]
python
en
['en', 'en', 'en']
True
TestSkyRegionAssociation.test_new_runcat_insertion
(self)
Here we test the association logic executed upon insertion of a new runningcatalog source. We add an empty image0, then proceed to image1, which is partially overlapping. We add one new overlapping source, and one source only in image1's skyrgn. Then we check that the back-assoc...
Here we test the association logic executed upon insertion of a new runningcatalog source.
def test_new_runcat_insertion(self): """Here we test the association logic executed upon insertion of a new runningcatalog source. We add an empty image0, then proceed to image1, which is partially overlapping. We add one new overlapping source, and one source only in image1's s...
[ "def", "test_new_runcat_insertion", "(", "self", ")", ":", "n_images", "=", "6", "im_params", "=", "db_subs", ".", "generate_timespaced_dbimages_data", "(", "n_images", ")", "#We first create 2 overlapping images,", "#one above the other in dec by 1.0*xtr_radius", "idx", "=",...
[ 131, 4 ]
[ 192, 79 ]
python
en
['en', 'en', 'en']
True
TestOneToManyAssocUpdates.test_basic_same_field_case
(self)
Here we start with 1 source in image0. We then add image1 (same field as image0), with a double association for the source, and check assocskyrgn updates correctly.
Here we start with 1 source in image0. We then add image1 (same field as image0), with a double association for the source, and check assocskyrgn updates correctly.
def test_basic_same_field_case(self): """ Here we start with 1 source in image0. We then add image1 (same field as image0), with a double association for the source, and check assocskyrgn updates correctly. """ n_images = 2 im_params = db_subs.generate_timespaced_dbimages_...
[ "def", "test_basic_same_field_case", "(", "self", ")", ":", "n_images", "=", "2", "im_params", "=", "db_subs", ".", "generate_timespaced_dbimages_data", "(", "n_images", ")", "idx", "=", "0", "src_a", "=", "db_subs", ".", "example_extractedsource_tuple", "(", "ra"...
[ 207, 4 ]
[ 236, 43 ]
python
en
['en', 'en', 'en']
True
TestTransientExclusion.test_two_field_basic_case
(self)
Here we create 2 disjoint image fields, with one source at centre of each, and check that the second source inserted does not get flagged as newsource.
Here we create 2 disjoint image fields, with one source at centre of each, and check that the second source inserted does not get flagged as newsource.
def test_two_field_basic_case(self): """ Here we create 2 disjoint image fields, with one source at centre of each, and check that the second source inserted does not get flagged as newsource. """ n_images = 2 xtr_radius = 1.5 im_params = db_subs.generate_...
[ "def", "test_two_field_basic_case", "(", "self", ")", ":", "n_images", "=", "2", "xtr_radius", "=", "1.5", "im_params", "=", "db_subs", ".", "generate_timespaced_dbimages_data", "(", "n_images", ",", "xtr_radius", "=", "xtr_radius", ")", "im_params", "[", "1", "...
[ 249, 4 ]
[ 288, 44 ]
python
en
['en', 'error', 'th']
False
TestTransientExclusion.test_two_field_overlap_new_transient
(self)
Now for something more interesting - two overlapping fields, 4 sources: one steady source only in lower field, one steady source in both fields, one steady source only in upper field, one transient source in both fields but only at 2nd timestep.
Now for something more interesting - two overlapping fields, 4 sources: one steady source only in lower field, one steady source in both fields, one steady source only in upper field, one transient source in both fields but only at 2nd timestep.
def test_two_field_overlap_new_transient(self): """Now for something more interesting - two overlapping fields, 4 sources: one steady source only in lower field, one steady source in both fields, one steady source only in upper field, one transient source in both fields but only ...
[ "def", "test_two_field_overlap_new_transient", "(", "self", ")", ":", "n_images", "=", "2", "xtr_radius", "=", "1.5", "im_params", "=", "db_subs", ".", "generate_timespaced_dbimages_data", "(", "n_images", ",", "xtr_radius", "=", "xtr_radius", ")", "im_params", "[",...
[ 290, 4 ]
[ 347, 44 ]
python
en
['en', 'en', 'en']
True
TestTransientExclusion.test_two_field_overlap_nulling_src
(self)
Similar to above, but one source disappears: Two overlapping fields, 4 sources: one steady source only in lower field, one steady source in both fields, one steady source only in upper field, one transient source in both fields but only at *1st* timestep.
Similar to above, but one source disappears: Two overlapping fields, 4 sources: one steady source only in lower field, one steady source in both fields, one steady source only in upper field, one transient source in both fields but only at *1st* timestep.
def test_two_field_overlap_nulling_src(self): """Similar to above, but one source disappears: Two overlapping fields, 4 sources: one steady source only in lower field, one steady source in both fields, one steady source only in upper field, one transient source in both fi...
[ "def", "test_two_field_overlap_nulling_src", "(", "self", ")", ":", "n_images", "=", "2", "xtr_radius", "=", "1.5", "im_params", "=", "db_subs", ".", "generate_timespaced_dbimages_data", "(", "n_images", ",", "xtr_radius", "=", "xtr_radius", ")", "im_params", "[", ...
[ 349, 4 ]
[ 398, 41 ]
python
en
['en', 'en', 'en']
True
ConsoleStatusReporter.prepare
(self)
Prepare console screen objects, logger, ask for widgets
Prepare console screen objects, logger, ask for widgets
def prepare(self): """ Prepare console screen objects, logger, ask for widgets """ super(ConsoleStatusReporter, self).prepare() if isinstance(self.engine.aggregator, ResultsProvider): self.engine.aggregator.add_listener(self) disable = self.settings.get('disa...
[ "def", "prepare", "(", "self", ")", ":", "super", "(", "ConsoleStatusReporter", ",", "self", ")", ".", "prepare", "(", ")", "if", "isinstance", "(", "self", ".", "engine", ".", "aggregator", ",", "ResultsProvider", ")", ":", "self", ".", "engine", ".", ...
[ 109, 4 ]
[ 140, 58 ]
python
en
['en', 'error', 'th']
False
ConsoleStatusReporter.check
(self)
Repaint the screen
Repaint the screen
def check(self): """ Repaint the screen """ if self._last_datapoint: self.__print_one_line_stats(self.log.info if self.disabled else self.log.debug) self._last_datapoint = None if self.disabled: return False self.__start_screen() ...
[ "def", "check", "(", "self", ")", ":", "if", "self", ".", "_last_datapoint", ":", "self", ".", "__print_one_line_stats", "(", "self", ".", "log", ".", "info", "if", "self", ".", "disabled", "else", "self", ".", "log", ".", "debug", ")", "self", ".", ...
[ 142, 4 ]
[ 157, 20 ]
python
en
['en', 'error', 'th']
False
ConsoleStatusReporter.__start_screen
(self)
Start GUIScreen on windows or urwid.curses_display on *nix :return:
Start GUIScreen on windows or urwid.curses_display on *nix :return:
def __start_screen(self): """ Start GUIScreen on windows or urwid.curses_display on *nix :return: """ if not self.screen.started: self.__redirect_streams() self.screen.start() self.log.info("Waiting for finish...")
[ "def", "__start_screen", "(", "self", ")", ":", "if", "not", "self", ".", "screen", ".", "started", ":", "self", ".", "__redirect_streams", "(", ")", "self", ".", "screen", ".", "start", "(", ")", "self", ".", "log", ".", "info", "(", "\"Waiting for fi...
[ 171, 4 ]
[ 179, 50 ]
python
en
['en', 'error', 'th']
False
ConsoleStatusReporter.__update_screen
(self)
update screen size, update log entries call screen.__repaint() :return:
update screen size, update log entries call screen.__repaint() :return:
def __update_screen(self): """ update screen size, update log entries call screen.__repaint() :return: """ if self.screen.started: self.console.tick() self.screen_size = self.screen.get_cols_rows() self.console.update_log(self.temp_st...
[ "def", "__update_screen", "(", "self", ")", ":", "if", "self", ".", "screen", ".", "started", ":", "self", ".", "console", ".", "tick", "(", ")", "self", ".", "screen_size", "=", "self", ".", "screen", ".", "get_cols_rows", "(", ")", "self", ".", "co...
[ 181, 4 ]
[ 200, 31 ]
python
en
['en', 'error', 'th']
False
ConsoleStatusReporter.aggregated_second
(self, data)
Consume aggregate data and feed it to console screen :type data: bzt.modules.aggregator.DataPoint :return:
Consume aggregate data and feed it to console screen
def aggregated_second(self, data): """ Consume aggregate data and feed it to console screen :type data: bzt.modules.aggregator.DataPoint :return: """ self._last_datapoint = data if self.disabled: return try: self.console.add_data...
[ "def", "aggregated_second", "(", "self", ",", "data", ")", ":", "self", ".", "_last_datapoint", "=", "data", "if", "self", ".", "disabled", ":", "return", "try", ":", "self", ".", "console", ".", "add_data", "(", "data", ")", "except", "KeyboardInterrupt",...
[ 202, 4 ]
[ 220, 56 ]
python
en
['en', 'error', 'th']
False
ConsoleStatusReporter.shutdown
(self)
Stop showing the screen
Stop showing the screen
def shutdown(self): """ Stop showing the screen """ super(ConsoleStatusReporter, self).shutdown() if self.disabled: return self.screen.stop() self.__dump_saved_log()
[ "def", "shutdown", "(", "self", ")", ":", "super", "(", "ConsoleStatusReporter", ",", "self", ")", ".", "shutdown", "(", ")", "if", "self", ".", "disabled", ":", "return", "self", ".", "screen", ".", "stop", "(", ")", "self", ".", "__dump_saved_log", "...
[ 226, 4 ]
[ 235, 31 ]
python
en
['en', 'error', 'th']
False
ConsoleStatusReporter.__dump_saved_log
(self)
Dump data from background logging buffer to orig_stream
Dump data from background logging buffer to orig_stream
def __dump_saved_log(self): """ Dump data from background logging buffer to orig_stream """ if self.logger_handlers and self.orig_streams: # dump what we have in our background logging stream self.log.debug("Restoring logging streams, %s/%s", self.logger_handlers,...
[ "def", "__dump_saved_log", "(", "self", ")", ":", "if", "self", ".", "logger_handlers", "and", "self", ".", "orig_streams", ":", "# dump what we have in our background logging stream", "self", ".", "log", ".", "debug", "(", "\"Restoring logging streams, %s/%s\"", ",", ...
[ 277, 4 ]
[ 292, 75 ]
python
en
['en', 'error', 'th']
False
ConsoleStatusReporter.log_updated
(self)
Notification for log changes, to repaint log widget
Notification for log changes, to repaint log widget
def log_updated(self): """ Notification for log changes, to repaint log widget """ self.console.update_log(self.temp_stream) # we need to repaint, otherwise graceful shutdown messages not visible self.__repaint()
[ "def", "log_updated", "(", "self", ")", ":", "self", ".", "console", ".", "update_log", "(", "self", ".", "temp_stream", ")", "# we need to repaint, otherwise graceful shutdown messages not visible", "self", ".", "__repaint", "(", ")" ]
[ 299, 4 ]
[ 305, 24 ]
python
en
['en', 'error', 'th']
False
ScrollingLog.render
(self, size, focus=False)
Render the widget :param size: :param focus: :return:
Render the widget
def render(self, size, focus=False): """ Render the widget :param size: :param focus: :return: """ self.last_size = size while len(self.body) and BOTTOM not in self.ends_visible(size, focus): self.body.pop(0) return super(ScrollingLog,...
[ "def", "render", "(", "self", ",", "size", ",", "focus", "=", "False", ")", ":", "self", ".", "last_size", "=", "size", "while", "len", "(", "self", ".", "body", ")", "and", "BOTTOM", "not", "in", "self", ".", "ends_visible", "(", "size", ",", "foc...
[ 320, 4 ]
[ 331, 60 ]
python
en
['en', 'error', 'th']
False
ScrollingLog.update
(self, data)
Update log view with data :type data: str
Update log view with data
def update(self, data): """ Update log view with data :type data: str """ lines = self.ansi_escape.sub('', data.strip()).split("\n") while len(self.body): self.body.pop(0) for line in lines[-self.last_size[1]:]: self.body.append(Text(('l...
[ "def", "update", "(", "self", ",", "data", ")", ":", "lines", "=", "self", ".", "ansi_escape", ".", "sub", "(", "''", ",", "data", ".", "strip", "(", ")", ")", ".", "split", "(", "\"\\n\"", ")", "while", "len", "(", "self", ".", "body", ")", ":...
[ 333, 4 ]
[ 345, 49 ]
python
en
['en', 'error', 'th']
False
TaurusConsole.add_data
(self, data)
New datapoint notification :type data: bzt.modules.aggregator.DataPoint
New datapoint notification
def add_data(self, data): """ New datapoint notification :type data: bzt.modules.aggregator.DataPoint """ overall = data[DataPoint.CURRENT].get('', KPISet()) # self.log.debug("Got data for second: %s", to_json(data)) active = int(math.floor(overall[KPISet.SAMPLE...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "overall", "=", "data", "[", "DataPoint", ".", "CURRENT", "]", ".", "get", "(", "''", ",", "KPISet", "(", ")", ")", "# self.log.debug(\"Got data for second: %s\", to_json(data))", "active", "=", "int", "...
[ 409, 4 ]
[ 429, 44 ]
python
en
['en', 'error', 'th']
False
TaurusConsole.update_log
(self, log_stream)
Update log with stream :type log_stream: bzt.modules.console.StringIONotifying
Update log with stream
def update_log(self, log_stream): """ Update log with stream :type log_stream: bzt.modules.console.StringIONotifying """ self.log_widget.update(log_stream.getvalue())
[ "def", "update_log", "(", "self", ",", "log_stream", ")", ":", "self", ".", "log_widget", ".", "update", "(", "log_stream", ".", "getvalue", "(", ")", ")" ]
[ 431, 4 ]
[ 437, 53 ]
python
en
['en', 'error', 'th']
False
TaurusConsole.tick
(self)
Update ticking widgets
Update ticking widgets
def tick(self): """ Update ticking widgets """ self.logo.tick()
[ "def", "tick", "(", "self", ")", ":", "self", ".", "logo", ".", "tick", "(", ")" ]
[ 439, 4 ]
[ 443, 24 ]
python
en
['en', 'error', 'th']
False
StringIONotifying.__init__
(self, listener)
:type self: StringIO
def __init__(self, listener): """ :type self: StringIO """ StringIO.__init__(self) # pylint: disable=non-parent-init-called self.listener = listener
[ "def", "__init__", "(", "self", ",", "listener", ")", ":", "StringIO", ".", "__init__", "(", "self", ")", "# pylint: disable=non-parent-init-called", "self", ".", "listener", "=", "listener" ]
[ 455, 4 ]
[ 461, 32 ]
python
en
['en', 'error', 'th']
False
StringIONotifying.flush
(self)
:type self: StringIONotifying or StringIO
def flush(self): """ :type self: StringIONotifying or StringIO """ # noinspection PyArgumentList StringIO.flush(self) self.listener()
[ "def", "flush", "(", "self", ")", ":", "# noinspection PyArgumentList", "StringIO", ".", "flush", "(", "self", ")", "self", ".", "listener", "(", ")" ]
[ 463, 4 ]
[ 470, 23 ]
python
en
['en', 'error', 'th']
False
ThreeGraphs.append
(self, v_users, active, rps, fail, r_time, conn, lat)
Append data :type v_users: int :type active: int :type rps: int :type fail: int :type r_time: float :type conn: float :type lat: float
Append data
def append(self, v_users, active, rps, fail, r_time, conn, lat): """ Append data :type v_users: int :type active: int :type rps: int :type fail: int :type r_time: float :type conn: float :type lat: float """ if v_users is None: ...
[ "def", "append", "(", "self", ",", "v_users", ",", "active", ",", "rps", ",", "fail", ",", "r_time", ",", "conn", ",", "lat", ")", ":", "if", "v_users", "is", "None", ":", "v_users", "=", "0", "if", "active", "is", "None", ":", "active", "=", "0"...
[ 494, 4 ]
[ 515, 26 ]
python
en
['en', 'error', 'th']
False
StackedGraph.render
(self, size, focus=False)
Render the graph :param focus: ignored :type size: tuple :return:
Render the graph
def render(self, size, focus=False): """ Render the graph :param focus: ignored :type size: tuple :return: """ del focus self.last_size = size matrix = self.__get_matrix(size[0], size[1]) rows = [] for row in range(0, size[1]): ...
[ "def", "render", "(", "self", ",", "size", ",", "focus", "=", "False", ")", ":", "del", "focus", "self", ".", "last_size", "=", "size", "matrix", "=", "self", ".", "__get_matrix", "(", "size", "[", "0", "]", ",", "size", "[", "1", "]", ")", "rows...
[ 551, 4 ]
[ 572, 34 ]
python
en
['en', 'error', 'th']
False
StackedGraph.append
(self, value)
Add data to graph :type value: tuple[float] or float
Add data to graph
def append(self, value): """ Add data to graph :type value: tuple[float] or float """ if not isinstance(value, (list, tuple)): value = (value,) self.max = max(chain(value, chain.from_iterable(islice(self.data, self._left_border(), len(self.data))))) s...
[ "def", "append", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ")", ")", ":", "value", "=", "(", "value", ",", ")", "self", ".", "max", "=", "max", "(", "chain", "(", "value", ",",...
[ 574, 4 ]
[ 586, 26 ]
python
en
['en', 'error', 'th']
False
BoxedGraph.format_title
(self, text)
Override title formatting :type text: list :return:
Override title formatting
def format_title(self, text): """ Override title formatting :type text: list :return: """ return text
[ "def", "format_title", "(", "self", ",", "text", ")", ":", "return", "text" ]
[ 602, 4 ]
[ 609, 19 ]
python
en
['en', 'error', 'th']
False
BoxedGraph.append
(self, data)
Append data, reflecting in title :type data: tuple
Append data, reflecting in title
def append(self, data): """ Append data, reflecting in title :type data: tuple """ self.graph.append(data) nums = list(data) new_title = copy.copy(self.orig_title) for idx, part in enumerate(new_title): if '%' in part: new_titl...
[ "def", "append", "(", "self", ",", "data", ")", ":", "self", ".", "graph", ".", "append", "(", "data", ")", "nums", "=", "list", "(", "data", ")", "new_title", "=", "copy", ".", "copy", "(", "self", ".", "orig_title", ")", "for", "idx", ",", "par...
[ 611, 4 ]
[ 623, 33 ]
python
en
['en', 'error', 'th']
False
LatestStats.add_data
(self, data)
Append datapoint :type data: bzt.modules.aggregator.DataPoint
Append datapoint
def add_data(self, data): """ Append datapoint :type data: bzt.modules.aggregator.DataPoint """ self.data = data if self.data[DataPoint.TIMESTAMP]: dat = datetime.fromtimestamp(self.data[DataPoint.TIMESTAMP]) self.set_title(self.title + " at %s" %...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "self", ".", "data", "=", "data", "if", "self", ".", "data", "[", "DataPoint", ".", "TIMESTAMP", "]", ":", "dat", "=", "datetime", ".", "fromtimestamp", "(", "self", ".", "data", "[", "DataPoint"...
[ 643, 4 ]
[ 656, 34 ]
python
en
['en', 'error', 'th']
False
CumulativeStats.add_data
(self, data)
Append datapoint :type data: bzt.modules.aggregator.DataPoint
Append datapoint
def add_data(self, data): """ Append datapoint :type data: bzt.modules.aggregator.DataPoint """ self.data = data self.percentiles.add_data(data) self.avg_times.add_data(data) self.rcodes.add_data(data) self.labels_pile.add_data(data) if n...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "self", ".", "data", "=", "data", "self", ".", "percentiles", ".", "add_data", "(", "data", ")", "self", ".", "avg_times", ".", "add_data", "(", "data", ")", "self", ".", "rcodes", ".", "add_data...
[ 682, 4 ]
[ 698, 66 ]
python
en
['en', 'error', 'th']
False
PercentilesList.add_data
(self, data)
Append data :type data: bzt.modules.aggregator.DataPoint
Append data
def add_data(self, data): """ Append data :type data: bzt.modules.aggregator.DataPoint """ while len(self.body): self.body.pop(0) self.body.append(Text(("stat-hdr", " Percentiles: "), align=RIGHT)) overall = data.get(self.key).get('', KPISet()) ...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "while", "len", "(", "self", ".", "body", ")", ":", "self", ".", "body", ".", "pop", "(", "0", ")", "self", ".", "body", ".", "append", "(", "Text", "(", "(", "\"stat-hdr\"", ",", "\" Percent...
[ 712, 4 ]
[ 726, 70 ]
python
en
['en', 'error', 'th']
False
AvgTimesList.add_data
(self, data)
Append data :type data: bzt.modules.aggregator.DataPoint
Append data
def add_data(self, data): """ Append data :type data: bzt.modules.aggregator.DataPoint """ while len(self.body): self.body.pop(0) self.body.append(Text(("stat-hdr", " Average Times: "), align=RIGHT)) overall = data.get(self.key).get('', KPISet()) ...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "while", "len", "(", "self", ".", "body", ")", ":", "self", ".", "body", ".", "pop", "(", "0", ")", "self", ".", "body", ".", "append", "(", "Text", "(", "(", "\"stat-hdr\"", ",", "\" Average...
[ 740, 4 ]
[ 759, 30 ]
python
en
['en', 'error', 'th']
False
LabelsPile.add_data
(self, data)
add data to label columns and errors listbox
add data to label columns and errors listbox
def add_data(self, data): """ add data to label columns and errors listbox """ self.label_columns.add_data(data) self.errors_description.add_data(data)
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "self", ".", "label_columns", ".", "add_data", "(", "data", ")", "self", ".", "errors_description", ".", "add_data", "(", "data", ")" ]
[ 774, 4 ]
[ 779, 46 ]
python
en
['en', 'error', 'th']
False
LabelsPile.render
(self, size, focus=False)
Draws LabelsPile based on height of labels_column
Draws LabelsPile based on height of labels_column
def render(self, size, focus=False): """ Draws LabelsPile based on height of labels_column """ labels_height = self.label_columns.get_height() + 1 self.contents[0] = (self.contents[0][0], (GIVEN, labels_height)) return super(LabelsPile, self).render(size)
[ "def", "render", "(", "self", ",", "size", ",", "focus", "=", "False", ")", ":", "labels_height", "=", "self", ".", "label_columns", ".", "get_height", "(", ")", "+", "1", "self", ".", "contents", "[", "0", "]", "=", "(", "self", ".", "contents", "...
[ 781, 4 ]
[ 787, 51 ]
python
en
['en', 'error', 'th']
False
LabelStatsTable.add_data
(self, data)
Append data :type data: bzt.modules.aggregator.DataPoint
Append data
def add_data(self, data): """ Append data :type data: bzt.modules.aggregator.DataPoint """ self.labels.flush_data() self.stats_table.flush_data() overall = data.get(self.key) for label in overall: if label != "": hits = overa...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "self", ".", "labels", ".", "flush_data", "(", ")", "self", ".", "stats_table", ".", "flush_data", "(", ")", "overall", "=", "data", ".", "get", "(", "self", ".", "key", ")", "for", "label", "i...
[ 806, 4 ]
[ 823, 63 ]
python
en
['en', 'error', 'th']
False
LabelStatsTable.render
(self, size, focus=False)
render widget based on stat_table width if no space available, cut obtain some space from labels
render widget based on stat_table width if no space available, cut obtain some space from labels
def render(self, size, focus=False): """ render widget based on stat_table width if no space available, cut obtain some space from labels """ max_width = size[0] stat_table_max_width = self.stats_table.get_width() label_names_width = self.labels.get_width() ...
[ "def", "render", "(", "self", ",", "size", ",", "focus", "=", "False", ")", ":", "max_width", "=", "size", "[", "0", "]", "stat_table_max_width", "=", "self", ".", "stats_table", ".", "get_width", "(", ")", "label_names_width", "=", "self", ".", "labels"...
[ 825, 4 ]
[ 837, 56 ]
python
en
['en', 'error', 'th']
False
LabelStatsTable.get_height
(self)
Return widget's height
Return widget's height
def get_height(self): """ Return widget's height """ return self.labels.get_height()
[ "def", "get_height", "(", "self", ")", ":", "return", "self", ".", "labels", ".", "get_height", "(", ")" ]
[ 839, 4 ]
[ 843, 39 ]
python
en
['en', 'error', 'th']
False
StatsTable.flush_data
(self)
flush data from stats table columns
flush data from stats table columns
def flush_data(self): """ flush data from stats table columns """ self.hits.flush_data() self.failed.flush_data() self.avg_rt.flush_data()
[ "def", "flush_data", "(", "self", ")", ":", "self", ".", "hits", ".", "flush_data", "(", ")", "self", ".", "failed", ".", "flush_data", "(", ")", "self", ".", "avg_rt", ".", "flush_data", "(", ")" ]
[ 858, 4 ]
[ 864, 32 ]
python
en
['en', 'error', 'th']
False
StatsTable.add_data
(self, hits, failed, avg_rt)
add data to stats table columns
add data to stats table columns
def add_data(self, hits, failed, avg_rt): """ add data to stats table columns """ self.hits.add_data(hits) self.failed.add_data(failed) self.avg_rt.add_data(avg_rt)
[ "def", "add_data", "(", "self", ",", "hits", ",", "failed", ",", "avg_rt", ")", ":", "self", ".", "hits", ".", "add_data", "(", "hits", ")", "self", ".", "failed", ".", "add_data", "(", "failed", ")", "self", ".", "avg_rt", ".", "add_data", "(", "a...
[ 866, 4 ]
[ 872, 36 ]
python
en
['en', 'error', 'th']
False
StatsTable.get_width
(self)
returns width of stats table widget
returns width of stats table widget
def get_width(self): """ returns width of stats table widget """ dividechars = 1 table_size = self.hits.get_width() + self.columns[1][0] + self.columns[2][0] + dividechars * 3 return table_size
[ "def", "get_width", "(", "self", ")", ":", "dividechars", "=", "1", "table_size", "=", "self", ".", "hits", ".", "get_width", "(", ")", "+", "self", ".", "columns", "[", "1", "]", "[", "0", "]", "+", "self", ".", "columns", "[", "2", "]", "[", ...
[ 874, 4 ]
[ 880, 25 ]
python
en
['en', 'error', 'th']
False
StatsTable.render
(self, size, focus=False)
set width for columns
set width for columns
def render(self, size, focus=False): """ set width for columns """ hits_size = self.hits.get_width() self.contents[0] = (self.contents[0][0], (GIVEN, hits_size, False)) return super(StatsTable, self).render(size)
[ "def", "render", "(", "self", ",", "size", ",", "focus", "=", "False", ")", ":", "hits_size", "=", "self", ".", "hits", ".", "get_width", "(", ")", "self", ".", "contents", "[", "0", "]", "=", "(", "self", ".", "contents", "[", "0", "]", "[", "...
[ 882, 4 ]
[ 888, 51 ]
python
en
['en', 'error', 'th']
False
StatsColumn.flush_data
(self)
Erase data, draw header
Erase data, draw header
def flush_data(self): """ Erase data, draw header """ while len(self.body): self.body.pop(0) self.body.append(self.header)
[ "def", "flush_data", "(", "self", ")", ":", "while", "len", "(", "self", ".", "body", ")", ":", "self", ".", "body", ".", "pop", "(", "0", ")", "self", ".", "body", ".", "append", "(", "self", ".", "header", ")" ]
[ 900, 4 ]
[ 906, 37 ]
python
en
['en', 'error', 'th']
False
StatsColumn.get_width
(self)
get widget width
get widget width
def get_width(self): """ get widget width """ return max([len(x.text) for x in self.body])
[ "def", "get_width", "(", "self", ")", ":", "return", "max", "(", "[", "len", "(", "x", ".", "text", ")", "for", "x", "in", "self", ".", "body", "]", ")" ]
[ 908, 4 ]
[ 912, 52 ]
python
en
['en', 'error', 'th']
False
StatsColumn.get_height
(self)
get widget height
get widget height
def get_height(self): """ get widget height """ return len(self.body)
[ "def", "get_height", "(", "self", ")", ":", "return", "len", "(", "self", ".", "body", ")" ]
[ 914, 4 ]
[ 918, 29 ]
python
en
['en', 'error', 'th']
False
SampleLabelsNames.add_data
(self, data)
add label name
add label name
def add_data(self, data): """ add label name """ data_widget = Text(("stat-txt", "%s" % data), wrap=CLIP) self.body.append(data_widget)
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "data_widget", "=", "Text", "(", "(", "\"stat-txt\"", ",", "\"%s\"", "%", "data", ")", ",", "wrap", "=", "CLIP", ")", "self", ".", "body", ".", "append", "(", "data_widget", ")" ]
[ 931, 4 ]
[ 936, 37 ]
python
en
['en', 'error', 'th']
False
SampleLabelsHits.add_data
(self, data)
add new hits value to column
add new hits value to column
def add_data(self, data): """ add new hits value to column """ data_widget = Text(("stat-txt", "%d" % data), align=RIGHT) self.body.append(data_widget)
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "data_widget", "=", "Text", "(", "(", "\"stat-txt\"", ",", "\"%d\"", "%", "data", ")", ",", "align", "=", "RIGHT", ")", "self", ".", "body", ".", "append", "(", "data_widget", ")" ]
[ 949, 4 ]
[ 954, 37 ]
python
en
['en', 'error', 'th']
False
SampleLabelsFailed.add_data
(self, data)
add new failed value to column
add new failed value to column
def add_data(self, data): """ add new failed value to column """ data_widget = Text(("stat-txt", "%.2f%%" % data), align=RIGHT) self.body.append(data_widget)
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "data_widget", "=", "Text", "(", "(", "\"stat-txt\"", ",", "\"%.2f%%\"", "%", "data", ")", ",", "align", "=", "RIGHT", ")", "self", ".", "body", ".", "append", "(", "data_widget", ")" ]
[ 967, 4 ]
[ 972, 37 ]
python
en
['en', 'error', 'th']
False
SampleLabelsAvgRT.add_data
(self, data)
add new avg rt value to column
add new avg rt value to column
def add_data(self, data): """ add new avg rt value to column """ data_widget = Text(("stat-txt", "%.3f" % data), align=RIGHT) self.body.append(data_widget)
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "data_widget", "=", "Text", "(", "(", "\"stat-txt\"", ",", "\"%.3f\"", "%", "data", ")", ",", "align", "=", "RIGHT", ")", "self", ".", "body", ".", "append", "(", "data_widget", ")" ]
[ 985, 4 ]
[ 990, 37 ]
python
en
['en', 'error', 'th']
False
DetailedErrorString.add_data
(self, data)
Append data :type data: bzt.modules.aggregator.DataPoint
Append data
def add_data(self, data): """ Append data :type data: bzt.modules.aggregator.DataPoint """ while len(self.body): self.body.pop(0) self.body.append(Text(("stat-hdr", " Errors: "))) overall = data.get(self.key) if '' in overall: err...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "while", "len", "(", "self", ".", "body", ")", ":", "self", ".", "body", ".", "pop", "(", "0", ")", "self", ".", "body", ".", "append", "(", "Text", "(", "(", "\"stat-hdr\"", ",", "\" Errors:...
[ 1003, 4 ]
[ 1027, 71 ]
python
en
['en', 'error', 'th']
False
RCodesList.add_data
(self, data)
Append data point :type data: bzt.modules.aggregator.DataPoint
Append data point
def add_data(self, data): """ Append data point :type data: bzt.modules.aggregator.DataPoint """ while len(self.body): self.body.pop(0) overall = data.get(self.key).get('', KPISet()) self.body.append(Text(("stat-hdr", " Response Codes: "), align=RIG...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "while", "len", "(", "self", ".", "body", ")", ":", "self", ".", "body", ".", "pop", "(", "0", ")", "overall", "=", "data", ".", "get", "(", "self", ".", "key", ")", ".", "get", "(", "''"...
[ 1041, 4 ]
[ 1081, 83 ]
python
en
['en', 'error', 'th']
False
TaurusLogo.tick
(self)
Update rotating sticks
Update rotating sticks
def tick(self): """ Update rotating sticks """ txt = self.by_text % (self.seq[self.idx], VERSION, self.seq[self.idx]) # noinspection PyPropertyAccess self.byb.body.set_text(txt) self.idx += 1 if self.idx >= len(self.seq): self.idx = 0 s...
[ "def", "tick", "(", "self", ")", ":", "txt", "=", "self", ".", "by_text", "%", "(", "self", ".", "seq", "[", "self", ".", "idx", "]", ",", "VERSION", ",", "self", ".", "seq", "[", "self", ".", "idx", "]", ")", "# noinspection PyPropertyAccess", "se...
[ 1105, 4 ]
[ 1115, 26 ]
python
en
['en', 'error', 'th']
False
WidgetProvider.get_widget
(self)
Returns widget instance to be added to sidebar :rtype: urwid.Widget
Returns widget instance to be added to sidebar
def get_widget(self): """ Returns widget instance to be added to sidebar :rtype: urwid.Widget """ pass
[ "def", "get_widget", "(", "self", ")", ":", "pass" ]
[ 1124, 4 ]
[ 1130, 12 ]
python
en
['en', 'error', 'th']
False
ExecutorWidget.update
(self)
Refresh widget values
Refresh widget values
def update(self): """ Refresh widget values """ if self.finished: return if self.executor.start_time: elapsed = time.time() - self.executor.start_time self.elapsed.set_text("Elapsed: %s" % humanize_time(elapsed)) if self.duration: ...
[ "def", "update", "(", "self", ")", ":", "if", "self", ".", "finished", ":", "return", "if", "self", ".", "executor", ".", "start_time", ":", "elapsed", "=", "time", ".", "time", "(", ")", "-", "self", ".", "executor", ".", "start_time", "self", ".", ...
[ 1170, 4 ]
[ 1208, 26 ]
python
en
['en', 'error', 'th']
False
format_for_columns
(pkgs, options)
Convert the package data into something usable by output_package_listing_columns.
Convert the package data into something usable by output_package_listing_columns.
def format_for_columns(pkgs, options): # type: (List[Distribution], Values) -> Tuple[List[List[str]], List[str]] """ Convert the package data into something usable by output_package_listing_columns. """ running_outdated = options.outdated # Adjust the header for the `pip list --outdated` cas...
[ "def", "format_for_columns", "(", "pkgs", ",", "options", ")", ":", "# type: (List[Distribution], Values) -> Tuple[List[List[str]], List[str]]", "running_outdated", "=", "options", ".", "outdated", "# Adjust the header for the `pip list --outdated` case.", "if", "running_outdated", ...
[ 273, 0 ]
[ 308, 23 ]
python
en
['en', 'error', 'th']
False
ListCommand._build_package_finder
(self, options, session)
Create a package finder appropriate to this list command.
Create a package finder appropriate to this list command.
def _build_package_finder(self, options, session): # type: (Values, PipSession) -> PackageFinder """ Create a package finder appropriate to this list command. """ link_collector = LinkCollector.create(session, options=options) # Pass allow_yanked=False to ignore yanked v...
[ "def", "_build_package_finder", "(", "self", ",", "options", ",", "session", ")", ":", "# type: (Values, PipSession) -> PackageFinder", "link_collector", "=", "LinkCollector", ".", "create", "(", "session", ",", "options", "=", "options", ")", "# Pass allow_yanked=False...
[ 125, 4 ]
[ 141, 9 ]
python
en
['en', 'error', 'th']
False
printc
(text, color)
Print in color.
Print in color.
def printc(text, color): """Print in color.""" if sys.stdout.isatty(): print("\033["+codeCodes[color]+"m"+text+"\033[0m") else: print(text)
[ "def", "printc", "(", "text", ",", "color", ")", ":", "if", "sys", ".", "stdout", ".", "isatty", "(", ")", ":", "print", "(", "\"\\033[\"", "+", "codeCodes", "[", "color", "]", "+", "\"m\"", "+", "text", "+", "\"\\033[0m\"", ")", "else", ":", "prin...
[ 30, 0 ]
[ 35, 19 ]
python
en
['en', 'en', 'en']
True
_contains_egg_info
(s)
Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1
Determine whether the string looks like an egg_info.
def _contains_egg_info(s): # type: (str) -> bool """Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 """ return bool(_egg_info_re.search(s))
[ "def", "_contains_egg_info", "(", "s", ")", ":", "# type: (str) -> bool", "return", "bool", "(", "_egg_info_re", ".", "search", "(", "s", ")", ")" ]
[ 34, 0 ]
[ 40, 39 ]
python
en
['en', 'en', 'en']
True
_should_build
( req, # type: InstallRequirement need_wheel, # type: bool check_binary_allowed, # type: BinaryAllowedPredicate )
Return whether an InstallRequirement should be built into a wheel.
Return whether an InstallRequirement should be built into a wheel.
def _should_build( req, # type: InstallRequirement need_wheel, # type: bool check_binary_allowed, # type: BinaryAllowedPredicate ): # type: (...) -> bool """Return whether an InstallRequirement should be built into a wheel.""" if req.constraint: # never build requirements that are mer...
[ "def", "_should_build", "(", "req", ",", "# type: InstallRequirement", "need_wheel", ",", "# type: bool", "check_binary_allowed", ",", "# type: BinaryAllowedPredicate", ")", ":", "# type: (...) -> bool", "if", "req", ".", "constraint", ":", "# never build requirements that ar...
[ 43, 0 ]
[ 85, 15 ]
python
en
['en', 'en', 'en']
True
_should_cache
( req, # type: InstallRequirement )
Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built.
Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built.
def _should_cache( req, # type: InstallRequirement ): # type: (...) -> Optional[bool] """ Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built. """ if re...
[ "def", "_should_cache", "(", "req", ",", "# type: InstallRequirement", ")", ":", "# type: (...) -> Optional[bool]", "if", "req", ".", "editable", "or", "not", "req", ".", "source_dir", ":", "# never cache editable requirements", "return", "False", "if", "req", ".", ...
[ 107, 0 ]
[ 137, 16 ]
python
en
['en', 'error', 'th']
False
_get_cache_dir
( req, # type: InstallRequirement wheel_cache, # type: WheelCache )
Return the persistent or temporary cache directory where the built wheel need to be stored.
Return the persistent or temporary cache directory where the built wheel need to be stored.
def _get_cache_dir( req, # type: InstallRequirement wheel_cache, # type: WheelCache ): # type: (...) -> str """Return the persistent or temporary cache directory where the built wheel need to be stored. """ cache_available = bool(wheel_cache.cache_dir) assert req.link if cache_avai...
[ "def", "_get_cache_dir", "(", "req", ",", "# type: InstallRequirement", "wheel_cache", ",", "# type: WheelCache", ")", ":", "# type: (...) -> str", "cache_available", "=", "bool", "(", "wheel_cache", ".", "cache_dir", ")", "assert", "req", ".", "link", "if", "cache_...
[ 140, 0 ]
[ 154, 20 ]
python
en
['en', 'en', 'en']
True
_build_one
( req, # type: InstallRequirement output_dir, # type: str build_options, # type: List[str] global_options, # type: List[str] )
Build one wheel. :return: The filename of the built wheel, or None if the build failed.
Build one wheel.
def _build_one( req, # type: InstallRequirement output_dir, # type: str build_options, # type: List[str] global_options, # type: List[str] ): # type: (...) -> Optional[str] """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ try: ...
[ "def", "_build_one", "(", "req", ",", "# type: InstallRequirement", "output_dir", ",", "# type: str", "build_options", ",", "# type: List[str]", "global_options", ",", "# type: List[str]", ")", ":", "# type: (...) -> Optional[str]", "try", ":", "ensure_dir", "(", "output_...
[ 162, 0 ]
[ 186, 9 ]
python
en
['en', 'sr', 'en']
True
build
( requirements, # type: Iterable[InstallRequirement] wheel_cache, # type: WheelCache build_options, # type: List[str] global_options, # type: List[str] )
Build wheels. :return: The list of InstallRequirement that succeeded to build and the list of InstallRequirement that failed to build.
Build wheels.
def build( requirements, # type: Iterable[InstallRequirement] wheel_cache, # type: WheelCache build_options, # type: List[str] global_options, # type: List[str] ): # type: (...) -> BuildResult """Build wheels. :return: The list of InstallRequirement that succeeded to build and t...
[ "def", "build", "(", "requirements", ",", "# type: Iterable[InstallRequirement]", "wheel_cache", ",", "# type: WheelCache", "build_options", ",", "# type: List[str]", "global_options", ",", "# type: List[str]", ")", ":", "# type: (...) -> BuildResult", "if", "not", "requireme...
[ 256, 0 ]
[ 305, 42 ]
python
en
['en', 'sr', 'en']
False
check_requires_python
(requires_python, version_info)
Check if the given Python version matches a "Requires-Python" specifier. :param version_info: A 3-tuple of ints representing a Python major-minor-micro version to check (e.g. `sys.version_info[:3]`). :return: `True` if the given Python version satisfies the requirement. Otherwise, return ...
Check if the given Python version matches a "Requires-Python" specifier.
def check_requires_python(requires_python, version_info): # type: (Optional[str], Tuple[int, ...]) -> bool """ Check if the given Python version matches a "Requires-Python" specifier. :param version_info: A 3-tuple of ints representing a Python major-minor-micro version to check (e.g. `sys.vers...
[ "def", "check_requires_python", "(", "requires_python", ",", "version_info", ")", ":", "# type: (Optional[str], Tuple[int, ...]) -> bool", "if", "requires_python", "is", "None", ":", "# The package provides no information", "return", "True", "requires_python_specifier", "=", "s...
[ 22, 0 ]
[ 41, 54 ]
python
en
['en', 'error', 'th']
False
get_metadata
(dist)
:raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None.
:raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None.
def get_metadata(dist): # type: (Distribution) -> Message """ :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. """ metadata_name = 'METADATA' if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_m...
[ "def", "get_metadata", "(", "dist", ")", ":", "# type: (Distribution) -> Message", "metadata_name", "=", "'METADATA'", "if", "(", "isinstance", "(", "dist", ",", "pkg_resources", ".", "DistInfoDistribution", ")", "and", "dist", ".", "has_metadata", "(", "metadata_na...
[ 44, 0 ]
[ 68, 30 ]
python
en
['en', 'error', 'th']
False
get_requires_python
(dist)
Return the "Requires-Python" metadata for a distribution, or None if not present.
Return the "Requires-Python" metadata for a distribution, or None if not present.
def get_requires_python(dist): # type: (pkg_resources.Distribution) -> Optional[str] """ Return the "Requires-Python" metadata for a distribution, or None if not present. """ pkg_info_dict = get_metadata(dist) requires_python = pkg_info_dict.get('Requires-Python') if requires_python is ...
[ "def", "get_requires_python", "(", "dist", ")", ":", "# type: (pkg_resources.Distribution) -> Optional[str]", "pkg_info_dict", "=", "get_metadata", "(", "dist", ")", "requires_python", "=", "pkg_info_dict", ".", "get", "(", "'Requires-Python'", ")", "if", "requires_python...
[ 71, 0 ]
[ 85, 26 ]
python
en
['en', 'error', 'th']
False
kl_divergence_pdf
(p, q, x_cond, n_samples=10 ** 5)
Computes the Kullback–Leibler divergence KL[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution Args: p: conditional distribution object p(y|x) q: conditional distribution object q(y|x) x_cond: x values to condition on - numpy array of shape (n_values, ndim...
Computes the Kullback–Leibler divergence KL[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution
def kl_divergence_pdf(p, q, x_cond, n_samples=10 ** 5): """ Computes the Kullback–Leibler divergence KL[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution Args: p: conditional distribution object p(y|x) q: conditional distribution object q(y|x) x_cond: x ...
[ "def", "kl_divergence_pdf", "(", "p", ",", "q", ",", "x_cond", ",", "n_samples", "=", "10", "**", "5", ")", ":", "return", "_divergence_mc", "(", "p", ",", "q", ",", "x_cond", ",", "_FUN_KL", ",", "n_samples", ")" ]
[ 8, 0 ]
[ 21, 57 ]
python
en
['en', 'en', 'it']
True
js_divergence_pdf
(p, q, x_cond, n_samples=10 ** 5)
Computes the Jensen-Shannon divergence JS[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution Args: p: conditional distribution object p(y|x) q: conditional distribution object q(y|x) x_cond: x values to condition on - numpy array of shape (n_values, ndim_x...
Computes the Jensen-Shannon divergence JS[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution
def js_divergence_pdf(p, q, x_cond, n_samples=10 ** 5): """ Computes the Jensen-Shannon divergence JS[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution Args: p: conditional distribution object p(y|x) q: conditional distribution object q(y|x) x_cond: x va...
[ "def", "js_divergence_pdf", "(", "p", ",", "q", ",", "x_cond", ",", "n_samples", "=", "10", "**", "5", ")", ":", "divergence_fun", "=", "lambda", "p", ",", "q", ":", "0.5", "*", "p", "*", "np", ".", "log", "(", "p", "/", "q", ")", "+", "0.5", ...
[ 23, 0 ]
[ 37, 64 ]
python
en
['en', 'fr', 'it']
False
hellinger_distance_pdf
(p, q, x_cond, n_samples=10 ** 5)
Computes the Hellinger Distance H[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution Args: p: conditional distribution object p(y|x) q: conditional distribution object q(y|x) x_cond: x values to condition on - numpy array of shape (n_values, ndim_x) n_s...
Computes the Hellinger Distance H[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution
def hellinger_distance_pdf(p, q, x_cond, n_samples=10 ** 5): """ Computes the Hellinger Distance H[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution Args: p: conditional distribution object p(y|x) q: conditional distribution object q(y|x) x_cond: x value...
[ "def", "hellinger_distance_pdf", "(", "p", ",", "q", ",", "x_cond", ",", "n_samples", "=", "10", "**", "5", ")", ":", "hellinger_squared", "=", "_divergence_mc", "(", "p", ",", "q", ",", "x_cond", ",", "_FUN_HELLINGER_2", ",", "n_samples", ")", "return", ...
[ 39, 0 ]
[ 53, 41 ]
python
en
['en', 'fr', 'it']
False
divergence_measures_pdf
(p, q, x_cond, n_samples=10**5)
Computes the - Hellinger Distance H[p ; q] - Kullback–Leibler divergence KL[p ; q] - Jennsen-Shannon divergence JS[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution Args: p: conditional distribution object p(y|x) q: conditional di...
Computes the - Hellinger Distance H[p ; q] - Kullback–Leibler divergence KL[p ; q] - Jennsen-Shannon divergence JS[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution
def divergence_measures_pdf(p, q, x_cond, n_samples=10**5): """ Computes the - Hellinger Distance H[p ; q] - Kullback–Leibler divergence KL[p ; q] - Jennsen-Shannon divergence JS[p ; q] via monte carlo integration using importance sampling with a student-t proposal distribution Args: ...
[ "def", "divergence_measures_pdf", "(", "p", ",", "q", ",", "x_cond", ",", "n_samples", "=", "10", "**", "5", ")", ":", "fun_div_measures_stack", "=", "lambda", "p", ",", "q", ":", "np", ".", "stack", "(", "[", "_FUN_HELLINGER_2", "(", "p", ",", "q", ...
[ 55, 0 ]
[ 75, 48 ]
python
en
['en', 'sr', 'en']
False
BaseNNEstimator.reset_fit
(self)
Reset all tensorflow objects to enable the model to be trained again :return:
Reset all tensorflow objects to enable the model to be trained again :return:
def reset_fit(self): """ Reset all tensorflow objects to enable the model to be trained again :return: """ raise NotImplementedError()
[ "def", "reset_fit", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 35, 4 ]
[ 40, 35 ]
python
en
['en', 'error', 'th']
False
BaseNNEstimator.fit_by_cv
(self, X, Y, n_folds=3, param_grid=None, random_state=None, verbose=True, n_jobs=-1)
Fits the conditional density model with hyperparameter search and cross-validation. - Determines the best hyperparameter configuration from a pre-defined set using cross-validation. Thereby, the conditional log-likelihood is used for simulation_eval. - Fits the model with the previously sele...
Fits the conditional density model with hyperparameter search and cross-validation.
def fit_by_cv(self, X, Y, n_folds=3, param_grid=None, random_state=None, verbose=True, n_jobs=-1): """ Fits the conditional density model with hyperparameter search and cross-validation. - Determines the best hyperparameter configuration from a pre-defined set using cross-validation. Thereby, ...
[ "def", "fit_by_cv", "(", "self", ",", "X", ",", "Y", ",", "n_folds", "=", "3", ",", "param_grid", "=", "None", ",", "random_state", "=", "None", ",", "verbose", "=", "True", ",", "n_jobs", "=", "-", "1", ")", ":", "os", ".", "environ", "[", "'TF_...
[ 42, 4 ]
[ 137, 30 ]
python
en
['en', 'en', 'en']
True
BaseNNEstimator.pdf
(self, X, Y)
Predicts the conditional probability p(y|x). Requires the model to be fitted. Args: X: numpy array to be conditioned on - shape: (n_samples, n_dim_x) Y: numpy array of y targets - shape: (n_samples, n_dim_y) Returns: conditional probability p(y|x) - numpy...
Predicts the conditional probability p(y|x). Requires the model to be fitted.
def pdf(self, X, Y): """ Predicts the conditional probability p(y|x). Requires the model to be fitted. Args: X: numpy array to be conditioned on - shape: (n_samples, n_dim_x) Y: numpy array of y targets - shape: (n_samples, n_dim_y) Returns: condit...
[ "def", "pdf", "(", "self", ",", "X", ",", "Y", ")", ":", "assert", "self", ".", "fitted", ",", "\"model must be fitted to compute likelihood score\"", "X", ",", "Y", "=", "self", ".", "_handle_input_dimensionality", "(", "X", ",", "Y", ",", "fitting", "=", ...
[ 139, 4 ]
[ 154, 16 ]
python
en
['en', 'en', 'en']
True