| Conditions | 1 |
| Total Lines | 51 |
| Code Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import pytest |
||
| 4 | @pytest.fixture |
||
| 5 | def client_pandas_tabular_implementation(): |
||
| 6 | from so_magic.data.interfaces import TabularRetriever, TabularIterator, TabularMutator |
||
| 7 | |||
| 8 | class TestPDTabularRetrieverDelegate(TabularRetriever): |
||
| 9 | """The observation object is the same as the one you return from 'from_json_lines'""" |
||
| 10 | |||
| 11 | @classmethod |
||
| 12 | def column(cls, identifier, data): pass |
||
| 13 | |||
| 14 | def row(self, identifier, data): pass |
||
| 15 | |||
| 16 | @classmethod |
||
| 17 | def nb_columns(cls, data): pass |
||
| 18 | |||
| 19 | @classmethod |
||
| 20 | def nb_rows(cls, data): pass |
||
| 21 | |||
| 22 | @classmethod |
||
| 23 | def get_numerical_attributes(cls, data): pass |
||
| 24 | |||
| 25 | |||
| 26 | class TestPDTabularIteratorDelegate(TabularIterator): |
||
| 27 | """The observation object is the same as the one your return from 'from_json_lines'""" |
||
| 28 | |||
| 29 | def columnnames(self, data): pass |
||
| 30 | |||
| 31 | @classmethod |
||
| 32 | def iterrows(cls, data): pass |
||
| 33 | |||
| 34 | @classmethod |
||
| 35 | def itercolumns(cls, data): pass |
||
| 36 | |||
| 37 | |||
| 38 | class TestPDTabularMutatorDelegate(TabularMutator): |
||
| 39 | |||
| 40 | @classmethod |
||
| 41 | def add_column(cls, datapoints, values, new_attribute, **kwargs): pass |
||
| 42 | |||
| 43 | |||
| 44 | BACKEND = { |
||
| 45 | 'backend_id': 'test-pd', |
||
| 46 | 'backend_name': 'test-pandas', |
||
| 47 | 'interfaces': [ |
||
| 48 | TestPDTabularRetrieverDelegate, |
||
| 49 | TestPDTabularIteratorDelegate, |
||
| 50 | TestPDTabularMutatorDelegate, |
||
| 51 | ] |
||
| 52 | } |
||
| 53 | |||
| 54 | return BACKEND |
||
| 55 | |||
| 78 |