-
Notifications
You must be signed in to change notification settings - Fork 43
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
Make registering same DataDep twice a no-op #88
base: master
Are you sure you want to change the base?
Conversation
Trying to fix issue oxinabox#86 (not sure what I am doing at this point)
Codecov Report
@@ Coverage Diff @@
## master #88 +/- ##
=========================================
+ Coverage 53.5% 53.91% +0.4%
=========================================
Files 12 12
Lines 228 230 +2
=========================================
+ Hits 122 124 +2
Misses 106 106
Continue to review full report at Codecov.
|
@@ -5,6 +5,9 @@ const registry = Dict{String, AbstractDataDep}() | |||
function register(datadep::AbstractDataDep) | |||
name = datadep.name | |||
if haskey(registry, name) | |||
if isequal(datadep, registry[name]) | |||
return registry |
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.
return registry | |
return registry[name] |
Might be a cleaner way to do this, using say:
existing = get(regisitry, name, nothing)
if existing != nothing
if isequal(datadep, existing)
return existing
else
@warning...
end
end
or something like that?
Cool! thanks. I know digging into a new code-base can be tough and I appreciate it. Needs tests. I think |
@oxinabox Is any work remaining on this PR? I need this functionality for my new package. |
Something is wrong if you need this for your package. |
// Returns the URL of dataset
function download(country) {
register(Datadep(country, ...))
...
}
function get(country) {
resource_path = download(country)
...further processing
} There's a single If UPDATE: I've solved the problem by catching the |
recommendation is that If you have a function you call that return the Line 27 in c3a522d
Though in many packages i have that could do that, I |
Trying to fix issue #86 (not sure what I am doing at this point)