Skip to content

Commit faf1c37

Browse files
committed
2 parents c2398c3 + dd6e22e commit faf1c37

File tree

1 file changed

+68
-59
lines changed

1 file changed

+68
-59
lines changed

talkmap_out.ipynb

Lines changed: 68 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"```bash\n",
1212
"sudo apt install jupyter\n",
1313
"sudo apt install python3-pip\n",
14-
"pip install getorg --upgrade\n",
14+
"pip install python-frontmatter getorg --upgrade\n",
1515
"```\n",
1616
"\n",
1717
"After which you can run this from the `_talks/` directory, via:\n",
@@ -29,24 +29,27 @@
2929
"metadata": {
3030
"collapsed": false,
3131
"execution": {
32-
"iopub.execute_input": "2025-02-22T01:30:05.703774Z",
33-
"iopub.status.busy": "2025-02-22T01:30:05.703517Z",
34-
"iopub.status.idle": "2025-02-22T01:30:06.843336Z",
35-
"shell.execute_reply": "2025-02-22T01:30:06.842591Z"
32+
"iopub.execute_input": "2025-02-25T02:57:21.388444Z",
33+
"iopub.status.busy": "2025-02-25T02:57:21.387866Z",
34+
"iopub.status.idle": "2025-02-25T02:57:22.511527Z",
35+
"shell.execute_reply": "2025-02-25T02:57:22.510903Z"
3636
}
3737
},
3838
"outputs": [
3939
{
4040
"name": "stdout",
4141
"output_type": "stream",
4242
"text": [
43-
"Requirement already satisfied: getorg in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (0.3.1)\r\n"
43+
"Collecting python-frontmatter\r\n",
44+
" Downloading python_frontmatter-1.1.0-py3-none-any.whl.metadata (4.1 kB)\r\n"
4445
]
4546
},
4647
{
4748
"name": "stdout",
4849
"output_type": "stream",
4950
"text": [
51+
"Requirement already satisfied: getorg in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (0.3.1)\r\n",
52+
"Requirement already satisfied: PyYAML in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from python-frontmatter) (6.0.2)\r\n",
5053
"Requirement already satisfied: geopy in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from getorg) (2.4.1)\r\n",
5154
"Requirement already satisfied: pygithub in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from getorg) (2.6.1)\r\n",
5255
"Requirement already satisfied: retrying in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from getorg) (1.3.4)\r\n",
@@ -57,20 +60,35 @@
5760
"Requirement already satisfied: typing-extensions>=4.0.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (4.12.2)\r\n",
5861
"Requirement already satisfied: urllib3>=1.26.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (2.3.0)\r\n",
5962
"Requirement already satisfied: Deprecated in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (1.2.18)\r\n",
60-
"Requirement already satisfied: six>=1.7.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from retrying->getorg) (1.17.0)\r\n"
63+
"Requirement already satisfied: six>=1.7.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from retrying->getorg) (1.17.0)\r\n",
64+
"Requirement already satisfied: cryptography>=3.4.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pyjwt[crypto]>=2.4.0->pygithub->getorg) (44.0.1)\r\n",
65+
"Requirement already satisfied: cffi>=1.4.1 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pynacl>=1.4.0->pygithub->getorg) (1.17.1)\r\n",
66+
"Requirement already satisfied: charset-normalizer<4,>=2 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.4.1)\r\n",
67+
"Requirement already satisfied: idna<4,>=2.5 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.10)\r\n",
68+
"Requirement already satisfied: certifi>=2017.4.17 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (2025.1.31)\r\n"
6169
]
6270
},
6371
{
6472
"name": "stdout",
6573
"output_type": "stream",
6674
"text": [
67-
"Requirement already satisfied: cryptography>=3.4.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pyjwt[crypto]>=2.4.0->pygithub->getorg) (44.0.1)\r\n",
68-
"Requirement already satisfied: cffi>=1.4.1 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pynacl>=1.4.0->pygithub->getorg) (1.17.1)\r\n",
69-
"Requirement already satisfied: charset-normalizer<4,>=2 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.4.1)\r\n",
70-
"Requirement already satisfied: idna<4,>=2.5 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.10)\r\n",
71-
"Requirement already satisfied: certifi>=2017.4.17 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (2025.1.31)\r\n",
7275
"Requirement already satisfied: wrapt<2,>=1.10 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from Deprecated->pygithub->getorg) (1.17.2)\r\n",
73-
"Requirement already satisfied: pycparser in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from cffi>=1.4.1->pynacl>=1.4.0->pygithub->getorg) (2.22)\r\n"
76+
"Requirement already satisfied: pycparser in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from cffi>=1.4.1->pynacl>=1.4.0->pygithub->getorg) (2.22)\r\n",
77+
"Downloading python_frontmatter-1.1.0-py3-none-any.whl (9.8 kB)\r\n"
78+
]
79+
},
80+
{
81+
"name": "stdout",
82+
"output_type": "stream",
83+
"text": [
84+
"Installing collected packages: python-frontmatter\r\n"
85+
]
86+
},
87+
{
88+
"name": "stdout",
89+
"output_type": "stream",
90+
"text": [
91+
"Successfully installed python-frontmatter-1.1.0\r\n"
7492
]
7593
},
7694
{
@@ -87,7 +105,8 @@
87105
],
88106
"source": [
89107
"# Start by installing the dependencies\n",
90-
"!pip install getorg --upgrade\n",
108+
"!pip install python-frontmatter getorg --upgrade\n",
109+
"import frontmatter\n",
91110
"import glob\n",
92111
"import getorg\n",
93112
"from geopy import Nominatim"
@@ -99,10 +118,10 @@
99118
"metadata": {
100119
"collapsed": false,
101120
"execution": {
102-
"iopub.execute_input": "2025-02-22T01:30:06.845946Z",
103-
"iopub.status.busy": "2025-02-22T01:30:06.845467Z",
104-
"iopub.status.idle": "2025-02-22T01:30:06.849121Z",
105-
"shell.execute_reply": "2025-02-22T01:30:06.848477Z"
121+
"iopub.execute_input": "2025-02-25T02:57:22.513776Z",
122+
"iopub.status.busy": "2025-02-25T02:57:22.513344Z",
123+
"iopub.status.idle": "2025-02-25T02:57:22.516648Z",
124+
"shell.execute_reply": "2025-02-25T02:57:22.516090Z"
106125
}
107126
},
108127
"outputs": [],
@@ -117,10 +136,10 @@
117136
"metadata": {
118137
"collapsed": true,
119138
"execution": {
120-
"iopub.execute_input": "2025-02-22T01:30:06.851364Z",
121-
"iopub.status.busy": "2025-02-22T01:30:06.850962Z",
122-
"iopub.status.idle": "2025-02-22T01:30:06.876444Z",
123-
"shell.execute_reply": "2025-02-22T01:30:06.875850Z"
139+
"iopub.execute_input": "2025-02-25T02:57:22.518622Z",
140+
"iopub.status.busy": "2025-02-25T02:57:22.518252Z",
141+
"iopub.status.idle": "2025-02-25T02:57:22.543417Z",
142+
"shell.execute_reply": "2025-02-25T02:57:22.542908Z"
124143
}
125144
},
126145
"outputs": [],
@@ -139,44 +158,34 @@
139158
"metadata": {
140159
"collapsed": false,
141160
"execution": {
142-
"iopub.execute_input": "2025-02-22T01:30:06.878925Z",
143-
"iopub.status.busy": "2025-02-22T01:30:06.878494Z",
144-
"iopub.status.idle": "2025-02-22T01:30:09.224074Z",
145-
"shell.execute_reply": "2025-02-22T01:30:09.223402Z"
161+
"iopub.execute_input": "2025-02-25T02:57:22.545540Z",
162+
"iopub.status.busy": "2025-02-25T02:57:22.545175Z",
163+
"iopub.status.idle": "2025-02-25T02:57:22.549637Z",
164+
"shell.execute_reply": "2025-02-25T02:57:22.549147Z"
146165
}
147166
},
148-
"outputs": [
149-
{
150-
"name": "stdout",
151-
"output_type": "stream",
152-
"text": [
153-
" \n",
154-
" None\n"
155-
]
156-
},
157-
{
158-
"name": "stdout",
159-
"output_type": "stream",
160-
"text": [
161-
" \n",
162-
" None\n"
163-
]
164-
}
165-
],
167+
"outputs": [],
166168
"source": [
167169
"# Perform geolocation\n",
168170
"for file in g:\n",
169-
" with open(file, 'r') as f:\n",
170-
" lines = f.read()\n",
171-
" if lines.find('location: \"') > 1:\n",
172-
" loc_start = lines.find('location: \"') + 11\n",
173-
" lines_trim = lines[loc_start:]\n",
174-
" loc_end = lines_trim.find('\"')\n",
175-
" location = lines_trim[:loc_end]\n",
176-
" \n",
177-
" \n",
178-
" location_dict[location] = geocoder.geocode(location)\n",
179-
" print(location, \"\\n\", location_dict[location])\n"
171+
" # Read the file\n",
172+
" data = frontmatter.load(file)\n",
173+
" data = data.to_dict()\n",
174+
"\n",
175+
" # Press on if the location is not present\n",
176+
" if 'location' not in data:\n",
177+
" continue\n",
178+
"\n",
179+
" # Prepare the description\n",
180+
" title = data['title'].strip()\n",
181+
" venue = data['venue'].strip()\n",
182+
" location = data['location'].strip()\n",
183+
" description = f\"{title}\\n{venue}; {location}\"\n",
184+
" print(description)\n",
185+
"\n",
186+
" # Geocode the location and report the status\n",
187+
" location_dict[description] = geocoder.geocode(location)\n",
188+
" print(description, location_dict[description])"
180189
]
181190
},
182191
{
@@ -185,10 +194,10 @@
185194
"metadata": {
186195
"collapsed": false,
187196
"execution": {
188-
"iopub.execute_input": "2025-02-22T01:30:09.226429Z",
189-
"iopub.status.busy": "2025-02-22T01:30:09.225951Z",
190-
"iopub.status.idle": "2025-02-22T01:30:09.233806Z",
191-
"shell.execute_reply": "2025-02-22T01:30:09.233240Z"
197+
"iopub.execute_input": "2025-02-25T02:57:22.551418Z",
198+
"iopub.status.busy": "2025-02-25T02:57:22.551243Z",
199+
"iopub.status.idle": "2025-02-25T02:57:22.558593Z",
200+
"shell.execute_reply": "2025-02-25T02:57:22.557942Z"
192201
}
193202
},
194203
"outputs": [

0 commit comments

Comments
 (0)