Skip to content

Commit

Permalink
codestyling
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeisel committed Mar 15, 2022
1 parent 20e249b commit 988e714
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
7 changes: 3 additions & 4 deletions app/database/minio_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
TMPDIR = os.path.join(os.getcwd(), "tmp")



def check_if_bucket_exists(bucketname):
# Make QPU bucket if not exist.
found = client.bucket_exists(bucketname)
Expand All @@ -30,6 +29,7 @@ def check_if_bucket_exists(bucketname):
else:
print("Bucket '" + bucketname + "' already exists")


def store_matrix_object_in_db(matrix, qpu: str, matrix_type: MatrixType, **kwargs):
"""
Expand Down Expand Up @@ -73,7 +73,6 @@ def store_matrix_object_in_db(matrix, qpu: str, matrix_type: MatrixType, **kwarg
raise



def load_matrix_object_from_db(qpu, matrix_type: MatrixType, **kwargs):
"""
Expand Down Expand Up @@ -178,7 +177,6 @@ def load_mitigator_object_from_db_by_filename(
return matrix, metadata



def get_obj_metadata(obj):
metadata = {"name": obj.object_name}
for key, value in obj.metadata.items():
Expand Down Expand Up @@ -208,7 +206,6 @@ def get_obj_metadata(obj):
print(res)



########################################################
# #
# LEGACY FEATURE - RATHER USE OBJECT INSTEAD #
Expand All @@ -217,6 +214,7 @@ def get_obj_metadata(obj):

from app.utils.helper_functions import deprecated


@deprecated
def store_matrix_file_in_db(matrix, qpu: str, matrix_type: MatrixType, **kwargs):
"""
Expand Down Expand Up @@ -254,6 +252,7 @@ def store_matrix_file_in_db(matrix, qpu: str, matrix_type: MatrixType, **kwargs)
os.remove(source_filepath)
return filename


@deprecated
def load_matrix_file_from_db(qpu, matrix_type: MatrixType, **kwargs):
"""
Expand Down
16 changes: 7 additions & 9 deletions app/utils/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ def countsdict_to_array(dict, qubits, qubits_mm):
print(vector)



import functools
import inspect
import warnings

string_types = (type(b''), type(u''))
string_types = (type(b""), type(u""))


def deprecated(reason):
Expand Down Expand Up @@ -101,13 +100,13 @@ def decorator(func1):

@functools.wraps(func1)
def new_func1(*args, **kwargs):
warnings.simplefilter('always', DeprecationWarning)
warnings.simplefilter("always", DeprecationWarning)
warnings.warn(
fmt1.format(name=func1.__name__, reason=reason),
category=DeprecationWarning,
stacklevel=2
stacklevel=2,
)
warnings.simplefilter('default', DeprecationWarning)
warnings.simplefilter("default", DeprecationWarning)
return func1(*args, **kwargs)

return new_func1
Expand All @@ -133,13 +132,13 @@ def new_func1(*args, **kwargs):

@functools.wraps(func2)
def new_func2(*args, **kwargs):
warnings.simplefilter('always', DeprecationWarning)
warnings.simplefilter("always", DeprecationWarning)
warnings.warn(
fmt2.format(name=func2.__name__),
category=DeprecationWarning,
stacklevel=2
stacklevel=2,
)
warnings.simplefilter('default', DeprecationWarning)
warnings.simplefilter("default", DeprecationWarning)
return func2(*args, **kwargs)

return new_func2
Expand All @@ -148,7 +147,6 @@ def new_func2(*args, **kwargs):
raise TypeError(repr(type(reason)))



if __name__ == "__main__":
dict = {
"111": 129,
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Config:
"license": {"name": "Apache v2 License"},
}

MINIO_ENDPOINT = os.environ.get('MINIO_URL') or "localhost:9000"
MINIO_ENDPOINT = os.environ.get("MINIO_URL") or "localhost:9000"
MINIO_USER = "minio"
MINIO_PASSWORD = "minio123"
MINIO_SECURITY = False
Expand Down

0 comments on commit 988e714

Please sign in to comment.