From db6d57e669c133a56ec6c7a63e8ec0e218bc7bf5 Mon Sep 17 00:00:00 2001 From: sadrasabouri Date: Thu, 30 Sep 2021 07:37:01 +0330 Subject: [PATCH] edit : autopep8ed. --- samila/__init__.py | 2 +- samila/functions.py | 9 +++++++-- samila/genimage.py | 6 +++--- samila/params.py | 1 - 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/samila/__init__.py b/samila/__init__.py index bca50d6..24fd5a8 100644 --- a/samila/__init__.py +++ b/samila/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- """Samila modules.""" from .genimage import GenerativeImage -from .params import Projection,VALID_COLORS +from .params import Projection, VALID_COLORS diff --git a/samila/functions.py b/samila/functions.py index 1fefbf9..734de86 100644 --- a/samila/functions.py +++ b/samila/functions.py @@ -4,6 +4,7 @@ import requests from .params import Projection, DEFAULT_PROJECTION, VALID_COLORS, NFT_STORAGE_API, NFT_STORAGE_SUCCESS_MESSAGE + def float_range(start, stop, step): """ Generate float range. @@ -68,6 +69,7 @@ def filter_color(color): return VALID_COLORS[distance_list.index(min_distance)] return None + def filter_projection(projection): """ Filter given projection. @@ -80,6 +82,7 @@ def filter_projection(projection): return projection.value return DEFAULT_PROJECTION + def nft_storage_upload(api_key, data): """ Upload file to nft.storage. @@ -93,7 +96,10 @@ def nft_storage_upload(api_key, data): result = {"status": True, "message": NFT_STORAGE_SUCCESS_MESSAGE} try: headers = {'Authorization': 'Bearer {0}'.format(api_key)} - response = requests.post(url=NFT_STORAGE_API,data=data,headers=headers) + response = requests.post( + url=NFT_STORAGE_API, + data=data, + headers=headers) response_json = response.json() if response_json["ok"]: return result @@ -104,4 +110,3 @@ def nft_storage_upload(api_key, data): result["status"] = False result["message"] = str(e) return result - diff --git a/samila/genimage.py b/samila/genimage.py index b6b79c8..d435ff8 100644 --- a/samila/genimage.py +++ b/samila/genimage.py @@ -108,7 +108,7 @@ class GenerativeImage: ax.add_artist(ax.patch) self.fig = fig - def nft_storage(self,api_key): + def nft_storage(self, api_key): """ Upload image to nft.storage. @@ -118,5 +118,5 @@ class GenerativeImage: """ buf = io.BytesIO() self.fig.savefig(buf, format='png') - response = nft_storage_upload(api_key=api_key,data=buf.getvalue()) - return response \ No newline at end of file + response = nft_storage_upload(api_key=api_key, data=buf.getvalue()) + return response diff --git a/samila/params.py b/samila/params.py index 797da50..941d35d 100644 --- a/samila/params.py +++ b/samila/params.py @@ -20,7 +20,6 @@ NFT_STORAGE_API = "https://api.nft.storage/upload" NFT_STORAGE_SUCCESS_MESSAGE = "Everything seems good" - class Projection(Enum): """ Samila Projection type class.