Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-Faker for openSUSE:Factory checked in at 2024-01-09 20:49:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Faker (Old) and /work/SRC/openSUSE:Factory/.python-Faker.new.21961 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Faker" Tue Jan 9 20:49:07 2024 rev:49 rq:1137642 version:22.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Faker/python-Faker.changes 2024-01-07 21:39:16.049760603 +0100 +++ /work/SRC/openSUSE:Factory/.python-Faker.new.21961/python-Faker.changes 2024-01-09 20:49:24.779695806 +0100 @@ -1,0 +2,6 @@ +Mon Jan 8 21:00:30 UTC 2024 - Dirk Müller <dmuel...@suse.com> + +- update to 22.1.0: + * Add support for multiple file systems path rules. + +------------------------------------------------------------------- Old: ---- Faker-22.0.0.tar.gz New: ---- Faker-22.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Faker.spec ++++++ --- /var/tmp/diff_new_pack.Sz9GT4/_old 2024-01-09 20:49:25.315715294 +0100 +++ /var/tmp/diff_new_pack.Sz9GT4/_new 2024-01-09 20:49:25.319715439 +0100 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-Faker -Version: 22.0.0 +Version: 22.1.0 Release: 0 Summary: Python package that generates fake data License: MIT ++++++ Faker-22.0.0.tar.gz -> Faker-22.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Faker-22.0.0/CHANGELOG.md new/Faker-22.1.0/CHANGELOG.md --- old/Faker-22.0.0/CHANGELOG.md 2023-12-29 17:13:37.000000000 +0100 +++ new/Faker-22.1.0/CHANGELOG.md 2024-01-08 17:51:06.000000000 +0100 @@ -1,5 +1,9 @@ ## Changelog +### [v22.1.0 - 2024-01-08](https://github.com/joke2k/faker/compare/v22.0.0...v22.1.0) + +* Add support for multiple file systems path rules. Thanks @parsariyahi. + ### [v22.0.0 - 2023-12-29](https://github.com/joke2k/faker/compare/v21.0.1...v22.0.0) * Remove dot from `file_name` when `extention` is the empty string. Thanks @gotofritz diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Faker-22.0.0/Faker.egg-info/PKG-INFO new/Faker-22.1.0/Faker.egg-info/PKG-INFO --- old/Faker-22.0.0/Faker.egg-info/PKG-INFO 2023-12-29 17:14:00.000000000 +0100 +++ new/Faker-22.1.0/Faker.egg-info/PKG-INFO 2024-01-08 17:52:14.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: Faker -Version: 22.0.0 +Version: 22.1.0 Summary: Faker is a Python package that generates fake data for you. Home-page: https://github.com/joke2k/faker Author: joke2k diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Faker-22.0.0/PKG-INFO new/Faker-22.1.0/PKG-INFO --- old/Faker-22.0.0/PKG-INFO 2023-12-29 17:14:01.770661000 +0100 +++ new/Faker-22.1.0/PKG-INFO 2024-01-08 17:52:16.039365300 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: Faker -Version: 22.0.0 +Version: 22.1.0 Summary: Faker is a Python package that generates fake data for you. Home-page: https://github.com/joke2k/faker Author: joke2k diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Faker-22.0.0/VERSION new/Faker-22.1.0/VERSION --- old/Faker-22.0.0/VERSION 2023-12-29 17:13:52.000000000 +0100 +++ new/Faker-22.1.0/VERSION 2024-01-08 17:52:02.000000000 +0100 @@ -1 +1 @@ -22.0.0 +22.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Faker-22.0.0/faker/__init__.py new/Faker-22.1.0/faker/__init__.py --- old/Faker-22.0.0/faker/__init__.py 2023-12-29 17:13:52.000000000 +0100 +++ new/Faker-22.1.0/faker/__init__.py 2024-01-08 17:52:02.000000000 +0100 @@ -2,6 +2,6 @@ from faker.generator import Generator from faker.proxy import Faker -VERSION = "22.0.0" +VERSION = "22.1.0" __all__ = ("Factory", "Generator", "Faker") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Faker-22.0.0/faker/providers/file/__init__.py new/Faker-22.1.0/faker/providers/file/__init__.py --- old/Faker-22.0.0/faker/providers/file/__init__.py 2023-12-29 17:00:53.000000000 +0100 +++ new/Faker-22.1.0/faker/providers/file/__init__.py 2024-01-08 16:38:19.000000000 +0100 @@ -1,7 +1,7 @@ import string from collections import OrderedDict -from typing import Dict, Optional, Sequence, Union +from typing import Dict, Literal, Optional, Sequence, Union from .. import BaseProvider, ElementsType @@ -204,6 +204,18 @@ ("video", video_file_extensions), ) ) + + file_systems_path_rules: Dict[str, Dict] = { + "windows": { + "root": "C:\\", + "separator": "\\", + }, + "linux": { + "root": "/", + "separator": "/", + }, + } + unix_device_prefixes: ElementsType[str] = ("sd", "vd", "xvd") def mime_type(self, category: Optional[str] = None) -> str: @@ -262,6 +274,7 @@ category: Optional[str] = None, extension: Optional[Union[str, Sequence[str]]] = None, absolute: Optional[bool] = True, + file_system_rule: Literal["linux", "windows"] = "linux", ) -> str: """Generate an pathname to a file. @@ -279,6 +292,10 @@ or an empty sequence (the path will have no extension). Default behaviour is the same as |file_name| + if ``file_system`` is set (default="linux"), the generated path uses + specified file system path standard, the list of valid file systems include: + ``'windows'``, ``'linux'``. + :sample: size=10 :sample: depth=3 :sample: depth=5, category='video' @@ -286,18 +303,27 @@ :sample: extension=[] :sample: extension='' :sample: extension=["a", "bc", "def"] + :sample: depth=5, category='video', extension='abcdef', file_system='windows' """ + if extension is not None and not isinstance(extension, str): if len(extension): extension = self.random_element(extension) else: extension = "" - file: str = self.file_name(category, extension) - path: str = f"/{file}" + fs_rule = self.file_systems_path_rules.get(file_system_rule, None) + if not fs_rule: + raise TypeError("Specified file system is invalid.") + + root = fs_rule["root"] + seperator = fs_rule["separator"] + + path: str = self.file_name(category, extension) for _ in range(0, depth): - path = f"/{self.generator.word()}{path}" - return path if absolute else path[1:] + path = f"{self.generator.word()}{seperator}{path}" + + return root + path if absolute else path def unix_device(self, prefix: Optional[str] = None) -> str: """Generate a Unix device file name. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Faker-22.0.0/tests/providers/test_file.py new/Faker-22.1.0/tests/providers/test_file.py --- old/Faker-22.0.0/tests/providers/test_file.py 2023-12-29 17:00:53.000000000 +0100 +++ new/Faker-22.1.0/tests/providers/test_file.py 2024-01-08 16:32:59.000000000 +0100 @@ -45,7 +45,12 @@ file_path = self.fake.file_path(extension=[]) assert re.search(r"\/\w+\/\w+$", file_path) file_path = self.fake.file_path(category="image") - assert re.search(r"\/\w+\/\w+\.(bmp|gif|jpeg|jpg|png|tiff)$", file_path) + assert re.search(r"\/\w+\/\w+\.(bmp|gif|jpeg|jpg|png|tiff)", file_path) + file_path = self.fake.file_path(file_system_rule="windows") + assert re.search(r"\\\w+\\\w+\.\w+", file_path) + file_path = self.fake.file_path(file_system_rule="windows", category="image", absolute=True) + assert re.search(r"^[a-zA-Z]:\\\w+\\\w+\.\w+", file_path) + assert re.search(r"\\\w+\\\w+\.(bmp|gif|jpeg|jpg|png|tiff)$", file_path) def test_unix_device(self): reg_device = re.compile(r"^/dev/(vd|sd|xvd)[a-z]$")