Skip to content

Commit

Permalink
Passes variant info to TupleComp for DataSetInput
Browse files Browse the repository at this point in the history
also removes parenthesis from @lru_cache, see: https://bugs.python.org/issue36772
  • Loading branch information
RoyStegeman committed May 17, 2024
1 parent 9777baf commit 23c5e53
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions validphys2/src/validphys/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __hash__(self):

def __repr__(self):
argvals = ', '.join('%s=%r' % vals for vals in zip(self.argnames(), self.comp_tuple))
return '{}({})'.format(self.__class__.__qualname__, argvals)
return f'{self.__class__.__qualname__}({argvals})'


class PDFDoesNotExist(Exception):
Expand Down Expand Up @@ -344,7 +344,7 @@ def __init__(self, *, name, sys, cfac, frac, weight, custom_group, variant):
self.weight = weight
self.custom_group = custom_group
self.variant = variant
super().__init__(name, sys, cfac, frac, weight, custom_group)
super().__init__(name, sys, cfac, frac, weight, custom_group, variant)

def __str__(self):
return self.name
Expand Down Expand Up @@ -428,7 +428,7 @@ def __init__(self, inputs, threshold):
self.threshold = threshold
super().__init__(self.inputs, self.threshold)

@functools.lru_cache()
@functools.lru_cache
def load(self):
# TODO: Update this when a suitable interace becomes available
from validphys.convolution import central_predictions
Expand Down Expand Up @@ -487,7 +487,7 @@ def __init__(self, *, name, commondata, fkspecs, thspec, cuts, frac=1, op=None,

super().__init__(name, commondata, fkspecs, thspec, cuts, frac, op, weight)

@functools.lru_cache()
@functools.lru_cache
def load_commondata(self):
"""Strips the commondata loading from `load`"""
cd = self.commondata.load()
Expand Down Expand Up @@ -562,7 +562,7 @@ def load_cfactors(self):

return [[parse_cfactor(c.open("rb")) for c in cfacs] for cfacs in self.cfactors]

@functools.lru_cache()
@functools.lru_cache
def load_with_cuts(self, cuts):
"""Load the fktable and apply cuts immediately. Returns a FKTableData"""
return load_fktable(self).with_cuts(cuts)
Expand All @@ -586,7 +586,7 @@ def to_unweighted(self):
)
return self

@functools.lru_cache()
@functools.lru_cache
def load_commondata(self):
return self.commondata.load()

Expand Down Expand Up @@ -669,7 +669,7 @@ def __iter__(self):
yield self.name
yield self.path

@functools.lru_cache()
@functools.lru_cache
def as_input(self):
p = self.path / 'filter.yml'
log.debug('Reading input from fit configuration %s', p)
Expand Down Expand Up @@ -930,4 +930,4 @@ def as_pair(self):
return self.label, self.indexes

def __str__(self):
return '{}: {}'.format(self.label, self.indexes)
return f'{self.label}: {self.indexes}'

0 comments on commit 23c5e53

Please sign in to comment.