Skip to content

Commit c9a6d92

Browse files
authored
Merge branch 'master' into python-inherit-list-userlist
2 parents 840b010 + 26a9ae5 commit c9a6d92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+677
-445
lines changed

.circleci/config.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/linters.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Check that code is formatted consistently
2+
#
3+
# Available Python versions:
4+
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
5+
6+
name: linters
7+
on:
8+
push:
9+
branches:
10+
- master
11+
pull_request:
12+
13+
jobs:
14+
tests:
15+
name: ${{ matrix.name }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- {name: Linux311, python: '3.11.0-rc.1', os: ubuntu-latest}
22+
steps:
23+
- name: Check out repository
24+
uses: actions/checkout@v2
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ matrix.python }}
30+
31+
- name: Restore cache
32+
id: cache
33+
uses: actions/cache@v3
34+
with:
35+
path: ./venv
36+
key: ${{ matrix.name }}-pip-${{ hashFiles('requirements.txt') }}
37+
restore-keys: |
38+
${{ matrix.name }}-pip-
39+
40+
- name: Install dependencies
41+
if: steps.cache.outputs.cache-hit != 'true'
42+
run: |
43+
python -m venv venv
44+
. venv/bin/activate
45+
python -m pip install --upgrade pip
46+
python -m pip install -r requirements.txt
47+
48+
- name: Check code style
49+
run: |
50+
. venv/bin/activate
51+
python -m flake8
52+
python -m black --check .
53+
54+
- name: Check directory layout
55+
run: |
56+
. venv/bin/activate
57+
python .github/workflows/dircheck.py

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
Bonus materials, exercises, and example projects for Real Python's [Python tutorials](https://realpython.com).
44

