Skip to content

Commit

Permalink
Move up imports in process_connect_string
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Aug 10, 2023
1 parent f3dbf4e commit acbfc1b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions adodbapi/process_connect_string.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
""" a clumsy attempt at a macro language to let the programmer execute code on the server (ex: determine 64bit)"""
import getpass
import os
import platform
import tempfile

from . import is64bit as is64bit


Expand Down Expand Up @@ -31,13 +36,9 @@ def macro_call(macro_name, args, kwargs):
macro_name == "getuser"
): # get the name of the user the server is logged in under
if not new_key in kwargs:
import getpass

return new_key, getpass.getuser()

elif macro_name == "getnode": # get the name of the computer running the server
import platform

try:
return new_key, args[1] % platform.node()
except IndexError:
Expand All @@ -60,9 +61,6 @@ def macro_call(macro_name, args, kwargs):
elif (
macro_name == "find_temp_test_path"
): # helper function for testing ado operation -- undocumented
import os
import tempfile

return new_key, os.path.join(
tempfile.gettempdir(), "adodbapi_test", args[1]
)
Expand Down

0 comments on commit acbfc1b

Please sign in to comment.