Skip to content

Commit

Permalink
Fix code smell catched by SonarCloud (#1)
Browse files Browse the repository at this point in the history
Authored-by: Adam Puza <[email protected]>
  • Loading branch information
adamhmetal authored Feb 4, 2024
1 parent 004ac41 commit 88b32e4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ One of Python's most significant advantages is that we can make applications fas

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.

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

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).

Expand Down
3 changes: 1 addition & 2 deletions redbeanpython/structure/db_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def have_table(self, bean_type: str) -> bool:

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

def get_default_properties(self, bean_type: str) -> dict[str, TYPE]:
if table_definition := self.tables.get(bean_type):
Expand Down
8 changes: 0 additions & 8 deletions redbeanpython/structure/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,3 @@ def __eq__(self, other: TYPE):

def get_properties_dict(self) -> dict[str, TYPE]:
return {name: None for name in self.columns.keys()}

def bean_as_model_data(self, bean: Bean) -> dict[str, TYPE]:
result = {}
for k, value in dict(bean).items():
column_type = self.columns[k]
result[k] = value
return result

Binary file modified site/sitemap.xml.gz
Binary file not shown.

0 comments on commit 88b32e4

Please sign in to comment.