-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git - Should Pipfile.lock be committed to version control? #598
Comments
i recommend it. |
Especially for applications. For libraries, less so. |
Thanks a lot @kennethreitz |
Should this recommendation be documented? Perhaps in a section similar to Composer's. |
Are their negative consequences to using a Pipfile.lock across OS types? In other words, if I generate my Pipfile.lock on MacOS, then deploy to Linux will Pipenv "do bad things"? |
@dougireton This depends on your dependencies. Using a lockfile from a different OS is fine if all your packages are modern and well-behaved (either platform-agnostic or have good cross-platform support). Otherwise Pipenv can do things wrong, like installing dependencies that don’t work, or not installing all needed dependencies. |
Generally, yes you should commit it to version control. |
How come pipenv's own |
because we are special snowflakes. |
I'm happy to take this advice as correct but I would like to understand why it is given. the docs say:
but I couldn't find any more reasoning in the docs, can you point me to it? Pipfile.lock is auto-generated and contents will differ depending on platform. If I'm developing on macOS and deploying to Debian ...already it sounds to me like I don't want the lock file in version control. Then the comment above says:
Again it sounds like I would not want the lock file in version control. Here is someone asking similar question #954 Reading through the responses on that issue I have a clearer idea of why I would want it. I think the docs need more elaboration. The related question is how explicitly should versions be specified in the Pipfile? If I do But if the other dev is on a different platform the lock file contents will change(?) but it's not necessarily due to different package versions and we wouldn't want to commit it. Hmm. And I would only add version specifier to Also I noticed in the example Dockerfile you use (loving pipenv so far though!) |
I just found some more opinion from the pipenv tool itself:
|
This thread is quite old, but since it emerges again I guess it is best to make a definite, up-to-date statement. As of March 2018, the answer to this question is yes, you should always commit the lock file. Always. |
@uranusjr could you please explain why? what has changed in March 2018 that changed the answer from "generally yes" to "always yes"? What about the issue you explain earlier, is it fixed?
|
Nothing is different. You should commit it to version control. If there are os-specific markers they should be included automatically. Because |
For application using pipenv, yes you track the lock files. My librairies however I write using pipenv (and use PBR to reflect to setup.py and an automatic generation of requirements.txt so PBR is happy once the package is deployed), I do not track the lock file. Pretty simple |
…m/questions/46330327/please-explain-the-usage-of-pipfile-and-pipfile-lock) suggests the Pipenv should be versioned as well. This is to help others build the tool easily. I've decided to start tracking the Pipenv as such, however as of this commit, the pipenv contains far from all dependencies. I will be slowly working those into the pipenv.
…a couple of things from requirements.txt and pipfile to make it compatible with linux
…Python projects to the .gitignore file. # Aider chat conversation: USER: fill the .gitignore with files that sholud be ignored for Python projects ASSISTANT: Sure, we can add common files and directories that should be ignored for Python projects to the `.gitignore` file. These include compiled Python files, log files, local configuration, virtual environments, and other files that are not needed in the repository. Here is the *SEARCH/REPLACE block* for the `.gitignore` file: <source>python .gitignore <<<<<<< SEARCH .aider* ======= # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # aide .aider* >>>>>>> REPLACE </source> This `.gitignore` file now includes common files and directories that should be ignored for Python projects.
# local env .vscode output.csv # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/
# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/
# Created by https://www.toptal.com/developers/gitignore/api/windows,linux,macos,python,virtualenv,visualstudiocode,pycharm # Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,macos,python,virtualenv,visualstudiocode,pycharm ### Linux ### *~ # temporary files which can be created if a process still has a handle open of a deleted file .fuse_hidden* # KDE directory preferences .directory # Linux trash folder which might appear on any partition or disk .Trash-* # .nfs files are created when an open file is removed but is still being accessed .nfs* ### macOS ### # General .DS_Store .AppleDouble .LSOverride # Icon must end with two \r Icon # Thumbnails ._* # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd .Spotlight-V100 .TemporaryItems .Trashes .VolumeIcon.icns .com.apple.timemachine.donotpresent # Directories potentially created on remote AFP share .AppleDB .AppleDesktop Network Trash Folder Temporary Items .apdisk ### PyCharm ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff .idea/**/workspace.xml .idea/**/tasks.xml .idea/**/usage.statistics.xml .idea/**/dictionaries .idea/**/shelf # Generated files .idea/**/contentModel.xml # Sensitive or high-churn files .idea/**/dataSources/ .idea/**/dataSources.ids .idea/**/dataSources.local.xml .idea/**/sqlDataSources.xml .idea/**/dynamic.xml .idea/**/uiDesigner.xml .idea/**/dbnavigator.xml # Gradle .idea/**/gradle.xml .idea/**/libraries # Gradle and Maven with auto-import # When using Gradle or Maven with auto-import, you should exclude module files, # since they will be recreated, and may cause churn. Uncomment if using # auto-import. # .idea/artifacts # .idea/compiler.xml # .idea/jarRepositories.xml # .idea/modules.xml # .idea/*.iml # .idea/modules # *.iml # *.ipr # CMake cmake-build-*/ # Mongo Explorer plugin .idea/**/mongoSettings.xml # File-based project format *.iws # IntelliJ out/ # mpeltonen/sbt-idea plugin .idea_modules/ # JIRA plugin atlassian-ide-plugin.xml # Cursive Clojure plugin .idea/replstate.xml # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties # Editor-based Rest Client .idea/httpRequests # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser ### PyCharm Patch ### # Comment Reason: toptal/gitignore.io#186 (comment) # *.iml # modules.xml # .idea/misc.xml # *.ipr # Sonarlint plugin # https://plugins.jetbrains.com/plugin/7973-sonarlint .idea/**/sonarlint/ # SonarQube Plugin # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin .idea/**/sonarIssues.xml # Markdown Navigator plugin # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced .idea/**/markdown-navigator.xml .idea/**/markdown-navigator-enh.xml .idea/**/markdown-navigator/ # Cache file creation bug # See https://youtrack.jetbrains.com/issue/JBR-2257 .idea/$CACHE_FILE$ # CodeStream plugin # https://plugins.jetbrains.com/plugin/12206-codestream .idea/codestream.xml ### Python ### # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ pytestdebug.log # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ doc/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ ### VirtualEnv ### # Virtualenv # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ [Bb]in [Ii]nclude [Ll]ib [Ll]ib64 [Ll]ocal [Ss]cripts pyvenv.cfg pip-selfcheck.json ### VisualStudioCode ### .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json *.code-workspace ### VisualStudioCode Patch ### # Ignore all local history of files .history ### Windows ### # Windows thumbnail cache files Thumbs.db Thumbs.db:encryptable ehthumbs.db ehthumbs_vista.db # Dump file *.stackdump # Folder config file [Dd]esktop.ini # Recycle Bin used on file shares $RECYCLE.BIN/ # Windows Installer files *.cab *.msi *.msix *.msm *.msp # Windows shortcuts *.lnk # End of https://www.toptal.com/developers/gitignore/api/windows,linux,macos,python,virtualenv,visualstudiocode,pycharm
… should not be included in a Git repository. # Aider chat conversation: ASSISTANT: Sure, here is a standard Python `.gitignore` file: <source>python .gitignore <<<<<<< SEARCH ======= # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ >>>>>>> REPLACE </source> This `.gitignore` file will ignore common Python files that should not be included in a Git repository. It includes rules for ignoring compiled Python files, distribution files, unit test reports, and various environment and configuration files.
# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/
diff --git a/.gitignore b/.gitignore index 68bc17f..51e9d59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,160 +1,160 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/Ex1/1-unique_rand.py b/Ex1/1-unique_rand.py index f69c014..d501396 100644 --- a/Ex1/1-unique_rand.py +++ b/Ex1/1-unique_rand.py @@ -1,15 +1,15 @@ -import random - - -def unique_rand(n): - rands = list(range(n)) - random.shuffle(rands) - return rands - - -if __name__ == "__main__": - # start = int(input("Enter the start for the range of random numbers: ")) - # end = int(input("Enter the end for the range of random numbers(inclusive): ")) - n = int(input("Enter the no. random nums you want to generate: ")) - nums = unique_rand(n) - print(f"The numbers: {nums}") +import random + + +def unique_rand(n): + rands = list(range(n)) + random.shuffle(rands) + return rands + + +if __name__ == "__main__": + # start = int(input("Enter the start for the range of random numbers: ")) + # end = int(input("Enter the end for the range of random numbers(inclusive): ")) + n = int(input("Enter the no. random nums you want to generate: ")) + nums = unique_rand(n) + print(f"The numbers: {nums}") diff --git a/Ex1/2-sort.py b/Ex1/2-sort.py index bd89460..986a33f 100644 --- a/Ex1/2-sort.py +++ b/Ex1/2-sort.py @@ -1,109 +1,109 @@ -import matplotlib.pyplot as plt -import time -import random - - -def unique_rand(n): - rands = list(range(n)) - random.shuffle(rands) - return rands - -def bucket_sort(elems, power, radix): - digit_buckets = [[] for i in range(radix)] - ended = True - - for elem in elems: - digit = (elem // power) % radix - if digit != 0: - ended = False - digit_buckets[digit].append(elem) - - k = 0 - for bucket in digit_buckets: - for elem in bucket: - elems[k] = elem - k+=1 - return ended - - -def count_sort(elems, radix, radix_to_n): - digit_sorted_elems = [0 for i in range(len(elems))] - digit_counts = [0 for i in range(radix)] - is_radix_too_big = True - - for elem in elems: - digit = int(elem / radix_to_n) % radix - if digit != 0: - is_radix_too_big = False - digit_counts[digit] += 1 - - cum_sum = 0 - for i in range(len(digit_counts)): - count = digit_counts[i] - digit_counts[i] = cum_sum - cum_sum += count - - for elem in elems: - digit = int(elem / radix_to_n) % radix - digit_sorted_elems[digit_counts[digit]] = elem - digit_counts[digit] += 1 - - for i in range(len(elems)): - elems[i] = digit_sorted_elems[i] - - return is_radix_too_big - - -def radix_sort(elems, radix): - power = 1 - while not bucket_sort(elems, power, radix): - power *= radix - - -def increment_sort(elems, increment): - for i in range(increment, len(elems)): - for j in range(i, increment - 1, -increment): - if elems[j] < elems[j - increment]: - elems[j], elems[j - increment] = elems[j - increment], elems[j] - else: - break - - -def insertion_sort(elems): - increment_sort(elems, 1) - - -def shell_sort(elems): - increment = int(len(elems) / 2) - while increment > 0: - increment_sort(elems, increment) - increment = int(increment / 2) - - -if __name__ == "__main__": - ns = [10, 1000, 2000, 5000, 100000] - timeRadix, timeShell, timeInsertion = [], [], [] - for i in ns: - #print(f"Now considering arrays of size {i}: ") - nums = unique_rand(i) - nums1, nums2, nums3 = list(nums), list(nums), list(nums) - start = time.perf_counter() - radix_sort(nums1, 256) - timeRadix.append(time.perf_counter() - start) - start = time.perf_counter() - shell_sort(nums2) - timeShell.append(time.perf_counter() - start) - start = time.perf_counter() - insertion_sort(nums3) - timeInsertion.append(time.perf_counter() - start) - #print(f"{timeInsertion[-1]=}, {timeRadix[-1]=}, {timeShell[-1]=}") - - fig1 = plt.plot(ns, timeRadix, label="radix") - fig2 = plt.plot(ns, timeShell, label="shell") - fig3 = plt.plot(ns, timeInsertion, label="insertion") - plt.legend() - plt.xscale("log") - plt.yscale("log") - plt.savefig("sorts_compared.png") - # fig2.savefig("2.png") - # fig3.savefig("3.png") +import matplotlib.pyplot as plt +import time +import random + + +def unique_rand(n): + rands = list(range(n)) + random.shuffle(rands) + return rands + +def bucket_sort(elems, power, radix): + digit_buckets = [[] for i in range(radix)] + ended = True + + for elem in elems: + digit = (elem // power) % radix + if digit != 0: + ended = False + digit_buckets[digit].append(elem) + + k = 0 + for bucket in digit_buckets: + for elem in bucket: + elems[k] = elem + k+=1 + return ended + + +def count_sort(elems, radix, radix_to_n): + digit_sorted_elems = [0 for i in range(len(elems))] + digit_counts = [0 for i in range(radix)] + is_radix_too_big = True + + for elem in elems: + digit = int(elem / radix_to_n) % radix + if digit != 0: + is_radix_too_big = False + digit_counts[digit] += 1 + + cum_sum = 0 + for i in range(len(digit_counts)): + count = digit_counts[i] + digit_counts[i] = cum_sum + cum_sum += count + + for elem in elems: + digit = int(elem / radix_to_n) % radix + digit_sorted_elems[digit_counts[digit]] = elem + digit_counts[digit] += 1 + + for i in range(len(elems)): + elems[i] = digit_sorted_elems[i] + + return is_radix_too_big + + +def radix_sort(elems, radix): + power = 1 + while not bucket_sort(elems, power, radix): + power *= radix + + +def increment_sort(elems, increment): + for i in range(increment, len(elems)): + for j in range(i, increment - 1, -increment): + if elems[j] < elems[j - increment]: + elems[j], elems[j - increment] = elems[j - increment], elems[j] + else: + break + + +def insertion_sort(elems): + increment_sort(elems, 1) + + +def shell_sort(elems): + increment = int(len(elems) / 2) + while increment > 0: + increment_sort(elems, increment) + increment = int(increment / 2) + + +if __name__ == "__main__": + ns = [10, 1000, 2000, 5000, 100000] + timeRadix, timeShell, timeInsertion = [], [], [] + for i in ns: + #print(f"Now considering arrays of size {i}: ") + nums = unique_rand(i) + nums1, nums2, nums3 = list(nums), list(nums), list(nums) + start = time.perf_counter() + radix_sort(nums1, 256) + timeRadix.append(time.perf_counter() - start) + start = time.perf_counter() + shell_sort(nums2) + timeShell.append(time.perf_counter() - start) + start = time.perf_counter() + insertion_sort(nums3) + timeInsertion.append(time.perf_counter() - start) + #print(f"{timeInsertion[-1]=}, {timeRadix[-1]=}, {timeShell[-1]=}") + + fig1 = plt.plot(ns, timeRadix, label="radix") + fig2 = plt.plot(ns, timeShell, label="shell") + fig3 = plt.plot(ns, timeInsertion, label="insertion") + plt.legend() + plt.xscale("log") + plt.yscale("log") + plt.savefig("sorts_compared.png") + # fig2.savefig("2.png") + # fig3.savefig("3.png") diff --git a/Ex1/3-insertion_order.py b/Ex1/3-insertion_order.py index e58e29d..a5d3b6e 100644 --- a/Ex1/3-insertion_order.py +++ b/Ex1/3-insertion_order.py @@ -1,45 +1,45 @@ -import random -import time - -def increment_sort(elems, increment): - for i in range(increment, len(elems)): - #print(f"{i=}") - for j in range(i, increment - 1, -increment): - if elems[j] < elems[j - increment]: - elems[j], elems[j - increment] = elems[j - increment], elems[j] - else: - break - - -def insertion_sort(elems): - increment_sort(elems, 1) - -def unique_rand(n): - rands = list(range(n)) - random.shuffle(rands) - return rands - -unsorted_elems = unique_rand(100000) -ascending_elems = sorted(unsorted_elems) -descending_elems = sorted(unsorted_elems, reverse=True) - -ascending_start_ns = time.process_time_ns() -insertion_sort(ascending_elems) -ascending_end_ns = time.process_time_ns() -ascending_time = (ascending_end_ns - ascending_start_ns)/10**9 -print(f"{ascending_time=}") - -descending_start_ns = time.process_time_ns() -insertion_sort(descending_elems) -descending_end_ns = time.process_time_ns() -descending_time = (descending_end_ns - descending_start_ns)/10**9 -print(f"{descending_time=}") - -unsorted_start_ns = time.process_time_ns() -insertion_sort(unsorted_elems) -unsorted_end_ns = time.process_time_ns() -unsorted_time = (unsorted_end_ns - unsorted_start_ns)/10**9 -print(f"{unsorted_time=}") - -with open("results.txt", "a", encoding="utf-8") as f: +import random +import time + +def increment_sort(elems, increment): + for i in range(increment, len(elems)): + #print(f"{i=}") + for j in range(i, increment - 1, -increment): + if elems[j] < elems[j - increment]: + elems[j], elems[j - increment] = elems[j - increment], elems[j] + else: + break + + +def insertion_sort(elems): + increment_sort(elems, 1) + +def unique_rand(n): + rands = list(range(n)) + random.shuffle(rands) + return rands + +unsorted_elems = unique_rand(100000) +ascending_elems = sorted(unsorted_elems) +descending_elems = sorted(unsorted_elems, reverse=True) + +ascending_start_ns = time.process_time_ns() +insertion_sort(ascending_elems) +ascending_end_ns = time.process_time_ns() +ascending_time = (ascending_end_ns - ascending_start_ns)/10**9 +print(f"{ascending_time=}") + +descending_start_ns = time.process_time_ns() +insertion_sort(descending_elems) +descending_end_ns = time.process_time_ns() +descending_time = (descending_end_ns - descending_start_ns)/10**9 +print(f"{descending_time=}") + +unsorted_start_ns = time.process_time_ns() +insertion_sort(unsorted_elems) +unsorted_end_ns = time.process_time_ns() +unsorted_time = (unsorted_end_ns - unsorted_start_ns)/10**9 +print(f"{unsorted_time=}") + +with open("results.txt", "a", encoding="utf-8") as f: f.write(f"{ascending_time=}, {descending_time=}, {unsorted_time=}") \ No newline at end of file diff --git a/Ex1/4-search.py b/Ex1/4-search.py index e48a365..9a71c15 100644 --- a/Ex1/4-search.py +++ b/Ex1/4-search.py @@ -1,41 +1,41 @@ -import random -import time - -def unique_rand(n): - rands = list(range(n)) - random.shuffle(rands) - return rands - -def rec_binary_search(elems, elem, start, end): - if end < start: - return -1 - mid_ind = (start + end)//2 - if elem == elems[mid_ind]: - return mid_ind - if elem < elems[mid_ind]: - return rec_binary_search(elems, elem, start, mid_ind-1) - return rec_binary_search(elems, elem, mid_ind + 1, end) - -def iter_binary_search(elems, elem): - start, end = 0, len(elems) - 1 - while end >= start: - mid_ind = (start + end)//2 - if elem == elems[mid_ind]: - return mid_ind - if elem < elems[mid_ind]: - end = mid_ind - 1 - else: - start = mid_ind + 1 - return -1 - -nums = unique_rand(100000) -iter_start = time.perf_counter_ns() -iter_binary_search(nums, -1) -iter_end = time.perf_counter_ns() -iter_time = (iter_end - iter_start)/1000 -print(f"{iter_time=}us") -rec_start = time.perf_counter_ns() -rec_binary_search(nums, -1, 0, len(nums)-1) -rec_end = time.perf_counter_ns() -rec_time = (rec_end - rec_start)/1000 +import random +import time + +def unique_rand(n): + rands = list(range(n)) + random.shuffle(rands) + return rands + +def rec_binary_search(elems, elem, start, end): + if end < start: + return -1 + mid_ind = (start + end)//2 + if elem == elems[mid_ind]: + return mid_ind + if elem < elems[mid_ind]: + return rec_binary_search(elems, elem, start, mid_ind-1) + return rec_binary_search(elems, elem, mid_ind + 1, end) + +def iter_binary_search(elems, elem): + start, end = 0, len(elems) - 1 + while end >= start: + mid_ind = (start + end)//2 + if elem == elems[mid_ind]: + return mid_ind + if elem < elems[mid_ind]: + end = mid_ind - 1 + else: + start = mid_ind + 1 + return -1 + +nums = unique_rand(100000) +iter_start = time.perf_counter_ns() +iter_binary_search(nums, -1) +iter_end = time.perf_counter_ns() +iter_time = (iter_end - iter_start)/1000 +print(f"{iter_time=}us") +rec_start = time.perf_counter_ns() +rec_binary_search(nums, -1, 0, len(nums)-1) +rec_end = time.perf_counter_ns() +rec_time = (rec_end - rec_start)/1000 print(f"{rec_time=}us") \ No newline at end of file diff --git a/Ex1/unique_rand.py b/Ex1/unique_rand.py index 6a11093..c9b5c92 100644 --- a/Ex1/unique_rand.py +++ b/Ex1/unique_rand.py @@ -1,19 +1,19 @@ -import random; -def unique_rand(start, end, n): - nums = {} - while len(nums) < n: - nums[random.randint(start, end)]=None - return list(nums.keys()) - -def unique_rand_2(n): - lst = list(range(n)) - random.shuffle(lst) - return lst - -if __name__ == "__main__": - start = int(input("Enter the start for the range of random numbers: ")) - end = int(input("Enter the end for the range of random numbers(inclusive): ")) - n = int(input("Enter the no. random nums you want to generate: ")) - nums = unique_rand(start, end, n) - print(f"The numbers: {nums}") - +import random; +def unique_rand(start, end, n): + nums = {} + while len(nums) < n: + nums[random.randint(start, end)]=None + return list(nums.keys()) + +def unique_rand_2(n): + lst = list(range(n)) + random.shuffle(lst) + return lst + +if __name__ == "__main__": + start = int(input("Enter the start for the range of random numbers: ")) + end = int(input("Enter the end for the range of random numbers(inclusive): ")) + n = int(input("Enter the no. random nums you want to generate: ")) + nums = unique_rand(start, end, n) + print(f"The numbers: {nums}") + diff --git a/Ex2/1-unique_elems.py b/Ex2/1-unique_elems.py index 1ac60b7..80379a0 100644 --- a/Ex2/1-unique_elems.py +++ b/Ex2/1-unique_elems.py @@ -1,19 +1,19 @@ -def unique_elems(arr): - unique = [] - for i in range(len(arr)): - if not containsMult(arr, arr[i]): - unique.append(arr[i]) - return unique - -def containsMult(arr, elem): - count = 0 - for i in range(len(arr)): - if arr[i] == elem: - count += 1 - return count > 1 - -if __name__ == "__main__": - text = input("Enter some space separated numbers: ") - nums = [int(num) for num in text.split()] - print(f"Unique nums: {unique_elems(nums)}") - +def unique_elems(arr): + unique = [] + for i in range(len(arr)): + if not containsMult(arr, arr[i]): + unique.append(arr[i]) + return unique + +def containsMult(arr, elem): + count = 0 + for i in range(len(arr)): + if arr[i] == elem: + count += 1 + return count > 1 + +if __name__ == "__main__": + text = input("Enter some space separated numbers: ") + nums = [int(num) for num in text.split()] + print(f"Unique nums: {unique_elems(nums)}") + diff --git a/Ex2/2-sum.py b/Ex2/2-sum.py index afe0c8e..97bf205 100644 --- a/Ex2/2-sum.py +++ b/Ex2/2-sum.py @@ -1,6 +1,6 @@ -def calc_sum(n): - return n * (n+1) * (n+2) / 6 - -if __name__ == "__main__": - n = int(input("Enter n: ")) +def calc_sum(n): + return n * (n+1) * (n+2) / 6 + +if __name__ == "__main__": + n = int(input("Enter n: ")) print(f"Sum: {calc_sum(n)}") \ No newline at end of file diff --git a/Ex2/3-most_freq.py b/Ex2/3-most_freq.py index 248e35f..f4c0ebc 100644 --- a/Ex2/3-most_freq.py +++ b/Ex2/3-most_freq.py @@ -1,21 +1,21 @@ -def most_freq(text): - max_count = 0 - char_counts = {} - for i in range(len(text)): - letter = text[i] - letter_count = 1 - if letter in char_counts: - letter_count = char_counts[letter] + 1 - if letter_count > max_count: - max_count = letter_count - char_counts[letter] = letter_count - most_freq_chars = [] - for key in char_counts: - if char_counts[key] == max_count: - most_freq_chars.append(key) - - return most_freq_chars - -if __name__ == "__main__": - text = input("Enter some text: ") - print(f"Most frequent chars: {most_freq(text)}") +def most_freq(text): + max_count = 0 + char_counts = {} + for i in range(len(text)): + letter = text[i] + letter_count = 1 + if letter in char_counts: + letter_count = char_counts[letter] + 1 + if letter_count > max_count: + max_count = letter_count + char_counts[letter] = letter_count + most_freq_chars = [] + for key in char_counts: + if char_counts[key] == max_count: + most_freq_chars.append(key) + + return most_freq_chars + +if __name__ == "__main__": + text = input("Enter some text: ") + print(f"Most frequent chars: {most_freq(text)}") diff --git a/Ex3/1-inversions.py b/Ex3/1-inversions.py index 85cdb8a..1988737 100644 --- a/Ex3/1-inversions.py +++ b/Ex3/1-inversions.py @@ -1,42 +1,42 @@ -def merge_count(nums, start, end): - if start == end: - return 0 - count = 0 - mid = (start + end) // 2 - count += merge_count(nums, start, mid) - count += merge_count(nums, mid + 1, end) - count += merge(nums, start, end) - - return count - - -def merge(nums, start, end): - tot_len = end - start + 1 - aux = [0] * (tot_len) - count = 0 - mid = (start + end) // 2 - i, j = 0, 0 - while i + j < tot_len: - if mid + 1 + j > end or ( - start + i < mid + 1 and nums[start + i] <= nums[mid + 1 + j] - ): - aux[i + j] = nums[start + i] - i += 1 - else: - aux[i + j] = nums[mid + 1 + j] - count += mid + 1 - start - i - j += 1 - for i in range(start, end + 1): - nums[i] = aux[i - start] - - return count - - -def count_inversions(nums): - return merge_count(nums, 0, len(nums) - 1) - - -if __name__ == "__main__": - text = input("Enter some space separated numbers: ") - nums = [int(num) for num in text.split()] - print(f"{count_inversions(nums)=}") +def merge_count(nums, start, end): + if start == end: + return 0 + count = 0 + mid = (start + end) // 2 + count += merge_count(nums, start, mid) + count += merge_count(nums, mid + 1, end) + count += merge(nums, start, end) + + return count + + +def merge(nums, start, end): + tot_len = end - start + 1 + aux = [0] * (tot_len) + count = 0 + mid = (start + end) // 2 + i, j = 0, 0 + while i + j < tot_len: + if mid + 1 + j > end or ( + start + i < mid + 1 and nums[start + i] <= nums[mid + 1 + j] + ): + aux[i + j] = nums[start + i] + i += 1 + else: + aux[i + j] = nums[mid + 1 + j] + count += mid + 1 - start - i + j += 1 + for i in range(start, end + 1): + nums[i] = aux[i - start] + + return count + + +def count_inversions(nums): + return merge_count(nums, 0, len(nums) - 1) + + +if __name__ == "__main__": + text = input("Enter some space separated numbers: ") + nums = [int(num) for num in text.split()] + print(f"{count_inversions(nums)=}") diff --git a/Ex3/2-comp_count_sort.py b/Ex3/2-comp_count_sort.py index e7081c6..02d4614 100644 --- a/Ex3/2-comp_count_sort.py +++ b/Ex3/2-comp_count_sort.py @@ -1,18 +1,18 @@ -def comparison_count_sort(nums): - count = [0] * len(nums) - nums_sorted = [0] * len(nums) - for i in range(len(nums) - 1): - for j in range(i + 1, len(nums)): - if nums[i] > nums[j]: - count[i] += 1 - elif nums[i] <= nums[j]: - count[j] += 1 - for i in range(len(nums)): - nums_sorted[count[i]] = nums[i] - return nums_sorted - - -if __name__ == "__main__": - text = input("Enter some space separated numbers: ") - nums = [int(num) for num in text.split()] - print(f"{comparison_count_sort(nums)=}") +def comparison_count_sort(nums): + count = [0] * len(nums) + nums_sorted = [0] * len(nums) + for i in range(len(nums) - 1): + for j in range(i + 1, len(nums)): + if nums[i] > nums[j]: + count[i] += 1 + elif nums[i] <= nums[j]: + count[j] += 1 + for i in range(len(nums)): + nums_sorted[count[i]] = nums[i] + return nums_sorted + + +if __name__ == "__main__": + text = input("Enter some space separated numbers: ") + nums = [int(num) for num in text.split()] + print(f"{comparison_count_sort(nums)=}") diff --git a/Ex4/1-max.py b/Ex4/1-max.py index 11f7456..0cf18a6 100644 --- a/Ex4/1-max.py +++ b/Ex4/1-max.py @@ -1,15 +1,15 @@ -def my_max(arr, start, end): - if start == end: - return arr[start] - mid = (start + end) // 2 - max1 = my_max(arr, start, mid) - max2 = my_max(arr, mid + 1, end) - real_max = max1 if max1 > max2 else max2 - return real_max - - -if __name__ == "__main__": - text = input("Enter some space separated numbers: ") - nums = [int(num) for num in text.split()] - print(f"{my_max(nums, 0, len(nums)-1)=}") - +def my_max(arr, start, end): + if start == end: + return arr[start] + mid = (start + end) // 2 + max1 = my_max(arr, start, mid) + max2 = my_max(arr, mid + 1, end) + real_max = max1 if max1 > max2 else max2 + return real_max + + +if __name__ == "__main__": + text = input("Enter some space separated numbers: ") + nums = [int(num) for num in text.split()] + print(f"{my_max(nums, 0, len(nums)-1)=}") + diff --git a/Ex4/2-merge_inversion.py b/Ex4/2-merge_inversion.py index 85cdb8a..1988737 100644 --- a/Ex4/2-merge_inversion.py +++ b/Ex4/2-merge_inversion.py @@ -1,42 +1,42 @@ -def merge_count(nums, start, end): - if start == end: - return 0 - count = 0 - mid = (start + end) // 2 - count += merge_count(nums, start, mid) - count += merge_count(nums, mid + 1, end) - count += merge(nums, start, end) - - return count - - -def merge(nums, start, end): - tot_len = end - start + 1 - aux = [0] * (tot_len) - count = 0 - mid = (start + end) // 2 - i, j = 0, 0 - while i + j < tot_len: - if mid + 1 + j > end or ( - start + i < mid + 1 and nums[start + i] <= nums[mid + 1 + j] - ): - aux[i + j] = nums[start + i] - i += 1 - else: - aux[i + j] = nums[mid + 1 + j] - count += mid + 1 - start - i - j += 1 - for i in range(start, end + 1): - nums[i] = aux[i - start] - - return count - - -def count_inversions(nums): - return merge_count(nums, 0, len(nums) - 1) - - -if __name__ == "__main__": - text = input("Enter some space separated numbers: ") - nums = [int(num) for num in text.split()] - print(f"{count_inversions(nums)=}") +def merge_count(nums, start, end): + if start == end: + return 0 + count = 0 + mid = (start + end) // 2 + count += merge_count(nums, start, mid) + count += merge_count(nums, mid + 1, end) + count += merge(nums, start, end) + + return count + + +def merge(nums, start, end): + tot_len = end - start + 1 + aux = [0] * (tot_len) + count = 0 + mid = (start + end) // 2 + i, j = 0, 0 + while i + j < tot_len: + if mid + 1 + j > end or ( + start + i < mid + 1 and nums[start + i] <= nums[mid + 1 + j] + ): + aux[i + j] = nums[start + i] + i += 1 + else: + aux[i + j] = nums[mid + 1 + j] + count += mid + 1 - start - i + j += 1 + for i in range(start, end + 1): + nums[i] = aux[i - start] + + return count + + +def count_inversions(nums): + return merge_count(nums, 0, len(nums) - 1) + + +if __name__ == "__main__": + text = input("Enter some space separated numbers: ") + nums = [int(num) for num in text.split()] + print(f"{count_inversions(nums)=}") diff --git a/Ex4/3-max_subarray_sum.py b/Ex4/3-max_subarray_sum.py index c41a699..3c12b7f 100644 --- a/Ex4/3-max_subarray_sum.py +++ b/Ex4/3-max_subarray_sum.py @@ -1,32 +1,32 @@ -def max_subarray_sum(arr, start, end): - if start == end: - return arr[start] - - mid = (start + end) // 2 - max1 = max_subarray_sum(arr, start, mid) - max2 = max_subarray_sum(arr, mid + 1, end) - - max_left = 0 - cum_left = 0 - for i in range(mid, start - 1, -1): - cum_left += arr[i] - if cum_left > max_left: - max_left = cum_left - - max_right = 0 - cum_right = 0 - for i in range(mid + 1, end + 1): - cum_right += arr[i] - if cum_right > max_right: - max_right = cum_right - - max3 = max_left + max_right - - return max(max1, max2, max3) - - -if __name__ == "__main__": - text = input("Enter some space separated numbers: ") - nums = [int(num) for num in text.split()] - print(f"{max_subarray_sum(nums, 0, len(nums)-1)}") +def max_subarray_sum(arr, start, end): + if start == end: + return arr[start] + + mid = (start + end) // 2 + max1 = max_subarray_sum(arr, start, mid) + max2 = max_subarray_sum(arr, mid + 1, end) + + max_left = 0 + cum_left = 0 + for i in range(mid, start - 1, -1): + cum_left += arr[i] + if cum_left > max_left: + max_left = cum_left + + max_right = 0 + cum_right = 0 + for i in range(mid + 1, end + 1): + cum_right += arr[i] + if cum_right > max_right: + max_right = cum_right + + max3 = max_left + max_right + + return max(max1, max2, max3) + + +if __name__ == "__main__": + text = input("Enter some space separated numbers: ") + nums = [int(num) for num in text.split()] + print(f"{max_subarray_sum(nums, 0, len(nums)-1)}") \ No newline at end of file diff --git a/Ex4/4-max_sub_2.py b/Ex4/4-max_sub_2.py index 51aa511..d5eb271 100644 --- a/Ex4/4-max_sub_2.py +++ b/Ex4/4-max_sub_2.py @@ -1,25 +1,25 @@ -def max_subarray_sum(nums): - aux = [0] * len(nums) - prev = 0 - for i, num in enumerate(nums): - aux[i] = prev + num - prev = aux[i] - - print(f"{aux=}") - - cur_lowest = 0 - cur_max = 0 - - for num in aux: - cur_sum = num - cur_lowest - if cur_sum > cur_max: - cur_max = cur_sum - if num < cur_lowest: - cur_lowest = num - - return cur_max - - -if __name__ == "__main__": - nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4] - print(f"{max_subarray_sum(nums)}") +def max_subarray_sum(nums): + aux = [0] * len(nums) + prev = 0 + for i, num in enumerate(nums): + aux[i] = prev + num + prev = aux[i] + + print(f"{aux=}") + + cur_lowest = 0 + cur_max = 0 + + for num in aux: + cur_sum = num - cur_lowest + if cur_sum > cur_max: + cur_max = cur_sum + if num < cur_lowest: + cur_lowest = num + + return cur_max + + +if __name__ == "__main__": + nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4] + print(f"{max_subarray_sum(nums)}") diff --git a/Ex4/store.c b/Ex4/store.c new file mode 100644 index 0000000..55f0d4b --- /dev/null +++ b/Ex4/store.c @@ -0,0 +1,178 @@ +// void non_preemptive(PriorityFunc pf, Event *event, double timedelta, double quanta) { +// handle_event_arrived_and_done(event, pf(event->pcb)); + +// if(event->type == QuantaOver) { +// cur_pcb->burst_left -= timedelta; +// pqueue_add(pqueue, init_pentry(cur_pcb->priority, cur_pcb), false); +// cur_pcb = NULL; +// } + +// if(cur_pcb == NULL) { +// PEntry *entry = pqueue_extract_min(pqueue); +// if(entry != NULL) { +// cur_pcb = entry->pcb; +// if(cur_pcb->burst_left <= quanta) { +// event_queue_add(event_queue, init_event(event->time + cur_pcb->burst_left, cur_pcb, Done)); +// } else { +// event_queue_add(event_queue, init_event(event->time + quanta, cur_pcb, QuantaOver)); +// } +// } +// free(entry); +// } +// } + + + + + +// void sjfs_non_preemptive(Event *event, double timedelta) { + +// handle_event_arrived_and_done(event, 1/event->pcb->burst_left); + +// if(cur_pcb == NULL) { +// PEntry *entry = pqueue_extract_min(pqueue); +// if(entry != NULL) { +// cur_pcb = entry->pcb; +// event_queue_add(event_queue, init_event(event->time + cur_pcb->burst_left, cur_pcb, Done)); +// } +// free(entry); +// } +// } + +// void round_robin_priority_nonpreemptive(Event *event, double timedelta, double quanta) { + +// handle_event_arrived_and_done(event, event->pcb->priority); + +// // if(event->type == Arrived) { +// // pqueue_add(pqueue, init_pentry(event->pcb->priority, event->pcb), false); +// // } + +// // if(event->type == Done) { +// // free(cur_pcb); +// // cur_pcb = NULL; +// // } + +// if(event->type == QuantaOver) { +// cur_pcb->burst_left -= timedelta; +// pqueue_add(pqueue, init_pentry(cur_pcb->priority, cur_pcb), false); +// cur_pcb = NULL; +// } + +// if(cur_pcb == NULL) { +// PEntry *entry = pqueue_extract_min(pqueue); +// if(entry != NULL) { +// cur_pcb = entry->pcb; +// if(cur_pcb->burst_left <= quanta) { +// event_queue_add(event_queue, init_event(event->time + cur_pcb->burst_left, cur_pcb, Done)); +// } else { +// event_queue_add(event_queue, init_event(event->time + quanta, cur_pcb, QuantaOver)); +// } +// } +// free(entry); +// } +// } + +// void preemptive(PriorityFunc pf, Event *event, double timedelta) { +// handle_event_arrived_and_done(event, pf(event->pcb)); + +// if(cur_pcb != NULL) { +// event_queue_remove(event_queue, cur_pcb->pid); +// cur_pcb->burst_left -= timedelta; +// pqueue_add(pqueue, init_pentry(pf(cur_pcb), cur_pcb), true); +// } + +// cur_pcb = NULL; +// PEntry *entry = pqueue_extract_min(pqueue); +// if(entry != NULL) { +// cur_pcb = entry->pcb; +// event_queue_add(event_queue, init_event(event->time + cur_pcb->burst_left, cur_pcb, Done)); +// } +// free(entry); +// } + +// void sjfs_preemptive(Event *event, double timedelta) { +// // if(event->type == Arrived) { +// // pqueue_add(pqueue, init_pentry(1/event->pcb->burst_left, event->pcb), false); +// // } + +// // if(event->type == Done) { +// // free(cur_pcb); +// // cur_pcb = NULL; +// // } + +// handle_event_arrived_and_done(event, 1/event->pcb->burst_left); + +// if(cur_pcb != NULL) { +// event_queue_remove(event_queue, cur_pcb->pid); +// cur_pcb->burst_left -= timedelta; +// pqueue_add(pqueue, init_pentry(1/cur_pcb->burst_left, cur_pcb), true); +// } + +// cur_pcb = NULL; +// PEntry *entry = pqueue_extract_min(pqueue); +// if(entry != NULL) { +// cur_pcb = entry->pcb; +// event_queue_add(event_queue, init_event(event->time + cur_pcb->burst_left, cur_pcb, Done)); +// } +// free(entry); +// } + + +// void priority_preemptive(Event *event, double timedelta) { +// // if(event->type == Arrived) { +// // pqueue_add(pqueue, init_pentry(event->pcb->priority, event->pcb), false); +// // } + +// // if(event->type == Done) { +// // free(cur_pcb); +// // cur_pcb = NULL; +// // } + +// handle_event_arrived_and_done(event, event->pcb->priority); + +// if(cur_pcb != NULL) { +// event_queue_remove(event_queue, cur_pcb->pid); +// cur_pcb->burst_left -= timedelta; +// pqueue_add(pqueue, init_pentry(cur_pcb->priority, cur_pcb), true); +// } + +// cur_pcb = NULL; +// PEntry *entry = pqueue_extract_min(pqueue); +// if(entry != NULL) { +// cur_pcb = entry->pcb; +// event_queue_add(event_queue, init_event(event->time + cur_pcb->burst_left, cur_pcb, Done)); +// } + +// free(entry); +// } + +// void handle_event_arrived_and_done(Event *event, double priority) { +// if(event->type == Arrived) { +// pqueue_add(pqueue, init_pentry(priority, event->pcb), false); +// } + +// if(event->type == Done) { +// free(cur_pcb); +// cur_pcb = NULL; +// } +// } + +// void fcfs_priority_non_preemptive(Event *event) { +// if(event->type == Arrived) { +// pqueue_add(pqueue, init_pentry(event->pcb->priority, event->pcb), false); +// } + +// if(event->type == Done) { +// free(cur_pcb) +// cur_pcb = NULL; +// } + +// if(cur_pcb == NULL) { +// PEntry *entry = pqueue_extract_min(pqueue); +// if(entry != NULL) { +// cur_pcb = entry->pcb; +// event_queue_add(event_queue, init_event(event->time + cur_pcb->burst_left, cur_pcb, Done)); +// } +// free(entry); +// } +// } \ No newline at end of file diff --git a/Ex5/1-kth_smallest_elem.py b/Ex5/1-kth_smallest_elem.py new file mode 100644 index 0000000..ae6369f --- /dev/null +++ b/Ex5/1-kth_smallest_elem.py @@ -0,0 +1,45 @@ +import random +import time + +def increment_sort(elems, increment): + for i in range(increment, len(elems)): + for j in range(i, increment - 1, -increment): + if elems[j] < elems[j - increment]: + elems[j], elems[j - increment] = elems[j - increment], elems[j] + else: + break + + +def insertion_sort(elems): + increment_sort(elems, 1) + +def partition(arr, start, end, pivot_ind): + arr[pivot_ind], arr[start] = arr[start], arr[pivot_ind] + pivot_ind = start + for i in range(pivot_ind, end + 1): + if arr[i] < arr[pivot_ind]: + arr[i], arr[pivot_ind + 1] = arr[pivot_ind + 1], arr[i] + arr[pivot_ind], arr[pivot_ind + 1] = arr[pivot_ind + 1], arr[pivot_ind] + pivot_ind += 1 + return pivot_ind + +def k_smallest(arr, k, start, end): + print(f"{start=}, {end=}") + if start == end: + return arr[start] + pivot_ind = partition(arr, start, end, random.randint(start, end)) + if pivot_ind == k - 1: + return arr[pivot_ind] + if pivot_ind > k - 1: + return k_smallest(arr, k, start, pivot_ind - 1) + return k_smallest(arr, k, pivot_ind + 1, end) + +if __name__ == "__main__": + seed = time.time_ns() + #random.seed(seed) + #print(f"{seed=}") + nums_str = input("Enter comma separated numbers: ") + nums = [int(num_str) for num_str in nums_str.split(',')] + k = int(input("Enter k: ")) + k_small = k_smallest(nums, k, 0, len(nums) - 1) + print(f"K-th smallest elem: {k_small}") diff --git a/Ex5/2-tree_sum.py b/Ex5/2-tree_sum.py new file mode 100644 index 0000000..100ba79 --- /dev/null +++ b/Ex5/2-tree_sum.py @@ -0,0 +1,60 @@ +import random +class TreeNode: + def __init__(self): + self.data = 0 + self.left = None + self.right = None + + def insert(self, data): + if data < self.data: + if self.left == None: + tempNode = TreeNode() + self.left = tempNode + self.left.data = data + else: + self.left.insert(data) + elif data > self.data: + if self.right == None: + tempNode = TreeNode() + self.right = tempNode + self.right.data = data + else: + self.right.insert(data) + def traverseInOrder(self): + if self.left != None: + self.left.traverseInOrder() + print(self.data, end=' ') + if self.right != None: + self.right.traverseInOrder() +def createRoot(): + i = random.randint(1, 10) + rootNode = TreeNode() + rootNode.data = i + return rootNode + +def createTree(): + rootNode = createRoot() + numNodes = random.randint(1, 10) + print(f"{numNodes=}") + currentNode = rootNode + j = 1 + L = [rootNode.data] + while (j < numNodes): + newVal = random.randint(1,20) + if newVal not in L: + currentNode.insert(newVal) + L.append(newVal) + j+=1 + rootNode.traverseInOrder() + return rootNode +# Code to populate the tree ends here +def getSum(node): + if node == None: + return 0 + else: + leftSum = getSum(node.left) + rightSum = getSum(node.right) + return node.data + leftSum + rightSum + +rootNode = createTree() +print("Sum = ",getSum(rootNode)) \ No newline at end of file diff --git a/Ex5/3-closest_points.py b/Ex5/3-closest_points.py new file mode 100644 index 0000000..7458c37 --- /dev/null +++ b/Ex5/3-closest_points.py @@ -0,0 +1,72 @@ +import math +import matplotlib.pyplot as plt +import random +import time + +class Point: + def __init__(self, x, y): + self.x = x + self.y = y + + def tuple(self): + return (self.x, self.y) + + @staticmethod + def dist(a, b): + return (a.x - b.x)**2 + (a.y - b.y)**2 + +def closest_points(points): + points_sorted_x = sorted(points, key = lambda p:p.x) + points_sorted_y = sorted(points, key = lambda p:p.y) + return closest_points_helper(points_sorted_x, points_sorted_y) + +def closest_points_helper(points_x, points_y): + if len(points_x) == 1: + return None, None, math.inf + if len(points_x) == 2: + return points_x[0], points_x[1], Point.dist(points_x[0], points_x[1]) + + left_x, right_x = points_x[:len(points_x)//2], points_x[len(points_x)//2:] + boundary_x = (left_x[-1].x + right_x[0].x) / 2 + #plt.vlines(boundary_x, 0, 100) + left_y, right_y = [point for point in points_y if point.x <= boundary_x], [point for point in points_y if point.x > boundary_x] + + left_p1, left_p2, left_d = closest_points_helper(left_x, left_y) + right_p1, right_p2, right_d = closest_points_helper(right_x, right_y) + + p1, p2, d = (left_p1, left_p2, left_d) if left_d < right_d else (right_p1, right_p2, right_d) + + cross_y = [point for point in points_y if abs(point.x - boundary_x) < d] + + for i, point in enumerate(cross_y): + for j in range(i+1, len(cross_y)): + if cross_y[j].y - point.y >= d: + break + if (temp_d := Point.dist(point, cross_y[j])) < d: + p1, p2, d = point, cross_y[j], temp_d + + return p1, p2, d + +n = 100 +points = [Point(random.uniform(0, 100), random.uniform(0, 100)) for i in range(n)] +start = time.perf_counter() +ap1, ap2, ad = None, None, math.inf +for i, t1 in enumerate(points): + for t2 in points[i+1:]: + if((temp_d:=Point.dist(t1, t2)) < ad): + ad = temp_d + ap1 = t1 + ap2 = t2 +print(f"{ad=}") +end = time.perf_counter() +print(f"{end - start = }") +plt.scatter(*zip(*[p.tuple() for p in points]), c='blue') +start = time.perf_counter() +p1, p2, d = closest_points(points) +print(f"{d=}") +end = time.perf_counter() +print(f"{end - start = }") +plt.scatter([p1.x, p2.x], [p1.y, p2.y], color = 'green') +plt.scatter([ap1.x,ap2.x], [ap1.y, ap2.y], color = 'red') +#plt.hlines(0, 0, 100) +plt.show() \ No newline at end of file diff --git a/LICENSE b/LICENSE index 9f61605..0820fa4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,24 +1,24 @@ -BSD 2-Clause License - -Copyright (c) 2024, Depixelate - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +BSD 2-Clause License + +Copyright (c) 2024, Depixelate + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 4e1bbd1..be86360 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# algo-analysis -A Practice Repository For Learning About different kinds of algorithms +# algo-analysis +A Practice Repository For Learning About different kinds of algorithms
# Aider chat conversation: USER: commit ASSISTANT: Please provide the specific files you would like me to edit or the details of the changes you need. USER: add the standard files you might add to `.gitignore` in a python project ASSISTANT: Here is the *SEARCH/REPLACE block* to update the `.gitignore` file with standard entries for a Python project: .gitignore ```python <<<<<<< SEARCH .aider* .venv* ======= # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyderworkspace # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # Aider .aider* >>>>>>> REPLACE ```
…lass # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/
# Aider chat conversation: USER: Add best practice gitignore content for python projects ASSISTANT: Here is the updated `.gitignore` file with best practice content for Python projects: .gitignore ```python <<<<<<< SEARCH __pycache__/ *.pyc .env .aider** scripts/** push setup_env.py ======= # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ docsrc/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # Custom .aider** scripts/** push setup_env.py >>>>>>> REPLACE ```
… ignoring common files and directories that should not be tracked by Git. # Aider chat conversation: USER: setup the .gitignore file to properly handle python project (feel free to commit anything that is not tracked) ASSISTANT: Let's create a `.gitignore` file to properly handle a Python project. This file will ignore common files and directories that should not be tracked by Git. .gitignore <source>plaintext <<<<<<< SEARCH ======= # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ docsrc/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # VS Code .vscode/ >>>>>>> REPLACE </source> This `.gitignore` file will help ensure that unnecessary files are not tracked in your repository.
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 --- /dev/null (date 1727788276489) +++ b/.idea/.gitignore (date 1727788276489) @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml Index: WiC_decision_maker_model-main/.idea/.gitignore IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WiC_decision_maker_model-main/.idea/.gitignore b/WiC_decision_maker_model-main/.idea/.gitignore new file mode 100644 --- /dev/null (date 1727670808000) +++ b/WiC_decision_maker_model-main/.idea/.gitignore (date 1727670808000) @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml Index: WiC_decision_maker_model-main/.gitignore IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WiC_decision_maker_model-main/.gitignore b/WiC_decision_maker_model-main/.gitignore new file mode 100644 --- /dev/null (date 1727670808000) +++ b/WiC_decision_maker_model-main/.gitignore (date 1727670808000) @@ -0,0 +1,162 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ Index: WiC_decision_maker_model-main/about.txt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WiC_decision_maker_model-main/about.txt b/WiC_decision_maker_model-main/about.txt new file mode 100644 --- /dev/null (date 1727670808000) +++ b/WiC_decision_maker_model-main/about.txt (date 1727670808000) @@ -0,0 +1,1 @@ +Az alkalmazás megvizsgálja, hogy a WiC (word in context) feladatot különböző nyelvi modellek mennyire jól tudják megoldani, illetve, hogy mennyire érzékenyek esetlegesen arra, hogyha a 2 példamondatot, amire vonatkozóan döntést kell hozzanak, azt fordított sorrendben adjuk be nekik. Megvizsgált modellek terv szerint gemma2-2b, GPT 3.5 és 4, Gemini. \ No newline at end of file Index: WiC_decision_maker_model-main/frontend/app.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WiC_decision_maker_model-main/frontend/app.js b/WiC_decision_maker_model-main/frontend/app.js new file mode 100644 --- /dev/null (date 1727670808000) +++ b/WiC_decision_maker_model-main/frontend/app.js (date 1727670808000) @@ -0,0 +1,16 @@ +function MyButton() { + return ( + <button> + I'm a button + </button> + ); +} + +export default function MyApp() { + return ( + <div> + <h1>Welcome to my app</h1> + <MyButton /> + </div> + ); +} Index: WiC_decision_maker_model-main/backend/app/app.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WiC_decision_maker_model-main/backend/app/app.py b/WiC_decision_maker_model-main/backend/app/app.py new file mode 100644 --- /dev/null (date 1727789908761) +++ b/WiC_decision_maker_model-main/backend/app/app.py (date 1727789908761) @@ -0,0 +1,40 @@ +import data +import pandas as pd +from flask import Flask, render_template +from py import build_templates + +# import nlp_utils + +app = Flask(__name__) + + +@app.route('/') +def index(): + return render_template('index.html') + + +def count_word_occurrences(sentences, word): + count = 0 + for sentence in sentences: + count += sentence.split().count(word) + return count + + +if __name__ == '__main__': + + # Az adatfájl betöltése + templates = build_templates.template_builder(10) + # Open the file in write mode + with open('output/out.txt', 'w', encoding='utf-8') as f: + for element in templates: + if element == ' ': + print(' ', file=f) + else: + print(element, file=f, end="") + # print(chat_template("bed", "There's a lot of trash on the bed of the river", + # "I keep a glass of water next to my bed when I sleep")) + app.run(host="127.0.0.1", port=5000, debug=True) + + +def py(): + return None Index: WiC_decision_maker_model-main/backend/app/py/build_templates.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WiC_decision_maker_model-main/backend/app/py/build_templates.py b/WiC_decision_maker_model-main/backend/app/py/build_templates.py new file mode 100644 --- /dev/null (date 1727788732325) +++ b/WiC_decision_maker_model-main/backend/app/py/build_templates.py (date 1727788732325) @@ -0,0 +1,40 @@ +import csv +import os + + +def read_dataset(): + # Get the directory of the current script + current_dir = os.path.dirname(os.path.abspath(__file__)) + + # Construct the absolute path to the dataset + dataset_path = os.path.join(current_dir, '../../dataset/test/test.data.txt') + # Az adatfájl betöltése + with open(dataset_path, 'r', encoding='utf-8') as file: + reader = csv.reader(file, delimiter='\t') # Tabulátorral elválasztott adatok olvasása + data = list(reader) # A teljes adat beolvasása a fájl lezárása előtt + return data # Az adat visszaadása a fájl lezárása után + + +def chat_template(word, s1, s2): + return (f'Does the word "{word}" mean the same in sentence "{s1}" as in sentence"' + f'{s2}"?') + + +def template_builder(endindex): # you can adjust how many lines you want to work with + i = 0 + string_builder = [] + data = read_dataset() + print(data) + for row in data: + target_word = row[0] + PoS = row[1] + index1_index2 = row[2] + example_1 = row[3] + example_2 = row[4] + question = chat_template(target_word, example_1, example_2) + string_builder.append(question) + i += 1 + if i > endindex: + break + + return ''.join(string_builder) \ No newline at end of file Index: WiC_decision_maker_model-main/backend/dataset/dev/dev.data.txt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WiC_decision_maker_model-main/backend/dataset/dev/dev.data.txt b/WiC_decision_maker_model-main/backend/dataset/dev/dev.data.txt new file mode 100644 --- /dev/null (date 1727670808000) +++ b/WiC_decision_maker_model-main/backend/dataset/dev/dev.data.txt (date 1727670808000) @@ -0,0 +1,638 @@ +board N 2-2 Room and board . He nailed boards across the windows . +circulate V 0-4 Circulate a rumor . This letter is being circulated among the faculty . +hook V 0-1 Hook a fish . He hooked a snake accidentally , and was so scared he dropped his rod into the water . +recreation N 1-9 For recreation he wrote poetry and solved crossword puzzles . Drug abuse is often regarded as a form of recreation . +domesticity N 4-6 Making a hobby of domesticity . A royal family living in unpretentious domesticity . +acquisition N 3-7 The child 's acquisition of language . That graphite tennis racquet is quite an acquisition . +meeting N 3-1 There was no meeting of minds . The meeting elected a chairperson . +nude N 4-4 They swam in the nude . The marketing rule ' nude sells ' spread from verbal to visual mainstream media in the 20th century . +mark N 4-8 He left an indelible mark on the American theater . It was in London that he made his mark . +association N 7-2 Conditioning is a form of learning by association . Many close associations with England . +inclination N 2-1 The alkaline inclination of the local waters . An inclination of his head indicated his agreement . +glaze V 0-2 Glaze the bread with eggwhite . The potter glazed the dishes . +piggyback V 3-1 An amendment to piggyback the current law . He piggybacked her child so she could see the show . +pick V 1-3 To pick rags . Do n't always pick on your little brother . +belabor V 0-2 Belabor the obvious . She was belabored by her fellow students . +bell V 0-2 Bell cows . Who will bell the cat ? +tear N 12-3 He took the manuscript in both hands and gave it a mighty tear . There were big tears rolling down Lisa 's cheeks . +kill V 0-1 Kill the engine . He killed the ball . +analyze V 0-2 Analyze your real motives . The inspector analyzed the building 's soundness . +lecture V 3-1 Did you ever lecture at Harvard ? She lectured to the class about her travels . +rehearsal N 1-4 A rehearsal will be held the day before the wedding . He missed too many rehearsals . +forge V 3-1 We decided to forge ahead with our plans even though our biggest underwriter backed out . He forged ahead . +falsity N 9-7 The belief that the world is flat is a falsity . Argument could not determine its truth or falsity . +assurance N 1-1 An assurance of help when needed . His assurance in his superiority did not make him popular . +branch N 1-2 A branch of Congress . We have branches in all major suburbs . +fuzz N 9-1 He tried to clear his head of the whisky fuzz . Peach fuzz . +risk V 3-1 I can not risk smoking . Why risk your life ? +chemistry N 1-1 The chemistry of indigo . The chemistry of iron . +char N 10-11 “ Among other native delicacies , they give you fresh char . ” . “ I had to scrub the kitchen today , because the char could n't come ” . +response N 4-1 This situation developed in response to events in Africa . His responses have slowed with age . +excuse N 5-4 That thing is a poor excuse for a gingerbread man . Has n't anyone taught you how to bake ? He 's a sorry excuse of a doctor . +bondage N 5-5 He sought release from his bondage to Satan . A self freed from the bondage of time . +catch N 1-3 The catch was only 10 fish . He shared his catch with the others . +shadiness N 4-1 There 's too much shadiness to take good photographs . The shadiness of their transactions . +passage N 2-6 The outward passage took 10 days . She struggled to play the difficult passages . +daughter N 13-1 I already have a son , so I would like to have a daughter . Her daughter cared for her in her old age . +hold V 1-0 Please hold a table at Maxim 's . Hold a table for us at 7:00 . +banish V 0-0 Banish bad thoughts . Banish gloom . +sense N 3-2 A keen musical sense . A good sense of timing . +opinion N 2-6 In my opinion , white chocolate is better than milk chocolate . I would like to know your opinions on the new systems . +deed N 3-3 He signed the deed . I inherited the deed to the house . +question N 8-3 His claim to the property has come under question . He obeyed without question . +distribute V 4-2 The publisher wants to distribute the book in Asia . The function distributes the values evenly . +return V 0-0 Return her love . Return a compliment . +officer N 3-4 He is an officer of the court . The club elected its officers for the coming year . +clutch V 1-1 To clutch power . She clutched her purse . +dissipation N 1-1 The dissipation of the mist . Mindless dissipation of natural resources . +portfolio N 9-3 He remembered her because she was carrying a large portfolio . He holds the portfolio for foreign affairs . +play N 3-5 They gave full play to the artist 's talent . It was all done in play . +brush N 6-4 She gave her hair a quick brush . The dentist recommended two brushes a day . +rise N 6-1 They asked for a 10 % rise in rates . The rising of the Holy Ghost . +studio N 1-5 His studio was cramped when he began as an artist . You do n't need a studio to make a passport photograph . +cushion V 1-0 To cushion a blow . Cushion the blow . +plenty N 2-4 There was plenty of food for everyone . It must have cost plenty . +look N 1-1 A look of triumph . His look was fixed on her eyes . +recrudescence N 1-1 A recrudescence of racism . A recrudescence of the symptoms . +metadata N 3-4 Most websites contain metadata to tell the computer how to lay the words out on the screen . A library catalog is metadata because it describes publications . +streak N 1-4 A streak of wildness . He has a stubborn streak . +elapse V 5-2 He allowed a month to elapse before beginning the work . Several days elapsed before they met again . +corner N 5-2 He tripled to the rightfield corner . The southeastern corner of the Mediterranean . +average N 3-6 He is about average in height . The snowfall this month is below average . +replicate V 11-0 On entering a host cell , a virus will start to replicate . Replicate the cell . +wait V 3-0 She used to wait down at the Dew Drop Inn . Wait here until your car arrives . +bottom N 4-9 They started at the bottom of the hill . They did much of their overseas trade in foreign bottoms . +straggle N 1-1 A straggle of followers . A straggle of outbuildings . +torture N 7-13 In every war there are acts of torture that cause the world to shudder . Using large dogs to attack bound , hand - cuffed prisoners is clearly torture . +wash V 5-2 This silly excuse wo n't wash in traffic court . The cat washes several times a day . +seem V 1-1 I seem to be misunderstood by everyone . There seems no reason to go ahead with the project now . +jockey N 4-2 He 's a truck jockey . A disc jockey . +sugar V 0-2 Sugar your tea . John heavily sugars his coffee . +load V 0-0 Load a car . Load the truck with hay . +canon N 2-0 The neoclassical canon . Canons of polite society . +upstage V 6-8 She only wore that dress to upstage everyone . When the dog entered the stage , he upstaged the actress . +ruin V 3-3 This behavior will ruin your chances of winning the election . The country lay ruined after the war . +modify V 1-1 Please modify this letter to make it more polite . He modified his views on same - gender marriage . +loose V 1-0 Let loose mines . Loose terrible plagues upon humanity . +breast N 3-5 He beat his breast in anger . The robin has a red breast . +invasion N 1-1 An invasion of locusts . An invasion of tourists . +stay V 5-0 Wear gloves so your hands stay warm . Stay with me , please . +chore N 4-4 Washing dishes is a chore , but we can not just stop eating . The farmer 's morning chores . +stripe N 3-3 Businessmen of every stripe joined in opposition to the proposal . They earned their stripes in Kuwait . +sight N 4-7 He was a familiar sight on the television . They went to Paris to see the sights . +potluck N 4-7 Here 's a good potluck of beans and stew . Having arrived unannounced we had to take potluck . +push V 3-1 You need to push quite hard to get this door open . Nora pushed through the crowd . +nut N 7-5 He was driving his car like a nut . I kicked him in the nuts . +share V 2-3 Our children share a love of music . The two countries share a long border . +develop V 2-2 Children must develop a sense of right and wrong . We have developed a new theory of evolution . +compress V 4-1 The force required to compress a spring varies linearly with the displacement . She compressed her lips . +pressure N 2-6 He used pressure to stop the bleeding . The sensitivity of his skin to pressure and temperature was normal . +love V 1-1 I love French food . I loved to write . +strike V 0-2 Strike an arc . The clock struck midnight . +shtik N 3-7 He 's a shtik crazy . How did you ever fall for a shtik like that ? +tremor N 3-4 She felt a tremor in her stomach before going on stage . Did you feel the tremor this morning ? +whitewash V 3-10 Let 's not whitewash the crimes of Stalin . In his sermon , the minister did n't try to whitewash over the sins of his church . +bridge N 6-5 Her glasses left marks on the bridge of her nose . Rugby players often break the bridge of their noses . +adoxography N 4-0 Elizabethan schoolboys were taught adoxography , the art of eruditely praising worthless things . Adoxography is particularly useful to lawyers . +dexterity N 9-7 She twirled the knife through her fingers with impressive dexterity . Playing computer games can improve your manual dexterity . +reflect V 13-4 People do that sort of thing every day , without ever stopping to reflect on the consequences . The teacher 's ability reflects well on the school . +harbour N 6-7 The city has an excellent natural harbour . The neighbourhood is a well - known harbour for petty thieves . +absorb V 0-1 Absorb the costs for something . He absorbed the knowledge or beliefs of his tribe . +round N 1-3 The round of the seasons . The postman 's rounds . +resolution N 3-6 Printing at higher resolution will cause a reduction in performance . They never did achieve a final resolution of their differences . +applaud V 1-9 I applaud your efforts . Although we do n't like your methods , we applaud your motives . +trailer N 1-14 The trailer for that movie makes it seem like it would be fun . At the end of the day , we put the snowmobiles back on the trailer . +dinner N 7-6 Guests should never be late to a dinner party . On Sundays they had a large dinner when they returned from church . +growth N 1-1 A growth of hair . The growth of culture . +buzz N 1-1 The buzz of excitement was so great that a formal denial was issued . The buzz of a bumble bee . +beat N 8-1 In the old days a policeman walked a beat and knew all his people by name . A beat of the heart . +footprint N 5-1 The computer had a desktop footprint of 10 by 16 inches . The footprints of an earlier civilization . +nowhere N 4-6 He came out of nowhere . They went on a cruise to nowhere . +mince N 1-0 A mince of mushrooms . Mince tastes really good fried in a pan with some chopped onion and tomato . +militarize V 0-0 Militarize the Civil Service . Militarize Germany again after the war . +intention N 1-1 The intention of this legislation is to boost the economy . Good intentions are not enough . +submerge V 0-2 Submerge your head completely . The submarine submerged in the water . +amuse V 6-2 I watch these movies because they amuse me . The clown amused the children . +calibrate V 0-1 Calibrate a gun . He calibrated the thermometer for the Celsius scale . +circumference N 8-5 A danger to all races over the whole circumference of the globe . He had walked the full circumference of his land . +tap V 0-0 Tap a keg of beer . Tap a maple tree for its syrup . +branch N 4-2 We opened a new branch in London . Our main branch is downtown . +peradventure N 3-2 This proves beyond peradventure that he is innocent . Proved beyond peradventure . — South . +finish N 8-11 My horse was several lengths behind at the finish . The winner is the team with the most points at the finish . +kick N 1-11 The kick must be synchronized with the arm movements . A sidecar is a smooth drink but it has a powerful kick . +month N 4-6 He was given a month to pay the bill . We went on holiday for two months . +contradistinction N 2-6 Sculpture in contradistinction to painting . We used hamburgers and soda in contradistinction to healthy food . +remove V 0-2 Remove a wrapper . The President removed many postmasters . +crash V 2-2 You can crash here , though it 's not very comfortable . The terrorists crashed the plane into the palace . +smoothness N 11-2 The weather system of the Pacific is determined by the uninterrupted smoothness of the ocean . His oily smoothness concealed his guilt from the police . +exhibition N 4-2 There was an art exhibition on in the town hall . A boat exhibition . +cloister V 0-1 Cloister the garden . She cloistered herself in the office . +maneuver N 4-6 He made a great maneuver . Parallel parking can be a difficult maneuver . +mess N 4-5 The house was a mess . My boss dumped a whole mess of projects on my desk today . +burn V 0-3 Burn a CD . My eyes are burning . +knuckleball N 8-14 Even the pitcher does n't know where his knuckleball is going . Boston Red Sox pitcher Tim Wakefield is best known for his use of the knuckleball . +map V 0-0 Map the genes . Map the surface of Venus . +mandate V 0-7 Mandate a colony . The new director of the school board mandated regular tests . +way N 7-4 They did n't have much in the way of clothing . We went our separate ways . +shock V 1-0 To shock rye . Shock grain . +tipper N 2-7 A generous tipper . The Americans are among the most generous tippers in the world . +avail V 2-1 It will avail them to dispose of their booty . He availed himself of the available resources . +button N 6-4 The politician wore a bright yellow button with the slogan " Vote Smart " emblazoned on it . They passed out campaign buttons for their candidate . +crop N 2-2 The annual crop of students brings many new ideas . The latest crop of fashions is about to hit the stores . +boot V 0-11 Boot your computer . When arriving at the office , first thing I do is booting my machine . +heartbeat N 5-5 The policeman waited for a heartbeat in vain . He alone gives me such heartbeats . +drag V 3-2 Time seems to drag when you 're waiting for a bus . The speech dragged on for two hours . +chisel V 0-2 Chisel the marble . Who 's chiseling on the side ? +literature N 11-2 One aspect of Waterloo has not yet been treated in the literature . The technical literature . +snatch N 2-1 Martin 's snatch at the bridle failed and the horse raced away . Overheard snatches of their conversation . +excite V 5-0 There are drugs designed to excite certain nerves in our body . Excite the audience . +building N 2-1 The entire building complained about the noise . The building of the bridge will be completed in a couple of weeks . +scallop V 0-0 Scallop the hem of the dress . Scallop the meat . +date V 4-1 Scientists often can not date precisely archeological or prehistorical findings . To date the building of the pyramids . +exchange N 4-1 They had a bitter exchange . An exchange of cattle for grain . +apology N 3-1 It was an apology for a meal . The Apology of Socrates . +spade N 4-0 She led a low spade . Spades were trumps . +cocoon V 7-1 She loves to stay at home and cocoon . Families cocoon around the T.V. set most evenings . +build V 0-3 Build up confidence . They had to build up their fortress to protect against attack . +winterize V 0-0 Winterize cars . Winterize your houses . +wish N 3-2 He got his wish . My best wishes . +reinstatement N 1-15 Her reinstatement to her former office followed quickly . Many people are unhappy with the sacking of the chief constable and demand his immediate reinstatement . +watch V 9-3 Put a little baking soda in some vinegar and watch what happens . The world is watching Sarajevo . +installation N 8-2 He gave a speech as part of his installation into the hall of fame . The telephone installation took only a few minutes . +conceive V 3-7 She can not conceive . Assisted procreation can help those trying to conceive . +touch V 3-7 He could not touch the meaning of the poem . Helen Keller felt the physical world by touching people and objects around her . +percolate V 0-2 Percolate coffee . I 'll percolate some coffee . +drought N 10-5 When England defeated Pakistan it ended a ten - year drought . Farmers most affected by the drought hope that there may yet be sufficient rain early in the growing season . +excite V 0-6 Excite the neurons . The fireworks which opened the festivities excited anyone present . +pull N 2-3 A zipper pull . He grabbed the pull and opened the drawer . +fight N 1-2 A fight broke out at the hockey game . There were fights in the streets . +breed N 5-1 He experimented on a particular breed of white rats . A breed of animal . +mainstream N 6-6 His thinking was in the American mainstream . His ideas were well outside the mainstream , but he presented them intelligently , and we were impressed if not convinced . +help N 3-3 There 's no help for it . I need some help with my homework . +cognate N 3-10 English is a cognate of Greek , German , Russian and Persian . English and , Russian , Icelandic and Irish are all cognates . +convey V 1-1 To convey information . She conveyed the message to me . +profession N 1-6 A profession of disagreement . My father was a barrister by profession . +protest N 6-5 The senator rose to register his protest . They finished the game under protest to the league president . +operation N 3-7 The plane 's operation in high winds . The power of its engine determines its operation . +strip N 6-3 He welded together some pieces of strip . She did a strip right in front of everyone . +toss V 2-1 I 'll toss you for it . Steve tossed John the ball . +squeaker N 4-3 Which hinge is the squeaker ? Those sneakers are squeakers . +delta N 2-3 The Nile delta . The Mississippi River delta . +sign V 1-1 Please sign on the dotted line . Please sign here . +capacity N 2-7 Limited runway capacity . He should be retained in his present capacity at a higher salary . +frame N 2-9 A lace frame . His starved flesh hung loosely on his once imposing frame . +solemnize V 4-2 The couple chose to solemnize their relationship in a secular ceremony , instead of having a wedding . The King solemnized this day of morning . +drawing N 1-8 The drawing of water from the well . He did complicated pen - and - ink drawings like medieval miniatures . +cup N 3-4 He put the cup back in the saucer . The handle of the cup was missing . +plan V 0-1 Plan an attack . He plans to be in graduate school next year . +hit V 0-3 Hit the bottle . He tries to hit on women in bars . +criticize V 2-2 Those who criticize others often are not perfect , either . The paper criticized the new movie . +wake N 7-3 There 's no weeping at an Irish wake . The motorboat 's wake capsized the canoe . +stream N 3-4 He felt a stream of air . The hose ejected a stream of water . +block V 0-3 Block the signals emitted by this station . The thick curtain blocked the action on the stage . +obstacle N 5-7 Lack of imagination is an obstacle to one 's advancement . The poverty of a district is an obstacle to good education . +point V 0-4 Point a gun . It 's rude to point at other people . +draw N 4-4 The luck of the draw . They anticipated a tough draw . +embellish V 1-5 To embellish a story , the truth . The old book cover was embellished with golden letters . +glimpse N 7-4 From the window he could catch a glimpse of the lake . He caught only a glimpse of the professor 's meaning . +shuffle V 1-0 You shuffle , I 'll deal . Shuffle the cards . +bracket V 1-0 Please bracket this remark . Bracket bookshelves . +vary V 1-2 Prices vary . His moods vary depending on the weather . +abridge V 4-4 The new law might abridge our freedom of expression . He had his rights abridged by the crooked sheriff . +attack N 4-1 He published an unexpected attack on my work . An attack of diarrhea . +revenge N 4-15 Indifference is the sweetest revenge . When I left my wife , she tried to set fire to the house in revenge . +review V 2-10 Let 's review your situation . Before I tackle the question directly , I must briefly review historical approaches to the problem . +tilt N 3-5 The court 's tilt toward conservative rulings . The tower had a pronounced tilt . +consult V 3-0 They had to consult before arriving at a decision . Consult your local broker . +reline V 0-6 Reline the paper . The old fur coat must be relined . +liberty N 1-0 At liberty to choose whatever occupation one wishes . Liberty to think or feel or do just as one pleases . +answer V 0-5 Answer the question . She did n't want to answer . +carve V 0-2 Carve one 's name into the bark . That chisel carved the statue . +square N 10-3 The carpenter who built this room must have lost his square . 64 is the square of 8 . +donate V 0-1 Donate money to the orphanage . I donated blood to the Red Cross for the victims of the earthquake . +proliferate V 3-2 We must not proliferate nuclear arms . The flowers proliferated rapidly all spring . +hew V 0-11 Hew out a path in the rock . One of the most widely used typefaces in the world was hewn by the English printer and typographer John Baskerville . +keep V 2-1 Can I keep my old stuffed animals ? She kept her maiden name after she married . +sophistication N 5-6 He practiced the art of sophistication upon reason . Understanding affine transformations requires considerable mathematical sophistication . +shot N 5-1 He trained at putting the shot . The shot flew twenty metres , and nearly landed on the judge 's foot . +muscle N 4-0 The senators used their muscle to get the party leader to resign . Muscle consists largely of actin and myosin filaments . +fiddle V 2-2 Do n't fiddle with the screws . She always fiddles with her van on the weekend . +harass V 0-2 Harass the enemy . This man harasses his female co - workers . +minister N 1-4 The minister said a prayer on behalf of the entire congregation . Clergymen are usually called ministers in Protestant churches . +sequence N 5-4 He played the trumps in sequence . The doctor saw a sequence of patients . +abatement N 1-3 The abatement of a nuisance is the suppression thereof . Laws enforcing noise abatement . +incorporate V 0-3 Incorporate this document with those pertaining to the same case . The company was incorporated in 1980 . +chew V 5-0 The steak was tough to chew as it had been cooked too long . Chew your food and do n't swallow it ! +conclusion N 1-1 The conclusion of the peace treaty . The conclusion of a business deal . +fiefdom N 3-20 The duke 's fiefdom had been greatly expanded as a reward for his dutiful military service on behalf of the king . Most of our company 's computers are standardized , but the IT director allows the employees in his own little fiefdom to specify their own machines . +marriage N 1-1 A marriage of ideas . The marriage of music and dance . +button N 3-6 Pat pushed the button marked " shred " on the blender . The elevator was operated by push buttons . +plant V 0-0 Plant bugs in the dissident 's apartment . Plant a spy in Moscow . +accumulate V 3-2 He wishes to accumulate a sum of money . Journals are accumulating in my office . +wrangle V 0-11 Wrangle horses . The bar keeper threw them out , but they continued to wrangle on down the street . +ticket N 6-9 This car could be just the ticket for a small family . Joe will be running on an anti - crime ticket . +shake V 0-2 Shake the salt out of the salt shaker . His hands shook . +process V 0-1 Process iron . They processed into the dining room . +spread V 2-1 The infection spread . Optimism spread among the population . +seize V 4-2 Birds of prey often seize small mammals . The invaders seized the land and property of the inhabitants . +follow V 2-1 We must follow closely the economic development is Cuba . It follows that your assertion is false . +pull N 4-6 It was a long pull but we made it . He was sidelined with a hamstring pull . +misdirect V 0-2 Misdirect the letter . The pedestrian misdirected the out - of - town driver . +distribution N 2-1 Worldwide in distribution . The distribution of nerve fibers . +sit V 6-7 When does the court of law sit ? In what city is the circuit court sitting for this session . +command V 1-0 To command an army or a ship . Command the military forces . +touch N 3-4 He has a touch of rheumatism . He longed for the touch of her hand . +last V 3-3 Summer seems to last longer each year . The bad weather lasted for three days . +lead N 2-13 A good lead for a job . Joe is a great addition to our sales team , he has numerous leads in the paper industry . +contact V 4-2 I am trying to contact my sister . He never contacted his children after he emigrated to Australia . +send V 0-1 Send me your latest results . Nora sent the book from Paris . +patronage N 6-7 The restaurant had an upper class patronage . Even before noon there was a considerable patronage . +exile N 3-4 He lived in exile . She lived as an exile . +bastion N 2-1 The last bastion of communism . A bastion against corruption . +admit V 0-2 Admit someone to the profession . She was admitted to the New Jersey Bar . +occurrence N 4-1 A disease of frequent occurrence . The occurrence ( or presence ) of life on other planets . +ease V 0-2 Ease the pain in your legs . The pain eased overnight . +safety N 3-3 He ran to safety . The reciprocal of safety is risk . +save N 7-5 The relief pitcher got credit for a save . The goalie made a brilliant save . +stop V 0-0 Stop a car . Stop the thief . +exalt V 2-3 These paintings exalt the imagination . The man was exalted from a humble carpenter to a minister . +taste N 11-3 To ask at that particular time was the ultimate in bad taste . He got a taste of life on the wild side . +advantage N 4-5 The enemy had the advantage of a more elevated position . The experience gave him the advantage over me . +deliberation N 3-1 It was the deliberation of his act that was insulting . The deliberations of the jury . +allowance V 5-3 The captain was obliged to allowance his crew . Our provisions were allowanced . +arousal N 3-6 To influence the arousal of brain and behavior . The purpose of art is the arousal of emotions . +whimsy N 0-3 Whimsy can be humorous to someone with time to enjoy it . He had a whimsy about flying to the moon . +strain V 2-2 Do n't strain your mind too much . The rope strained when the weight was attached . +vision N 9-3 The runners emerged from the trees into his clear vision . He had a vision of the Virgin Mary . +relieve V 3-2 This shall not relieve either Party of any obligations . The thief relieved me of $ 100 . +vote V 1-1 I vote that we all go home . She voted for going to the Chinese restaurant . +gap N 0-7 Gap between income and outgo . The exploring party went through the high gap in the mountains . +partnership N 5-5 The action teams worked in partnership with the government . Effective language learning is a partnership between school , teacher and student . +piece N 6-3 The children acted out a comic piece to amuse the guests . He sacrificed a piece to get a strategic advantage . +body N 1-1 The body of the car was badly rusted . Administrative body . +right N 2-1 Take a right at the corner . Film rights . +fuel N 1-3 More fuel is needed during the winter months . They developed alternative fuels for aircraft . +peg V 2-0 Let 's peg the rug to the floor . Peg a tent . +largeness N 6-5 The might have repercussions of unimaginable largeness . A man distinguished by the largeness and scope of his views . +affect V 4-2 Will the new rules affect me ? The medicine affects my heart rate . +hell N 2-1 War is hell . The hell of battle . +cost N 2-2 The average cost of a new house is twice as much as t was 20 years ago . The total cost of the new complex was an estimated $ 1.5 million . +parade N 6-3 The floats and horses in the parade were impressive , but the marching bands were really amazing . She made a parade of her sorrows . +preparation N 3-8 He left the preparation of meals to his wife . The resolution of one dissonance is often the preparation for another dissonance . +sort N 4-3 She served a creamy sort of dessert thing . She wore a sort of magenta dress . +refrigerate V 1-0 Please refrigerate your uncooked meats at or below 40 Fahrenheit . Refrigerate this medicine . +ash N 4-1 The woods planted in ash will see a different mix of species . The ash trees are dying off . +tradecraft N 13-10 The CIA chief of station accepted responsibility for his agents ' failures of tradecraft . Instructional designers are trained in something that might be called tradecraft . +sense V 2-2 Particle detectors sense ionization . She immediately sensed her disdain . +utter V 0-1 Utter counterfeit currency . He uttered strange sounds that nobody could understand . +capital N 2-2 The drug capital of Columbia . The crime capital of Italy . +prepare V 0-1 Prepare for war . We prepared a fish for dinner . +gem N 3-4 He had the gem set in a ring for his wife . She 's an absolute gem . +part N 5-3 The government must do its part . Religions in all parts of the world . +rise V 0-2 Rise to the occasion . Her spirits rose when she heard the good news . +hook V 0-2 Hook the ball . His opponent hooked him badly . +tool N 3-6 He was a tool , no more than a pawn to her . I do n't have the right tools to start fiddling around with the engine . +life N 1-13 Real life . It was a heavy play and the actors tried in vain to give life to it . +result V 0-3 Result in tragedy . This measure will result in good or in evil . +story N 4-2 The book tells the story of two roommates . Disney 's stories entertain adults as well as children . +load N 3-5 That 's a load off my mind . I 'm worried that the load on that transformer will be too high . +office N 4-5 An executive or judical office . During his first year in office . +configure V 0-0 Configure a plane for a combat mission . Configure my new computer . +torrent N 7-3 The houses were swept away in the torrent . They endured a torrent of inquiries . +choke V 0-3 Choke a carburetor . This neckband is choking the cat . +embodiment N 1-4 The embodiment of hope . A circle was the embodiment of his concept of life . +date N 1-1 His date never stopped talking . The date for pleading . +engrave V 0-0 Engrave a letter . Engrave a pen . +blend N 5-7 ` smog ' is a blend of ` smoke ' and ` fog ' . Their music has been described as a blend of jazz and heavy metal . +aim V 3-1 She wanted to aim a pun . He aimed his fists towards his opponent 's face . +department N 5-4 His work established a new department of literature . Baking is not my department . +plume N 1-3 A plume of smoke . Grass with large plumes . +curd N 1-1 Bean curd . Lemon curd . +rush N 7-4 The linebackers were ready to stop a rush . Come back after the rush . +remover N 1-1 Rust remover . Paint remover . +care N 5-0 He handled the vase with care . Care should be taken when holding babies . +noise N 15-3 He knew that it was trash day , when the garbage collectors made all the noise . They heard indistinct noises of people talking . +donate V 5-1 Some of the members may donate privately . She donates to her favorite charity every month . +earshot N 10-7 I 'll row out on the lake but stay within earshot . The children were told to stay within earshot . +home N 11-1 Canadian tariffs enabled United States lumber companies to raise prices at home . His home is New Jersey . +member N 3-4 Canada is a member of the United Nations . The library was a member of the interlibrary loan association . +class N 3-15 An emerging professional class . Apologizing for losing your temper , even though you were badly provoked , showed real class . +disable V 0-2 Disable this command on your computer . He was disabled in a car accident . +moderate V 1-1 To moderate a synod . John moderated the discussion . +horse N 2-1 A clothes horse . 500 horse led the attack . +tree V 4-4 Her dog likes to tree squirrels . This lot should be treed so that the house will be shaded in summer . +attitude N 10-6 The airliner had to land with a nose - up attitude after the incident . The actor struck just the right attitude . +afford V 3-2 We ca n't afford to send our children to college . Can you afford this car ? +renovate V 2-1 This will renovate my spirits . They renovated the ceiling of the Sistine Chapel . +wateriness N 1-3 The wateriness of his blood . The haziness and wateriness of his disquisitions . +continent N 5-3 Pioneers had to cross the continent on foot . There are seven continents . +break N 2-5 Make a break for it . He finally got his big break . +operation N 4-4 They organized a rescue operation . Consolidate the companies various operations . +check N 8-1 As he called the role he put a check mark by each student 's name . A check on its dependability under stress . +influence N 4-4 He was a bad influence on the children . Used her parents ' influence to get the job . +scrub V 2-1 Surgeons must scrub prior to an operation . She scrubbed his back . +facility N 6-1 The assembly plant is an enormous facility . Educational facilities . +wine N 3-0 She ordered some wine for the meal . Wine is stronger than beer . +closure N 3-11 They regretted the closure of the day care center . He needed to grieve before he could achieve a sense of closure . +cuisine N 7-1 The restaurant is noted for its excellent cuisine . French cuisine is considered to be one of the world 's most refined and elegant styles of cooking . +peak N 1-4 The peak of perfection . The view from the peak was magnificent . +liberate V 1-1 To liberate the mind from prejudice . To liberate gases . +trip V 5-5 A pedestrian was able to trip the burglar as he was running away . The questions on the test tripped him up . +ball N 1-4 The ball at the base of the thumb . He stood on the balls of his feet . +move N 3-10 It 's your move ! Roll the dice ! If you roll a six , you can make two moves . +slip V 0-3 Slip into something comfortable . My grades are slipping . +flush V 0-2 Flush the meadows . The sky flushed with rosy splendor . +comb V 0-0 Comb the wool . Comb your hair before dinner . +walk N 7-0 After the blizzard he shoveled the front walk . Walking is a healthy form of exercise . +blockage N 3-10 There was a blockage in the sewer , so we called out the plumber . We had to call a plumber to clear out the blockage in the drainpipe . +collapse V 0-4 Collapse the music stand . The school system is collapsing . +sleep V 1-2 We sleep five people in each room . This tent sleeps six people . +shape N 6-6 Geometry is the mathematical science of shape . He could barely make out their shapes . +leave V 0-1 Leave your child the nurse 's care . He left the decision to his deputy . +aliyah N 2-6 Students making aliyah . He was called on for an aliyah . +lay V 1-0 To lay a tax on land . Lay a responsibility on someone . +thing N 1-0 A thing of the spirit . Things of the heart . +acquaintance N 9-9 I know of the man ; but have no acquaintance with him . I have trouble remembering the names of all my acquaintances . +sign V 0-4 Sign an intersection . This road has been signed . +street N 4-2 Be careful crossing the street . The whole street protested the absence of lights . +fuss V 2-1 Do n't fuss too much over the grandchildren -- they are quite big now . She fusses over her husband . +affair N 5-6 It is none of your affair . He used a hook - shaped affair with a long handle to unlock the car . +direct V 0-1 Direct your anger towards others , not towards yourself . He directed all his energies into his dissertation . +characterize V 2-4 You can characterize his behavior as that of an egotist . This poem can be characterized as a lament for a dead lover . +strangle V 5-6 The imperialist nation wanted to strangle the free trade between the two small countries . A man in Boston has been strangling several dozen prostitutes . +board N 1-4 The board has seven members . He got out the board and set up the pieces . +grip N 8-4 In Britain they call a bobby pin a grip . They kept a firm grip on the two top priorities . +swear V 1-3 I swear by my grandmother 's recipes . Before God I swear I am innocent . +gown N 5-5 The relations between town and gown are always sensitive . In the perennial town versus gown battles , townies win some violent battles , but the collegians are winning the war . +triangulate V 0-5 Triangulate the piece of cardboard . The land surveyor worked by triangulating the plot . +snap N 3-3 The infielder 's snap and throw was a single motion . Children can manage snaps better than buttons . +say V 4-2 What does the law say ? The clock says noon . +aptness N 1-1 The aptness of men to follow example . The aptness of iron to rust . +pay N 3-11 He wasted his pay on drink . Many employers have rules designed to keep employees from comparing their pays . +collapse N 1-6 The collapse of the old star under its own gravity . The roof is in danger of collapse . +go N 3-5 It 's my go . I 'll give it a go . +go V 4-2 How did your interview go ? She was going that way anyway , so she offered to show him where it was . +shot N 6-5 The nurse gave him a flu shot . He tried to get unposed shots of his friends . +mixture N 3-1 He drank a mixture of beer and lemonade . The mixture of sulphuric acid and water produces heat . +abuse N 1-6 All abuse , whether physical , verbal , psychological or sexual , is bad . The child showed signs of physical abuse . +breeze N 1-1 The breeze rustled the papers on her desk . The breeze was cooled by the lake . +floss V 1-2 She flossed her teeth . The hygienist flossed my teeth . +refresher N 5-8 The nap was a welcome refresher . He stopped at the bar for a quick refresher . +violate V 0-2 Violate the sanctity of the church . This sentence violates the rules of syntax . +barrage N 1-4 A barrage of questions . They laid down a barrage in front of the advancing troops . +work N 7-3 The symphony was hailed as an ingenious work . Erosion is the work of wind or water over time . +transfer N 1-5 The transfer of the music from record to tape suppressed much of the background noise . The best student was a transfer from LSU . +homogenization N 1-3 The homogenization of cream . The network 's homogenization of political news . +intellect N 4-6 He has a keen intellect . Some of the world 's leading intellects were meeting there . +toilet N 4-4 He made his morning toilet and went to breakfast . Pensions are in the toilet . +military N 1-6 Their military is the largest in the region . He spent six years in the military . +leave V 0-1 Leave lots of time for the trip . This leaves no room for improvement . +scraping N 4-3 All that bowing and scraping did not impress him . They collected blood scrapings for analysis . +breed N 4-1 Google represents a new breed of entrepreneurs . A breed of tulip . +section N 7-0 There are three synagogues in the Jewish section . Sections from the left ventricle showed diseased tissue . +pound V 2-0 The locks pound the water of the canal . Pound the roots with a heavy flat stone . +connection N 8-8 The bus was late so he missed his connection at Penn Station and had to wait six hours for the next train . The plane was late and he missed his connection in Atlanta . +mechanism N 1-0 A mechanism of social control . Mechanisms of communication . +gargle V 0-3 Gargle with this liquid . Every morning he gargled a little cheap Scotch . +bang N 3-4 He got a bang on the head . They got a great bang out of it . +activity N 1-4 Catalytic activity . They avoided all recreational activity . +terror N 2-3 He used terror to make them confess . He was the terror of the neighborhood . +landing N 5-1 The plane made a smooth landing . His landing on his feet was catlike . +flowage N 4-6 Rock fracture and rock flowage are different types of geological deformation . Many campsites were located near the flowage . +denizen N 5-7 The bald eagle is a denizen of the northern part of the state . The giant squid is one of many denizens of the deep . +sensation N 4-1 The news caused a sensation . A sensation of touch . +state V 0-0 State your name . State your opinion . +foot N 4-5 We went there by foot because we could not afford a taxi . There is a lot of foot traffic on this street . +dollar N 4-1 He worships the almighty dollar . The dollar coin has never been popular in the United States . +view N 6-10 They look the same in outward view . The most desirable feature of the park are the beautiful views . +need V 1-1 I need him to be nice . I needed him to go . +role N 5-2 My neighbor was the lead role in last year 's village play . Play its role . +policy N 9-3 You should have read the small print on your policy . It was a policy of retribution . +urgency N 7-7 They departed hurriedly because of some great urgency in their affairs . I 'll be there , barring any urgencies . +book N 5-13 I am reading a good book on economics . He was frustrated because he could n't find anything about dinosaurs in the book . +scrap N 7-8 The unhappy couple got into a terrible scrap . That car is n't good for anything but scrap . +mess V 1-3 I mess with the wardroom officers . The afternoon breeze messed up my hair . +recognition N 7-6 Territorial disputes were resolved in Guatemala 's recognition of Belize in 1991 . The partners were delighted with the recognition of their work . +hitter N 2-3 A hard hitter . Blacksmiths are good hitters . +affiliation N 3-2 A valuable financial affiliation . Welcomed the affiliation of the research center with the university . +mate N 4-9 He 's my best mate . I 'm going to the pub with a few mates . +middle N 2-3 In the middle of the marathon , David collapsed from fatigue . Rain during the middle of April . +diet N 1-6 The diet of the Giant Panda consists mainly of bamboo . He 's been reading a steady diet of nonfiction for the last several years . +induction N 6-1 He was ordered to report for induction into the army . The induction of an anesthetic state . +bull V 1-1 To bull railroad bonds . He bulled his way in . +impregnation N 1-1 The impregnation of wood with preservative . The impregnation , whatever it was , had turned the rock blue . +escalation N 4-4 Higher wages caused an escalation of prices . There was a gradual escalation of hostilities . +motivation N 5-1 We did not understand his motivation . His motivation was at a high level . +identity N 2-4 A right identity , x * I = x for any x in the structure . You can lose your identity when you join the army . +holiday N 4-6 Today is a Wiccan holiday ! No mail is delivered on federal holidays . +fire N 3-3 Clinton directed his fire at the Republican Party . There was a fire at the school last night and the whole place burned down . +average V 2-8 If you average 10 , 20 and 24 , you get 18 . The number of hours I work per work averages out to 40 . +addition N 1-1 The addition of a leap day every four years . The addition of a bathroom was a major improvement . +segment V 0-0 Segment a compound word . Segment an orange . +shoot V 0-0 Shoot cloth . Shoot a star . +education N 3-0 A girl 's education was less important than a boy 's . Education is a preparation for life . +succession N 1-1 A succession of failures . A succession of stalls offering soft drinks . +erase V 3-2 The files will erase quickly . The chalkboard erased easily . +crush V 1-2 To crush grapes . The car crushed the toy . +figure V 1-4 Elections figure prominently in every government program . How do the elections figure in the current pattern of internal politics ? +eliminate V 2-4 Let 's eliminate the course on Akkadian hieroglyphics . This possibility can be eliminated from our consideration . +house N 3-1 He counted the house . The house applauded . +cooperation N 1-6 Economic cooperation . They agreed on a policy of cooperation . +indent V 0-0 Indent the documents . Indent the paragraphs of a letter . +militia N 4-10 Their troops were untrained militia . Congress shall have power to provide for calling forth the militia -- United States Constitution . +probation N 0-4 Probation is part of the sentencing process . You 'll be on probation for first six months . After that , if you work out , they 'll hire you permanently . +bag V 0-1 Bag a few pheasants . We bagged three deer yesterday . +herald N 4-4 Rouge Dragon is a herald at the College of Arms . The chieftain had a herald who announced his arrival with a trumpet . +detention N 1-1 His detention was politically motivated . The detention of tardy pupils . +spread V 2-4 The invaders spread their language all over the country . A big oil spot spread across the water . +accession N 0-5 Accession to such demands would set a dangerous precedent . The librarian shelved the new accessions . +switch V 0-3 Switch to a different brand of beer . I want to switch this red dress for a green one . +hang V 2-0 Let 's hang this cute animal in the nursery . Hang wallpaper . +association N 9-5 You can not be convicted of criminal guilt by association . He joined the Modern Language Association . +drop N 8-4 It was a miracle that he survived the drop from that height . That was a long drop , but fortunately I did n't break any bones . +precaution N 10-2 He put an ice pack on the injury as a precaution . To take precautions against risks of accident . +experience N 2-0 A surprising experience . Experience is the best teacher . +undo V 0-3 Undo the shoelace . A single mistake undid the President and he had to resign . +relief N 4-2 He has been on relief for many years . Was the relief supposed to be protection from future harm or compensation for past injury ? +adhocracy N 8-5 The need for informational flexibility can lead to adhocracy . The choice between bureaucracy and adhocracy represents a common dilemma . +nightlife N 4-5 In the summer the nightlife shifts to the dance clubs . A futile search for intelligent nightlife . +pencil N 2-6 An eyebrow pencil . This artist 's favorite medium is pencil . +poster N 3-1 I saw a poster for it on the side of a bus . A poster advertised the coming attractions . +word N 3-10 We had a word or two about it . There was then a long discussion of whether to capitalize words like " east " . +want V 0-2 Want the strength to go on living . Flood victims wanting food and shelter . +gauntlet N 3-3 Threw down the gauntlet . Took up the gauntlet . +bull N 3-4 He was a bull of a man . He made a bad bull of the assignment . +flick V 0-1 Flick a piece of paper across the table . He flicked his Bic . +treatment N 1-1 His treatment of the race question is badly biased . His treatment of space borrows from Italian architecture . +authority N 6-5 She lost all her respect and authority after turning up drunk to the meeting . This book is the final authority on the life of Milton . +grunt N 3-5 He went from grunt to chairman in six years . Infantrymen in Vietnam were called grunts . +toast N 5-5 That toaster can make wonderful toasts . I ate a piece of toast for breakfast . +hour N 3-4 We live an hour from the airport . It was their finest hour . +dig N 7-3 They set up camp next to the dig . She takes a dig at me every chance she gets . +dish N 4-6 They served me a dish of rice . We gave them a set of dishes for a wedding present . +death N 5-5 The animal died a painful death . He seemed more content in death than he had ever been in life . +upgrade N 6-9 The power plant received a new upgrade . With my phone company , I get a free upgrade every twelve months if I keep topping up 10 pounds a month . +afflict V 0-2 Afflict with the plague . She was afflicted by the death of her parents . +post V 0-2 Post a warning at the dump . The newspaper posted him in Timbuktu . +group N 3-1 There is a group of houses behind the hill . A group of people gathered in front of the Parliament to demonstrate against the Prime Minister 's proposals . +pinnacle V 0-6 Pinnacle a pediment . He did not want to be pinnacled . +bite V 4-4 Gunny invariably tried to bite her . As soon as you bite that sandwich , you 'll know how good it is . +finalize V 2-11 Let 's finalize the proposal . As soon as we get the plane tickets , we 'll finalize our reservations with the hotel . +lie V 0-1 Lie down on the bed until you feel better . She lied when she told me she was only 29 . +agency N 3-2 She has free agency . Central Intelligence Agency . +string N 1-1 A string of islands . The strings played superlatively well . +gnash V 1-1 To gnash the air in fury . To gnash a carpet . +twist V 2-0 Do n't twist my words . Twist the dough into a braid . +invite V 2-2 Can I invite you for dinner on Sunday night ? The organizers invite submissions of papers for the conference . +brush V 0-0 Brush aside the objections . Brush the dust from the jacket . +dad N 5-0 He had n't seen his dad in years . Dad , happy Father 's Day ! +render V 0-6 Render the brick walls in the den . The face of the child is rendered with much tenderness in this painting . +kinship N 2-3 Anthropology 's kinship with the humanities . Felt a deep kinship with the other students . +agency N 3-3 The superintendence and agency of Providence in the natural world . --Woodward . The Central Intelligence Agency . +breakdown N 8-5 After so much stress , he suffered a breakdown and simply gave up . His warning came after the breakdown of talks in London . +combust V 1-2 We combust coal and other fossil fuels . The professor combusted when the student did n't know the answer to a very elementary question . +writing N 0-9 Writing was a form of therapy for him . The idea occurs with increasing frequency in Hemingway 's writings . +inadequacy N 5-1 Juvenile offenses often reflect an inadequacy in the parents . The inadequacy of unemployment benefits . +step N 2-2 Always a step behind . Keep in step with the fashions . +flip V 2-1 I 'd flip if anyone broke my phone . He flipped when he heard that he was accepted into Princeton University . +reappearance N 1-1 The reappearance of Halley 's comet . His reappearance as Hamlet has been long awaited . +usage N 1-1 English usage . A usage borrowed from French . +gig N 3-5 They played a gig in New Jersey . Our guitar player had another gig so we had to get a sub . +demon N 3-4 She 's a demon at math . He worked like a demon to finish the job on time . +eccentricity N 5-7 For an ellipse , the eccentricity is the ratio of the distance from the center to a focus divided by the length of the semi - major axis . A circle is an ellipse with zero eccentricity . +allowance N 2-1 My weekly allowance of two eggs . Travel allowance . +transplant V 5-0 These delicate plants do not transplant easily . Transplant the young rice plants . +middle N 5-8 I woke up in the middle of the night . A whole is that which has beginning , middle , and end - Aristotle . +spin N 5-4 The campaign put a favorable spin on the story . The skaters demonstrated their spins . +heel V 0-0 Heel a golf ball . Heel that dance . +socialization N 1-4 Force socialization rarely creates strong friendships , but there are exceptions . There was too much socialization with the enlisted men . +attend V 2-1 I rarely attend services at my church . She attends class regularly . +oppression N 3-1 The tyrant 's oppression of the people . The oppression of the poor by the aristocracy was one cause of the French Revolution . +tap V 0-1 Tap a cask of wine . He tapped a new barrel of beer . +touch V 12-1 Please can I have a look , if I promise not to touch ? Carrie touched his shoulder with the stick . +work N 6-1 He was indebted to the pioneering work of John Dewey . The work of an active imagination . +construction N 5-0 The engineer marvelled at his construction . Construction is underway on the new bridge . +catch V 10-1 I would love to have dinner but I have to catch a plane . We caught something of his theory in the lecture . +segregate V 5-2 Experiments show clearly that genes segregate . Many towns segregated into new counties . +border N 6-1 The rug had a wide blue border . The borders of the garden . +scavenge V 1-1 Hyenas scavenge . She scavenged the garbage cans for food . +manipulation N 1-11 His manipulation of his friends was scandalous . He found that the new manager was known for his Machiavellian manipulations in his last two positions . +flood V 0-3 Flood the market with tennis shoes . The swollen river flooded the village . +steam V 1-7 Just steam the vegetables . Her indifference to his amorous advances really steamed the young man . +foundation N 3-2 He lacks the foundation necessary for advanced study . The Wikimedia Foundation , Inc. is the parent organization of the Wiktionary collaborative project . +twilight N 9-3 I could just make out her face in the twilight . He loved the twilight . +rank N 7-4 The strike was supported by the union rank and file . He rose from the ranks to become a colonel . +delight N 5-1 The new car is a delight . His delight to see her was obvious to all . +path N 1-1 The path of virtue . Our paths in life led us apart . +get V 4-2 The operator could n't get Kobe because of the earthquake . I 'll get this finished by lunchtime . +forwarding N 1-1 The forwarding of resumes to the personnel department . The forwarding of mail to a new address is done automatically . +fail V 2-4 Did I fail the test ? She studied hard but failed nevertheless . +dimple N 4-4 The accident created a dimple in the hood of the car . There are approximately 336 dimples on a golf ball . +pity N 3-7 It 's a pity he could n't do it . The blind are too often objects of pity . +rail N 4-3 He was concerned with rail safety . He traveled by rail . +preempt V 6-6 Discussion of the emergency situation will preempt the lecture by the professor . Live broadcast of the presidential debate preempts the regular news hour . +assumption N 2-13 The Nazi assumption of power in 1934 . He acquired all the company 's assets for ten million dollars and the assumption of the company 's debts . +brother N 6-3 I would like to thank the brother who just spoke . None of his brothers would betray him . +recruit V 0-3 Recruit new soldiers . The lab director recruited an able crew of assistants . +upset V 1-3 Truman upset Dewey in the 1948 US presidential election . The foreign team upset the local team . +show N 1-2 A show of impatience . A good show of looking interested . +fondler N 8-2 The woman charged that her jailer was a fondler . Not all fondlers are sexual perverts . +body N 2-2 The whole body filed out of the auditorium . The student body . +destroy V 1-2 Hooligans destroy unprovoked . The fire destroyed the house . +confusion N 4-1 The army retreated in confusion . A confusion of impressions . +stress N 4-3 Some people put the stress on the first syllable of “ controversy ” ; others put it on the second . The intensity of stress is expressed in units of force divided by units of area . +inject V 0-5 Inject hydrogen into the balloon . Now lie back while we inject you with the anesthetic . +custody N 6-4 He was mistreated while in police custody . He is in the custody of police . +gesture N 2-1 A political gesture . A gesture of defiance . +cleat V 0-0 Cleat runni…
# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/latest/usage/project/#working-with-version-control .pdm.toml .pdm-python .pdm-build/ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear
When two developers are working on a projet with different operating systems, the
Pipfile.lock
is different (especially the part insidehost-environment-markers
).For Composer, most people recommend to commit
composer.lock
. Do we have to do the same for Pipenv?The text was updated successfully, but these errors were encountered: