Skip to content

Commit 88b32e4

Browse files
authored
Fix code smell catched by SonarCloud (#1)
Authored-by: Adam Puza <adam.puza@gmail.com>
1 parent 004ac41 commit 88b32e4

4 files changed

Lines changed: 2 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ One of Python's most significant advantages is that we can make applications fas
44

55
The idea of RedBeanPython ORM is to decrease the time to market for applications by providing an absolutely zero configuration ORM and, simultaneously, heaving the possibility of zero effort transition to advanced ORM when needed.
66

7-
RedBeanPython idea is inspired by the matured [RedBeanPHP ORM](https://www.redbeanphp.com/index.php) (since 2009 and still running).
7+
[RedBeanPython](https://redbeanpython.org) idea is inspired by the matured [RedBeanPHP ORM](https://www.redbeanphp.com/index.php) (since 2009 and still running).
88

99
RedBeanPython ORM's idea is not to replace the more advanced ORMs (we should not reinvent the wheel) but to cooperate with them. Initially, it can be used as only ORM. When projects evolve, both code bases (RedBeanPython and SQLAlchemy) can coexist and, finally, can be swiftly replaced by SQLAlchemy (if needed).
1010

redbeanpython/structure/db_structure.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def have_table(self, bean_type: str) -> bool:
4646

4747
def get_model(self, bean: Bean) -> Model:
4848
model_class = self.get_model_class(bean.bean_type)
49-
table_definition = self.tables[bean.bean_type]
50-
return model_class(**table_definition.bean_as_model_data(bean))
49+
return model_class(**dict(bean))
5150

5251
def get_default_properties(self, bean_type: str) -> dict[str, TYPE]:
5352
if table_definition := self.tables.get(bean_type):

redbeanpython/structure/table.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,3 @@ def __eq__(self, other: TYPE):
6363

6464
def get_properties_dict(self) -> dict[str, TYPE]:
6565
return {name: None for name in self.columns.keys()}
66-
67-
def bean_as_model_data(self, bean: Bean) -> dict[str, TYPE]:
68-
result = {}
69-
for k, value in dict(bean).items():
70-
column_type = self.columns[k]
71-
result[k] = value
72-
return result
73-

site/sitemap.xml.gz

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)