## ~yerinalexey/pcrond

a4cfffb411086d443cdcdeb539a84ef0b551b31a — Luca Vercelli 2 years ago
```clean code
```
```2 files changed, 7 insertions(+), 7 deletions(-)

M pcrond/job.py
M test_scheduler.py
```
`M pcrond/job.py => pcrond/job.py +3 -3`
```@@ 72,7 72,7 @@ class Job(object):
# L = last day
# 15W= last working day before 15th, or the first one after if none
[self.allowed_every_dom, self.allowed_dom, self.allowed_wdom] = self._parse_day_in_month(crontab_lst)
-
+
# Day of week.
# 5L = last friday of the month
# 5#2 = second friday of the month

@@ 170,7 170,7 @@ class Job(object):
# here singletons == [1, 7], ranges == [[2, 5, 3], [10, 11, 1]]
ranges = [range(rng, rng + 1, rng) for rng in ranges if (rng <= rng)] + \
[range(rng, maxval, rng) for rng in ranges if rng > rng] + \
-                     [range(minval, rng + 1, rng) for rng in ranges if rng > rng] \
+                     [range(minval, rng + 1, rng) for rng in ranges if rng > rng]
# here ranges == [range(2, 5, 3), range(10, 11, 1]]
flatlist = singletons + [z for rng in ranges for z in rng]
# here flatlist == [1, 7, 2, 3, 4, 5, 10, 11]

@@ 189,7 189,7 @@ class Job(object):
return ([x for x in singletons if x[-1] != 'w'], ranges)

def only_w(singletons, ranges):
-            return ([x[:-1] for x in singletons if  x[-1] == 'w'], [])
+            return ([x[:-1] for x in singletons if x[-1] == 'w'], [])

[every, dom] = self._parse_common(s, 31, {'l': '-1'}, 1, ignore_w)
if every:

```
`M test_scheduler.py => test_scheduler.py +4 -4`
```@@ 39,12 39,12 @@ class SchedulerTests(unittest.TestCase):
assert job._decode_token("1234", {}) == "1234"
assert job._decode_token("goofy", {'goofy': "1234"}) == "1234"
assert job._decode_token("goofy", {'goofy': 1234}) == 1234
-
+
def test_get_num_wom(self):
job = Job()
-        assert job.get_num_wom(d(2019, 3, 7)) == 1      #first thursday of month
-        assert job.get_num_wom(d(2019, 3, 8)) == 2      #second friday of month
-        assert job.get_num_wom(d(2019, 3, 31)) == 5     #fifth sunday of month
+        assert job.get_num_wom(d(2019, 3, 7)) == 1      # first thursday of month
+        assert job.get_num_wom(d(2019, 3, 8)) == 2      # second friday of month
+        assert job.get_num_wom(d(2019, 3, 31)) == 5     # fifth sunday of month

def test_is_last_wom(self):
job = Job()

```