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

Localization #57

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Localization #57

wants to merge 17 commits into from

Conversation

mausotog
Copy link
Collaborator

No description provided.

@coveralls
Copy link

Coverage Status

Coverage decreased (-6.2%) to 90.462% when pulling b866ca1 on localization into d44a747 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.678% when pulling 36ace73 on localization into d44a747 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.678% when pulling 5dd5a45 on localization into d44a747 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.678% when pulling 5dd5a45 on localization into d44a747 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.678% when pulling 909734d on localization into d44a747 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.5%) to 92.174% when pulling 6c6ed45 on localization into d44a747 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.5%) to 92.174% when pulling bd0087f on localization into d44a747 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.5%) to 92.219% when pulling 91d2776 on localization into d44a747 on master.

@jlacomis
Copy link
Collaborator

I should add more tests for this.

raise NotImplementedError


class File_C(Component):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can we change this to FileComponent?

self.filename = filename


class Line_C(Component):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

self.lineno = lineno


class Function_C(Component):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

filename: File_C = None,
line_start: int = 0,
line_end: int = 0) -> None:
self.funcname = funcname
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer hidden variables (e.g., self.__funcname) over public variables (e.g., self.funcname). Use the @property decorator to ensure read-only (external) access to the variable.

try:
loc = yaml.load(f)
except KeyError as err:
print('Error when importing', filename, '.', err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? Prefer "foo {}; bar {}".format(x, y).

except KeyError as err:
print('Error when importing', filename, '.', err)
raise IOError
return loc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the type of loc? Unless I've misunderstood, yaml.load(f) should return a dictionary? Does loc not need to be unpacked into a Localization object?

Stores its internal data in a file
"""
with open(filename, "w") as f:
yaml.dump(self, f)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer to dump relevant information to a dictionary rather than dumping the entire object, which may contain irrelevant and/or ephemeral information.

import yaml

VERSION = "1.0"
G = TypeVar('G', bound=Component)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G and S are the same?

granularity: Type[G],
version: str = VERSION) -> None:

self.mapping = mapping
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use hidden variables and properties.

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

Successfully merging this pull request may close these issues.

4 participants