Comments (7)
Okay, this looks like a good idea.
I just have to think, where to put the parsing code? Do you think, it would be more meaningful to put it in a complex loop to Cache
class? Or something like from_html
method in a new Waypoint
class + a simpler loop during the cache loading? It is kind of philosophical question...
from pycaching.
Had some trouble rebasing the my branch. My initial thought was that yet another class would be a bit of an overkill but after trying to implement this it might be better to have a class
instead of a namedtuple
. The parsing loop is a bit tricky since two lines need to be parsed for each entry, I would definitely split the parsing from the main load()
method since it is complex enough as it is.
This first suggestion is how I personally would do it, a function returning a dict is ok since it doesn't need any persistent state stored in Cache
object but it breaks the coding style a bit.
A separate class might be the best solution?
from pycaching.
First of all, please unify the naming. I think Waypoint
is better than AdditionalLocation
, because it is brief and straightforward. Regarding the naming – there are also some misuses of "waypoint" word in the docstrings, it would be great to update them to something like "GC codes", "waypoint codes" or something similar.
Yes, the function returning a dict is a good solution, but current code location is really unfortunate. I would prefer creating a new class (Waypoint
) with a class method parsing the waypoints into dict (exactly like you did). Something in style of cache.Size.from_string
, but returning a dict of instances. In the final, the Waypoint
class would be just smarter namedtuple
with one class method.
from pycaching.
Ok, I'll look into it during the weekend.
from pycaching.
I've done the changes you suggested and changed waypoint
-> GC code
in cache.py. Is this what you intended or did I misunderstand something?
Should I add a str and repr to the class or is it ok to have a "bare bones" class?
Test aren't included yet.
from pycaching.
It looks good. Just a few more things:
- Documentation for
Cache.waypoints
property – please add a:type
. - Documentation for
Waypoint
class properties – it would be better to have it in the style ofCache
class, because of nicer documentation rendering. - The tests, as you said.
- Optionaly
str
orrepr
methods – I will leave it completly up to you, what do you think it will be more useful.
from pycaching.
I have just merged #59 and will release the features in version 3.5. Thank you Åke and happy easter to you too!
from pycaching.
Related Issues (20)
- pycaching.cache.Cache._from_print_page not working with non-English languages HOT 1
- get_cache(guid=) raising page load error HOT 1
- No attribute for getting the name of a cache HOT 1
- I'm not sure how to translate a cache.Type value into a str. HOT 1
- Access Geocaching Messaging Feature HOT 1
- What type does cache.load_logbook() return and how do I turn it into a dict? HOT 3
- No current way to get the raw HTML cache description HOT 5
- Get all the images from a cache's image gallery
- Delete or Edit Log Posts HOT 1
- pycaching.geocaching.search() function not working properly HOT 13
- advanced_search() returning unexpected results when searching for a string HOT 9
- Document release process
- Enable squash merging? HOT 1
- Posting a log isn't possible anymore - maybe related to recent Groudspeak log page change HOT 10
- Unexpected results when searching caches from a point HOT 5
- Docs build is failing HOT 5
- Archive Log Type Can Be 5 or 6 HOT 1
- Cannot process caches with unescaped `&#` in the cache name HOT 5
- Incorrect Point.from_string() parsing
- search always brings me to south america HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycaching.