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.
Files changed (57) hide show
  1. {pypaf-1.0.2/src/PyPaf.egg-info → pypaf-1.0.4}/PKG-INFO +188 -184
  2. {pypaf-1.0.2 → pypaf-1.0.4}/pyproject.toml +18 -1
  3. {pypaf-1.0.2 → pypaf-1.0.4}/setup.cfg +4 -4
  4. {pypaf-1.0.2 → pypaf-1.0.4/src/PyPaf.egg-info}/PKG-INFO +188 -184
  5. {pypaf-1.0.2 → pypaf-1.0.4}/src/PyPaf.egg-info/SOURCES.txt +1 -1
  6. pypaf-1.0.4/src/PyPaf.egg-info/requires.txt +4 -0
  7. pypaf-1.0.4/src/paf/attribute.py +29 -0
  8. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/lineable.py +2 -11
  9. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/__init__.py +54 -4
  10. pypaf-1.0.4/src/paf/premises/attribute.py +25 -0
  11. pypaf-1.0.4/src/paf/premises/building_type.py +29 -0
  12. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/exception.py +2 -2
  13. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/premisable.py +4 -8
  14. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/split.py +2 -2
  15. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/thoroughfare_locality.py +8 -23
  16. pypaf-1.0.4/src/paf/version.py +3 -0
  17. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_6.py +85 -0
  18. pypaf-1.0.2/src/paf/attribute.py +0 -44
  19. pypaf-1.0.2/src/paf/premises/attribute.py +0 -40
  20. pypaf-1.0.2/src/paf/premises/building_type.py +0 -33
  21. pypaf-1.0.2/src/paf/premises/extender.py +0 -23
  22. pypaf-1.0.2/src/paf/version.py +0 -3
  23. {pypaf-1.0.2 → pypaf-1.0.4}/LICENSE.txt +0 -0
  24. {pypaf-1.0.2 → pypaf-1.0.4}/README.md +0 -0
  25. {pypaf-1.0.2 → pypaf-1.0.4}/src/PyPaf.egg-info/dependency_links.txt +0 -0
  26. {pypaf-1.0.2 → pypaf-1.0.4}/src/PyPaf.egg-info/top_level.txt +0 -0
  27. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/__init__.py +0 -0
  28. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/address.py +0 -0
  29. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/immutable.py +0 -0
  30. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/initiator.py +0 -0
  31. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/dependent_premisable.py +0 -0
  32. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/lineable.py +0 -0
  33. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule000.py +0 -0
  34. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule001.py +0 -0
  35. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule010.py +0 -0
  36. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule011.py +0 -0
  37. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule100.py +0 -0
  38. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule101.py +0 -0
  39. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule110.py +0 -0
  40. {pypaf-1.0.2 → pypaf-1.0.4}/src/paf/premises/rule111.py +0 -0
  41. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_empty.py +0 -0
  42. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_exception_i.py +0 -0
  43. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_exception_ii.py +0 -0
  44. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_exception_iii.py +0 -0
  45. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_exception_iv.py +0 -0
  46. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_immutability.py +0 -0
  47. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_kwargs.py +0 -0
  48. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_mainfile.py +0 -0
  49. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_po_box.py +0 -0
  50. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_premises.py +0 -0
  51. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_1.py +0 -0
  52. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_2.py +0 -0
  53. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_3.py +0 -0
  54. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_4.py +0 -0
  55. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_5.py +0 -0
  56. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_7.py +0 -0
  57. {pypaf-1.0.2 → pypaf-1.0.4}/tests/test_rule_x.py +0 -0
