-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding OSM licenses; fixing choice creation
- Loading branch information
1 parent
f3d09b6
commit 89918c9
Showing
2 changed files
with
15,011 additions
and
15,003 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,11 +40,11 @@ def add_test_users(self): | |
for n in range(20): | ||
if n < len(named_users): | ||
users.append(UserFactory.create( | ||
**named_users[n], | ||
password='password', | ||
email_verified=True, | ||
last_login=datetime.now(tz=timezone.utc), | ||
is_active=True, | ||
**named_users[n] | ||
)) | ||
else: | ||
users.append(UserFactory.create( | ||
|
@@ -408,15 +408,20 @@ def add_huge_project(self, num_records=4000): | |
) | ||
|
||
spatial_units = [] | ||
choices = [c[0] for c in TYPE_CHOICES] | ||
|
||
with open(os.path.join(os.path.dirname(__file__), | ||
"londondata.txt"), "r") as ins: | ||
for i, geometry in enumerate(ins): | ||
for geometry in ins: | ||
if not geometry.rstrip() or geometry.startswith('#'): | ||
continue | ||
|
||
i = len(spatial_units) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
oliverroick
Author
Member
|
||
if not i < num_records: | ||
break | ||
|
||
name = 'Spatial Unit #{}'.format(i) | ||
type = random.choice([c[0] for c in TYPE_CHOICES]) | ||
type = random.choice(choices) | ||
|
||
spatial_units.append({ | ||
'geometry': GEOSGeometry(geometry), | ||
|
Oops, something went wrong.
Just curious. Would initializing
i
to 0 and then incrementing it be more efficient than checking the array length? Also, since the variable is no longer tied to the loop definition, then it needs a better name likenum_running_records
(ornum_records
and then rename the existing parameter tomax_num_records
).