1 | 1 | import os |
|
0 ignored issues
–
show
|
|||
2 | 1 | import logging |
|
3 | 1 | from pathlib import Path |
|
4 | |||
5 | |||
6 | 1 | GITIGNORE = """ |
|
7 | |||
8 | /tmp |
||
9 | |||
10 | """ |
||
11 | |||
12 | 1 | MAKEFILE = """ |
|
13 | |||
14 | .PHONY: all |
||
15 | all: build |
||
16 | |||
17 | # PIPELINE ##################################################################### |
||
18 | |||
19 | .PHONY: build |
||
20 | build: docs/osmerge.geojson |
||
21 | |||
22 | docs/osmerge.geojson: tmp/merged.json |
||
23 | osmerge convert $< $@ |
||
24 | |||
25 | tmp/merged.json: tmp/filtered.json osmerge.csv |
||
26 | osmerge merge $< $@ |
||
27 | |||
28 | tmp/filtered.json: tmp/base.json osmerge.yml |
||
29 | osmerge filter $< $@ |
||
30 | |||
31 | tmp/base.json: osmerge.yml |
||
32 | osmerge download $@ |
||
33 | |||
34 | # CLEANUP ###################################################################### |
||
35 | |||
36 | .PHONY: clean |
||
37 | clean: |
||
38 | rm -rf tmp |
||
39 | |||
40 | """.replace(' ' * 4, '\t') |
||
41 | |||
42 | 1 | INDEX = """ |
|
43 | |||
44 | <!-- TBD --> |
||
45 | |||
46 | """ |
||
47 | |||
48 | 1 | GEOJSON = """ |
|
49 | |||
50 | {} |
||
51 | |||
52 | """ |
||
53 | |||
54 | 1 | log = logging.getLogger(__name__) |
|
0 ignored issues
–
show
The name
log does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$ ).
This check looks for invalid names for a range of different identifiers. You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements. If your project includes a Pylint configuration file, the settings contained in that file take precedence. To find out more about Pylint, please refer to their site. ![]() |
|||
55 | |||
56 | |||
57 | 1 | class Project(object): |
|
0 ignored issues
–
show
This class should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
58 | |||
59 | 1 | @classmethod |
|
60 | def generate(cls): |
||
0 ignored issues
–
show
This method should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
61 | 1 | root = Path.cwd() |
|
62 | |||
63 | 1 | if len(os.listdir()) >= 3: |
|
64 | log.warning("A project already exists: %s", root) |
||
65 | return False |
||
66 | |||
67 | 1 | with root.joinpath(".gitignore").open('w') as stream: |
|
0 ignored issues
–
show
|
|||
68 | 1 | stream.write(GITIGNORE.strip() + '\n') |
|
69 | 1 | with root.joinpath("Makefile").open('w') as stream: |
|
0 ignored issues
–
show
|
|||
70 | 1 | stream.write(MAKEFILE.strip() + '\n') |
|
71 | |||
72 | 1 | docs = Path("docs") |
|
73 | 1 | docs.mkdir(parents=True, exist_ok=True) |
|
0 ignored issues
–
show
|
|||
74 | |||
75 | 1 | with docs.joinpath("index.html").open('w') as stream: |
|
0 ignored issues
–
show
|
|||
76 | 1 | stream.write(INDEX.strip() + '\n') |
|
77 | 1 | with docs.joinpath("osmerge.geojson").open('w') as stream: |
|
0 ignored issues
–
show
|
|||
78 | 1 | stream.write(GEOJSON.strip() + '\n') |
|
79 | |||
80 | return True |
||
81 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.