sort imports

This commit is contained in:
Sina Atalay 2024-06-24 16:08:07 +03:00
parent bfde7bb42b
commit 4fc622dd4d
14 changed files with 63 additions and 64 deletions

View File

@ -5,14 +5,14 @@ example entries found in
are coming from this script. are coming from this script.
""" """
import tempfile
import pathlib
import io import io
import pathlib
import shutil import shutil
import tempfile
from typing import Any from typing import Any
import ruamel.yaml
import pdfCropMargins import pdfCropMargins
import ruamel.yaml
import rendercv.data_models as dm import rendercv.data_models as dm
import rendercv.renderer as r import rendercv.renderer as r

View File

@ -1,7 +1,7 @@
"""This script generates the `examples` folder in the repository root.""" """This script generates the `examples` folder in the repository root."""
import pathlib
import os import os
import pathlib
import shutil import shutil
import rendercv.cli as cli import rendercv.cli as cli

View File

@ -5,32 +5,31 @@ This module contains the functions and classes that handle the command line inte
output. output.
""" """
import json
import urllib.request
import pathlib
from typing import Annotated, Callable, Optional
import re
import functools import functools
import shutil import json
import os import os
import pathlib
import re
import shutil
import urllib.request
from typing import Annotated, Callable, Optional
from rich import print import jinja2
import pydantic
import rich.console import rich.console
import rich.panel
import rich.live import rich.live
import rich.panel
import rich.progress
import rich.table import rich.table
import rich.text import rich.text
import rich.progress
import pydantic
import ruamel.yaml import ruamel.yaml
import ruamel.yaml.parser import ruamel.yaml.parser
import typer import typer
import jinja2 from rich import print
from . import __version__
from . import data_models as dm from . import data_models as dm
from . import renderer as r from . import renderer as r
from . import __version__
app = typer.Typer( app = typer.Typer(
rich_markup_mode="rich", rich_markup_mode="rich",

View File

@ -13,27 +13,27 @@ has provided a valid RenderCV input. This is achieved using
during the data classes' initialization. during the data classes' initialization.
""" """
from datetime import date as Date
from typing import Literal, Any, Type, Annotated, Optional, get_args
import importlib
import importlib.util
import importlib.machinery
import functools import functools
import json import importlib
import re import importlib.machinery
import pathlib import importlib.util
import warnings
import annotated_types as at
import io import io
import json
import pathlib
import re
import warnings
from datetime import date as Date
from typing import Annotated, Any, Literal, Optional, Type, get_args
import annotated_types as at
import pydantic import pydantic
import pydantic_extra_types.phone_numbers as pydantic_phone_numbers import pydantic_extra_types.phone_numbers as pydantic_phone_numbers
import ruamel.yaml import ruamel.yaml
from .themes.classic import ClassicThemeOptions from .themes.classic import ClassicThemeOptions
from .themes.engineeringresumes import EngineeringresumesThemeOptions
from .themes.moderncv import ModerncvThemeOptions from .themes.moderncv import ModerncvThemeOptions
from .themes.sb2nov import Sb2novThemeOptions from .themes.sb2nov import Sb2novThemeOptions
from .themes.engineeringresumes import EngineeringresumesThemeOptions
# Disable Pydantic warnings: # Disable Pydantic warnings:
warnings.filterwarnings("ignore") warnings.filterwarnings("ignore")

View File

@ -9,20 +9,19 @@ distribution. The markdown file is rendered into an HTML file with `markdown` pa
The PDF files are rendered into PNG files with `PyMuPDF`/`fitz` package. The PDF files are rendered into PNG files with `PyMuPDF`/`fitz` package.
""" """
import subprocess
import re
import pathlib
import importlib.resources
import shutil
import sys
import copy import copy
import importlib.resources
import pathlib
import re
import shutil
import subprocess
import sys
from datetime import date as Date from datetime import date as Date
from typing import Optional, Any from typing import Any, Optional
import fitz
import jinja2 import jinja2
import markdown import markdown
import fitz
from . import data_models as dm from . import data_models as dm
@ -386,6 +385,7 @@ def escape_latex_characters(latex_string: str, strict: bool = True) -> str:
for i, link in enumerate(links): for i, link in enumerate(links):
placeholder = link[0] placeholder = link[0]
escaped_placeholder = placeholder.translate(strict_translation_map) escaped_placeholder = placeholder.translate(strict_translation_map)
escaped_placeholder = escaped_placeholder.translate(translation_map)
url = link[1] url = link[1]
original_link = f"[{placeholder}]({url})" original_link = f"[{placeholder}]({url})"

View File

@ -3,7 +3,7 @@ are encouraged to inherit from these data models and add their own options, to a
code duplication. code duplication.
""" """
from typing import Literal, Annotated from typing import Annotated, Literal
import pydantic import pydantic
import pydantic_extra_types.color as pydantic_color import pydantic_extra_types.color as pydantic_color

View File

@ -2,7 +2,7 @@ from typing import Literal
import pydantic import pydantic
from .. import ThemeOptions, EntryAreaMargins, Margins, LaTeXDimension from .. import EntryAreaMargins, LaTeXDimension, Margins, ThemeOptions
class EntryAreaMarginsForClassic(EntryAreaMargins): class EntryAreaMarginsForClassic(EntryAreaMargins):

View File

@ -4,12 +4,12 @@ import pydantic
import pydantic_extra_types.color as pydantic_color import pydantic_extra_types.color as pydantic_color
from .. import ( from .. import (
ThemeOptions,
EntryAreaMargins, EntryAreaMargins,
HighlightsAreaMargins,
HeaderMargins, HeaderMargins,
Margins, HighlightsAreaMargins,
LaTeXDimension, LaTeXDimension,
Margins,
ThemeOptions,
) )

View File

@ -2,7 +2,7 @@ from typing import Literal
import pydantic import pydantic
from .. import ThemeOptions, LaTeXDimension from .. import LaTeXDimension, ThemeOptions
class Sb2novThemeOptions(ThemeOptions): class Sb2novThemeOptions(ThemeOptions):

View File

@ -1,22 +1,22 @@
"""This module contains fixtures and other helpful functions for the tests.""" """This module contains fixtures and other helpful functions for the tests."""
import pathlib
import copy import copy
import typing
import itertools
import filecmp import filecmp
from typing import Optional import itertools
import os import os
import pathlib
import shutil import shutil
import typing
from typing import Optional
import pypdf
import jinja2 import jinja2
import pytest
import pydantic import pydantic
import pydantic_extra_types.phone_numbers as pydantic_phone_numbers import pydantic_extra_types.phone_numbers as pydantic_phone_numbers
import pypdf
import pytest
from rendercv import data_models as dm
import rendercv.renderer as r import rendercv.renderer as r
from rendercv import data_models as dm
# RenderCV is being tested by comparing the output to reference files. Therefore, # RenderCV is being tested by comparing the output to reference files. Therefore,
# reference files should be updated when RenderCV is updated in a way that changes # reference files should be updated when RenderCV is updated in a way that changes

View File

@ -5,8 +5,8 @@ import sys
from datetime import date as Date from datetime import date as Date
import pydantic import pydantic
import ruamel.yaml
import pytest import pytest
import ruamel.yaml
import typer.testing import typer.testing
import rendercv.cli as cli import rendercv.cli as cli
@ -580,8 +580,8 @@ def test_get_latest_version_number_from_pypi():
def test_if_welcome_prints_new_version_available(monkeypatch): def test_if_welcome_prints_new_version_available(monkeypatch):
monkeypatch.setattr(cli, "get_latest_version_number_from_pypi", lambda: "99999") monkeypatch.setattr(cli, "get_latest_version_number_from_pypi", lambda: "99999")
import io
import contextlib import contextlib
import io
with contextlib.redirect_stdout(io.StringIO()) as f: with contextlib.redirect_stdout(io.StringIO()) as f:
cli.welcome() cli.welcome()

View File

@ -1,14 +1,14 @@
from datetime import date as Date import io
import json import json
import os import os
import io
import re import re
import shutil import shutil
from datetime import date as Date
import pydantic import pydantic
import pytest import pytest
import time_machine
import ruamel.yaml import ruamel.yaml
import time_machine
from rendercv import data_models as dm from rendercv import data_models as dm

View File

@ -1,15 +1,15 @@
import math
import shutil
import copy import copy
import pathlib import math
import os import os
import pathlib
import shutil
import pytest
import jinja2 import jinja2
import pytest
import time_machine import time_machine
from rendercv import renderer as r
from rendercv import data_models as dm from rendercv import data_models as dm
from rendercv import renderer as r
folder_name_dictionary = { folder_name_dictionary = {
"rendercv_empty_curriculum_vitae_data_model": "empty", "rendercv_empty_curriculum_vitae_data_model": "empty",
@ -97,12 +97,12 @@ def test_markdown_file_class(tmp_path, rendercv_data_model, jinja2_environment):
("##%%&&~~", "\\#\\#\\%\\%\\&\\&\\textasciitilde{}\\textasciitilde{}"), ("##%%&&~~", "\\#\\#\\%\\%\\&\\&\\textasciitilde{}\\textasciitilde{}"),
( (
( (
"[link_test](you shouldn't escape whatever is in here & % # ~) [second" "[link_test#](you shouldn't escape whatever is in here & % # ~) [second"
" link](https://myurl.com)" " link](https://myurl.com)"
), ),
( (
"[link\\_test](you shouldn't escape whatever is in here & % # ~) [second" "[link\\_test\\#](you shouldn't escape whatever is in here & % # ~)"
" link](https://myurl.com)" " [second link](https://myurl.com)"
), ),
), ),
("$a=5_4^3$", "$a=5_4^3$"), ("$a=5_4^3$", "$a=5_4^3$"),

View File

@ -4,4 +4,4 @@ import pydantic
class DummythemeThemeOptions(pydantic.BaseModel): class DummythemeThemeOptions(pydantic.BaseModel):
theme: Literal['dummytheme'] theme: Literal["dummytheme"]