MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / init_objects

Method init_objects

test/perf/compiled_extensions.py:880–933  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

878 }
879
880 def init_objects(self):
881 from sqlalchemy.engine.result import SimpleResultMetaData
882 from string import ascii_letters
883
884 self.parent = SimpleResultMetaData(("a", "b", "c"))
885 self.row_args = (
886 self.parent,
887 self.parent._processors,
888 self.parent._key_to_index,
889 (1, 2, 3),
890 )
891 self.parent_long = SimpleResultMetaData(tuple(ascii_letters))
892 self.row_long_args = (
893 self.parent_long,
894 self.parent_long._processors,
895 self.parent_long._key_to_index,
896 tuple(range(len(ascii_letters))),
897 )
898 self.row = self.impl(*self.row_args)
899 self.row_long = self.impl(*self.row_long_args)
900 assert isinstance(self.row, self.impl), type(self.row)
901
902 class Row(self.impl):
903 pass
904
905 self.Row = Row
906 self.row_sub = Row(*self.row_args)
907
908 self.row_state = self.row.__getstate__()
909 self.row_long_state = self.row_long.__getstate__()
910
911 assert len(ascii_letters) == 52
912 self.parent_proc = SimpleResultMetaData(
913 tuple(ascii_letters),
914 _processors=[None, int, float, None, str] * 10, # cut the last 2
915 )
916 self.row_proc_args = (
917 self.parent_proc,
918 self.parent_proc._processors,
919 self.parent_proc._key_to_index,
920 tuple(range(len(ascii_letters))),
921 )
922
923 self.parent_proc_none = SimpleResultMetaData(
924 tuple(ascii_letters), _processors=[None] * 52
925 )
926 self.row_proc_none_args = (
927 self.parent_proc_none,
928 # NOTE: usually the code calls _effective_processors that returns
929 # None for this case of all None.
930 self.parent_proc_none._processors,
931 self.parent_proc_none._key_to_index,
932 tuple(range(len(ascii_letters))),
933 )
934
935 @classmethod
936 def update_results(cls, results):

Callers 2

get_by_key_recreateMethod · 0.95
getattr_recreateMethod · 0.95

Calls 3

RowClass · 0.70
__getstate__Method · 0.45

Tested by

no test coverage detected