Compare commits

...

5 Commits

Author SHA1 Message Date
d28bd6ed1c Remove shebang 2022-11-02 10:02:34 -03:00
45c5b94e63 Add some lab 15 contents 2022-11-02 10:02:15 -03:00
0f1e8d5e36 Add run configs for lab 14 2022-11-02 09:43:37 -03:00
57405f5aac Fix python venv 2022-11-02 09:15:23 -03:00
8500f351fc Add lab 15 skeleton 2022-11-02 09:15:03 -03:00
35 changed files with 228 additions and 10 deletions

View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="client" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="L14" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/client.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="fizzbuzz" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="L14" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/fizzbuzz.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="humansize" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="L14" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/humansize.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="pytest" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="pytest --cov --cov-report=term-missing" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

8
labs/L15/.idea/.gitignore vendored Normal file
View File

@ -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

8
labs/L15/.idea/L15.iml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.10 (python-venv)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
labs/L15/.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (python-venv)" project-jdk-type="Python SDK" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/L15.iml" filepath="$PROJECT_DIR$/.idea/L15.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="globex" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="L15" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="C:\Users\Isaac\Documents\CS2613-Repo\cs2613-ishoebot\labs\L15\globex.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="pytest" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="pytest --cov --cov-report=term-missing" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

6
labs/L15/.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

22
labs/L15/globex.py Normal file
View File

@ -0,0 +1,22 @@
import glob
import os
# new_dir = os.path.expanduser("~/fcshome/cs2613/labs/test") # For lab machines
new_dir = os.path.abspath("C:\\Users\\Isaac\\Documents\\CS2613-Repo\\cs2613-ishoebot\\labs\\L14") # For local machine
python_files_for = []
for file in glob.glob("*.py"):
python_files_for.append(os.path.join(new_dir, file))
python_files_comp = [os.path.join(new_dir, file) for file in glob.glob("*.py")]
python_files_map = map(lambda file: os.path.join(new_dir, file), glob.glob("*.py"))
if __name__ == '__main__': # pragma: no cover
print(python_files_for)
print()
print(python_files_comp)
print()
print(list(python_files_map))

7
labs/L15/list2dict.py Normal file
View File

@ -0,0 +1,7 @@
def list2dict(lst):
lst_dict = dict()
counter = 1
for i in range(lst):
lst_dict[counter] = i
counter += 1
return lst_dict

9
labs/L15/test_globex.py Normal file
View File

@ -0,0 +1,9 @@
import globex
def test_for():
assert sorted(globex.python_files_for) == sorted(globex.python_files_comp)
def test_map():
assert sorted(globex.python_files_comp) == sorted(globex.python_files_map)

View File

@ -0,0 +1,10 @@
from list2dict import list2dict
def test_empty():
assert list2dict([]) == {}
def test_abc():
dictionary = list2dict(["a", "b", "c"])
assert dictionary == {1: 'a', 2: 'b', 3: 'c'}

View File

@ -1,6 +1,6 @@
../../Scripts/coverage-3.10.exe,sha256=ArPrBFGsegnWbuH3MK0p2BhX4DldZ7bTkMqwM_PPGGo,106435
../../Scripts/coverage.exe,sha256=ArPrBFGsegnWbuH3MK0p2BhX4DldZ7bTkMqwM_PPGGo,106435
../../Scripts/coverage3.exe,sha256=ArPrBFGsegnWbuH3MK0p2BhX4DldZ7bTkMqwM_PPGGo,106435
../../Scripts/coverage-3.10.exe,sha256=llYoqHrIkHftVkxbeITNE8gbnorOVN9DLlg07a84H1Y,106394
../../Scripts/coverage.exe,sha256=llYoqHrIkHftVkxbeITNE8gbnorOVN9DLlg07a84H1Y,106394
../../Scripts/coverage3.exe,sha256=llYoqHrIkHftVkxbeITNE8gbnorOVN9DLlg07a84H1Y,106394
coverage-6.5.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
coverage-6.5.0.dist-info/LICENSE.txt,sha256=6z17VIVGasvYHytJb1latjfSeS4mggayfZnnk722dUk,10351
coverage-6.5.0.dist-info/METADATA,sha256=BnxYhYwPb1FX7xduZGy53wqb0HjCJ60iwBfB_6d5dPY,8838

