Skip to content
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

dicts: if foo in bar / else -> try / except #208

Open
yakra opened this issue Feb 25, 2022 · 9 comments
Open

dicts: if foo in bar / else -> try / except #208

yakra opened this issue Feb 25, 2022 · 9 comments

Comments

@yakra
Copy link
Owner

yakra commented Feb 25, 2022

The OP has been replaced with individual comments below that can be hidden as each item is addressed.

@yakra
Copy link
Owner Author

yakra commented Feb 25, 2022

Creating unique names and vertices

if wpt.route.region not in rg_vset_hash:
rg_vset_hash[wpt.route.region] = set()
rg_vset_hash[wpt.route.region].add(self)
else:
rg_vset_hash[wpt.route.region].add(self)

if w.route.region not in rg_vset_hash:
rg_vset_hash[w.route.region] = set()
rg_vset_hash[w.route.region].add(self)
else:
rg_vset_hash[w.route.region].add(self)

@yakra

This comment was marked as off-topic.

@yakra

This comment was marked as off-topic.

@yakra
Copy link
Owner Author

yakra commented Feb 25, 2022

Creating per-traveler stats log entries and augmenting data structure.

if h.systemname in t.system_region_mileages:
t_system_overall = math.fsum(list(t.system_region_mileages[h.systemname].values()))

@yakra
Copy link
Owner Author

yakra commented Feb 25, 2022

Creating per-traveler stats log entries and augmenting data structure.

if h.systemname in t.system_region_mileages and region in t.system_region_mileages[h.systemname]:
system_region_mileage = t.system_region_mileages[h.systemname][region]
csmbr_values.append("('" + h.systemname + "','" + region + "','"
+ t.traveler_name + "','" +
str(system_region_mileage) + "')")

pass

@yakra

This comment was marked as off-topic.

@yakra
Copy link
Owner Author

yakra commented Feb 25, 2022

Writing stats csv files.

if h.systemname in t.system_region_mileages:
sysfile.write(t.traveler_name + ",{0:.2f}".format(math.fsum(list(t.system_region_mileages[h.systemname].values()))))
for region in regions:
if region in t.system_region_mileages[h.systemname]:
sysfile.write(',{0:.2f}'.format(t.system_region_mileages[h.systemname][region]))
else:
sysfile.write(',0')
sysfile.write('\n')

pass, list, except

@yakra

This comment was marked as off-topic.

@yakra

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant