chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8fbd1286-a50f-4ca6-90e2-de96c943125f | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,983 | supabase-export-v2 | b31b5522b89b21f9 | What happens if no configuration is provided ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If no logging configuration is provided, it is possible to have a situation
where a logging event needs to be output, but no handlers can be found to
output the event. | trusted_official_docs | CPython Docs | What happens if no configuration is provided ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If no logging configuration is provided, it is possible to have a situation
where a logging event needs to be output, but no handlers can be found to
output the event. | What happens if no configuration is provided ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If no logging configuration is provided, it is possible to have a situation
where a logging event needs to be output, but no handlers can be found to
output the event. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9087aee3-e993-48e8-b7da-d60c6ccaf5a7 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,030 | supabase-export-v2 | 7836903050521730 | are defined in the core logging package. The other handlers are defined in a sub-module, :mod:`logging.handlers`. (There is also another sub-module, :mod:`logging.config`, for configuration functionality.)
Logged messages are formatted for presentation through instances of the
:class:`Formatter` class. They are initial... | trusted_official_docs | CPython Docs | are defined in the core logging package. The other handlers are defined in a sub-module, :mod:`logging.handlers`. (There is also another sub-module, :mod:`logging.config`, for configuration functionality.)
Logged messages are formatted for presentation through instances of the
:class:`Formatter` class. They are initial... | are defined in the core logging package. The other handlers are defined in a sub-module, :mod:`logging.handlers`. (There is also another sub-module, :mod:`logging.config`, for configuration functionality.)
Logged messages are formatted for presentation through instances of the
:class:`Formatter` class. They are initial... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
921687f3-b8f1-48eb-9238-4ad599a2126f | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,885 | supabase-export-v2 | c560d907058a2c4b | The logging library takes a modular approach and offers several categories of components: loggers, handlers, filters, and formatters.
* Loggers expose the interface that application code directly uses. * Handlers send the log records (created by loggers) to the appropriate
destination. * Filters provide a finer graine... | trusted_official_docs | CPython Docs | The logging library takes a modular approach and offers several categories of components: loggers, handlers, filters, and formatters.
* Loggers expose the interface that application code directly uses. * Handlers send the log records (created by loggers) to the appropriate
destination. * Filters provide a finer graine... | The logging library takes a modular approach and offers several categories of components: loggers, handlers, filters, and formatters.
* Loggers expose the interface that application code directly uses. * Handlers send the log records (created by loggers) to the appropriate
destination. * Filters provide a finer graine... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
92e42660-c1c4-4b54-8ad2-338d41513568 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,914 | supabase-export-v2 | 65561236a827b64e | You don't need to always call these methods on every logger you create. See the last two paragraphs in this section.
With the logger object configured, the following methods create log messages: | trusted_official_docs | CPython Docs | You don't need to always call these methods on every logger you create. See the last two paragraphs in this section.
With the logger object configured, the following methods create log messages: | You don't need to always call these methods on every logger you create. See the last two paragraphs in this section.
With the logger object configured, the following methods create log messages: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
93048657-77f1-4803-8a8d-318a0865d6cf | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,917 | supabase-export-v2 | 7d1dd7858936c1d7 | log message similar to :meth:`Logger.error`. The difference is that :meth:`Logger.exception` dumps a stack trace along with it. Call this method only from an exception handler.
* :meth:`Logger.log` takes a log level as an explicit argument. This is a
little more verbose for logging messages than using the log level co... | trusted_official_docs | CPython Docs | log message similar to :meth:`Logger.error`. The difference is that :meth:`Logger.exception` dumps a stack trace along with it. Call this method only from an exception handler.
* :meth:`Logger.log` takes a log level as an explicit argument. This is a
little more verbose for logging messages than using the log level co... | log message similar to :meth:`Logger.error`. The difference is that :meth:`Logger.exception` dumps a stack trace along with it. Call this method only from an exception handler.
* :meth:`Logger.log` takes a log level as an explicit argument. This is a
little more verbose for logging messages than using the log level co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9650afb7-b98b-4948-8f1c-01dfa61d5ea7 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,026 | supabase-export-v2 | 709c0d4612cce77b | #. :class:`~handlers.QueueHandler` instances send messages to a queue, such as those implemented in the :mod:`queue` or :mod:`multiprocessing` modules.
#. :class:`NullHandler` instances do nothing with error messages. They are used
by library developers who want to use logging, but want to avoid the 'No
handlers coul... | trusted_official_docs | CPython Docs | #. :class:`~handlers.QueueHandler` instances send messages to a queue, such as those implemented in the :mod:`queue` or :mod:`multiprocessing` modules.
#. :class:`NullHandler` instances do nothing with error messages. They are used
by library developers who want to use logging, but want to avoid the 'No
handlers coul... | #. :class:`~handlers.QueueHandler` instances send messages to a queue, such as those implemented in the :mod:`queue` or :mod:`multiprocessing` modules.
#. :class:`NullHandler` instances do nothing with error messages. They are used
by library developers who want to use logging, but want to avoid the 'No
handlers coul... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
986e56f3-f717-42e2-b691-011ea43a0886 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,973 | supabase-export-v2 | fd0de3bdb551c079 | a few advantages over the Python code approach, mainly separation of configuration and code and the ability of noncoders to easily modify the logging properties.
.. warning:: The :func:`fileConfig` function takes a default parameter,
``disable_existing_loggers``, which defaults to ``True`` for reasons of
backward com... | trusted_official_docs | CPython Docs | a few advantages over the Python code approach, mainly separation of configuration and code and the ability of noncoders to easily modify the logging properties.
.. warning:: The :func:`fileConfig` function takes a default parameter,
``disable_existing_loggers``, which defaults to ``True`` for reasons of
backward com... | a few advantages over the Python code approach, mainly separation of configuration and code and the ability of noncoders to easily modify the logging properties.
.. warning:: The :func:`fileConfig` function takes a default parameter,
``disable_existing_loggers``, which defaults to ``True`` for reasons of
backward com... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9a1e950f-97db-4b4e-9d03-c03069e9e584 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,887 | supabase-export-v2 | 02a6f359f801df1f | Log event information is passed between loggers, handlers, filters and formatters in a :class:`LogRecord` instance.
Logging is performed by calling methods on instances of the :class:`Logger`
class (hereafter called :dfn:`loggers`). Each instance has a name, and they are
conceptually arranged in a namespace hierarchy u... | trusted_official_docs | CPython Docs | Log event information is passed between loggers, handlers, filters and formatters in a :class:`LogRecord` instance.
Logging is performed by calling methods on instances of the :class:`Logger`
class (hereafter called :dfn:`loggers`). Each instance has a name, and they are
conceptually arranged in a namespace hierarchy u... | Log event information is passed between loggers, handlers, filters and formatters in a :class:`LogRecord` instance.
Logging is performed by calling methods on instances of the :class:`Logger`
class (hereafter called :dfn:`loggers`). Each instance has a name, and they are
conceptually arranged in a namespace hierarchy u... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ab7aa69-26bc-4ee9-b440-14efc5ce877e | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,008 | supabase-export-v2 | 98abe3d026fc741e | Custom Levels ^^^^^^^^^^^^^
Defining your own levels is possible, but should not be necessary, as the
existing levels have been chosen on the basis of practical experience. However, if you are convinced that you need custom levels, great care should
be exercised when doing this, and it is possibly *a very bad idea to d... | trusted_official_docs | CPython Docs | Custom Levels ^^^^^^^^^^^^^
Defining your own levels is possible, but should not be necessary, as the
existing levels have been chosen on the basis of practical experience. However, if you are convinced that you need custom levels, great care should
be exercised when doing this, and it is possibly *a very bad idea to d... | Custom Levels ^^^^^^^^^^^^^
Defining your own levels is possible, but should not be necessary, as the
existing levels have been chosen on the basis of practical experience. However, if you are convinced that you need custom levels, great care should
be exercised when doing this, and it is possibly *a very bad idea to d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9e63b364-2b34-4517-9411-01642ff1c753 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,911 | supabase-export-v2 | 01281ff1313c68a3 | severity. For example, if the severity level is INFO, the logger will handle only INFO, WARNING, ERROR, and CRITICAL messages and will ignore DEBUG messages.
* :meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove
handler objects from the logger object. Handlers are covered in more detail
in :ref:... | trusted_official_docs | CPython Docs | severity. For example, if the severity level is INFO, the logger will handle only INFO, WARNING, ERROR, and CRITICAL messages and will ignore DEBUG messages.
* :meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove
handler objects from the logger object. Handlers are covered in more detail
in :ref:... | severity. For example, if the severity level is INFO, the logger will handle only INFO, WARNING, ERROR, and CRITICAL messages and will ignore DEBUG messages.
* :meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove
handler objects from the logger object. Handlers are covered in more detail
in :ref:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f2f65ab-201a-4545-b416-686d8e32f248 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,978 | supabase-export-v2 | 970433c324ef8080 | you can construct the dictionary in Python code, receive it in pickled form over a socket, or use whatever approach makes sense for your application.
Here's an example of the same configuration as above, in YAML format for
the new dictionary-based approach: | trusted_official_docs | CPython Docs | you can construct the dictionary in Python code, receive it in pickled form over a socket, or use whatever approach makes sense for your application.
Here's an example of the same configuration as above, in YAML format for
the new dictionary-based approach: | you can construct the dictionary in Python code, receive it in pickled form over a socket, or use whatever approach makes sense for your application.
Here's an example of the same configuration as above, in YAML format for
the new dictionary-based approach: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9fb4eeaa-13a3-417c-be8d-c854c5a5a799 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,998 | supabase-export-v2 | a51d91ff2246a3ef | root logger will make it difficult or impossible for the application developer to configure the logging verbosity or handlers of your library as they wish.
.. note:: It is strongly advised that you *do not add any handlers other
than* :class:`~logging.NullHandler` *to your library's loggers*. This is
because the conf... | trusted_official_docs | CPython Docs | root logger will make it difficult or impossible for the application developer to configure the logging verbosity or handlers of your library as they wish.
.. note:: It is strongly advised that you *do not add any handlers other
than* :class:`~logging.NullHandler` *to your library's loggers*. This is
because the conf... | root logger will make it difficult or impossible for the application developer to configure the logging verbosity or handlers of your library as they wish.
.. note:: It is strongly advised that you *do not add any handlers other
than* :class:`~logging.NullHandler` *to your library's loggers*. This is
because the conf... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a05a2a36-faf3-4c06-b3ec-1555e26c3a2c | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,859 | supabase-export-v2 | e42d37ffced1a8a7 | WARNING:root:Look before you leap!
As you can see, merging of variable data into the event description message
uses the old, %-style of string formatting. This is for backwards
compatibility: the logging package pre-dates newer formatting options such as
:meth:`str.format` and :class:`string.Template`. These newer form... | trusted_official_docs | CPython Docs | WARNING:root:Look before you leap!
As you can see, merging of variable data into the event description message
uses the old, %-style of string formatting. This is for backwards
compatibility: the logging package pre-dates newer formatting options such as
:meth:`str.format` and :class:`string.Template`. These newer form... | WARNING:root:Look before you leap!
As you can see, merging of variable data into the event description message
uses the old, %-style of string formatting. This is for backwards
compatibility: the logging package pre-dates newer formatting options such as
:meth:`str.format` and :class:`string.Template`. These newer form... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a143eef6-0690-48fe-bd02-6403bf37d997 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,002 | supabase-export-v2 | 62ef5a6ee06e22d4 | +--------------+---------------+ | ``WARNING`` | 30 | +--------------+---------------+ | ``INFO`` | 20 | +--------------+---------------+ | ``DEBUG`` | 10 | +--------------+---------------+ | ``NOTSET`` | 0 | +--------------+---------------+
Levels can also be associated with loggers, being set either by the developer ... | trusted_official_docs | CPython Docs | +--------------+---------------+ | ``WARNING`` | 30 | +--------------+---------------+ | ``INFO`` | 20 | +--------------+---------------+ | ``DEBUG`` | 10 | +--------------+---------------+ | ``NOTSET`` | 0 | +--------------+---------------+
Levels can also be associated with loggers, being set either by the developer ... | +--------------+---------------+ | ``WARNING`` | 30 | +--------------+---------------+ | ``INFO`` | 20 | +--------------+---------------+ | ``DEBUG`` | 10 | +--------------+---------------+ | ``NOTSET`` | 0 | +--------------+---------------+
Levels can also be associated with loggers, being set either by the developer ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a21426ea-6adf-4b49-afaf-388ab05356e5 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,005 | supabase-export-v2 | c8c521ea440d8012 | passed :class:`LogRecord` instances intended for particular destinations. Each logger can have zero, one or more handlers associated with it (via the :meth:`~Logger.addHandler` method of :class:`Logger`).
In addition to any
handlers directly associated with a logger, *all handlers associated with all
ancestors of the l... | trusted_official_docs | CPython Docs | passed :class:`LogRecord` instances intended for particular destinations. Each logger can have zero, one or more handlers associated with it (via the :meth:`~Logger.addHandler` method of :class:`Logger`).
In addition to any
handlers directly associated with a logger, *all handlers associated with all
ancestors of the l... | passed :class:`LogRecord` instances intended for particular destinations. Each logger can have zero, one or more handlers associated with it (via the :meth:`~Logger.addHandler` method of :class:`Logger`).
In addition to any
handlers directly associated with a logger, *all handlers associated with all
ancestors of the l... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a2bf8df6-64d1-4998-88ee-369d36050e59 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,880 | supabase-export-v2 | 9be4927fa84c3ec1 | a little more of your time in reading the following sections. If you're ready for that, grab some of your favourite beverage and carry on.
If your logging needs are simple, then use the above examples to incorporate
logging into your own scripts, and if you run into problems or don't understand
something, please post a... | trusted_official_docs | CPython Docs | a little more of your time in reading the following sections. If you're ready for that, grab some of your favourite beverage and carry on.
If your logging needs are simple, then use the above examples to incorporate
logging into your own scripts, and if you run into problems or don't understand
something, please post a... | a little more of your time in reading the following sections. If you're ready for that, grab some of your favourite beverage and carry on.
If your logging needs are simple, then use the above examples to incorporate
logging into your own scripts, and if you run into problems or don't understand
something, please post a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a45b1de5-1d8d-4369-aaa6-65bf02ee43c1 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,931 | supabase-export-v2 | 5288d446bfb99a7a | if your application needs special behavior. The constructor takes three optional arguments -- a message format string, a date format string and a style indicator.
.. method:: logging.Formatter.__init__(fmt=None, datefmt=None, style='%') | trusted_official_docs | CPython Docs | if your application needs special behavior. The constructor takes three optional arguments -- a message format string, a date format string and a style indicator.
.. method:: logging.Formatter.__init__(fmt=None, datefmt=None, style='%') | if your application needs special behavior. The constructor takes three optional arguments -- a message format string, a date format string and a style indicator.
.. method:: logging.Formatter.__init__(fmt=None, datefmt=None, style='%') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a58345e3-8548-4ad6-b68f-a0379c487ce3 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,937 | supabase-export-v2 | 894065e064621f9a | .. versionchanged:: 3.2 Added the ``style`` parameter.
The following message format string will log the time in a human-readable
format, the severity of the message, and the contents of the message, in that
order:: | trusted_official_docs | CPython Docs | .. versionchanged:: 3.2 Added the ``style`` parameter.
The following message format string will log the time in a human-readable
format, the severity of the message, and the contents of the message, in that
order:: | .. versionchanged:: 3.2 Added the ``style`` parameter.
The following message format string will log the time in a human-readable
format, the severity of the message, and the contents of the message, in that
order:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a7bfff25-5ab0-4afc-a7e8-6c89646184d6 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,849 | supabase-export-v2 | f8a0297066e78271 | which you'll pass to :func:`basicConfig` via the *level* argument. You may want to error check any user input value, perhaps as in the following example::
# assuming loglevel is bound to the string value obtained from the
# command line argument. Convert to upper case to allow the user to
# specify --log=DEBUG or --l... | trusted_official_docs | CPython Docs | which you'll pass to :func:`basicConfig` via the *level* argument. You may want to error check any user input value, perhaps as in the following example::
# assuming loglevel is bound to the string value obtained from the
# command line argument. Convert to upper case to allow the user to
# specify --log=DEBUG or --l... | which you'll pass to :func:`basicConfig` via the *level* argument. You may want to error check any user input value, perhaps as in the following example::
# assuming loglevel is bound to the string value obtained from the
# command line argument. Convert to upper case to allow the user to
# specify --log=DEBUG or --l... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a8732316-6a79-4fed-b5a4-db6dac6f501b | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,027 | supabase-export-v2 | 9b7e4083d4349f10 | handlers could be found for logger *XXX*' message which can be displayed if the library user has not configured logging. See :ref:`library-config` for more information.
.. versionadded:: 3.1
The :class:`NullHandler` class. | trusted_official_docs | CPython Docs | handlers could be found for logger *XXX*' message which can be displayed if the library user has not configured logging. See :ref:`library-config` for more information.
.. versionadded:: 3.1
The :class:`NullHandler` class. | handlers could be found for logger *XXX*' message which can be displayed if the library user has not configured logging. See :ref:`library-config` for more information.
.. versionadded:: 3.1
The :class:`NullHandler` class. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a97e1ec3-9f0f-4e58-aa00-5cc02333be60 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,938 | supabase-export-v2 | 1c1f3a93e8e9a149 | message format string will log the time in a human-readable format, the severity of the message, and the contents of the message, in that order::
'%(asctime)s - %(levelname)s - %(message)s' | trusted_official_docs | CPython Docs | message format string will log the time in a human-readable format, the severity of the message, and the contents of the message, in that order::
'%(asctime)s - %(levelname)s - %(message)s' | message format string will log the time in a human-readable format, the severity of the message, and the contents of the message, in that order::
'%(asctime)s - %(levelname)s - %(message)s' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aa8bc69d-8234-4211-9fa4-3df9afbd8c7d | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,892 | supabase-export-v2 | 60d4be8b440dfd8d | of the root logger. The functions and the methods have the same signatures. The root logger's name is printed as 'root' in the logged output.
It is, of course, possible to log messages to different destinations. Support
is included in the package for writing log messages to files, HTTP GET/POST
locations, email via SMT... | trusted_official_docs | CPython Docs | of the root logger. The functions and the methods have the same signatures. The root logger's name is printed as 'root' in the logged output.
It is, of course, possible to log messages to different destinations. Support
is included in the package for writing log messages to files, HTTP GET/POST
locations, email via SMT... | of the root logger. The functions and the methods have the same signatures. The root logger's name is printed as 'root' in the logged output.
It is, of course, possible to log messages to different destinations. Support
is included in the package for writing log messages to files, HTTP GET/POST
locations, email via SMT... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
adf100ae-a0a3-4210-973f-3aad1da06432 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,954 | supabase-export-v2 | fc29cbfa55848a19 | .. code-block:: shell-session
$ python simple_logging_module.py
2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message
2005-03-19 15:10:26,620 - simple_example - INFO - info message
2005-03-19 15:10:26,695 - simple_example - WARNING - warn message
2005-03-19 15:10:26,697 - simple_example - ERROR - error m... | trusted_official_docs | CPython Docs | .. code-block:: shell-session
$ python simple_logging_module.py
2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message
2005-03-19 15:10:26,620 - simple_example - INFO - info message
2005-03-19 15:10:26,695 - simple_example - WARNING - warn message
2005-03-19 15:10:26,697 - simple_example - ERROR - error m... | .. code-block:: shell-session
$ python simple_logging_module.py
2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message
2005-03-19 15:10:26,620 - simple_example - INFO - info message
2005-03-19 15:10:26,695 - simple_example - WARNING - warn message
2005-03-19 15:10:26,697 - simple_example - ERROR - error m... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b4560fa6-d45a-4dc2-b327-8dd6f48989a5 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,834 | supabase-export-v2 | 3804ac0a60f0aa2c | WARNING:root:Watch out!
printed out on the console. The ``INFO`` message doesn't appear because the
default level is ``WARNING``. The printed message includes the indication of the
level and the description of the event provided in the logging call, i.e. 'Watch out!'. The actual output can be formatted quite flexibly i... | trusted_official_docs | CPython Docs | WARNING:root:Watch out!
printed out on the console. The ``INFO`` message doesn't appear because the
default level is ``WARNING``. The printed message includes the indication of the
level and the description of the event provided in the logging call, i.e. 'Watch out!'. The actual output can be formatted quite flexibly i... | WARNING:root:Watch out!
printed out on the console. The ``INFO`` message doesn't appear because the
default level is ``WARNING``. The printed message includes the indication of the
level and the description of the event provided in the logging call, i.e. 'Watch out!'. The actual output can be formatted quite flexibly i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bb2b67d7-48f5-4995-9ac2-6f8e2930aff0 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,033 | supabase-export-v2 | 99da3788198c7479 | message further, both loggers and handlers consult all their filters for permission. If any filter returns a false value, the message is not processed further.
The basic :class:`Filter` functionality allows filtering by specific logger
name. If this feature is used, messages sent to the named logger and its
children ar... | trusted_official_docs | CPython Docs | message further, both loggers and handlers consult all their filters for permission. If any filter returns a false value, the message is not processed further.
The basic :class:`Filter` functionality allows filtering by specific logger
name. If this feature is used, messages sent to the named logger and its
children ar... | message further, both loggers and handlers consult all their filters for permission. If any filter returns a false value, the message is not processed further.
The basic :class:`Filter` functionality allows filtering by specific logger
name. If this feature is used, messages sent to the named logger and its
children ar... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bd9cde7f-1f6b-4a7b-a12b-921b7bdec377 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,850 | supabase-export-v2 | eb3871065b8f38b1 | user to # specify --log=DEBUG or --log=debug numeric_level = getattr(logging, loglevel.upper(), None) if not isinstance(numeric_level, int): raise ValueError('Invalid log level: %s' % loglevel) logging.basicConfig(level=numeric_level, ...)
The call to :func:`basicConfig` should come *before* any calls to a logger's
met... | trusted_official_docs | CPython Docs | user to # specify --log=DEBUG or --log=debug numeric_level = getattr(logging, loglevel.upper(), None) if not isinstance(numeric_level, int): raise ValueError('Invalid log level: %s' % loglevel) logging.basicConfig(level=numeric_level, ...)
The call to :func:`basicConfig` should come *before* any calls to a logger's
met... | user to # specify --log=DEBUG or --log=debug numeric_level = getattr(logging, loglevel.upper(), None) if not isinstance(numeric_level, int): raise ValueError('Invalid log level: %s' % loglevel) logging.basicConfig(level=numeric_level, ...)
The call to :func:`basicConfig` should come *before* any calls to a logger's
met... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bfd4a638-9c86-4760-9174-01c1daa19743 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,989 | supabase-export-v2 | 4bd7ba61fb7b2b00 | * If :data:`raiseExceptions` is ``True`` (development mode), a message 'No handlers could be found for logger X.Y.Z' is printed once.
To obtain the pre-3.2 behaviour,
:data:`lastResort` can be set to ``None``. | trusted_official_docs | CPython Docs | * If :data:`raiseExceptions` is ``True`` (development mode), a message 'No handlers could be found for logger X.Y.Z' is printed once.
To obtain the pre-3.2 behaviour,
:data:`lastResort` can be set to ``None``. | * If :data:`raiseExceptions` is ``True`` (development mode), a message 'No handlers could be found for logger X.Y.Z' is printed once.
To obtain the pre-3.2 behaviour,
:data:`lastResort` can be set to ``None``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c0f7706d-8d09-4945-822d-b971362f2a6a | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,920 | supabase-export-v2 | 0795cff31cd07ea5 | deciding whether to process an event, the effective level of the logger is used to determine whether the event is passed to the logger's handlers.
Child loggers propagate messages up to the handlers associated with their
ancestor loggers. Because of this, it is unnecessary to define and configure
handlers for all the l... | trusted_official_docs | CPython Docs | deciding whether to process an event, the effective level of the logger is used to determine whether the event is passed to the logger's handlers.
Child loggers propagate messages up to the handlers associated with their
ancestor loggers. Because of this, it is unnecessary to define and configure
handlers for all the l... | deciding whether to process an event, the effective level of the logger is used to determine whether the event is passed to the logger's handlers.
Child loggers propagate messages up to the handlers associated with their
ancestor loggers. Because of this, it is unnecessary to define and configure
handlers for all the l... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c4b755b7-1e27-4534-ae1e-8b6278c6fa28 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,913 | supabase-export-v2 | a39707e4c0cf94bb | * :meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove filter objects from the logger object. Filters are covered in more detail in :ref:`filter`.
You don't need to always call these methods on every logger you create. See the
last two paragraphs in this section. | trusted_official_docs | CPython Docs | * :meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove filter objects from the logger object. Filters are covered in more detail in :ref:`filter`.
You don't need to always call these methods on every logger you create. See the
last two paragraphs in this section. | * :meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove filter objects from the logger object. Filters are covered in more detail in :ref:`filter`.
You don't need to always call these methods on every logger you create. See the
last two paragraphs in this section. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c86d8728-911a-4fe4-996e-80260a53396e | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,826 | supabase-export-v2 | 72fed866ef239026 | some function. | +--------------+---------------------------------------------+ | ``CRITICAL`` | A serious error, indicating that the program| | | itself may be unable to continue running. | +--------------+---------------------------------------------+
The default level is ``WARNING``, which means that only events of ... | trusted_official_docs | CPython Docs | some function. | +--------------+---------------------------------------------+ | ``CRITICAL`` | A serious error, indicating that the program| | | itself may be unable to continue running. | +--------------+---------------------------------------------+
The default level is ``WARNING``, which means that only events of ... | some function. | +--------------+---------------------------------------------+ | ``CRITICAL`` | A serious error, indicating that the program| | | itself may be unable to continue running. | +--------------+---------------------------------------------+
The default level is ``WARNING``, which means that only events of ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cb7276e8-5e4a-4c2f-a6eb-068081fe1e7a | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,934 | supabase-export-v2 | 6c5d907b4ff742b9 | %Y-%m-%d %H:%M:%S
with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``,
``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be used. | trusted_official_docs | CPython Docs | %Y-%m-%d %H:%M:%S
with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``,
``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be used. | %Y-%m-%d %H:%M:%S
with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``,
``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be used. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cd51d280-307d-435e-89a1-5373b7ce9c13 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,039 | supabase-export-v2 | 17f189bad5e91212 | checks to see if a module-level variable, :data:`raiseExceptions`, is set. If set, a traceback is printed to :data:`sys.stderr`. If not set, the exception is swallowed.
.. note::
The default value of :data:`raiseExceptions` is ``True``. This is
because during development, you typically want to be notified of any
exc... | trusted_official_docs | CPython Docs | checks to see if a module-level variable, :data:`raiseExceptions`, is set. If set, a traceback is printed to :data:`sys.stderr`. If not set, the exception is swallowed.
.. note::
The default value of :data:`raiseExceptions` is ``True``. This is
because during development, you typically want to be notified of any
exc... | checks to see if a module-level variable, :data:`raiseExceptions`, is set. If set, a traceback is printed to :data:`sys.stderr`. If not set, the exception is swallowed.
.. note::
The default value of :data:`raiseExceptions` is ``True``. This is
because during development, you typically want to be notified of any
exc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cdea25a0-bda5-4d29-b9cd-35a20dddee2b | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,032 | supabase-export-v2 | 0a0b0180a5093b0a | used. In addition to the format string (which is applied to each message in the batch), there is provision for header and trailer format strings.
When filtering based on logger level and/or handler level is not enough,
instances of :class:`Filter` can be added to both :class:`Logger` and
:class:`Handler` instances (thr... | trusted_official_docs | CPython Docs | used. In addition to the format string (which is applied to each message in the batch), there is provision for header and trailer format strings.
When filtering based on logger level and/or handler level is not enough,
instances of :class:`Filter` can be added to both :class:`Logger` and
:class:`Handler` instances (thr... | used. In addition to the format string (which is applied to each message in the batch), there is provision for header and trailer format strings.
When filtering based on logger level and/or handler level is not enough,
instances of :class:`Filter` can be added to both :class:`Logger` and
:class:`Handler` instances (thr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cf903afc-4358-4e0f-9511-bfa395755ec0 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,955 | supabase-export-v2 | f28d8f4e7a548882 | - simple_example - WARNING - warn message 2005-03-19 15:10:26,697 - simple_example - ERROR - error message 2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message
The following Python module creates a logger, handler, and formatter nearly
identical to those in the example listed above, with the only diff... | trusted_official_docs | CPython Docs | - simple_example - WARNING - warn message 2005-03-19 15:10:26,697 - simple_example - ERROR - error message 2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message
The following Python module creates a logger, handler, and formatter nearly
identical to those in the example listed above, with the only diff... | - simple_example - WARNING - warn message 2005-03-19 15:10:26,697 - simple_example - ERROR - error message 2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message
The following Python module creates a logger, handler, and formatter nearly
identical to those in the example listed above, with the only diff... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d03217b7-d4bf-4c73-a18f-02726744a387 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,844 | supabase-export-v2 | ae4fc9a38ca413ad | logging level which acts as the threshold for tracking. In this case, because we set the threshold to ``DEBUG``, all of the messages were printed.
If you want to set the logging level from a command-line option such as: | trusted_official_docs | CPython Docs | logging level which acts as the threshold for tracking. In this case, because we set the threshold to ``DEBUG``, all of the messages were printed.
If you want to set the logging level from a command-line option such as: | logging level which acts as the threshold for tracking. In this case, because we set the threshold to ``DEBUG``, all of the messages were printed.
If you want to set the logging level from a command-line option such as: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3c47034-f549-45e7-a5b8-205af2cbb443 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,821 | supabase-export-v2 | 97c6b17b7eae2124 | | | particular runtime event | | +-------------------------------------+--------------------------------------+ | Report suppression of an error | A logger's :meth:`~Logger.error`, | | without raising an exception (e.g.
| :meth:`~Logger.exception` or |
| error handler in a long-running | :meth:`~Logger.critical` method... | trusted_official_docs | CPython Docs | | | particular runtime event | | +-------------------------------------+--------------------------------------+ | Report suppression of an error | A logger's :meth:`~Logger.error`, | | without raising an exception (e.g.
| :meth:`~Logger.exception` or |
| error handler in a long-running | :meth:`~Logger.critical` method... | | | particular runtime event | | +-------------------------------------+--------------------------------------+ | Report suppression of an error | A logger's :meth:`~Logger.error`, | | without raising an exception (e.g.
| :meth:`~Logger.exception` or |
| error handler in a long-running | :meth:`~Logger.critical` method... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc984550-dd2e-4128-ad45-d25408648604 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,843 | supabase-export-v2 | f54d3091d38fb587 | DEBUG:__main__:This message should go to the log file INFO:__main__:So should this WARNING:__main__:And this, too ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö
This example also shows how you can set the logging level which acts as the
threshold for tracking. In this case, because we set the threshold... | trusted_official_docs | CPython Docs | DEBUG:__main__:This message should go to the log file INFO:__main__:So should this WARNING:__main__:And this, too ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö
This example also shows how you can set the logging level which acts as the
threshold for tracking. In this case, because we set the threshold... | DEBUG:__main__:This message should go to the log file INFO:__main__:So should this WARNING:__main__:And this, too ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö
This example also shows how you can set the logging level which acts as the
threshold for tracking. In this case, because we set the threshold... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dce2e65e-c6bc-4c0a-b30c-77eb4ac2044a | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,935 | supabase-export-v2 | a88af77864f71ac4 | on at the end. The ``style`` is one of ``'%'``, ``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be used.
If the ``style`` is ``'%'``, the message format string uses
``%(<dictionary key>)s`` styled string substitution; the possible keys are
documented in :ref:`logrecord-attributes`. If the style... | trusted_official_docs | CPython Docs | on at the end. The ``style`` is one of ``'%'``, ``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be used.
If the ``style`` is ``'%'``, the message format string uses
``%(<dictionary key>)s`` styled string substitution; the possible keys are
documented in :ref:`logrecord-attributes`. If the style... | on at the end. The ``style`` is one of ``'%'``, ``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be used.
If the ``style`` is ``'%'``, the message format string uses
``%(<dictionary key>)s`` styled string substitution; the possible keys are
documented in :ref:`logrecord-attributes`. If the style... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd407a7c-5198-4d03-9426-f43934bfa503 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,856 | supabase-export-v2 | 887718772a40077d | To log variable data, use a format string for the event description message and append the variable data as arguments. For example::
import logging
logging.warning('%s before you %s', 'Look', 'leap!') | trusted_official_docs | CPython Docs | To log variable data, use a format string for the event description message and append the variable data as arguments. For example::
import logging
logging.warning('%s before you %s', 'Look', 'leap!') | To log variable data, use a format string for the event description message and append the variable data as arguments. For example::
import logging
logging.warning('%s before you %s', 'Look', 'leap!') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e11789fa-b1e5-4337-bb4d-d46520f5f0c5 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,822 | supabase-export-v2 | c7c4be84e43c7047 | in a long-running | :meth:`~Logger.critical` method as | | server process) | appropriate for the specific error | | | and application domain | +-------------------------------------+--------------------------------------+
The logger methods are named after the level or severity of the events
they are used to track. The... | trusted_official_docs | CPython Docs | in a long-running | :meth:`~Logger.critical` method as | | server process) | appropriate for the specific error | | | and application domain | +-------------------------------------+--------------------------------------+
The logger methods are named after the level or severity of the events
they are used to track. The... | in a long-running | :meth:`~Logger.critical` method as | | server process) | appropriate for the specific error | | | and application domain | +-------------------------------------+--------------------------------------+
The logger methods are named after the level or severity of the events
they are used to track. The... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e189c1c6-fbc2-4113-916f-dacb18bb869e | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,006 | supabase-export-v2 | e6f678cdc8b81a12 | dispatch the message (unless the *propagate* flag for a logger is set to a false value, at which point the passing to ancestor handlers stops).
Just as for loggers, handlers can have levels associated with them. A handler's
level acts as a filter in the same way as a logger's level does. If a handler
decides to actuall... | trusted_official_docs | CPython Docs | dispatch the message (unless the *propagate* flag for a logger is set to a false value, at which point the passing to ancestor handlers stops).
Just as for loggers, handlers can have levels associated with them. A handler's
level acts as a filter in the same way as a logger's level does. If a handler
decides to actuall... | dispatch the message (unless the *propagate* flag for a logger is set to a false value, at which point the passing to ancestor handlers stops).
Just as for loggers, handlers can have levels associated with them. A handler's
level acts as a filter in the same way as a logger's level does. If a handler
decides to actuall... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e372e97d-81e1-46e4-85a3-56c8025b0709 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,872 | supabase-export-v2 | dc2efc1ffb6427ee | 2010-12-12 11:41:42,612 is when this event was logged.
The default format for date/time display (shown above) is like ISO8601 or
:rfc:`3339`. If you need more control over the formatting of the date/time, provide
a *datefmt* argument to ``basicConfig``, as in this example:: | trusted_official_docs | CPython Docs | 2010-12-12 11:41:42,612 is when this event was logged.
The default format for date/time display (shown above) is like ISO8601 or
:rfc:`3339`. If you need more control over the formatting of the date/time, provide
a *datefmt* argument to ``basicConfig``, as in this example:: | 2010-12-12 11:41:42,612 is when this event was logged.
The default format for date/time display (shown above) is like ISO8601 or
:rfc:`3339`. If you need more control over the formatting of the date/time, provide
a *datefmt* argument to ``basicConfig``, as in this example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ecb0b958-75e5-4429-92a5-59267d02abba | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,836 | supabase-export-v2 | d24c8eab4359dce9 | to control the logging configuration explicitly however - so for that reason as well as others, it's better to create loggers and call their methods.
Logging to a file
^^^^^^^^^^^^^^^^^ | trusted_official_docs | CPython Docs | to control the logging configuration explicitly however - so for that reason as well as others, it's better to create loggers and call their methods.
Logging to a file
^^^^^^^^^^^^^^^^^ | to control the logging configuration explicitly however - so for that reason as well as others, it's better to create loggers and call their methods.
Logging to a file
^^^^^^^^^^^^^^^^^ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f040d898-be83-4c40-88a4-acfa54e3ff06 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,024 | supabase-export-v2 | 4f7a5fd167a40f4e | #. :class:`~handlers.HTTPHandler` instances send messages to an HTTP server using either ``GET`` or ``POST`` semantics.
#. :class:`~handlers.WatchedFileHandler` instances watch the file they are
logging to. If the file changes, it is closed and reopened using the file
name. This handler is only useful on Unix-like sy... | trusted_official_docs | CPython Docs | #. :class:`~handlers.HTTPHandler` instances send messages to an HTTP server using either ``GET`` or ``POST`` semantics.
#. :class:`~handlers.WatchedFileHandler` instances watch the file they are
logging to. If the file changes, it is closed and reopened using the file
name. This handler is only useful on Unix-like sy... | #. :class:`~handlers.HTTPHandler` instances send messages to an HTTP server using either ``GET`` or ``POST`` semantics.
#. :class:`~handlers.WatchedFileHandler` instances watch the file they are
logging to. If the file changes, it is closed and reopened using the file
name. This handler is only useful on Unix-like sy... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f0db3737-b6c5-40f3-aaa5-3ab7d3515daf | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,977 | supabase-export-v2 | 87cdd27b30084efc | to the logging module) or ``mypackage.mymodule.MyHandler`` (for a class defined in package ``mypackage`` and module ``mymodule``, where ``mypackage`` is available on the Python import path).
In Python 3.2, a new means of configuring logging has been introduced, using
dictionaries to hold configuration information. This... | trusted_official_docs | CPython Docs | to the logging module) or ``mypackage.mymodule.MyHandler`` (for a class defined in package ``mypackage`` and module ``mymodule``, where ``mypackage`` is available on the Python import path).
In Python 3.2, a new means of configuring logging has been introduced, using
dictionaries to hold configuration information. This... | to the logging module) or ``mypackage.mymodule.MyHandler`` (for a class defined in package ``mypackage`` and module ``mymodule``, where ``mypackage`` is available on the Python import path).
In Python 3.2, a new means of configuring logging has been introduced, using
dictionaries to hold configuration information. This... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1930fbb-d287-4519-9603-99f977fb82e6 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,893 | supabase-export-v2 | 3be8f22f0f2ece54 | by :dfn:`handler` classes. You can create your own log destination class if you have special requirements not met by any of the built-in handler classes.
By default, no destination is set for any logging messages. You can specify
a destination (such as console or file) by using :func:`basicConfig` as in the
tutorial ex... | trusted_official_docs | CPython Docs | by :dfn:`handler` classes. You can create your own log destination class if you have special requirements not met by any of the built-in handler classes.
By default, no destination is set for any logging messages. You can specify
a destination (such as console or file) by using :func:`basicConfig` as in the
tutorial ex... | by :dfn:`handler` classes. You can create your own log destination class if you have special requirements not met by any of the built-in handler classes.
By default, no destination is set for any logging messages. You can specify
a destination (such as console or file) by using :func:`basicConfig` as in the
tutorial ex... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f2462d68-98cf-4698-b599-bb733b1805d7 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,974 | supabase-export-v2 | 9b5cb208e8c5522c | ancestor) are explicitly named in the configuration. Please refer to the reference documentation for more information, and specify ``False`` for this parameter if you wish.
The dictionary passed to :func:`dictConfig` can also specify a Boolean
value with key ``disable_existing_loggers``, which if not specified
explic... | trusted_official_docs | CPython Docs | ancestor) are explicitly named in the configuration. Please refer to the reference documentation for more information, and specify ``False`` for this parameter if you wish.
The dictionary passed to :func:`dictConfig` can also specify a Boolean
value with key ``disable_existing_loggers``, which if not specified
explic... | ancestor) are explicitly named in the configuration. Please refer to the reference documentation for more information, and specify ``False`` for this parameter if you wish.
The dictionary passed to :func:`dictConfig` can also specify a Boolean
value with key ``disable_existing_loggers``, which if not specified
explic... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6617642-1efe-41c3-b9a2-98779da988a5 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,048 | supabase-export-v2 | 53e46e6bcf89eeee | so that if the logger's threshold is set above ``DEBUG``, the calls to ``expensive_func1`` and ``expensive_func2`` are never made.
.. note:: In some cases, :meth:`~Logger.isEnabledFor` can itself be more
expensive than you'd like (e.g. for deeply nested loggers where an explicit
level is only set high up in the logge... | trusted_official_docs | CPython Docs | so that if the logger's threshold is set above ``DEBUG``, the calls to ``expensive_func1`` and ``expensive_func2`` are never made.
.. note:: In some cases, :meth:`~Logger.isEnabledFor` can itself be more
expensive than you'd like (e.g. for deeply nested loggers where an explicit
level is only set high up in the logge... | so that if the logger's threshold is set above ``DEBUG``, the calls to ``expensive_func1`` and ``expensive_func2`` are never made.
.. note:: In some cases, :meth:`~Logger.isEnabledFor` can itself be more
expensive than you'd like (e.g. for deeply nested loggers where an explicit
level is only set high up in the logge... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fa7bdd82-d92e-4bd6-b316-79239da3e27e | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,905 | supabase-export-v2 | 94dd5910150f7028 | elem.classList.remove('dark-theme'); elem.classList.remove('light-theme'); if (theme === 'dark') { elem.classList.add('dark-theme'); } else if (theme === 'light') { elem.classList.add('light-theme'); } }
activateTheme = function(theme) {
oldActivateTheme(theme);
updateBody(theme);
};
/*
* If the page is refreshed,... | trusted_official_docs | CPython Docs | elem.classList.remove('dark-theme'); elem.classList.remove('light-theme'); if (theme === 'dark') { elem.classList.add('dark-theme'); } else if (theme === 'light') { elem.classList.add('light-theme'); } }
activateTheme = function(theme) {
oldActivateTheme(theme);
updateBody(theme);
};
/*
* If the page is refreshed,... | elem.classList.remove('dark-theme'); elem.classList.remove('light-theme'); if (theme === 'dark') { elem.classList.add('dark-theme'); } else if (theme === 'light') { elem.classList.add('light-theme'); } }
activateTheme = function(theme) {
oldActivateTheme(theme);
updateBody(theme);
};
/*
* If the page is refreshed,... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc553a5c-18cf-46ca-9e18-4d348e16cf33 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,881 | supabase-export-v2 | e99fde0203094cb6 | don't understand something, please post a question in the Help category of the `Python discussion forum <https://discuss.python.org/c/help/7>`_ and you should receive help before too long.
Still here? You can carry on reading the next few sections, which provide a
slightly more advanced/in-depth tutorial than the basic... | trusted_official_docs | CPython Docs | don't understand something, please post a question in the Help category of the `Python discussion forum <https://discuss.python.org/c/help/7>`_ and you should receive help before too long.
Still here? You can carry on reading the next few sections, which provide a
slightly more advanced/in-depth tutorial than the basic... | don't understand something, please post a question in the Help category of the `Python discussion forum <https://discuss.python.org/c/help/7>`_ and you should receive help before too long.
Still here? You can carry on reading the next few sections, which provide a
slightly more advanced/in-depth tutorial than the basic... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fca180ce-bc43-443d-9016-5a904602d72b | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 58,820 | supabase-export-v2 | 93d444c53b1a5e26 | | | program | | +-------------------------------------+--------------------------------------+ | Report events that occur during | A logger's :meth:`~Logger.info` (or | | normal operation of a program (e.g.
| :meth:`~Logger.debug` method for very|
| for status monitoring or fault | detailed output for diagnostic |
| in... | trusted_official_docs | CPython Docs | | | program | | +-------------------------------------+--------------------------------------+ | Report events that occur during | A logger's :meth:`~Logger.info` (or | | normal operation of a program (e.g.
| :meth:`~Logger.debug` method for very|
| for status monitoring or fault | detailed output for diagnostic |
| in... | | | program | | +-------------------------------------+--------------------------------------+ | Report events that occur during | A logger's :meth:`~Logger.info` (or | | normal operation of a program (e.g.
| :meth:`~Logger.debug` method for very|
| for status monitoring or fault | detailed output for diagnostic |
| in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fcf0428a-f939-49ec-8704-0f8bdf408822 | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,018 | supabase-export-v2 | 4391641c7acd20d9 | #. :class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. Since 3.4, Unix domain sockets are also supported.
#. :class:`~handlers.DatagramHandler` instances send messages to UDP
sockets. Since 3.4, Unix domain sockets are also supported. | trusted_official_docs | CPython Docs | #. :class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. Since 3.4, Unix domain sockets are also supported.
#. :class:`~handlers.DatagramHandler` instances send messages to UDP
sockets. Since 3.4, Unix domain sockets are also supported. | #. :class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. Since 3.4, Unix domain sockets are also supported.
#. :class:`~handlers.DatagramHandler` instances send messages to UDP
sockets. Since 3.4, Unix domain sockets are also supported. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fd1f3103-647a-4069-b463-df66b67dabec | CPython Docs | file://datasets/cpython/Doc/howto/logging.rst | unknown | 8d832e9f-2a60-4904-9a27-2cce1f85641f | 59,023 | supabase-export-v2 | 6c96a58f4cee83d2 | #. :class:`~handlers.MemoryHandler` instances send messages to a buffer in memory, which is flushed whenever specific criteria are met.
#. :class:`~handlers.HTTPHandler` instances send messages to an HTTP
server using either ``GET`` or ``POST`` semantics. | trusted_official_docs | CPython Docs | #. :class:`~handlers.MemoryHandler` instances send messages to a buffer in memory, which is flushed whenever specific criteria are met.
#. :class:`~handlers.HTTPHandler` instances send messages to an HTTP
server using either ``GET`` or ``POST`` semantics. | #. :class:`~handlers.MemoryHandler` instances send messages to a buffer in memory, which is flushed whenever specific criteria are met.
#. :class:`~handlers.HTTPHandler` instances send messages to an HTTP
server using either ``GET`` or ``POST`` semantics. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02e1d00c-3ad5-4cfd-91eb-8590e960cdd9 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,118 | supabase-export-v2 | e9536c13bd280c29 | :mod:`socket`) usually won't accept objects from this module directly. Instead, they must be coerced to an integer or string that the other module will accept::
>>> addr4 = ipaddress.ip_address('192.0.2.1')
>>> str(addr4)
'192.0.2.1'
>>> int(addr4)
3221225985 | trusted_official_docs | CPython Docs | :mod:`socket`) usually won't accept objects from this module directly. Instead, they must be coerced to an integer or string that the other module will accept::
>>> addr4 = ipaddress.ip_address('192.0.2.1')
>>> str(addr4)
'192.0.2.1'
>>> int(addr4)
3221225985 | :mod:`socket`) usually won't accept objects from this module directly. Instead, they must be coerced to an integer or string that the other module will accept::
>>> addr4 = ipaddress.ip_address('192.0.2.1')
>>> str(addr4)
'192.0.2.1'
>>> int(addr4)
3221225985 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02ec7505-7179-4d5b-a232-41bdef168f34 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,080 | supabase-export-v2 | 899065c711be0743 | >>> ipaddress.ip_network('192.0.2.0/24') IPv4Network('192.0.2.0/24') >>> ipaddress.ip_network('2001:db8::0/96') IPv6Network('2001:db8::/96')
Network objects cannot have any host bits set. The practical effect of this
is that ``192.0.2.1/24`` does not describe a network. Such definitions are
referred to as interface obj... | trusted_official_docs | CPython Docs | >>> ipaddress.ip_network('192.0.2.0/24') IPv4Network('192.0.2.0/24') >>> ipaddress.ip_network('2001:db8::0/96') IPv6Network('2001:db8::/96')
Network objects cannot have any host bits set. The practical effect of this
is that ``192.0.2.1/24`` does not describe a network. Such definitions are
referred to as interface obj... | >>> ipaddress.ip_network('192.0.2.0/24') IPv4Network('192.0.2.0/24') >>> ipaddress.ip_network('2001:db8::0/96') IPv6Network('2001:db8::/96')
Network objects cannot have any host bits set. The practical effect of this
is that ``192.0.2.1/24`` does not describe a network. Such definitions are
referred to as interface obj... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0343a1b1-4cb8-4741-9790-8c313b16676c | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,126 | supabase-export-v2 | 1cb9cd0438468db9 | have :exc:`ValueError` as their parent class, so if you're not concerned with the particular type of error, you can still write code like the following::
try:
network = ipaddress.IPv4Network(address)
except ValueError:
print('address/netmask is invalid for IPv4:', address) | trusted_official_docs | CPython Docs | have :exc:`ValueError` as their parent class, so if you're not concerned with the particular type of error, you can still write code like the following::
try:
network = ipaddress.IPv4Network(address)
except ValueError:
print('address/netmask is invalid for IPv4:', address) | have :exc:`ValueError` as their parent class, so if you're not concerned with the particular type of error, you can still write code like the following::
try:
network = ipaddress.IPv4Network(address)
except ValueError:
print('address/netmask is invalid for IPv4:', address) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
06c40c21-bb09-46e4-a5f2-a0940a309a4f | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,087 | supabase-export-v2 | d8e25cc0d2a949e8 | Host Interfaces ---------------
As mentioned just above, if you need to describe an address on a particular
network, neither the address nor the network classes are sufficient. Notation like ``192.0.2.1/24`` is commonly used by network engineers and the
people who write tools for firewalls and routers as shorthand for ... | trusted_official_docs | CPython Docs | Host Interfaces ---------------
As mentioned just above, if you need to describe an address on a particular
network, neither the address nor the network classes are sufficient. Notation like ``192.0.2.1/24`` is commonly used by network engineers and the
people who write tools for firewalls and routers as shorthand for ... | Host Interfaces ---------------
As mentioned just above, if you need to describe an address on a particular
network, neither the address nor the network classes are sufficient. Notation like ``192.0.2.1/24`` is commonly used by network engineers and the
people who write tools for firewalls and routers as shorthand for ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0fbc6977-002f-4ba5-a3ef-53ee0d0c5207 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,100 | supabase-export-v2 | a11ef16a540283e2 | >>> net4 = ipaddress.ip_network('192.0.2.0/24') >>> for x in net4.hosts(): ... print(x) # doctest: +ELLIPSIS 192.0.2.1 192.0.2.2 192.0.2.3 192.0.2.4 ... 192.0.2.252 192.0.2.253 192.0.2.254
Obtaining the netmask (i.e. set bits corresponding to the network prefix) or
the hostmask (any bits that are not part of the netmas... | trusted_official_docs | CPython Docs | >>> net4 = ipaddress.ip_network('192.0.2.0/24') >>> for x in net4.hosts(): ... print(x) # doctest: +ELLIPSIS 192.0.2.1 192.0.2.2 192.0.2.3 192.0.2.4 ... 192.0.2.252 192.0.2.253 192.0.2.254
Obtaining the netmask (i.e. set bits corresponding to the network prefix) or
the hostmask (any bits that are not part of the netmas... | >>> net4 = ipaddress.ip_network('192.0.2.0/24') >>> for x in net4.hosts(): ... print(x) # doctest: +ELLIPSIS 192.0.2.1 192.0.2.2 192.0.2.3 192.0.2.4 ... 192.0.2.252 192.0.2.253 192.0.2.254
Obtaining the netmask (i.e. set bits corresponding to the network prefix) or
the hostmask (any bits that are not part of the netmas... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1fa9a5f8-ca91-4553-8478-17250d982f6b | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,117 | supabase-export-v2 | eddfc5d31ebb49bd | Using IP Addresses with other modules =====================================
Other modules that use IP addresses (such as :mod:`socket`) usually won't
accept objects from this module directly. Instead, they must be coerced to
an integer or string that the other module will accept:: | trusted_official_docs | CPython Docs | Using IP Addresses with other modules =====================================
Other modules that use IP addresses (such as :mod:`socket`) usually won't
accept objects from this module directly. Instead, they must be coerced to
an integer or string that the other module will accept:: | Using IP Addresses with other modules =====================================
Other modules that use IP addresses (such as :mod:`socket`) usually won't
accept objects from this module directly. Instead, they must be coerced to
an integer or string that the other module will accept:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2a940482-f903-410d-a697-b87418fb9442 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,120 | supabase-export-v2 | c3204bf8c79ba5b0 | Getting more detail when instance creation fails ================================================
When creating address/network/interface objects using the version-agnostic
factory functions, any errors will be reported as :exc:`ValueError` with
a generic error message that simply says the passed in value was not
recog... | trusted_official_docs | CPython Docs | Getting more detail when instance creation fails ================================================
When creating address/network/interface objects using the version-agnostic
factory functions, any errors will be reported as :exc:`ValueError` with
a generic error message that simply says the passed in value was not
recog... | Getting more detail when instance creation fails ================================================
When creating address/network/interface objects using the version-agnostic
factory functions, any errors will be reported as :exc:`ValueError` with
a generic error message that simply says the passed in value was not
recog... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b9ebb86-7fb6-40c5-87bc-bb7b937a9a79 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,068 | supabase-export-v2 | 894a181f909aa06f | doesn't provide enough addresses to handle the needs of the whole world, especially given the increasing number of devices with direct connections to the internet.
Explaining the details of the differences between the two versions of the
protocol is beyond the scope of this introduction, but readers need to at
least be... | trusted_official_docs | CPython Docs | doesn't provide enough addresses to handle the needs of the whole world, especially given the increasing number of devices with direct connections to the internet.
Explaining the details of the differences between the two versions of the
protocol is beyond the scope of this introduction, but readers need to at
least be... | doesn't provide enough addresses to handle the needs of the whole world, especially given the increasing number of devices with direct connections to the internet.
Explaining the details of the differences between the two versions of the
protocol is beyond the scope of this introduction, but readers need to at
least be... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
304e0851-3297-42c2-bcbf-351e6a8eccc2 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,070 | supabase-export-v2 | 236550464d822d24 | IP Host Addresses -----------------
Addresses, often referred to as "host addresses" are the most basic unit
when working with IP addressing. The simplest way to create addresses is
to use the :func:`ipaddress.ip_address` factory function, which automatically
determines whether to create an IPv4 or IPv6 address based o... | trusted_official_docs | CPython Docs | IP Host Addresses -----------------
Addresses, often referred to as "host addresses" are the most basic unit
when working with IP addressing. The simplest way to create addresses is
to use the :func:`ipaddress.ip_address` factory function, which automatically
determines whether to create an IPv4 or IPv6 address based o... | IP Host Addresses -----------------
Addresses, often referred to as "host addresses" are the most basic unit
when working with IP addressing. The simplest way to create addresses is
to use the :func:`ipaddress.ip_address` factory function, which automatically
determines whether to create an IPv4 or IPv6 address based o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c62167b-deae-4cba-92d1-6b5d6e249722 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,078 | supabase-export-v2 | 5640ef18b063287e | are compared to determine whether or not an address is part of the network and the network address defines the expected value of those bits.
As for addresses, a factory function is provided that determines the correct
IP version automatically:: | trusted_official_docs | CPython Docs | are compared to determine whether or not an address is part of the network and the network address defines the expected value of those bits.
As for addresses, a factory function is provided that determines the correct
IP version automatically:: | are compared to determine whether or not an address is part of the network and the network address defines the expected value of those bits.
As for addresses, a factory function is provided that determines the correct
IP version automatically:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
40138a49-aced-49cd-a798-1847db4b8619 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,084 | supabase-export-v2 | 18f5dfc795d25a1a | this case, the network is considered to contain only the single address identified by the integer, so the network prefix includes the entire network address::
>>> ipaddress.ip_network(3221225984)
IPv4Network('192.0.2.0/32')
>>> ipaddress.ip_network(42540766411282592856903984951653826560)
IPv6Network('2001:db8::/128'... | trusted_official_docs | CPython Docs | this case, the network is considered to contain only the single address identified by the integer, so the network prefix includes the entire network address::
>>> ipaddress.ip_network(3221225984)
IPv4Network('192.0.2.0/32')
>>> ipaddress.ip_network(42540766411282592856903984951653826560)
IPv6Network('2001:db8::/128'... | this case, the network is considered to contain only the single address identified by the integer, so the network prefix includes the entire network address::
>>> ipaddress.ip_network(3221225984)
IPv4Network('192.0.2.0/32')
>>> ipaddress.ip_network(42540766411282592856903984951653826560)
IPv6Network('2001:db8::/128'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47834a69-5fff-44cc-9c51-b448a19c583e | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,088 | supabase-export-v2 | 31b48a1e512db3ee | network. The interface for creation is identical to that for defining network objects, except that the address portion isn't constrained to being a network address.
>>> ipaddress.ip_interface('192.0.2.1/24')
IPv4Interface('192.0.2.1/24')
>>> ipaddress.ip_interface('2001:db8::1/96')
IPv6Interface('2001:db8::1/96') | trusted_official_docs | CPython Docs | network. The interface for creation is identical to that for defining network objects, except that the address portion isn't constrained to being a network address.
>>> ipaddress.ip_interface('192.0.2.1/24')
IPv4Interface('192.0.2.1/24')
>>> ipaddress.ip_interface('2001:db8::1/96')
IPv6Interface('2001:db8::1/96') | network. The interface for creation is identical to that for defining network objects, except that the address portion isn't constrained to being a network address.
>>> ipaddress.ip_interface('192.0.2.1/24')
IPv4Interface('192.0.2.1/24')
>>> ipaddress.ip_interface('2001:db8::1/96')
IPv6Interface('2001:db8::1/96') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4871c1f2-18a3-4021-bf78-627743e841cc | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,063 | supabase-export-v2 | aa2e86bdcca9e07a | .. topic:: Overview
This document aims to provide a gentle introduction to the
:mod:`ipaddress` module. It is aimed primarily at users that aren't
already familiar with IP networking terminology, but may also be useful
to network engineers wanting an overview of how :mod:`ipaddress`
represents IP network addressing... | trusted_official_docs | CPython Docs | .. topic:: Overview
This document aims to provide a gentle introduction to the
:mod:`ipaddress` module. It is aimed primarily at users that aren't
already familiar with IP networking terminology, but may also be useful
to network engineers wanting an overview of how :mod:`ipaddress`
represents IP network addressing... | .. topic:: Overview
This document aims to provide a gentle introduction to the
:mod:`ipaddress` module. It is aimed primarily at users that aren't
already familiar with IP networking terminology, but may also be useful
to network engineers wanting an overview of how :mod:`ipaddress`
represents IP network addressing... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5a714ed8-b307-4b5a-b460-118a6bb48269 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,124 | supabase-export-v2 | f99dcc5a133801b2 | appear to be an IPv4 or IPv6 address >>> ipaddress.IPv4Address("192.168.0.256") Traceback (most recent call last): ... ipaddress.AddressValueError: Octet 256 (> 255) not permitted in '192.168.0.256'
>>> ipaddress.ip_network("192.168.0.1/64")
Traceback (most recent call last):
... ValueError: '192.168.0.1/64' does not... | trusted_official_docs | CPython Docs | appear to be an IPv4 or IPv6 address >>> ipaddress.IPv4Address("192.168.0.256") Traceback (most recent call last): ... ipaddress.AddressValueError: Octet 256 (> 255) not permitted in '192.168.0.256'
>>> ipaddress.ip_network("192.168.0.1/64")
Traceback (most recent call last):
... ValueError: '192.168.0.1/64' does not... | appear to be an IPv4 or IPv6 address >>> ipaddress.IPv4Address("192.168.0.256") Traceback (most recent call last): ... ipaddress.AddressValueError: Octet 256 (> 255) not permitted in '192.168.0.256'
>>> ipaddress.ip_network("192.168.0.1/64")
Traceback (most recent call last):
... ValueError: '192.168.0.1/64' does not... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5c1dabe1-c14f-42ba-b388-3c5eac4eedf1 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,085 | supabase-export-v2 | 2bb2f097d12290de | >>> ipaddress.ip_network(3221225984) IPv4Network('192.0.2.0/32') >>> ipaddress.ip_network(42540766411282592856903984951653826560) IPv6Network('2001:db8::/128')
As with addresses, creation of a particular kind of network can be forced
by calling the class constructor directly instead of using the factory
function. | trusted_official_docs | CPython Docs | >>> ipaddress.ip_network(3221225984) IPv4Network('192.0.2.0/32') >>> ipaddress.ip_network(42540766411282592856903984951653826560) IPv6Network('2001:db8::/128')
As with addresses, creation of a particular kind of network can be forced
by calling the class constructor directly instead of using the factory
function. | >>> ipaddress.ip_network(3221225984) IPv4Network('192.0.2.0/32') >>> ipaddress.ip_network(42540766411282592856903984951653826560) IPv6Network('2001:db8::/128')
As with addresses, creation of a particular kind of network can be forced
by calling the class constructor directly instead of using the factory
function. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e35790b-7f5c-4d4d-94ac-25cd9d1d024a | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,081 | supabase-export-v2 | b90cb6d7971b1e04 | the ip-on-a-network notation is commonly used to describe network interfaces of a computer on a given network and are described further in the next section.
By default, attempting to create a network object with host bits set will
result in :exc:`ValueError` being raised. To request that the
additional bits instead be ... | trusted_official_docs | CPython Docs | the ip-on-a-network notation is commonly used to describe network interfaces of a computer on a given network and are described further in the next section.
By default, attempting to create a network object with host bits set will
result in :exc:`ValueError` being raised. To request that the
additional bits instead be ... | the ip-on-a-network notation is commonly used to describe network interfaces of a computer on a given network and are described further in the next section.
By default, attempting to create a network object with host bits set will
result in :exc:`ValueError` being raised. To request that the
additional bits instead be ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
65bef649-736e-48a1-be4c-2bed834b036f | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,123 | supabase-export-v2 | d074e1daa393005d | The error messages are significantly more detailed when using the class constructors directly. For example::
>>> ipaddress.ip_address("192.168.0.256")
Traceback (most recent call last):
... ValueError: '192.168.0.256' does not appear to be an IPv4 or IPv6 address
>>> ipaddress.IPv4Address("192.168.0.256")
Traceback... | trusted_official_docs | CPython Docs | The error messages are significantly more detailed when using the class constructors directly. For example::
>>> ipaddress.ip_address("192.168.0.256")
Traceback (most recent call last):
... ValueError: '192.168.0.256' does not appear to be an IPv4 or IPv6 address
>>> ipaddress.IPv4Address("192.168.0.256")
Traceback... | The error messages are significantly more detailed when using the class constructors directly. For example::
>>> ipaddress.ip_address("192.168.0.256")
Traceback (most recent call last):
... ValueError: '192.168.0.256' does not appear to be an IPv4 or IPv6 address
>>> ipaddress.IPv4Address("192.168.0.256")
Traceback... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
691e5975-d125-40bb-9d4b-81c072313e29 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,075 | supabase-export-v2 | d293a3abffaab029 | of IPv4 or IPv6 addresses, the relevant classes can be invoked directly. This is particularly useful to force creation of IPv6 addresses for small integers::
>>> ipaddress.ip_address(1)
IPv4Address('0.0.0.1')
>>> ipaddress.IPv4Address(1)
IPv4Address('0.0.0.1')
>>> ipaddress.IPv6Address(1)
IPv6Address('::1') | trusted_official_docs | CPython Docs | of IPv4 or IPv6 addresses, the relevant classes can be invoked directly. This is particularly useful to force creation of IPv6 addresses for small integers::
>>> ipaddress.ip_address(1)
IPv4Address('0.0.0.1')
>>> ipaddress.IPv4Address(1)
IPv4Address('0.0.0.1')
>>> ipaddress.IPv6Address(1)
IPv6Address('::1') | of IPv4 or IPv6 addresses, the relevant classes can be invoked directly. This is particularly useful to force creation of IPv6 addresses for small integers::
>>> ipaddress.ip_address(1)
IPv4Address('0.0.0.1')
>>> ipaddress.IPv4Address(1)
IPv4Address('0.0.0.1')
>>> ipaddress.IPv6Address(1)
IPv6Address('::1') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6cd110b3-c000-4ab3-9d9b-4d80742e80c8 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,125 | supabase-export-v2 | 81a30ee66baa7b6b | does not appear to be an IPv4 or IPv6 network >>> ipaddress.IPv4Network("192.168.0.1/64") Traceback (most recent call last): ... ipaddress.NetmaskValueError: '64' is not a valid netmask
However, both of the module specific exceptions have :exc:`ValueError` as their
parent class, so if you're not concerned with the part... | trusted_official_docs | CPython Docs | does not appear to be an IPv4 or IPv6 network >>> ipaddress.IPv4Network("192.168.0.1/64") Traceback (most recent call last): ... ipaddress.NetmaskValueError: '64' is not a valid netmask
However, both of the module specific exceptions have :exc:`ValueError` as their
parent class, so if you're not concerned with the part... | does not appear to be an IPv4 or IPv6 network >>> ipaddress.IPv4Network("192.168.0.1/64") Traceback (most recent call last): ... ipaddress.NetmaskValueError: '64' is not a valid netmask
However, both of the module specific exceptions have :exc:`ValueError` as their
parent class, so if you're not concerned with the part... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
74796581-e814-4ef1-8c61-ce5b3595dc89 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,065 | supabase-export-v2 | 23d15e1ad5e8e04a | Creating Address/Network/Interface objects ==========================================
Since :mod:`ipaddress` is a module for inspecting and manipulating IP addresses,
the first thing you'll want to do is create some objects. You can use
:mod:`ipaddress` to create objects from strings and integers. | trusted_official_docs | CPython Docs | Creating Address/Network/Interface objects ==========================================
Since :mod:`ipaddress` is a module for inspecting and manipulating IP addresses,
the first thing you'll want to do is create some objects. You can use
:mod:`ipaddress` to create objects from strings and integers. | Creating Address/Network/Interface objects ==========================================
Since :mod:`ipaddress` is a module for inspecting and manipulating IP addresses,
the first thing you'll want to do is create some objects. You can use
:mod:`ipaddress` to create objects from strings and integers. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7d1140bd-5546-4b25-9280-1203a9febf8a | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,067 | supabase-export-v2 | 27f58800467bd268 | A Note on IP Versions ---------------------
For readers that aren't particularly familiar with IP addressing, it's
important to know that the Internet Protocol (IP) is currently in the process
of moving from version 4 of the protocol to version 6. This transition is
occurring largely because version 4 of the protocol d... | trusted_official_docs | CPython Docs | A Note on IP Versions ---------------------
For readers that aren't particularly familiar with IP addressing, it's
important to know that the Internet Protocol (IP) is currently in the process
of moving from version 4 of the protocol to version 6. This transition is
occurring largely because version 4 of the protocol d... | A Note on IP Versions ---------------------
For readers that aren't particularly familiar with IP addressing, it's
important to know that the Internet Protocol (IP) is currently in the process
of moving from version 4 of the protocol to version 6. This transition is
occurring largely because version 4 of the protocol d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
872b3f15-5789-45e5-9451-3b10b479a167 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,101 | supabase-export-v2 | fd76cdaa08a5a918 | Obtaining the netmask (i.e. set bits corresponding to the network prefix) or the hostmask (any bits that are not part of the netmask):
>>> net4 = ipaddress.ip_network('192.0.2.0/24')
>>> net4.netmask
IPv4Address('255.255.255.0')
>>> net4.hostmask
IPv4Address('0.0.0.255')
>>> net6 = ipaddress.ip_network('2001:db8::... | trusted_official_docs | CPython Docs | Obtaining the netmask (i.e. set bits corresponding to the network prefix) or the hostmask (any bits that are not part of the netmask):
>>> net4 = ipaddress.ip_network('192.0.2.0/24')
>>> net4.netmask
IPv4Address('255.255.255.0')
>>> net4.hostmask
IPv4Address('0.0.0.255')
>>> net6 = ipaddress.ip_network('2001:db8::... | Obtaining the netmask (i.e. set bits corresponding to the network prefix) or the hostmask (any bits that are not part of the netmask):
>>> net4 = ipaddress.ip_network('192.0.2.0/24')
>>> net4.netmask
IPv4Address('255.255.255.0')
>>> net4.hostmask
IPv4Address('0.0.0.255')
>>> net6 = ipaddress.ip_network('2001:db8::... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8eafa70f-48e4-43bc-aa56-d0c338f0b6e2 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,071 | supabase-export-v2 | bd24ab13fb38195f | addresses is to use the :func:`ipaddress.ip_address` factory function, which automatically determines whether to create an IPv4 or IPv6 address based on the passed in value:
>>> ipaddress.ip_address('192.0.2.1')
IPv4Address('192.0.2.1')
>>> ipaddress.ip_address('2001:DB8::1')
IPv6Address('2001:db8::1') | trusted_official_docs | CPython Docs | addresses is to use the :func:`ipaddress.ip_address` factory function, which automatically determines whether to create an IPv4 or IPv6 address based on the passed in value:
>>> ipaddress.ip_address('192.0.2.1')
IPv4Address('192.0.2.1')
>>> ipaddress.ip_address('2001:DB8::1')
IPv6Address('2001:db8::1') | addresses is to use the :func:`ipaddress.ip_address` factory function, which automatically determines whether to create an IPv4 or IPv6 address based on the passed in value:
>>> ipaddress.ip_address('192.0.2.1')
IPv4Address('192.0.2.1')
>>> ipaddress.ip_address('2001:DB8::1')
IPv6Address('2001:db8::1') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90c00ba3-ae46-449b-8a15-f60cc3655452 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,121 | supabase-export-v2 | d70cdc9da7f11ed4 | necessary to know whether the value is *supposed* to be IPv4 or IPv6 in order to provide more detail on why it has been rejected.
To support use cases where it is useful to have access to this additional
detail, the individual class constructors actually raise the
:exc:`ValueError` subclasses :exc:`ipaddress.AddressVal... | trusted_official_docs | CPython Docs | necessary to know whether the value is *supposed* to be IPv4 or IPv6 in order to provide more detail on why it has been rejected.
To support use cases where it is useful to have access to this additional
detail, the individual class constructors actually raise the
:exc:`ValueError` subclasses :exc:`ipaddress.AddressVal... | necessary to know whether the value is *supposed* to be IPv4 or IPv6 in order to provide more detail on why it has been rejected.
To support use cases where it is useful to have access to this additional
detail, the individual class constructors actually raise the
:exc:`ValueError` subclasses :exc:`ipaddress.AddressVal... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
91b707a5-dc56-41ee-849a-57f3a3a2af77 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,107 | supabase-export-v2 | af59a55eb8462a9f | It's sometimes useful to treat networks as lists. This means it is possible to index them like this::
>>> net4[1]
IPv4Address('192.0.2.1')
>>> net4[-1]
IPv4Address('192.0.2.255')
>>> net6[1]
IPv6Address('2001:db8::1')
>>> net6[-1]
IPv6Address('2001:db8::ffff:ffff') | trusted_official_docs | CPython Docs | It's sometimes useful to treat networks as lists. This means it is possible to index them like this::
>>> net4[1]
IPv4Address('192.0.2.1')
>>> net4[-1]
IPv4Address('192.0.2.255')
>>> net6[1]
IPv6Address('2001:db8::1')
>>> net6[-1]
IPv6Address('2001:db8::ffff:ffff') | It's sometimes useful to treat networks as lists. This means it is possible to index them like this::
>>> net4[1]
IPv4Address('192.0.2.1')
>>> net4[-1]
IPv4Address('192.0.2.255')
>>> net6[1]
IPv6Address('2001:db8::1')
>>> net6[-1]
IPv6Address('2001:db8::ffff:ffff') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9dad163c-8cdf-447a-b1d8-69d5a719895f | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,105 | supabase-export-v2 | 29b675865eb17d3b | that version neutral code can easily ensure the most concise or most verbose form is used for IPv6 addresses while still correctly handling IPv4 addresses.
Networks as lists of Addresses
============================== | trusted_official_docs | CPython Docs | that version neutral code can easily ensure the most concise or most verbose form is used for IPv6 addresses while still correctly handling IPv4 addresses.
Networks as lists of Addresses
============================== | that version neutral code can easily ensure the most concise or most verbose form is used for IPv6 addresses while still correctly handling IPv4 addresses.
Networks as lists of Addresses
============================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a06eb05a-186d-4a68-9042-3abe0877f7e6 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,083 | supabase-export-v2 | f62a70050ea46793 | >>> ipaddress.ip_network('192.0.2.1/24') Traceback (most recent call last): ... ValueError: 192.0.2.1/24 has host bits set >>> ipaddress.ip_network('192.0.2.1/24', strict=False) IPv4Network('192.0.2.0/24')
While the string form offers significantly more flexibility, networks can
also be defined with integers, just like... | trusted_official_docs | CPython Docs | >>> ipaddress.ip_network('192.0.2.1/24') Traceback (most recent call last): ... ValueError: 192.0.2.1/24 has host bits set >>> ipaddress.ip_network('192.0.2.1/24', strict=False) IPv4Network('192.0.2.0/24')
While the string form offers significantly more flexibility, networks can
also be defined with integers, just like... | >>> ipaddress.ip_network('192.0.2.1/24') Traceback (most recent call last): ... ValueError: 192.0.2.1/24 has host bits set >>> ipaddress.ip_network('192.0.2.1/24', strict=False) IPv4Network('192.0.2.0/24')
While the string form offers significantly more flexibility, networks can
also be defined with integers, just like... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a63e908b-603e-4556-a5eb-d1c2d29fdf40 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,082 | supabase-export-v2 | a0e25cba4c62daa0 | result in :exc:`ValueError` being raised. To request that the additional bits instead be coerced to zero, the flag ``strict=False`` can be passed to the constructor::
>>> ipaddress.ip_network('192.0.2.1/24')
Traceback (most recent call last):
... ValueError: 192.0.2.1/24 has host bits set
>>> ipaddress.ip_network('1... | trusted_official_docs | CPython Docs | result in :exc:`ValueError` being raised. To request that the additional bits instead be coerced to zero, the flag ``strict=False`` can be passed to the constructor::
>>> ipaddress.ip_network('192.0.2.1/24')
Traceback (most recent call last):
... ValueError: 192.0.2.1/24 has host bits set
>>> ipaddress.ip_network('1... | result in :exc:`ValueError` being raised. To request that the additional bits instead be coerced to zero, the flag ``strict=False`` can be passed to the constructor::
>>> ipaddress.ip_network('192.0.2.1/24')
Traceback (most recent call last):
... ValueError: 192.0.2.1/24 has host bits set
>>> ipaddress.ip_network('1... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a77a5389-b402-4456-b62e-6ab326188882 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,104 | supabase-export-v2 | 296b86c8f65aa7ec | >>> addr6.exploded '2001:0db8:0000:0000:0000:0000:0000:0001' >>> addr6.compressed '2001:db8::1' >>> net6.exploded '2001:0db8:0000:0000:0000:0000:0000:0000/96' >>> net6.compressed '2001:db8::/96'
While IPv4 doesn't support explosion or compression, the associated objects
still provide the relevant properties so that ver... | trusted_official_docs | CPython Docs | >>> addr6.exploded '2001:0db8:0000:0000:0000:0000:0000:0001' >>> addr6.compressed '2001:db8::1' >>> net6.exploded '2001:0db8:0000:0000:0000:0000:0000:0000/96' >>> net6.compressed '2001:db8::/96'
While IPv4 doesn't support explosion or compression, the associated objects
still provide the relevant properties so that ver... | >>> addr6.exploded '2001:0db8:0000:0000:0000:0000:0000:0001' >>> addr6.compressed '2001:db8::1' >>> net6.exploded '2001:0db8:0000:0000:0000:0000:0000:0000/96' >>> net6.compressed '2001:db8::/96'
While IPv4 doesn't support explosion or compression, the associated objects
still provide the relevant properties so that ver... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ada6d6ea-45d3-44b4-bd92-0c562024fb6a | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,122 | supabase-export-v2 | d14d15fcf2d28ea3 | detail, the individual class constructors actually raise the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the definition failed to parse correctly.
The error messages are significantly more detailed when using the
class construc... | trusted_official_docs | CPython Docs | detail, the individual class constructors actually raise the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the definition failed to parse correctly.
The error messages are significantly more detailed when using the
class construc... | detail, the individual class constructors actually raise the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the definition failed to parse correctly.
The error messages are significantly more detailed when using the
class construc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d611730e-5851-46ac-a193-149fb6db7fd7 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,099 | supabase-export-v2 | ac590649d52e5961 | Iterating through the "usable" addresses on a network::
>>> net4 = ipaddress.ip_network('192.0.2.0/24')
>>> for x in net4.hosts():
... print(x) # doctest: +ELLIPSIS
192.0.2.1
192.0.2.2
192.0.2.3
192.0.2.4
... 192.0.2.252
192.0.2.253
192.0.2.254 | trusted_official_docs | CPython Docs | Iterating through the "usable" addresses on a network::
>>> net4 = ipaddress.ip_network('192.0.2.0/24')
>>> for x in net4.hosts():
... print(x) # doctest: +ELLIPSIS
192.0.2.1
192.0.2.2
192.0.2.3
192.0.2.4
... 192.0.2.252
192.0.2.253
192.0.2.254 | Iterating through the "usable" addresses on a network::
>>> net4 = ipaddress.ip_network('192.0.2.0/24')
>>> for x in net4.hosts():
... print(x) # doctest: +ELLIPSIS
192.0.2.1
192.0.2.2
192.0.2.3
192.0.2.4
... 192.0.2.252
192.0.2.253
192.0.2.254 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d6d90e1f-a4ae-4ddc-95d5-2e694d02c661 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,066 | supabase-export-v2 | f51db800f35f7e57 | manipulating IP addresses, the first thing you'll want to do is create some objects. You can use :mod:`ipaddress` to create objects from strings and integers.
A Note on IP Versions
--------------------- | trusted_official_docs | CPython Docs | manipulating IP addresses, the first thing you'll want to do is create some objects. You can use :mod:`ipaddress` to create objects from strings and integers.
A Note on IP Versions
--------------------- | manipulating IP addresses, the first thing you'll want to do is create some objects. You can use :mod:`ipaddress` to create objects from strings and integers.
A Note on IP Versions
--------------------- | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d927114f-3665-4922-a5d2-d40252641a3b | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,077 | supabase-export-v2 | 31712c2409a57675 | Defining Networks -----------------
Host addresses are usually grouped together into IP networks, so
:mod:`ipaddress` provides a way to create, inspect and manipulate network
definitions. IP network objects are constructed from strings that define the
range of host addresses that are part of that network. The simplest ... | trusted_official_docs | CPython Docs | Defining Networks -----------------
Host addresses are usually grouped together into IP networks, so
:mod:`ipaddress` provides a way to create, inspect and manipulate network
definitions. IP network objects are constructed from strings that define the
range of host addresses that are part of that network. The simplest ... | Defining Networks -----------------
Host addresses are usually grouped together into IP networks, so
:mod:`ipaddress` provides a way to create, inspect and manipulate network
definitions. IP network objects are constructed from strings that define the
range of host addresses that are part of that network. The simplest ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e6cecd9d-86eb-4b73-a8cd-5fd43e5e5af3 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,074 | supabase-export-v2 | 83ae4c8ddfca0ae7 | >>> ipaddress.ip_address(3221225985) IPv4Address('192.0.2.1') >>> ipaddress.ip_address(42540766411282592856903984951653826561) IPv6Address('2001:db8::1')
To force the use of IPv4 or IPv6 addresses, the relevant classes can be
invoked directly. This is particularly useful to force creation of IPv6
addresses for small in... | trusted_official_docs | CPython Docs | >>> ipaddress.ip_address(3221225985) IPv4Address('192.0.2.1') >>> ipaddress.ip_address(42540766411282592856903984951653826561) IPv6Address('2001:db8::1')
To force the use of IPv4 or IPv6 addresses, the relevant classes can be
invoked directly. This is particularly useful to force creation of IPv6
addresses for small in... | >>> ipaddress.ip_address(3221225985) IPv4Address('192.0.2.1') >>> ipaddress.ip_address(42540766411282592856903984951653826561) IPv6Address('2001:db8::1')
To force the use of IPv4 or IPv6 addresses, the relevant classes can be
invoked directly. This is particularly useful to force creation of IPv6
addresses for small in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f5a5132b-0576-4482-aba5-7aeaf6a8a477 | CPython Docs | file://datasets/cpython/Doc/howto/ipaddress.rst | unknown | c5560642-d809-4ec2-8f11-589e7d6a339c | 59,091 | supabase-export-v2 | 7e150277b26ace1e | Inspecting Address/Network/Interface Objects ============================================
You've gone to the trouble of creating an IPv(4|6)(Address|Network|Interface)
object, so you probably want to get information about it. :mod:`ipaddress`
tries to make doing this easy and intuitive. | trusted_official_docs | CPython Docs | Inspecting Address/Network/Interface Objects ============================================
You've gone to the trouble of creating an IPv(4|6)(Address|Network|Interface)
object, so you probably want to get information about it. :mod:`ipaddress`
tries to make doing this easy and intuitive. | Inspecting Address/Network/Interface Objects ============================================
You've gone to the trouble of creating an IPv(4|6)(Address|Network|Interface)
object, so you probably want to get information about it. :mod:`ipaddress`
tries to make doing this easy and intuitive. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0fef283c-9d4b-4dba-b035-d73a36818ded | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,142 | supabase-export-v2 | 7d6e302ab8443454 | socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # bind the socket to a public host, and a well-known port serversocket.bind((socket.gethostname(), 80)) # become a server socket serversocket.listen(5)
A couple things to notice: we used ``socket.gethostname()`` so that the socket
would be visible ... | trusted_official_docs | CPython Docs | socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # bind the socket to a public host, and a well-known port serversocket.bind((socket.gethostname(), 80)) # become a server socket serversocket.listen(5)
A couple things to notice: we used ``socket.gethostname()`` so that the socket
would be visible ... | socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # bind the socket to a public host, and a well-known port serversocket.bind((socket.gethostname(), 80)) # become a server socket serversocket.listen(5)
A couple things to notice: we used ``socket.gethostname()`` so that the socket
would be visible ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
109ee813-4fe9-4234-b384-3cc1210724c9 | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,138 | supabase-export-v2 | 8574a3e30c1db41a | Roughly speaking, when you clicked on the link that brought you to this page, your browser did something like the following::
# create an INET, STREAMing socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# now connect to the web server on port 80 - the normal http port
s.connect(("www.python.org", 80)) | trusted_official_docs | CPython Docs | Roughly speaking, when you clicked on the link that brought you to this page, your browser did something like the following::
# create an INET, STREAMing socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# now connect to the web server on port 80 - the normal http port
s.connect(("www.python.org", 80)) | Roughly speaking, when you clicked on the link that brought you to this page, your browser did something like the following::
# create an INET, STREAMing socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# now connect to the web server on port 80 - the normal http port
s.connect(("www.python.org", 80)) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13672389-bf6d-4539-aa9d-a85ad064ff3b | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,189 | supabase-export-v2 | 3befb89a5b23515d | but *something* is better than nothing. (Actually, any reasonably healthy socket will return as writable - it just means outbound network buffer space is available.)
If you have a "server" socket, put it in the potential_readers list. If it comes
out in the readable list, your ``accept`` will (almost certainly) work. I... | trusted_official_docs | CPython Docs | but *something* is better than nothing. (Actually, any reasonably healthy socket will return as writable - it just means outbound network buffer space is available.)
If you have a "server" socket, put it in the potential_readers list. If it comes
out in the readable list, your ``accept`` will (almost certainly) work. I... | but *something* is better than nothing. (Actually, any reasonably healthy socket will return as writable - it just means outbound network buffer space is available.)
If you have a "server" socket, put it in the potential_readers list. If it comes
out in the readable list, your ``accept`` will (almost certainly) work. I... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
188dc026-e668-4989-ac1a-ce6aacd8c421 | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,140 | supabase-export-v2 | 908693c343dddaf7 | the reply, and then be destroyed. That's right, destroyed. Client sockets are normally only used for one exchange (or a small set of sequential exchanges).
What happens in the web server is a bit more complex. First, the web server
creates a "server socket":: | trusted_official_docs | CPython Docs | the reply, and then be destroyed. That's right, destroyed. Client sockets are normally only used for one exchange (or a small set of sequential exchanges).
What happens in the web server is a bit more complex. First, the web server
creates a "server socket":: | the reply, and then be destroyed. That's right, destroyed. Client sockets are normally only used for one exchange (or a small set of sequential exchanges).
What happens in the web server is a bit more complex. First, the web server
creates a "server socket":: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
22828e37-70d8-4d67-b85c-ba6c5d32449c | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,162 | supabase-export-v2 | 242860533eb27923 | def connect(self, host, port): self.sock.connect((host, port))
def mysend(self, msg):
totalsent = 0
while totalsent < MSGLEN:
sent = self.sock.send(msg[totalsent:])
if sent == 0:
raise RuntimeError("socket connection broken")
totalsent = totalsent + sent | trusted_official_docs | CPython Docs | def connect(self, host, port): self.sock.connect((host, port))
def mysend(self, msg):
totalsent = 0
while totalsent < MSGLEN:
sent = self.sock.send(msg[totalsent:])
if sent == 0:
raise RuntimeError("socket connection broken")
totalsent = totalsent + sent | def connect(self, host, port): self.sock.connect((host, port))
def mysend(self, msg):
totalsent = 0
while totalsent < MSGLEN:
sent = self.sock.send(msg[totalsent:])
if sent == 0:
raise RuntimeError("socket connection broken")
totalsent = totalsent + sent | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
228e2f94-4814-439c-8b25-656cf7499079 | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,134 | supabase-export-v2 | add04fcd02e433fc | History -------
Of the various forms of :abbr:`IPC (Inter Process Communication)`,
sockets are by far the most popular. On any given platform, there are
likely to be other forms of IPC that are faster, but for
cross-platform communication, sockets are about the only game in town. | trusted_official_docs | CPython Docs | History -------
Of the various forms of :abbr:`IPC (Inter Process Communication)`,
sockets are by far the most popular. On any given platform, there are
likely to be other forms of IPC that are faster, but for
cross-platform communication, sockets are about the only game in town. | History -------
Of the various forms of :abbr:`IPC (Inter Process Communication)`,
sockets are by far the most popular. On any given platform, there are
likely to be other forms of IPC that are faster, but for
cross-platform communication, sockets are about the only game in town. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c5fe9ab-27b5-4ba9-a9b1-953bf66cd9be | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,191 | supabase-export-v2 | 59388b01f57cb02b | in the buffers. However, this still doesn't help with the problem of determining whether the other end is done, or just busy with something else.
**Portability alert**: On Unix, ``select`` works both with the sockets and
files. Don't try this on Windows. On Windows, ``select`` works with sockets
only. Also note that in... | trusted_official_docs | CPython Docs | in the buffers. However, this still doesn't help with the problem of determining whether the other end is done, or just busy with something else.
**Portability alert**: On Unix, ``select`` works both with the sockets and
files. Don't try this on Windows. On Windows, ``select`` works with sockets
only. Also note that in... | in the buffers. However, this still doesn't help with the problem of determining whether the other end is done, or just busy with something else.
**Portability alert**: On Unix, ``select`` works both with the sockets and
files. Don't try this on Windows. On Windows, ``select`` works with sockets
only. Also note that in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3bcb897e-a5a1-42e0-bbd9-6fec185aacf2 | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,153 | supabase-export-v2 | 141f343479c846fe | socket starts the conversation, by sending in a request, or perhaps a signon. But that's a design decision - it's not a rule of sockets.
Now there are two sets of verbs to use for communication. You can use ``send``
and ``recv``, or you can transform your client socket into a file-like beast and
use ``read`` and ``writ... | trusted_official_docs | CPython Docs | socket starts the conversation, by sending in a request, or perhaps a signon. But that's a design decision - it's not a rule of sockets.
Now there are two sets of verbs to use for communication. You can use ``send``
and ``recv``, or you can transform your client socket into a file-like beast and
use ``read`` and ``writ... | socket starts the conversation, by sending in a request, or perhaps a signon. But that's a design decision - it's not a rule of sockets.
Now there are two sets of verbs to use for communication. You can use ``send``
and ``recv``, or you can transform your client socket into a file-like beast and
use ``read`` and ``writ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
416b4d7f-bb28-4186-8f05-65715343bef5 | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,170 | supabase-export-v2 | 30145d71d1692872 | Binary Data -----------
It is perfectly possible to send binary data over a socket. The major problem is
that not all machines use the same formats for binary data. For example,
`network byte order <https://en.wikipedia.org/wiki/Endianness#Networking>`_
is big-endian, with the most significant byte first,
so a 16 bit i... | trusted_official_docs | CPython Docs | Binary Data -----------
It is perfectly possible to send binary data over a socket. The major problem is
that not all machines use the same formats for binary data. For example,
`network byte order <https://en.wikipedia.org/wiki/Endianness#Networking>`_
is big-endian, with the most significant byte first,
so a 16 bit i... | Binary Data -----------
It is perfectly possible to send binary data over a socket. The major problem is
that not all machines use the same formats for binary data. For example,
`network byte order <https://en.wikipedia.org/wiki/Endianness#Networking>`_
is big-endian, with the most significant byte first,
so a 16 bit i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
422712d6-e758-4354-a5b5-b6c3c48bffd8 | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,171 | supabase-export-v2 | 8896c11a2f637955 | ``00 01``. However, most common processors (x86/AMD64, ARM, RISC-V), are little-endian, with the least significant byte first - that same ``1`` would be ``01 00``.
Socket libraries have calls for converting 16 and 32 bit integers - ``ntohl,
htonl, ntohs, htons`` where "n" means *network* and "h" means *host*, "s" means... | trusted_official_docs | CPython Docs | ``00 01``. However, most common processors (x86/AMD64, ARM, RISC-V), are little-endian, with the least significant byte first - that same ``1`` would be ``01 00``.
Socket libraries have calls for converting 16 and 32 bit integers - ``ntohl,
htonl, ntohs, htons`` where "n" means *network* and "h" means *host*, "s" means... | ``00 01``. However, most common processors (x86/AMD64, ARM, RISC-V), are little-endian, with the least significant byte first - that same ``1`` would be ``01 00``.
Socket libraries have calls for converting 16 and 32 bit integers - ``ntohl,
htonl, ntohs, htons`` where "n" means *network* and "h" means *host*, "s" means... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
43304eaa-b96b-466e-93fc-bbd5c22b8902 | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,180 | supabase-export-v2 | 25f18dbb339c6cb4 | Non-blocking Sockets ====================
If you've understood the preceding, you already know most of what you need to
know about the mechanics of using sockets. You'll still use the same calls, in
much the same ways. It's just that, if you do it right, your app will be almost
inside-out. | trusted_official_docs | CPython Docs | Non-blocking Sockets ====================
If you've understood the preceding, you already know most of what you need to
know about the mechanics of using sockets. You'll still use the same calls, in
much the same ways. It's just that, if you do it right, your app will be almost
inside-out. | Non-blocking Sockets ====================
If you've understood the preceding, you already know most of what you need to
know about the mechanics of using sockets. You'll still use the same calls, in
much the same ways. It's just that, if you do it right, your app will be almost
inside-out. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
45f4ffdb-2797-493b-a56b-a94368a0541d | CPython Docs | file://datasets/cpython/Doc/howto/sockets.rst | unknown | d7d867d4-d36e-401a-a7c7-6390415bd8ce | 59,176 | supabase-export-v2 | 9f377f557c104d0a | It can assume it has the complete request. The server sends a reply. If the ``send`` completes successfully then, indeed, the client was still receiving.
Python takes the automatic shutdown a step further, and says that when a socket
is garbage collected, it will automatically do a ``close`` if it's needed. But
relying... | trusted_official_docs | CPython Docs | It can assume it has the complete request. The server sends a reply. If the ``send`` completes successfully then, indeed, the client was still receiving.
Python takes the automatic shutdown a step further, and says that when a socket
is garbage collected, it will automatically do a ``close`` if it's needed. But
relying... | It can assume it has the complete request. The server sends a reply. If the ``send`` completes successfully then, indeed, the client was still receiving.
Python takes the automatic shutdown a step further, and says that when a socket
is garbage collected, it will automatically do a ``close`` if it's needed. But
relying... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.