Skip to content

Commit

Permalink
bump version number to 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Dec 7, 2019
1 parent c6a4087 commit 285c349
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion authorityspoke/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from .rules import Rule
from .io.dump import to_dict, to_json

__version__ = "0.2.0"
__version__ = "0.3.0"
1 change: 1 addition & 0 deletions authorityspoke/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def _get_sections_from_relative_path(self, docpath: str) -> Optional[BeautifulSo
def cal_href(docpath, href):
"""
Test if XML element is labeled as the text of the section in ``docpath``.
Uses `California statute XML format <http://leginfo.legislature.ca.gov/>`_.
"""
section = docpath.split("/")[1].strip("s")
Expand Down
4 changes: 3 additions & 1 deletion authorityspoke/factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
from typing import Any, Callable, Dict, Iterable, Iterator, List
from typing import Optional, Sequence, Tuple, Union

from authorityspoke.enactments import Enactment
from anchorpoint.textselectors import TextQuoteSelector

from authorityspoke.enactments import Enactment


logger = logging.getLogger(__name__)


Expand Down
16 changes: 8 additions & 8 deletions authorityspoke/io/api_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@

def make_spec() -> APISpec:
"""Generate specification for data used to create AuthoritySpoke objects."""
spec = APISpec(
holding_spec = APISpec(
title="AuthoritySpoke Holding API",
version="0.1.0",
openapi_version="3.0.2",
info=dict(description="An interface for annotating judicial holdings"),
plugins=[MarshmallowPlugin()],
)

spec.components.schema("Holding", schema=HoldingSchema)
spec.components.schema("Fact", schema=FactSchema)
spec.components.schema("Evidence", schema=EvidenceSchema)
spec.components.schema("Allegation", schema=AllegationSchema)
holding_spec.components.schema("Holding", schema=HoldingSchema)
holding_spec.components.schema("Fact", schema=FactSchema)
holding_spec.components.schema("Evidence", schema=EvidenceSchema)
holding_spec.components.schema("Allegation", schema=AllegationSchema)

factor_names = ["Fact", "Exhibit", "Evidence", "Pleading", "Allegation"]
factor_options = []

for factor_name in factor_names:
factor_options.append({"$ref": f"#/components/schemas/{factor_name}"})

del spec.components._schemas["Factor"]
del holding_spec.components._schemas["Factor"]

spec.components.schema(
holding_spec.components.schema(
"Factor", {"oneOf": factor_options, "discriminator": {"propertyName": "type"},},
)
return spec
return holding_spec


spec = make_spec()
9 changes: 3 additions & 6 deletions authorityspoke/io/text_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@


def expand_shorthand(obj: Dict) -> Dict[str, Any]:
"""
Traverse dict and expand every kind of pre-loading shorthand.
"""
"""Traverse dict and expand every kind of pre-loading shorthand."""
return nesting.walk_tree_and_modify(
obj=obj, func=expand_node_shorthand, ignore=("predicate")
)
Expand Down Expand Up @@ -52,6 +50,7 @@ def expand_shorthand_mentioned(obj: Dict) -> Dict:


def collapse_known_factors(obj: Dict):
"""Replace all names of known context factors with placeholder strings."""
if obj.get("context_factors"):
for factor in obj["context_factors"]:
if isinstance(factor, str):
Expand All @@ -68,9 +67,7 @@ def collapse_known_factors(obj: Dict):
def collapse_name_in_content(
content: str, name: Optional[str], placeholder: str = "{}"
):
"""
Replace name with placeholder to show it is referenced in context_factors.
"""
"""Replace name with placeholder to show it is referenced in context_factors."""
content = content.replace(name, placeholder, 1)
double_placeholder = placeholder[0] + placeholder + placeholder[1]
if double_placeholder in content:
Expand Down
3 changes: 2 additions & 1 deletion authorityspoke/opinions.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def explanations_contradiction(
yield from other.explanations_contradiction(self, context=context)
else:
raise TypeError(
f"'Contradicts' test not implemented for types {self.__class__} and {other.__class__}."
f"'Contradicts' test not implemented for types "
+ f"{self.__class__} and {other.__class__}."
)

def explain_implication(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="AuthoritySpoke",
version="0.2.0",
version="0.3.0",
author="Matt Carey",
author_email="matt@authorityspoke.com",
description="tool for managing structured data about legal authority",
Expand Down
6 changes: 1 addition & 5 deletions tests/test_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

import pytest

from anchorpoint.textselectors import TextQuoteSelector, TextPositionSelector

from authorityspoke.codes import Code
from authorityspoke.enactments import Enactment, consolidate_enactments
from authorityspoke.io import loaders, readers, dump
from anchorpoint.textselectors import TextPositionSelector


class TestCodes:
Expand Down

0 comments on commit 285c349

Please sign in to comment.