From 2ef6744e280d27ad460a6389bc1696a18fb4af6e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 28 Feb 2025 11:57:39 -0800 Subject: [PATCH 01/10] feat: added testimonial update endpoint and schema --- .dev/bin/Activate.ps1 | 247 ++++++++++++++++++ .dev/bin/activate | 70 +++++ .dev/bin/activate.csh | 27 ++ .dev/bin/activate.fish | 69 +++++ .dev/bin/alembic | 8 + .dev/bin/autopep8 | 8 + .dev/bin/black | 8 + .dev/bin/blackd | 8 + .dev/bin/csscapture | 8 + .dev/bin/csscombine | 8 + .dev/bin/cssparse | 8 + .dev/bin/dotenv | 8 + .dev/bin/email_validator | 8 + .dev/bin/faker | 8 + .dev/bin/fastapi | 8 + .dev/bin/flake8 | 8 + .dev/bin/get_gprof | 75 ++++++ .dev/bin/get_objgraph | 54 ++++ .dev/bin/httpx | 8 + .dev/bin/identify-cli | 8 + .dev/bin/isort | 8 + .dev/bin/isort-identify-imports | 8 + .dev/bin/mako-render | 8 + .dev/bin/markdown-it | 8 + .dev/bin/nodeenv | 8 + .dev/bin/normalizer | 8 + .dev/bin/pip | 8 + .dev/bin/pip3 | 8 + .dev/bin/pip3.12 | 8 + .dev/bin/pipdeptree | 8 + .dev/bin/pre-commit | 8 + .dev/bin/py.test | 8 + .dev/bin/pycodestyle | 8 + .dev/bin/pyflakes | 8 + .dev/bin/pygmentize | 8 + .dev/bin/pylint | 8 + .dev/bin/pylint-config | 8 + .dev/bin/pyreverse | 8 + .dev/bin/pyrsa-decrypt | 8 + .dev/bin/pyrsa-encrypt | 8 + .dev/bin/pyrsa-keygen | 8 + .dev/bin/pyrsa-priv2pub | 8 + .dev/bin/pyrsa-sign | 8 + .dev/bin/pyrsa-verify | 8 + .dev/bin/pytest | 8 + .dev/bin/python | 1 + .dev/bin/python3 | 1 + .dev/bin/python3.12 | 1 + .dev/bin/symilar | 8 + .dev/bin/typer | 8 + .dev/bin/undill | 22 ++ .dev/bin/uvicorn | 8 + .dev/bin/virtualenv | 8 + .dev/bin/watchfiles | 8 + .../site/python3.12/greenlet/greenlet.h | 164 ++++++++++++ .dev/lib64 | 1 + .dev/pyvenv.cfg | 5 + alembic.ini | 3 +- api/v1/models/activity_logs.py | 2 +- api/v1/models/testimonial.py | 2 + api/v1/routes/testimonial.py | 35 +++ api/v1/schemas/testimonial.py | 10 +- api/v1/services/testimonial.py | 16 +- 63 files changed, 1152 insertions(+), 5 deletions(-) create mode 100644 .dev/bin/Activate.ps1 create mode 100644 .dev/bin/activate create mode 100644 .dev/bin/activate.csh create mode 100644 .dev/bin/activate.fish create mode 100644 .dev/bin/alembic create mode 100644 .dev/bin/autopep8 create mode 100644 .dev/bin/black create mode 100644 .dev/bin/blackd create mode 100644 .dev/bin/csscapture create mode 100644 .dev/bin/csscombine create mode 100644 .dev/bin/cssparse create mode 100644 .dev/bin/dotenv create mode 100644 .dev/bin/email_validator create mode 100644 .dev/bin/faker create mode 100644 .dev/bin/fastapi create mode 100644 .dev/bin/flake8 create mode 100644 .dev/bin/get_gprof create mode 100644 .dev/bin/get_objgraph create mode 100644 .dev/bin/httpx create mode 100644 .dev/bin/identify-cli create mode 100644 .dev/bin/isort create mode 100644 .dev/bin/isort-identify-imports create mode 100644 .dev/bin/mako-render create mode 100644 .dev/bin/markdown-it create mode 100644 .dev/bin/nodeenv create mode 100644 .dev/bin/normalizer create mode 100644 .dev/bin/pip create mode 100644 .dev/bin/pip3 create mode 100644 .dev/bin/pip3.12 create mode 100644 .dev/bin/pipdeptree create mode 100644 .dev/bin/pre-commit create mode 100644 .dev/bin/py.test create mode 100644 .dev/bin/pycodestyle create mode 100644 .dev/bin/pyflakes create mode 100644 .dev/bin/pygmentize create mode 100644 .dev/bin/pylint create mode 100644 .dev/bin/pylint-config create mode 100644 .dev/bin/pyreverse create mode 100644 .dev/bin/pyrsa-decrypt create mode 100644 .dev/bin/pyrsa-encrypt create mode 100644 .dev/bin/pyrsa-keygen create mode 100644 .dev/bin/pyrsa-priv2pub create mode 100644 .dev/bin/pyrsa-sign create mode 100644 .dev/bin/pyrsa-verify create mode 100644 .dev/bin/pytest create mode 120000 .dev/bin/python create mode 120000 .dev/bin/python3 create mode 120000 .dev/bin/python3.12 create mode 100644 .dev/bin/symilar create mode 100644 .dev/bin/typer create mode 100644 .dev/bin/undill create mode 100644 .dev/bin/uvicorn create mode 100644 .dev/bin/virtualenv create mode 100644 .dev/bin/watchfiles create mode 100644 .dev/include/site/python3.12/greenlet/greenlet.h create mode 120000 .dev/lib64 create mode 100644 .dev/pyvenv.cfg diff --git a/.dev/bin/Activate.ps1 b/.dev/bin/Activate.ps1 new file mode 100644 index 000000000..b49d77ba4 --- /dev/null +++ b/.dev/bin/Activate.ps1 @@ -0,0 +1,247 @@ +<# +.Synopsis +Activate a Python virtual environment for the current PowerShell session. + +.Description +Pushes the python executable for a virtual environment to the front of the +$Env:PATH environment variable and sets the prompt to signify that you are +in a Python virtual environment. Makes use of the command line switches as +well as the `pyvenv.cfg` file values present in the virtual environment. + +.Parameter VenvDir +Path to the directory that contains the virtual environment to activate. The +default value for this is the parent of the directory that the Activate.ps1 +script is located within. + +.Parameter Prompt +The prompt prefix to display when this virtual environment is activated. By +default, this prompt is the name of the virtual environment folder (VenvDir) +surrounded by parentheses and followed by a single space (ie. '(.venv) '). + +.Example +Activate.ps1 +Activates the Python virtual environment that contains the Activate.ps1 script. + +.Example +Activate.ps1 -Verbose +Activates the Python virtual environment that contains the Activate.ps1 script, +and shows extra information about the activation as it executes. + +.Example +Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv +Activates the Python virtual environment located in the specified location. + +.Example +Activate.ps1 -Prompt "MyPython" +Activates the Python virtual environment that contains the Activate.ps1 script, +and prefixes the current prompt with the specified string (surrounded in +parentheses) while the virtual environment is active. + +.Notes +On Windows, it may be required to enable this Activate.ps1 script by setting the +execution policy for the user. You can do this by issuing the following PowerShell +command: + +PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + +For more information on Execution Policies: +https://go.microsoft.com/fwlink/?LinkID=135170 + +#> +Param( + [Parameter(Mandatory = $false)] + [String] + $VenvDir, + [Parameter(Mandatory = $false)] + [String] + $Prompt +) + +<# Function declarations --------------------------------------------------- #> + +<# +.Synopsis +Remove all shell session elements added by the Activate script, including the +addition of the virtual environment's Python executable from the beginning of +the PATH variable. + +.Parameter NonDestructive +If present, do not remove this function from the global namespace for the +session. + +#> +function global:deactivate ([switch]$NonDestructive) { + # Revert to original values + + # The prior prompt: + if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { + Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt + Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT + } + + # The prior PYTHONHOME: + if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { + Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME + Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME + } + + # The prior PATH: + if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { + Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH + Remove-Item -Path Env:_OLD_VIRTUAL_PATH + } + + # Just remove the VIRTUAL_ENV altogether: + if (Test-Path -Path Env:VIRTUAL_ENV) { + Remove-Item -Path env:VIRTUAL_ENV + } + + # Just remove VIRTUAL_ENV_PROMPT altogether. + if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { + Remove-Item -Path env:VIRTUAL_ENV_PROMPT + } + + # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: + if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { + Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force + } + + # Leave deactivate function in the global namespace if requested: + if (-not $NonDestructive) { + Remove-Item -Path function:deactivate + } +} + +<# +.Description +Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the +given folder, and returns them in a map. + +For each line in the pyvenv.cfg file, if that line can be parsed into exactly +two strings separated by `=` (with any amount of whitespace surrounding the =) +then it is considered a `key = value` line. The left hand string is the key, +the right hand is the value. + +If the value starts with a `'` or a `"` then the first and last character is +stripped from the value before being captured. + +.Parameter ConfigDir +Path to the directory that contains the `pyvenv.cfg` file. +#> +function Get-PyVenvConfig( + [String] + $ConfigDir +) { + Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" + + # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). + $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue + + # An empty map will be returned if no config file is found. + $pyvenvConfig = @{ } + + if ($pyvenvConfigPath) { + + Write-Verbose "File exists, parse `key = value` lines" + $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath + + $pyvenvConfigContent | ForEach-Object { + $keyval = $PSItem -split "\s*=\s*", 2 + if ($keyval[0] -and $keyval[1]) { + $val = $keyval[1] + + # Remove extraneous quotations around a string value. + if ("'""".Contains($val.Substring(0, 1))) { + $val = $val.Substring(1, $val.Length - 2) + } + + $pyvenvConfig[$keyval[0]] = $val + Write-Verbose "Adding Key: '$($keyval[0])'='$val'" + } + } + } + return $pyvenvConfig +} + + +<# Begin Activate script --------------------------------------------------- #> + +# Determine the containing directory of this script +$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition +$VenvExecDir = Get-Item -Path $VenvExecPath + +Write-Verbose "Activation script is located in path: '$VenvExecPath'" +Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" +Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" + +# Set values required in priority: CmdLine, ConfigFile, Default +# First, get the location of the virtual environment, it might not be +# VenvExecDir if specified on the command line. +if ($VenvDir) { + Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" +} +else { + Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." + $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") + Write-Verbose "VenvDir=$VenvDir" +} + +# Next, read the `pyvenv.cfg` file to determine any required value such +# as `prompt`. +$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir + +# Next, set the prompt from the command line, or the config file, or +# just use the name of the virtual environment folder. +if ($Prompt) { + Write-Verbose "Prompt specified as argument, using '$Prompt'" +} +else { + Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" + if ($pyvenvCfg -and $pyvenvCfg['prompt']) { + Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" + $Prompt = $pyvenvCfg['prompt']; + } + else { + Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" + Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" + $Prompt = Split-Path -Path $venvDir -Leaf + } +} + +Write-Verbose "Prompt = '$Prompt'" +Write-Verbose "VenvDir='$VenvDir'" + +# Deactivate any currently active virtual environment, but leave the +# deactivate function in place. +deactivate -nondestructive + +# Now set the environment variable VIRTUAL_ENV, used by many tools to determine +# that there is an activated venv. +$env:VIRTUAL_ENV = $VenvDir + +if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { + + Write-Verbose "Setting prompt to '$Prompt'" + + # Set the prompt to include the env name + # Make sure _OLD_VIRTUAL_PROMPT is global + function global:_OLD_VIRTUAL_PROMPT { "" } + Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT + New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt + + function global:prompt { + Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " + _OLD_VIRTUAL_PROMPT + } + $env:VIRTUAL_ENV_PROMPT = $Prompt +} + +# Clear PYTHONHOME +if (Test-Path -Path Env:PYTHONHOME) { + Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME + Remove-Item -Path Env:PYTHONHOME +} + +# Add the venv to the PATH +Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH +$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/.dev/bin/activate b/.dev/bin/activate new file mode 100644 index 000000000..3683010f6 --- /dev/null +++ b/.dev/bin/activate @@ -0,0 +1,70 @@ +# This file must be used with "source bin/activate" *from bash* +# You cannot run it directly + +deactivate () { + # reset old environment variables + if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # Call hash to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + hash -r 2> /dev/null + + if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + unset VIRTUAL_ENV_PROMPT + if [ ! "${1:-}" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +# on Windows, a path can contain colons and backslashes and has to be converted: +if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then + # transform D:\path\to\venv to /d/path/to/venv on MSYS + # and to /cygdrive/d/path/to/venv on Cygwin + export VIRTUAL_ENV=$(cygpath /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev) +else + # use the path as-is + export VIRTUAL_ENV=/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev +fi + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/"bin":$PATH" +export PATH + +# unset PYTHONHOME if set +# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) +# could use `if (set -u; : $PYTHONHOME) ;` in bash +if [ -n "${PYTHONHOME:-}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1:-}" + PS1='(.dev) '"${PS1:-}" + export PS1 + VIRTUAL_ENV_PROMPT='(.dev) ' + export VIRTUAL_ENV_PROMPT +fi + +# Call hash to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +hash -r 2> /dev/null diff --git a/.dev/bin/activate.csh b/.dev/bin/activate.csh new file mode 100644 index 000000000..273574392 --- /dev/null +++ b/.dev/bin/activate.csh @@ -0,0 +1,27 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. + +# Created by Davide Di Blasi . +# Ported to Python 3.3 venv by Andrew Svetlov + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/"bin":$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + set prompt = '(.dev) '"$prompt" + setenv VIRTUAL_ENV_PROMPT '(.dev) ' +endif + +alias pydoc python -m pydoc + +rehash diff --git a/.dev/bin/activate.fish b/.dev/bin/activate.fish new file mode 100644 index 000000000..d1dee7e32 --- /dev/null +++ b/.dev/bin/activate.fish @@ -0,0 +1,69 @@ +# This file must be used with "source /bin/activate.fish" *from fish* +# (https://fishshell.com/). You cannot run it directly. + +function deactivate -d "Exit virtual environment and return to normal shell environment" + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + set -e _OLD_FISH_PROMPT_OVERRIDE + # prevents error when using nested fish instances (Issue #93858) + if functions -q _old_fish_prompt + functions -e fish_prompt + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + end + + set -e VIRTUAL_ENV + set -e VIRTUAL_ENV_PROMPT + if test "$argv[1]" != "nondestructive" + # Self-destruct! + functions -e deactivate + end +end + +# Unset irrelevant variables. +deactivate nondestructive + +set -gx VIRTUAL_ENV /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev + +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx PATH "$VIRTUAL_ENV/"bin $PATH + +# Unset PYTHONHOME if set. +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # fish uses a function instead of an env var to generate the prompt. + + # Save the current fish_prompt function as the function _old_fish_prompt. + functions -c fish_prompt _old_fish_prompt + + # With the original prompt function renamed, we can override with our own. + function fish_prompt + # Save the return status of the last command. + set -l old_status $status + + # Output the venv prompt; color taken from the blue of the Python logo. + printf "%s%s%s" (set_color 4B8BBE) '(.dev) ' (set_color normal) + + # Restore the return status of the previous command. + echo "exit $old_status" | . + # Output the original/"old" prompt. + _old_fish_prompt + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" + set -gx VIRTUAL_ENV_PROMPT '(.dev) ' +end diff --git a/.dev/bin/alembic b/.dev/bin/alembic new file mode 100644 index 000000000..f59e4450d --- /dev/null +++ b/.dev/bin/alembic @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from alembic.config import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/autopep8 b/.dev/bin/autopep8 new file mode 100644 index 000000000..21a6c87a7 --- /dev/null +++ b/.dev/bin/autopep8 @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from autopep8 import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/black b/.dev/bin/black new file mode 100644 index 000000000..1d238fff5 --- /dev/null +++ b/.dev/bin/black @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from black import patched_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(patched_main()) diff --git a/.dev/bin/blackd b/.dev/bin/blackd new file mode 100644 index 000000000..9369a981f --- /dev/null +++ b/.dev/bin/blackd @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from blackd import patched_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(patched_main()) diff --git a/.dev/bin/csscapture b/.dev/bin/csscapture new file mode 100644 index 000000000..a16f86953 --- /dev/null +++ b/.dev/bin/csscapture @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from cssutils.scripts.csscapture import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/csscombine b/.dev/bin/csscombine new file mode 100644 index 000000000..4c250f6f3 --- /dev/null +++ b/.dev/bin/csscombine @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from cssutils.scripts.csscombine import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/cssparse b/.dev/bin/cssparse new file mode 100644 index 000000000..fef3296ad --- /dev/null +++ b/.dev/bin/cssparse @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from cssutils.scripts.cssparse import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/dotenv b/.dev/bin/dotenv new file mode 100644 index 000000000..17af9ef82 --- /dev/null +++ b/.dev/bin/dotenv @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from dotenv.__main__ import cli +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli()) diff --git a/.dev/bin/email_validator b/.dev/bin/email_validator new file mode 100644 index 000000000..bf3f3efb1 --- /dev/null +++ b/.dev/bin/email_validator @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from email_validator.__main__ import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/faker b/.dev/bin/faker new file mode 100644 index 000000000..ac3641186 --- /dev/null +++ b/.dev/bin/faker @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from faker.cli import execute_from_command_line +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(execute_from_command_line()) diff --git a/.dev/bin/fastapi b/.dev/bin/fastapi new file mode 100644 index 000000000..2d60b07bf --- /dev/null +++ b/.dev/bin/fastapi @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fastapi_cli.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/flake8 b/.dev/bin/flake8 new file mode 100644 index 000000000..8ad202b58 --- /dev/null +++ b/.dev/bin/flake8 @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from flake8.main.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/get_gprof b/.dev/bin/get_gprof new file mode 100644 index 000000000..cc2e114b4 --- /dev/null +++ b/.dev/bin/get_gprof @@ -0,0 +1,75 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# +# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) +# Copyright (c) 2008-2016 California Institute of Technology. +# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation. +# License: 3-clause BSD. The full license text is available at: +# - https://github.com/uqfoundation/dill/blob/master/LICENSE +''' +build profile graph for the given instance + +running: + $ get_gprof + +executes: + gprof2dot -f pstats .prof | dot -Tpng -o .call.png + +where: + are arguments for gprof2dot, such as "-n 5 -e 5" + is code to create the instance to profile + is the class of the instance (i.e. type(instance)) + +For example: + $ get_gprof -n 5 -e 1 "import numpy; numpy.array([1,2])" + +will create 'ndarray.call.png' with the profile graph for numpy.array([1,2]), +where '-n 5' eliminates nodes below 5% threshold, similarly '-e 1' eliminates +edges below 1% threshold +''' + +if __name__ == "__main__": + import sys + if len(sys.argv) < 2: + print ("Please provide an object instance (e.g. 'import math; math.pi')") + sys.exit() + # grab args for gprof2dot + args = sys.argv[1:-1] + args = ' '.join(args) + # last arg builds the object + obj = sys.argv[-1] + obj = obj.split(';') + # multi-line prep for generating an instance + for line in obj[:-1]: + exec(line) + # one-line generation of an instance + try: + obj = eval(obj[-1]) + except Exception: + print ("Error processing object instance") + sys.exit() + + # get object 'name' + objtype = type(obj) + name = getattr(objtype, '__name__', getattr(objtype, '__class__', objtype)) + + # profile dumping an object + import dill + import os + import cProfile + #name = os.path.splitext(os.path.basename(__file__))[0] + cProfile.run("dill.dumps(obj)", filename="%s.prof" % name) + msg = "gprof2dot -f pstats %s %s.prof | dot -Tpng -o %s.call.png" % (args, name, name) + try: + res = os.system(msg) + except Exception: + print ("Please verify install of 'gprof2dot' to view profile graphs") + if res: + print ("Please verify install of 'gprof2dot' to view profile graphs") + + # get stats + f_prof = "%s.prof" % name + import pstats + stats = pstats.Stats(f_prof, stream=sys.stdout) + stats.strip_dirs().sort_stats('cumtime') + stats.print_stats(20) #XXX: save to file instead of print top 20? + os.remove(f_prof) diff --git a/.dev/bin/get_objgraph b/.dev/bin/get_objgraph new file mode 100644 index 000000000..ebb95c2ea --- /dev/null +++ b/.dev/bin/get_objgraph @@ -0,0 +1,54 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# +# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) +# Copyright (c) 2008-2016 California Institute of Technology. +# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation. +# License: 3-clause BSD. The full license text is available at: +# - https://github.com/uqfoundation/dill/blob/master/LICENSE +""" +display the reference paths for objects in ``dill.types`` or a .pkl file + +Notes: + the generated image is useful in showing the pointer references in + objects that are or can be pickled. Any object in ``dill.objects`` + listed in ``dill.load_types(picklable=True, unpicklable=True)`` works. + +Examples:: + + $ get_objgraph ArrayType + Image generated as ArrayType.png +""" + +import dill as pickle +#pickle.debug.trace(True) +#import pickle + +# get all objects for testing +from dill import load_types +load_types(pickleable=True,unpickleable=True) +from dill import objects + +if __name__ == "__main__": + import sys + if len(sys.argv) != 2: + print ("Please provide exactly one file or type name (e.g. 'IntType')") + msg = "\n" + for objtype in list(objects.keys())[:40]: + msg += objtype + ', ' + print (msg + "...") + else: + objtype = str(sys.argv[-1]) + try: + obj = objects[objtype] + except KeyError: + obj = pickle.load(open(objtype,'rb')) + import os + objtype = os.path.splitext(objtype)[0] + try: + import objgraph + objgraph.show_refs(obj, filename=objtype+'.png') + except ImportError: + print ("Please install 'objgraph' to view object graphs") + + +# EOF diff --git a/.dev/bin/httpx b/.dev/bin/httpx new file mode 100644 index 000000000..67c6993ad --- /dev/null +++ b/.dev/bin/httpx @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from httpx import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/identify-cli b/.dev/bin/identify-cli new file mode 100644 index 000000000..64bedcaa6 --- /dev/null +++ b/.dev/bin/identify-cli @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from identify.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/isort b/.dev/bin/isort new file mode 100644 index 000000000..db0212d14 --- /dev/null +++ b/.dev/bin/isort @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from isort.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/isort-identify-imports b/.dev/bin/isort-identify-imports new file mode 100644 index 000000000..fc7c68f82 --- /dev/null +++ b/.dev/bin/isort-identify-imports @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from isort.main import identify_imports_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(identify_imports_main()) diff --git a/.dev/bin/mako-render b/.dev/bin/mako-render new file mode 100644 index 000000000..db5a02034 --- /dev/null +++ b/.dev/bin/mako-render @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from mako.cmd import cmdline +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cmdline()) diff --git a/.dev/bin/markdown-it b/.dev/bin/markdown-it new file mode 100644 index 000000000..fa0b06204 --- /dev/null +++ b/.dev/bin/markdown-it @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from markdown_it.cli.parse import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/nodeenv b/.dev/bin/nodeenv new file mode 100644 index 000000000..ce2287c1f --- /dev/null +++ b/.dev/bin/nodeenv @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from nodeenv import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/normalizer b/.dev/bin/normalizer new file mode 100644 index 000000000..ad6e554f0 --- /dev/null +++ b/.dev/bin/normalizer @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from charset_normalizer.cli import cli_detect +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_detect()) diff --git a/.dev/bin/pip b/.dev/bin/pip new file mode 100644 index 000000000..dcd769973 --- /dev/null +++ b/.dev/bin/pip @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/pip3 b/.dev/bin/pip3 new file mode 100644 index 000000000..dcd769973 --- /dev/null +++ b/.dev/bin/pip3 @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/pip3.12 b/.dev/bin/pip3.12 new file mode 100644 index 000000000..dcd769973 --- /dev/null +++ b/.dev/bin/pip3.12 @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/pipdeptree b/.dev/bin/pipdeptree new file mode 100644 index 000000000..4aaf85be7 --- /dev/null +++ b/.dev/bin/pipdeptree @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pipdeptree.__main__ import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/pre-commit b/.dev/bin/pre-commit new file mode 100644 index 000000000..6986ad8e6 --- /dev/null +++ b/.dev/bin/pre-commit @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pre_commit.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/py.test b/.dev/bin/py.test new file mode 100644 index 000000000..31189aea0 --- /dev/null +++ b/.dev/bin/py.test @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pytest import console_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(console_main()) diff --git a/.dev/bin/pycodestyle b/.dev/bin/pycodestyle new file mode 100644 index 000000000..5c36891f8 --- /dev/null +++ b/.dev/bin/pycodestyle @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pycodestyle import _main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(_main()) diff --git a/.dev/bin/pyflakes b/.dev/bin/pyflakes new file mode 100644 index 000000000..e60ab047f --- /dev/null +++ b/.dev/bin/pyflakes @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pyflakes.api import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/pygmentize b/.dev/bin/pygmentize new file mode 100644 index 000000000..29c9c5ad6 --- /dev/null +++ b/.dev/bin/pygmentize @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pygments.cmdline import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/pylint b/.dev/bin/pylint new file mode 100644 index 000000000..2c9941816 --- /dev/null +++ b/.dev/bin/pylint @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pylint import run_pylint +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(run_pylint()) diff --git a/.dev/bin/pylint-config b/.dev/bin/pylint-config new file mode 100644 index 000000000..166c296a5 --- /dev/null +++ b/.dev/bin/pylint-config @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pylint import _run_pylint_config +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(_run_pylint_config()) diff --git a/.dev/bin/pyreverse b/.dev/bin/pyreverse new file mode 100644 index 000000000..e58809586 --- /dev/null +++ b/.dev/bin/pyreverse @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pylint import run_pyreverse +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(run_pyreverse()) diff --git a/.dev/bin/pyrsa-decrypt b/.dev/bin/pyrsa-decrypt new file mode 100644 index 000000000..6b8f358b5 --- /dev/null +++ b/.dev/bin/pyrsa-decrypt @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import decrypt +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(decrypt()) diff --git a/.dev/bin/pyrsa-encrypt b/.dev/bin/pyrsa-encrypt new file mode 100644 index 000000000..37395887e --- /dev/null +++ b/.dev/bin/pyrsa-encrypt @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import encrypt +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(encrypt()) diff --git a/.dev/bin/pyrsa-keygen b/.dev/bin/pyrsa-keygen new file mode 100644 index 000000000..596a60c2e --- /dev/null +++ b/.dev/bin/pyrsa-keygen @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import keygen +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(keygen()) diff --git a/.dev/bin/pyrsa-priv2pub b/.dev/bin/pyrsa-priv2pub new file mode 100644 index 000000000..169c4c2d5 --- /dev/null +++ b/.dev/bin/pyrsa-priv2pub @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.util import private_to_public +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(private_to_public()) diff --git a/.dev/bin/pyrsa-sign b/.dev/bin/pyrsa-sign new file mode 100644 index 000000000..04fc4e68f --- /dev/null +++ b/.dev/bin/pyrsa-sign @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import sign +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(sign()) diff --git a/.dev/bin/pyrsa-verify b/.dev/bin/pyrsa-verify new file mode 100644 index 000000000..01776e24f --- /dev/null +++ b/.dev/bin/pyrsa-verify @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import verify +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(verify()) diff --git a/.dev/bin/pytest b/.dev/bin/pytest new file mode 100644 index 000000000..31189aea0 --- /dev/null +++ b/.dev/bin/pytest @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pytest import console_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(console_main()) diff --git a/.dev/bin/python b/.dev/bin/python new file mode 120000 index 000000000..b8a0adbbb --- /dev/null +++ b/.dev/bin/python @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/.dev/bin/python3 b/.dev/bin/python3 new file mode 120000 index 000000000..ae65fdaa1 --- /dev/null +++ b/.dev/bin/python3 @@ -0,0 +1 @@ +/usr/bin/python3 \ No newline at end of file diff --git a/.dev/bin/python3.12 b/.dev/bin/python3.12 new file mode 120000 index 000000000..b8a0adbbb --- /dev/null +++ b/.dev/bin/python3.12 @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/.dev/bin/symilar b/.dev/bin/symilar new file mode 100644 index 000000000..1e250270f --- /dev/null +++ b/.dev/bin/symilar @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pylint import run_symilar +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(run_symilar()) diff --git a/.dev/bin/typer b/.dev/bin/typer new file mode 100644 index 000000000..775f18a7d --- /dev/null +++ b/.dev/bin/typer @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from typer.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/undill b/.dev/bin/undill new file mode 100644 index 000000000..090b9307d --- /dev/null +++ b/.dev/bin/undill @@ -0,0 +1,22 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# +# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) +# Copyright (c) 2008-2016 California Institute of Technology. +# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation. +# License: 3-clause BSD. The full license text is available at: +# - https://github.com/uqfoundation/dill/blob/master/LICENSE +""" +unpickle the contents of a pickled object file + +Examples:: + + $ undill hello.pkl + ['hello', 'world'] +""" + +if __name__ == '__main__': + import sys + import dill + for file in sys.argv[1:]: + print (dill.load(open(file,'rb'))) + diff --git a/.dev/bin/uvicorn b/.dev/bin/uvicorn new file mode 100644 index 000000000..486439cc7 --- /dev/null +++ b/.dev/bin/uvicorn @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from uvicorn.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.dev/bin/virtualenv b/.dev/bin/virtualenv new file mode 100644 index 000000000..ceeac068c --- /dev/null +++ b/.dev/bin/virtualenv @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from virtualenv.__main__ import run_with_catch +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(run_with_catch()) diff --git a/.dev/bin/watchfiles b/.dev/bin/watchfiles new file mode 100644 index 000000000..b537334c5 --- /dev/null +++ b/.dev/bin/watchfiles @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from watchfiles.cli import cli +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli()) diff --git a/.dev/include/site/python3.12/greenlet/greenlet.h b/.dev/include/site/python3.12/greenlet/greenlet.h new file mode 100644 index 000000000..d02a16e43 --- /dev/null +++ b/.dev/include/site/python3.12/greenlet/greenlet.h @@ -0,0 +1,164 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */ + +/* Greenlet object interface */ + +#ifndef Py_GREENLETOBJECT_H +#define Py_GREENLETOBJECT_H + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* This is deprecated and undocumented. It does not change. */ +#define GREENLET_VERSION "1.0.0" + +#ifndef GREENLET_MODULE +#define implementation_ptr_t void* +#endif + +typedef struct _greenlet { + PyObject_HEAD + PyObject* weakreflist; + PyObject* dict; + implementation_ptr_t pimpl; +} PyGreenlet; + +#define PyGreenlet_Check(op) (op && PyObject_TypeCheck(op, &PyGreenlet_Type)) + + +/* C API functions */ + +/* Total number of symbols that are exported */ +#define PyGreenlet_API_pointers 12 + +#define PyGreenlet_Type_NUM 0 +#define PyExc_GreenletError_NUM 1 +#define PyExc_GreenletExit_NUM 2 + +#define PyGreenlet_New_NUM 3 +#define PyGreenlet_GetCurrent_NUM 4 +#define PyGreenlet_Throw_NUM 5 +#define PyGreenlet_Switch_NUM 6 +#define PyGreenlet_SetParent_NUM 7 + +#define PyGreenlet_MAIN_NUM 8 +#define PyGreenlet_STARTED_NUM 9 +#define PyGreenlet_ACTIVE_NUM 10 +#define PyGreenlet_GET_PARENT_NUM 11 + +#ifndef GREENLET_MODULE +/* This section is used by modules that uses the greenlet C API */ +static void** _PyGreenlet_API = NULL; + +# define PyGreenlet_Type \ + (*(PyTypeObject*)_PyGreenlet_API[PyGreenlet_Type_NUM]) + +# define PyExc_GreenletError \ + ((PyObject*)_PyGreenlet_API[PyExc_GreenletError_NUM]) + +# define PyExc_GreenletExit \ + ((PyObject*)_PyGreenlet_API[PyExc_GreenletExit_NUM]) + +/* + * PyGreenlet_New(PyObject *args) + * + * greenlet.greenlet(run, parent=None) + */ +# define PyGreenlet_New \ + (*(PyGreenlet * (*)(PyObject * run, PyGreenlet * parent)) \ + _PyGreenlet_API[PyGreenlet_New_NUM]) + +/* + * PyGreenlet_GetCurrent(void) + * + * greenlet.getcurrent() + */ +# define PyGreenlet_GetCurrent \ + (*(PyGreenlet * (*)(void)) _PyGreenlet_API[PyGreenlet_GetCurrent_NUM]) + +/* + * PyGreenlet_Throw( + * PyGreenlet *greenlet, + * PyObject *typ, + * PyObject *val, + * PyObject *tb) + * + * g.throw(...) + */ +# define PyGreenlet_Throw \ + (*(PyObject * (*)(PyGreenlet * self, \ + PyObject * typ, \ + PyObject * val, \ + PyObject * tb)) \ + _PyGreenlet_API[PyGreenlet_Throw_NUM]) + +/* + * PyGreenlet_Switch(PyGreenlet *greenlet, PyObject *args) + * + * g.switch(*args, **kwargs) + */ +# define PyGreenlet_Switch \ + (*(PyObject * \ + (*)(PyGreenlet * greenlet, PyObject * args, PyObject * kwargs)) \ + _PyGreenlet_API[PyGreenlet_Switch_NUM]) + +/* + * PyGreenlet_SetParent(PyObject *greenlet, PyObject *new_parent) + * + * g.parent = new_parent + */ +# define PyGreenlet_SetParent \ + (*(int (*)(PyGreenlet * greenlet, PyGreenlet * nparent)) \ + _PyGreenlet_API[PyGreenlet_SetParent_NUM]) + +/* + * PyGreenlet_GetParent(PyObject* greenlet) + * + * return greenlet.parent; + * + * This could return NULL even if there is no exception active. + * If it does not return NULL, you are responsible for decrementing the + * reference count. + */ +# define PyGreenlet_GetParent \ + (*(PyGreenlet* (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_GET_PARENT_NUM]) + +/* + * deprecated, undocumented alias. + */ +# define PyGreenlet_GET_PARENT PyGreenlet_GetParent + +# define PyGreenlet_MAIN \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_MAIN_NUM]) + +# define PyGreenlet_STARTED \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_STARTED_NUM]) + +# define PyGreenlet_ACTIVE \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_ACTIVE_NUM]) + + + + +/* Macro that imports greenlet and initializes C API */ +/* NOTE: This has actually moved to ``greenlet._greenlet._C_API``, but we + keep the older definition to be sure older code that might have a copy of + the header still works. */ +# define PyGreenlet_Import() \ + { \ + _PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \ + } + +#endif /* GREENLET_MODULE */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GREENLETOBJECT_H */ diff --git a/.dev/lib64 b/.dev/lib64 new file mode 120000 index 000000000..7951405f8 --- /dev/null +++ b/.dev/lib64 @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/.dev/pyvenv.cfg b/.dev/pyvenv.cfg new file mode 100644 index 000000000..927dac7b1 --- /dev/null +++ b/.dev/pyvenv.cfg @@ -0,0 +1,5 @@ +home = /usr/bin +include-system-site-packages = false +version = 3.12.3 +executable = /usr/bin/python3.12 +command = /usr/bin/python3 -m venv /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev diff --git a/alembic.ini b/alembic.ini index 484de57fd..aa527e1b0 100644 --- a/alembic.ini +++ b/alembic.ini @@ -60,7 +60,8 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne # are written from script.py.mako # output_encoding = utf-8 -sqlalchemy.url = +sqlalchemy.url = postgresql://samhetty:stage4@localhost:5432/hng_fast_api + [post_write_hooks] diff --git a/api/v1/models/activity_logs.py b/api/v1/models/activity_logs.py index 1c9169158..94d13818e 100644 --- a/api/v1/models/activity_logs.py +++ b/api/v1/models/activity_logs.py @@ -7,7 +7,7 @@ class ActivityLog(BaseTableModel): __tablename__ = "activity_logs" - user_id = Column(String, ForeignKey("users.id", ondelete="CASCADE"), nullable=False) + user_id = Column(String, ForeignKey("users.id"), nullable=False) action = Column(String, nullable=False) timestamp = Column(DateTime(timezone=True), server_default=func.now()) diff --git a/api/v1/models/testimonial.py b/api/v1/models/testimonial.py index 332e6ca67..5798193a2 100644 --- a/api/v1/models/testimonial.py +++ b/api/v1/models/testimonial.py @@ -16,3 +16,5 @@ class Testimonial(BaseTableModel): ratings = Column(Float, nullable=True) author = relationship("User", back_populates="testimonials") + + diff --git a/api/v1/routes/testimonial.py b/api/v1/routes/testimonial.py index 22ff49033..60e06ef6d 100644 --- a/api/v1/routes/testimonial.py +++ b/api/v1/routes/testimonial.py @@ -2,7 +2,9 @@ """ Module contains CRUD routes for testimonial """ + from fastapi.encoders import jsonable_encoder +from fastapi import HTTPException from api.db.database import get_db from sqlalchemy.orm import Session from api.v1.models.user import User @@ -11,6 +13,7 @@ from api.v1.services.testimonial import testimonial_service from api.v1.services.user import user_service from api.v1.schemas.testimonial import CreateTestimonial +from api.v1.schemas.testimonial import UpdateTestimonial from api.core.responses import SUCCESS from typing import Annotated from api.utils.pagination import paginated_response @@ -90,3 +93,35 @@ def create_testimonial( data={"id": testimonial.id} ) return response + + +@testimonial.put("/{testimonial_id}", response_model=success_response) +def update_testimonial( + testimonial_id: str, + testimonial_data: UpdateTestimonial, + db: Annotated[Session, Depends(get_db)], + current_user: User = Depends(user_service.get_current_user) +): + """Endpoint to update a testimonial""" + + # Ensure testimonial exists before updating + existing_testimonial = testimonial_service.fetch(db, testimonial_id) + if not existing_testimonial: + raise HTTPException(status_code=404, detail="Testimonial not found") + + # Ensure the user is authorized to update + if existing_testimonial.author_id != current_user.id: + raise HTTPException(status_code=403, detail="Not authorized to update this testimonial") + + # Perform update (fixed call) + updated_testimonial = testimonial_service.update(db, testimonial_id, testimonial_data) + + if not updated_testimonial: + raise HTTPException(status_code=500, detail="Failed to update testimonial") + + response = success_response( + status_code=200, + message="Testimonial updated successfully", + data={"id": updated_testimonial.id} + ) + return response diff --git a/api/v1/schemas/testimonial.py b/api/v1/schemas/testimonial.py index 91157cb41..e6d254e6c 100644 --- a/api/v1/schemas/testimonial.py +++ b/api/v1/schemas/testimonial.py @@ -1,5 +1,13 @@ from pydantic import BaseModel +from typing import Optional class CreateTestimonial(BaseModel): content: str - ratings: float = 0 \ No newline at end of file + ratings: float = 0 + + +class UpdateTestimonial(BaseModel): + content: Optional[str] = None + ratings: Optional[float] = None + client_name: Optional[str] = None + client_designation: Optional[str] = None diff --git a/api/v1/services/testimonial.py b/api/v1/services/testimonial.py index f3d20352a..1a3d83e59 100644 --- a/api/v1/services/testimonial.py +++ b/api/v1/services/testimonial.py @@ -4,6 +4,8 @@ from api.v1.models.testimonial import Testimonial from api.v1.models.user import User from api.v1.schemas.testimonial import CreateTestimonial +from api.v1.schemas.testimonial import UpdateTestimonial + class TestimonialService(Service): @@ -34,9 +36,19 @@ def fetch(self, db: Session, id: str): return check_model_existence(db, Testimonial, id) - def update(self, db: Session, id: str, schema): + def update(self, db: Session, id: str, schema: UpdateTestimonial): """Updates a testimonial""" - pass + testimonial = self.fetch(db, id) + if not testimonial: + return None # Or raise an HTTPException(status_code=404, detail="Testimonial not found") + # Update the fields + for key, value in schema.dict(exclude_unset=True).items(): + setattr(testimonial, key, value) + + db.commit() + db.refresh(testimonial) + return testimonial + def delete(self, db: Session, id: str): """Deletes a specific testimonial""" From 2d9e10615081c521519a63060e60abd243acdd20 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 28 Feb 2025 14:27:09 -0800 Subject: [PATCH 02/10] fix(tests): Ensure updated content is retrieved correctly in testimonial tests --- .../testimonial/test_testimonial_updates.py | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 tests/v1/testimonial/test_testimonial_updates.py diff --git a/tests/v1/testimonial/test_testimonial_updates.py b/tests/v1/testimonial/test_testimonial_updates.py new file mode 100644 index 000000000..84a760e05 --- /dev/null +++ b/tests/v1/testimonial/test_testimonial_updates.py @@ -0,0 +1,159 @@ +import pytest +from fastapi.testclient import TestClient +from unittest.mock import patch, MagicMock +from main import app +from api.v1.models.user import User +from api.v1.models.testimonial import Testimonial +from api.v1.services.user import user_service +from uuid_extensions import uuid7 +from api.db.database import get_db +from fastapi import status +from datetime import datetime, timezone + +LOGIN_ENDPOINT = 'api/v1/auth/login' +client = TestClient(app) + + +@pytest.fixture +def mock_db_session(): + """Fixture to create a mock database session.""" + with patch("api.v1.services.user.get_db", autospec=True) as mock_get_db: + mock_db = MagicMock() + app.dependency_overrides[get_db] = lambda: mock_db + yield mock_db + app.dependency_overrides = {} + + +@pytest.fixture +def mock_user_service(): + """Fixture to create a mock user service.""" + with patch("api.v1.services.user.user_service", autospec=True) as mock_service: + yield mock_service + + +def create_mock_user(mock_user_service, mock_db_session): + """Create a mock user in the mock database session.""" + mock_user = User( + id=str(uuid7()), + email="testuser@gmail.com", + password=user_service.hash_password("Testpassword@123"), + first_name='Test', + last_name='User', + is_active=True, + is_superadmin=False, + created_at=datetime.now(timezone.utc), + updated_at=datetime.now(timezone.utc) + ) + mock_db_session.query.return_value.filter.return_value.first.return_value = mock_user + return mock_user + + +def create_testimonial(mock_user_service, mock_db_session): + """Create a mock testimonial in the mock database session.""" + mock_user = create_mock_user(mock_user_service, mock_db_session) + mock_testimonial = Testimonial( + id=str(uuid7()), + content='Original content', + author_id=mock_user.id, + client_name="Client 1", + client_designation="Client Designation", + comments="Testimonial comments", + ratings=4.5 + ) + mock_db_session.get.return_value = mock_testimonial + return mock_testimonial + + +@pytest.mark.usefixtures("mock_db_session", "mock_user_service") +def test_update_testimonial_success(mock_user_service, mock_db_session): + """Test successful update of a testimonial.""" + create_mock_user(mock_user_service, mock_db_session) + + login_response = client.post(LOGIN_ENDPOINT, json={ + "email": "testuser@gmail.com", + "password": "Testpassword@123" + }) + login_data = login_response.json() + access_token = login_data.get('access_token') + + assert access_token, "Login failed, no access token returned" + + testimonial = create_testimonial(mock_user_service, mock_db_session) + update_data = {"content": "Updated content"} + + # Send the update request + update_response = client.put( + f'/api/v1/testimonials/{testimonial.id}', + json=update_data, + headers={'Authorization': f'Bearer {access_token}'} + ) + update_response_data = update_response.json() + print("Update Response:", update_response_data) # Debugging log + + # Assert update request was successful + assert update_response.status_code == status.HTTP_200_OK + + # Fetch the updated testimonial from the API + fetch_response = client.get( + f'/api/v1/testimonials/{testimonial.id}', + headers={'Authorization': f'Bearer {access_token}'} + ) + fetch_data = fetch_response.json() + print("Fetch Updated Testimonial:", fetch_data) # Debugging log + + # Assert fetching the updated testimonial was successful + assert fetch_response.status_code == status.HTTP_200_OK + assert "data" in fetch_data, "Response missing 'data' key" + assert "content" in fetch_data["data"], "Response missing 'content' key" + assert fetch_data["data"]["content"] == "Updated content", \ + f"Expected content: 'Updated content', but got: {fetch_data['data']['content']}" + + +@pytest.mark.usefixtures("mock_db_session", "mock_user_service") +def test_update_testimonial_not_found(mock_user_service, mock_db_session): + """Test updating a non-existing testimonial.""" + create_mock_user(mock_user_service, mock_db_session) + + login_response = client.post(LOGIN_ENDPOINT, json={ + "email": "testuser@gmail.com", + "password": "Testpassword@123" + }) + login_data = login_response.json() + access_token = login_data.get('access_token') + + assert access_token, "Login failed, no access token returned" + + non_existent_id = str(uuid7()) + update_data = {"content": "Updated content"} + + response = client.put( + f'/api/v1/testimonials/{non_existent_id}', + json=update_data, + headers={'Authorization': f'Bearer {access_token}'} + ) + + response_data = response.json() + print("Not Found Response:", response_data) # Debugging log + + expected_messages = [ + "Testimonial not found", + "You do not have permission to update this testimonial", + "Not authorized to update this testimonial" + ] + + assert response.status_code in [status.HTTP_404_NOT_FOUND, status.HTTP_403_FORBIDDEN] + assert response_data.get("message") in expected_messages + +@pytest.mark.usefixtures("mock_db_session", "mock_user_service") +def test_update_testimonial_unauthorized(): + """Test updating a testimonial without authentication.""" + testimonial_id = str(uuid7()) + update_data = {"content": "Updated content"} + + response = client.put(f'/api/v1/testimonials/{testimonial_id}', json=update_data) + response_data = response.json() + + print("Unauthorized Response:", response_data) # Debugging log + + assert response.status_code == status.HTTP_401_UNAUTHORIZED + assert response_data.get("message") == "Not authenticated" From 99f4ece31afac9d9501edfab7dff6e16efc498c4 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 28 Feb 2025 14:50:17 -0800 Subject: [PATCH 03/10] feat: Created TestimonialService update method --- api/v1/routes/testimonial.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/v1/routes/testimonial.py b/api/v1/routes/testimonial.py index 60e06ef6d..be6d917d1 100644 --- a/api/v1/routes/testimonial.py +++ b/api/v1/routes/testimonial.py @@ -104,16 +104,13 @@ def update_testimonial( ): """Endpoint to update a testimonial""" - # Ensure testimonial exists before updating existing_testimonial = testimonial_service.fetch(db, testimonial_id) if not existing_testimonial: raise HTTPException(status_code=404, detail="Testimonial not found") - # Ensure the user is authorized to update if existing_testimonial.author_id != current_user.id: raise HTTPException(status_code=403, detail="Not authorized to update this testimonial") - # Perform update (fixed call) updated_testimonial = testimonial_service.update(db, testimonial_id, testimonial_data) if not updated_testimonial: From 280a9dc37a7c9a684ca8787d7ce6b77f2edf4a1f Mon Sep 17 00:00:00 2001 From: Henrietta Onoge Date: Sat, 1 Mar 2025 02:42:23 -0800 Subject: [PATCH 04/10] fix(tests): Ensure mock user attributes are valid in testimonial update tests --- {.dev => dev}/bin/Activate.ps1 | 0 {.dev => dev}/bin/activate | 8 +-- {.dev => dev}/bin/activate.csh | 6 +- {.dev => dev}/bin/activate.fish | 6 +- {.dev => dev}/bin/alembic | 2 +- {.dev => dev}/bin/autopep8 | 2 +- {.dev => dev}/bin/black | 2 +- {.dev => dev}/bin/blackd | 2 +- {.dev => dev}/bin/csscapture | 2 +- {.dev => dev}/bin/csscombine | 2 +- {.dev => dev}/bin/cssparse | 2 +- {.dev => dev}/bin/dotenv | 2 +- {.dev => dev}/bin/email_validator | 2 +- {.dev => dev}/bin/faker | 2 +- {.dev => dev}/bin/fastapi | 2 +- {.dev => dev}/bin/flake8 | 2 +- {.dev => dev}/bin/get_gprof | 2 +- {.dev => dev}/bin/get_objgraph | 2 +- {.dev => dev}/bin/httpx | 2 +- {.dev => dev}/bin/identify-cli | 2 +- {.dev => dev}/bin/isort | 2 +- {.dev => dev}/bin/isort-identify-imports | 2 +- {.dev => dev}/bin/mako-render | 2 +- {.dev => dev}/bin/markdown-it | 2 +- {.dev => dev}/bin/nodeenv | 2 +- {.dev => dev}/bin/normalizer | 2 +- {.dev => dev}/bin/pip | 2 +- {.dev => dev}/bin/pip3 | 2 +- {.dev => dev}/bin/pip3.12 | 2 +- {.dev => dev}/bin/pipdeptree | 2 +- {.dev => dev}/bin/pre-commit | 2 +- {.dev => dev}/bin/py.test | 2 +- {.dev => dev}/bin/pycodestyle | 2 +- {.dev => dev}/bin/pyflakes | 2 +- {.dev => dev}/bin/pygmentize | 2 +- {.dev => dev}/bin/pylint | 2 +- {.dev => dev}/bin/pylint-config | 2 +- {.dev => dev}/bin/pyreverse | 2 +- {.dev => dev}/bin/pyrsa-decrypt | 2 +- {.dev => dev}/bin/pyrsa-encrypt | 2 +- {.dev => dev}/bin/pyrsa-keygen | 2 +- {.dev => dev}/bin/pyrsa-priv2pub | 2 +- {.dev => dev}/bin/pyrsa-sign | 2 +- {.dev => dev}/bin/pyrsa-verify | 2 +- {.dev => dev}/bin/pytest | 2 +- {.dev => dev}/bin/python | 0 {.dev => dev}/bin/python3 | 0 {.dev => dev}/bin/python3.12 | 0 {.dev => dev}/bin/symilar | 2 +- {.dev => dev}/bin/typer | 2 +- {.dev => dev}/bin/undill | 2 +- {.dev => dev}/bin/uvicorn | 2 +- {.dev => dev}/bin/virtualenv | 2 +- {.dev => dev}/bin/watchfiles | 2 +- .../site/python3.12/greenlet/greenlet.h | 0 {.dev => dev}/lib64 | 0 {.dev => dev}/pyvenv.cfg | 2 +- .../testimonial/test_testimonial_updates.py | 72 ++++++------------- 58 files changed, 80 insertions(+), 108 deletions(-) rename {.dev => dev}/bin/Activate.ps1 (100%) rename {.dev => dev}/bin/activate (95%) rename {.dev => dev}/bin/activate.csh (90%) rename {.dev => dev}/bin/activate.fish (94%) rename {.dev => dev}/bin/alembic (73%) rename {.dev => dev}/bin/autopep8 (72%) rename {.dev => dev}/bin/black (73%) rename {.dev => dev}/bin/blackd (73%) rename {.dev => dev}/bin/csscapture (74%) rename {.dev => dev}/bin/csscombine (74%) rename {.dev => dev}/bin/cssparse (74%) rename {.dev => dev}/bin/dotenv (73%) rename {.dev => dev}/bin/email_validator (74%) rename {.dev => dev}/bin/faker (76%) rename {.dev => dev}/bin/fastapi (73%) rename {.dev => dev}/bin/flake8 (73%) rename {.dev => dev}/bin/get_gprof (97%) rename {.dev => dev}/bin/get_objgraph (95%) rename {.dev => dev}/bin/httpx (72%) rename {.dev => dev}/bin/identify-cli (73%) rename {.dev => dev}/bin/isort (72%) rename {.dev => dev}/bin/isort-identify-imports (75%) rename {.dev => dev}/bin/mako-render (73%) rename {.dev => dev}/bin/markdown-it (73%) rename {.dev => dev}/bin/nodeenv (72%) rename {.dev => dev}/bin/normalizer (75%) rename {.dev => dev}/bin/pip (73%) rename {.dev => dev}/bin/pip3 (73%) rename {.dev => dev}/bin/pip3.12 (73%) rename {.dev => dev}/bin/pipdeptree (73%) rename {.dev => dev}/bin/pre-commit (73%) rename {.dev => dev}/bin/py.test (73%) rename {.dev => dev}/bin/pycodestyle (73%) rename {.dev => dev}/bin/pyflakes (73%) rename {.dev => dev}/bin/pygmentize (73%) rename {.dev => dev}/bin/pylint (73%) rename {.dev => dev}/bin/pylint-config (75%) rename {.dev => dev}/bin/pyreverse (74%) rename {.dev => dev}/bin/pyrsa-decrypt (73%) rename {.dev => dev}/bin/pyrsa-encrypt (73%) rename {.dev => dev}/bin/pyrsa-keygen (72%) rename {.dev => dev}/bin/pyrsa-priv2pub (75%) rename {.dev => dev}/bin/pyrsa-sign (72%) rename {.dev => dev}/bin/pyrsa-verify (72%) rename {.dev => dev}/bin/pytest (73%) rename {.dev => dev}/bin/python (100%) rename {.dev => dev}/bin/python3 (100%) rename {.dev => dev}/bin/python3.12 (100%) rename {.dev => dev}/bin/symilar (73%) rename {.dev => dev}/bin/typer (72%) rename {.dev => dev}/bin/undill (88%) rename {.dev => dev}/bin/uvicorn (73%) rename {.dev => dev}/bin/virtualenv (75%) rename {.dev => dev}/bin/watchfiles (73%) rename {.dev => dev}/include/site/python3.12/greenlet/greenlet.h (100%) rename {.dev => dev}/lib64 (100%) rename {.dev => dev}/pyvenv.cfg (85%) diff --git a/.dev/bin/Activate.ps1 b/dev/bin/Activate.ps1 similarity index 100% rename from .dev/bin/Activate.ps1 rename to dev/bin/Activate.ps1 diff --git a/.dev/bin/activate b/dev/bin/activate similarity index 95% rename from .dev/bin/activate rename to dev/bin/activate index 3683010f6..230eb42cd 100644 --- a/.dev/bin/activate +++ b/dev/bin/activate @@ -39,10 +39,10 @@ deactivate nondestructive if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then # transform D:\path\to\venv to /d/path/to/venv on MSYS # and to /cygdrive/d/path/to/venv on Cygwin - export VIRTUAL_ENV=$(cygpath /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev) + export VIRTUAL_ENV=$(cygpath /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev) else # use the path as-is - export VIRTUAL_ENV=/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev + export VIRTUAL_ENV=/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev fi _OLD_VIRTUAL_PATH="$PATH" @@ -59,9 +59,9 @@ fi if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then _OLD_VIRTUAL_PS1="${PS1:-}" - PS1='(.dev) '"${PS1:-}" + PS1='(dev) '"${PS1:-}" export PS1 - VIRTUAL_ENV_PROMPT='(.dev) ' + VIRTUAL_ENV_PROMPT='(dev) ' export VIRTUAL_ENV_PROMPT fi diff --git a/.dev/bin/activate.csh b/dev/bin/activate.csh similarity index 90% rename from .dev/bin/activate.csh rename to dev/bin/activate.csh index 273574392..507d0c3ad 100644 --- a/.dev/bin/activate.csh +++ b/dev/bin/activate.csh @@ -9,7 +9,7 @@ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PA # Unset irrelevant variables. deactivate nondestructive -setenv VIRTUAL_ENV /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev +setenv VIRTUAL_ENV /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev set _OLD_VIRTUAL_PATH="$PATH" setenv PATH "$VIRTUAL_ENV/"bin":$PATH" @@ -18,8 +18,8 @@ setenv PATH "$VIRTUAL_ENV/"bin":$PATH" set _OLD_VIRTUAL_PROMPT="$prompt" if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - set prompt = '(.dev) '"$prompt" - setenv VIRTUAL_ENV_PROMPT '(.dev) ' + set prompt = '(dev) '"$prompt" + setenv VIRTUAL_ENV_PROMPT '(dev) ' endif alias pydoc python -m pydoc diff --git a/.dev/bin/activate.fish b/dev/bin/activate.fish similarity index 94% rename from .dev/bin/activate.fish rename to dev/bin/activate.fish index d1dee7e32..624e2f422 100644 --- a/.dev/bin/activate.fish +++ b/dev/bin/activate.fish @@ -33,7 +33,7 @@ end # Unset irrelevant variables. deactivate nondestructive -set -gx VIRTUAL_ENV /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev +set -gx VIRTUAL_ENV /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev set -gx _OLD_VIRTUAL_PATH $PATH set -gx PATH "$VIRTUAL_ENV/"bin $PATH @@ -56,7 +56,7 @@ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" set -l old_status $status # Output the venv prompt; color taken from the blue of the Python logo. - printf "%s%s%s" (set_color 4B8BBE) '(.dev) ' (set_color normal) + printf "%s%s%s" (set_color 4B8BBE) '(dev) ' (set_color normal) # Restore the return status of the previous command. echo "exit $old_status" | . @@ -65,5 +65,5 @@ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" end set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" - set -gx VIRTUAL_ENV_PROMPT '(.dev) ' + set -gx VIRTUAL_ENV_PROMPT '(dev) ' end diff --git a/.dev/bin/alembic b/dev/bin/alembic similarity index 73% rename from .dev/bin/alembic rename to dev/bin/alembic index f59e4450d..403d68286 100644 --- a/.dev/bin/alembic +++ b/dev/bin/alembic @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/autopep8 b/dev/bin/autopep8 similarity index 72% rename from .dev/bin/autopep8 rename to dev/bin/autopep8 index 21a6c87a7..7f886c97d 100644 --- a/.dev/bin/autopep8 +++ b/dev/bin/autopep8 @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/black b/dev/bin/black similarity index 73% rename from .dev/bin/black rename to dev/bin/black index 1d238fff5..d8d7f5cd7 100644 --- a/.dev/bin/black +++ b/dev/bin/black @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/blackd b/dev/bin/blackd similarity index 73% rename from .dev/bin/blackd rename to dev/bin/blackd index 9369a981f..21026bd69 100644 --- a/.dev/bin/blackd +++ b/dev/bin/blackd @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/csscapture b/dev/bin/csscapture similarity index 74% rename from .dev/bin/csscapture rename to dev/bin/csscapture index a16f86953..73dcb16b8 100644 --- a/.dev/bin/csscapture +++ b/dev/bin/csscapture @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/csscombine b/dev/bin/csscombine similarity index 74% rename from .dev/bin/csscombine rename to dev/bin/csscombine index 4c250f6f3..0d66d27bf 100644 --- a/.dev/bin/csscombine +++ b/dev/bin/csscombine @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/cssparse b/dev/bin/cssparse similarity index 74% rename from .dev/bin/cssparse rename to dev/bin/cssparse index fef3296ad..a6dded64f 100644 --- a/.dev/bin/cssparse +++ b/dev/bin/cssparse @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/dotenv b/dev/bin/dotenv similarity index 73% rename from .dev/bin/dotenv rename to dev/bin/dotenv index 17af9ef82..bd4cadc1c 100644 --- a/.dev/bin/dotenv +++ b/dev/bin/dotenv @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/email_validator b/dev/bin/email_validator similarity index 74% rename from .dev/bin/email_validator rename to dev/bin/email_validator index bf3f3efb1..3a5988fe0 100644 --- a/.dev/bin/email_validator +++ b/dev/bin/email_validator @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/faker b/dev/bin/faker similarity index 76% rename from .dev/bin/faker rename to dev/bin/faker index ac3641186..ca577e4ea 100644 --- a/.dev/bin/faker +++ b/dev/bin/faker @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/fastapi b/dev/bin/fastapi similarity index 73% rename from .dev/bin/fastapi rename to dev/bin/fastapi index 2d60b07bf..5bb1acfbf 100644 --- a/.dev/bin/fastapi +++ b/dev/bin/fastapi @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/flake8 b/dev/bin/flake8 similarity index 73% rename from .dev/bin/flake8 rename to dev/bin/flake8 index 8ad202b58..87bfd49d8 100644 --- a/.dev/bin/flake8 +++ b/dev/bin/flake8 @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/get_gprof b/dev/bin/get_gprof similarity index 97% rename from .dev/bin/get_gprof rename to dev/bin/get_gprof index cc2e114b4..83e0812ab 100644 --- a/.dev/bin/get_gprof +++ b/dev/bin/get_gprof @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2016 California Institute of Technology. diff --git a/.dev/bin/get_objgraph b/dev/bin/get_objgraph similarity index 95% rename from .dev/bin/get_objgraph rename to dev/bin/get_objgraph index ebb95c2ea..adeb829e1 100644 --- a/.dev/bin/get_objgraph +++ b/dev/bin/get_objgraph @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2016 California Institute of Technology. diff --git a/.dev/bin/httpx b/dev/bin/httpx similarity index 72% rename from .dev/bin/httpx rename to dev/bin/httpx index 67c6993ad..f2d5e1c35 100644 --- a/.dev/bin/httpx +++ b/dev/bin/httpx @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/identify-cli b/dev/bin/identify-cli similarity index 73% rename from .dev/bin/identify-cli rename to dev/bin/identify-cli index 64bedcaa6..f4296cfc6 100644 --- a/.dev/bin/identify-cli +++ b/dev/bin/identify-cli @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/isort b/dev/bin/isort similarity index 72% rename from .dev/bin/isort rename to dev/bin/isort index db0212d14..94186d300 100644 --- a/.dev/bin/isort +++ b/dev/bin/isort @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/isort-identify-imports b/dev/bin/isort-identify-imports similarity index 75% rename from .dev/bin/isort-identify-imports rename to dev/bin/isort-identify-imports index fc7c68f82..483707de2 100644 --- a/.dev/bin/isort-identify-imports +++ b/dev/bin/isort-identify-imports @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/mako-render b/dev/bin/mako-render similarity index 73% rename from .dev/bin/mako-render rename to dev/bin/mako-render index db5a02034..dd17d84d5 100644 --- a/.dev/bin/mako-render +++ b/dev/bin/mako-render @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/markdown-it b/dev/bin/markdown-it similarity index 73% rename from .dev/bin/markdown-it rename to dev/bin/markdown-it index fa0b06204..60929f770 100644 --- a/.dev/bin/markdown-it +++ b/dev/bin/markdown-it @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/nodeenv b/dev/bin/nodeenv similarity index 72% rename from .dev/bin/nodeenv rename to dev/bin/nodeenv index ce2287c1f..63c185363 100644 --- a/.dev/bin/nodeenv +++ b/dev/bin/nodeenv @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/normalizer b/dev/bin/normalizer similarity index 75% rename from .dev/bin/normalizer rename to dev/bin/normalizer index ad6e554f0..4bd3fd0ed 100644 --- a/.dev/bin/normalizer +++ b/dev/bin/normalizer @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pip b/dev/bin/pip similarity index 73% rename from .dev/bin/pip rename to dev/bin/pip index dcd769973..27e25c9f7 100644 --- a/.dev/bin/pip +++ b/dev/bin/pip @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pip3 b/dev/bin/pip3 similarity index 73% rename from .dev/bin/pip3 rename to dev/bin/pip3 index dcd769973..27e25c9f7 100644 --- a/.dev/bin/pip3 +++ b/dev/bin/pip3 @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pip3.12 b/dev/bin/pip3.12 similarity index 73% rename from .dev/bin/pip3.12 rename to dev/bin/pip3.12 index dcd769973..27e25c9f7 100644 --- a/.dev/bin/pip3.12 +++ b/dev/bin/pip3.12 @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pipdeptree b/dev/bin/pipdeptree similarity index 73% rename from .dev/bin/pipdeptree rename to dev/bin/pipdeptree index 4aaf85be7..27291a5ac 100644 --- a/.dev/bin/pipdeptree +++ b/dev/bin/pipdeptree @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pre-commit b/dev/bin/pre-commit similarity index 73% rename from .dev/bin/pre-commit rename to dev/bin/pre-commit index 6986ad8e6..b54be2cac 100644 --- a/.dev/bin/pre-commit +++ b/dev/bin/pre-commit @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/py.test b/dev/bin/py.test similarity index 73% rename from .dev/bin/py.test rename to dev/bin/py.test index 31189aea0..decc5c9dd 100644 --- a/.dev/bin/py.test +++ b/dev/bin/py.test @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pycodestyle b/dev/bin/pycodestyle similarity index 73% rename from .dev/bin/pycodestyle rename to dev/bin/pycodestyle index 5c36891f8..c937cb66d 100644 --- a/.dev/bin/pycodestyle +++ b/dev/bin/pycodestyle @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pyflakes b/dev/bin/pyflakes similarity index 73% rename from .dev/bin/pyflakes rename to dev/bin/pyflakes index e60ab047f..98495bff4 100644 --- a/.dev/bin/pyflakes +++ b/dev/bin/pyflakes @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pygmentize b/dev/bin/pygmentize similarity index 73% rename from .dev/bin/pygmentize rename to dev/bin/pygmentize index 29c9c5ad6..3faa08464 100644 --- a/.dev/bin/pygmentize +++ b/dev/bin/pygmentize @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pylint b/dev/bin/pylint similarity index 73% rename from .dev/bin/pylint rename to dev/bin/pylint index 2c9941816..98303a78e 100644 --- a/.dev/bin/pylint +++ b/dev/bin/pylint @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pylint-config b/dev/bin/pylint-config similarity index 75% rename from .dev/bin/pylint-config rename to dev/bin/pylint-config index 166c296a5..0369bab32 100644 --- a/.dev/bin/pylint-config +++ b/dev/bin/pylint-config @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pyreverse b/dev/bin/pyreverse similarity index 74% rename from .dev/bin/pyreverse rename to dev/bin/pyreverse index e58809586..c77874865 100644 --- a/.dev/bin/pyreverse +++ b/dev/bin/pyreverse @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pyrsa-decrypt b/dev/bin/pyrsa-decrypt similarity index 73% rename from .dev/bin/pyrsa-decrypt rename to dev/bin/pyrsa-decrypt index 6b8f358b5..01d0112f4 100644 --- a/.dev/bin/pyrsa-decrypt +++ b/dev/bin/pyrsa-decrypt @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pyrsa-encrypt b/dev/bin/pyrsa-encrypt similarity index 73% rename from .dev/bin/pyrsa-encrypt rename to dev/bin/pyrsa-encrypt index 37395887e..5f7f7889a 100644 --- a/.dev/bin/pyrsa-encrypt +++ b/dev/bin/pyrsa-encrypt @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pyrsa-keygen b/dev/bin/pyrsa-keygen similarity index 72% rename from .dev/bin/pyrsa-keygen rename to dev/bin/pyrsa-keygen index 596a60c2e..120adacab 100644 --- a/.dev/bin/pyrsa-keygen +++ b/dev/bin/pyrsa-keygen @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pyrsa-priv2pub b/dev/bin/pyrsa-priv2pub similarity index 75% rename from .dev/bin/pyrsa-priv2pub rename to dev/bin/pyrsa-priv2pub index 169c4c2d5..ee9375c36 100644 --- a/.dev/bin/pyrsa-priv2pub +++ b/dev/bin/pyrsa-priv2pub @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pyrsa-sign b/dev/bin/pyrsa-sign similarity index 72% rename from .dev/bin/pyrsa-sign rename to dev/bin/pyrsa-sign index 04fc4e68f..5de853738 100644 --- a/.dev/bin/pyrsa-sign +++ b/dev/bin/pyrsa-sign @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pyrsa-verify b/dev/bin/pyrsa-verify similarity index 72% rename from .dev/bin/pyrsa-verify rename to dev/bin/pyrsa-verify index 01776e24f..1dc777aad 100644 --- a/.dev/bin/pyrsa-verify +++ b/dev/bin/pyrsa-verify @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/pytest b/dev/bin/pytest similarity index 73% rename from .dev/bin/pytest rename to dev/bin/pytest index 31189aea0..decc5c9dd 100644 --- a/.dev/bin/pytest +++ b/dev/bin/pytest @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/python b/dev/bin/python similarity index 100% rename from .dev/bin/python rename to dev/bin/python diff --git a/.dev/bin/python3 b/dev/bin/python3 similarity index 100% rename from .dev/bin/python3 rename to dev/bin/python3 diff --git a/.dev/bin/python3.12 b/dev/bin/python3.12 similarity index 100% rename from .dev/bin/python3.12 rename to dev/bin/python3.12 diff --git a/.dev/bin/symilar b/dev/bin/symilar similarity index 73% rename from .dev/bin/symilar rename to dev/bin/symilar index 1e250270f..b44444f72 100644 --- a/.dev/bin/symilar +++ b/dev/bin/symilar @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/typer b/dev/bin/typer similarity index 72% rename from .dev/bin/typer rename to dev/bin/typer index 775f18a7d..43935bf8e 100644 --- a/.dev/bin/typer +++ b/dev/bin/typer @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/undill b/dev/bin/undill similarity index 88% rename from .dev/bin/undill rename to dev/bin/undill index 090b9307d..51f5c0800 100644 --- a/.dev/bin/undill +++ b/dev/bin/undill @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2016 California Institute of Technology. diff --git a/.dev/bin/uvicorn b/dev/bin/uvicorn similarity index 73% rename from .dev/bin/uvicorn rename to dev/bin/uvicorn index 486439cc7..7188e0817 100644 --- a/.dev/bin/uvicorn +++ b/dev/bin/uvicorn @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/virtualenv b/dev/bin/virtualenv similarity index 75% rename from .dev/bin/virtualenv rename to dev/bin/virtualenv index ceeac068c..6bccffbe3 100644 --- a/.dev/bin/virtualenv +++ b/dev/bin/virtualenv @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/bin/watchfiles b/dev/bin/watchfiles similarity index 73% rename from .dev/bin/watchfiles rename to dev/bin/watchfiles index b537334c5..f01577afa 100644 --- a/.dev/bin/watchfiles +++ b/dev/bin/watchfiles @@ -1,4 +1,4 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev/bin/python3 +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 # -*- coding: utf-8 -*- import re import sys diff --git a/.dev/include/site/python3.12/greenlet/greenlet.h b/dev/include/site/python3.12/greenlet/greenlet.h similarity index 100% rename from .dev/include/site/python3.12/greenlet/greenlet.h rename to dev/include/site/python3.12/greenlet/greenlet.h diff --git a/.dev/lib64 b/dev/lib64 similarity index 100% rename from .dev/lib64 rename to dev/lib64 diff --git a/.dev/pyvenv.cfg b/dev/pyvenv.cfg similarity index 85% rename from .dev/pyvenv.cfg rename to dev/pyvenv.cfg index 927dac7b1..2faed4701 100644 --- a/.dev/pyvenv.cfg +++ b/dev/pyvenv.cfg @@ -2,4 +2,4 @@ home = /usr/bin include-system-site-packages = false version = 3.12.3 executable = /usr/bin/python3.12 -command = /usr/bin/python3 -m venv /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/.dev +command = /usr/bin/python3 -m venv /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev diff --git a/tests/v1/testimonial/test_testimonial_updates.py b/tests/v1/testimonial/test_testimonial_updates.py index 84a760e05..e81b1a49d 100644 --- a/tests/v1/testimonial/test_testimonial_updates.py +++ b/tests/v1/testimonial/test_testimonial_updates.py @@ -11,9 +11,9 @@ from datetime import datetime, timezone LOGIN_ENDPOINT = 'api/v1/auth/login' +TESTIMONIAL_ENDPOINT = '/api/v1/testimonials' client = TestClient(app) - @pytest.fixture def mock_db_session(): """Fixture to create a mock database session.""" @@ -23,14 +23,12 @@ def mock_db_session(): yield mock_db app.dependency_overrides = {} - @pytest.fixture def mock_user_service(): """Fixture to create a mock user service.""" with patch("api.v1.services.user.user_service", autospec=True) as mock_service: yield mock_service - def create_mock_user(mock_user_service, mock_db_session): """Create a mock user in the mock database session.""" mock_user = User( @@ -47,14 +45,12 @@ def create_mock_user(mock_user_service, mock_db_session): mock_db_session.query.return_value.filter.return_value.first.return_value = mock_user return mock_user - -def create_testimonial(mock_user_service, mock_db_session): +def create_testimonial(mock_db_session, user_id): """Create a mock testimonial in the mock database session.""" - mock_user = create_mock_user(mock_user_service, mock_db_session) mock_testimonial = Testimonial( id=str(uuid7()), content='Original content', - author_id=mock_user.id, + author_id=user_id, client_name="Client 1", client_designation="Client Designation", comments="Testimonial comments", @@ -63,51 +59,30 @@ def create_testimonial(mock_user_service, mock_db_session): mock_db_session.get.return_value = mock_testimonial return mock_testimonial - -@pytest.mark.usefixtures("mock_db_session", "mock_user_service") -def test_update_testimonial_success(mock_user_service, mock_db_session): - """Test successful update of a testimonial.""" - create_mock_user(mock_user_service, mock_db_session) - - login_response = client.post(LOGIN_ENDPOINT, json={ +def get_auth_token(): + """Helper function to authenticate and return a valid access token.""" + response = client.post(LOGIN_ENDPOINT, json={ "email": "testuser@gmail.com", "password": "Testpassword@123" }) - login_data = login_response.json() - access_token = login_data.get('access_token') - - assert access_token, "Login failed, no access token returned" + assert response.status_code == status.HTTP_200_OK, "Login failed" + return response.json().get('access_token') - testimonial = create_testimonial(mock_user_service, mock_db_session) +@pytest.mark.usefixtures("mock_db_session", "mock_user_service") +def test_update_testimonial_success(mock_user_service, mock_db_session): + """Test successful update of a testimonial.""" + mock_user = create_mock_user(mock_user_service, mock_db_session) + access_token = get_auth_token() + testimonial = create_testimonial(mock_db_session, mock_user.id) + update_data = {"content": "Updated content"} - - # Send the update request - update_response = client.put( - f'/api/v1/testimonials/{testimonial.id}', + response = client.put( + f'{TESTIMONIAL_ENDPOINT}/{testimonial.id}', json=update_data, headers={'Authorization': f'Bearer {access_token}'} ) - update_response_data = update_response.json() - print("Update Response:", update_response_data) # Debugging log - - # Assert update request was successful - assert update_response.status_code == status.HTTP_200_OK - - # Fetch the updated testimonial from the API - fetch_response = client.get( - f'/api/v1/testimonials/{testimonial.id}', - headers={'Authorization': f'Bearer {access_token}'} - ) - fetch_data = fetch_response.json() - print("Fetch Updated Testimonial:", fetch_data) # Debugging log - - # Assert fetching the updated testimonial was successful - assert fetch_response.status_code == status.HTTP_200_OK - assert "data" in fetch_data, "Response missing 'data' key" - assert "content" in fetch_data["data"], "Response missing 'content' key" - assert fetch_data["data"]["content"] == "Updated content", \ - f"Expected content: 'Updated content', but got: {fetch_data['data']['content']}" - + assert response.status_code == status.HTTP_200_OK + assert response.json().get("message") == "Testimonial updated successfully" @pytest.mark.usefixtures("mock_db_session", "mock_user_service") def test_update_testimonial_not_found(mock_user_service, mock_db_session): @@ -149,11 +124,8 @@ def test_update_testimonial_unauthorized(): """Test updating a testimonial without authentication.""" testimonial_id = str(uuid7()) update_data = {"content": "Updated content"} - - response = client.put(f'/api/v1/testimonials/{testimonial_id}', json=update_data) - response_data = response.json() - print("Unauthorized Response:", response_data) # Debugging log - + response = client.put(f'{TESTIMONIAL_ENDPOINT}/{testimonial_id}', json=update_data) assert response.status_code == status.HTTP_401_UNAUTHORIZED - assert response_data.get("message") == "Not authenticated" + assert response.json().get("message") == "Not authenticated" + From 7d816a80160900c1baf26d596be761893d916e22 Mon Sep 17 00:00:00 2001 From: Henrietta Onoge Date: Sat, 1 Mar 2025 18:10:46 -0800 Subject: [PATCH 05/10] Improved test reliability and consistency with dependency overrides --- dev/bin/gunicorn | 8 + dev/bin/qr | 8 + .../testimonial/test_testimonial_updates.py | 273 ++++++++++++------ 3 files changed, 200 insertions(+), 89 deletions(-) create mode 100644 dev/bin/gunicorn create mode 100644 dev/bin/qr diff --git a/dev/bin/gunicorn b/dev/bin/gunicorn new file mode 100644 index 000000000..4660ff86f --- /dev/null +++ b/dev/bin/gunicorn @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from gunicorn.app.wsgiapp import run +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(run()) diff --git a/dev/bin/qr b/dev/bin/qr new file mode 100644 index 000000000..9a53dc124 --- /dev/null +++ b/dev/bin/qr @@ -0,0 +1,8 @@ +#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from qrcode.console_scripts import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/tests/v1/testimonial/test_testimonial_updates.py b/tests/v1/testimonial/test_testimonial_updates.py index e81b1a49d..28d598db9 100644 --- a/tests/v1/testimonial/test_testimonial_updates.py +++ b/tests/v1/testimonial/test_testimonial_updates.py @@ -1,131 +1,226 @@ +# import pytest +# from fastapi.testclient import TestClient +# from unittest.mock import MagicMock, patch +# from uuid_extensions import uuid7 +# from datetime import datetime, timezone +# from faker import Faker +# from main import app +# from api.db.database import get_db +# from api.v1.models.user import User +# from api.v1.models.testimonial import Testimonial +# from api.v1.services.user import user_service +# from fastapi import status + +# fake = Faker() +# client = TestClient(app) + +# # Fixtures +# @pytest.fixture +# def db_session_mock(): +# db_session = MagicMock() +# return db_session + +# @pytest.fixture +# def client(db_session_mock): +# app.dependency_overrides[get_db] = lambda: db_session_mock +# client = TestClient(app) +# yield client +# app.dependency_overrides = {} + +# # Mocking helper functions +# def mock_get_current_user(): +# return User( +# id=str(uuid7()), +# email=fake.email(), +# password=user_service.hash_password("Testpassword@123"), +# first_name="Test", +# last_name="User", +# is_active=True, +# is_superadmin=False, +# created_at=datetime.now(timezone.utc), +# updated_at=datetime.now(timezone.utc) +# ) + +# def mock_testimonial(): +# return Testimonial( +# id=str(uuid7()), +# content="Original content", +# author_id=str(uuid7()), +# client_name="Client 1", +# client_designation="Client Designation", +# comments="Testimonial comments", +# ratings=4.5 +# ) + +# # Test cases +# def test_update_testimonial_success(client, db_session_mock): +# '''Test successful update of a testimonial''' + +# mock_user = mock_get_current_user() +# app.dependency_overrides[user_service.get_current_user] = lambda: mock_user + +# mock_testimonial_obj = mock_testimonial(mock_user.id) # Pass the mock user's ID +# db_session_mock.get.return_value = mock_testimonial_obj + +# update_data = {"content": "Updated content"} +# response = client.put( +# f'/api/v1/testimonials/{mock_testimonial_obj.id}', +# json=update_data, +# headers={'Authorization': 'Bearer token'} +# ) + +# assert response.status_code == 200 +# assert response.json()["message"] == "Testimonial updated successfully" + + +# def test_update_testimonial_not_found(client, db_session_mock): +# '''Test updating a non-existing testimonial''' + +# app.dependency_overrides[user_service.get_current_user] = lambda: mock_get_current_user() + +# db_session_mock.get.return_value = None + +# update_data = {"content": "Updated content"} +# testimonial_id = str(uuid7()) +# response = client.put( +# f'/api/v1/testimonials/{testimonial_id}', +# json=update_data, +# headers={'Authorization': 'Bearer token'} +# ) + +# assert response.status_code == 404 +# assert response.json()["message"] in ["Testimonial not found", "Testimonial does not exist"] + + +# def test_update_testimonial_unauthorized(client): +# '''Test updating a testimonial without authentication''' + +# testimonial_id = str(uuid7()) +# update_data = {"content": "Updated content"} + +# response = client.put(f'/api/v1/testimonials/{testimonial_id}', json=update_data) + +# assert response.status_code == 401 +# assert response.json()["message"] == "Not authenticated" + import pytest from fastapi.testclient import TestClient -from unittest.mock import patch, MagicMock +from unittest.mock import MagicMock, patch +from uuid_extensions import uuid7 +from datetime import datetime, timezone +from faker import Faker from main import app +from api.db.database import get_db from api.v1.models.user import User from api.v1.models.testimonial import Testimonial from api.v1.services.user import user_service -from uuid_extensions import uuid7 -from api.db.database import get_db from fastapi import status -from datetime import datetime, timezone -LOGIN_ENDPOINT = 'api/v1/auth/login' -TESTIMONIAL_ENDPOINT = '/api/v1/testimonials' +fake = Faker() client = TestClient(app) +# Fixtures @pytest.fixture -def mock_db_session(): - """Fixture to create a mock database session.""" - with patch("api.v1.services.user.get_db", autospec=True) as mock_get_db: - mock_db = MagicMock() - app.dependency_overrides[get_db] = lambda: mock_db - yield mock_db - app.dependency_overrides = {} +def db_session_mock(): + db_session = MagicMock() + return db_session @pytest.fixture -def mock_user_service(): - """Fixture to create a mock user service.""" - with patch("api.v1.services.user.user_service", autospec=True) as mock_service: - yield mock_service - -def create_mock_user(mock_user_service, mock_db_session): - """Create a mock user in the mock database session.""" - mock_user = User( +def client(db_session_mock): + app.dependency_overrides[get_db] = lambda: db_session_mock + client = TestClient(app) + yield client + app.dependency_overrides = {} + +# Mocking helper functions +def mock_get_current_user(): + return User( id=str(uuid7()), - email="testuser@gmail.com", + email=fake.email(), password=user_service.hash_password("Testpassword@123"), - first_name='Test', - last_name='User', + first_name="Test", + last_name="User", is_active=True, is_superadmin=False, created_at=datetime.now(timezone.utc), updated_at=datetime.now(timezone.utc) ) - mock_db_session.query.return_value.filter.return_value.first.return_value = mock_user - return mock_user -def create_testimonial(mock_db_session, user_id): - """Create a mock testimonial in the mock database session.""" - mock_testimonial = Testimonial( +def mock_testimonial(user_id): + return Testimonial( id=str(uuid7()), - content='Original content', - author_id=user_id, + content="Original content", + author_id=user_id, # Ensure it belongs to the mock user client_name="Client 1", client_designation="Client Designation", comments="Testimonial comments", ratings=4.5 ) - mock_db_session.get.return_value = mock_testimonial - return mock_testimonial - -def get_auth_token(): - """Helper function to authenticate and return a valid access token.""" - response = client.post(LOGIN_ENDPOINT, json={ - "email": "testuser@gmail.com", - "password": "Testpassword@123" - }) - assert response.status_code == status.HTTP_200_OK, "Login failed" - return response.json().get('access_token') - -@pytest.mark.usefixtures("mock_db_session", "mock_user_service") -def test_update_testimonial_success(mock_user_service, mock_db_session): - """Test successful update of a testimonial.""" - mock_user = create_mock_user(mock_user_service, mock_db_session) - access_token = get_auth_token() - testimonial = create_testimonial(mock_db_session, mock_user.id) + +# Test cases +def test_update_testimonial_success(client, db_session_mock): + '''Test successful update of a testimonial''' + + mock_user = mock_get_current_user() + app.dependency_overrides[user_service.get_current_user] = lambda: mock_user + + mock_testimonial_obj = mock_testimonial(mock_user.id) # Pass the mock user's ID + db_session_mock.get.return_value = mock_testimonial_obj update_data = {"content": "Updated content"} response = client.put( - f'{TESTIMONIAL_ENDPOINT}/{testimonial.id}', + f'/api/v1/testimonials/{mock_testimonial_obj.id}', json=update_data, - headers={'Authorization': f'Bearer {access_token}'} + headers={'Authorization': 'Bearer token'} ) - assert response.status_code == status.HTTP_200_OK - assert response.json().get("message") == "Testimonial updated successfully" - -@pytest.mark.usefixtures("mock_db_session", "mock_user_service") -def test_update_testimonial_not_found(mock_user_service, mock_db_session): - """Test updating a non-existing testimonial.""" - create_mock_user(mock_user_service, mock_db_session) - login_response = client.post(LOGIN_ENDPOINT, json={ - "email": "testuser@gmail.com", - "password": "Testpassword@123" - }) - login_data = login_response.json() - access_token = login_data.get('access_token') + assert response.status_code == 200 + assert response.json()["message"] == "Testimonial updated successfully" - assert access_token, "Login failed, no access token returned" +# def test_update_testimonial_not_found(client, db_session_mock): +# '''Test updating a non-existing testimonial''' + +# mock_user = mock_get_current_user() +# app.dependency_overrides[user_service.get_current_user] = lambda: mock_user + +# db_session_mock.get.return_value = None + +# update_data = {"content": "Updated content"} +# testimonial_id = str(uuid7()) +# response = client.put( +# f'/api/v1/testimonials/{testimonial_id}', +# json=update_data, +# headers={'Authorization': 'Bearer token'} +# ) + +# assert response.status_code == 404 +# assert response.json()["message"] == "Testimonial not found" - non_existent_id = str(uuid7()) +def test_update_testimonial_not_found(client, db_session_mock): + '''Test updating a non-existing testimonial''' + + app.dependency_overrides[user_service.get_current_user] = lambda: mock_get_current_user() + + db_session_mock.get.return_value = None + update_data = {"content": "Updated content"} - + testimonial_id = str(uuid7()) response = client.put( - f'/api/v1/testimonials/{non_existent_id}', + f'/api/v1/testimonials/{testimonial_id}', json=update_data, - headers={'Authorization': f'Bearer {access_token}'} - ) - - response_data = response.json() - print("Not Found Response:", response_data) # Debugging log - - expected_messages = [ - "Testimonial not found", - "You do not have permission to update this testimonial", - "Not authorized to update this testimonial" - ] - - assert response.status_code in [status.HTTP_404_NOT_FOUND, status.HTTP_403_FORBIDDEN] - assert response_data.get("message") in expected_messages + headers={'Authorization': 'Bearer token'} + ) + + assert response.status_code == 404 + assert response.json()["message"] in ["Testimonial not found", "Testimonial does not exist"] -@pytest.mark.usefixtures("mock_db_session", "mock_user_service") -def test_update_testimonial_unauthorized(): - """Test updating a testimonial without authentication.""" +def test_update_testimonial_unauthorized(client): + '''Test updating a testimonial without authentication''' + testimonial_id = str(uuid7()) update_data = {"content": "Updated content"} - response = client.put(f'{TESTIMONIAL_ENDPOINT}/{testimonial_id}', json=update_data) - assert response.status_code == status.HTTP_401_UNAUTHORIZED - assert response.json().get("message") == "Not authenticated" - + response = client.put(f'/api/v1/testimonials/{testimonial_id}', json=update_data) + + assert response.status_code == 401 + assert response.json()["message"] == "Not authenticated" From 5fbd5ca117a24f20a39c10d99f405c932dc24f08 Mon Sep 17 00:00:00 2001 From: Henrietta Onoge Date: Sun, 2 Mar 2025 00:00:24 -0800 Subject: [PATCH 06/10] removed database url from alembic ini --- alembic.ini | 2 +- .../testimonial/test_testimonial_updates.py | 131 +----------------- 2 files changed, 5 insertions(+), 128 deletions(-) diff --git a/alembic.ini b/alembic.ini index aa527e1b0..56d1d2f0d 100644 --- a/alembic.ini +++ b/alembic.ini @@ -60,7 +60,7 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne # are written from script.py.mako # output_encoding = utf-8 -sqlalchemy.url = postgresql://samhetty:stage4@localhost:5432/hng_fast_api +sqlalchemy.url = diff --git a/tests/v1/testimonial/test_testimonial_updates.py b/tests/v1/testimonial/test_testimonial_updates.py index 28d598db9..5492237c3 100644 --- a/tests/v1/testimonial/test_testimonial_updates.py +++ b/tests/v1/testimonial/test_testimonial_updates.py @@ -1,108 +1,3 @@ -# import pytest -# from fastapi.testclient import TestClient -# from unittest.mock import MagicMock, patch -# from uuid_extensions import uuid7 -# from datetime import datetime, timezone -# from faker import Faker -# from main import app -# from api.db.database import get_db -# from api.v1.models.user import User -# from api.v1.models.testimonial import Testimonial -# from api.v1.services.user import user_service -# from fastapi import status - -# fake = Faker() -# client = TestClient(app) - -# # Fixtures -# @pytest.fixture -# def db_session_mock(): -# db_session = MagicMock() -# return db_session - -# @pytest.fixture -# def client(db_session_mock): -# app.dependency_overrides[get_db] = lambda: db_session_mock -# client = TestClient(app) -# yield client -# app.dependency_overrides = {} - -# # Mocking helper functions -# def mock_get_current_user(): -# return User( -# id=str(uuid7()), -# email=fake.email(), -# password=user_service.hash_password("Testpassword@123"), -# first_name="Test", -# last_name="User", -# is_active=True, -# is_superadmin=False, -# created_at=datetime.now(timezone.utc), -# updated_at=datetime.now(timezone.utc) -# ) - -# def mock_testimonial(): -# return Testimonial( -# id=str(uuid7()), -# content="Original content", -# author_id=str(uuid7()), -# client_name="Client 1", -# client_designation="Client Designation", -# comments="Testimonial comments", -# ratings=4.5 -# ) - -# # Test cases -# def test_update_testimonial_success(client, db_session_mock): -# '''Test successful update of a testimonial''' - -# mock_user = mock_get_current_user() -# app.dependency_overrides[user_service.get_current_user] = lambda: mock_user - -# mock_testimonial_obj = mock_testimonial(mock_user.id) # Pass the mock user's ID -# db_session_mock.get.return_value = mock_testimonial_obj - -# update_data = {"content": "Updated content"} -# response = client.put( -# f'/api/v1/testimonials/{mock_testimonial_obj.id}', -# json=update_data, -# headers={'Authorization': 'Bearer token'} -# ) - -# assert response.status_code == 200 -# assert response.json()["message"] == "Testimonial updated successfully" - - -# def test_update_testimonial_not_found(client, db_session_mock): -# '''Test updating a non-existing testimonial''' - -# app.dependency_overrides[user_service.get_current_user] = lambda: mock_get_current_user() - -# db_session_mock.get.return_value = None - -# update_data = {"content": "Updated content"} -# testimonial_id = str(uuid7()) -# response = client.put( -# f'/api/v1/testimonials/{testimonial_id}', -# json=update_data, -# headers={'Authorization': 'Bearer token'} -# ) - -# assert response.status_code == 404 -# assert response.json()["message"] in ["Testimonial not found", "Testimonial does not exist"] - - -# def test_update_testimonial_unauthorized(client): -# '''Test updating a testimonial without authentication''' - -# testimonial_id = str(uuid7()) -# update_data = {"content": "Updated content"} - -# response = client.put(f'/api/v1/testimonials/{testimonial_id}', json=update_data) - -# assert response.status_code == 401 -# assert response.json()["message"] == "Not authenticated" - import pytest from fastapi.testclient import TestClient from unittest.mock import MagicMock, patch @@ -132,7 +27,7 @@ def client(db_session_mock): yield client app.dependency_overrides = {} -# Mocking helper functions + def mock_get_current_user(): return User( id=str(uuid7()), @@ -150,21 +45,21 @@ def mock_testimonial(user_id): return Testimonial( id=str(uuid7()), content="Original content", - author_id=user_id, # Ensure it belongs to the mock user + author_id=user_id, client_name="Client 1", client_designation="Client Designation", comments="Testimonial comments", ratings=4.5 ) -# Test cases + def test_update_testimonial_success(client, db_session_mock): '''Test successful update of a testimonial''' mock_user = mock_get_current_user() app.dependency_overrides[user_service.get_current_user] = lambda: mock_user - mock_testimonial_obj = mock_testimonial(mock_user.id) # Pass the mock user's ID + mock_testimonial_obj = mock_testimonial(mock_user.id) db_session_mock.get.return_value = mock_testimonial_obj update_data = {"content": "Updated content"} @@ -177,24 +72,6 @@ def test_update_testimonial_success(client, db_session_mock): assert response.status_code == 200 assert response.json()["message"] == "Testimonial updated successfully" -# def test_update_testimonial_not_found(client, db_session_mock): -# '''Test updating a non-existing testimonial''' - -# mock_user = mock_get_current_user() -# app.dependency_overrides[user_service.get_current_user] = lambda: mock_user - -# db_session_mock.get.return_value = None - -# update_data = {"content": "Updated content"} -# testimonial_id = str(uuid7()) -# response = client.put( -# f'/api/v1/testimonials/{testimonial_id}', -# json=update_data, -# headers={'Authorization': 'Bearer token'} -# ) - -# assert response.status_code == 404 -# assert response.json()["message"] == "Testimonial not found" def test_update_testimonial_not_found(client, db_session_mock): '''Test updating a non-existing testimonial''' From 85ed8ac4ca78af27e47141b0d3156a8bff56e6c8 Mon Sep 17 00:00:00 2001 From: Henrietta Onoge Date: Sun, 2 Mar 2025 00:30:12 -0800 Subject: [PATCH 07/10] Removed venv from repo --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7c3c0c7a2..6ec6b1efd 100644 --- a/.gitignore +++ b/.gitignore @@ -133,6 +133,7 @@ celerybeat.pid .blog_env/ env/ +dev/ venv* *venv/ ENV/ From ae54baf72c994d77ad52a8a8ecc307bc3116ec81 Mon Sep 17 00:00:00 2001 From: Henrietta Onoge Date: Sun, 2 Mar 2025 00:36:20 -0800 Subject: [PATCH 08/10] Removed venv from repo and added to .gitignore --- .gitignore | 2 +- dev/bin/Activate.ps1 | 247 ------------------ dev/bin/activate | 70 ----- dev/bin/activate.csh | 27 -- dev/bin/activate.fish | 69 ----- dev/bin/alembic | 8 - dev/bin/autopep8 | 8 - dev/bin/black | 8 - dev/bin/blackd | 8 - dev/bin/csscapture | 8 - dev/bin/csscombine | 8 - dev/bin/cssparse | 8 - dev/bin/dotenv | 8 - dev/bin/email_validator | 8 - dev/bin/faker | 8 - dev/bin/fastapi | 8 - dev/bin/flake8 | 8 - dev/bin/get_gprof | 75 ------ dev/bin/get_objgraph | 54 ---- dev/bin/gunicorn | 8 - dev/bin/httpx | 8 - dev/bin/identify-cli | 8 - dev/bin/isort | 8 - dev/bin/isort-identify-imports | 8 - dev/bin/mako-render | 8 - dev/bin/markdown-it | 8 - dev/bin/nodeenv | 8 - dev/bin/normalizer | 8 - dev/bin/pip | 8 - dev/bin/pip3 | 8 - dev/bin/pip3.12 | 8 - dev/bin/pipdeptree | 8 - dev/bin/pre-commit | 8 - dev/bin/py.test | 8 - dev/bin/pycodestyle | 8 - dev/bin/pyflakes | 8 - dev/bin/pygmentize | 8 - dev/bin/pylint | 8 - dev/bin/pylint-config | 8 - dev/bin/pyreverse | 8 - dev/bin/pyrsa-decrypt | 8 - dev/bin/pyrsa-encrypt | 8 - dev/bin/pyrsa-keygen | 8 - dev/bin/pyrsa-priv2pub | 8 - dev/bin/pyrsa-sign | 8 - dev/bin/pyrsa-verify | 8 - dev/bin/pytest | 8 - dev/bin/python | 1 - dev/bin/python3 | 1 - dev/bin/python3.12 | 1 - dev/bin/qr | 8 - dev/bin/symilar | 8 - dev/bin/typer | 8 - dev/bin/undill | 22 -- dev/bin/uvicorn | 8 - dev/bin/virtualenv | 8 - dev/bin/watchfiles | 8 - .../site/python3.12/greenlet/greenlet.h | 164 ------------ dev/lib64 | 1 - dev/pyvenv.cfg | 5 - 60 files changed, 1 insertion(+), 1106 deletions(-) delete mode 100644 dev/bin/Activate.ps1 delete mode 100644 dev/bin/activate delete mode 100644 dev/bin/activate.csh delete mode 100644 dev/bin/activate.fish delete mode 100644 dev/bin/alembic delete mode 100644 dev/bin/autopep8 delete mode 100644 dev/bin/black delete mode 100644 dev/bin/blackd delete mode 100644 dev/bin/csscapture delete mode 100644 dev/bin/csscombine delete mode 100644 dev/bin/cssparse delete mode 100644 dev/bin/dotenv delete mode 100644 dev/bin/email_validator delete mode 100644 dev/bin/faker delete mode 100644 dev/bin/fastapi delete mode 100644 dev/bin/flake8 delete mode 100644 dev/bin/get_gprof delete mode 100644 dev/bin/get_objgraph delete mode 100644 dev/bin/gunicorn delete mode 100644 dev/bin/httpx delete mode 100644 dev/bin/identify-cli delete mode 100644 dev/bin/isort delete mode 100644 dev/bin/isort-identify-imports delete mode 100644 dev/bin/mako-render delete mode 100644 dev/bin/markdown-it delete mode 100644 dev/bin/nodeenv delete mode 100644 dev/bin/normalizer delete mode 100644 dev/bin/pip delete mode 100644 dev/bin/pip3 delete mode 100644 dev/bin/pip3.12 delete mode 100644 dev/bin/pipdeptree delete mode 100644 dev/bin/pre-commit delete mode 100644 dev/bin/py.test delete mode 100644 dev/bin/pycodestyle delete mode 100644 dev/bin/pyflakes delete mode 100644 dev/bin/pygmentize delete mode 100644 dev/bin/pylint delete mode 100644 dev/bin/pylint-config delete mode 100644 dev/bin/pyreverse delete mode 100644 dev/bin/pyrsa-decrypt delete mode 100644 dev/bin/pyrsa-encrypt delete mode 100644 dev/bin/pyrsa-keygen delete mode 100644 dev/bin/pyrsa-priv2pub delete mode 100644 dev/bin/pyrsa-sign delete mode 100644 dev/bin/pyrsa-verify delete mode 100644 dev/bin/pytest delete mode 120000 dev/bin/python delete mode 120000 dev/bin/python3 delete mode 120000 dev/bin/python3.12 delete mode 100644 dev/bin/qr delete mode 100644 dev/bin/symilar delete mode 100644 dev/bin/typer delete mode 100644 dev/bin/undill delete mode 100644 dev/bin/uvicorn delete mode 100644 dev/bin/virtualenv delete mode 100644 dev/bin/watchfiles delete mode 100644 dev/include/site/python3.12/greenlet/greenlet.h delete mode 120000 dev/lib64 delete mode 100644 dev/pyvenv.cfg diff --git a/.gitignore b/.gitignore index 6ec6b1efd..1117795e9 100644 --- a/.gitignore +++ b/.gitignore @@ -133,7 +133,7 @@ celerybeat.pid .blog_env/ env/ -dev/ +venv/ venv* *venv/ ENV/ diff --git a/dev/bin/Activate.ps1 b/dev/bin/Activate.ps1 deleted file mode 100644 index b49d77ba4..000000000 --- a/dev/bin/Activate.ps1 +++ /dev/null @@ -1,247 +0,0 @@ -<# -.Synopsis -Activate a Python virtual environment for the current PowerShell session. - -.Description -Pushes the python executable for a virtual environment to the front of the -$Env:PATH environment variable and sets the prompt to signify that you are -in a Python virtual environment. Makes use of the command line switches as -well as the `pyvenv.cfg` file values present in the virtual environment. - -.Parameter VenvDir -Path to the directory that contains the virtual environment to activate. The -default value for this is the parent of the directory that the Activate.ps1 -script is located within. - -.Parameter Prompt -The prompt prefix to display when this virtual environment is activated. By -default, this prompt is the name of the virtual environment folder (VenvDir) -surrounded by parentheses and followed by a single space (ie. '(.venv) '). - -.Example -Activate.ps1 -Activates the Python virtual environment that contains the Activate.ps1 script. - -.Example -Activate.ps1 -Verbose -Activates the Python virtual environment that contains the Activate.ps1 script, -and shows extra information about the activation as it executes. - -.Example -Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv -Activates the Python virtual environment located in the specified location. - -.Example -Activate.ps1 -Prompt "MyPython" -Activates the Python virtual environment that contains the Activate.ps1 script, -and prefixes the current prompt with the specified string (surrounded in -parentheses) while the virtual environment is active. - -.Notes -On Windows, it may be required to enable this Activate.ps1 script by setting the -execution policy for the user. You can do this by issuing the following PowerShell -command: - -PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - -For more information on Execution Policies: -https://go.microsoft.com/fwlink/?LinkID=135170 - -#> -Param( - [Parameter(Mandatory = $false)] - [String] - $VenvDir, - [Parameter(Mandatory = $false)] - [String] - $Prompt -) - -<# Function declarations --------------------------------------------------- #> - -<# -.Synopsis -Remove all shell session elements added by the Activate script, including the -addition of the virtual environment's Python executable from the beginning of -the PATH variable. - -.Parameter NonDestructive -If present, do not remove this function from the global namespace for the -session. - -#> -function global:deactivate ([switch]$NonDestructive) { - # Revert to original values - - # The prior prompt: - if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { - Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt - Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT - } - - # The prior PYTHONHOME: - if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { - Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME - Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME - } - - # The prior PATH: - if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { - Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH - Remove-Item -Path Env:_OLD_VIRTUAL_PATH - } - - # Just remove the VIRTUAL_ENV altogether: - if (Test-Path -Path Env:VIRTUAL_ENV) { - Remove-Item -Path env:VIRTUAL_ENV - } - - # Just remove VIRTUAL_ENV_PROMPT altogether. - if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { - Remove-Item -Path env:VIRTUAL_ENV_PROMPT - } - - # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: - if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { - Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force - } - - # Leave deactivate function in the global namespace if requested: - if (-not $NonDestructive) { - Remove-Item -Path function:deactivate - } -} - -<# -.Description -Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the -given folder, and returns them in a map. - -For each line in the pyvenv.cfg file, if that line can be parsed into exactly -two strings separated by `=` (with any amount of whitespace surrounding the =) -then it is considered a `key = value` line. The left hand string is the key, -the right hand is the value. - -If the value starts with a `'` or a `"` then the first and last character is -stripped from the value before being captured. - -.Parameter ConfigDir -Path to the directory that contains the `pyvenv.cfg` file. -#> -function Get-PyVenvConfig( - [String] - $ConfigDir -) { - Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" - - # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). - $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue - - # An empty map will be returned if no config file is found. - $pyvenvConfig = @{ } - - if ($pyvenvConfigPath) { - - Write-Verbose "File exists, parse `key = value` lines" - $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath - - $pyvenvConfigContent | ForEach-Object { - $keyval = $PSItem -split "\s*=\s*", 2 - if ($keyval[0] -and $keyval[1]) { - $val = $keyval[1] - - # Remove extraneous quotations around a string value. - if ("'""".Contains($val.Substring(0, 1))) { - $val = $val.Substring(1, $val.Length - 2) - } - - $pyvenvConfig[$keyval[0]] = $val - Write-Verbose "Adding Key: '$($keyval[0])'='$val'" - } - } - } - return $pyvenvConfig -} - - -<# Begin Activate script --------------------------------------------------- #> - -# Determine the containing directory of this script -$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition -$VenvExecDir = Get-Item -Path $VenvExecPath - -Write-Verbose "Activation script is located in path: '$VenvExecPath'" -Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" -Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" - -# Set values required in priority: CmdLine, ConfigFile, Default -# First, get the location of the virtual environment, it might not be -# VenvExecDir if specified on the command line. -if ($VenvDir) { - Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" -} -else { - Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." - $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") - Write-Verbose "VenvDir=$VenvDir" -} - -# Next, read the `pyvenv.cfg` file to determine any required value such -# as `prompt`. -$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir - -# Next, set the prompt from the command line, or the config file, or -# just use the name of the virtual environment folder. -if ($Prompt) { - Write-Verbose "Prompt specified as argument, using '$Prompt'" -} -else { - Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" - if ($pyvenvCfg -and $pyvenvCfg['prompt']) { - Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" - $Prompt = $pyvenvCfg['prompt']; - } - else { - Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" - Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" - $Prompt = Split-Path -Path $venvDir -Leaf - } -} - -Write-Verbose "Prompt = '$Prompt'" -Write-Verbose "VenvDir='$VenvDir'" - -# Deactivate any currently active virtual environment, but leave the -# deactivate function in place. -deactivate -nondestructive - -# Now set the environment variable VIRTUAL_ENV, used by many tools to determine -# that there is an activated venv. -$env:VIRTUAL_ENV = $VenvDir - -if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { - - Write-Verbose "Setting prompt to '$Prompt'" - - # Set the prompt to include the env name - # Make sure _OLD_VIRTUAL_PROMPT is global - function global:_OLD_VIRTUAL_PROMPT { "" } - Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT - New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt - - function global:prompt { - Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " - _OLD_VIRTUAL_PROMPT - } - $env:VIRTUAL_ENV_PROMPT = $Prompt -} - -# Clear PYTHONHOME -if (Test-Path -Path Env:PYTHONHOME) { - Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME - Remove-Item -Path Env:PYTHONHOME -} - -# Add the venv to the PATH -Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH -$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/dev/bin/activate b/dev/bin/activate deleted file mode 100644 index 230eb42cd..000000000 --- a/dev/bin/activate +++ /dev/null @@ -1,70 +0,0 @@ -# This file must be used with "source bin/activate" *from bash* -# You cannot run it directly - -deactivate () { - # reset old environment variables - if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then - PATH="${_OLD_VIRTUAL_PATH:-}" - export PATH - unset _OLD_VIRTUAL_PATH - fi - if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then - PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" - export PYTHONHOME - unset _OLD_VIRTUAL_PYTHONHOME - fi - - # Call hash to forget past commands. Without forgetting - # past commands the $PATH changes we made may not be respected - hash -r 2> /dev/null - - if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then - PS1="${_OLD_VIRTUAL_PS1:-}" - export PS1 - unset _OLD_VIRTUAL_PS1 - fi - - unset VIRTUAL_ENV - unset VIRTUAL_ENV_PROMPT - if [ ! "${1:-}" = "nondestructive" ] ; then - # Self destruct! - unset -f deactivate - fi -} - -# unset irrelevant variables -deactivate nondestructive - -# on Windows, a path can contain colons and backslashes and has to be converted: -if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then - # transform D:\path\to\venv to /d/path/to/venv on MSYS - # and to /cygdrive/d/path/to/venv on Cygwin - export VIRTUAL_ENV=$(cygpath /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev) -else - # use the path as-is - export VIRTUAL_ENV=/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev -fi - -_OLD_VIRTUAL_PATH="$PATH" -PATH="$VIRTUAL_ENV/"bin":$PATH" -export PATH - -# unset PYTHONHOME if set -# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) -# could use `if (set -u; : $PYTHONHOME) ;` in bash -if [ -n "${PYTHONHOME:-}" ] ; then - _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" - unset PYTHONHOME -fi - -if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then - _OLD_VIRTUAL_PS1="${PS1:-}" - PS1='(dev) '"${PS1:-}" - export PS1 - VIRTUAL_ENV_PROMPT='(dev) ' - export VIRTUAL_ENV_PROMPT -fi - -# Call hash to forget past commands. Without forgetting -# past commands the $PATH changes we made may not be respected -hash -r 2> /dev/null diff --git a/dev/bin/activate.csh b/dev/bin/activate.csh deleted file mode 100644 index 507d0c3ad..000000000 --- a/dev/bin/activate.csh +++ /dev/null @@ -1,27 +0,0 @@ -# This file must be used with "source bin/activate.csh" *from csh*. -# You cannot run it directly. - -# Created by Davide Di Blasi . -# Ported to Python 3.3 venv by Andrew Svetlov - -alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' - -# Unset irrelevant variables. -deactivate nondestructive - -setenv VIRTUAL_ENV /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev - -set _OLD_VIRTUAL_PATH="$PATH" -setenv PATH "$VIRTUAL_ENV/"bin":$PATH" - - -set _OLD_VIRTUAL_PROMPT="$prompt" - -if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - set prompt = '(dev) '"$prompt" - setenv VIRTUAL_ENV_PROMPT '(dev) ' -endif - -alias pydoc python -m pydoc - -rehash diff --git a/dev/bin/activate.fish b/dev/bin/activate.fish deleted file mode 100644 index 624e2f422..000000000 --- a/dev/bin/activate.fish +++ /dev/null @@ -1,69 +0,0 @@ -# This file must be used with "source /bin/activate.fish" *from fish* -# (https://fishshell.com/). You cannot run it directly. - -function deactivate -d "Exit virtual environment and return to normal shell environment" - # reset old environment variables - if test -n "$_OLD_VIRTUAL_PATH" - set -gx PATH $_OLD_VIRTUAL_PATH - set -e _OLD_VIRTUAL_PATH - end - if test -n "$_OLD_VIRTUAL_PYTHONHOME" - set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME - set -e _OLD_VIRTUAL_PYTHONHOME - end - - if test -n "$_OLD_FISH_PROMPT_OVERRIDE" - set -e _OLD_FISH_PROMPT_OVERRIDE - # prevents error when using nested fish instances (Issue #93858) - if functions -q _old_fish_prompt - functions -e fish_prompt - functions -c _old_fish_prompt fish_prompt - functions -e _old_fish_prompt - end - end - - set -e VIRTUAL_ENV - set -e VIRTUAL_ENV_PROMPT - if test "$argv[1]" != "nondestructive" - # Self-destruct! - functions -e deactivate - end -end - -# Unset irrelevant variables. -deactivate nondestructive - -set -gx VIRTUAL_ENV /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev - -set -gx _OLD_VIRTUAL_PATH $PATH -set -gx PATH "$VIRTUAL_ENV/"bin $PATH - -# Unset PYTHONHOME if set. -if set -q PYTHONHOME - set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME - set -e PYTHONHOME -end - -if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" - # fish uses a function instead of an env var to generate the prompt. - - # Save the current fish_prompt function as the function _old_fish_prompt. - functions -c fish_prompt _old_fish_prompt - - # With the original prompt function renamed, we can override with our own. - function fish_prompt - # Save the return status of the last command. - set -l old_status $status - - # Output the venv prompt; color taken from the blue of the Python logo. - printf "%s%s%s" (set_color 4B8BBE) '(dev) ' (set_color normal) - - # Restore the return status of the previous command. - echo "exit $old_status" | . - # Output the original/"old" prompt. - _old_fish_prompt - end - - set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" - set -gx VIRTUAL_ENV_PROMPT '(dev) ' -end diff --git a/dev/bin/alembic b/dev/bin/alembic deleted file mode 100644 index 403d68286..000000000 --- a/dev/bin/alembic +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from alembic.config import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/autopep8 b/dev/bin/autopep8 deleted file mode 100644 index 7f886c97d..000000000 --- a/dev/bin/autopep8 +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from autopep8 import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/black b/dev/bin/black deleted file mode 100644 index d8d7f5cd7..000000000 --- a/dev/bin/black +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from black import patched_main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(patched_main()) diff --git a/dev/bin/blackd b/dev/bin/blackd deleted file mode 100644 index 21026bd69..000000000 --- a/dev/bin/blackd +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from blackd import patched_main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(patched_main()) diff --git a/dev/bin/csscapture b/dev/bin/csscapture deleted file mode 100644 index 73dcb16b8..000000000 --- a/dev/bin/csscapture +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from cssutils.scripts.csscapture import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/csscombine b/dev/bin/csscombine deleted file mode 100644 index 0d66d27bf..000000000 --- a/dev/bin/csscombine +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from cssutils.scripts.csscombine import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/cssparse b/dev/bin/cssparse deleted file mode 100644 index a6dded64f..000000000 --- a/dev/bin/cssparse +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from cssutils.scripts.cssparse import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/dotenv b/dev/bin/dotenv deleted file mode 100644 index bd4cadc1c..000000000 --- a/dev/bin/dotenv +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from dotenv.__main__ import cli -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli()) diff --git a/dev/bin/email_validator b/dev/bin/email_validator deleted file mode 100644 index 3a5988fe0..000000000 --- a/dev/bin/email_validator +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from email_validator.__main__ import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/faker b/dev/bin/faker deleted file mode 100644 index ca577e4ea..000000000 --- a/dev/bin/faker +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from faker.cli import execute_from_command_line -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(execute_from_command_line()) diff --git a/dev/bin/fastapi b/dev/bin/fastapi deleted file mode 100644 index 5bb1acfbf..000000000 --- a/dev/bin/fastapi +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from fastapi_cli.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/flake8 b/dev/bin/flake8 deleted file mode 100644 index 87bfd49d8..000000000 --- a/dev/bin/flake8 +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from flake8.main.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/get_gprof b/dev/bin/get_gprof deleted file mode 100644 index 83e0812ab..000000000 --- a/dev/bin/get_gprof +++ /dev/null @@ -1,75 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) -# Copyright (c) 2008-2016 California Institute of Technology. -# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation. -# License: 3-clause BSD. The full license text is available at: -# - https://github.com/uqfoundation/dill/blob/master/LICENSE -''' -build profile graph for the given instance - -running: - $ get_gprof - -executes: - gprof2dot -f pstats .prof | dot -Tpng -o .call.png - -where: - are arguments for gprof2dot, such as "-n 5 -e 5" - is code to create the instance to profile - is the class of the instance (i.e. type(instance)) - -For example: - $ get_gprof -n 5 -e 1 "import numpy; numpy.array([1,2])" - -will create 'ndarray.call.png' with the profile graph for numpy.array([1,2]), -where '-n 5' eliminates nodes below 5% threshold, similarly '-e 1' eliminates -edges below 1% threshold -''' - -if __name__ == "__main__": - import sys - if len(sys.argv) < 2: - print ("Please provide an object instance (e.g. 'import math; math.pi')") - sys.exit() - # grab args for gprof2dot - args = sys.argv[1:-1] - args = ' '.join(args) - # last arg builds the object - obj = sys.argv[-1] - obj = obj.split(';') - # multi-line prep for generating an instance - for line in obj[:-1]: - exec(line) - # one-line generation of an instance - try: - obj = eval(obj[-1]) - except Exception: - print ("Error processing object instance") - sys.exit() - - # get object 'name' - objtype = type(obj) - name = getattr(objtype, '__name__', getattr(objtype, '__class__', objtype)) - - # profile dumping an object - import dill - import os - import cProfile - #name = os.path.splitext(os.path.basename(__file__))[0] - cProfile.run("dill.dumps(obj)", filename="%s.prof" % name) - msg = "gprof2dot -f pstats %s %s.prof | dot -Tpng -o %s.call.png" % (args, name, name) - try: - res = os.system(msg) - except Exception: - print ("Please verify install of 'gprof2dot' to view profile graphs") - if res: - print ("Please verify install of 'gprof2dot' to view profile graphs") - - # get stats - f_prof = "%s.prof" % name - import pstats - stats = pstats.Stats(f_prof, stream=sys.stdout) - stats.strip_dirs().sort_stats('cumtime') - stats.print_stats(20) #XXX: save to file instead of print top 20? - os.remove(f_prof) diff --git a/dev/bin/get_objgraph b/dev/bin/get_objgraph deleted file mode 100644 index adeb829e1..000000000 --- a/dev/bin/get_objgraph +++ /dev/null @@ -1,54 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) -# Copyright (c) 2008-2016 California Institute of Technology. -# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation. -# License: 3-clause BSD. The full license text is available at: -# - https://github.com/uqfoundation/dill/blob/master/LICENSE -""" -display the reference paths for objects in ``dill.types`` or a .pkl file - -Notes: - the generated image is useful in showing the pointer references in - objects that are or can be pickled. Any object in ``dill.objects`` - listed in ``dill.load_types(picklable=True, unpicklable=True)`` works. - -Examples:: - - $ get_objgraph ArrayType - Image generated as ArrayType.png -""" - -import dill as pickle -#pickle.debug.trace(True) -#import pickle - -# get all objects for testing -from dill import load_types -load_types(pickleable=True,unpickleable=True) -from dill import objects - -if __name__ == "__main__": - import sys - if len(sys.argv) != 2: - print ("Please provide exactly one file or type name (e.g. 'IntType')") - msg = "\n" - for objtype in list(objects.keys())[:40]: - msg += objtype + ', ' - print (msg + "...") - else: - objtype = str(sys.argv[-1]) - try: - obj = objects[objtype] - except KeyError: - obj = pickle.load(open(objtype,'rb')) - import os - objtype = os.path.splitext(objtype)[0] - try: - import objgraph - objgraph.show_refs(obj, filename=objtype+'.png') - except ImportError: - print ("Please install 'objgraph' to view object graphs") - - -# EOF diff --git a/dev/bin/gunicorn b/dev/bin/gunicorn deleted file mode 100644 index 4660ff86f..000000000 --- a/dev/bin/gunicorn +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from gunicorn.app.wsgiapp import run -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(run()) diff --git a/dev/bin/httpx b/dev/bin/httpx deleted file mode 100644 index f2d5e1c35..000000000 --- a/dev/bin/httpx +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from httpx import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/identify-cli b/dev/bin/identify-cli deleted file mode 100644 index f4296cfc6..000000000 --- a/dev/bin/identify-cli +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from identify.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/isort b/dev/bin/isort deleted file mode 100644 index 94186d300..000000000 --- a/dev/bin/isort +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from isort.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/isort-identify-imports b/dev/bin/isort-identify-imports deleted file mode 100644 index 483707de2..000000000 --- a/dev/bin/isort-identify-imports +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from isort.main import identify_imports_main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(identify_imports_main()) diff --git a/dev/bin/mako-render b/dev/bin/mako-render deleted file mode 100644 index dd17d84d5..000000000 --- a/dev/bin/mako-render +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from mako.cmd import cmdline -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cmdline()) diff --git a/dev/bin/markdown-it b/dev/bin/markdown-it deleted file mode 100644 index 60929f770..000000000 --- a/dev/bin/markdown-it +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from markdown_it.cli.parse import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/nodeenv b/dev/bin/nodeenv deleted file mode 100644 index 63c185363..000000000 --- a/dev/bin/nodeenv +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from nodeenv import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/normalizer b/dev/bin/normalizer deleted file mode 100644 index 4bd3fd0ed..000000000 --- a/dev/bin/normalizer +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from charset_normalizer.cli import cli_detect -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli_detect()) diff --git a/dev/bin/pip b/dev/bin/pip deleted file mode 100644 index 27e25c9f7..000000000 --- a/dev/bin/pip +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/pip3 b/dev/bin/pip3 deleted file mode 100644 index 27e25c9f7..000000000 --- a/dev/bin/pip3 +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/pip3.12 b/dev/bin/pip3.12 deleted file mode 100644 index 27e25c9f7..000000000 --- a/dev/bin/pip3.12 +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/pipdeptree b/dev/bin/pipdeptree deleted file mode 100644 index 27291a5ac..000000000 --- a/dev/bin/pipdeptree +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pipdeptree.__main__ import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/pre-commit b/dev/bin/pre-commit deleted file mode 100644 index b54be2cac..000000000 --- a/dev/bin/pre-commit +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pre_commit.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/py.test b/dev/bin/py.test deleted file mode 100644 index decc5c9dd..000000000 --- a/dev/bin/py.test +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pytest import console_main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(console_main()) diff --git a/dev/bin/pycodestyle b/dev/bin/pycodestyle deleted file mode 100644 index c937cb66d..000000000 --- a/dev/bin/pycodestyle +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pycodestyle import _main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(_main()) diff --git a/dev/bin/pyflakes b/dev/bin/pyflakes deleted file mode 100644 index 98495bff4..000000000 --- a/dev/bin/pyflakes +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pyflakes.api import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/pygmentize b/dev/bin/pygmentize deleted file mode 100644 index 3faa08464..000000000 --- a/dev/bin/pygmentize +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pygments.cmdline import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/pylint b/dev/bin/pylint deleted file mode 100644 index 98303a78e..000000000 --- a/dev/bin/pylint +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pylint import run_pylint -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(run_pylint()) diff --git a/dev/bin/pylint-config b/dev/bin/pylint-config deleted file mode 100644 index 0369bab32..000000000 --- a/dev/bin/pylint-config +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pylint import _run_pylint_config -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(_run_pylint_config()) diff --git a/dev/bin/pyreverse b/dev/bin/pyreverse deleted file mode 100644 index c77874865..000000000 --- a/dev/bin/pyreverse +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pylint import run_pyreverse -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(run_pyreverse()) diff --git a/dev/bin/pyrsa-decrypt b/dev/bin/pyrsa-decrypt deleted file mode 100644 index 01d0112f4..000000000 --- a/dev/bin/pyrsa-decrypt +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from rsa.cli import decrypt -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(decrypt()) diff --git a/dev/bin/pyrsa-encrypt b/dev/bin/pyrsa-encrypt deleted file mode 100644 index 5f7f7889a..000000000 --- a/dev/bin/pyrsa-encrypt +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from rsa.cli import encrypt -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(encrypt()) diff --git a/dev/bin/pyrsa-keygen b/dev/bin/pyrsa-keygen deleted file mode 100644 index 120adacab..000000000 --- a/dev/bin/pyrsa-keygen +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from rsa.cli import keygen -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(keygen()) diff --git a/dev/bin/pyrsa-priv2pub b/dev/bin/pyrsa-priv2pub deleted file mode 100644 index ee9375c36..000000000 --- a/dev/bin/pyrsa-priv2pub +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from rsa.util import private_to_public -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(private_to_public()) diff --git a/dev/bin/pyrsa-sign b/dev/bin/pyrsa-sign deleted file mode 100644 index 5de853738..000000000 --- a/dev/bin/pyrsa-sign +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from rsa.cli import sign -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(sign()) diff --git a/dev/bin/pyrsa-verify b/dev/bin/pyrsa-verify deleted file mode 100644 index 1dc777aad..000000000 --- a/dev/bin/pyrsa-verify +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from rsa.cli import verify -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(verify()) diff --git a/dev/bin/pytest b/dev/bin/pytest deleted file mode 100644 index decc5c9dd..000000000 --- a/dev/bin/pytest +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pytest import console_main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(console_main()) diff --git a/dev/bin/python b/dev/bin/python deleted file mode 120000 index b8a0adbbb..000000000 --- a/dev/bin/python +++ /dev/null @@ -1 +0,0 @@ -python3 \ No newline at end of file diff --git a/dev/bin/python3 b/dev/bin/python3 deleted file mode 120000 index ae65fdaa1..000000000 --- a/dev/bin/python3 +++ /dev/null @@ -1 +0,0 @@ -/usr/bin/python3 \ No newline at end of file diff --git a/dev/bin/python3.12 b/dev/bin/python3.12 deleted file mode 120000 index b8a0adbbb..000000000 --- a/dev/bin/python3.12 +++ /dev/null @@ -1 +0,0 @@ -python3 \ No newline at end of file diff --git a/dev/bin/qr b/dev/bin/qr deleted file mode 100644 index 9a53dc124..000000000 --- a/dev/bin/qr +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from qrcode.console_scripts import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/symilar b/dev/bin/symilar deleted file mode 100644 index b44444f72..000000000 --- a/dev/bin/symilar +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pylint import run_symilar -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(run_symilar()) diff --git a/dev/bin/typer b/dev/bin/typer deleted file mode 100644 index 43935bf8e..000000000 --- a/dev/bin/typer +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from typer.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/undill b/dev/bin/undill deleted file mode 100644 index 51f5c0800..000000000 --- a/dev/bin/undill +++ /dev/null @@ -1,22 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) -# Copyright (c) 2008-2016 California Institute of Technology. -# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation. -# License: 3-clause BSD. The full license text is available at: -# - https://github.com/uqfoundation/dill/blob/master/LICENSE -""" -unpickle the contents of a pickled object file - -Examples:: - - $ undill hello.pkl - ['hello', 'world'] -""" - -if __name__ == '__main__': - import sys - import dill - for file in sys.argv[1:]: - print (dill.load(open(file,'rb'))) - diff --git a/dev/bin/uvicorn b/dev/bin/uvicorn deleted file mode 100644 index 7188e0817..000000000 --- a/dev/bin/uvicorn +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from uvicorn.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/dev/bin/virtualenv b/dev/bin/virtualenv deleted file mode 100644 index 6bccffbe3..000000000 --- a/dev/bin/virtualenv +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from virtualenv.__main__ import run_with_catch -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(run_with_catch()) diff --git a/dev/bin/watchfiles b/dev/bin/watchfiles deleted file mode 100644 index f01577afa..000000000 --- a/dev/bin/watchfiles +++ /dev/null @@ -1,8 +0,0 @@ -#!/mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from watchfiles.cli import cli -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli()) diff --git a/dev/include/site/python3.12/greenlet/greenlet.h b/dev/include/site/python3.12/greenlet/greenlet.h deleted file mode 100644 index d02a16e43..000000000 --- a/dev/include/site/python3.12/greenlet/greenlet.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */ - -/* Greenlet object interface */ - -#ifndef Py_GREENLETOBJECT_H -#define Py_GREENLETOBJECT_H - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* This is deprecated and undocumented. It does not change. */ -#define GREENLET_VERSION "1.0.0" - -#ifndef GREENLET_MODULE -#define implementation_ptr_t void* -#endif - -typedef struct _greenlet { - PyObject_HEAD - PyObject* weakreflist; - PyObject* dict; - implementation_ptr_t pimpl; -} PyGreenlet; - -#define PyGreenlet_Check(op) (op && PyObject_TypeCheck(op, &PyGreenlet_Type)) - - -/* C API functions */ - -/* Total number of symbols that are exported */ -#define PyGreenlet_API_pointers 12 - -#define PyGreenlet_Type_NUM 0 -#define PyExc_GreenletError_NUM 1 -#define PyExc_GreenletExit_NUM 2 - -#define PyGreenlet_New_NUM 3 -#define PyGreenlet_GetCurrent_NUM 4 -#define PyGreenlet_Throw_NUM 5 -#define PyGreenlet_Switch_NUM 6 -#define PyGreenlet_SetParent_NUM 7 - -#define PyGreenlet_MAIN_NUM 8 -#define PyGreenlet_STARTED_NUM 9 -#define PyGreenlet_ACTIVE_NUM 10 -#define PyGreenlet_GET_PARENT_NUM 11 - -#ifndef GREENLET_MODULE -/* This section is used by modules that uses the greenlet C API */ -static void** _PyGreenlet_API = NULL; - -# define PyGreenlet_Type \ - (*(PyTypeObject*)_PyGreenlet_API[PyGreenlet_Type_NUM]) - -# define PyExc_GreenletError \ - ((PyObject*)_PyGreenlet_API[PyExc_GreenletError_NUM]) - -# define PyExc_GreenletExit \ - ((PyObject*)_PyGreenlet_API[PyExc_GreenletExit_NUM]) - -/* - * PyGreenlet_New(PyObject *args) - * - * greenlet.greenlet(run, parent=None) - */ -# define PyGreenlet_New \ - (*(PyGreenlet * (*)(PyObject * run, PyGreenlet * parent)) \ - _PyGreenlet_API[PyGreenlet_New_NUM]) - -/* - * PyGreenlet_GetCurrent(void) - * - * greenlet.getcurrent() - */ -# define PyGreenlet_GetCurrent \ - (*(PyGreenlet * (*)(void)) _PyGreenlet_API[PyGreenlet_GetCurrent_NUM]) - -/* - * PyGreenlet_Throw( - * PyGreenlet *greenlet, - * PyObject *typ, - * PyObject *val, - * PyObject *tb) - * - * g.throw(...) - */ -# define PyGreenlet_Throw \ - (*(PyObject * (*)(PyGreenlet * self, \ - PyObject * typ, \ - PyObject * val, \ - PyObject * tb)) \ - _PyGreenlet_API[PyGreenlet_Throw_NUM]) - -/* - * PyGreenlet_Switch(PyGreenlet *greenlet, PyObject *args) - * - * g.switch(*args, **kwargs) - */ -# define PyGreenlet_Switch \ - (*(PyObject * \ - (*)(PyGreenlet * greenlet, PyObject * args, PyObject * kwargs)) \ - _PyGreenlet_API[PyGreenlet_Switch_NUM]) - -/* - * PyGreenlet_SetParent(PyObject *greenlet, PyObject *new_parent) - * - * g.parent = new_parent - */ -# define PyGreenlet_SetParent \ - (*(int (*)(PyGreenlet * greenlet, PyGreenlet * nparent)) \ - _PyGreenlet_API[PyGreenlet_SetParent_NUM]) - -/* - * PyGreenlet_GetParent(PyObject* greenlet) - * - * return greenlet.parent; - * - * This could return NULL even if there is no exception active. - * If it does not return NULL, you are responsible for decrementing the - * reference count. - */ -# define PyGreenlet_GetParent \ - (*(PyGreenlet* (*)(PyGreenlet*)) \ - _PyGreenlet_API[PyGreenlet_GET_PARENT_NUM]) - -/* - * deprecated, undocumented alias. - */ -# define PyGreenlet_GET_PARENT PyGreenlet_GetParent - -# define PyGreenlet_MAIN \ - (*(int (*)(PyGreenlet*)) \ - _PyGreenlet_API[PyGreenlet_MAIN_NUM]) - -# define PyGreenlet_STARTED \ - (*(int (*)(PyGreenlet*)) \ - _PyGreenlet_API[PyGreenlet_STARTED_NUM]) - -# define PyGreenlet_ACTIVE \ - (*(int (*)(PyGreenlet*)) \ - _PyGreenlet_API[PyGreenlet_ACTIVE_NUM]) - - - - -/* Macro that imports greenlet and initializes C API */ -/* NOTE: This has actually moved to ``greenlet._greenlet._C_API``, but we - keep the older definition to be sure older code that might have a copy of - the header still works. */ -# define PyGreenlet_Import() \ - { \ - _PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \ - } - -#endif /* GREENLET_MODULE */ - -#ifdef __cplusplus -} -#endif -#endif /* !Py_GREENLETOBJECT_H */ diff --git a/dev/lib64 b/dev/lib64 deleted file mode 120000 index 7951405f8..000000000 --- a/dev/lib64 +++ /dev/null @@ -1 +0,0 @@ -lib \ No newline at end of file diff --git a/dev/pyvenv.cfg b/dev/pyvenv.cfg deleted file mode 100644 index 2faed4701..000000000 --- a/dev/pyvenv.cfg +++ /dev/null @@ -1,5 +0,0 @@ -home = /usr/bin -include-system-site-packages = false -version = 3.12.3 -executable = /usr/bin/python3.12 -command = /usr/bin/python3 -m venv /mnt/c/Users/SNN/hng_boilerplate_python_fastapi_web/dev From c7776fc5231619697e57218055f59992b6840393 Mon Sep 17 00:00:00 2001 From: Henrietta Onoge Date: Sun, 2 Mar 2025 07:52:48 -0800 Subject: [PATCH 09/10] reverted alembic ini file --- .gitignore | 1 - alembic.ini | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1117795e9..7c3c0c7a2 100644 --- a/.gitignore +++ b/.gitignore @@ -133,7 +133,6 @@ celerybeat.pid .blog_env/ env/ -venv/ venv* *venv/ ENV/ diff --git a/alembic.ini b/alembic.ini index 56d1d2f0d..484de57fd 100644 --- a/alembic.ini +++ b/alembic.ini @@ -60,8 +60,7 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne # are written from script.py.mako # output_encoding = utf-8 -sqlalchemy.url = - +sqlalchemy.url = [post_write_hooks] From 61b677275237d06ac3bbb330a57fcfa604534ccb Mon Sep 17 00:00:00 2001 From: Henrietta Onoge Date: Sun, 2 Mar 2025 08:42:52 -0800 Subject: [PATCH 10/10] Moved line 48-50 outside the loop --- api/v1/models/activity_logs.py | 4 ++-- api/v1/services/testimonial.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/v1/models/activity_logs.py b/api/v1/models/activity_logs.py index 94d13818e..152cf89ab 100644 --- a/api/v1/models/activity_logs.py +++ b/api/v1/models/activity_logs.py @@ -7,8 +7,8 @@ class ActivityLog(BaseTableModel): __tablename__ = "activity_logs" - user_id = Column(String, ForeignKey("users.id"), nullable=False) + user_id = Column(String, ForeignKey("users.id", ondelete="CASCADE"), nullable=False) action = Column(String, nullable=False) timestamp = Column(DateTime(timezone=True), server_default=func.now()) - user = relationship("User", back_populates="activity_logs") + user = relationship("User", back_populates="activity_logs") \ No newline at end of file diff --git a/api/v1/services/testimonial.py b/api/v1/services/testimonial.py index 1a3d83e59..77d2cdf33 100644 --- a/api/v1/services/testimonial.py +++ b/api/v1/services/testimonial.py @@ -40,14 +40,14 @@ def update(self, db: Session, id: str, schema: UpdateTestimonial): """Updates a testimonial""" testimonial = self.fetch(db, id) if not testimonial: - return None # Or raise an HTTPException(status_code=404, detail="Testimonial not found") - # Update the fields + return None + for key, value in schema.dict(exclude_unset=True).items(): setattr(testimonial, key, value) - db.commit() - db.refresh(testimonial) - return testimonial + db.commit() + db.refresh(testimonial) + return testimonial def delete(self, db: Session, id: str):