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

A slash (/) in impact function docstrings break InaSAFE #173

Closed
uniomni opened this issue Jun 5, 2012 · 3 comments
Closed

A slash (/) in impact function docstrings break InaSAFE #173

uniomni opened this issue Jun 5, 2012 · 3 comments

Comments

@uniomni
Copy link
Contributor

uniomni commented Jun 5, 2012

Adding the following to one impact function docstring causes all impact functions to fail:

 Some stats are derived from SP2010_agregat_data_perProvinsin.dbf from
    http://dds.bps.go.id/eng/

The error message is

======================================================================
ERROR: test_filtering_of_impact_functions (__main__.Test_real_plugins)
Impact functions are filtered correctly
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_real_impact_functions.py", line 25, in test_filtering_of_impact_functions
    P = get_admissible_plugins([])
  File "/home/nielso/sandpit/inasafe-dev/impact_functions/core.py", line 463, in get_admissible_plugins
    requirelines = requirements_collect(func)
  File "/home/nielso/sandpit/inasafe-dev/impact_functions/core.py", line 143, in requirements_collect
    requires_lines[-1] = requires_lines[-1][:-1] + doc_line
IndexError: list index out of range
@ghost ghost assigned uniomni Jun 5, 2012
@uniomni
Copy link
Contributor Author

uniomni commented Jun 5, 2012

It appears that the reason it fails is the trailing '/'

@uniomni
Copy link
Contributor Author

uniomni commented Jun 5, 2012

Interestingly, the function requirements_collect in impact_functions/core.py reads

for cnt, line in enumerate(lines):
           
            doc_line = line.strip()
            if len(doc_line) == 0:
                continue

            if join_line and not doc_line.startswith(require_cmd):
                requires_lines[-1] = requires_lines[-1][:-1] + doc_line
            elif doc_line.startswith(require_cmd):
                requires_lines.append(doc_line[len(require_cmd) + 1:])

            join_line = doc_line[-1] == '/'

The documentation of this function states that it'll use the character '' to signify line continuation, so it looks like that
is the intention but that it isn't implemented correctly. Why this works is not clear. Will investigate.

uniomni added a commit that referenced this issue Jun 5, 2012
. Uncommented and verified that all tests and demos still pass
@uniomni
Copy link
Contributor Author

uniomni commented Jun 5, 2012

This was resolved in commit ec7a557

@uniomni uniomni closed this as completed Jun 5, 2012
@uniomni uniomni removed their assignment Nov 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant