Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphviz on docs #16

Merged
merged 55 commits into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
289bb58
adding dot graph with builtins
chrizzFTD Feb 17, 2020
117b470
remove extra space
chrizzFTD Feb 17, 2020
09ba35c
EOL
chrizzFTD Feb 17, 2020
76e768b
fix uppercase
chrizzFTD Feb 17, 2020
d5498f8
try http
chrizzFTD Feb 17, 2020
a04b565
try custom_mark instead of builtins
chrizzFTD Feb 17, 2020
d7ec601
custom_mark
chrizzFTD Feb 17, 2020
c387e06
no new lines
chrizzFTD Feb 17, 2020
3b776e3
EOL
chrizzFTD Feb 17, 2020
8bbcf3b
drop strict
chrizzFTD Feb 17, 2020
53b4d5e
specific dot
chrizzFTD Feb 17, 2020
2d68937
try svg
chrizzFTD Feb 17, 2020
21bed79
startulm
chrizzFTD Feb 17, 2020
ba10679
cleanup
chrizzFTD Feb 17, 2020
f16472e
graphvizo example
chrizzFTD Feb 17, 2020
68d81d5
invalid URL
chrizzFTD Feb 17, 2020
42341dc
remove old img
chrizzFTD Feb 17, 2020
52b150d
mark10
chrizzFTD Feb 17, 2020
16ba5c9
no custom mark
chrizzFTD Feb 17, 2020
47a155a
no svg
chrizzFTD Feb 17, 2020
3ff9c08
live aspace
chrizzFTD Feb 17, 2020
b1ad980
test from graphvizo
chrizzFTD Feb 17, 2020
efdacea
svg
chrizzFTD Feb 17, 2020
da37d62
own
chrizzFTD Feb 17, 2020
15b0472
100 times plz
chrizzFTD Feb 17, 2020
f64f9fc
now
chrizzFTD Feb 17, 2020
0f4b3b1
new digraph
chrizzFTD Feb 17, 2020
6a92f98
try no newline
chrizzFTD Feb 17, 2020
b555202
removed curlys
chrizzFTD Feb 17, 2020
25b1e10
removed cluster
chrizzFTD Feb 17, 2020
25fbbca
removed styles and labels
chrizzFTD Feb 17, 2020
0c0cdeb
multicon
chrizzFTD Feb 17, 2020
510e2e7
add edge
chrizzFTD Feb 17, 2020
1950a96
Revert "add edge"
chrizzFTD Feb 17, 2020
854995e
no multilink
chrizzFTD Feb 17, 2020
5d5cdfb
adding style
chrizzFTD Feb 17, 2020
282e081
bring style
chrizzFTD Feb 17, 2020
bd7a4bf
remove culrys
chrizzFTD Feb 17, 2020
0743d1b
fix
chrizzFTD Feb 17, 2020
c32f7f3
graphvizo happy
chrizzFTD Feb 17, 2020
35c1bbc
multiline label
chrizzFTD Feb 17, 2020
de7e87a
Revert "multiline label"
chrizzFTD Feb 17, 2020
4a4be72
adding overview.dot
chrizzFTD Feb 21, 2020
6db42e1
linking graphviz overview
chrizzFTD Feb 21, 2020
6b126b3
invis bg color
chrizzFTD Feb 21, 2020
2d2fe4d
comments and slash
chrizzFTD Feb 21, 2020
e21c603
missing escape slash
chrizzFTD Feb 21, 2020
9f965f3
Remove external link
chrizzFTD Feb 21, 2020
ce8371a
update docs
chrizzFTD Feb 21, 2020
de3ac7b
wording
chrizzFTD Feb 21, 2020
3666c6b
sorting
chrizzFTD Feb 21, 2020
4a935f4
basic use section is now usage
chrizzFTD Feb 22, 2020
f399fb1
wording pt2
chrizzFTD Feb 22, 2020
8d99fbb
revert The
chrizzFTD Feb 22, 2020
a8fb0b7
git EOL
chrizzFTD Feb 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@

Object-oriented names for the digital era.

naming provides a simple yet flexible and scalable interface for naming conventions.
It follows the UNIX tradition of single-purpose tools that do one thing well.

<div class="footer">
<img src="https://docs.google.com/drawings/d/1wU-T04kgE7O_uVr4XRNIxGsnZP-TJmVxG5mqQE6mMNM/pub?w=1380&amp;h=980">
</div>
`naming` provides an interface for dealing with naming conventions; from
defining them, to identifying names and creating new ones.

### Installation

