Move imports to the top of the file

This commit is contained in:
Dunedan 2024-09-07 06:38:47 +02:00
parent 4d3be23bac
commit ac48b72550
Signed by untrusted user: Dunedan
GPG Key ID: 885B16854284E0B2
2 changed files with 4 additions and 6 deletions

View File

@ -30,6 +30,9 @@ import sys
from functools import lru_cache
from textwrap import dedent
from babel.messages.jslexer import tokenize, unquote_string
from lxml import etree
@lru_cache
def get_mask_pattern(mask: str) -> re.Pattern:
@ -128,8 +131,6 @@ class JavascriptExtractor(Extractor):
)
def extract_javascript_from_file(self, file_object):
from babel.messages.jslexer import tokenize, unquote_string
funcname = message_lineno = None
messages = []
last_argument = None
@ -451,8 +452,6 @@ class XmlExtractor(Extractor):
return self.jsonExtractor
def extract_from_file(self, filepath):
from lxml import etree
with open(filepath, encoding="utf-8-sig") as file_object:
xml_document = etree.parse(file_object)
for keyword in self.keywords:

View File

@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
import argparse
import glob
import json
import multiprocessing
@ -112,8 +113,6 @@ def generate_templates_for_messages_file(messages_file_path):
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"--scandir",