Skip to content

Commit

Permalink
infra: import checking bugfix (#14569)
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Dec 11, 2023
1 parent 8bdaf55 commit 0a9d933
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
9 changes: 7 additions & 2 deletions libs/community/scripts/check_imports.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import random
import string
import sys
import traceback
from importlib.machinery import SourceFileLoader
Expand All @@ -7,9 +9,12 @@
has_failure = False
for file in files:
try:
SourceFileLoader("x", file).load_module()
module_name = "".join(
random.choice(string.ascii_letters) for _ in range(20)
)
SourceFileLoader(module_name, file).load_module()
except Exception:
has_faillure = True
has_failure = True
print(file)
traceback.print_exc()
print()
Expand Down
9 changes: 7 additions & 2 deletions libs/core/scripts/check_imports.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import random
import string
import sys
import traceback
from importlib.machinery import SourceFileLoader
Expand All @@ -7,9 +9,12 @@
has_failure = False
for file in files:
try:
SourceFileLoader("x", file).load_module()
module_name = "".join(
random.choice(string.ascii_letters) for _ in range(20)
)
SourceFileLoader(module_name, file).load_module()
except Exception:
has_faillure = True
has_failure = True
print(file)
traceback.print_exc()
print()
Expand Down
9 changes: 7 additions & 2 deletions libs/experimental/scripts/check_imports.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import random
import string
import sys
import traceback
from importlib.machinery import SourceFileLoader
Expand All @@ -7,9 +9,12 @@
has_failure = False
for file in files:
try:
SourceFileLoader("x", file).load_module()
module_name = "".join(
random.choice(string.ascii_letters) for _ in range(20)
)
SourceFileLoader(module_name, file).load_module()
except Exception:
has_faillure = True
has_failure = True
print(file)
traceback.print_exc()
print()
Expand Down
9 changes: 7 additions & 2 deletions libs/langchain/scripts/check_imports.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import random
import string
import sys
import traceback
from importlib.machinery import SourceFileLoader
Expand All @@ -7,9 +9,12 @@
has_failure = False
for file in files:
try:
SourceFileLoader("x", file).load_module()
module_name = "".join(
random.choice(string.ascii_letters) for _ in range(20)
)
SourceFileLoader(module_name, file).load_module()
except Exception:
has_faillure = True
has_failure = True
print(file)
traceback.print_exc()
print()
Expand Down

0 comments on commit 0a9d933

Please sign in to comment.