PyPaf 0.1.0__tar.gz → 0.2.0__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 (38) hide show
  1. {pypaf-0.1.0/src/PyPaf.egg-info → pypaf-0.2.0}/PKG-INFO +4 -4
  2. {pypaf-0.1.0 → pypaf-0.2.0}/README.md +3 -3
  3. {pypaf-0.1.0 → pypaf-0.2.0/src/PyPaf.egg-info}/PKG-INFO +4 -4
  4. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/paf.py +12 -4
  5. pypaf-0.2.0/src/paf/version.py +3 -0
  6. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_exception_i.py +1 -1
  7. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_exception_ii.py +1 -1
  8. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_exception_iii.py +1 -1
  9. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_mainfile.py +1 -1
  10. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_po_box.py +1 -1
  11. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_rule_1.py +1 -1
  12. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_rule_2.py +1 -1
  13. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_rule_3.py +4 -4
  14. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_rule_4.py +1 -1
  15. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_rule_5.py +2 -2
  16. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_rule_6.py +3 -3
  17. {pypaf-0.1.0 → pypaf-0.2.0}/tests/test_rule_7.py +2 -2
  18. pypaf-0.1.0/src/paf/version.py +0 -3
  19. {pypaf-0.1.0 → pypaf-0.2.0}/LICENSE.txt +0 -0
  20. {pypaf-0.1.0 → pypaf-0.2.0}/pyproject.toml +0 -0
  21. {pypaf-0.1.0 → pypaf-0.2.0}/setup.cfg +0 -0
  22. {pypaf-0.1.0 → pypaf-0.2.0}/src/PyPaf.egg-info/SOURCES.txt +0 -0
  23. {pypaf-0.1.0 → pypaf-0.2.0}/src/PyPaf.egg-info/dependency_links.txt +0 -0
  24. {pypaf-0.1.0 → pypaf-0.2.0}/src/PyPaf.egg-info/top_level.txt +0 -0
  25. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/__init__.py +0 -0
  26. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/attribute.py +0 -0
  27. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/lineable.py +0 -0
  28. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/__init__.py +0 -0
  29. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/common.py +0 -0
  30. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/rule000.py +0 -0
  31. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/rule001.py +0 -0
  32. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/rule010.py +0 -0
  33. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/rule011.py +0 -0
  34. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/rule101.py +0 -0
  35. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/rule110.py +0 -0
  36. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises/rule111.py +0 -0
  37. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/premises_extender.py +0 -0
  38. {pypaf-0.1.0 → pypaf-0.2.0}/src/paf/thoroughfare_locality.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PyPaf
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Formats the elements of a Royal Mail Postcode Address File entry
5
5
  Author-email: John Bard <johnbard@globalnet.co.uk>
6
6
  License: MIT
@@ -21,7 +21,7 @@ Formats the elements of a Royal Mail Postcode Address File entry according to th
21
21
 
22
22
  Install it from PyPI:
23
23
 
24
- $ pip install pypaf
24
+ pip install pypaf
25
25
 
26
26
  ## Usage
27
27
 
@@ -37,7 +37,7 @@ paf = Paf({
37
37
  'post_town': "HIGH WYCOMBE",
38
38
  'postcode': "HP10 8LS"
39
39
  })
40
- paf.list()
40
+ paf.list() # or list(paf)
41
41
 
