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 |
|---|---|---|---|---|---|---|---|---|
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/ankipandas/test/test_raw.py | ankipandas/test/test_raw.py | # std
from __future__ import annotations
import copy
import pathlib
import shutil
import tempfile
import unittest
# 3rd
import pandas as pd
# ours
from ankipandas.raw import (
close_db,
get_db_version,
get_deck_info,
get_did2deck,
get_info,
get_mid2fields,
get_mid2model,
get_model_inf... | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/ankipandas/test/test_collection.py | ankipandas/test/test_collection.py | # std
from __future__ import annotations
import pathlib
import shutil
# 3rd
import pytest
# ours
from ankipandas.collection import Collection
from ankipandas.test.util import parameterized_paths
def _init_all_tables(col: Collection) -> None:
"""Access all attributes at least once to ensure that they are
in... | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/ankipandas/test/__init__.py | ankipandas/test/__init__.py | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false | |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/ankipandas/test/test_regression.py | ankipandas/test/test_regression.py | """ These tests are created from issues that we fixed to avoid that they might
come back later.
"""
from __future__ import annotations
# ours
from ankipandas.collection import Collection
from ankipandas.test.util import parameterized_paths
@parameterized_paths()
def test_inplace_merge_notes(db_path):
"""https:/... | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/doc/conf.py | doc/conf.py | from __future__ import annotations
import os
import pathlib
import sys
from pathlib import Path
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, l... | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/doc/examples/loader.py | doc/examples/loader.py | #!/usr/bin/env python3
# std
from __future__ import annotations
import logging
import os
import sys
from pathlib import Path
# 3rd
import matplotlib.pyplot as plt
# ours
sys.path.insert(0, "../..")
import ankipandas # noqa E402
from ankipandas.util.log import get_logger # noqa E402
class Loader:
def __init_... | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/doc/examples/examples/retention_distribution_vs_deck.py | doc/examples/examples/retention_distribution_vs_deck.py | from __future__ import annotations
import matplotlib.pyplot as plt
import numpy as np
ax = plt.gca()
for deck in col.cards.cdeck.unique():
selected = col.cards[col.cards.cdeck == deck]["civl"]
if len(selected) < 1000:
continue
selected.plot.hist(
ax=ax,
label=deck,
histtype... | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/doc/examples/examples/repetitions_per_deck.py | doc/examples/examples/repetitions_per_deck.py | interesting_decks = list(col.cards.cdeck.unique())
interesting_decks.remove("archived::physics")
selected = col.cards[col.cards.cdeck.isin(interesting_decks)]
axss = selected.hist(
column="creps",
by="cdeck",
sharex=True,
layout=(5, 4),
figsize=(15, 15),
density=True,
)
for axs in axss:
for ... | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/doc/examples/examples/repetitions_per_type.py | doc/examples/examples/repetitions_per_type.py | axs = col.cards.hist(column="creps", by="ctype", layout=(1, 2), figsize=(12, 3))
for ax in axs:
ax.set_xlabel("#Reviews")
ax.set_ylabel("Count")
| python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/doc/examples/examples/leeches_per_deck.py | doc/examples/examples/leeches_per_deck.py | cards = col.cards.merge_notes()
counts = cards[cards.has_tag("leech")]["cdeck"].value_counts()
counts.plot.pie(title="Leeches per deck")
| python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/doc/examples/examples/reviews_vs_ease.py | doc/examples/examples/reviews_vs_ease.py | from __future__ import annotations
import pandas as pd
xs = []
ys = []
decks = []
for deck in col.cards.cdeck.unique():
selected = col.cards[col.cards["cdeck"] == deck]
if len(selected) < 500:
continue
decks.append(deck)
binned = pd.qcut(selected["creps"], 15, duplicates="drop")
results = ... | python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
klieret/AnkiPandas | https://github.com/klieret/AnkiPandas/blob/0b17a1870711d4adc3e9fc82bff8aac986b09f5e/doc/examples/examples/retention_rate_per_deck.py | doc/examples/examples/retention_rate_per_deck.py | grouped = col.cards.groupby("cdeck")
data = grouped.mean()["civl"].sort_values().tail()
ax = data.plot.barh()
ax.set_ylabel("Deck name")
ax.set_xlabel("Average expected retention length/review interval [days]")
ax.set_title("Average retention length per deck")
| python | MIT | 0b17a1870711d4adc3e9fc82bff8aac986b09f5e | 2026-01-05T07:09:04.346970Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chat2api.py | chat2api.py | import asyncio
import types
import warnings
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from fastapi import FastAPI, Request, Depends, HTTPException, Form
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import HTMLResponse
from fastapi.responses import StreamingResponse, JSONR... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/app.py | app.py | import warnings
import uvicorn
from fastapi import FastAPI, HTTPException
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from fastapi.middleware.cors import CORSMiddleware
from fastapi.templating import Jinja2Templates
from utils.configs import enable_gateway, api_prefix
warnings.filterwarning... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/login.py | gateway/login.py | from fastapi import Request
from fastapi.responses import HTMLResponse
from app import app, templates
@app.get("/login", response_class=HTMLResponse)
async def login_html(request: Request):
response = templates.TemplateResponse("login.html", {"request": request})
return response
| python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/admin.py | gateway/admin.py | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false | |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/chatgpt.py | gateway/chatgpt.py | import json
from urllib.parse import quote
from fastapi import Request
from fastapi.responses import HTMLResponse
from app import app, templates
from gateway.login import login_html
from utils.kv_utils import set_value_for_key
with open("templates/chatgpt_context.json", "r", encoding="utf-8") as f:
chatgpt_conte... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/route.py | gateway/route.py | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false | |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/reverseProxy.py | gateway/reverseProxy.py | import json
import random
import time
import uuid
from datetime import datetime, timezone
from fastapi import Request, HTTPException
from fastapi.responses import StreamingResponse, Response
from starlette.background import BackgroundTask
import utils.globals as globals
from chatgpt.authorization import verify_token,... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/gpts.py | gateway/gpts.py | import json
from fastapi import Request
from fastapi.responses import Response
from app import app
from gateway.chatgpt import chatgpt_html
with open("templates/gpts_context.json", "r", encoding="utf-8") as f:
gpts_context = json.load(f)
@app.get("/gpts")
async def get_gpts():
return {"kind": "store"}
@a... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/v1.py | gateway/v1.py | import json
from fastapi import Request
from fastapi.responses import Response
from app import app
from gateway.reverseProxy import chatgpt_reverse_proxy
from utils.kv_utils import set_value_for_key
@app.post("/v1/initialize")
async def initialize(request: Request):
initialize_response = (await chatgpt_reverse_... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/share.py | gateway/share.py | import json
import random
import time
import jwt
from fastapi import Request, HTTPException, Security
from fastapi.responses import Response
from fastapi.security import HTTPAuthorizationCredentials
import utils.globals as globals
from app import app, security_scheme
from chatgpt.authorization import get_fp, verify_t... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/gateway/backend.py | gateway/backend.py | import json
import random
import re
import time
import uuid
from fastapi import Request, HTTPException
from fastapi.responses import RedirectResponse, StreamingResponse, Response
from starlette.background import BackgroundTask
from starlette.concurrency import run_in_threadpool
import utils.globals as globals
from ap... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/utils/Logger.py | utils/Logger.py | import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s | %(levelname)s | %(message)s')
class Logger:
@staticmethod
def info(message):
logging.info(str(message))
@staticmethod
def warning(message):
logging.warning("\033[0;33m" + str(message) + "\033[0m")
@stat... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/utils/config.py | utils/config.py | import ast
import os
from dotenv import load_dotenv
from utils.Logger import logger
load_dotenv(encoding="ascii")
def is_true(x):
if isinstance(x, bool):
return x
if isinstance(x, str):
return x.lower() in ['true', '1', 't', 'y', 'yes']
elif isinstance(x, int):
return x == 1
... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/utils/retry.py | utils/retry.py | from fastapi import HTTPException
from utils.Logger import logger
from utils.configs import retry_times
async def async_retry(func, *args, max_retries=retry_times, **kwargs):
for attempt in range(max_retries + 1):
try:
result = await func(*args, **kwargs)
return result
exc... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/utils/globals.py | utils/globals.py | import json
import os
import utils.configs as configs
from utils.Logger import logger
DATA_FOLDER = "data"
TOKENS_FILE = os.path.join(DATA_FOLDER, "token.txt")
REFRESH_MAP_FILE = os.path.join(DATA_FOLDER, "refresh_map.json")
ERROR_TOKENS_FILE = os.path.join(DATA_FOLDER, "error_token.txt")
WSS_MAP_FILE = os.path.join(... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/utils/Client.py | utils/Client.py | import random
from curl_cffi.requests import AsyncSession
class Client:
def __init__(self, proxy=None, timeout=15, verify=True, impersonate='safari15_3'):
self.proxies = {"http": proxy, "https": proxy}
self.timeout = timeout
self.verify = verify
self.impersonate = impersonate
... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/utils/kv_utils.py | utils/kv_utils.py | def set_value_for_key(data, target_key, new_value):
if isinstance(data, dict):
for key, value in data.items():
if key == target_key:
data[key] = new_value
else:
set_value_for_key(value, target_key, new_value)
elif isinstance(data, list):
fo... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/api/models.py | api/models.py | model_proxy = {
"gpt-3.5-turbo": "gpt-3.5-turbo-0125",
"gpt-3.5-turbo-16k": "gpt-3.5-turbo-16k-0613",
"gpt-4": "gpt-4-0613",
"gpt-4-32k": "gpt-4-32k-0613",
"gpt-4-turbo-preview": "gpt-4-0125-preview",
"gpt-4-vision-preview": "gpt-4-1106-vision-preview",
"gpt-4-turbo": "gpt-4-turbo-2024-04-09... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/api/chat2api.py | api/chat2api.py | import asyncio
import types
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from fastapi import Request, HTTPException, Form, Security
from fastapi.responses import HTMLResponse, StreamingResponse, JSONResponse
from fastapi.security import HTTPAuthorizationCredentials
from starlette.background import Backg... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/api/files.py | api/files.py | import io
import pybase64
from PIL import Image
from utils.Client import Client
from utils.configs import export_proxy_url, cf_file_url
async def get_file_content(url):
if url.startswith("data:"):
mime_type, base64_data = url.split(';')[0].split(':')[1], url.split(',')[1]
file_content = pybase64... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/api/tokens.py | api/tokens.py | import math
import tiktoken
async def calculate_image_tokens(width, height, detail):
if detail == "low":
return 85
else:
max_dimension = max(width, height)
if max_dimension > 2048:
scale_factor = 2048 / max_dimension
new_width = int(width * scale_factor)
... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chatgpt/chatLimit.py | chatgpt/chatLimit.py | import time
from datetime import datetime
from utils.Logger import logger
limit_details = {}
def check_is_limit(detail, token, model):
if token and isinstance(detail, dict) and detail.get('clears_in'):
clear_time = int(time.time()) + detail.get('clears_in')
limit_details.setdefault(token, {})[mo... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chatgpt/ChatService.py | chatgpt/ChatService.py | import asyncio
import json
import random
import uuid
from fastapi import HTTPException
from starlette.concurrency import run_in_threadpool
from api.files import get_image_size, get_file_extension, determine_file_use_case
from api.models import model_proxy
from chatgpt.authorization import get_req_token, verify_token,... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chatgpt/refreshToken.py | chatgpt/refreshToken.py | import json
import random
import time
from fastapi import HTTPException
from utils.Client import Client
from utils.Logger import logger
from utils.configs import proxy_url_list
import utils.globals as globals
async def rt2ac(refresh_token, force_refresh=False):
if not force_refresh and (refresh_token in globals... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chatgpt/turnstile.py | chatgpt/turnstile.py | import pybase64
import json
import random
import time
from typing import Any, Callable, Dict, List, Union
class OrderedMap:
def __init__(self):
self.keys = []
self.values = {}
def add(self, key: str, value: Any):
if key not in self.values:
self.keys.append(key)
sel... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chatgpt/chatFormat.py | chatgpt/chatFormat.py | import asyncio
import json
import random
import re
import string
import time
import uuid
import pybase64
import websockets
from fastapi import HTTPException
from api.files import get_file_content
from api.models import model_system_fingerprint
from api.tokens import split_tokens_from_content, calculate_image_tokens, ... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chatgpt/proofofWork.py | chatgpt/proofofWork.py | import hashlib
import json
import random
import re
import time
import uuid
from datetime import datetime, timedelta, timezone
from html.parser import HTMLParser
import pybase64
from utils.Logger import logger
from utils.configs import conversation_only
cores = [16, 24, 32]
screens = [3000, 4000, 6000]
timeLayout = "... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chatgpt/wssClient.py | chatgpt/wssClient.py | import json
import time
from utils.Logger import logger
import utils.globals as globals
def save_wss_map(wss_map):
with open(globals.WSS_MAP_FILE, "w") as f:
json.dump(wss_map, f, indent=4)
async def token2wss(token):
if not token:
return False, None
if token in globals.wss_map:
... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
Niansuh/chat2api | https://github.com/Niansuh/chat2api/blob/f7446ddf9bdccb7fe37f51f42ca92a796f9b8900/chatgpt/authorization.py | chatgpt/authorization.py | import asyncio
import json
import random
import uuid
import ua_generator
from ua_generator.options import Options
from ua_generator.data.version import VersionRange
from fastapi import HTTPException
import utils.configs as configs
import utils.globals as globals
from chatgpt.refreshToken import rt2ac
from utils.Logge... | python | MIT | f7446ddf9bdccb7fe37f51f42ca92a796f9b8900 | 2026-01-05T07:09:04.714365Z | false |
janjur/readable-pylint-messages | https://github.com/janjur/readable-pylint-messages/blob/4e8d290f604d98bc162316f453b22d7a5e45641f/readable_pylint_messages/generate_markdown.py | readable_pylint_messages/generate_markdown.py | #!/usr/bin/env python3
""" generate_markdown docstring
This module is complete tool for creating as eyepleasing as possible pylint messages
with error codes and descriptions.
"""
from shutil import move
from subprocess import check_output, PIPE
from readable_pylint_messages.Message import Message
def pylint_list_msgs... | python | MIT | 4e8d290f604d98bc162316f453b22d7a5e45641f | 2026-01-05T07:09:05.297083Z | false |
janjur/readable-pylint-messages | https://github.com/janjur/readable-pylint-messages/blob/4e8d290f604d98bc162316f453b22d7a5e45641f/readable_pylint_messages/__init__.py | readable_pylint_messages/__init__.py | from .generate_markdown import main # pylint: skip-file
| python | MIT | 4e8d290f604d98bc162316f453b22d7a5e45641f | 2026-01-05T07:09:05.297083Z | false |
janjur/readable-pylint-messages | https://github.com/janjur/readable-pylint-messages/blob/4e8d290f604d98bc162316f453b22d7a5e45641f/readable_pylint_messages/Message.py | readable_pylint_messages/Message.py | """
File implementing Message class
"""
class Message: # pylint: disable=too-few-public-methods
"""
Class representing pylint error messages
"""
def __init__(self, name, code, brief, description):
self.name = name
self.code = code
self.brief = brief
self.description = ... | python | MIT | 4e8d290f604d98bc162316f453b22d7a5e45641f | 2026-01-05T07:09:05.297083Z | false |
aaronst/macholibre | https://github.com/aaronst/macholibre/blob/c019c079a9e324e9f8e549a372406a12ddbc2a04/setup.py | setup.py | import os
import sys
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
NEWS = open(os.path.join(here, 'NEWS.txt')).read()
version = '1.1.0'
install_requires = [
# List your project dependencies here.
# For ... | python | Apache-2.0 | c019c079a9e324e9f8e549a372406a12ddbc2a04 | 2026-01-05T07:09:05.561561Z | false |
aaronst/macholibre | https://github.com/aaronst/macholibre/blob/c019c079a9e324e9f8e549a372406a12ddbc2a04/macholibre/parser.py | macholibre/parser.py | """
Copyright 2016 Aaron Stephens <aaronjst93@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | python | Apache-2.0 | c019c079a9e324e9f8e549a372406a12ddbc2a04 | 2026-01-05T07:09:05.561561Z | true |
aaronst/macholibre | https://github.com/aaronst/macholibre/blob/c019c079a9e324e9f8e549a372406a12ddbc2a04/macholibre/dictionary.py | macholibre/dictionary.py | #!/usr/bin/env python
"""
Copyright 2016 Aaron Stephens <aaronjst93@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | python | Apache-2.0 | c019c079a9e324e9f8e549a372406a12ddbc2a04 | 2026-01-05T07:09:05.561561Z | false |
aaronst/macholibre | https://github.com/aaronst/macholibre/blob/c019c079a9e324e9f8e549a372406a12ddbc2a04/macholibre/__init__.py | macholibre/__init__.py | #!/usr/bin/env python3
"""
Copyright 2016 Aaron Stephens <aaronjst93@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by ... | python | Apache-2.0 | c019c079a9e324e9f8e549a372406a12ddbc2a04 | 2026-01-05T07:09:05.561561Z | false |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/train.py | train.py | from pytorch_lightning import Trainer, seed_everything
from alignscore.dataloader import DSTDataLoader
from alignscore.model import BERTAlignModel
from pytorch_lightning.callbacks import ModelCheckpoint
from argparse import ArgumentParser
import os
def train(datasets, args):
dm = DSTDataLoader(
dataset_con... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | false |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/generate_training_data.py | generate_training_data.py | from logging import error
from datasets import load_dataset
import transformers
from random import sample
import random
import torch
import json
from tqdm import tqdm
from nltk.translate.bleu_score import sentence_bleu
import pandas as pd
import re
'''
data format
{text_a, text_b, label:None or 0_1, }
'''
DATASET_HUG... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | true |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/baselines.py | baselines.py | from logging import warning
import torch
import torch.nn as nn
import numpy as np
from tqdm import tqdm
import spacy
from sklearn.metrics.pairwise import cosine_similarity
from nltk.tokenize import sent_tokenize
import json
class CTCScorer():
def __init__(self, model_type) -> None:
self.model_type = model_... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | true |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/benchmark.py | benchmark.py | from evaluate import Evaluator, ALL_TASKS
from baselines import *
from alignscore.inference import Inferencer
import time
import json
import os
from argparse import ArgumentParser
SAVE_ALL_TABLES = True
SAVE_AND_PRINT_TIMER = False
class Timer():
def __init__(self) -> None:
self.t0 = time.time()
s... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | false |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/evaluate.py | evaluate.py | from logging import warning
from datasets import load_dataset
from alignscore.inference import Inferencer
import numpy as np
from scipy.stats import pearsonr, kendalltau, spearmanr
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, balanced_accuracy_score, matthews_corrcoef
import pandas as pd
import ... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | true |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/src/alignscore/inference.py | src/alignscore/inference.py | from logging import warning
import spacy
from nltk.tokenize import sent_tokenize
import torch
from .model import BERTAlignModel
from transformers import AutoConfig, AutoTokenizer
import torch.nn as nn
from tqdm import tqdm
class Inferencer():
def __init__(self, ckpt_path, model='bert-base-uncased', batch_size=32, ... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | false |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/src/alignscore/model.py | src/alignscore/model.py | import math
from typing import Optional, Tuple
from transformers import AdamW, get_linear_schedule_with_warmup, AutoConfig
from transformers import BertForPreTraining, BertModel, RobertaModel, AlbertModel, AlbertForMaskedLM, RobertaForMaskedLM
import torch
import torch.nn as nn
import pytorch_lightning as pl
from sklea... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | false |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/src/alignscore/alignscore.py | src/alignscore/alignscore.py | from .inference import Inferencer
from typing import List
class AlignScore:
def __init__(self, model: str, batch_size: int, device: int, ckpt_path: str, evaluation_mode='nli_sp', verbose=True) -> None:
self.model = Inferencer(
ckpt_path=ckpt_path,
model=model,
batch_siz... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | false |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/src/alignscore/__init__.py | src/alignscore/__init__.py | from .alignscore import AlignScore | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | false |
yuh-zha/AlignScore | https://github.com/yuh-zha/AlignScore/blob/a0936d5afee642a46b22f6c02a163478447aa493/src/alignscore/dataloader.py | src/alignscore/dataloader.py | import json
import logging
import random
from typing import Optional, Sized
import numpy as np
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import (
AutoConfig,
AutoTokenizer,
)
from torch.utils.data import Datase... | python | MIT | a0936d5afee642a46b22f6c02a163478447aa493 | 2026-01-05T07:09:06.286076Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/src/sqla_wrapper/base_model.py | src/sqla_wrapper/base_model.py | import typing as t
from sqlalchemy import inspect
__all__ = ("BaseModel", )
class BaseModel:
def fill(self, **attrs: t.Any) -> t.Any:
"""Fill the object with the values of the attrs dict."""
for name in attrs:
setattr(self, name, attrs[name])
return self
def __repr__(se... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/src/sqla_wrapper/alembic_wrapper.py | src/sqla_wrapper/alembic_wrapper.py | import shutil
import typing as t
from pathlib import Path
from alembic import autogenerate, util
from alembic.config import Config
from alembic.runtime.environment import EnvironmentContext
from alembic.script import Script, ScriptDirectory
from .cli import click_cli, proper_cli_cli
from .sqlalchemy_wrapper import SQ... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/src/sqla_wrapper/__init__.py | src/sqla_wrapper/__init__.py | from .alembic_wrapper import * # noqa
from .base_model import * # noqa
from .session import * # noqa
from .sqlalchemy_wrapper import * # noqa
| python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/src/sqla_wrapper/session.py | src/sqla_wrapper/session.py | import typing as t
import sqlalchemy.orm
from sqlalchemy import select
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import scoped_session
__all__ = ("Session",)
class Session(sqlalchemy.orm.Session):
"""SQLAlchemy default Session class has the method `.get(Model, pk)`
to query and return a... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/src/sqla_wrapper/sqlalchemy_wrapper.py | src/sqla_wrapper/sqlalchemy_wrapper.py | import typing as t
import sqlalchemy as sa
from sqlalchemy import orm as sa_orm
from sqlalchemy.event import listens_for as sa_listens_for
from .base_model import BaseModel
from .session import PatchedScopedSession, Session
__all__ = ("SQLAlchemy", "TestTransaction")
class SQLAlchemy:
"""Create a SQLAlchemy c... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/src/sqla_wrapper/cli/proper_cli_cli.py | src/sqla_wrapper/cli/proper_cli_cli.py |
def get_proper_cli(alembic):
import proper_cli # type: ignore
return type(
"DBCli",
(proper_cli.Cli,),
{
"__doc__": """Database migrations operations.""",
"revision": alembic.revision,
"upgrade": alembic.upgrade,
"downgrade": alembic.d... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/src/sqla_wrapper/cli/click_cli.py | src/sqla_wrapper/cli/click_cli.py | def get_flask_cli(alembic, name):
from flask.cli import FlaskGroup
group = FlaskGroup(name)
return _get_cli(alembic, group)
def get_click_cli(alembic, name):
from click import Group
group = Group(name)
return _get_cli(alembic, group)
def _get_cli(alembic, group):
import click
@gro... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/src/sqla_wrapper/cli/__init__.py | src/sqla_wrapper/cli/__init__.py | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false | |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/tests/test_session.py | tests/test_session.py | def test_first(dbs, TestModelA):
dbs.add(TestModelA(title="Lorem"))
dbs.add(TestModelA(title="Ipsum"))
dbs.add(TestModelA(title="Sit"))
dbs.commit()
obj = dbs.first(TestModelA)
assert obj.title == "Lorem"
def test_create(dbs, TestModelA):
dbs.create(TestModelA, title="Remember")
dbs.c... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/tests/test_base_model.py | tests/test_base_model.py | def test_fill(dbs, TestModelA):
obj = dbs.create(TestModelA, title="Remember")
obj.fill(title="lorem ipsum")
dbs.commit()
updated = dbs.first(TestModelA)
assert updated.title == "lorem ipsum"
def test_repr(dbs, TestModelA):
obj = dbs.create(TestModelA, title="Hello world")
dbs.commit()
... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/tests/test_sqlalchemy_wrapper.py | tests/test_sqlalchemy_wrapper.py | import pytest
import sqlalchemy as sa
from sqlalchemy.exc import OperationalError
from sqlalchemy.orm import Mapped, mapped_column
from sqla_wrapper import SQLAlchemy
def test_repr(memdb):
assert memdb.url in str(memdb)
def test_setup_with_params_full():
db = SQLAlchemy(
dialect="postgresql+psycopg... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/tests/test_alembic_wrapper.py | tests/test_alembic_wrapper.py | import pytest
import sqlalchemy as sa
from sqlalchemy.orm import Mapped, mapped_column
from sqla_wrapper import Alembic
def _create_test_model1(memdb):
class TestModel1(memdb.Model):
__tablename__ = "test_model_1"
id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str] = mapped... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/tests/test_testing.py | tests/test_testing.py | from sqlalchemy import func, select
def test_independence_1(db, dbs, TestModelB):
stmt = select(func.count("*")).select_from(TestModelB)
assert db.s.execute(stmt).scalar() == 1
db.s.add(TestModelB(title="second"))
db.s.flush()
assert db.s.execute(stmt).scalar() == 2
def test_independence_2(db, ... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpsca/sqla-wrapper | https://github.com/jpsca/sqla-wrapper/blob/69a987c55df82df1235a441169437df717129b6e/tests/conftest.py | tests/conftest.py | import shutil
from datetime import datetime
from pathlib import Path
from tempfile import mkdtemp
import pytest
import sqlalchemy as sa
from sqlalchemy.orm import Mapped, mapped_column
from sqla_wrapper import SQLAlchemy
@pytest.fixture()
def memdb() -> SQLAlchemy:
return SQLAlchemy("sqlite://")
@pytest.fixtu... | python | MIT | 69a987c55df82df1235a441169437df717129b6e | 2026-01-05T07:09:07.328934Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/setup.py | setup.py | #!/usr/bin/env python
"""
pip setup file
"""
import os
import re
from setuptools import setup
__library__ = "hubspot3"
__user__ = "https://github.com/jpetrucciani"
with open("README.md") as readme:
LONG_DESCRIPTION = readme.read()
def find_version(*file_paths):
"""
This pattern was modeled on a method... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/keywords.py | hubspot3/keywords.py | """
hubspot keywords api
"""
from hubspot3.base import BaseClient
KEYWORDS_API_VERSION = "v1"
class KeywordsClient(BaseClient):
"""allows access to the keywords api"""
def _get_path(self, subpath):
return f"keywords/{KEYWORDS_API_VERSION}/{subpath}"
# Contains both list of keywords and metadat... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/properties.py | hubspot3/properties.py | """
hubspot properties api
"""
from typing import Dict, Optional
from hubspot3.base import BaseClient
from hubspot3.globals import (
OBJECT_TYPE_COMPANIES,
OBJECT_TYPE_CONTACTS,
OBJECT_TYPE_DEALS,
OBJECT_TYPE_LINE_ITEMS,
OBJECT_TYPE_PRODUCTS,
VALID_PROPERTY_DATA_TYPES,
VALID_PROPERTY_WIDGET... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/lines.py | hubspot3/lines.py | """
hubspot lines api
"""
from typing import Dict, Union
from hubspot3.base import BaseClient
from hubspot3.crm_associations import CRMAssociationsClient
from hubspot3.utils import get_log, prettify, ordered_dict
LINES_API_VERSION = "1"
class LinesClient(BaseClient):
"""
Line Items API endpoint
:see: h... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/users.py | hubspot3/users.py | """
hubspot users api
"""
from typing import Union
from hubspot3.base import BaseClient
USERS_API_VERSION = "v3"
class UsersClient(BaseClient):
"""
hubspot3 Users client
:see: https://developers.hubspot.com/docs/api/settings/user-provisioning
"""
def _get_path(self, subpath: str):
"""G... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/owners.py | hubspot3/owners.py | """
hubspot owners api
"""
from hubspot3.crm_associations import CRMAssociationsClient
from hubspot3.base import BaseClient
OWNERS_API_VERSION = "v3"
class OwnersClient(BaseClient):
"""
hubspot3 Owners client
:see: https://developers.hubspot.com/docs/methods/owners/owners_overview
"""
def _get... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/cms_layouts.py | hubspot3/cms_layouts.py | """
hubspot cms_layout api client
"""
from hubspot3.base import BaseClient
LAYOUTS_API_VERSION = "2"
class CMSLayoutsClient(BaseClient):
"""
provides a client for accessing hubspot layout info
"""
def _get_path(self, subpath: str) -> str:
return f"content/api/v{LAYOUTS_API_VERSION}/layouts... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/leads.py | hubspot3/leads.py | """
hubspot leads api
"""
import time
from typing import Dict, List
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
LEADS_API_VERSION = "1"
def list_to_snake_dict(list_: List) -> Dict:
dictionary = {}
for item in list_:
dictionary[item] = item
if item.lower() != item... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/error.py | hubspot3/error.py | """
hubspot3 error helpers
"""
import json
from hubspot3.utils import force_utf8, uglify_hapikey
class EmptyResult:
"""
Null Object pattern to prevent Null reference errors
when there is no result
"""
def __init__(self):
self.status = 0
self.body = ""
self.msg = ""
... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/blog.py | hubspot3/blog.py | """
hubspot blog api client
"""
import json
from typing import Any, Dict
from hubspot3.base import BaseClient
BLOG_API_VERSION = "2"
COMMENTS_API_VERSION = "3"
TOPICS_API_VERSION = "3"
class BlogClient(BaseClient):
"""
provides a client for accessing hubspot blog info
"""
def _get_path(self, subpa... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/cms_templates.py | hubspot3/cms_templates.py | """
hubspot cms_templates api client
"""
from hubspot3.base import BaseClient
TEMPLATES_API_VERSION = "2"
class CMSTemplatesClient(BaseClient):
"""
provides a client for accessing hubspot template info
"""
def _get_path(self, subpath: str) -> str:
return f"content/api/v{TEMPLATES_API_VERSI... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/ecommerce_bridge.py | hubspot3/ecommerce_bridge.py | """
hubspot ecommerce bridge api
"""
from collections.abc import Mapping, Sequence
from typing import Dict, List, Optional
from hubspot3.base import BaseClient
from hubspot3.error import HubspotBadConfig
from hubspot3.utils import get_log
ECOMMERCE_BRIDGE_API_VERSION = "2"
MAX_ECOMMERCE_BRIDGE_SYNC_MESSAGES = 200 #... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/companies_properties.py | hubspot3/companies_properties.py | """
hubspot companies properties api
"""
from typing import List, Optional, Union
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
COMPANIES_PROPERTIES_API_VERSION = "1"
class CompaniesPropertiesClient(BaseClient):
"""
The hubspot3 Companies Properties client uses the _make_request m... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/crm_association_labels.py | hubspot3/crm_association_labels.py | """
hubspot crm_association_labels api
"""
from enum import Enum
from typing import List, Dict, Optional, Union
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
ASSOCIATIONS_API_VERSION = "4"
class ObjectTypeDefinitions(Enum):
"""see https://developers.hubspot.com/docs/api/crm/understand... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/contacts.py | hubspot3/contacts.py | """
hubspot contacts api
"""
import warnings
from typing import Dict, List, Optional, Union
from hubspot3.crm_associations import CRMAssociationsClient
from hubspot3.base import BaseClient
from hubspot3.utils import prettify, get_log
CONTACTS_API_VERSION = "1"
class ContactsClient(BaseClient):
"""
The hubs... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/engagements.py | hubspot3/engagements.py | """
hubspot engagements api
"""
from typing import Dict, List
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
ENGAGEMENTS_API_VERSION = "1"
class EngagementsClient(BaseClient):
"""
The hubspot3 Engagements client uses the _make_request method to call the API
for data. It return... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/broadcast.py | hubspot3/broadcast.py | """
hubspot broadcast api
"""
from typing import Any, Dict, List, Optional
from hubspot3.base import BaseClient
HUBSPOT_BROADCAST_API_VERSION = "1"
class BaseSocialObject:
"""base social object"""
def _camel_case_to_underscores(self, text: str) -> str:
result = []
pos = 0
while pos... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/oauth2.py | hubspot3/oauth2.py | """
hubspot OAuth2 api
"""
from typing import Optional
from urllib.parse import urlencode
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
OAUTH2_API_VERSION = "1"
class OAuth2Client(BaseClient):
"""
The hubspot3 OAuth2 client uses the _make_request method to call the
API for dat... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/__main__.py | hubspot3/__main__.py | """
Command-line interface for the Hubspot client
"""
import json
import sys
import types
from functools import wraps
from typing import Callable, Dict, List, Tuple
from fire.core import Fire as fire, _Fire as fire_execute
from fire.helptext import HelpText as build_usage_string
from fire.parser import SeparateFlagArg... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/crm_associations.py | hubspot3/crm_associations.py | """
hubspot crm_associations api
"""
from enum import Enum
from typing import Union
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
ASSOCIATIONS_API_VERSION = "1"
class Definitions(Enum):
"""
:see: https://developers.hubspot.com/docs/methods/crm-associations/crm-associations-overvie... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/products.py | hubspot3/products.py | """
hubspot products api
"""
from typing import Dict, List, Optional
from hubspot3.base import BaseClient
from hubspot3.utils import prettify, get_log, ordered_dict
PRODUCTS_API_VERSION = "1"
class ProductsClient(BaseClient):
"""
Products extension for products API endpoint
:see: https://developers.hub... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/utils.py | hubspot3/utils.py | """
base utils for the hubspot3 library
"""
import logging
import sys
from collections import OrderedDict
from urllib import parse
from typing import Dict, Union
PY_VERSION = sys.version_info
class NullHandler(logging.Handler):
def emit(self, record):
pass
def get_log(name: str):
logger = logging... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/settings.py | hubspot3/settings.py | """
hubspot settings api
"""
from typing import Dict
from hubspot3.base import BaseClient
from hubspot3.error import HubspotError
SETTINGS_API_VERSION = "v1"
class SettingsClient(BaseClient):
"""
hubspot3 Settings client
Use this to read settings for a given API key, as well as update a setting.
:s... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/email_events.py | hubspot3/email_events.py | """
hubspot email events api
"""
from typing import Optional
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
EMAIL_EVENTS_API_VERSION = "1"
class EmailEventsClient(BaseClient):
"""
The hubspot3 Email Events client uses the _make_request method to call the
API for data. It retur... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/__init__.py | hubspot3/__init__.py | """
hubspot3 module
"""
from datetime import datetime, timedelta
from typing import Any, Optional
from hubspot3.error import HubspotBadConfig, HubspotNoConfig
class Hubspot3UsageLimits:
"""a nicer wrapper for the usage limit data"""
class FetchStatus:
"""fetch status enum"""
NONE = ""
... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/email_subscription.py | hubspot3/email_subscription.py | """
hubspot email subscription api
"""
from typing import Dict, Iterable, Mapping, Optional
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
EMAIL_SUBSCRIPTION_API_VERSION = "1"
class EmailSubscriptionClient(BaseClient):
"""
The hubspot3 Email Subscription client uses the _make_reque... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/prospects.py | hubspot3/prospects.py | """
hubspot prospects client
"""
from hubspot3.base import BaseClient
PROSPECTS_API_VERSION = "v1"
class ProspectsClient(BaseClient):
"""
Python client for the HubSpot Prospects API.
This client provides convenience methods for the HubSpot Prospects API.
It is a work in progress, and contributions ... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
jpetrucciani/hubspot3 | https://github.com/jpetrucciani/hubspot3/blob/37a12eea9e08fe8effa60c8f117b5bf9416b00a4/hubspot3/cms_files.py | hubspot3/cms_files.py | """
hubspot cms_files api
"""
from typing import Dict
from hubspot3.base import BaseClient
CMS_FILES_API_VERSION = "2"
class CMSFilesClient(BaseClient):
"""
provides a client for accessing cms files
"""
def _get_path(self, subpath: str) -> str:
return f"filemanager/api/v{CMS_FILES_API_VERS... | python | MIT | 37a12eea9e08fe8effa60c8f117b5bf9416b00a4 | 2026-01-05T07:09:09.017152Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.