Skip to content

Instantly share code, notes, and snippets.

Avatar

Robin Wilson robintw

View GitHub Profile
View Untitled-1
====
With normal output
====
2021-10-09 21:50:37.540 | DEBUG | prompt_toolkit.key_binding.bindings.focus:focus_next:21 - Set focus to [('[SetMenuPosition]', ''), ('class:dropdown.text', ' Select column ',...
2021-10-09 21:50:38.057 | DEBUG | prompt_toolkit.key_binding.bindings.focus:focus_next:21 - Set focus to [('[SetMenuPosition]', ''), ('class:dropdown.text', ' = ',...
===
With DummyOutput
===
2021-10-09 21:51:12.538 | DEBUG | prompt_toolkit.key_binding.bindings.focus:focus_next:21 - Set focus to [('class:button.arrow', '<', <function Button._get_text_fragments.<locals>.handler at 0x119a321f0>), ('[SetCursorPosition]', ''), ('class:button.text', 'Add filter condition'...
View test_gui_interactively.py
import asyncio
from prompt_toolkit.application import create_app_session
from prompt_toolkit.input.base import DummyInput
from prompt_toolkit.key_binding.key_processor import KeyPress
from prompt_toolkit.keys import Keys
from prompt_toolkit.output import DummyOutput
from pepys_admin.maintenance.dialogs.help_dialog import HelpDialog
from pepys_admin.maintenance.gui import MaintenanceGUI
View Untitled-1
async def test_select_platform_type(test_datastore):
# Test application in a dummy session.
input = DummyInput()
output = DummyOutput()
# output = None
with create_app_session(output=output, input=input):
gui = MaintenanceGUI(test_datastore)
task = asyncio.create_task(gui.app.run_async())
View test_pepys_gui_v2.py
import asyncio
from contextlib import asynccontextmanager
from prompt_toolkit.application import create_app_session
from prompt_toolkit.input import create_pipe_input
from prompt_toolkit.input.ansi_escape_sequences import REVERSE_ANSI_SEQUENCES
from prompt_toolkit.input.base import DummyInput
from prompt_toolkit.key_binding.key_processor import KeyPress
from prompt_toolkit.keys import Keys
from prompt_toolkit.output import DummyOutput
View test_pepys_gui.py
async def test_select_platform_type(test_datastore):
# Test application in a dummy session.
input = DummyInput()
# output = DummyOutput()
output = None
with create_app_session(output=output, input=input):
gui = MaintenanceGUI(test_datastore)
# Run the application.
View Example Periodic Callback.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Example Periodic Callback.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:a555b81f29c9b40581c510dea67e6351
[Info - 7:54:19 PM] Pylance language server 2020.6.1 starting
[Info - 7:54:19 PM] Server root directory: /Users/robin/.vscode-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server
[Info - 7:54:19 PM] No configuration file found.
[Info - 7:54:19 PM] Setting pythonPath for service "pepys-import": "/Users/robin/anaconda3/envs/pepys/bin/python"
[Info - 7:54:20 PM] stubPath /Users/robin/Documents/IanMayo/pepys-import/typings is not a valid directory.
[Info - 7:54:20 PM] Assuming Python version 3.7
[Info - 7:54:20 PM] Assuming Python platform Darwin
[Info - 7:54:20 PM] Searching for source files
[Info - 7:54:20 PM] Found 181 source files
[Info - 7:54:20 PM] Background analysis root directory: /Users/robin/.vscode-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server
View PyCon2018Proposal.md

What is your session about?

"I wish there was a way to easily manipulate this huge multi-dimensional array in Python...", I thought, as I stared at a huge chunk of satellite data on my laptop. The data was from a satellite measuring air quality - and I wanted to slice and dice the data in some supposedly simple ways. Using pure numpy - the go-to library when the words 'multi-dimensional', 'array' and 'python' are mentioned in the same sentence - was just such a pain. What I wished for was something like pandas - with datetime indexes, fancy ways of selecting subsets, group-by operations and so on - but something that would work with my huge multi-dimensional array.

The solution: XArray - a wonderful library which provides the power of pandas for multi-dimensional data. In this talk I will introduce the XArray library by showing how just a few lines of code can answer questions about my data that would take a lot of complex code to answer with pure numpy - questions like 'What is the average air quality in

@robintw
robintw / create_html_from_opml.py
Created Apr 24, 2018
Creates a HTML list from an OPML file
View create_html_from_opml.py
import dominate
from dominate.tags import h1, ul, li, a
import listparser
parsed = listparser.parse('feedly-11e0b8cd-1b68-422a-bf73-19cb26386252-2018-03-25.opml')
feeds = parsed.feeds
doc = dominate.document(title="Robin's blogroll")
with doc: