Skip to content

Commit

Permalink
🚨 Fix lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BrikerMan committed Jul 4, 2021
1 parent bc55c54 commit c77f706
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions kashgari/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,33 @@
from distutils.version import LooseVersion
from typing import Any, Dict

os.environ['TF_KERAS'] = '1'
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ["TF_KERAS"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"

custom_objects: Dict[str, Any] = {}

def check_tfa_version(tf_version):
if LooseVersion(tf_version) < '2.2.0':
return '0.9.1'
elif LooseVersion(tf_version) < '2.3.0':
return '0.11.2'

def check_tfa_version(tf_version: str) -> str:
if LooseVersion(tf_version) < "2.2.0":
return "0.9.1"
elif LooseVersion(tf_version) < "2.3.0":
return "0.11.2"
else:
return '0.13.0'
return "0.13.0"


def dependency_check() -> None:
import tensorflow as tf

tfa_version = check_tfa_version(tf_version=tf.__version__)
try:
import tensorflow_addons as tfa
except:
raise ImportError(
"Kashgari request tensorflow_addons, please install via the "
f"`$pip install tensorflow_addons=={tfa_version}`"
)
)


dependency_check()

Expand All @@ -47,5 +50,3 @@ def dependency_check() -> None:
from kashgari.macros import config

custom_objects = layers.resigter_custom_layers(custom_objects)


2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# time: 10:48 上午

import unittest
import numpy as np
import numpy as np
from kashgari.utils import unison_shuffled_copies
from kashgari.utils import get_list_subset

Expand Down

0 comments on commit c77f706

Please sign in to comment.