1
|
1 |
|
import yorm |
|
|
|
|
2
|
1 |
|
from yorm.types import Float, List, Object, AttributeDictionary |
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
1 |
|
@yorm.attr(minimum=Float) |
6
|
1 |
|
@yorm.attr(maximum=Float) |
7
|
1 |
|
class CoordinateRange(AttributeDictionary): |
8
|
|
|
"""Specifies a floating-point range.""" |
9
|
|
|
|
10
|
1 |
|
def __init__(self, minimum, maximum): |
11
|
1 |
|
super().__init__() |
12
|
1 |
|
self.minimum = minimum |
13
|
1 |
|
self.maximum = maximum |
14
|
|
|
|
15
|
|
|
|
16
|
1 |
|
@yorm.attr(latitude=CoordinateRange) |
17
|
1 |
|
@yorm.attr(longitude=CoordinateRange) |
18
|
1 |
|
class BoundingBox(AttributeDictionary): |
19
|
|
|
"""A GPS bounding box.""" |
20
|
|
|
|
21
|
1 |
|
def __init__(self, latitude, longitude): |
22
|
1 |
|
super().__init__() |
23
|
1 |
|
self.latitude = latitude |
24
|
1 |
|
self.longitude = longitude |
25
|
|
|
|
26
|
|
|
|
27
|
1 |
|
@yorm.attr(tags=List.of_type(Object)) |
28
|
1 |
|
class FilterOptions(AttributeDictionary): |
29
|
|
|
"""Collection of rules to include matching polygons.""" |
30
|
|
|
|
31
|
1 |
|
def __init__(self, tags=None): |
32
|
1 |
|
super().__init__() |
33
|
1 |
|
self.tags = tags or [] |
34
|
|
|
|
35
|
|
|
|
36
|
1 |
|
@yorm.attr(boundaries=List.of_type(BoundingBox)) |
37
|
1 |
|
@yorm.attr(filters=FilterOptions) |
38
|
1 |
|
@yorm.sync("osmerge.yml") |
39
|
|
|
class Config: |
40
|
|
|
"""Specifies how to limited the location and types of polygons.""" |
41
|
|
|
|
42
|
1 |
|
def __init__(self): |
43
|
1 |
|
self.boundaries = [] |
44
|
1 |
|
self.filters = FilterOptions() |
45
|
|
|
|
46
|
1 |
|
@classmethod |
47
|
|
|
def generate_example(cls): |
48
|
|
|
"""Create an example configuration to be manually edited.""" |
49
|
1 |
|
config = cls() |
50
|
|
|
|
51
|
1 |
|
config.boundaries.append(BoundingBox( |
52
|
|
|
CoordinateRange(42.882669706849875, 43.03002974711799), |
53
|
|
|
CoordinateRange(-85.75284790217363, -85.5676630879733), |
54
|
|
|
)) |
55
|
1 |
|
config.filters.tags.append(dict(leasure='park')) |
56
|
|
|
|
57
|
|
|
return config |
58
|
|
|
|
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.py
files in your module folders. Make sure that you place one file in each sub-folder.