homework done

This commit is contained in:
ilia 2023-09-28 21:47:21 +03:00
parent 2660e0879b
commit 9cbb7ba909
13 changed files with 396 additions and 1 deletions

View File

@ -1,2 +1 @@
# advanced-python-homework-2023

160
controls/.gitignore vendored Normal file
View File

@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

9
controls/Licence.txt Normal file
View File

@ -0,0 +1,9 @@
I am providing code and resources in this repository to you under an open source
license. Because this is my personal repository, the license you receive to my
code and resources is from me and not my employer.
Copyright 2023 Ilia Tambovtsev
Creative Commons Attribution 4.0 International License (CC BY 4.0)
http://creativecommons.org/licenses/by/4.0/

27
controls/README.md Normal file
View File

@ -0,0 +1,27 @@
# Controls
## Venv creation:
```
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```
## Documentation
1. run sphinx initialization: `sphinx-quickstart docs`
2. add project packages: `sphinx-apidoc -o docs/source .`
3. edit `conf.py`
```py
import sys
import os
sys.path.insert(0, os.path.abspath("../../"))
extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
]
```
4. build docs `sphinx-build -M html docs/source/ docs/build/`
5. docs are now in `docs/build/html`

38
controls/__init__.py Normal file
View File

@ -0,0 +1,38 @@
"""SCADA (Supervisory Control and Data Acquisition) is a system used to
monitor and control industrial processes and operations. It is a combination of
hardware and software components that gather and analyze real-time data from
various sources, such as sensors, meters, and other devices, in order to
provide supervision, control, and visualization of the entire process.
Key features of a SCADA system include:
1. Data Acquisition: SCADA systems collect data in real-time from different
sources, such as sens
2. Graphical User Interface (GUI): SCADA systems provide a user-friendly
interface, typically in the form of a graphical display, allowing operators
to visualize the process, alarms, and data in a clear and intuitive manner.
3. Control and Automation: SCADA systems enable operators to remotely control
and automate various aspects of the industrial process, such as
opening/closing valves or adjusting setpoints, to optimize performance and
ensure safety.
4. Alarming and Event Notification: SCADA systems generate alarms and
notifications in response to abnormal conditions or events, such as
equipment failure or deviations from set parameters, allowing operators to
take appropriate actions.
5. Historical Data Logging and Reporting: SCADA systems store and archive
historical data, enabling long-term analysis, trend identification, and
reporting for performance evaluation, regulatory compliance, and
decision-making purposes.
6. Remote Access and Monitoring: SCADA systems often support remote access,
allowing authorized users to monitor and control the industrial process from
anywhere, enhancing flexibility, efficiency, and troubleshooting capability.
7. Security and Authentication: SCADA systems implement security measures, such
as authentication and user access controls, to protect against unauthorized
access, data breaches, and cyber threats.
"""

31
controls/pyproject.toml Normal file
View File

@ -0,0 +1,31 @@
[project]
name = "spam"
version = "2020.0.0"
description = "Lovely Spam! Wonderful Spam!"
readme = "README.rst"
requires-python = ">=3.7"
license = {file = "LICENSE.txt"}
keywords = ["SCADA", "mipt"]
authors = [
{email = "tambovtsev.io@phystech.edu"},
{name = "Ilia Tambovtsev"}
]
classifiers = [
"Programming Language :: Python"
]
dependencies = [
"numpy",
"scipy"
]
[project.optional-dependencies]
test = [
"pytest < 5.0.0",
]
[project.urls]
homepage = "https://example.com"
documentation = "https://readthedocs.org"
repository = "https://github.com"

View File

@ -0,0 +1,3 @@
pylint
sphinx
mypy

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

35
docs/make.bat Normal file
View File

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

36
docs/source/conf.py Normal file
View File

@ -0,0 +1,36 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import sys
import os
sys.path.insert(0, os.path.abspath("../../"))
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'Advanced python homework'
copyright = '2023, Ilia'
author = 'Ilia'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
]
templates_path = ['_templates']
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'alabaster'
html_static_path = ['_static']

10
docs/source/controls.rst Normal file
View File

@ -0,0 +1,10 @@
controls package
================
Module contents
---------------
.. automodule:: controls
:members:
:undoc-members:
:show-inheritance:

20
docs/source/index.rst Normal file
View File

@ -0,0 +1,20 @@
.. Advanced python homework documentation master file, created by
sphinx-quickstart on Thu Sep 28 21:33:05 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Advanced python homework's documentation!
====================================================
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

7
docs/source/modules.rst Normal file
View File

@ -0,0 +1,7 @@
advanced-python-homework-2023
=============================
.. toctree::
:maxdepth: 4
controls