@@ -1,184 +1,188 @@
1
- Metadata-Version: 2.2
2
- Name: PyPaf
3
- Version: 1.0.2
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
- # PyPaf
17
-
18
- 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)
19
-
20
- ## Installation
21
-
22
- Install it from PyPI:
23
-
24
- pip install pypaf
25
-
26
- ## Usage
27
-
28
- ### Formatting
29
-
30
- 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:
31
-
32
- ```python
33
- import paf
34
- address = paf.Address({
35
- 'building_name': "1-2",
36
- 'thoroughfare_name': "NURSERY",
37
- 'thoroughfare_descriptor': "LANE",
38
- 'dependent_locality': "PENN",
39
- 'post_town': "HIGH WYCOMBE",
40
- 'postcode': "HP10 8LS"
41
- })
42
- address.as_list() # or list(address)
43
-
44
- ['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
45
- ```
46
-
47
- Or as a tuple of strings:
48
-
49
- ```python
50
- import paf
51
- address = paf.Address(
52
- building_name="1-2",
53
- thoroughfare_name="NURSERY",
54
- thoroughfare_descriptor="LANE",
55
- dependent_locality="PENN",
56
- post_town="HIGH WYCOMBE",
57
- postcode="HP10 8LS"
58
- )
59
- address.as_tuple() # or tuple(address)
60
-
61
- ('1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS')
62
- ```
63
-
64
- Or as a single string:
65
-
66
- ```python
67
- import paf
68
- address = paf.Address({
69
- 'building_name': "1-2",
70
- 'thoroughfare_name': "NURSERY",
71
- 'thoroughfare_descriptor': "LANE",
72
- 'dependent_locality': "PENN",
73
- 'post_town': "HIGH WYCOMBE",
74
- 'postcode': "HP10 8LS"
75
- })
76
- address.as_str() # or str(address)
77
-
78
- '1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
79
- ```
80
-
81
- Or as a dictionary:
82
-
83
- ```python
84
- import paf
85
- address = paf.Address(
86
- building_name="1-2",
87
- thoroughfare_name="NURSERY",
88
- thoroughfare_descriptor="LANE",
89
- dependent_locality="PENN",
90
- post_town="HIGH WYCOMBE",
91
- postcode="HP10 8LS"
92
- )
93
- address.as_dict()
94
-
95
- {
96
- 'line_1': "1-2 NURSERY LANE",
97
- 'line_2': "PENN",
98
- 'post_town': "HIGH WYCOMBE",
99
- 'postcode': "HP10 8LS"
100
- }
101
- ```
102
-
103
- ### Premises Attributes
104
-
105
- 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.
106
-
107
- 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.
108
-
109
- The parsing decomposes the premises and sub-premises to its constituent parts:
110
-
111
- | Key | Notes |
112
- | ------------------- | ----------- |
113
- | premises_type | If it is of a known type e.g. BLOCK, BUILDING |
114
- | premises_number | Building number or leading digits of building name |
115
- | premises_suffix | Non-numeric characters following leading digits of building name |
116
- | premises_name | Building name, if it cannot be decomposed |
117
- | sub_premises_type | If it is of a known type e.g. FLAT, UNIT |
118
- | sub_premises_number | Leading digits of sub-building name |
119
- | sub_premises_suffix | Non-numeric characters following leading digits of sub-building name |
120
- | sub_premises_name | Sub-building name, if it cannot be decomposed |
121
-
122
- ```python
123
- import paf
124
- self.address = paf.Address({
125
- 'sub_building_name': "FLAT 2B",
126
- 'building_name': "THE TOWER",
127
- 'building_number': "27",
128
- 'thoroughfare_name': "JOHN",
129
- 'thoroughfare_descriptor': "STREET",
130
- 'post_town': "WINCHESTER",
131
- 'postcode': "SO23 9AP"
132
- })
133
- address.premises()
134
-
135
- {
136
- 'premises_number': 27,
137
- 'premises_name': 'THE TOWER',
138
- 'sub_premises_type': 'FLAT',
139
- 'sub_premises_number': 2,
140
- 'sub_premises_suffix': 'B',
141
- }
142
- ```
143
-
144
- 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.
145
-
146
- 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.
147
-
148
- ```python
149
- import paf
150
- self.address = paf.Address(
151
- building_name="1A",
152
- dependent_thoroughfare_name="SEASTONE",
153
- dependent_thoroughfare_descriptor="COURT",
154
- thoroughfare_name="STATION",
155
- thoroughfare_descriptor="ROAD",
156
- post_town="HOLT",
157
- postcode="NR25 7HG"
158
- )
159
- address.premises()
160
-
161
- {
162
- 'premises_name': 'SEASTONE COURT',
163
- 'sub_premises_number': 1,
164
- 'sub_premises_suffix': 'A'
165
- }
166
- ```
167
-
168
- ## Development
169
-
170
- After checking out the repo, run `pytest` to run the tests.
171
-
172
- 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).
173
-
174
- ## Contributing
175
-
176
- 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.
177
-
178
- ## License
179
-
180
- The package is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
181
-
182
- ## Code of Conduct
183
-
184
- 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).
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
+