From 4eedae744f5a5bd8edc5b5edd021e9e49a68a653 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Sun, 26 Dec 2021 16:57:36 +0000 Subject: [PATCH 01/12] Replacing Tablib fork with the original repo Link currently points to a tablib fork and not to the original repo (https://github.com/jazzband/tablib). Fork doesn't look maintained and is behind the original repo Changing link to use https://github.com/jazzband/tablib --- docs/writing/reading.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/writing/reading.rst b/docs/writing/reading.rst index ad67ea3cb..1e03a4def 100644 --- a/docs/writing/reading.rst +++ b/docs/writing/reading.rst @@ -43,7 +43,7 @@ reading. Each one of these projects is a paragon of Python coding. Requests is an Apache2 Licensed HTTP library, written in Python, for human beings. -- `Tablib `_ +- `Tablib `_ Tablib is a format-agnostic tabular dataset library, written in Python. From 8e7087b41b42609837ed3484732f450c68e86edc Mon Sep 17 00:00:00 2001 From: Thomas Severin Date: Mon, 25 Apr 2022 10:05:30 +0200 Subject: [PATCH 02/12] Code refactoring and wording improvements. --- docs/scenarios/admin.rst | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/docs/scenarios/admin.rst b/docs/scenarios/admin.rst index 07d263945..236d08d2b 100644 --- a/docs/scenarios/admin.rst +++ b/docs/scenarios/admin.rst @@ -155,44 +155,42 @@ tests (net, CPU) fail, it will send an email. # Package for email services: import smtplib import string - MAX_NET_USAGE = 400000 + MAX_NET_USAGE = 400000 # bytes per seconds MAX_ATTACKS = 4 attack = 0 - counter = 0 while attack <= MAX_ATTACKS: sleep(4) - counter = counter + 1 - # Check the cpu usage - if cpu_percent(interval = 1) > 70: - attack = attack + 1 - # Check the net usage - neti1 = net_io_counters()[1] - neto1 = net_io_counters()[0] + + # Check the net usage wit named tuples + neti1 = net_io_counters().bytes_recv + neto1 = net_io_counters().bytes_sent sleep(1) - neti2 = net_io_counters()[1] - neto2 = net_io_counters()[0] + neti2 = net_io_counters().bytes_recv + neto2 = net_io_counters().bytes_sent + # Calculate the bytes per second net = ((neti2+neto2) - (neti1+neto1))/2 - if net > MAX_NET_USAGE: - attack = attack + 1 - if counter > 25: - attack = 0 - counter = 0 + + # Check the net and cpu usage + if (net > MAX_NET_USAGE) or (cpu_percent(interval = 1) > 70): + attack+=1 + elif attack > 1: + attack-=1 + # Write a very important email if attack is higher than 4 TO = "you@your_email.com" FROM = "webmaster@your_domain.com" SUBJECT = "Your domain is out of system resources!" text = "Go and fix your server!" - BODY = string.join(("From: %s" %FROM,"To: %s" %TO,"Subject: %s" %SUBJECT, "",text), "\r\n") + string="\r\n" + BODY = string.join(("From: %s" %FROM,"To: %s" %TO, + "Subject: %s" %SUBJECT, "",text)) server = smtplib.SMTP('127.0.0.1') server.sendmail(FROM, [TO], BODY) server.quit() -A full terminal application like a widely extended top which is based on -psutil and with the ability of a client-server monitoring is -`glance `_. - +A full terminal application like a widely extended top is glance, which is based on psutil and has the ability for client-server monitoring. ******* Ansible From 69580b1179e64da6dca20215aeaf0257e044f369 Mon Sep 17 00:00:00 2001 From: Thomas S Date: Wed, 27 Apr 2022 18:34:21 +0200 Subject: [PATCH 03/12] Broken link to Glance --- docs/scenarios/admin.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/scenarios/admin.rst b/docs/scenarios/admin.rst index 236d08d2b..f70268fa9 100644 --- a/docs/scenarios/admin.rst +++ b/docs/scenarios/admin.rst @@ -190,7 +190,7 @@ tests (net, CPU) fail, it will send an email. server.quit() -A full terminal application like a widely extended top is glance, which is based on psutil and has the ability for client-server monitoring. +A full terminal application like a widely extended top is `glance `_, which is based on psutil and has the ability for client-server monitoring. ******* Ansible From 536b08fc804eb9af246a3e707aafb951a3cc14c1 Mon Sep 17 00:00:00 2001 From: Thomas S Date: Wed, 27 Apr 2022 18:34:46 +0200 Subject: [PATCH 04/12] Broken link to Glance --- docs/scenarios/admin.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/scenarios/admin.rst b/docs/scenarios/admin.rst index f70268fa9..73df990d7 100644 --- a/docs/scenarios/admin.rst +++ b/docs/scenarios/admin.rst @@ -190,7 +190,7 @@ tests (net, CPU) fail, it will send an email. server.quit() -A full terminal application like a widely extended top is `glance `_, which is based on psutil and has the ability for client-server monitoring. +A full terminal application like a widely extended top is `Glance `_, which is based on psutil and has the ability for client-server monitoring. ******* Ansible From 32db4ae8e27ccc1b2c5a3099166add1543671819 Mon Sep 17 00:00:00 2001 From: Max Weiner Date: Thu, 16 Jun 2022 07:44:27 +0200 Subject: [PATCH 05/12] add section for xmlschema --- docs/scenarios/xml.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/scenarios/xml.rst b/docs/scenarios/xml.rst index 3bdf15b6c..24dab5869 100644 --- a/docs/scenarios/xml.rst +++ b/docs/scenarios/xml.rst @@ -81,3 +81,30 @@ and then you can access elements, attributes, and values like this: xmltodict also lets you roundtrip back to XML with the unparse function, has a streaming mode suitable for handling files that don't fit in memory, and supports XML namespaces. + +********** +xmlschema +********** + +`xmlschema `_ provides support for using XSD-Schemas in Python. +Unlike other XML libraries, automatic type parsing is available, so f.e. if the schema defines an element to be of type ``int``, the parsed ``dict`` will contain also an ``int`` value for that element. +Moreover the library supports automatic and explicit validation of XML documents against a schema. + +.. code-block:: python + + from xmlschema import XMLSchema, etree_tostring + + # load a XSD schema file + schema = XMLSchema("your_schema.xsd") + + # validate against the schema + schema.validate("your_file.xml") + + # or + schema.is_valid("your_file.xml") + + # decode a file + data = schmema.decode("your_file.xml") + + # encode to string + s = etree_tostring(schema.encode(data)) From 20b4160bf8424d881c007b320a3f65d2289c9b14 Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Fri, 17 Jun 2022 11:43:46 -0600 Subject: [PATCH 06/12] Update Requests documentation links --- docs/dev/virtualenvs.rst | 2 +- docs/scenarios/client.rst | 2 +- docs/scenarios/scrape.rst | 2 +- docs/writing/style.rst | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst index b4591e43b..fe6bd3f9e 100644 --- a/docs/dev/virtualenvs.rst +++ b/docs/dev/virtualenvs.rst @@ -156,7 +156,7 @@ when you share your project with others. You should get output similar to this Adding requests to Pipfile's [packages]... P.S. You have excellent taste! ✨ 🍰 ✨ -.. _Requests: http://docs.python-requests.org/en/master/ +.. _Requests: https://requests.readthedocs.io/en/latest/ Using installed packages diff --git a/docs/scenarios/client.rst b/docs/scenarios/client.rst index 1457fa479..c2d5c289b 100644 --- a/docs/scenarios/client.rst +++ b/docs/scenarios/client.rst @@ -28,7 +28,7 @@ your URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling are 100% automatic, powered by urllib3, which is embedded within Requests. -- `Documentation `_ +- `Documentation `_ - `PyPi `_ - `GitHub `_ diff --git a/docs/scenarios/scrape.rst b/docs/scenarios/scrape.rst index 54747b295..527719200 100644 --- a/docs/scenarios/scrape.rst +++ b/docs/scenarios/scrape.rst @@ -28,7 +28,7 @@ lxml and Requests `lxml `_ is a pretty extensive library written for parsing XML and HTML documents very quickly, even handling messed up tags in the process. We will also be using the -`Requests `_ module instead of the +`Requests `_ module instead of the already built-in urllib2 module due to improvements in speed and readability. You can easily install both using ``pip install lxml`` and ``pip install requests``. diff --git a/docs/writing/style.rst b/docs/writing/style.rst index 9858112de..d8c096a05 100644 --- a/docs/writing/style.rst +++ b/docs/writing/style.rst @@ -465,8 +465,7 @@ easy-to-read version of PEP 8 is also available at `pep8.org ` This is highly recommended reading. The entire Python community does their best to adhere to the guidelines laid out within this document. Some project -may sway from it from time to time, while others may -`amend its recommendations `_. +may sway from it from time to time, while others may amend its recommendations. That being said, conforming your Python code to PEP 8 is generally a good idea and helps make code more consistent when working on projects with other From 44630bbe9b3353e3b6bac125cbb4530f72fb00a7 Mon Sep 17 00:00:00 2001 From: Howie Zhao Date: Sun, 28 Aug 2022 12:35:00 +0800 Subject: [PATCH 07/12] Update osx.rst --- docs/starting/install3/osx.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/starting/install3/osx.rst b/docs/starting/install3/osx.rst index 37252d615..6e3f09057 100644 --- a/docs/starting/install3/osx.rst +++ b/docs/starting/install3/osx.rst @@ -9,9 +9,9 @@ Installing Python 3 on Mac OS X .. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg -**Mac OS X comes with Python 2.7 out of the box.** +**Mac OS X comes with Python 2.7 out of the box between versions 10.8 and 12.3.** -You do not need to install or configure anything else to use Python 2. These +If your Mac OS X version is between the above versions, you do not need to install or configure anything else to use Python 2. These instructions document the installation of Python 3. The version of Python that ships with OS X is great for learning, but it's not From d03633e5d62acfee6060430f5e763e3d69d29d0f Mon Sep 17 00:00:00 2001 From: Howie Zhao Date: Sun, 28 Aug 2022 12:38:04 +0800 Subject: [PATCH 08/12] Update osx.rst --- docs/starting/install/osx.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/starting/install/osx.rst b/docs/starting/install/osx.rst index d0aa601aa..4a8a8e03b 100644 --- a/docs/starting/install/osx.rst +++ b/docs/starting/install/osx.rst @@ -10,9 +10,10 @@ Installing Python 2 on Mac OS X .. note:: Check out our :ref:`guide for installing Python 3 on OS X`. -**Mac OS X comes with Python 2.7 out of the box.** +**Mac OS X comes with Python 2.7 out of the box between versions 10.8 and 12.3.** -You do not need to install or configure anything else to use Python. Having said +If your Mac OS X version is between the above versions, +you do not need to install or configure anything else to use Python. Having said that, I would strongly recommend that you install the tools and libraries described in the next section before you start building Python applications for real-world use. In particular, you should always install Setuptools, as it makes From 2935d8f4f7255fa1ad81b06eda2c800f82b9a2f1 Mon Sep 17 00:00:00 2001 From: Howie Zhao Date: Sun, 28 Aug 2022 12:38:33 +0800 Subject: [PATCH 09/12] Update osx.rst --- docs/starting/install3/osx.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/starting/install3/osx.rst b/docs/starting/install3/osx.rst index 6e3f09057..fa90fb93a 100644 --- a/docs/starting/install3/osx.rst +++ b/docs/starting/install3/osx.rst @@ -11,7 +11,8 @@ Installing Python 3 on Mac OS X **Mac OS X comes with Python 2.7 out of the box between versions 10.8 and 12.3.** -If your Mac OS X version is between the above versions, you do not need to install or configure anything else to use Python 2. These +If your Mac OS X version is between the above versions, +you do not need to install or configure anything else to use Python 2. These instructions document the installation of Python 3. The version of Python that ships with OS X is great for learning, but it's not From f70533e75f03cd6d45d3ec113705a16c493be529 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Wed, 2 Nov 2022 18:30:56 -0700 Subject: [PATCH 10/12] Update runtime.txt --- runtime.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime.txt b/runtime.txt index 5a958026d..cc1923a40 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -3.5 +3.8 From 4f0ee6998c3c3d27b316bb9356896a18c8e51d63 Mon Sep 17 00:00:00 2001 From: fa064972 Date: Sun, 16 Jun 2024 22:26:05 +0530 Subject: [PATCH 11/12] updated the broken links of opencv and PIL readthedocs site --- docs/scenarios/imaging.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/scenarios/imaging.rst b/docs/scenarios/imaging.rst index 7b0e71935..8fe7e08fe 100644 --- a/docs/scenarios/imaging.rst +++ b/docs/scenarios/imaging.rst @@ -62,7 +62,7 @@ Example exif_data There are more examples of the Pillow library in the -`Pillow tutorial `_. +`Pillow tutorial `_. *************************** @@ -109,4 +109,4 @@ Example There are more Python-implemented examples of OpenCV in this `collection of tutorials -`_. +`_. From 64ac5ceb88f20537c8c5c26cbcbb15f1ca56623f Mon Sep 17 00:00:00 2001 From: d9pouces Date: Thu, 20 Jun 2024 22:34:50 +0200 Subject: [PATCH 12/12] fix: remove Shinken from the admin part, because Shinken is dead (last version 8 years ago) --- docs/scenarios/admin.rst | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/docs/scenarios/admin.rst b/docs/scenarios/admin.rst index 73df990d7..f6433c213 100644 --- a/docs/scenarios/admin.rst +++ b/docs/scenarios/admin.rst @@ -395,17 +395,3 @@ up. Buildout is primarily used to download and set up dependencies in `Python eggs `_ format of the software being developed or deployed. Recipes for build tasks in any environment can be created, and many are already available. - - -******* -Shinken -******* - -`Shinken `_ is a modern, Nagios compatible -monitoring framework written in Python. Its main goal is to give users a flexible -architecture for their monitoring system that is designed to scale to large -environments. - -Shinken is backwards-compatible with the Nagios configuration standard and -plugins. It works on any operating system and architecture that supports Python, -which includes Windows, Linux, and FreeBSD.