diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-01-26 13:18:00 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-01-26 14:37:14 +0300 |
commit | 7e48de06a66dff1e3f73e186f64b6d155dffa086 (patch) | |
tree | edd6494ecf7cfca5285dbf4e5c386a20ab58e970 /contrib/python | |
parent | 9b8da54607431b12327615568180adf77cca95c8 (diff) | |
download | ydb-7e48de06a66dff1e3f73e186f64b6d155dffa086.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python')
20 files changed, 154 insertions, 50 deletions
diff --git a/contrib/python/fonttools/.dist-info/METADATA b/contrib/python/fonttools/.dist-info/METADATA index f156c42697..f9e01c388f 100644 --- a/contrib/python/fonttools/.dist-info/METADATA +++ b/contrib/python/fonttools/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: fonttools -Version: 4.47.0 +Version: 4.47.2 Summary: Tools to manipulate font files Home-page: http://github.com/fonttools/fonttools Author: Just van Rossum @@ -375,6 +375,18 @@ Have fun! Changelog ~~~~~~~~~ +4.47.2 (released 2024-01-11) +---------------------------- + +Minor release to fix uploading wheels to PyPI. + +4.47.1 (released 2024-01-11) +---------------------------- + +- [merge] Improve help message and add standard command line options (#3408) +- [otlLib] Pass ``ttFont`` to ``name.addName`` in ``buildStatTable`` (#3406) +- [featureVars] Re-use ``FeatureVariationRecord``'s when possible (#3413) + 4.47.0 (released 2023-12-18) ---------------------------- diff --git a/contrib/python/fonttools/fontTools/__init__.py b/contrib/python/fonttools/fontTools/__init__.py index 6c00e567a4..7410d3c7fe 100644 --- a/contrib/python/fonttools/fontTools/__init__.py +++ b/contrib/python/fonttools/fontTools/__init__.py @@ -3,6 +3,6 @@ from fontTools.misc.loggingTools import configLogger log = logging.getLogger(__name__) -version = __version__ = "4.47.0" +version = __version__ = "4.47.2" __all__ = ["version", "log", "configLogger"] diff --git a/contrib/python/fonttools/fontTools/merge/__init__.py b/contrib/python/fonttools/fontTools/merge/__init__.py index 8d8a5213e8..7653e4a079 100644 --- a/contrib/python/fonttools/fontTools/merge/__init__.py +++ b/contrib/python/fonttools/fontTools/merge/__init__.py @@ -139,6 +139,7 @@ class Merger(object): *(vars(table).keys() for table in tables if table is not NotImplemented), ) for key in allKeys: + log.info(" %s", key) try: mergeLogic = logic[key] except KeyError: @@ -181,17 +182,50 @@ def main(args=None): args = sys.argv[1:] options = Options() - args = options.parse_opts(args, ignore_unknown=["output-file"]) - outfile = "merged.ttf" + args = options.parse_opts(args) fontfiles = [] + if options.input_file: + with open(options.input_file) as inputfile: + fontfiles = [ + line.strip() + for line in inputfile.readlines() + if not line.lstrip().startswith("#") + ] for g in args: - if g.startswith("--output-file="): - outfile = g[14:] - continue fontfiles.append(g) - if len(args) < 1: - print("usage: pyftmerge font...", file=sys.stderr) + if len(fontfiles) < 1: + print( + "usage: pyftmerge [font1 ... fontN] [--input-file=filelist.txt] [--output-file=merged.ttf] [--import-file=tables.ttx]", + file=sys.stderr, + ) + print( + " [--drop-tables=tags] [--verbose] [--timing]", + file=sys.stderr, + ) + print("", file=sys.stderr) + print(" font1 ... fontN Files to merge.", file=sys.stderr) + print( + " --input-file=<filename> Read files to merge from a text file, each path new line. # Comment lines allowed.", + file=sys.stderr, + ) + print( + " --output-file=<filename> Specify output file name (default: merged.ttf).", + file=sys.stderr, + ) + print( + " --import-file=<filename> TTX file to import after merging. This can be used to set metadata.", + file=sys.stderr, + ) + print( + " --drop-tables=<table tags> Comma separated list of table tags to skip, case sensitive.", + file=sys.stderr, + ) + print( + " --verbose Output progress information.", + file=sys.stderr, + ) + print(" --timing Output progress timing.", file=sys.stderr) return 1 configLogger(level=logging.INFO if options.verbose else logging.WARNING) @@ -202,8 +236,12 @@ def main(args=None): merger = Merger(options=options) font = merger.merge(fontfiles) + + if options.import_file: + font.importXML(options.import_file) + with timer("compile and save font"): - font.save(outfile) + font.save(options.output_file) if __name__ == "__main__": diff --git a/contrib/python/fonttools/fontTools/merge/options.py b/contrib/python/fonttools/fontTools/merge/options.py index f134009368..8bc8947138 100644 --- a/contrib/python/fonttools/fontTools/merge/options.py +++ b/contrib/python/fonttools/fontTools/merge/options.py @@ -11,6 +11,9 @@ class Options(object): self.verbose = False self.timing = False self.drop_tables = [] + self.input_file = None + self.output_file = "merged.ttf" + self.import_file = None self.set(**kwargs) diff --git a/contrib/python/fonttools/fontTools/otlLib/builder.py b/contrib/python/fonttools/fontTools/otlLib/builder.py index 3508a7e28d..4b457f4d9f 100644 --- a/contrib/python/fonttools/fontTools/otlLib/builder.py +++ b/contrib/python/fonttools/fontTools/otlLib/builder.py @@ -2781,14 +2781,13 @@ def buildStatTable( """ ttFont["STAT"] = ttLib.newTable("STAT") statTable = ttFont["STAT"].table = ot.STAT() - nameTable = ttFont["name"] statTable.ElidedFallbackNameID = _addName( - nameTable, elidedFallbackName, windows=windowsNames, mac=macNames + ttFont, elidedFallbackName, windows=windowsNames, mac=macNames ) # 'locations' contains data for AxisValue Format 4 axisRecords, axisValues = _buildAxisRecords( - axes, nameTable, windowsNames=windowsNames, macNames=macNames + axes, ttFont, windowsNames=windowsNames, macNames=macNames ) if not locations: statTable.Version = 0x00010001 @@ -2797,10 +2796,10 @@ def buildStatTable( # requires a higher table version statTable.Version = 0x00010002 multiAxisValues = _buildAxisValuesFormat4( - locations, axes, nameTable, windowsNames=windowsNames, macNames=macNames + locations, axes, ttFont, windowsNames=windowsNames, macNames=macNames ) axisValues = multiAxisValues + axisValues - nameTable.names.sort() + ttFont["name"].names.sort() # Store AxisRecords axisRecordArray = ot.AxisRecordArray() @@ -2820,14 +2819,14 @@ def buildStatTable( statTable.AxisValueCount = len(axisValues) -def _buildAxisRecords(axes, nameTable, windowsNames=True, macNames=True): +def _buildAxisRecords(axes, ttFont, windowsNames=True, macNames=True): axisRecords = [] axisValues = [] for axisRecordIndex, axisDict in enumerate(axes): axis = ot.AxisRecord() axis.AxisTag = axisDict["tag"] axis.AxisNameID = _addName( - nameTable, axisDict["name"], 256, windows=windowsNames, mac=macNames + ttFont, axisDict["name"], 256, windows=windowsNames, mac=macNames ) axis.AxisOrdering = axisDict.get("ordering", axisRecordIndex) axisRecords.append(axis) @@ -2837,7 +2836,7 @@ def _buildAxisRecords(axes, nameTable, windowsNames=True, macNames=True): axisValRec.AxisIndex = axisRecordIndex axisValRec.Flags = axisVal.get("flags", 0) axisValRec.ValueNameID = _addName( - nameTable, axisVal["name"], windows=windowsNames, mac=macNames + ttFont, axisVal["name"], windows=windowsNames, mac=macNames ) if "value" in axisVal: @@ -2863,9 +2862,7 @@ def _buildAxisRecords(axes, nameTable, windowsNames=True, macNames=True): return axisRecords, axisValues -def _buildAxisValuesFormat4( - locations, axes, nameTable, windowsNames=True, macNames=True -): +def _buildAxisValuesFormat4(locations, axes, ttFont, windowsNames=True, macNames=True): axisTagToIndex = {} for axisRecordIndex, axisDict in enumerate(axes): axisTagToIndex[axisDict["tag"]] = axisRecordIndex @@ -2875,7 +2872,7 @@ def _buildAxisValuesFormat4( axisValRec = ot.AxisValue() axisValRec.Format = 4 axisValRec.ValueNameID = _addName( - nameTable, axisLocationDict["name"], windows=windowsNames, mac=macNames + ttFont, axisLocationDict["name"], windows=windowsNames, mac=macNames ) axisValRec.Flags = axisLocationDict.get("flags", 0) axisValueRecords = [] @@ -2891,7 +2888,8 @@ def _buildAxisValuesFormat4( return axisValues -def _addName(nameTable, value, minNameID=0, windows=True, mac=True): +def _addName(ttFont, value, minNameID=0, windows=True, mac=True): + nameTable = ttFont["name"] if isinstance(value, int): # Already a nameID return value @@ -2916,5 +2914,5 @@ def _addName(nameTable, value, minNameID=0, windows=True, mac=True): else: raise TypeError("value must be int, str, dict or list") return nameTable.addMultilingualName( - names, windows=windows, mac=mac, minNameID=minNameID + names, ttFont=ttFont, windows=windows, mac=mac, minNameID=minNameID ) diff --git a/contrib/python/fonttools/fontTools/varLib/featureVars.py b/contrib/python/fonttools/fontTools/varLib/featureVars.py index a6beb5c7d2..828b843594 100644 --- a/contrib/python/fonttools/fontTools/varLib/featureVars.py +++ b/contrib/python/fonttools/fontTools/varLib/featureVars.py @@ -414,6 +414,10 @@ def addFeatureVariationsRaw(font, table, conditionalSubstitutions, featureTag="r axis.axisTag: axisIndex for axisIndex, axis in enumerate(font["fvar"].axes) } + hasFeatureVariations = ( + hasattr(table, "FeatureVariations") and table.FeatureVariations is not None + ) + featureVariationRecords = [] for conditionSet, lookupIndices in conditionalSubstitutions: conditionTable = [] @@ -440,11 +444,19 @@ def addFeatureVariationsRaw(font, table, conditionalSubstitutions, featureTag="r varFeatureIndex, combinedLookupIndices ) ) - featureVariationRecords.append( - buildFeatureVariationRecord(conditionTable, records) - ) + if hasFeatureVariations and ( + fvr := findFeatureVariationRecord(table.FeatureVariations, conditionTable) + ): + fvr.FeatureTableSubstitution.SubstitutionRecord.extend(records) + fvr.FeatureTableSubstitution.SubstitutionCount = len( + fvr.FeatureTableSubstitution.SubstitutionRecord + ) + else: + featureVariationRecords.append( + buildFeatureVariationRecord(conditionTable, records) + ) - if hasattr(table, "FeatureVariations") and table.FeatureVariations is not None: + if hasFeatureVariations: if table.FeatureVariations.Version != 0x00010000: raise VarLibError( "Unsupported FeatureVariations table version: " @@ -614,6 +626,21 @@ def buildConditionTable(axisIndex, filterRangeMinValue, filterRangeMaxValue): return ct +def findFeatureVariationRecord(featureVariations, conditionTable): + """Find a FeatureVariationRecord that has the same conditionTable.""" + if featureVariations.Version != 0x00010000: + raise VarLibError( + "Unsupported FeatureVariations table version: " + f"0x{featureVariations.Version:08x} (expected 0x00010000)." + ) + + for fvr in featureVariations.FeatureVariationRecord: + if conditionTable == fvr.ConditionSet.ConditionTable: + return fvr + + return None + + def sortFeatureList(table): """Sort the feature list by feature tag, and remap the feature indices elsewhere. This is needed after the feature list has been modified. diff --git a/contrib/python/fonttools/fontTools/varLib/interpolatable.py b/contrib/python/fonttools/fontTools/varLib/interpolatable.py index 0a9bbebc41..5fc12e04c9 100644 --- a/contrib/python/fonttools/fontTools/varLib/interpolatable.py +++ b/contrib/python/fonttools/fontTools/varLib/interpolatable.py @@ -376,9 +376,6 @@ def test_gen( size1 = m1Vec[0] * m1Vec[0] midSize = midVector[0] * midVector[0] - power = 1 - t = tolerance**power - for overweight, problem_type in enumerate( ( InterpolatableProblem.UNDERWEIGHT, @@ -386,8 +383,7 @@ def test_gen( ) ): if overweight: - expectedSize = sqrt(size0 * size1) - expectedSize = (size0 + size1) - expectedSize + expectedSize = max(size0, size1) continue else: expectedSize = sqrt(size0 * size1) @@ -406,13 +402,9 @@ def test_gen( ) or (overweight and 1e-5 + expectedSize / tolerance < midSize): try: if overweight: - this_tolerance = (expectedSize / midSize) ** ( - 1 / power - ) + this_tolerance = expectedSize / midSize else: - this_tolerance = (midSize / expectedSize) ** ( - 1 / power - ) + this_tolerance = midSize / expectedSize except ZeroDivisionError: this_tolerance = 0 log.debug("tolerance %g", this_tolerance) diff --git a/contrib/python/fonttools/ya.make b/contrib/python/fonttools/ya.make index 6e76c94da1..4d380b556c 100644 --- a/contrib/python/fonttools/ya.make +++ b/contrib/python/fonttools/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(4.47.0) +VERSION(4.47.2) LICENSE(MIT) diff --git a/contrib/python/google-auth/py3/.dist-info/METADATA b/contrib/python/google-auth/py3/.dist-info/METADATA index 21345a0555..2820e8856d 100644 --- a/contrib/python/google-auth/py3/.dist-info/METADATA +++ b/contrib/python/google-auth/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: google-auth -Version: 2.26.1 +Version: 2.26.2 Summary: Google Authentication Library Home-page: https://github.com/googleapis/google-auth-library-python Author: Google Cloud Platform diff --git a/contrib/python/google-auth/py3/google/auth/external_account_authorized_user.py b/contrib/python/google-auth/py3/google/auth/external_account_authorized_user.py index 55230103f4..526588f7e8 100644 --- a/contrib/python/google-auth/py3/google/auth/external_account_authorized_user.py +++ b/contrib/python/google-auth/py3/google/auth/external_account_authorized_user.py @@ -342,6 +342,7 @@ class Credentials( revoke_url=info.get("revoke_url"), quota_project_id=info.get("quota_project_id"), scopes=info.get("scopes"), + universe_domain=info.get("universe_domain", _DEFAULT_UNIVERSE_DOMAIN), **kwargs ) diff --git a/contrib/python/google-auth/py3/google/auth/version.py b/contrib/python/google-auth/py3/google/auth/version.py index 1c94c2f5f6..6d53c4c411 100644 --- a/contrib/python/google-auth/py3/google/auth/version.py +++ b/contrib/python/google-auth/py3/google/auth/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2.26.1" +__version__ = "2.26.2" diff --git a/contrib/python/google-auth/py3/tests/data/external_account_authorized_user_non_gdu.json b/contrib/python/google-auth/py3/tests/data/external_account_authorized_user_non_gdu.json new file mode 100644 index 0000000000..b82854c743 --- /dev/null +++ b/contrib/python/google-auth/py3/tests/data/external_account_authorized_user_non_gdu.json @@ -0,0 +1,10 @@ +{ + "type": "external_account_authorized_user", + "audience": "//iam.fake_universe_domain/locations/global/workforcePools/$WORKFORCE_POOL_ID/providers/$PROVIDER_ID", + "refresh_token": "refreshToken", + "token_url": "https://sts.fake_universe_domain/v1/oauth/token", + "token_info_url": "https://sts.fake_universe_domain/v1/instrospect", + "client_id": "clientId", + "client_secret": "clientSecret", + "universe_domain": "fake_universe_domain" +} diff --git a/contrib/python/google-auth/py3/tests/test__default.py b/contrib/python/google-auth/py3/tests/test__default.py index d619614790..aaf892f6d0 100644 --- a/contrib/python/google-auth/py3/tests/test__default.py +++ b/contrib/python/google-auth/py3/tests/test__default.py @@ -158,6 +158,10 @@ EXTERNAL_ACCOUNT_AUTHORIZED_USER_FILE = os.path.join( DATA_DIR, "external_account_authorized_user.json" ) +EXTERNAL_ACCOUNT_AUTHORIZED_USER_NON_GDU_FILE = os.path.join( + DATA_DIR, "external_account_authorized_user_non_gdu.json" +) + MOCK_CREDENTIALS = mock.Mock(spec=credentials.CredentialsWithQuotaProject) MOCK_CREDENTIALS.with_quota_project.return_value = MOCK_CREDENTIALS @@ -577,6 +581,15 @@ def test_load_credentials_from_file_external_account_authorized_user(): assert project_id is None +def test_load_credentials_from_file_external_account_authorized_user_non_gdu(): + credentials, _ = _default.load_credentials_from_file( + EXTERNAL_ACCOUNT_AUTHORIZED_USER_NON_GDU_FILE, request=mock.sentinel.request + ) + + assert isinstance(credentials, external_account_authorized_user.Credentials) + assert credentials.universe_domain == "fake_universe_domain" + + def test_load_credentials_from_file_external_account_authorized_user_bad_format(tmpdir): filename = tmpdir.join("external_account_authorized_user_bad.json") filename.write(json.dumps({"type": "external_account_authorized_user"})) diff --git a/contrib/python/google-auth/py3/ya.make b/contrib/python/google-auth/py3/ya.make index 75848da971..976b926bff 100644 --- a/contrib/python/google-auth/py3/ya.make +++ b/contrib/python/google-auth/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(2.26.1) +VERSION(2.26.2) LICENSE(Apache-2.0) diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index bf3a10e9cc..b4f00cf430 100644 --- a/contrib/python/hypothesis/py3/.dist-info/METADATA +++ b/contrib/python/hypothesis/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hypothesis -Version: 6.92.7 +Version: 6.92.8 Summary: A library for property-based testing Home-page: https://hypothesis.works Author: David R. MacIver and Zac Hatfield-Dodds diff --git a/contrib/python/hypothesis/py3/hypothesis/control.py b/contrib/python/hypothesis/py3/hypothesis/control.py index c49dba2954..3a973f666f 100644 --- a/contrib/python/hypothesis/py3/hypothesis/control.py +++ b/contrib/python/hypothesis/py3/hypothesis/control.py @@ -8,6 +8,7 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. +import inspect import math from collections import defaultdict from typing import NoReturn, Union @@ -25,6 +26,10 @@ from hypothesis.utils.dynamicvariables import DynamicVariable from hypothesis.vendor.pretty import IDKey +def _calling_function_name(frame): + return frame.f_back.f_code.co_name + + def reject() -> NoReturn: if _current_build_context.value is None: note_deprecation( @@ -32,7 +37,8 @@ def reject() -> NoReturn: since="2023-09-25", has_codemod=False, ) - raise UnsatisfiedAssumption + f = _calling_function_name(inspect.currentframe()) + raise UnsatisfiedAssumption(f"reject() in {f}") def assume(condition: object) -> bool: @@ -49,7 +55,8 @@ def assume(condition: object) -> bool: has_codemod=False, ) if not condition: - raise UnsatisfiedAssumption + f = _calling_function_name(inspect.currentframe()) + raise UnsatisfiedAssumption(f"failed to satisfy assume() in {f}") return True diff --git a/contrib/python/hypothesis/py3/hypothesis/core.py b/contrib/python/hypothesis/py3/hypothesis/core.py index 7c149d1222..86b20ea6f9 100644 --- a/contrib/python/hypothesis/py3/hypothesis/core.py +++ b/contrib/python/hypothesis/py3/hypothesis/core.py @@ -1005,10 +1005,10 @@ class StateForActualGivenExecution: f"{self.test.__name__} returned {result!r} instead.", HealthCheck.return_value, ) - except UnsatisfiedAssumption: + except UnsatisfiedAssumption as e: # An "assume" check failed, so instead we inform the engine that # this test run was invalid. - data.mark_invalid() + data.mark_invalid(e.reason) except StopTest: # The engine knows how to handle this control exception, so it's # OK to re-raise it. diff --git a/contrib/python/hypothesis/py3/hypothesis/errors.py b/contrib/python/hypothesis/py3/hypothesis/errors.py index 9ee81cfc36..8387a87586 100644 --- a/contrib/python/hypothesis/py3/hypothesis/errors.py +++ b/contrib/python/hypothesis/py3/hypothesis/errors.py @@ -23,6 +23,9 @@ class UnsatisfiedAssumption(HypothesisException): If you're seeing this error something has gone wrong. """ + def __init__(self, reason=None): + self.reason = reason + class NoSuchExample(HypothesisException): """The condition we have been asked to satisfy appears to be always false. diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index cd924cc7a7..ef8fe6a63a 100644 --- a/contrib/python/hypothesis/py3/hypothesis/version.py +++ b/contrib/python/hypothesis/py3/hypothesis/version.py @@ -8,5 +8,5 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. -__version_info__ = (6, 92, 7) +__version_info__ = (6, 92, 8) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index 6616c6d3b9..92b1d0c734 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.92.7) +VERSION(6.92.8) LICENSE(MPL-2.0) |