@staticmethod
PYL-R0201 206
207 return queryset
208
209 def get_relationships(self, request, MappedBase, draft): 210 result = {}
211 relationships_overrides = {}
212
181 self.model_lookups_relationship_types = dict()
182 self.model_sort_types = dict()
183
184 def get_queryset(self, request, Model, only_columns=None): 185 mapper = inspect(Model)
186 pks = mapper.primary_key
187
841
842 return type('Model{}RecordAttrsType'.format(name), (ModelAttrsType,), attrs)
843
844 def get_selections(self, info, path): 845 i = 0
846 current_field = info.field_asts[0]
847
830 self.model_sort_types[cls_name] = cls
831 return graphene.List(cls)
832
833 def get_model_attrs_type(self, MappedBase, mapper): 834 table_name = get_table_name(MappedBase.metadata, mapper.selectable)
835 name = clean_name(table_name)
836 attrs = {}
322
323 return dict(map(lambda x: map_models(x), relationships.items()))
324
325 def get_model_columns_by_clean_name(self, MappedBase, mapper): 326 table = mapper.tables[0]
327 name = get_table_name(MappedBase.metadata, table)
328 Model = MappedBase.classes.get(name)
The method doesn't use its bound instance. Decorate this method with @staticmethod
decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.