Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé
Module « pymongo.cursor »

Classe « Code »

Informations générales

Héritage

builtins.object
    builtins.str
        Code

Définition

class Code(builtins.str):

help(Code)

BSON's JavaScript code type.

Raises :class:`TypeError` if `code` is not an instance of
:class:`str` or `scope` is not ``None`` or an instance
of :class:`dict`.

Scope variables can be set by passing a dictionary as the `scope`
argument or by using keyword arguments. If a variable is set as a
keyword argument it will override any setting for that variable in
the `scope` dictionary.

:param code: A string containing JavaScript code to be evaluated or another
    instance of Code. In the latter case, the scope of `code` becomes this
    Code's :attr:`scope`.
:param scope: dictionary representing the scope in which
    `code` should be evaluated - a mapping from identifiers (as
    strings) to values. Defaults to ``None``. This is applied after any
    scope associated with a given `code` above.
:param kwargs: scope variables can also be passed as
    keyword arguments. These are applied after `scope` and `code`.

.. versionchanged:: 3.4
  The default value for :attr:`scope` is ``None`` instead of ``{}``.

Constructeur(s)

Signature du constructeur Description
__new__(cls: 'Type[Code]', code: 'Union[str, Code]', scope: 'Optional[Mapping[str, Any]]' = None, **kwargs: 'Any') -> 'Code'
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des propriétés

Nom de la propriétéDescription
scopeScope dictionary for this instance or ``None``. [extrait de scope.__doc__]

Liste des opérateurs

Signature de l'opérateur Description
__eq__(self, other: 'Any') -> 'bool'
__ne__(self, other: 'Any') -> 'bool'

Opérateurs hérités de la classe str

__add__, __contains__, __ge__, __getitem__, __gt__, __le__, __lt__, __mod__, __mul__, __rmod__, __rmul__

Opérateurs hérités de la classe object

__ge__, __gt__, __le__, __lt__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__repr__(self) -> 'str'

Méthodes héritées de la classe str

__format__, __getnewargs__, __hash__, __init_subclass__, __iter__, __len__, __sizeof__, __str__, __subclasshook__, capitalize, casefold, center, count, encode, endswith, expandtabs, find, format, format_map, index, isalnum, isalpha, isascii, isdecimal, isdigit, isidentifier, islower, isnumeric, isprintable, isspace, istitle, isupper, join, ljust, lower, lstrip, maketrans, partition, removeprefix, removesuffix, replace, rfind, rindex, rjust, rpartition, rsplit, rstrip, split, splitlines, startswith, strip, swapcase, title, translate, upper, zfill

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __init_subclass__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé