Belle II Software development
CdRefiner Class Reference
Inheritance diagram for CdRefiner:
Refiner

Public Member Functions

 __init__ (self, wrapped_refiner, folder_name=None, groupby_addition=None)
 
 refine (self, harvesting_module, crops, tdirectory=None, groupby_part_name=None, groupby_value=None, *args, **kwds)
 
 __get__ (self, harvesting_module, cls=None)
 
 __call__ (self, harvesting_module, crops=None, *args, **kwds)
 

Public Attributes

 wrapped_refiner = wrapped_refiner
 cached value of the wrapped refiner
 
 folder_name = folder_name
 cached value of the folder name
 
 groupby_addition = groupby_addition
 cached value of the suffix for a groupby selection
 
 refiner_function = refiner_function
 cached copy of the instance's refiner function
 

Static Public Attributes

str default_folder_name = ""
 Folder name to be used if a groupby selection is active.
 
str default_groupby_addition = "_groupby_{groupby}_{groupby_value}"
 Default suffix for a groupby selection.
 

Detailed Description

Refiner for change-directory

Definition at line 1039 of file refiners.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
wrapped_refiner,
folder_name = None,
groupby_addition = None )
Constructor for this refiner

Definition at line 1047 of file refiners.py.

1050 groupby_addition=None):
1051 """Constructor for this refiner"""
1052
1053 ## cached value of the wrapped refiner
1054 self.wrapped_refiner = wrapped_refiner
1055 ## cached value of the folder name
1056 self.folder_name = folder_name
1057 ## cached value of the suffix for a groupby selection
1058 self.groupby_addition = groupby_addition
1059

Member Function Documentation

◆ __call__()

__call__ ( self,
harvesting_module,
crops = None,
* args,
** kwds )
inherited
implementation of the function-call of the Refiner instance r = Refiner() r(harvester) # decoration r(harvester, crops, args, keywords) # refinement

Definition at line 55 of file refiners.py.

55 def __call__(self, harvesting_module, crops=None, *args, **kwds):
56 """implementation of the function-call of the Refiner instance
57 r = Refiner()
58 r(harvester) # decoration
59 r(harvester, crops, args, keywords) # refinement
60 """
61 if crops is None:
62 # Decoration mode
63 harvesting_module.refiners.append(self)
64 return harvesting_module
65 else:
66 # Refining mode
67 return self.refine(harvesting_module, crops, *args, **kwds)
68

◆ __get__()

__get__ ( self,
harvesting_module,
cls = None )
inherited
Getter of the Refiner instance

Definition at line 42 of file refiners.py.

42 def __get__(self, harvesting_module, cls=None):
43 """Getter of the Refiner instance"""
44 if harvesting_module is None:
45 # Class access
46 return self
47 else:
48 # Instance access
49 refine = self.refine
50
51 def bound_call(*args, **kwds):
52 return refine(harvesting_module, *args, **kwds)
53 return bound_call
54

◆ refine()

refine ( self,
harvesting_module,
crops,
tdirectory = None,
groupby_part_name = None,
groupby_value = None,
* args,
** kwds )
Process the change-directory

Reimplemented from Refiner.

Definition at line 1060 of file refiners.py.

1067 **kwds):
1068 """Process the change-directory"""
1069
1070 folder_name = self.folder_name
1071 if folder_name is None:
1072 if groupby_value is not None:
1073 folder_name = "{groupby_addition}"
1074 else:
1075 folder_name = self.default_folder_name
1076
1077 groupby_addition = self.groupby_addition
1078
1079 if groupby_addition is None:
1080 groupby_addition = self.default_groupby_addition
1081
1082 if groupby_part_name is None and groupby_value is None:
1083 groupby_addition = ""
1084 else:
1085 groupby_addition = formatter.format(groupby_addition,
1086 groupby=groupby_part_name,
1087 groupby_value=groupby_value)
1088
1089 folder_name = formatter.format(folder_name,
1090 groupby_addition=groupby_addition,
1091 groupby=groupby_part_name,
1092 groupby_value=groupby_value)
1093
1094 folder_name = '/'.join(root_save_name(name) for name in folder_name.split('/'))
1095
1096 with root_cd(tdirectory):
1097 with root_cd(folder_name) as tdirectory:
1098 self.wrapped_refiner(harvesting_module,
1099 crops,
1100 tdirectory=tdirectory,
1101 groupby_part_name=groupby_part_name,
1102 groupby_value=groupby_value,
1103 *args,
1104 **kwds)
1105
1106

Member Data Documentation

◆ default_folder_name

str default_folder_name = ""
static

Folder name to be used if a groupby selection is active.

Definition at line 1043 of file refiners.py.

◆ default_groupby_addition

str default_groupby_addition = "_groupby_{groupby}_{groupby_value}"
static

Default suffix for a groupby selection.

Definition at line 1045 of file refiners.py.

◆ folder_name

folder_name = folder_name

cached value of the folder name

Definition at line 1056 of file refiners.py.

◆ groupby_addition

groupby_addition = groupby_addition

cached value of the suffix for a groupby selection

Definition at line 1058 of file refiners.py.

◆ refiner_function

refiner_function = refiner_function
inherited

cached copy of the instance's refiner function

Definition at line 40 of file refiners.py.

◆ wrapped_refiner

wrapped_refiner = wrapped_refiner

cached value of the wrapped refiner

Definition at line 1054 of file refiners.py.


The documentation for this class was generated from the following file: