Skip to content

Commit

Permalink
Merge pull request #7 from barseghyanartur/dev
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
barseghyanartur authored Sep 11, 2024
2 parents 9e3aec4 + 7610b88 commit 4b50bb5
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 55 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ are used for versioning (schema follows below):
0.3.4 to 0.4).
- All backwards incompatible changes are mentioned in this document.

0.1.1
-----
2024-09-11

- Minor optimisations.

0.1
-----
2024-08-14
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Update version ONLY here
VERSION := 0.1
VERSION := 0.1.1
SHELL := /bin/bash
# Makefile for project
VENV := ~/.virtualenvs/fake-py-django-storage/bin/activate
Expand Down
82 changes: 41 additions & 41 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ backports-tarfile==1.2.0
# via jaraco-context
black==24.8.0
# via fake-py-django-storage (pyproject.toml)
boto3==1.34.158
boto3==1.35.16
# via
# django-storages
# moto
botocore==1.34.158
botocore==1.35.16
# via
# boto3
# moto
# s3transfer
build==1.2.1
build==1.2.2
# via pip-tools
cachetools==5.4.0
cachetools==5.5.0
# via google-auth
certifi==2024.7.4
certifi==2024.8.30
# via requests
cffi==1.17.0
cffi==1.17.1
# via cryptography
charset-normalizer==3.3.2
# via requests
Expand All @@ -44,7 +44,7 @@ click==8.1.7
# pydoclint
coverage==7.6.1
# via pytest-cov
cryptography==43.0.0
cryptography==43.0.1
# via
# azure-storage-blob
# moto
Expand All @@ -53,13 +53,13 @@ decorator==5.1.1
# via ipython
detect-secrets==1.5.0
# via fake-py-django-storage (pyproject.toml)
django==5.1
django==5.1.1
# via
# fake-py-django-storage (pyproject.toml)
# django-storages
django-storages==1.14.4
# via fake-py-django-storage (pyproject.toml)
doc8==1.1.1
doc8==1.1.2
# via fake-py-django-storage (pyproject.toml)
docstring-parser-fork==0.0.9
# via pydoclint
Expand All @@ -75,48 +75,50 @@ exceptiongroup==1.2.2
# via
# ipython
# pytest
executing==2.0.1
executing==2.1.0
# via stack-data
fake-py==0.9.3
fake-py==0.9.5
# via fake-py-django-storage (pyproject.toml)
google-api-core==2.19.1
google-api-core==2.19.2
# via
# google-cloud-core
# google-cloud-storage
google-auth==2.33.0
google-auth==2.34.0
# via
# google-api-core
# google-cloud-core
# google-cloud-storage
google-cloud-core==2.4.1
# via google-cloud-storage
google-cloud-storage==1.44.0
google-cloud-storage==2.18.2
# via django-storages
google-crc32c==1.5.0
# via google-resumable-media
google-crc32c==1.6.0
# via
# google-cloud-storage
# google-resumable-media
google-resumable-media==2.7.2
# via google-cloud-storage
googleapis-common-protos==1.63.2
googleapis-common-protos==1.65.0
# via google-api-core
idna==3.7
idna==3.8
# via requests
imagesize==1.4.1
# via sphinx
importlib-metadata==8.2.0
importlib-metadata==8.5.0
# via
# keyring
# twine
iniconfig==2.0.0
# via pytest
ipython==8.26.0
ipython==8.27.0
# via fake-py-django-storage (pyproject.toml)
isodate==0.6.1
# via azure-storage-blob
isort==5.13.2
# via fake-py-django-storage (pyproject.toml)
jaraco-classes==3.4.0
# via keyring
jaraco-context==5.3.0
jaraco-context==6.0.1
# via keyring
jaraco-functools==4.0.2
# via keyring
Expand Down Expand Up @@ -146,13 +148,13 @@ matplotlib-inline==0.1.7
# via ipython
mdurl==0.1.2
# via markdown-it-py
more-itertools==10.4.0
more-itertools==10.5.0
# via
# jaraco-classes
# jaraco-functools
moto==5.0.12
moto==5.0.14
# via fake-py-django-storage (pyproject.toml)
mypy==1.11.1
mypy==1.11.2
# via fake-py-django-storage (pyproject.toml)
mypy-extensions==1.0.0
# via
Expand All @@ -172,7 +174,7 @@ parso==0.8.4
# via jedi
pathspec==0.12.1
# via black
pbr==6.0.0
pbr==6.1.0
# via stevedore
pexpect==4.9.0
# via ipython
Expand All @@ -182,33 +184,32 @@ pip-tools==7.4.1
# via fake-py-django-storage (pyproject.toml)
pkginfo==1.10.0
# via twine
platformdirs==4.2.2
platformdirs==4.3.2
# via black
pluggy==1.5.0
# via pytest
prompt-toolkit==3.0.47
# via ipython
proto-plus==1.24.0
# via google-api-core
protobuf==5.27.3
protobuf==5.28.1
# via
# google-api-core
# google-cloud-storage
# googleapis-common-protos
# proto-plus
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.3
# via stack-data
pyasn1==0.6.0
pyasn1==0.6.1
# via
# pyasn1-modules
# rsa
pyasn1-modules==0.4.0
pyasn1-modules==0.4.1
# via google-auth
pycparser==2.22
# via cffi
pydoclint==0.5.6
pydoclint==0.5.7
# via fake-py-django-storage (pyproject.toml)
pygments==2.18.0
# via
Expand All @@ -221,14 +222,14 @@ pyproject-hooks==1.1.0
# via
# build
# pip-tools
pytest==8.3.2
pytest==8.3.3
# via
# fake-py-django-storage (pyproject.toml)
# pytest-cov
# pytest-django
pytest-cov==5.0.0
# via fake-py-django-storage (pyproject.toml)
pytest-django==4.8.0
pytest-django==4.9.0
# via fake-py-django-storage (pyproject.toml)
pytest-rst==0.1.5
# via fake-py-django-storage (pyproject.toml)
Expand Down Expand Up @@ -261,23 +262,22 @@ restructuredtext-lint==1.4.0
# via doc8
rfc3986==2.0.0
# via twine
rich==13.7.1
rich==13.8.1
# via twine
rsa==4.9
# via google-auth
ruff==0.5.7
ruff==0.6.4
# via fake-py-django-storage (pyproject.toml)
s3transfer==0.10.2
# via boto3
secretstorage==3.3.3
# via keyring
setuptools==72.1.0
setuptools==74.1.2
# via pip-tools
six==1.16.0
# via
# asttokens
# azure-core
# google-cloud-storage
# isodate
# python-dateutil
snowballstemmer==2.2.0
Expand Down Expand Up @@ -310,7 +310,7 @@ sqlparse==0.5.1
# via django
stack-data==0.6.3
# via ipython
stevedore==5.2.0
stevedore==5.3.0
# via doc8
tomli==2.0.1
# via
Expand Down Expand Up @@ -342,15 +342,15 @@ urllib3==2.2.2
# requests
# responses
# twine
uv==0.2.34
uv==0.4.9
# via fake-py-django-storage (pyproject.toml)
wcwidth==0.2.13
# via prompt-toolkit
werkzeug==3.0.3
werkzeug==3.0.4
# via moto
wheel==0.44.0
# via pip-tools
xmltodict==0.13.0
# via moto
zipp==3.19.2
zipp==3.20.1
# via importlib-metadata
2 changes: 1 addition & 1 deletion fakepy/django_storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
__author__ = "Artur Barseghyan <artur.barseghyan@gmail.com>"
__copyright__ = "2024 Artur Barseghyan"
__license__ = "MIT"
__version__ = "0.1"
__version__ = "0.1.1"
15 changes: 5 additions & 10 deletions fakepy/django_storage/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
from abc import abstractmethod
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import Optional, Union

from django.core.files.base import ContentFile
Expand Down Expand Up @@ -74,15 +73,11 @@ def generate_filename(
if not extension:
raise Exception("Extension shall be given!")

if basename:
filename = f"{basename}.{extension}"
else:
temp_file = NamedTemporaryFile(
prefix=prefix,
suffix=f".{extension}",
delete=False,
)
filename = Path(temp_file.name).name
if not basename:
basename = self.generate_basename(prefix)

filename = f"{basename}.{extension}"

return os.path.join(dir_path, filename)

def write_text(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
name = "fake-py-django-storage"
description = "Django storage for fake.py"
readme = "README.rst"
version = "0.1"
version = "0.1.1"
dependencies = [
"fake.py",
"fake.py>=0.9.5",
"django",
]
authors = [
Expand Down

0 comments on commit 4b50bb5

Please sign in to comment.