Skip to content

Commit

Permalink
perf: Move babel import to extract function
Browse files Browse the repository at this point in the history
This is never used in production.

[skip ci]
  • Loading branch information
ankush committed Jun 23, 2023
1 parent 8a37d6d commit c6419f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions frappe/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
from contextlib import contextmanager
from csv import reader, writer

from babel.messages.extract import extract_python
from babel.messages.jslexer import Token, tokenize, unquote_string
from pypika.terms import PseudoColumn

import frappe
Expand Down Expand Up @@ -737,6 +735,7 @@ def get_messages_from_file(path: str) -> list[tuple[str, str, str | None, int]]:

def extract_messages_from_python_code(code: str) -> list[tuple[int, str, str | None]]:
"""Extracts translatable strings from Python code using babel."""
from babel.messages.extract import extract_python

messages = []

Expand Down Expand Up @@ -809,6 +808,8 @@ def extract_javascript(code, keywords=("__",), options=None):
* `template_string` -- set to false to disable ES6
template string support.
"""
from babel.messages.jslexer import Token, tokenize, unquote_string

if options is None:
options = {}

Expand Down

0 comments on commit c6419f5

Please sign in to comment.