diff --git a/bin/swh-revhash b/bin/swh-revhash index c7e2998a131724949f34f883cc1df2ca46d43824..6de0a26a7e8f57fc59acd02d1ebbef1ff1ed5575 100755 --- a/bin/swh-revhash +++ b/bin/swh-revhash @@ -18,8 +18,8 @@ def revhash(revision_raw): """Compute the revision hash. """ - if b'\\n' in revision_raw: # HACK: string have somehow their \n - # expanded to \\n + # HACK: string have somehow their \n expanded to \\n + if b'\\n' in revision_raw: revision_raw = revision_raw.replace(b'\\n', b'\n') h = hashutil.hash_git_data(revision_raw, 'commit') diff --git a/swh/model/model.py b/swh/model/model.py index badac8c6b119f6f30c448f6093de76499754b50a..70559dbbf685cfdf0240e5302dd40cfc0205c372 100644 --- a/swh/model/model.py +++ b/swh/model/model.py @@ -26,7 +26,7 @@ class BaseModel: that are suitable for JSON/msgpack-like formats.""" def to_dict(self): - """Wrapper of `attr.asdict` that can be overriden by subclasses + """Wrapper of `attr.asdict` that can be overridden by subclasses that have special handling of some of the fields.""" return attr.asdict(self) @@ -352,7 +352,7 @@ class Content(BaseModel): @reason.validator def check_reason(self, attribute, value): - """Checks the reason is full iff status != absent.""" + """Checks the reason is full if status != absent.""" assert self.reason == value if self.status == 'absent' and value is None: raise ValueError('Must provide a reason if content is absent.')