5-
Build Status: [![CircleCI](https://circleci.com/gh/realpython/materials.svg?style=svg)](https://circleci.com/gh/realpython/materials)
5+
Build Status:
6+
[![GitHub Actions](https://img.shields.io/github/workflow/status/realpython/materials/linters?label=build)](https://github.com/realpython/materials/actions)
67

78
## Got a Question?
89

9-
The best way to get support for Real Python courses & articles and code in this repository is to join one of our [weekly Office Hours calls](https://realpython.com/office-hours/) or to ask your question in the [RP Community Slack](https://realpython.com/community/).
10+
The best way to get support for Real Python courses, articles, and code in this repository is to join one of our [weekly Office Hours calls](https://realpython.com/office-hours/) or to ask your question in the [RP Community Slack](https://realpython.com/community/).
1011

11-
Due to time constraints we cannot provide 1:1 support via GitHub. See you on Slack or on the next Office Hours call 🙂
12+
Due to time constraints, we cannot provide 1:1 support via GitHub. See you on Slack or on the next Office Hours call 🙂
1213

1314
## Adding Source Code & Sample Projects to This Repo (RP Contributors)
1415

1516
### Running Code Style Checks
1617

17-
We use [flake8](http://flake8.pycqa.org/en/latest/) and [black](https://github.com/ambv/black) to ensure a consistent code style for all of our sample code in this repository.
18+
We use [flake8](http://flake8.pycqa.org/en/latest/) and [black](https://black.readthedocs.io/) to ensure a consistent code style for all of our sample code in this repository.
1819

1920
Run the following commands to validate your code against the linters:
2021

@@ -25,11 +26,11 @@ $ black --check .
2526

2627
### Running Python Code Formatter
2728

28-
We're using a tool called [black](https://github.com/ambv/black) on this repo to ensure consistent formatting. On CI it runs in "check" mode to ensure any new files added to the repo are following PEP 8. If you see linter warnings that say something like "would reformat some_file.py" it means black disagrees with your formatting.
29+
We're using a tool called [black](https://black.readthedocs.io/) on this repo to ensure consistent formatting. On CI it runs in "check" mode to ensure any new files added to the repo follow PEP 8. If you see linter warnings that say something like "would reformat some_file.py" it means that black disagrees with your formatting.
2930

30-
**The easiest way to resolve these errors is to just run Black locally on the code and then committing those changes, as explained below.**
31+
**The easiest way to resolve these errors is to run Black locally on the code and then commit those changes, as explained below.**
3132

32-
To automatically re-format your code to be consistent with our code style guidelines, run [black](https://github.com/ambv/black) in the repository root folder:
33+
To automatically re-format your code to be consistent with our code style guidelines, run [black](https://black.readthedocs.io/) in the repository root folder:
3334

3435
```sh
3536
$ black .

build-a-web-scraper/01_inspect.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,6 +1718,7 @@
17181718
],
17191719
"source": [
17201720
"from IPython.display import HTML\n",
1721+
"\n",
17211722
"HTML(\"https://www.indeed.com/jobs?q=python&l=new+york\")"
17221723
]
17231724
},

build-a-web-scraper/02_scrape.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"outputs": [],
6363
"source": [
6464
"# let's try a string search\n",
65-
"loc = str(response.content).find('python')\n",
65+
"loc = str(response.content).find(\"python\")\n",
6666
"loc"
6767
]
6868
},
@@ -72,7 +72,7 @@
7272
"metadata": {},
7373
"outputs": [],
7474
"source": [
75-
"response.content[loc-10:loc+10]"
75+
"response.content[loc - 10 : loc + 10]"
7676
]
7777
},
7878
{
@@ -83,7 +83,8 @@
8383
"source": [
8484
"# what about regex?\n",
8585
"import re\n",
86-
"re.findall(r'python', str(response.content))"
86+
"\n",
87+
"re.findall(r\"python\", str(response.content))"
8788
]
8889
},
8990
{
@@ -110,7 +111,7 @@
110111
"metadata": {},
111112
"outputs": [],
112113
"source": [
113-
"res = requests.get('https://api.github.com/user')"
114+
"res = requests.get(\"https://api.github.com/user\")"
114115
]
115116
},
116117
{
@@ -148,7 +149,7 @@
148149
"metadata": {},
149150
"outputs": [],
150151
"source": [
151-
"res = requests.get('https://twitter.com/search?q=realpython')"
152+
"res = requests.get(\"https://twitter.com/search?q=realpython\")"
152153
]
153154
},
154155
{

build-a-web-scraper/03_parse.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@
13801380
"metadata": {},
13811381
"outputs": [],
13821382
"source": [
1383-
"results = soup.find(id='resultsCol')"
1383+
"results = soup.find(id=\"resultsCol\")"
13841384
]
13851385
},
13861386
{
@@ -1950,7 +1950,7 @@
19501950
"metadata": {},
19511951
"outputs": [],
19521952
"source": [
1953-
"jobs = results.find_all('div', class_='result')"
1953+
"jobs = results.find_all(\"div\", class_=\"result\")"
19541954
]
19551955
},
19561956
{
@@ -2053,7 +2053,7 @@
20532053
}
20542054
],
20552055
"source": [
2056-
"title = jobs[0].find('h2')\n",
2056+
"title = jobs[0].find(\"h2\")\n",
20572057
"title"
20582058
]
20592059
},
@@ -2075,7 +2075,7 @@
20752075
}
20762076
],
20772077
"source": [
2078-
"title_link = title.find('a')\n",
2078+
"title_link = title.find(\"a\")\n",
20792079
"title_link"
20802080
]
20812081
},
@@ -2134,7 +2134,7 @@
21342134
"metadata": {},
21352135
"outputs": [],
21362136
"source": [
2137-
"job_titles = [job.find('h2').find('a').text.strip() for job in jobs]"
2137+
"job_titles = [job.find(\"h2\").find(\"a\").text.strip() for job in jobs]"
21382138
]
21392139
},
21402140
{
@@ -2213,7 +2213,7 @@
22132213
}
22142214
],
22152215
"source": [
2216-
"title_link['href']"
2216+
"title_link[\"href\"]"
22172217
]
22182218
},
22192219
{
@@ -2241,7 +2241,7 @@
22412241
],
22422242
"source": [
22432243
"base_url = \"https://www.indeed.com\"\n",
2244-
"job_url = base_url + title_link['href']\n",
2244+
"job_url = base_url + title_link[\"href\"]\n",
22452245
"job_url"
22462246
]
22472247
},

0 commit comments

Comments
 (0)