text
stringlengths
0
828
logger.info(dict_name + ' = ')
try:
from pprint import pformat
logger.info(pformat(dict_value))
except:
logger.info(dict_value)"
355,"def get_default_object_parsers(parser_finder: ParserFinder, conversion_finder: ConversionFinder) -> List[AnyParser]:
""""""
Utility method to return the default parsers able to parse an object from a file.
Note that MultifileObjectParser is not provided in this list, as it is already added in a hardcoded way in
RootParser
:return:
""""""
return [SingleFileParserFunction(parser_function=read_object_from_pickle,
streaming_mode=False,
supported_exts={'.pyc'},
supported_types={AnyObject}),
MultifileObjectParser(parser_finder, conversion_finder)
]"
356,"def get_default_object_converters(conversion_finder: ConversionFinder) \
-> List[Union[Converter[Any, Type[None]], Converter[Type[None], Any]]]:
""""""
Utility method to return the default converters associated to dict (from dict to other type,
and from other type to dict)
:return:
""""""
return [
ConverterFunction(from_type=b64str, to_type=AnyObject, conversion_method=base64_ascii_str_pickle_to_object),
ConverterFunction(from_type=DictOfDict, to_type=Any, conversion_method=dict_to_object,
custom_name='dict_of_dict_to_object',
is_able_to_convert_func=_is_valid_for_dict_to_object_conversion, unpack_options=False,
function_args={'conversion_finder': conversion_finder, 'is_dict_of_dicts': True}),
ConverterFunction(from_type=dict, to_type=AnyObject, conversion_method=dict_to_object,
custom_name='dict_to_object', unpack_options=False,
is_able_to_convert_func=_is_valid_for_dict_to_object_conversion,
function_args={'conversion_finder': conversion_finder, 'is_dict_of_dicts': False})
]"
357,"def create(obj: PersistedObject, obj_type: Type[Any], arg_name: str):
""""""
Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests
ERROR: type should be string, got " https://github.com/nose-devs/nose/issues/725"
:param obj:
:param obj_type:
:param arg_name:
:return:
""""""
return MissingMandatoryAttributeFiles('Multifile object ' + str(obj) + ' cannot be built from constructor of '
'type ' + get_pretty_type_str(obj_type) +
', mandatory constructor argument \'' + arg_name + '\'was not found on '
'filesystem')"
358,"def create(item_type: Type[Any], constructor_atts: List[str], invalid_property_name: str):
""""""
Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests
ERROR: type should be string, got " https://github.com/nose-devs/nose/issues/725"
:param item_type:
:return:
""""""
return InvalidAttributeNameForConstructorError('Cannot parse object of type <' + get_pretty_type_str(item_type)
+ '> using the provided configuration file: configuration '
+ 'contains a property name (\'' + invalid_property_name + '\')'\
+ 'that is not an attribute of the object constructor. <'
+ get_pretty_type_str(item_type) + '> constructor attributes '
+ 'are : ' + str(constructor_atts))"
359,"def create(item_type: Type[Any], constructor_args: Dict[str, Any], cause: Exception):
""""""
Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests
ERROR: type should be string, got " https://github.com/nose-devs/nose/issues/725"
:param item_type:
:return:
""""""
return ObjectInstantiationException('Error while building object of type <' + get_pretty_type_str(item_type)
+ '> using its constructor and parsed contents : ' + str(constructor_args)
+ ' : \n' + str(cause.__class__) + ' ' + str(cause)
).with_traceback(cause.__traceback__)"
360,"def create(desired_type: Type[Any], contents_dict: Dict, caught: Exception):
""""""
Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests
ERROR: type should be string, got " https://github.com/nose-devs/nose/issues/725"
:param desired_type:
:param contents_dict:
:param caught:
:return:
""""""
msg = 'Error while trying to instantiate object of type ' + str(desired_type) + ' using dictionary input_dict:'\
+ 'Caught error message is : ' + caught.__class__.__name__ + ' : ' + str(caught) + '\n'
try:
from pprint import pformat
msg += 'Dict provided was ' + pformat(contents_dict)
except:
msg += 'Dict provided was ' + str(contents_dict)
return CaughtTypeErrorDuringInstantiation(msg).with_traceback(caught.__traceback__)"
361,"def is_able_to_parse_detailed(self, desired_type: Type[Any], desired_ext: str, strict: bool):
""""""