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 bs4 import BeautifulSoup | |
import urllib | |
import requests | |
S = requests.Session() | |
r = S.get('http://archive.noao.edu/search/query') | |
# not 100% sure this is necessary any mroe... | |
S.headers['X-CSRF-Token'] = BeautifulSoup(r.text, 'html5lib').find('meta',{'name':'csrf-token'}).attrs['content'] |
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 os | |
import netrc | |
from github import Github | |
from batchpr import Updater | |
DESCRIPTION = """ | |
This is an automated update of the astropy-helpers submodule to {0}. This |
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 requests | |
headers = {} | |
headers['Accept'] = 'application/vnd.github.mockingbird-preview' | |
url = 'https://api.github.com/repos/astropy/astropy/issues/2590/timeline' | |
r = requests.get(url, headers=headers) | |
r.json() | |
r = requests.get(url, headers=headers) | |
r.json() | |
history |
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.
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
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) |
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
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 |