Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/safety_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Safety Scan

on:
push: # Run on every push to any branch
pull_request: # Run on new pull requests

jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Run Safety CLI to check for vulnerabilities
uses: pyupio/safety-action@v1
with:
api-key: ${{ secrets.SAFETY_API_KEY }}
39 changes: 19 additions & 20 deletions .github/workflows/test_lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,23 @@ jobs:
test_and_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install --upgrade pip wheel
- run: pip install bandit black codespell flake8 flake8-2020 flake8-bugbear
flake8-comprehensions isort mypy pytest pyupgrade safety
- run: bandit --recursive --skip B101 . || true # B101 is assert statements
- run: black --check . || true
- run: codespell || true # --ignore-words-list="" --skip="*.css,*.js,*.lock"
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88
--show-source --statistics
- run: isort --check-only --profile black . || true
- run: pip install -r requirements.txt || pip install --editable . || true
- run: pip install -r dev-requirements.txt
- run: pip install .
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: abatilo/actions-poetry@v3
- run: poetry config virtualenvs.create true --local
- run: poetry config virtualenvs.in-project true --local
- run: poetry install
- run: poetry run bandit --recursive --skip B101 delorean || true # B101 is assert statements
- run: poetry run black --check delorean || true
- run: poetry run codespell delorean || true # --ignore-words-list="" --skip="*.css,*.js,*.lock"
- run: poetry run flake8 delorean --count --select=E9,F63,F7,F82 --show-source --statistics
- run: poetry run flake8 delorean --count --exit-zero --max-complexity=10 --max-line-length=88
--show-source --statistics || true
- run: poetry run isort --check-only --profile black delorean || true
- run: mkdir --parents --verbose .mypy_cache
- run: mypy --ignore-missing-imports --install-types --non-interactive . || true
- run: pytest tests/delorean_tests.py
- run: pytest --doctest-modules
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true
- run: safety check
- run: poetry run mypy --ignore-missing-imports --install-types --non-interactive --exclude ./docs/ delorean
- run: poetry run pytest tests/delorean_tests.py
- run: poetry run pytest --doctest-modules
- run: poetry run nosetests --with-coverage --cover-package=delorean
263 changes: 243 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,258 @@
*.py[co]
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Packages
*.egg
*.egg-info
.eggs
dist
build
eggs
parts
bin
var
sdist
develop-eggs
# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.tox
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

#Translations
# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/
.idea/sonarlint.xml # see https://community.sonarsource.com/t/is-the-file-idea-idea-idea-sonarlint-xml-intended-to-be-under-source-control/121119

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

#Mr Developer
.mr.developer.cfg
.DS_Store

#docs
_build

# IDE
.idea
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
PKGDIR=delorean

test:
nosetests --with-coverage --cover-package=delorean
-bandit --recursive --skip B101 ${PKGDIR}
-black --check ${PKGDIR}
-codespell ${PKGDIR}
-flake8 --count --select=E9,F63,F7,F82 --show-source --statistics ${PKGDIR}
-flake8 --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics ${PKGDIR}
-isort --check-only --profile black ${PKGDIR}
-mypy --ignore-missing-imports --install-types --non-interactive --exclude ./docs/ ${PKGDIR}
-pytest tests/delorean_tests.py
-pytest --doctest-modules
-nosetests --with-coverage --cover-package=${PKGDIR}

doc:
make -C docs clean doctest html
Expand Down
4 changes: 2 additions & 2 deletions delorean/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,10 @@ def format_datetime(self, format='medium', locale='en_US'):

>>> d = Delorean(datetime(2015, 1, 1, 12, 30), timezone='US/Pacific')
>>> d.format_datetime(locale='en_US')
'Jan 1, 2015, 12:30:00 PM'
'Jan 1, 2015, 12:30:00\u202fPM'

>>> d.format_datetime(format='long', locale='de_DE')
'1. Januar 2015 um 12:30:00 -0800'
'1. Januar 2015, 12:30:00 -0800'

:param format: one of "full", "long", "medium", "short", or a custom datetime pattern
:param locale: a locale identifier
Expand Down
8 changes: 0 additions & 8 deletions dev-requirements.in

This file was deleted.

Loading