PyPaf 1.0.2__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypaf-1.0.2/src/PyPaf.egg-info → pypaf-1.0.4}/PKG-INFO +188 -184
- {pypaf-1.0.2 → pypaf-1.0.4}/pyproject.toml +18 -1
- {pypaf-1.0.2 → pypaf-1.0.4}/setup.cfg +4 -4
- {pypaf-1.0.2 → pypaf-1.0.4/src/PyPaf.egg-info}/PKG-INFO +188 -184
- {pypaf-1.0.2 → pypaf-1.0.4}/src/PyPaf.egg-info/SOURCES.txt +1 -1
- pypaf-1.0.4/src/PyPaf.egg-info/requires.txt +4 -0
- pypaf-1.0.4/src/paf/attribute.py +29 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/lineable.py +2 -11
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/__init__.py +54 -4
- pypaf-1.0.4/src/paf/premises/attribute.py +25 -0
- pypaf-1.0.4/src/paf/premises/building_type.py +29 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/exception.py +2 -2
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/premisable.py +4 -8
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/split.py +2 -2
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/thoroughfare_locality.py +8 -23
- pypaf-1.0.4/src/paf/version.py +3 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_6.py +85 -0
- pypaf-1.0.2/src/paf/attribute.py +0 -44
- pypaf-1.0.2/src/paf/premises/attribute.py +0 -40
- pypaf-1.0.2/src/paf/premises/building_type.py +0 -33
- pypaf-1.0.2/src/paf/premises/extender.py +0 -23
- pypaf-1.0.2/src/paf/version.py +0 -3
- {pypaf-1.0.2 → pypaf-1.0.4}/LICENSE.txt +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/README.md +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/PyPaf.egg-info/dependency_links.txt +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/PyPaf.egg-info/top_level.txt +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/__init__.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/address.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/immutable.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/initiator.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/dependent_premisable.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/lineable.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule000.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule001.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule010.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule011.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule100.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule101.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule110.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule111.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_empty.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_exception_i.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_exception_ii.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_exception_iii.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_exception_iv.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_immutability.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_kwargs.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_mainfile.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_po_box.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_premises.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_1.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_2.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_3.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_4.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_5.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_7.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_x.py +0 -0
|
@@ -1,184 +1,188 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name: PyPaf
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: Formats the elements of a Royal Mail Postcode Address File entry
|
|
5
|
-
Author-email: John Bard <johnbard@globalnet.co.uk>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/drabjay/pypaf
|
|
8
|
-
Project-URL: Repository, https://github.com/drabjay/pypaf.git
|
|
9
|
-
Project-URL: Issues, https://github.com/drabjay/paf/issues
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.8
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE.txt
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
'
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
The
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
'
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
'
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
##
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
##
|
|
183
|
-
|
|
184
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyPaf
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Formats the elements of a Royal Mail Postcode Address File entry
|
|
5
|
+
Author-email: John Bard <johnbard@globalnet.co.uk>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/drabjay/pypaf
|
|
8
|
+
Project-URL: Repository, https://github.com/drabjay/pypaf.git
|
|
9
|
+
Project-URL: Issues, https://github.com/drabjay/paf/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE.txt
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pylint; extra == "dev"
|
|
17
|
+
Requires-Dist: pytest; extra == "dev"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# PyPaf
|
|
21
|
+
|
|
22
|
+
Formats the elements of a Royal Mail Postcode Address File entry according to the rules described in the [Royal Mail Programmer's Guide Edition 7, Version 6.2](https://www.poweredbypaf.com/wp-content/uploads/2024/11/Latest-Programmers_guide_Edition-7-Version-6-2.pdf)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
Install it from PyPI:
|
|
27
|
+
|
|
28
|
+
pip install pypaf
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### Formatting
|
|
33
|
+
|
|
34
|
+
May be used to format the PAF Address elements - passed as either a single dictionary or as a series of keyword arguments - as a list of strings:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import paf
|
|
38
|
+
address = paf.Address({
|
|
39
|
+
'building_name': "1-2",
|
|
40
|
+
'thoroughfare_name': "NURSERY",
|
|
41
|
+
'thoroughfare_descriptor': "LANE",
|
|
42
|
+
'dependent_locality': "PENN",
|
|
43
|
+
'post_town': "HIGH WYCOMBE",
|
|
44
|
+
'postcode': "HP10 8LS"
|
|
45
|
+
})
|
|
46
|
+
address.as_list() # or list(address)
|
|
47
|
+
|
|
48
|
+
['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or as a tuple of strings:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import paf
|
|
55
|
+
address = paf.Address(
|
|
56
|
+
building_name="1-2",
|
|
57
|
+
thoroughfare_name="NURSERY",
|
|
58
|
+
thoroughfare_descriptor="LANE",
|
|
59
|
+
dependent_locality="PENN",
|
|
60
|
+
post_town="HIGH WYCOMBE",
|
|
61
|
+
postcode="HP10 8LS"
|
|
62
|
+
)
|
|
63
|
+
address.as_tuple() # or tuple(address)
|
|
64
|
+
|
|
65
|
+
('1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS')
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or as a single string:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import paf
|
|
72
|
+
address = paf.Address({
|
|
73
|
+
'building_name': "1-2",
|
|
74
|
+
'thoroughfare_name': "NURSERY",
|
|
75
|
+
'thoroughfare_descriptor': "LANE",
|
|
76
|
+
'dependent_locality': "PENN",
|
|
77
|
+
'post_town': "HIGH WYCOMBE",
|
|
78
|
+
'postcode': "HP10 8LS"
|
|
79
|
+
})
|
|
80
|
+
address.as_str() # or str(address)
|
|
81
|
+
|
|
82
|
+
'1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Or as a dictionary:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import paf
|
|
89
|
+
address = paf.Address(
|
|
90
|
+
building_name="1-2",
|
|
91
|
+
thoroughfare_name="NURSERY",
|
|
92
|
+
thoroughfare_descriptor="LANE",
|
|
93
|
+
dependent_locality="PENN",
|
|
94
|
+
post_town="HIGH WYCOMBE",
|
|
95
|
+
postcode="HP10 8LS"
|
|
96
|
+
)
|
|
97
|
+
address.as_dict()
|
|
98
|
+
|
|
99
|
+
{
|
|
100
|
+
'line_1': "1-2 NURSERY LANE",
|
|
101
|
+
'line_2': "PENN",
|
|
102
|
+
'post_town': "HIGH WYCOMBE",
|
|
103
|
+
'postcode': "HP10 8LS"
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Premises Attributes
|
|
108
|
+
|
|
109
|
+
The `sub_building_name`, `building_name` and `building_number` supplied in the source PAF Address elements need to be parsed according Programmer's Guide rules in order to correctly identify the premises elements of the address.
|
|
110
|
+
|
|
111
|
+
The Address class includes a parsed premises dictionary that contains key-values that may be used to identify the premises within the thoroughfare and the sub-premises within the premises.
|
|
112
|
+
|
|
113
|
+
The parsing decomposes the premises and sub-premises to its constituent parts:
|
|
114
|
+
|
|
115
|
+
| Key | Notes |
|
|
116
|
+
| ------------------- | ----------- |
|
|
117
|
+
| premises_type | If it is of a known type e.g. BLOCK, BUILDING |
|
|
118
|
+
| premises_number | Building number or leading digits of building name |
|
|
119
|
+
| premises_suffix | Non-numeric characters following leading digits of building name |
|
|
120
|
+
| premises_name | Building name, if it cannot be decomposed |
|
|
121
|
+
| sub_premises_type | If it is of a known type e.g. FLAT, UNIT |
|
|
122
|
+
| sub_premises_number | Leading digits of sub-building name |
|
|
123
|
+
| sub_premises_suffix | Non-numeric characters following leading digits of sub-building name |
|
|
124
|
+
| sub_premises_name | Sub-building name, if it cannot be decomposed |
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
import paf
|
|
128
|
+
self.address = paf.Address({
|
|
129
|
+
'sub_building_name': "FLAT 2B",
|
|
130
|
+
'building_name': "THE TOWER",
|
|
131
|
+
'building_number': "27",
|
|
132
|
+
'thoroughfare_name': "JOHN",
|
|
133
|
+
'thoroughfare_descriptor': "STREET",
|
|
134
|
+
'post_town': "WINCHESTER",
|
|
135
|
+
'postcode': "SO23 9AP"
|
|
136
|
+
})
|
|
137
|
+
address.premises()
|
|
138
|
+
|
|
139
|
+
{
|
|
140
|
+
'premises_number': 27,
|
|
141
|
+
'premises_name': 'THE TOWER',
|
|
142
|
+
'sub_premises_type': 'FLAT',
|
|
143
|
+
'sub_premises_number': 2,
|
|
144
|
+
'sub_premises_suffix': 'B',
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
If there are no `sub_building` or `building` elements supplied the `organisation_name` or `po_box_number` elements will be used populate the premises elements, where available.
|
|
149
|
+
|
|
150
|
+
If there is no `sub_building_name` element and the `dependent_thoroughfare` elements are populated the `building` elements will be used to populate the `sub_premises` elements and the `dependent_thoroughfare` elements the `premises` elements.
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
import paf
|
|
154
|
+
self.address = paf.Address(
|
|
155
|
+
building_name="1A",
|
|
156
|
+
dependent_thoroughfare_name="SEASTONE",
|
|
157
|
+
dependent_thoroughfare_descriptor="COURT",
|
|
158
|
+
thoroughfare_name="STATION",
|
|
159
|
+
thoroughfare_descriptor="ROAD",
|
|
160
|
+
post_town="HOLT",
|
|
161
|
+
postcode="NR25 7HG"
|
|
162
|
+
)
|
|
163
|
+
address.premises()
|
|
164
|
+
|
|
165
|
+
{
|
|
166
|
+
'premises_name': 'SEASTONE COURT',
|
|
167
|
+
'sub_premises_number': 1,
|
|
168
|
+
'sub_premises_suffix': 'A'
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Development
|
|
173
|
+
|
|
174
|
+
After checking out the repo, run `pytest` to run the tests.
|
|
175
|
+
|
|
176
|
+
To release a new version, update the version number in `version.py`, and then run `python -m build`, which will create a distribution archive. Run `python -m twine upload dist/*`, to upload the distribution archive to [pypi.org](https://pypi.org).
|
|
177
|
+
|
|
178
|
+
## Contributing
|
|
179
|
+
|
|
180
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/drabjay/pypaf. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
The package is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
185
|
+
|
|
186
|
+
## Code of Conduct
|
|
187
|
+
|
|
188
|
+
Everyone interacting in the PyPaf project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/drabjayc/pypaf/blob/master/CODE_OF_CONDUCT.md).
|
|
@@ -18,12 +18,29 @@ Homepage = "https://github.com/drabjay/pypaf"
|
|
|
18
18
|
Repository = "https://github.com/drabjay/pypaf.git"
|
|
19
19
|
Issues = "https://github.com/drabjay/paf/issues"
|
|
20
20
|
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
dev = [
|
|
23
|
+
"pylint",
|
|
24
|
+
"pytest",
|
|
25
|
+
]
|
|
26
|
+
|
|
21
27
|
[build-system]
|
|
22
28
|
requires = ["setuptools >= 61.0"]
|
|
23
29
|
build-backend = "setuptools.build_meta"
|
|
24
30
|
|
|
31
|
+
[tool.setuptools]
|
|
32
|
+
package-dir = {"" = "src"}
|
|
33
|
+
|
|
25
34
|
[tool.setuptools.dynamic]
|
|
26
|
-
version = { attr = "paf.__version__" }
|
|
35
|
+
version = { attr = "paf.version.__version__" }
|
|
27
36
|
|
|
28
37
|
[tool.setuptools.packages.find]
|
|
29
38
|
where = ["src"]
|
|
39
|
+
|
|
40
|
+
[tool.pytest.ini_options]
|
|
41
|
+
pythonpath = ["src"]
|
|
42
|
+
testpaths = "tests"
|
|
43
|
+
|
|
44
|
+
[tool.pylint.MASTER]
|
|
45
|
+
init-hook = 'import sys; sys.path.append("src")'
|
|
46
|
+
generated-members = 'premises'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|