Skip to content

Commit

Permalink
change dict to list to respect order (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
longshuicy authored Sep 19, 2024
1 parent ebaa993 commit 3a4f276
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Fixed Sphinx autodoc skipping class methods with custom decorators. [#518](https://github.com/IN-CORE/pyincore/issues/518)
- Pyomo version fixed to fix indp solver failure [#585](https://github.com/IN-CORE/pyincore/issues/585)
- Uploaded raster files doesn't respect the order [#614](https://github.com/IN-CORE/pyincore/issues/614)

### Changed
- Support Interdependent recovery of residential buildings and households [#606](https://github.com/IN-CORE/pyincore/pull/606)
Expand Down
20 changes: 10 additions & 10 deletions pyincore/hazardservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ def create_earthquake(
"""
url = self.base_earthquake_url
eq_data = {("earthquake", eq_json)}
eq_data = [("earthquake", eq_json)]

for file_path in file_paths:
eq_data.add(("file", open(file_path, "rb")))
eq_data.append(("file", open(file_path, "rb")))
kwargs = {"files": eq_data}
r = self.client.post(url, timeout=timeout, **kwargs)
return return_http_response(r).json()
Expand Down Expand Up @@ -558,10 +558,10 @@ def create_tornado_scenario(
"""
url = self.base_tornado_url
tornado_data = {("tornado", tornado_json)}
tornado_data = [("tornado", tornado_json)]

for file_path in file_paths:
tornado_data.add(("file", open(file_path, "rb")))
tornado_data.append(("file", open(file_path, "rb")))
kwargs = {"files": tornado_data}
r = self.client.post(url, timeout=timeout, **kwargs)
return return_http_response(r).json()
Expand Down Expand Up @@ -708,10 +708,10 @@ def create_tsunami_hazard(
"""

url = self.base_tsunami_url
tsunami_data = {("tsunami", tsunami_json)}
tsunami_data = [("tsunami", tsunami_json)]

for file_path in file_paths:
tsunami_data.add(("file", open(file_path, "rb")))
tsunami_data.append(("file", open(file_path, "rb")))
kwargs = {"files": tsunami_data}
r = self.client.post(url, timeout=timeout, **kwargs)
return return_http_response(r).json()
Expand Down Expand Up @@ -783,10 +783,10 @@ def create_hurricane(
"""
url = self.base_hurricane_url
hurricane_data = {("hurricane", hurricane_json)}
hurricane_data = [("hurricane", hurricane_json)]

for file_path in file_paths:
hurricane_data.add(("file", open(file_path, "rb")))
hurricane_data.append(("file", open(file_path, "rb")))
kwargs = {"files": hurricane_data}
r = self.client.post(url, timeout=timeout, **kwargs)

Expand Down Expand Up @@ -926,10 +926,10 @@ def create_flood(self, flood_json, file_paths: List, timeout=(30, 600), **kwargs
"""
url = self.base_flood_url
flood_data = {("flood", flood_json)}
flood_data = [("flood", flood_json)]

for file_path in file_paths:
flood_data.add(("file", open(file_path, "rb")))
flood_data.append(("file", open(file_path, "rb")))
kwargs = {"files": flood_data}
r = self.client.post(url, timeout=timeout, **kwargs)

Expand Down
4 changes: 2 additions & 2 deletions pyincore/spaceservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create_space(self, space_json, timeout=(30, 600), **kwargs):
"""
url = self.base_space_url
space_data = {("space", space_json)}
space_data = [("space", space_json)]
kwargs["files"] = space_data
r = self.client.post(url, timeout=timeout, **kwargs)
return return_http_response(r).json()
Expand Down Expand Up @@ -214,7 +214,7 @@ def grant_privileges_to_space(
"""
url = urljoin(self.base_space_url, space_id + "/grant")
space_privileges = {("grant", privileges_json)}
space_privileges = [("grant", privileges_json)]
kwargs["files"] = space_privileges
r = self.client.post(url, timeout=timeout, **kwargs)

Expand Down

0 comments on commit 3a4f276

Please sign in to comment.