-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,8 +23,8 @@ def registrationsFromFile(counter, arg): | |
| line = f.readline() | ||
| if not line: break | ||
| numOf, timeOf = registrationsFromLine(counter, line.rstrip()) | ||
| totalNumOf = totalNumOf + numOf | ||
| totalTimeOf = totalTimeOf + timeOf | ||
| totalNumOf += numOf | ||
| totalTimeOf += timeOf | ||
|
Comment on lines
-26
to
+27
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return totalNumOf, totalTimeOf | ||
|
|
||
| # The "main" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,12 +57,9 @@ | |
| def nextOrder(modules, deps, ordered, unordered, fileName): | ||
| order = set() | ||
| for module in unordered: | ||
| isOrd = True | ||
| for (left, right) in deps: | ||
| if module == left: | ||
| if right not in ordered: | ||
| # It's not already ordered, so this is not this order | ||
| isOrd = False | ||
| isOrd = not any(module == left and right not in ordered | ||
| for (left, right) in deps) | ||
|
Comment on lines
-60
to
+62
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| if isOrd: | ||
| order.add(module) | ||
|
|
||
|
|
@@ -81,11 +78,8 @@ def nextOrder(modules, deps, ordered, unordered, fileName): | |
| def nextGeneration(modules, deps, gened, ungened, fileName): | ||
| gen = set() | ||
| for module in ungened: | ||
| isGen = True | ||
| for (left, right) in deps: | ||
| if module == right: | ||
| if left not in gened: | ||
| isGen = False | ||
| isGen = not any(module == right and left not in gened | ||
| for (left, right) in deps) | ||
|
Comment on lines
-84
to
+82
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| if isGen: | ||
| gen.add(module) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -503,9 +503,7 @@ | |
| "ZWE":"716" | ||
| } | ||
|
|
||
| sedoc = {} | ||
| for k in codes: | ||
| sedoc[codes[k]] = k | ||
| sedoc = {codes[k]: k for k in codes} | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines
|
||
|
|
||
| def main(argv): | ||
| a = sys.argv[1] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,15 +62,15 @@ def _encode_i2c(lat,lon,lat_length,lon_length): | |
| else: | ||
| a = lat | ||
| b = lon | ||
|
|
||
| boost = (0,1,4,5,16,17,20,21) | ||
| ret = '' | ||
| for i in range(precision): | ||
| for _ in range(precision): | ||
| ret+=_base32[(boost[a&7]+(boost[b&3]<<1))&0x1F] | ||
| t = a>>3 | ||
| a = b>>2 | ||
| b = t | ||
|
|
||
|
Comment on lines
-65
to
+73
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return ret[::-1] | ||
|
|
||
| def encode(latitude, longitude, precision=12): | ||
|
|
@@ -131,8 +131,8 @@ def _decode_c2i(hashcode): | |
| for i in hashcode: | ||
| t = _base32_map[i] | ||
| if bit_length%2==0: | ||
| lon = lon<<3 | ||
| lat = lat<<2 | ||
| lon <<= 3 | ||
| lat <<= 2 | ||
|
Comment on lines
-134
to
+135
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| lon += (t>>2)&4 | ||
| lat += (t>>2)&2 | ||
| lon += (t>>1)&2 | ||
|
|
@@ -141,18 +141,18 @@ def _decode_c2i(hashcode): | |
| lon_length+=3 | ||
| lat_length+=2 | ||
| else: | ||
| lon = lon<<2 | ||
| lat = lat<<3 | ||
| lon <<= 2 | ||
| lat <<= 3 | ||
| lat += (t>>2)&4 | ||
| lon += (t>>2)&2 | ||
| lat += (t>>1)&2 | ||
| lon += (t>>1)&1 | ||
| lat += t&1 | ||
| lon_length+=2 | ||
| lat_length+=3 | ||
|
|
||
| bit_length+=5 | ||
|
|
||
| return (lat,lon,lat_length,lon_length) | ||
|
|
||
| def decode(hashcode, delta=False): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ def run(self): | |
| #print geohash.bbox("u27") | ||
| i = 0 | ||
| for csv in self.csvs: | ||
| i = i + 1 | ||
| i += 1 | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| place = self.processPlace(csv, i) | ||
| self.csvs[i - 1] = place | ||
| if i == 1001: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines
506-508refactored with the following changes:dict-comprehension)