Skip to content

Instantly share code, notes, and snippets.

View pybites's full-sized avatar

Pybites pybites

View GitHub Profile
import cProfile
from functools import wraps
from pstats import Stats, SortKey
from time import time
def timing(f):
"""A simple timer decorator"""
@wraps(f)
def wrapper(*args, **kwargs):
# prior step done:
# python manage.py dumpdata auth.User --output=users.json --format=json
from collections import Counter
import json
import plotext as plt
def aggregate_users_by_year_month(filename="users.json"):
cnt = Counter()
from typing import Protocol
class PybitesSearchProtocol(Protocol):
def match_content(self, search: str) -> list[str]:
"""Implement in subclass to search Pybites content"""
...
class CompleteSearch:
def match_content(self, search: str) -> list[str]:
# Implementation of search method
import concurrent.futures
import os
import re
from timeit import timeit
import requests
URLS = 'urls'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements
- repo: https://github.com/pycqa/flake8