-
Notifications
You must be signed in to change notification settings - Fork 2
/
evidence.py
154 lines (127 loc) · 5.62 KB
/
evidence.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
r""":class:`.Factor`\s used to support :class:`.Fact` findings."""
from dataclasses import dataclass
from typing import ClassVar, Iterator, Optional
from authorityspoke.entities import Entity
from authorityspoke.factors import ContextRegister, Factor
from authorityspoke.facts import Fact
from authorityspoke.formatting import indented, wrapped
@dataclass(frozen=True)
class Exhibit(Factor):
"""
A source of information for use in litigation.
:param form:
a term describing the category of exhibit. For example: testimony,
declaration, document, or recording.
:param statement:
a fact assertion made via the exhibit. For instance, if the exhibit
is a document, this parameter could refer to a statement printed
on the document.
:param statement_attribution:
the :class:`.Entity` that the exhibit imputes the statement to. For
instance, for a signed declaration, this would refer to the person
whose signature appears on the declaration, regardless of any
authentication concerns. The statement_attribution parameter may
appear without the statement parameter, especially if the content
of the statement is irrelevant.
:param name:
a string identifier for the exhibit
:param absent:
if True, indicates that no exhibit meeting the description exists
in the litigation. If the exhibit has merely been rejected as
evidence, use the absent attribute on an :class:`Evidence` object
instead.
:param generic:
if True, indicates that the specific attributes of the exhibit
are irrelevant in the context of the :class:`.Holding` where
the exhibit is being referenced.
.. note
The form parameter may be replaced by a limited
ontology of terms when sufficient example data is available.
"""
form: Optional[str] = None
statement: Optional[Fact] = None
statement_attribution: Optional[Entity] = None
name: Optional[str] = None
absent: bool = False
generic: bool = False
context_factor_names: ClassVar = ("statement", "statement_attribution")
def _means_if_concrete(
self, other: Factor, context: Optional[ContextRegister] = None
) -> Iterator[ContextRegister]:
if isinstance(other, self.__class__) and self.form == other.form:
yield from super()._means_if_concrete(other, context)
def _implies_if_concrete(
self, other: Factor, context: Optional[ContextRegister] = None
) -> Iterator[ContextRegister]:
if isinstance(other, self.__class__) and (
self.form == other.form or other.form is None
):
yield from super()._implies_if_concrete(other, context)
@property
def short_string(self):
"""
Return string representation of the object without line breaks.
"""
string = (
f'{("attributed to " + self.statement_attribution.short_string + ", ") if self.statement_attribution else ""}'
+ f'{("asserting " + self.statement.short_string + ", ") if self.statement else ""}'
)
string = super().__str__().format(string)
return string.replace("Exhibit", self.form or "exhibit").strip()
def __str__(self):
text = ""
if self.form:
text += f"in the FORM {self.form}"
if self.statement:
text += f"\n" + indented(f"WITH THE ASSERTION:")
factor_text = indented(str(self.statement), tabs=2)
text += f"\n{str(factor_text)},"
if self.statement_attribution:
text += f"\n" + indented(f"ATTRIBUTED TO {str(self.statement_attribution)}")
return super().__str__().format(text)
@dataclass(frozen=True)
class Evidence(Factor):
"""
An :class:`Exhibit` admitted by a court to aid a factual determination.
:param exhibit:
the thing that is being used to aid a factual determination
:param to_effect:
the :class:`.Fact` finding that would be supported by the evidence.
If the Fact object includes a non-null standard_of_proof attribute, it
indicates that that the evidence would support a factual finding by
that standard of proof.
:param name:
a string identifier
:param absent:
if True, indicates that no evidence meeting the description has been
admitted, regardless of whether a corresponding :class:`Exhibit` has
been presented
:param generic:
if True, indicates that the specific attributes of the evidence
are irrelevant in the context of the :class:`.Holding` where
the evidence is being referenced.
"""
exhibit: Optional[Exhibit] = None
to_effect: Optional[Fact] = None
name: Optional[str] = None
absent: bool = False
generic: bool = False
context_factor_names: ClassVar = ("exhibit", "to_effect")
def __str__(self):
text = ""
if self.exhibit:
text += f"\n" + indented("OF:")
factor_text = indented(str(self.exhibit), tabs=2)
text += f"\n{str(factor_text)}"
if self.to_effect:
text += f"\n" + indented("INDICATING:")
factor_text = indented(str(self.to_effect), tabs=2)
text += f"\n{str(factor_text)}"
return super().__str__().format(text).strip()
@property
def short_string(self):
string = (
f'{("of " + self.exhibit.short_string + ", ") if self.exhibit else ""}'
+ f'{("which supports " + self.to_effect.short_string) if self.to_effect else ""}'
)
return super().__str__().format(string).strip().replace("Evidence", "evidence")