View File

@ -1,5 +1,5 @@
../../Scripts/py.test.exe,sha256=s3OL8zkHTSzouxxdW6So1dfi0qHObiUCY1RW5-8EAU8,106441
../../Scripts/pytest.exe,sha256=s3OL8zkHTSzouxxdW6So1dfi0qHObiUCY1RW5-8EAU8,106441
../../Scripts/py.test.exe,sha256=VYWhOHUkzySccFFnZsi1G3xQX026ULVUtczhm0R-Xz4,106400
../../Scripts/pytest.exe,sha256=VYWhOHUkzySccFFnZsi1G3xQX026ULVUtczhm0R-Xz4,106400
__pycache__/py.cpython-310.pyc,,
_pytest/__init__.py,sha256=4K-_CZFPuvNtJXNwxyTtnbmpjVkSb-dC75bs29Sg0d4,356
_pytest/__pycache__/__init__.cpython-310.pyc,,

View File

@ -44,7 +44,7 @@ deactivate () {
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV='C:\Users\Isaac\OneDrive - University of New Brunswick\Year 3 UNB\CS2613\Git\cs2613-ishoebot\utils\python-venv'
VIRTUAL_ENV='C:\Users\Isaac\Documents\CS2613-Repo\cs2613-ishoebot\utils\python-venv'
if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
fi

View File

@ -1,6 +1,6 @@
@echo off
set "VIRTUAL_ENV=C:\Users\Isaac\OneDrive - University of New Brunswick\Year 3 UNB\CS2613\Git\cs2613-ishoebot\utils\python-venv"
set "VIRTUAL_ENV=C:\Users\Isaac\Documents\CS2613-Repo\cs2613-ishoebot\utils\python-venv"
if defined _OLD_VIRTUAL_PROMPT (
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"

View File

@ -57,7 +57,7 @@ end
# Unset irrelevant variables.
deactivate nondestructive
set -gx VIRTUAL_ENV 'C:\Users\Isaac\OneDrive - University of New Brunswick\Year 3 UNB\CS2613\Git\cs2613-ishoebot\utils\python-venv'
set -gx VIRTUAL_ENV 'C:\Users\Isaac\Documents\CS2613-Repo\cs2613-ishoebot\utils\python-venv'
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
if test (echo $FISH_VERSION | head -c 1) -lt 3

View File

@ -1,6 +1,6 @@
# Setting all environment variables for the venv
let path-name = (if ((sys).host.name == "Windows") { "Path" } { "PATH" })
let virtual-env = "C:\Users\Isaac\OneDrive - University of New Brunswick\Year 3 UNB\CS2613\Git\cs2613-ishoebot\utils\python-venv"
let virtual-env = "C:\Users\Isaac\Documents\CS2613-Repo\cs2613-ishoebot\utils\python-venv"
let bin = "Scripts"
let path-sep = ";"
@ -38,4 +38,4 @@ let-env PROMPT_COMMAND = $new_prompt
# We are using alias as the function definitions because only aliases can be
# removed from the scope
alias pydoc = python -m pydoc
alias deactivate = source "C:\Users\Isaac\OneDrive - University of New Brunswick\Year 3 UNB\CS2613\Git\cs2613-ishoebot\utils\python-venv\Scripts\deactivate.nu"
alias deactivate = source "C:\Users\Isaac\Documents\CS2613-Repo\cs2613-ishoebot\utils\python-venv\Scripts\deactivate.nu"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.