This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import multiprocessing | |
import sys | |
import time | |
import typing as t | |
import typing_extensions as te | |
from pathlib import Path | |
import numpy as np | |
import pandas as pd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
# Invalid chars was taken from Antares Simulator (C++). | |
_sub_invalid_chars = re.compile(r"[^a-zA-Z0-9_(),& -]+").sub | |
def transform_name_to_id(name: str, lower: bool = True) -> str: | |
""" | |
Transform a name into an identifier by replacing consecutive | |
invalid characters by a single white space, and then whitespaces |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
from typing import Optional | |
import pydantic.main | |
from pydantic import Field, BaseModel | |
class AllOptionalMetaclass(pydantic.main.ModelMetaclass): | |
.... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Dict, Optional, Tuple, Type | |
import pydantic.main | |
class AllOptionalMetaclass(pydantic.main.ModelMetaclass): | |
""" | |
Metaclass that makes all fields of a Pydantic model optional. | |
This metaclass modifies the class's annotations to make all fields |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
from pydantic import Field | |
from antarest.study.business.utils import FormFieldsBaseModel | |
class SizeEnum(str, Enum): | |
SMALL = "Small" | |
MEDIUM = "Medium" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
import os | |
from typing import Set | |
STD_LIB = { | |
# fmt :off | |
'__future__', '__main__', '_abc', '_ast', '_asyncio', '_bisect', '_blake2', '_bootlocale', '_bz2', '_codecs', | |
'_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_collections', | |
'_collections_abc', '_compat_pickle', '_compression', '_contextvars', '_crypt', '_csv', '_ctypes', | |
'_ctypes_test', '_curses', '_curses_panel', '_datetime', '_dbm', '_decimal', '_dummy_thread', '_elementtree', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import re | |
_match_hex8 = re.compile( | |
r"^#(?P<r>[0-9a-f]{2})(?P<g>[0-9a-f]{2})(?P<b>[0-9a-f]{2})(?P<a>[0-9a-f]{2})?$", flags=re.I | |
).match | |
def parse_hex8(text, scale=255): | |
mo = _match_hex8(text) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 2 columns, instead of 4 in line 7.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BG-EN vocabulary database compiled by dict.cc | |
# Date and time 2019-08-28 22:04 | |
# License THIS WORK IS PROTECTED BY INTERNATIONAL COPYRIGHT LAWS! | |
# License Private use is allowed as long as the data, or parts of it, are not published or given away. | |
# License By using this file, you agree to be bound to the Terms of Use published at the following URL: | |
# License https://www.dict.cc/translation_file_request.php | |
# Brought to you by Paul Hemetsberger and the users of https://www.dict.cc/, 2002 - 2019 | |
(а/пък) и (and) then conj | |
(главен) готвач {м} chef noun [gastr.] [jobs] |
We can't make this file beautiful and searchable because it's too large.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DE-FR vocabulary database compiled by dict.cc | |
# Date and time 2019-08-28 21:50 | |
# License THIS WORK IS PROTECTED BY INTERNATIONAL COPYRIGHT LAWS! | |
# License Private use is allowed as long as the data, or parts of it, are not published or given away. | |
# License By using this file, you agree to be bound to the Terms of Use published at the following URL: | |
# License https://www.dict.cc/translation_file_request.php | |
# Brought to you by Paul Hemetsberger and the users of https://www.dict.cc/, 2002 - 2019 | |
(absolutes) Minimum {n} [zum Leben, Rente, Lohn] portion {f} congrue [rente, salaire] noun | |
(akute) Leberbeschwerden {f} crise {f} de foie noun [med.] |
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 2 columns, instead of 4 in line 8.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DE-EN vocabulary database compiled by dict.cc | |
# Date and time 2019-08-28 21:44 | |
# License THIS WORK IS PROTECTED BY INTERNATIONAL COPYRIGHT LAWS! | |
# License Private use is allowed as long as the data, or parts of it, are not published or given away. | |
# License By using this file, you agree to be bound to the Terms of Use published at the following URL: | |
# License https://www.dict.cc/translation_file_request.php | |
# Contains data from http://dict.tu-chemnitz.de/ with friendly permission by Frank Richter, TU Chemnitz | |
# Brought to you by Paul Hemetsberger and the users of https://www.dict.cc/, 2002 - 2019 | |
α-Keratin {n} α-keratin noun [biochem.] |
NewerOlder