├── .github └── workflows │ ├── golangci-lint.yml │ └── python.yml ├── README.md ├── golang ├── .golangci.yml ├── .vscode │ ├── launch.json │ └── settings.json ├── README.md ├── go.mod ├── go.sum ├── informatics.code-workspace ├── internal │ └── sample.go ├── main.go └── tests │ └── sample_test.go └── python ├── .flake8 ├── .gitignore ├── .vscode ├── launch.json └── settings.json ├── Pipfile ├── Pipfile.lock ├── README.md ├── informatics.code-workspace ├── requirements.txt ├── src ├── __init__.py └── main.py └── tests ├── __init__.py └── test_main.py /.github/workflows/golangci-lint.yml: -------------------------------------------------------------------------------- 1 | name: golangci-lint 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | golangci: 6 | name: lint 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/setup-go@v3 10 | with: 11 | go-version: 1.17 12 | - uses: actions/checkout@v3 13 | - name: golangci-lint 14 | uses: golangci/golangci-lint-action@v3 15 | with: 16 | # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version 17 | version: v1.50.1 18 | working-directory: golang 19 | args: -v --print-resources-usage --timeout=180s --config=.golangci.yml 20 | - name: Test 21 | run: | 22 | cd golang 23 | go test -count=1 -p 1 -v ./... 24 | 25 | -------------------------------------------------------------------------------- /.github/workflows/python.yml: -------------------------------------------------------------------------------- 1 | name: Python package 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | strategy: 10 | matrix: 11 | python-version: ["3.9"] 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | - name: Set up Python ${{ matrix.python-version }} 16 | uses: actions/setup-python@v4 17 | with: 18 | python-version: ${{ matrix.python-version }} 19 | - name: Install dependencies 20 | run: | 21 | cd ./python 22 | pip install -r requirements.txt 23 | - name: Lint with flake8 24 | run: | 25 | cd ./python 26 | flake8 ./ 27 | - name: Lint with MyPy 28 | run: | 29 | cd ./python 30 | mypy ./ 31 | - name: Test with unittest 32 | run: | 33 | cd ./python 34 | python -m unittest 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Репозиторий для работ по курсу информатика 2 | 3 | Вот сюда нужно будет в первой работе с гитом добавит свое ФИО 4 | 5 | ## ФИО 6 | 7 | ## Работа с репозиторием 8 | 9 | В репозитории присутствуют 2 каталога - для рабработчиков на python и golang. 10 | 11 | Необходимо выбрать ваш стек и в соответствующем каталоге открыть файл проекта `informatics.code-workspace` через vscode. 12 | Для тех, кто использует другие среды разработки - пишите в чат, попробуем помочь настроить. Дальнейшие инструкции для каждого 13 | соответствующего проекта находятся в соответствующем `README.md` файле проекта. 14 | 15 | ## Примеры работы с markdown 16 | 17 | Обычный текст. 18 | Еще текст на той же строке (в том же абзаце). 19 | 20 | Текст в новом абзаце 21 | 22 | ## Подзаголовок 23 | 24 | ``` 25 | Блок кода 26 | ``` 27 | 28 | ```python 29 | print("Hello world") 30 | ``` 31 | -------------------------------------------------------------------------------- /golang/.golangci.yml: -------------------------------------------------------------------------------- 1 | run: 2 | tests: false 3 | skip-files: 4 | - \.pb\.go$ 5 | - \.pb\.validate\.go$ 6 | - \.pb\.gw\.go$ 7 | 8 | linters-settings: 9 | dupl: 10 | threshold: 500 11 | # commented linter rules should be uncommented when corresponding linter will be enabled 12 | # funlen: 13 | # lines: 160 14 | # statements: 60 15 | gci: 16 | local-prefixes: github.com/golangci/golangci-lint 17 | # revive: 18 | # min-confidence: 0 19 | # gomnd: 20 | # checks: 21 | # - argument 22 | # - case 23 | # - condition 24 | # - return 25 | lll: 26 | line-length: 160 27 | 28 | linters: 29 | # please, do not use `enable-all`: it's deprecated and will be removed soon. 30 | # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint 31 | # Disabled linters should be enabled later 32 | disable-all: true 33 | enable: 34 | - asciicheck 35 | - bidichk 36 | - bodyclose 37 | - containedctx 38 | # - deadcode 39 | - decorder 40 | - depguard 41 | - dogsled 42 | - dupl 43 | - durationcheck 44 | # - errcheck 45 | - errchkjson 46 | # - errname 47 | - errorlint 48 | - execinquery 49 | - exportloopref 50 | # - forbidigo 51 | - forcetypeassert 52 | # - funlen 53 | - gocognit 54 | - goconst 55 | # - gocritic 56 | - gocyclo 57 | # - gofmt 58 | # - gofumpt 59 | - goheader 60 | # - goimports 61 | # - gomnd 62 | - gomodguard 63 | - goprintffuncname 64 | - gosec 65 | - gosimple 66 | - govet 67 | - grouper 68 | # - ifshort 69 | - importas 70 | - ineffassign 71 | - lll 72 | # - maintidx 73 | - makezero 74 | # - misspell 75 | - nakedret 76 | - nestif 77 | - nilerr 78 | - nilnil 79 | - noctx 80 | # - nolintlint 81 | - nosprintfhostport 82 | - paralleltest 83 | # - prealloc 84 | # - predeclared 85 | - promlinter 86 | # - revive 87 | - rowserrcheck 88 | - sqlclosecheck 89 | # - structcheck 90 | # - stylecheck 91 | # - tagliatelle 92 | - tenv 93 | - testpackage 94 | - tparallel 95 | - typecheck 96 | - unconvert 97 | - unparam 98 | - unused 99 | # - varcheck 100 | - wastedassign 101 | - whitespace 102 | 103 | issues: 104 | # Excluding configuration per-path, per-linter, per-text and per-source 105 | exclude-rules: 106 | - path: _test\.go 107 | linters: 108 | - gomnd 109 | - text: "File is not `goimports`-ed with -local github.com/golangci/golangci-lint" 110 | linters: 111 | - goimports 112 | -------------------------------------------------------------------------------- /golang/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Launch Package", 9 | "type": "go", 10 | "request": "launch", 11 | "mode": "auto", 12 | "program": "${fileDirname}", 13 | "console": "integratedTerminal", 14 | "args": ["sample"], 15 | "showLog": true 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /golang/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "go.lintTool": "golangci-lint", 3 | "go.lintFlags": ["--fast"] 4 | } 5 | -------------------------------------------------------------------------------- /golang/README.md: -------------------------------------------------------------------------------- 1 | # Работа с проектом 2 | 3 | `vscode` при старте предложит установить рекомендованныек расширения - с ним лучше согласиться. 4 | 5 | 6 | ## Настройка окружения 7 | 8 | ### Golang 9 | 10 | Установите `golang` для соответствующей операционной системы. 11 | 12 | Запустите выкачивание зависимостей 13 | 14 | ```shell 15 | go mod tidy 16 | ``` 17 | 18 | Для локальной проверки линтером следует установить линтер. Устанавливать следует из git bash терминала в случае `windows` 19 | 20 | ```shell 21 | # binary will be $(go env GOPATH)/bin/golangci-lint 22 | curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1 23 | ``` 24 | 25 | Для запуска линтера следует выполнить следующую команду 26 | ```shell 27 | $(go env GOPATH)/bin/golangci-lint run -vvv --out-format tab --print-resources-usage --timeout=180s --config=.golangci.yml 28 | ``` 29 | 30 | ### Запуск тестов 31 | 32 | ```shell 33 | go test -count=1 -p 1 -v ./... 34 | ``` -------------------------------------------------------------------------------- /golang/go.mod: -------------------------------------------------------------------------------- 1 | module isuct.ru/informatics2022 2 | 3 | go 1.16 4 | 5 | require github.com/stretchr/testify v1.8.1 6 | -------------------------------------------------------------------------------- /golang/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 5 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 6 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 7 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 8 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 9 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 10 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 11 | github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= 12 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 13 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 14 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 15 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 16 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 17 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 18 | -------------------------------------------------------------------------------- /golang/informatics.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | }, 6 | ], 7 | "settings": { 8 | "files.exclude": { 9 | "**/.git": true, 10 | }, 11 | }, 12 | "extensions": { 13 | "recommendations": [ 14 | "golang.go", 15 | "eamodio.gitlens" 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /golang/internal/sample.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | func Summ(a, b int) int { 4 | return a + b 5 | } 6 | -------------------------------------------------------------------------------- /golang/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | fmt.Println("Hello world") 7 | } 8 | -------------------------------------------------------------------------------- /golang/tests/sample_test.go: -------------------------------------------------------------------------------- 1 | package internal_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "isuct.ru/informatics2022/internal" 7 | ) 8 | 9 | func TestSumm(t *testing.T) { 10 | summ := internal.Summ(2, 3) 11 | if summ != 5 { 12 | t.Fatalf(`Summ(2,3) = %d, want 5, error`, summ) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /python/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = E722 3 | max-line-length = 128 4 | -------------------------------------------------------------------------------- /python/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | *.out 54 | 55 | # Byte-compiled / optimized / DLL files 56 | __pycache__/ 57 | *.py[cod] 58 | *$py.class 59 | 60 | # C extensions 61 | *.so 62 | 63 | # Distribution / packaging 64 | .Python 65 | build/ 66 | develop-eggs/ 67 | dist/ 68 | downloads/ 69 | eggs/ 70 | .eggs/ 71 | lib/ 72 | lib64/ 73 | parts/ 74 | sdist/ 75 | var/ 76 | wheels/ 77 | share/python-wheels/ 78 | *.egg-info/ 79 | .installed.cfg 80 | *.egg 81 | MANIFEST 82 | 83 | # PyInstaller 84 | # Usually these files are written by a python script from a template 85 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 86 | *.manifest 87 | *.spec 88 | 89 | # Installer logs 90 | pip-log.txt 91 | pip-delete-this-directory.txt 92 | 93 | # Unit test / coverage reports 94 | htmlcov/ 95 | .tox/ 96 | .nox/ 97 | .coverage 98 | .coverage.* 99 | .cache 100 | nosetests.xml 101 | coverage.xml 102 | *.cover 103 | *.py,cover 104 | .hypothesis/ 105 | .pytest_cache/ 106 | cover/ 107 | 108 | # Translations 109 | *.mo 110 | *.pot 111 | 112 | # Django stuff: 113 | *.log 114 | local_settings.py 115 | db.sqlite3 116 | db.sqlite3-journal 117 | 118 | # Flask stuff: 119 | instance/ 120 | .webassets-cache 121 | 122 | # Scrapy stuff: 123 | .scrapy 124 | 125 | # Sphinx documentation 126 | docs/_build/ 127 | 128 | # PyBuilder 129 | .pybuilder/ 130 | target/ 131 | 132 | # Jupyter Notebook 133 | .ipynb_checkpoints 134 | 135 | # IPython 136 | profile_default/ 137 | ipython_config.py 138 | 139 | # pyenv 140 | # For a library or package, you might want to ignore these files since the code is 141 | # intended to run in multiple environments; otherwise, check them in: 142 | # .python-version 143 | 144 | # pipenv 145 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 146 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 147 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 148 | # install all needed dependencies. 149 | #Pipfile.lock 150 | 151 | # poetry 152 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 153 | # This is especially recommended for binary packages to ensure reproducibility, and is more 154 | # commonly ignored for libraries. 155 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 156 | #poetry.lock 157 | 158 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 159 | __pypackages__/ 160 | 161 | # Celery stuff 162 | celerybeat-schedule 163 | celerybeat.pid 164 | 165 | # SageMath parsed files 166 | *.sage.py 167 | 168 | # Environments 169 | .env 170 | .venv 171 | env/ 172 | venv/ 173 | ENV/ 174 | env.bak/ 175 | venv.bak/ 176 | 177 | # Spyder project settings 178 | .spyderproject 179 | .spyproject 180 | 181 | # Rope project settings 182 | .ropeproject 183 | 184 | # mkdocs documentation 185 | /site 186 | 187 | # mypy 188 | .mypy_cache/ 189 | .dmypy.json 190 | dmypy.json 191 | 192 | # Pyre type checker 193 | .pyre/ 194 | 195 | # pytype static type analyzer 196 | .pytype/ 197 | 198 | # Cython debug symbols 199 | cython_debug/ 200 | 201 | # PyCharm 202 | # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can 203 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 204 | # and can be added to the global gitignore or merged into this file. For a more nuclear 205 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 206 | #.idea/ -------------------------------------------------------------------------------- /python/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Python: Текущий файл", 9 | "type": "python", 10 | "request": "launch", 11 | "program": "${file}", 12 | "console": "integratedTerminal" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /python/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.linting.pylintEnabled": false, 3 | "python.linting.mypyEnabled": false, 4 | "python.linting.enabled": true, 5 | "python.linting.lintOnSave": true, 6 | "python.linting.flake8Enabled": true, 7 | } 8 | -------------------------------------------------------------------------------- /python/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | 8 | [dev-packages] 9 | mypy = "*" 10 | flake8 = "*" 11 | 12 | [requires] 13 | python_version = "3.9" 14 | 15 | [scripts] 16 | start = "python ./src/main.py" 17 | test = "python -m unittest" 18 | lint = "flake8 ./" 19 | lintMyPy = "mypy ./" 20 | -------------------------------------------------------------------------------- /python/Pipfile.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "hash": { 4 | "sha256": "4894b22932cc8c76e138c68198ce54cb057a7f4b391476c15e3e05d193ceb7f7" 5 | }, 6 | "pipfile-spec": 6, 7 | "requires": { 8 | "python_version": "3.9" 9 | }, 10 | "sources": [ 11 | { 12 | "name": "pypi", 13 | "url": "https://pypi.org/simple", 14 | "verify_ssl": true 15 | } 16 | ] 17 | }, 18 | "default": {}, 19 | "develop": { 20 | "flake8": { 21 | "hashes": [ 22 | "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db", 23 | "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248" 24 | ], 25 | "index": "pypi", 26 | "version": "==5.0.4" 27 | }, 28 | "mccabe": { 29 | "hashes": [ 30 | "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325", 31 | "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e" 32 | ], 33 | "markers": "python_version >= '3.6'", 34 | "version": "==0.7.0" 35 | }, 36 | "mypy": { 37 | "hashes": [ 38 | "sha256:1021c241e8b6e1ca5a47e4d52601274ac078a89845cfde66c6d5f769819ffa1d", 39 | "sha256:14d53cdd4cf93765aa747a7399f0961a365bcddf7855d9cef6306fa41de01c24", 40 | "sha256:175f292f649a3af7082fe36620369ffc4661a71005aa9f8297ea473df5772046", 41 | "sha256:26ae64555d480ad4b32a267d10cab7aec92ff44de35a7cd95b2b7cb8e64ebe3e", 42 | "sha256:41fd1cf9bc0e1c19b9af13a6580ccb66c381a5ee2cf63ee5ebab747a4badeba3", 43 | "sha256:5085e6f442003fa915aeb0a46d4da58128da69325d8213b4b35cc7054090aed5", 44 | "sha256:58f27ebafe726a8e5ccb58d896451dd9a662a511a3188ff6a8a6a919142ecc20", 45 | "sha256:6389af3e204975d6658de4fb8ac16f58c14e1bacc6142fee86d1b5b26aa52bda", 46 | "sha256:724d36be56444f569c20a629d1d4ee0cb0ad666078d59bb84f8f887952511ca1", 47 | "sha256:75838c649290d83a2b83a88288c1eb60fe7a05b36d46cbea9d22efc790002146", 48 | "sha256:7b35ce03a289480d6544aac85fa3674f493f323d80ea7226410ed065cd46f206", 49 | "sha256:85f7a343542dc8b1ed0a888cdd34dca56462654ef23aa673907305b260b3d746", 50 | "sha256:86ebe67adf4d021b28c3f547da6aa2cce660b57f0432617af2cca932d4d378a6", 51 | "sha256:8ee8c2472e96beb1045e9081de8e92f295b89ac10c4109afdf3a23ad6e644f3e", 52 | "sha256:91781eff1f3f2607519c8b0e8518aad8498af1419e8442d5d0afb108059881fc", 53 | "sha256:a692a8e7d07abe5f4b2dd32d731812a0175626a90a223d4b58f10f458747dd8a", 54 | "sha256:a705a93670c8b74769496280d2fe6cd59961506c64f329bb179970ff1d24f9f8", 55 | "sha256:c6e564f035d25c99fd2b863e13049744d96bd1947e3d3d2f16f5828864506763", 56 | "sha256:cebca7fd333f90b61b3ef7f217ff75ce2e287482206ef4a8b18f32b49927b1a2", 57 | "sha256:d6af646bd46f10d53834a8e8983e130e47d8ab2d4b7a97363e35b24e1d588947", 58 | "sha256:e7aeaa763c7ab86d5b66ff27f68493d672e44c8099af636d433a7f3fa5596d40", 59 | "sha256:eaa97b9ddd1dd9901a22a879491dbb951b5dec75c3b90032e2baa7336777363b", 60 | "sha256:eb7a068e503be3543c4bd329c994103874fa543c1727ba5288393c21d912d795", 61 | "sha256:f793e3dd95e166b66d50e7b63e69e58e88643d80a3dcc3bcd81368e0478b089c" 62 | ], 63 | "index": "pypi", 64 | "version": "==0.982" 65 | }, 66 | "mypy-extensions": { 67 | "hashes": [ 68 | "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", 69 | "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8" 70 | ], 71 | "version": "==0.4.3" 72 | }, 73 | "pycodestyle": { 74 | "hashes": [ 75 | "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785", 76 | "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b" 77 | ], 78 | "markers": "python_version >= '3.6'", 79 | "version": "==2.9.1" 80 | }, 81 | "pyflakes": { 82 | "hashes": [ 83 | "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2", 84 | "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3" 85 | ], 86 | "markers": "python_version >= '3.6'", 87 | "version": "==2.5.0" 88 | }, 89 | "tomli": { 90 | "hashes": [ 91 | "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", 92 | "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f" 93 | ], 94 | "markers": "python_version < '3.11'", 95 | "version": "==2.0.1" 96 | }, 97 | "typing-extensions": { 98 | "hashes": [ 99 | "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa", 100 | "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e" 101 | ], 102 | "markers": "python_version >= '3.7'", 103 | "version": "==4.4.0" 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | # Работа с проектом 2 | 3 | `vscode` при старте предложит установить рекомендованныек расширения - с ним лучше согласиться. 4 | 5 | 6 | ## Настройка окружения 7 | 8 | ### Python 9 | 10 | Установите `python` для соответствующей операционной системы. 11 | 12 | **ВАЖНО** 13 | 14 | При установке в windows - укажите галочку - добавить python в переменную окружения `PATH` 15 | 16 | ### Pipenv 17 | 18 | Мы используем виртуальное окружение `pipenv`, для его установки используйте следующую команду: 19 | 20 | ```shell 21 | pip install pipenv 22 | ``` 23 | Установку требуется сделать только 1 раз, активацию - каждый раз когда вы перезапускаете терминал. 24 | 25 | 26 | Для активации виртуального окружения следует выполнить следующую команду, при этом выполнять ее нужно в каталоге текущего проекта `python` (рядом с текущим `README.md` файлом и содержит `Pipfile`) 27 | 28 | ``` 29 | pipenv shell 30 | ``` 31 | 32 | После этого необходимо установить зависимости, указанные в `pipenv` файле 33 | 34 | 35 | 36 | После установки pipenv при использовании `vscode` следует выбрать версию интерпретатора, привязанный к проекту. Для этого можно выполнить следующую последовательность действий. Настраивать требуется только 1 раз при настройке виртуального окружения. 37 | 38 | - Нажать комбинацию клавиш `ctrl-shift-p` 39 | - Начать писать `Reload window` 40 | - Начать писать `Python select interpreter` 41 | - Выбрать на уровне рабочей области 42 | - Найти свое окружение, скорее всего в его имени в скобках будет указано `(python-"НАБОР_СИМВОЛОВ")` 43 | 44 | Ваше рабочее окружение настроено и можете его иcпользовать. 45 | 46 | ### Доступные команды 47 | 48 | Команды проверок, запускаемые в `github actions` можно также запустить локально выполнением одной из следующих команд 49 | 50 | ```shell 51 | pipenv run test 52 | pipenv run lint 53 | pipenv run lintMyPy 54 | ``` -------------------------------------------------------------------------------- /python/informatics.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | }, 6 | ], 7 | "settings": { 8 | "files.exclude": { 9 | "**/.git": true, 10 | }, 11 | "editor.tabSize": 4, 12 | }, 13 | "extensions": { 14 | "recommendations": [ 15 | "ms-python.python", 16 | "eamodio.gitlens" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /python/requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ISUCT/Informatics_2024/9713c0fd8345ca33c965e2f49af07ddc386b292f/python/requirements.txt -------------------------------------------------------------------------------- /python/src/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ISUCT/Informatics_2024/9713c0fd8345ca33c965e2f49af07ddc386b292f/python/src/__init__.py -------------------------------------------------------------------------------- /python/src/main.py: -------------------------------------------------------------------------------- 1 | def summ(a: int, b: int) -> int: 2 | return a + b 3 | 4 | 5 | if __name__ == "__main__": 6 | print("Hello world") 7 | print(summ(3, 4)) 8 | -------------------------------------------------------------------------------- /python/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ISUCT/Informatics_2024/9713c0fd8345ca33c965e2f49af07ddc386b292f/python/tests/__init__.py -------------------------------------------------------------------------------- /python/tests/test_main.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from src import main 3 | 4 | 5 | class SummTests(unittest.TestCase): 6 | 7 | def test_positive(self): 8 | res = main.summ(2, 3) 9 | self.assertEqual(5, res) 10 | 11 | def test_zero(self): 12 | res = main.summ(0, 0) 13 | self.assertEqual(0, res) 14 | 15 | def test_one_negative(self): 16 | res = main.summ(-2, 3) 17 | self.assertEqual(1, res) 18 | 19 | def test_both_negative(self): 20 | res = main.summ(-2, -4) 21 | self.assertEqual(-6, res) 22 | 23 | def test_one_negative_zero_res(self): 24 | res = main.summ(-2, 2) 25 | self.assertEqual(0, res) 26 | 27 | def test_one_negative_and_text(self): 28 | try: 29 | main.summ(-2, "2") 30 | except: 31 | self.assertTrue(True) 32 | return 33 | self.fail() 34 | 35 | 36 | if __name__ == '__main__': 37 | unittest.main() 38 | --------------------------------------------------------------------------------