Skip to content

Commit

Permalink
Merge pull request #868 from stevenbronson-wk/xpath-datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
austinmatherne-wk committed Sep 21, 2023
2 parents 96e84cb + ab1702a commit 8a882f2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion arelle/FunctionUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def nodeArg(xc, args, i, type, missingArgFallback=None, emptyFallback=None):
return item


def testTypeCompatiblity(
def testTypeCompatibility(
xc: XPathContext,
p: FormulaToken,
op: str,
Expand Down
2 changes: 1 addition & 1 deletion arelle/FunctionXs.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def anyAtomicType(xc, p, source):
raise xsFunctionNotAvailable()

def dateTime(xc, p, source):
if isinstance(source,datetime.datetime): return source
if isinstance(source,datetime.datetime) and source.dateOnly is False: return source
return ModelValue.dateTime(source, type=ModelValue.DATETIME, castException=FORG0001)

def dateTimeInstantEnd(xc, p, source):
Expand Down
2 changes: 1 addition & 1 deletion arelle/ModelValue.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def dayTimeDuration(value: Time | datetime.timedelta | str) -> DayTimeDuration:

class DayTimeDuration(datetime.timedelta):
def __new__(cls, days: int, hours: int, minutes: int, seconds: int) -> DayTimeDuration:
dyTm = datetime.timedelta.__new__(cls,days,hours,minutes,seconds)
dyTm = datetime.timedelta.__new__(cls, days=days, hours=hours, minutes=minutes, seconds=seconds)
return dyTm
def dayHrsMinsSecs(self) -> tuple[int, int, int, int]:
days = int(self.days)
Expand Down
14 changes: 7 additions & 7 deletions arelle/formula/XPathContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
ContextItem | None,
ResultStack,
], bool] | None = None
testTypeCompatiblity: Callable[[
testTypeCompatibility: Callable[[
XPathContext,
FormulaToken,
str,
Expand Down Expand Up @@ -183,9 +183,9 @@ def create(
inputXbrlInstance: ModelDocument | None = None,
sourceElement: ModelObject | None = None,
) -> XPathContext:
global boolean, testTypeCompatiblity, Trace
global boolean, testTypeCompatibility, Trace
if boolean is None:
from arelle.FunctionUtil import testTypeCompatiblity
from arelle.FunctionUtil import testTypeCompatibility
from arelle.ModelFormulaObject import Trace
from arelle.FunctionFn import boolean

Expand Down Expand Up @@ -358,8 +358,8 @@ def evaluate(
else:
op1 = s1[0]
op2 = s2[0]
assert testTypeCompatiblity is not None
testTypeCompatiblity(self, p, op, op1, op2)
assert testTypeCompatibility is not None
testTypeCompatibility(self, p, op, op1, op2)
if type(op1) != type(op2) and op in (
'+',
'-',
Expand Down Expand Up @@ -414,10 +414,10 @@ def evaluate(
s1 = self.atomize(p, resultStack.pop()) if len(resultStack) > 0 else []
s2 = self.atomize(p, self.evaluate(p.args, contextItem=contextItem))
result = []
assert testTypeCompatiblity is not None
assert testTypeCompatibility is not None
for op1 in s1:
for op2 in s2:
testTypeCompatiblity(self, p, op, op1, op2)
testTypeCompatibility(self, p, op, op1, op2)
if op == '>=':
result = op1 >= op2
elif op == '>':
Expand Down

0 comments on commit 8a882f2

Please sign in to comment.