42
42
  ['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
43
43
  ```
@@ -54,7 +54,7 @@ paf = Paf({
54
54
  'post_town': "HIGH WYCOMBE",
55
55
  'postcode': "HP10 8LS"
56
56
  })
57
- str(paf)
57
+ paf.str() # or str(paf)
58
58
 
59
59
  '1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
60
60
  ```
@@ -6,7 +6,7 @@ Formats the elements of a Royal Mail Postcode Address File entry according to th
6
6
 
7
7
  Install it from PyPI:
8
8
 
9
- $ pip install pypaf
9
+ pip install pypaf
10
10
 
11
11
  ## Usage
12
12
 
@@ -22,7 +22,7 @@ paf = Paf({
22
22
  'post_town': "HIGH WYCOMBE",
23
23
  'postcode': "HP10 8LS"
24
24
  })
25
- paf.list()
25
+ paf.list() # or list(paf)
26
26
 
27
27
  ['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
28
28
  ```
@@ -39,7 +39,7 @@ paf = Paf({
39
39
  'post_town': "HIGH WYCOMBE",
40
40
  'postcode': "HP10 8LS"
41
41
  })
42
- str(paf)
42
+ paf.str() # or str(paf)
43
43
 
44
44
  '1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
45
45
  ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PyPaf
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Formats the elements of a Royal Mail Postcode Address File entry
5
5
  Author-email: John Bard <johnbard@globalnet.co.uk>
6
6
  License: MIT
@@ -21,7 +21,7 @@ Formats the elements of a Royal Mail Postcode Address File entry according to th
21
21
 
22
22
  Install it from PyPI:
23
23
 
24
- $ pip install pypaf
24
+ pip install pypaf
25
25
 
26
26
  ## Usage
27
27
 
@@ -37,7 +37,7 @@ paf = Paf({
37
37
  'post_town': "HIGH WYCOMBE",
38
38
  'postcode': "HP10 8LS"
39
39
  })
40
- paf.list()
40
+ paf.list() # or list(paf)
41
41
 
42
42
  ['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
43
43
  ```
@@ -54,7 +54,7 @@ paf = Paf({
54
54
  'post_town': "HIGH WYCOMBE",
55
55
  'postcode': "HP10 8LS"
56
56
  })
57
- str(paf)
57
+ paf.str() # or str(paf)
58
58
 
59
59
  '1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
60
60
  ```
@@ -20,14 +20,22 @@ class Paf(LineableMixin):
20
20
  return self.__class__.__name__ + '(' + str(args) + ')'
21
21
 
22
22
  def __str__(self):
23
- """Return Paf as string"""
23
+ """Return Paf as string representation"""
24
24
  line = ', '.join(self.lines)
25
25
  if self.is_empty('postcode'):
26
26
  return line
27
27
  return '. '.join([line] + [getattr(self, 'postcode')])
28
28
 
29
+ def __iter__(self):
30
+ """Return Paf as iterable"""
31
+ yield from self.lines.__iter__()
32
+ if not self.is_empty('postcode'):
33
+ yield from [getattr(self, 'postcode')].__iter__()
34
+
35
+ def str(self):
36
+ """Return Paf as string"""
37
+ return str(self)
38
+
29
39
  def list(self):
30
40
  """Return Paf as list of strings"""
31
- if self.is_empty('postcode'):
32
- return self.lines
33
- return self.lines + [getattr(self, 'postcode')]
41
+ return list(self)
@@ -0,0 +1,3 @@
1
+ """Version"""
2
+
3
+ __version__ = '0.2.0'
@@ -25,7 +25,7 @@ class TestExceptionI(unittest.TestCase):
25
25
  def test_string(self):
26
26
  """Test conversion to a string"""
27
27
  address = "1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS"
28
- self.assertEqual(str(self.paf), address, "Incorrect Exception I string format")
28
+ self.assertEqual(self.paf.str(), address, "Incorrect Exception I string format")
29
29
 
30
30
  if __name__ == '__main__':
31
31
  unittest.main()
@@ -23,7 +23,7 @@ class TestExceptionII(unittest.TestCase):
23
23
  def test_string(self):
24
24
  """Test conversion to a string"""
25
25
  address = "12A UPPERKIRKGATE, ABERDEEN. AB10 1BA"
26
- self.assertEqual(str(self.paf), address, "Incorrect Exception II string format")
26
+ self.assertEqual(self.paf.str(), address, "Incorrect Exception II string format")
27
27
 
28
28
  if __name__ == '__main__':
29
29
  unittest.main()
@@ -24,7 +24,7 @@ class TestExceptionIII(unittest.TestCase):
24
24
  def test_string(self):
25
25
  """Test conversion to a string"""
26
26
  address = "K PORTLAND ROAD, DORKING. RH4 1EW"
27
- self.assertEqual(str(self.paf), address, "Incorrect Exception III string format")
27
+ self.assertEqual(self.paf.str(), address, "Incorrect Exception III string format")
28
28
 
29
29
  if __name__ == '__main__':
30
30
  unittest.main()
@@ -49,7 +49,7 @@ class TestMainfile(unittest.TestCase):
49
49
  "GLASGOW. "
50
50
  "G72 0UP"
51
51
  )
52
- self.assertEqual(str(self.paf), address, "Incorrect Mainfile string format")
52
+ self.assertEqual(self.paf.str(), address, "Incorrect Mainfile string format")
53
53
 
54
54
  if __name__ == '__main__':
55
55
  unittest.main()
@@ -22,7 +22,7 @@ class TestPoBox(unittest.TestCase):
22
22
  def test_string(self):
23
23
  """Test conversion to a string"""
24
24
  address = "PO BOX 61, FAREHAM. PO14 1UX"
25
- self.assertEqual(str(self.paf), address, "Incorrect PO Box string format")
25
+ self.assertEqual(self.paf.str(), address, "Incorrect PO Box string format")
26
26
 
27
27
  if __name__ == '__main__':
28
28
  unittest.main()
@@ -23,7 +23,7 @@ class TestRule1(unittest.TestCase):
23
23
  def test_string(self):
24
24
  """Test conversion to a string"""
25
25
  address = "LEDA ENGINEERING LTD, APPLEFORD, ABINGDON. OX14 4PG"
26
- self.assertEqual(str(self.paf), address, "Incorrect Rule 1 string format")
26
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 1 string format")
27
27
 
28
28
  if __name__ == '__main__':
29
29
  unittest.main()
@@ -24,7 +24,7 @@ class TestRule2(unittest.TestCase):
24
24
  def test_string(self):
25
25
  """Test conversion to a string"""
26
26
  address = "1 ACACIA AVENUE, ABINGDON. OX14 4PG"
27
- self.assertEqual(str(self.paf), address, "Incorrect Rule 2 string format")
27
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 2 string format")
28
28
 
29
29
  if __name__ == '__main__':
30
30
  unittest.main()
@@ -26,7 +26,7 @@ class TestRule3WithBuildingName(unittest.TestCase):
26
26
  def test_string(self):
27
27
  """Test conversion to a string"""
28
28
  address = "1A SEASTONE COURT, STATION ROAD, HOLT. NR25 7HG"
29
- self.assertEqual(str(self.paf), address, "Incorrect Rule 3 with building string format")
29
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 3 with building string format")
30
30
 
31
31
  class TestRule3WithoutBuildingName(unittest.TestCase):
32
32
  """Test Paf Rule 3 without Building Name Exception"""
@@ -49,7 +49,7 @@ class TestRule3WithoutBuildingName(unittest.TestCase):
49
49
  def test_string(self):
50
50
  """Test conversion to a string"""
51
51
  address = "THE MANOR, UPPER ROAD, HORLEY. RH6 0HP"
52
- self.assertEqual(str(self.paf), address, "Incorrect Rule 3 without building string format")
52
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 3 without building string format")
53
53
 
54
54
  class TestRule3WithSplit(unittest.TestCase):
55
55
  """Test Paf Rule 3 with Split Exception"""
@@ -79,7 +79,7 @@ class TestRule3WithSplit(unittest.TestCase):
79
79
  def test_string(self):
80
80
  """Test conversion to a string"""
81
81
  address = "S D ALCOTT FLORISTS, FLOWER HOUSE, 189A PYE GREEN ROAD, CANNOCK. WS11 5SB"
82
- self.assertEqual(str(self.paf), address, "Incorrect Rule 3 with split string format")
82
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 3 with split string format")
83
83
 
84
84
  class TestRule3WithoutSplit(unittest.TestCase):
85
85
  """Test Paf Rule 3 without Split Exception"""
@@ -103,7 +103,7 @@ class TestRule3WithoutSplit(unittest.TestCase):
103
103
  def test_string(self):
104
104
  """Test conversion to a string"""
105
105
  address = "JAMES VILLA HOLIDAYS, CENTRE 30, ST LAURENCE AVENUE, GRAFTON. ME16 0LP"
106
- self.assertEqual(str(self.paf), address, "Incorrect Rule 3 without split string format")
106
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 3 without split string format")
107
107
 
108
108
  if __name__ == '__main__':
109
109
  unittest.main()
@@ -25,7 +25,7 @@ class TestRule4(unittest.TestCase):
25
25
  def test_string(self):
26
26
  """Test conversion to a string"""
27
27
  address = "VICTORIA HOUSE, 15 THE STREET, CHRISTCHURCH. BH23 6AA"
28
- self.assertEqual(str(self.paf), address, "Incorrect Rule 4 string format")
28
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 4 string format")
29
29
 
30
30
  if __name__ == '__main__':
31
31
  unittest.main()
@@ -25,7 +25,7 @@ class TestRule5(unittest.TestCase):
25
25
  def test_string(self):
26
26
  """Test conversion to a string"""
27
27
  address = "FLAT 1, 12 LIME TREE AVENUE, BRISTOL. BS8 4AB"
28
- self.assertEqual(str(self.paf), address, "Incorrect Rule 5 string format")
28
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 5 string format")
29
29
 
30
30
  class TestRule5WithConcatenation(unittest.TestCase):
31
31
  """Test Paf Rule 5 with Concatenation"""
@@ -51,7 +51,7 @@ class TestRule5WithConcatenation(unittest.TestCase):
51
51
  def test_string(self):
52
52
  """Test conversion to a string"""
53
53
  address = "12A HIGH STREET NORTH, COOMBE BISSETT, SALISBURY. SP5 4NA"
54
- self.assertEqual(str(self.paf), address, "Incorrect Rule 5 with concatenate string format")
54
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 5 with concatenate string format")
55
55
 
56
56
  if __name__ == '__main__':
57
57
  unittest.main()
@@ -25,7 +25,7 @@ class TestRule6WithSubBuildingName(unittest.TestCase):
25
25
  def test_string(self):
26
26
  """Test conversion to a string"""
27
27
  address = "10B BARRY JACKSON TOWER, ESTONE WALK, BIRMINGHAM. B6 5BA"
28
- self.assertEqual(str(self.paf), address, "Incorrect Rule 6 with sub-building string format")
28
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 6 w/ sub-building string format")
29
29
 
30
30
  class TestRule6WithBuildingName(unittest.TestCase):
31
31
  """Test Paf Rule 6 with Building Name Exception"""
@@ -49,7 +49,7 @@ class TestRule6WithBuildingName(unittest.TestCase):
49
49
  def test_string(self):
50
50
  """Test conversion to a string"""
51
51
  address = "CARETAKERS FLAT, 110-114 HIGH STREET WEST, BRISTOL. BS1 2AW"
52
- self.assertEqual(str(self.paf), address, "Incorrect Rule 6 with building string format")
52
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 6 with building string format")
53
53
 
54
54
  class TestRule6(unittest.TestCase):
55
55
  """Test Paf Rule 6 without Exception"""
@@ -73,7 +73,7 @@ class TestRule6(unittest.TestCase):
73
73
  def test_string(self):
74
74
  """Test conversion to a string"""
75
75
  address = "STABLES FLAT, THE MANOR, UPPER HILL, HORLEY. RH6 0HP"
76
- self.assertEqual(str(self.paf), address, "Incorrect Rule 6 string format")
76
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 6 string format")
77
77
 
78
78
  if __name__ == '__main__':
79
79
  unittest.main()
@@ -26,7 +26,7 @@ class TestRule7WithSubBuildingName(unittest.TestCase):
26
26
  def test_string(self):
27
27
  """Test conversion to a string"""
28
28
  address = "2B THE TOWER, 27 JOHN STREET, WINCHESTER. SO23 9AP"
29
- self.assertEqual(str(self.paf), address, "Incorrect Rule 7 with sub-building string format")
29
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 w/ sub-building string format")
30
30
 
31
31
  class TestRule7(unittest.TestCase):
32
32
  """Test Paf Rule 7 without Exception"""
@@ -51,7 +51,7 @@ class TestRule7(unittest.TestCase):
51
51
  def test_string(self):
52
52
  """Test conversion to a string"""
53
53
  address = "BASEMENT FLAT, VICTORIA HOUSE, 15 THE STREET, CORYTON. BP23 6AA"
54
- self.assertEqual(str(self.paf), address, "Incorrect Rule 7 string format")
54
+ self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 string format")
55
55
 
56
56
  if __name__ == '__main__':
57
57
  unittest.main()
@@ -1,3 +0,0 @@
1
- """Version"""
2
-
3
- __version__ = '0.1.0'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes