This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
from glob import glob | |
prefix_targets = [ | |
"nbconvert/templates", | |
"voila/templates", | |
] | |
def user_dir(): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import re | |
from collections import defaultdict | |
# flake8 --select=E501 astropy/ > pep8length.txt | |
with open('pep8length.txt') as f: | |
text = f.read() | |
matches = re.findall(r'astropy/(.*?)/.*.py:.*(\d\d) > 79 characters', text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Benchmarks that have improved: | |
before after ratio | |
[df4c75aa] [66ff20b9] | |
- 28.4±0.03ms 4.85±0.01ms 0.17 coordinates.FrameBenchmarks.time_concatenate_array | |
- 24.3±0.03ms 3.36±0.03ms 0.14 coordinates.FrameBenchmarks.time_concatenate_scalar | |
- 1.08±0.01ms 744±2μs 0.69 coordinates.FrameBenchmarks.time_init_array | |
- 390±0.4μs 82.6±0.6μs 0.21 coordinates.FrameBenchmarks.time_init_nodata | |
- 905±2μs 556±1μs 0.61 coordinates.FrameBenchmarks.time_init_scalar | |
- 18.4±0.01ms 1.79±0ms 0.10 coordinates.FrameBenchmarks.time_init_scalar_diff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImageWidget: | |
def __init__(self, properties...): # all the properties below should be valid kwargs | |
""" | |
Minimal widget does *not* have any fancy initializer parsing. The user | |
has to call a `load` method. Future-proofing against future `load_*` | |
methods so that the initializer doesn't get too confusing. | |
""" | |
# OPTION 2 / stretch goal - I favor only option 1: | |
def __init__(self, image=None, properties...): | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from astropy.coordinates import SkyCoord, EarthLocation | |
from astropy.coordinates.tests.utils import randomly_sample_sphere | |
from astropy.time import Time | |
import numpy as np | |
# 1000 random locations on the sky | |
ra, dec, _ = randomly_sample_sphere(1000) | |
coos = SkyCoord(ra, dec) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example to get the remaining rate limit using the Github GraphQL API. | |
import requests | |
headers = {"Authorization": "Bearer YOUR API KEY"} | |
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section. | |
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers) | |
if request.status_code == 200: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder