Skip to content

Commit 1edb4c3

Browse files
committed
Created docs
1 parent c2cdb90 commit 1edb4c3

28 files changed

+1090
-318
lines changed

.pydocstyle.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[pydocstyle]
22
convention = google
33
inherit = false
4-
match = (?!__init__).*\.py
4+
match = (?!__init__|conf).*\.py
55
match-dir = (?!tests)[^\.].*
66
# D212 is enabled by default in google convention, and complains if we have a docstring like:
77
# """

.readthedocs.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
version: 2
3+
4+
sphinx:
5+
builder: "html"
6+
configuration: "docs/source/conf.py"
7+
fail_on_warning: false
8+
9+
python:
10+
version: 3.7
11+
install:
12+
- requirements: "docs/requirements.txt"

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Functions are grouped with like functions, such as IP or MAC address based funct
3434

3535
# Examples
3636

37-
While all functions come with examples in the docstrings, for quick reference of the types of problems this library intends to
37+
While all functions come with examples in the docstrings, for quick reference of the types of problems this library intends to
3838
solve the following examples are provided.
3939

4040
The following function will help in deploying list of VLANs and match the configuration style in a standard IOS-like configurations.
@@ -52,10 +52,10 @@ The following function will help in deploying list of VLANs and match the config
5252
... print(f" switchport trunk allowed vlan {line}")
5353
... else:
5454
... print(f" switchport trunk allowed vlan add {line}")
55-
...
55+
...
5656
switchport trunk allowed vlan 1-3,5,6,1000,1002,1004,1006,1008,1010,1012,1014
5757
switchport trunk allowed vlan add 1016,1018
58-
>>>
58+
>>>
5959
```
6060

6161
You may want to compare a known password with a given encrypted password. This can help in verifying if the
@@ -111,8 +111,8 @@ issues. Functions that were known to be rewritten and their known origin.
111111

112112
| Function | Origin |
113113
| -------- | ------ |
114-
| asn_to_int | NAPALM |
115-
| is_ip | IPCal |
114+
| asn_to_int | NAPALM |
115+
| is_ip | IPCal |
116116
| ip_to_bin | IPCal |
117117
| get_usable_range | IPCal |
118118
| encrypt_type7 | unknown |
@@ -141,7 +141,7 @@ The project is following Network to Code software development guidelines and are
141141
The project features a CLI helper based on [invoke](http://www.pyinvoke.org/) to help setup the development environment. The commands are listed below in 3 categories:
142142
- `dev environment`
143143
- `utility`
144-
- `testing`.
144+
- `testing`.
145145

146146
Each command can be executed with `invoke <command>`. Each command also has its own help `invoke <command> --help`
147147

@@ -153,13 +153,13 @@ Each command can be executed with `invoke <command>`. Each command also has its
153153
rebuild Clean the Docker image and then rebuild without using cache.
154154
```
155155

156-
### Utility
156+
### Utility
157157

158158
```
159159
cli Enter the image to perform troubleshooting or dev work.
160160
```
161161

162-
### Testing
162+
### Testing
163163

164164
```
165165
bandit Run bandit to validate basic static code security analysis.
@@ -176,3 +176,4 @@ Each command can be executed with `invoke <command>`. Each command also has its
176176

177177
For any questions or comments, feel free to swing by the [Network to Code slack channel](https://networktocode.slack.com/) (channel #networktocode).
178178
Sign up [here](http://slack.networktocode.com/)
179+

docs/requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
m2r2==0.2.7
2+
Sphinx
3+
toml
4+
sphinx-rtd-theme

docs/source/_static/schema-page.css

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
body {
2+
font-family: 'Fira Sans', 'Noto Sans', 'Source Sans Pro', 'Segoe UI', Roboto, 'Lucida Sans Unicode', 'Lucida Grande', 'DejaVu Sans', sans-serif;
3+
}
4+
@media (min-width: 60em) {
5+
body {
6+
display: flex;
7+
flex-direction: row;
8+
}
9+
}
10+
#jschemer-nav {
11+
min-width: 15rem;
12+
padding: 1em;
13+
}
14+
.jschemer-schema {
15+
border: 0.05em solid #CCC;
16+
border-radius: 0.25em;
17+
margin: 0.5em;
18+
max-width: 60em;
19+
padding: 1em;
20+
}
21+
.jschemer-schema code,
22+
.jschemer-schema pre {
23+
background-color: rgba(27, 31, 35, 0.05);
24+
border-radius: 0.1em;
25+
font-size: 85%;
26+
line-height: 1.5;
27+
}
28+
.jschemer-schema pre {
29+
padding: 1em 0.5em;
30+
}
31+
.jschemer-schema code {
32+
display: inline;
33+
font-family: 'Fira Mono', 'Noto Mono', 'Source Code Pro', Consolas, 'Roboto Mono', 'Lucida Console', Monaco, 'DejaVu Sans Mono', monospace;
34+
font-size: 85%;
35+
line-height: inherit;
36+
padding: 0.2em 0.4em;
37+
word-wrap: normal;
38+
}
39+
.jschemer-schema pre > code {
40+
background-color: transparent;
41+
padding: 0;
42+
}
43+
.jschemer-schema h1 {
44+
display: inline;
45+
font-size: 1.5em;
46+
vertical-align: middle;
47+
}
48+
.jschemer-schema h1 code::before {
49+
content: '"';
50+
}
51+
.jschemer-schema h1 code::after {
52+
content: '"';
53+
}
54+
.jschemer-schema h2 {
55+
font-size: 1em;
56+
}
57+
main > .jschemer-schema > details > summary > h1 {
58+
font-size: 2em;
59+
}
60+
main ul {
61+
list-style: disc;
62+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* override table width restrictions */
2+
@media screen and (min-width: 767px) {
3+
4+
.wy-table-responsive table td {
5+
/* !important prevents the common CSS stylesheets from overriding
6+
this as on RTD they are loaded after this stylesheet */
7+
white-space: normal !important;
8+
}
9+
10+
.wy-table-responsive {
11+
overflow: visible !important;
12+
}
13+
}

docs/source/attribution/index.rst

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
############
2+
Attribution
3+
############
4+
5+
.. mdinclude:: ../../../README.md
6+
:start-line: 92
7+
:end-line: 126

docs/source/conf.py

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
# pylint: disable=W,C
13+
import os
14+
import sys
15+
import toml
16+
17+
sys.path.insert(0, os.path.abspath("../.."))
18+
toml_dict = toml.load("../../pyproject.toml")
19+
20+
21+
# -- Project information -----------------------------------------------------
22+
23+
project = toml_dict["tool"]["poetry"]["name"]
24+
copyright = f"{toml_dict['tool']['poetry']['authors'][0]}, 2021"
25+
author = ",".join(toml_dict["tool"]["poetry"]["authors"])
26+
27+
# The full version, including alpha/beta/rc tags
28+
release = toml_dict["tool"]["poetry"]["version"]
29+
30+
31+
# -- General configuration ---------------------------------------------------
32+
33+
# Add any Sphinx extension module names here, as strings. They can be
34+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35+
# ones.
36+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon", "m2r2"]
37+
38+
autodoc_default_options = {
39+
"members": True,
40+
"show-inheritance": True,
41+
"special-members": "__init__",
42+
"undoc-members": True,
43+
}
44+
45+
46+
# Add any paths that contain templates here, relative to this directory.
47+
templates_path = ["_templates"]
48+
49+
# The suffix(es) of source filenames.
50+
# You can specify multiple suffix as a list of string:
51+
#
52+
# source_suffix = ['.rst', '.md']
53+
source_suffix = ".rst"
54+
55+
# The master toctree document.
56+
master_doc = "index"
57+
58+
# The name of the Pygments (syntax highlighting) style to use.
59+
pygments_style = "sphinx"
60+
61+
# List of patterns, relative to source directory, that match files and
62+
# directories to ignore when looking for source files.
63+
# This pattern also affects html_static_path and html_extra_path.
64+
exclude_patterns = []
65+
66+
67+
# -- Options for HTML output ----------------------------------------------
68+
69+
# The theme to use for HTML and HTML Help pages. See the documentation for
70+
# a list of builtin themes.
71+
#
72+
html_theme = "sphinx_rtd_theme"
73+
74+
# Theme options are theme-specific and customize the look and feel of a theme
75+
# further. For a list of options available for each theme, see the
76+
# documentation.
77+
#
78+
# html_theme_options = {}
79+
80+
81+
# Add any paths that contain custom static files (such as style sheets) here,
82+
# relative to this directory. They are copied after the builtin static files,
83+
# so a file named "default.css" will overwrite the builtin "default.css".
84+
html_static_path = ["_static"]
85+
86+
html_context = {
87+
"css_files": [
88+
"_static/theme_overrides.css", # override wide tables in RTD theme
89+
"_static/schema-page.css", # Add css from jschemer
90+
]
91+
}
92+
93+
html_sidebars = {"**": ["globaltoc.html", "relations.html", "sourcelink.html", "searchbox.html"]}

docs/source/contributing/index.rst

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
############
2+
Contributing
3+
############
4+
5+
.. mdinclude:: ../../../README.md
6+
:start-line: 131
7+
:end-line: 178

docs/source/index.rst

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. netutils documentation master file, created by
2+
sphinx-quickstart on Wed May 5 01:15:43 2021.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to netutils's documentation!
7+
====================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
overview/index
14+
netutils/index
15+
attribution/index
16+
contributing/index
17+
18+
Indices and tables
19+
==================
20+
21+
* :ref:`genindex`
22+
* :ref:`modindex`

docs/source/netutils/asn/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*********
2+
BGP ASNs
3+
*********
4+
5+
.. automodule:: netutils.asn
6+
:members:
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*******
2+
Configs
3+
*******
4+
5+
.. automodule:: netutils.config.clean
6+
:members:
7+
8+
.. automodule:: netutils.config.compliance
9+
:members:
10+
11+
.. automodule:: netutils.config.parser
12+
:members:

docs/source/netutils/dns/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
****
2+
DNS
3+
****
4+
5+
.. automodule:: netutils.dns
6+
:members:

docs/source/netutils/index.rst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
******************
2+
Netutils Functions
3+
******************
4+
5+
.. toctree::
6+
:maxdepth: 2
7+
8+
asn/index
9+
configs/index
10+
dns/index
11+
interface/index
12+
ip/index
13+
mac/index
14+
password/index
15+
ping/index
16+
route/index
17+
vlan/index
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
***********
2+
Interfaces
3+
***********
4+
5+
.. automodule:: netutils.interface
6+
:members:

docs/source/netutils/ip/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**************
2+
IP addresses
3+
**************
4+
5+
.. automodule:: netutils.ip
6+
:members:

docs/source/netutils/mac/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**************
2+
MAC addresses
3+
**************
4+
5+
.. automodule:: netutils.mac
6+
:members:
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
***********
2+
Passwords
3+
***********
4+
5+
.. automodule:: netutils.password
6+
:members:

docs/source/netutils/ping/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
******
2+
Ping
3+
******
4+
5+
.. automodule:: netutils.ping
6+
:members:

docs/source/netutils/route/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*********
2+
Routing
3+
*********
4+
5+
.. automodule:: netutils.route
6+
:members:

0 commit comments

Comments
 (0)