Expand All @@ -24,4 +20,25 @@ $ pip install naming

### Usage

Refer to the [documentation](http://naming.readthedocs.io/en/latest/) for details on contents and usage.
Please refer to the [documentation](http://naming.readthedocs.io/en/latest/) for details on contents and usage.

```python
>>> import naming
>>> class NameFileConvention(naming.Name, naming.File):
... config = dict(first=r'\w+', last=r'\w+', number=r'\d+')
...
>>> name = NameFileConvention('john doe 07.jpg')
>>> name.last
'doe'
>>> name.number
'07'
>>> name.get_name(first='jane', number=99)
'jane doe 99.jpg'
>>> name.last = 'connor'
>>> name
NameFileConvention("john connor 07.jpg")
>>> name.number = 'not_a_number'
...
ValueError: Can't set invalid name 'john connor not_a_number.jpg' on NameFileConvention instance. Valid convention is: '{first} {last} {number}.{suffix}' with pattern: ^(?P<first>\w+)\ (?P<last>\w+)\ (?P<number>\d+)(\.(?P<suffix>\w+))$'
```

20 changes: 8 additions & 12 deletions docs/source/Overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ Overview

.. topic:: Name Objects

This package offers classes representing names as strings that follow a certain pattern convention. New Name
objects can subclass from the provided classes in a simple manner. Each Name object has a **config** attribute
This package offers classes representing names as strings that follow a certain pattern convention.
Each Name object has a **config** attribute
that contains the fields and regex patterns of the convention to follow. Names can also drop fields from their
parent classes with the **drop** attribute, or they can merge / split fields with the **join** attribute.

Class Flow
==========
Composition Example
===================
.. graphviz:: example.dot

.. raw:: html

<img src="https://docs.google.com/drawings/d/1wU-T04kgE7O_uVr4XRNIxGsnZP-TJmVxG5mqQE6mMNM/pub?w=690&amp;h=490">

Basic Use
=========
Usage
=====

.. topic:: Built-ins & `config` attribute

Expand Down Expand Up @@ -127,8 +124,7 @@ Basic Use

.. topic:: Extending Names

The **config**, **drop** and **join** attributes are merged on the subclasses to provide a simple but flexible
and scalable system that can help rule all names in a project.
The **config**, **drop** and **join** attributes are merged on subclasses.

Inheriting from an existing name::

Expand Down
55 changes: 55 additions & 0 deletions docs/source/example.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
strict digraph G {
// nodes creation, shape and style defined here
bgcolor=invis
{
node [style="rounded, filled" shape=box]
class, FILE, PIPE, PIPEFILE
}
{
node [style=filled margin=0 width=1 height=0.46 shape=polygon fixedsize=true skew=0.4]
format, file_format, pipe_format, pipefile_format
}
{
node [shape=none]
patterns, file_patterns, pipe_patterns, pipefile_patterns
}
{
node [style="dashed, filled" shape=box]
example, file_example, pipe_example, pipefile_example
}
// connections, labels and color related updates by higher level groups
subgraph legend {
edge[style=invis] // connect with invisible edges to emulate a legend
class, format, example, patterns [color=gray40 fillcolor=gray95]
patterns [label="field=pattern" fontcolor=gray22]
class -> format -> patterns -> example
}

FILE, file_format, file_example [color=lightgoldenrod3 fillcolor=lemonchiffon1]
file_format [label=".{suffix}"]
file_example [label=".ext"]
// escape the inverse slash so generated image displays one
file_patterns [label="suffix = \\w+" fontcolor=lightgoldenrod4]

PIPE, pipe_format, pipe_example [color=lightskyblue4 fillcolor=lightblue]
pipe_format [label=".{pipe}"]
pipe_example [label=".1
.1.out
.1.out.101"]
pipe_patterns [label="version = \\d+
output = \\w+?
frame = \\d+?"]

PIPEFILE, pipefile_format, pipefile_example [color=mediumorchid4 fillcolor=plum2]
pipefile_format [skew=0.15 width=2 label="{base}.{pipe}.{suffix}"]
pipefile_example [label="wip_data.7.ext
pipe_data.7.out.ext
framed_data.7.out.101.ext"]
pipefile_patterns [label="base = \\w+" fontcolor=mediumorchid4]

edge [color=gray36 arrowhead="vee"]
PIPE -> pipe_format -> pipe_patterns -> pipe_example
FILE -> file_format -> file_patterns -> file_example
PIPEFILE -> pipefile_format -> pipefile_patterns -> pipefile_example
{PIPE, FILE} -> PIPEFILE
}