repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
pkjmesra/PKScreener
https://github.com/pkjmesra/PKScreener/blob/c03a12626a557190678ff47897077bdf7784495c/pkscreener/classes/screening/__init__.py
pkscreener/classes/screening/__init__.py
""" The MIT License (MIT) Copyright (c) 2023 pkjmesra Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, ...
python
MIT
c03a12626a557190678ff47897077bdf7784495c
2026-01-05T06:31:20.733224Z
false
pkjmesra/PKScreener
https://github.com/pkjmesra/PKScreener/blob/c03a12626a557190678ff47897077bdf7784495c/pkscreener/classes/bot/__init__.py
pkscreener/classes/bot/__init__.py
""" Bot module for PKScreener Telegram Bot Contains refactored bot handler classes for better maintainability. """ from pkscreener.classes.bot.BotHandlers import ( PKBotLocalCache, BotConstants, UserHandler, MenuHandler, SubscriptionHandler, MarketTimeHandler, TextSanitizer ) __all__ = [ ...
python
MIT
c03a12626a557190678ff47897077bdf7784495c
2026-01-05T06:31:20.733224Z
false
pkjmesra/PKScreener
https://github.com/pkjmesra/PKScreener/blob/c03a12626a557190678ff47897077bdf7784495c/pkscreener/classes/bot/BotHandlers.py
pkscreener/classes/bot/BotHandlers.py
#!/usr/bin/python3 """ The MIT License (MIT) Copyright (c) 2023 pkjmesra Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ...
python
MIT
c03a12626a557190678ff47897077bdf7784495c
2026-01-05T06:31:20.733224Z
false
pkjmesra/PKScreener
https://github.com/pkjmesra/PKScreener/blob/c03a12626a557190678ff47897077bdf7784495c/pkscreener/classes/cli/PKCliRunner.py
pkscreener/classes/cli/PKCliRunner.py
#!/usr/bin/python3 """ The MIT License (MIT) Copyright (c) 2023 pkjmesra Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ...
python
MIT
c03a12626a557190678ff47897077bdf7784495c
2026-01-05T06:31:20.733224Z
false
pkjmesra/PKScreener
https://github.com/pkjmesra/PKScreener/blob/c03a12626a557190678ff47897077bdf7784495c/pkscreener/classes/cli/__init__.py
pkscreener/classes/cli/__init__.py
""" CLI module for PKScreener Contains refactored CLI components for better maintainability. """ from pkscreener.classes.cli.PKCliRunner import PKCliRunner, IntradayAnalysisRunner, CliConfigManager __all__ = ['PKCliRunner', 'IntradayAnalysisRunner', 'CliConfigManager']
python
MIT
c03a12626a557190678ff47897077bdf7784495c
2026-01-05T06:31:20.733224Z
false
COVID19Tracking/covid-tracking-data
https://github.com/COVID19Tracking/covid-tracking-data/blob/a701975875f0dc4b98482854e9e02eb419b1fb14/data-collection-scripts/ltc-scrapers/python-scrapers/ks_ltc_scraper.py
data-collection-scripts/ltc-scrapers/python-scrapers/ks_ltc_scraper.py
from tableauscraper import TableauScraper as TS from itertools import repeat from datetime import datetime from pytz import timezone """Fetch Kansas's Tableau LTC dashboard and output the data table data to STDOUT""" url = "https://public.tableau.com/views/COVID-19TableauVersion2/ClusterSummary" ts = TS() ts.loads(u...
python
Apache-2.0
a701975875f0dc4b98482854e9e02eb419b1fb14
2026-01-05T06:31:17.718705Z
false
COVID19Tracking/covid-tracking-data
https://github.com/COVID19Tracking/covid-tracking-data/blob/a701975875f0dc4b98482854e9e02eb419b1fb14/data-collection-scripts/ltc-scrapers/python-scrapers/ut_ltc_scraper.py
data-collection-scripts/ltc-scrapers/python-scrapers/ut_ltc_scraper.py
import json from datetime import datetime from pytz import timezone from urllib.request import urlopen import sys from itertools import repeat import csv from io import StringIO """Fetch Utah's LTC dashboard data and output the data table to STDOUT""" def load_json(): url = ( "https://services6.arcgis.co...
python
Apache-2.0
a701975875f0dc4b98482854e9e02eb419b1fb14
2026-01-05T06:31:17.718705Z
false
COVID19Tracking/covid-tracking-data
https://github.com/COVID19Tracking/covid-tracking-data/blob/a701975875f0dc4b98482854e9e02eb419b1fb14/data-collection-scripts/cdc-vaccinations-timeseries/make_timeseries.py
data-collection-scripts/cdc-vaccinations-timeseries/make_timeseries.py
import json import git import csv import sys import click from collections import defaultdict # we want our columns to come out in the desired order, and older pythons don't guarantee dict ordering MIN_PYTHON = (3, 7) if sys.version_info < MIN_PYTHON: sys.exit("Python %s.%s or later is required.\n" % MIN_PYTHON) ...
python
Apache-2.0
a701975875f0dc4b98482854e9e02eb419b1fb14
2026-01-05T06:31:17.718705Z
false
COVID19Tracking/covid-tracking-data
https://github.com/COVID19Tracking/covid-tracking-data/blob/a701975875f0dc4b98482854e9e02eb419b1fb14/data-collection-scripts/long-calculations/longcalcs.py
data-collection-scripts/long-calculations/longcalcs.py
import pandas as pd import requests from datetime import datetime, timezone, timedelta from pytz import timezone as tz # replace with ZoneInfo once G upgrades to 3.9 from io import StringIO, BytesIO from bs4 import BeautifulSoup import re import zipfile # DE positives def de(f): print("Run at: ", datetime.now(tz('U...
python
Apache-2.0
a701975875f0dc4b98482854e9e02eb419b1fb14
2026-01-05T06:31:17.718705Z
false
COVID19Tracking/covid-tracking-data
https://github.com/COVID19Tracking/covid-tracking-data/blob/a701975875f0dc4b98482854e9e02eb419b1fb14/data-collection-scripts/cdc-by-state/scrape.py
data-collection-scripts/cdc-by-state/scrape.py
"""NOTE: this is meant to be run from the top-level repo directory. """ import json import pandas as pd import requests STATES = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE...
python
Apache-2.0
a701975875f0dc4b98482854e9e02eb419b1fb14
2026-01-05T06:31:17.718705Z
false
COVID19Tracking/covid-tracking-data
https://github.com/COVID19Tracking/covid-tracking-data/blob/a701975875f0dc4b98482854e9e02eb419b1fb14/data-collection-scripts/fda-covid-ivd-euas/scrape.py
data-collection-scripts/fda-covid-ivd-euas/scrape.py
import requests import csv import sys from bs4 import BeautifulSoup def scrape(): url = "https://www.fda.gov/emergency-preparedness-and-response/mcm-legal-regulatory-and-policy-framework/emergency-use-authorization#covidinvitrodev" sys.stderr.write("getting data from: %s\n" % url) page = requests.get(url...
python
Apache-2.0
a701975875f0dc4b98482854e9e02eb419b1fb14
2026-01-05T06:31:17.718705Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/test_utils.py
tests/test_utils.py
import pytest import testutils import utils def test_read_write_json_file(): test_data = {"a": 1, "b": 2, "c": {"d": 3, "e": 4}} utils.write_json_file("test.json", test_data) read_data = utils.read_json_file("test.json") assert test_data == read_data missing_file = utils.read_json_file("xtest.json...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/test_combined_suburbs.py
tests/test_combined_suburbs.py
import os from datetime import datetime import main import pytest import suburbs import testutils def _dummy_read_json_file_combined_suburbs(filename: str) -> dict: """Fake combined-suburbs.json file.""" if filename == "results/combined-suburbs.json": return testutils.read_test_data_json("combined-su...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/test_geojson.py
tests/test_geojson.py
import datetime import os import geojson import utils from data import Address def test_read_geojson(monkeypatch): dir_path = os.path.dirname(os.path.realpath(__file__)) monkeypatch.setattr("geojson.os.path.exists", lambda path: True) monkeypatch.setattr( "geojson.read_json_file", lambda filename...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/test_main.py
tests/test_main.py
import copy import datetime import main import test_nbn import testutils import update_breakdown from data import Address from nbn import CACHE, NBNApi def get_nbn_data_json(self, url) -> dict: """Return canned NBN API data for testing""" if url.startswith("https://places.nbnco.net.au/places/v1/autocomplete?...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/test_db.py
tests/test_db.py
import os from argparse import ArgumentParser, Namespace import db SAMPLE_ADDRESSES_DB_FILE = f"{os.path.dirname(os.path.realpath(__file__))}/data/sample-addresses.sqlite" def test_get_address(): address_db = db.connect_to_db(Namespace(dbhost=SAMPLE_ADDRESSES_DB_FILE)) addresses = address_db.get_addresses("...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/test_adhoc_tools.py
tests/test_adhoc_tools.py
import datetime from argparse import Namespace import adhoc_tools import testutils from test_db import SAMPLE_ADDRESSES_DB_FILE def test_check_processing_rate(monkeypatch): """Check the reporting function""" monkeypatch.setattr( "utils.read_json_file", lambda filename: testutils.read_test_dat...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/testutils.py
tests/testutils.py
import json import os def read_file_string(filename: str) -> str: """Read the contents of a file as a string""" with open(filename) as f: return f.read() def get_test_data_path(filename: str) -> str: """Get the full path to a test data file.""" return f"{os.path.dirname(os.path.realpath(__fi...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/test_nbn.py
tests/test_nbn.py
import testutils from nbn import CACHE, NBNApi class JSONWrapper: def __init__(self, data): self.data = data def json(self): return self.data def raise_for_status(self): pass def requests_session_get(self, url, **kwargs): """Return canned NBN API data for testing""" if ...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/tests/test_export_locids_csv.py
tests/test_export_locids_csv.py
import csv import os import tempfile import export_locids_csv def test_iter_feature_data_with_default_fields(monkeypatch): """Test iterating features with default fields.""" mock_geojson = { "features": [ { "geometry": {"coordinates": [115.78506081, -31.95270506]}, ...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/sitemap.py
code/sitemap.py
import xml.etree.ElementTree as ET from urllib.parse import quote import utils def generate_sitemap(json_file, output_file): # Load suburbs data from JSON file data = utils.read_json_file(json_file) # Create the root element for the XML sitemap urlset = ET.Element("urlset", xmlns="http://www.sitemap...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/geojson.py
code/geojson.py
import json import logging import os from datetime import datetime from data import Address, AddressList from utils import read_json_file, write_json_file def format_addresses(addresses: AddressList, suburb: str, generated: datetime = None) -> dict: """Convert the list of addresses (with upgrade+tech fields) int...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/export_locids_csv.py
code/export_locids_csv.py
import argparse import csv import os from typing import Any, Dict, Iterable, List from utils import get_all_geojson_files # All available fields in GeoJSON features AVAILABLE_FIELDS = [ "loc_id", "latitude", "longitude", "name", "tech", "upgrade", "gnaf_pid", "tech_change_status", ...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/db.py
code/db.py
import logging import sqlite3 from abc import ABC, abstractmethod from argparse import ArgumentParser, Namespace import data import psycopg2 from psycopg2.extras import NamedTupleCursor SQLITE_FILE_EXTENSIONS = {"db", "sqlite", "sqlite3", "db3", "s3db", "sl3"} class DbDriver(ABC): """Abstract class for DB conne...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/update_breakdown.py
code/update_breakdown.py
#!/usr/bin/env python3 """a cut-down version of update_historical_tech_and_upgrade_breakdown() that processes the current checkout""" import logging from adhoc_tools import generate_state_breakdown, update_breakdown from tabulate import tabulate def print_breakdowns(breakdowns): """Dump the breakdowns to the co...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/adhoc_tools.py
code/adhoc_tools.py
#!/usr/bin/env python3 import argparse import csv import glob import logging import os import pprint import re import subprocess from collections import Counter, OrderedDict from datetime import datetime, timedelta import data import db import geojson import main import requests import suburbs import utils from bs4 im...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/main.py
code/main.py
#!/usr/bin/env python3 """Main script for fetching NBN data for a suburb from the NBN API and writing to a GeoJSON file.""" import argparse import itertools import logging import os import traceback from collections import Counter from collections.abc import Generator from concurrent.futures import ThreadPoolExecutor ...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/utils.py
code/utils.py
import copy import glob import json import os def print_progress_bar(iteration, total, prefix="", suffix="", decimals=1, length=100, fill="█", print_end="\r"): """ Call in a loop to create terminal progress bar. Borrowed from https://stackoverflow.com/questions/3173320/text-progress-bar-in-terminal-with-b...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/suburbs.py
code/suburbs.py
# api for managing the list of suburbs, which ones have been completed,etc. import dataclasses import glob import logging import os from collections import Counter from datetime import datetime import data import utils from geojson import ( get_geojson_file_generated, get_geojson_file_generated_from_name, ...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/data.py
code/data.py
from dataclasses import dataclass from datetime import datetime STATES_MAP = { "New South Wales": "NSW", "ACT": "ACT", "Victoria": "VIC", "Queensland": "QLD", "South Australia": "SA", "Western Australia": "WA", "Tasmania": "TAS", "Northern Territory": "NT", "Other Territories": "OT"...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
LukePrior/nbn-upgrade-map
https://github.com/LukePrior/nbn-upgrade-map/blob/9bb664084224c03ec53dab555c80adde4d491466/code/nbn.py
code/nbn.py
import difflib import logging import urllib.parse import diskcache import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry # 1GB LRU cache of gnaf_pid->loc_id and loc_id->details CACHE = diskcache.Cache("cache") class NBNApi: """Interacts with NBN's unoff...
python
MIT
9bb664084224c03ec53dab555c80adde4d491466
2026-01-05T06:50:31.043193Z
false
covid19india/api
https://github.com/covid19india/api/blob/3303854897685cfeaefed458748771b6ea63bf5c/src/parser_v3.py
src/parser_v3.py
#!/usr/bin/env python3 import csv import logging import json import yaml from collections import defaultdict, OrderedDict from datetime import datetime, timedelta from pathlib import Path # Set logging level logging.basicConfig(handlers=[logging.NullHandler()], format='%(message)s', ...
python
MIT
3303854897685cfeaefed458748771b6ea63bf5c
2026-01-05T04:52:08.585516Z
true
covid19india/api
https://github.com/covid19india/api/blob/3303854897685cfeaefed458748771b6ea63bf5c/src/parser_v4.py
src/parser_v4.py
#!/usr/bin/env python3 import csv import logging import json import sys import yaml from collections import defaultdict, OrderedDict from datetime import datetime, timedelta from pathlib import Path # Set logging level logging.basicConfig(stream=sys.stdout, format="%(message)s", ...
python
MIT
3303854897685cfeaefed458748771b6ea63bf5c
2026-01-05T04:52:08.585516Z
true
covid19india/api
https://github.com/covid19india/api/blob/3303854897685cfeaefed458748771b6ea63bf5c/src/build_raw_data.py
src/build_raw_data.py
import pandas as pd # pylint: disable=import-error import re from pathlib import Path import logging import sys import os from urllib.error import HTTPError # Set logging level logging.basicConfig(stream=sys.stdout, format="%(message)s", level=logging.INFO) def fetch_raw_data_fr...
python
MIT
3303854897685cfeaefed458748771b6ea63bf5c
2026-01-05T04:52:08.585516Z
false