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
taomanwai/tensorboardcolab
https://github.com/taomanwai/tensorboardcolab/blob/337dce9890dadcb977b60322c30c76dee7fb42b1/tensorboardcolab/callbacks.py
tensorboardcolab/callbacks.py
import tensorflow as tf from keras.callbacks import TensorBoard import time import os import io from tensorboardcolab.core import TensorBoardColab class TensorBoardColab: def __init__(self, port=6006, graph_path='./Graph', startup_waiting_time=8): self.port = port self.graph_path = graph_path ...
python
MIT
337dce9890dadcb977b60322c30c76dee7fb42b1
2026-01-05T07:13:48.796857Z
false
taomanwai/tensorboardcolab
https://github.com/taomanwai/tensorboardcolab/blob/337dce9890dadcb977b60322c30c76dee7fb42b1/tensorboardcolab/core.py
tensorboardcolab/core.py
import tensorflow as tf from keras.callbacks import TensorBoard import time import os import io class TensorBoardColab: def __init__(self, port=6006, graph_path='./Graph', startup_waiting_time=8): self.port = port self.graph_path = graph_path self.writer = None self.deep_writers = {...
python
MIT
337dce9890dadcb977b60322c30c76dee7fb42b1
2026-01-05T07:13:48.796857Z
false
taomanwai/tensorboardcolab
https://github.com/taomanwai/tensorboardcolab/blob/337dce9890dadcb977b60322c30c76dee7fb42b1/tensorboardcolab/__init__.py
tensorboardcolab/__init__.py
from tensorboardcolab.core import * from tensorboardcolab.callbacks import *
python
MIT
337dce9890dadcb977b60322c30c76dee7fb42b1
2026-01-05T07:13:48.796857Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/tests/conftest.py
tests/conftest.py
import io import lorem import numpy as np import pydub import pytest from _pytest.logging import LogCaptureFixture from loguru import logger import pyrobbot from pyrobbot.chat import Chat from pyrobbot.chat_configs import ChatOptions, VoiceChatConfigs from pyrobbot.voice_chat import VoiceChat @pytest.fixture() def ...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/tests/smoke/test_app.py
tests/smoke/test_app.py
import contextlib import streamlit import streamlit_webrtc.component from pyrobbot.app import app def test_app(mocker, default_voice_chat_configs): class MockAttrDict(streamlit.runtime.state.session_state_proxy.SessionStateProxy): def __getattr__(self, attr): return self.get(attr, mocker.Mag...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/tests/smoke/test_commands.py
tests/smoke/test_commands.py
import io import subprocess import pytest from pydub import AudioSegment from pyrobbot.__main__ import main from pyrobbot.argparse_wrapper import get_parsed_args def test_default_command(): args = get_parsed_args(argv=[]) assert args.command == "ui" @pytest.mark.usefixtures("_input_builtin_mocker") @pytes...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/tests/unit/test_internet_utils.py
tests/unit/test_internet_utils.py
import contextlib import duckduckgo_search from pyrobbot.internet_utils import websearch # if called inside tests or fixtures. Leave it like this for now. search_results = [] with contextlib.suppress(duckduckgo_search.exceptions.DuckDuckGoSearchException): search_results = list(websearch("foobar")) def test_we...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/tests/unit/test_chat.py
tests/unit/test_chat.py
import openai import pytest from pyrobbot import GeneralDefinitions from pyrobbot.chat import Chat from pyrobbot.chat_configs import ChatOptions @pytest.mark.order(1) @pytest.mark.usefixtures("_input_builtin_mocker") @pytest.mark.no_chat_completion_create_mocking() @pytest.mark.parametrize("user_input", ["regular-in...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/tests/unit/test_text_to_speech.py
tests/unit/test_text_to_speech.py
import pytest from pydub import AudioSegment from pyrobbot.sst_and_tts import SpeechToText @pytest.mark.parametrize("stt_engine", ["google", "openai"]) def test_stt(default_voice_chat, stt_engine): """Test the speech-to-text method.""" default_voice_chat.stt_engine = stt_engine stt = SpeechToText( ...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/tests/unit/test_voice_chat.py
tests/unit/test_voice_chat.py
import contextlib import pytest from pydantic import ValidationError from pydub import AudioSegment from sounddevice import PortAudioError from pyrobbot.chat_configs import VoiceChatConfigs from pyrobbot.sst_and_tts import TextToSpeech from pyrobbot.voice_chat import VoiceChat def test_soundcard_import_check(mocker...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/chat_configs.py
pyrobbot/chat_configs.py
#!/usr/bin/env python3 """Registration and validation of options.""" import argparse import json import types import typing from getpass import getuser from pathlib import Path from typing import Literal, Optional, get_args, get_origin from pydantic import BaseModel, Field from . import GeneralDefinitions from .token...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/argparse_wrapper.py
pyrobbot/argparse_wrapper.py
#!/usr/bin/env python3 """Wrappers for argparse functionality.""" import argparse import contextlib import sys from pydantic import BaseModel from . import GeneralDefinitions from .chat_configs import ChatOptions, VoiceChatConfigs from .command_definitions import ( accounting_report, browser_chat, termina...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/chat_context.py
pyrobbot/chat_context.py
"""Chat context/history management.""" import ast import itertools from abc import ABC, abstractmethod from datetime import datetime, timezone from typing import TYPE_CHECKING import numpy as np import openai import pandas as pd from scipy.spatial.distance import cosine as cosine_similarity from .embeddings_database...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/internet_utils.py
pyrobbot/internet_utils.py
"""Internet search module for the package.""" import asyncio import re import numpy as np import requests from bs4 import BeautifulSoup from bs4.element import Comment from duckduckgo_search import AsyncDDGS from loguru import logger from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pai...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/general_utils.py
pyrobbot/general_utils.py
"""General utility functions and classes.""" import difflib import inspect import json import re import time from functools import wraps from pathlib import Path from typing import Optional import httpx import openai from loguru import logger from pydub import AudioSegment from pydub.silence import detect_leading_sil...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/chat.py
pyrobbot/chat.py
#!/usr/bin/env python3 """Implementation of the Chat class.""" import contextlib import json import shutil import uuid from collections import defaultdict from datetime import datetime from pathlib import Path from typing import Optional import openai from attr import dataclass from loguru import logger from pydub imp...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/embeddings_database.py
pyrobbot/embeddings_database.py
"""Management of embeddings/chat history storage and retrieval.""" import datetime import json import sqlite3 from pathlib import Path from typing import Union import pandas as pd from loguru import logger class EmbeddingsDatabase: """Class for managing an SQLite database storing embeddings and associated data....
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/__main__.py
pyrobbot/__main__.py
#!/usr/bin/env python3 """Program's entry point.""" from .argparse_wrapper import get_parsed_args def main(argv=None): """Program's main routine.""" args = get_parsed_args(argv=argv) args.run_command(args=args)
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/command_definitions.py
pyrobbot/command_definitions.py
#!/usr/bin/env python3 """Commands supported by the package's script.""" import subprocess from loguru import logger from . import GeneralDefinitions from .chat import Chat from .chat_configs import ChatOptions from .voice_chat import VoiceChat def voice_chat(args): """Start a voice-based chat.""" VoiceChat...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/sst_and_tts.py
pyrobbot/sst_and_tts.py
"""Code related to speech-to-text and text-to-speech conversions.""" import io import socket import uuid from dataclasses import dataclass, field from typing import Literal import numpy as np import speech_recognition as sr from gtts import gTTS from loguru import logger from openai import OpenAI from pydub import Au...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/openai_utils.py
pyrobbot/openai_utils.py
"""Utils for using the OpenAI API.""" import hashlib import shutil from typing import TYPE_CHECKING, Optional import openai from loguru import logger from . import GeneralDefinitions from .chat_configs import OpenAiApiCallOptions from .general_utils import retry from .tokens import get_n_tokens_from_msgs if TYPE_CH...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/__init__.py
pyrobbot/__init__.py
#!/usr/bin/env python3 """Unnoficial OpenAI API UI and CLI tool.""" import os import sys import tempfile import uuid from collections import defaultdict from dataclasses import dataclass from importlib.metadata import metadata, version from pathlib import Path import ipinfo import requests from loguru import logger l...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/tokens.py
pyrobbot/tokens.py
"""Management of token usage and costs for OpenAI API.""" import contextlib import datetime import sqlite3 from pathlib import Path from typing import Optional import pandas as pd import tiktoken # See <https://openai.com/pricing> for the latest prices. PRICE_PER_K_TOKENS_LLM = { # Continuous model upgrades (mod...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/voice_chat.py
pyrobbot/voice_chat.py
"""Code related to the voice chat feature.""" import contextlib import io import queue import threading import time from collections import defaultdict, deque from datetime import datetime import chime import numpy as np import pydub import pygame import soundfile as sf import webrtcvad from loguru import logger from...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/app/app_utils.py
pyrobbot/app/app_utils.py
"""Utility functions and classes for the app.""" import contextlib import datetime import os import queue import threading from typing import TYPE_CHECKING import streamlit as st from loguru import logger from PIL import Image from pydub import AudioSegment from streamlit.runtime.scriptrunner import add_script_run_ct...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/app/multipage.py
pyrobbot/app/multipage.py
"""Code for the creation streamlit apps with dynamically created pages.""" import contextlib import datetime import hashlib import os import queue import sys import threading import time from abc import ABC, abstractmethod, abstractproperty from collections import defaultdict, deque from json.decoder import JSONDecode...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
true
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/app/app_page_templates.py
pyrobbot/app/app_page_templates.py
"""Utilities for creating pages in a streamlit app.""" import base64 import contextlib import datetime import queue import time import uuid from abc import ABC, abstractmethod from pathlib import Path from typing import TYPE_CHECKING, Union import streamlit as st from audio_recorder_streamlit import audio_recorder fr...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/app/__init__.py
pyrobbot/app/__init__.py
"""UI for the package."""
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
paulovcmedeiros/pyRobBot
https://github.com/paulovcmedeiros/pyRobBot/blob/7e77d3b1aee052cfa350a806371de75b9b713ad6/pyrobbot/app/app.py
pyrobbot/app/app.py
"""Entrypoint for the package's UI.""" from pyrobbot import GeneralDefinitions from pyrobbot.app.multipage import MultipageChatbotApp def run_app(): """Create and run an instance of the pacage's app.""" MultipageChatbotApp( page_title=GeneralDefinitions.APP_NAME, page_icon=":speech_balloon:",...
python
MIT
7e77d3b1aee052cfa350a806371de75b9b713ad6
2026-01-05T07:13:49.794839Z
false
FudanDISC/SocioVerse
https://github.com/FudanDISC/SocioVerse/blob/143d61c2405baaf455f09d99841e48c7d6f85783/evaluation/electionSim_evaluation.py
evaluation/electionSim_evaluation.py
import json import os import numpy as np def norm_and_rmse(pred, target): pred = np.array([item/sum(pred) for item in pred]) target = np.array([item/sum(target) for item in target]) # print(pred) # print(target) return np.sqrt(((pred - target) ** 2).mean()) eval_folder = 'output/2020_1000' year = ...
python
Apache-2.0
143d61c2405baaf455f09d99841e48c7d6f85783
2026-01-05T07:13:41.899845Z
false
FudanDISC/SocioVerse
https://github.com/FudanDISC/SocioVerse/blob/143d61c2405baaf455f09d99841e48c7d6f85783/evaluation/ecoSim_evaluation.py
evaluation/ecoSim_evaluation.py
import json from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt import pandas as pd import warnings from scipy.stats import entropy import os warnings.filterwarnings("ignore") def value_evaluation(dir): data = [] with open(dir, 'r') as f: for line in f: data.append(jso...
python
Apache-2.0
143d61c2405baaf455f09d99841e48c7d6f85783
2026-01-05T07:13:41.899845Z
false
FudanDISC/SocioVerse
https://github.com/FudanDISC/SocioVerse/blob/143d61c2405baaf455f09d99841e48c7d6f85783/evaluation/pressSim_evaluation.py
evaluation/pressSim_evaluation.py
import numpy as np from scipy.stats import entropy import json # normalize def convert_to_scores(data): converted_data = [] for row in data: score = 0 for i in range(len(row)): score += row[i]/10000*(i+1) converted_data.append(score/5) return np.array(converted_data) i...
python
Apache-2.0
143d61c2405baaf455f09d99841e48c7d6f85783
2026-01-05T07:13:41.899845Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/benchmarks/benchmarks.py
benchmarks/benchmarks.py
"""Morecantile/Mercantile/Utiles comparison benchmark The benchmark suite is adapted from jessekrubin/utiles https://github.com/jessekrubin/utiles/blob/ea58b9a017a2e3528f03cc20f16ef531737b863f/utiles-pyo3/bench/test_bench.py#L17-L25 """ # This file is a modified version of https://github.com/jessekrubin/utiles/blob/ea...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/morecantile/defaults.py
morecantile/defaults.py
"""Default Morecantile TMS.""" import os import pathlib from copy import copy, deepcopy import attr from morecantile.errors import InvalidIdentifier from morecantile.models import TileMatrixSet morecantile_tms_dir = pathlib.Path(__file__).parent.joinpath("data") tms_paths = list(pathlib.Path(morecantile_tms_dir).gl...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/morecantile/models.py
morecantile/models.py
"""Pydantic modules for OGC TileMatrixSets (https://www.ogc.org/standards/tms)""" import math import os import warnings from collections.abc import Iterator, Sequence from functools import cached_property, lru_cache from typing import Any, Literal import pyproj from pydantic import ( AnyHttpUrl, AnyUrl, B...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
true
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/morecantile/commons.py
morecantile/commons.py
"""Morecantile commons.""" from typing import NamedTuple class BoundingBox(NamedTuple): """A xmin,ymin,xmax,ymax coordinates tuple. Args: left (number): min horizontal coordinate. bottom (number):min vertical coordinate. right (number): max horizontal coordinate. top (number)...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/morecantile/utils.py
morecantile/utils.py
"""morecantile utils.""" import math from pyproj import CRS from pyproj.enums import WktVersion from morecantile.commons import BoundingBox, Coords, Tile from morecantile.errors import TileArgParsingError def _parse_tile_arg(*args) -> Tile: """ Parse the *tile arg of module functions Copy from https:/...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/morecantile/errors.py
morecantile/errors.py
"""Morecantile errors.""" class MorecantileError(Exception): """Base error for Morecantile.""" class InvalidIdentifier(MorecantileError): """Invalid TileMatrixSet indentifier.""" class InvalidLatitudeError(MorecantileError): """Raised when math errors occur beyond ~85 degrees N or S""" class TileArg...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/morecantile/__init__.py
morecantile/__init__.py
""" morecantile is an adaptation of mapbox/mercantile to work with custom projection. Refs: - mapproxy: https://github.com/mapproxy/mapproxy - mercantile: https://github.com/mapbox/mercantile - tiletanic: https://github.com/DigitalGlobe/tiletanic """ __version__ = "7.0.1" from .commons import BoundingBo...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/morecantile/scripts/cli.py
morecantile/scripts/cli.py
"""Morecantile command line interface""" import json import logging import sys import click from pyproj import CRS import morecantile logger = logging.getLogger(__name__) WGS84_CRS = CRS.from_epsg(4326) def configure_logging(verbosity): """Configure log verbosity. Original code from https://github.com/m...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/morecantile/scripts/__init__.py
morecantile/scripts/__init__.py
"""morecantile CLI."""
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/tests/test_morecantile.py
tests/test_morecantile.py
"""Tests for morecantile.""" import math import warnings import mercantile import pytest from pyproj import CRS import morecantile from morecantile.errors import ( InvalidIdentifier, InvalidZoomError, PointOutsideTMSBounds, ) from morecantile.utils import is_power_of_two, meters_per_unit DEFAULT_GRID_CO...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/tests/test_utils.py
tests/test_utils.py
"""test morecantile utils.""" import math import pytest from pyproj import CRS from morecantile import utils @pytest.mark.parametrize( "crs,unit", [ (CRS.from_epsg(4326), 2 * math.pi * 6378137 / 360.0), (CRS.from_epsg(3857), 1.0), (CRS.from_epsg(2276), 0.30480060960121924), ...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/tests/test_mercantile_conform.py
tests/test_mercantile_conform.py
"""Test Conformance with Mercantile.""" from random import sample import mercantile import pytest import morecantile tms = morecantile.tms.get("WebMercatorQuad") @pytest.mark.parametrize("zoom", range(0, 20)) def test_get_tile(zoom: int): """Make sure mercantile and morecantile returns the same thing.""" ...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/tests/test_cli.py
tests/test_cli.py
"""Tests of the morecantile CLI""" import json import pytest from click.testing import CliRunner from morecantile.scripts.cli import cli def test_cli_shapes(): """ Test shapes. From https://github.com/mapbox/mercantile/blob/master/tests/test_cli.py """ runner = CliRunner() result = runner....
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/tests/test_models.py
tests/test_models.py
"""Test TileMatrixSet model.""" import json import os import random from collections.abc import Iterable import pyproj import pytest from pydantic import ValidationError import morecantile from morecantile.commons import Tile from morecantile.errors import InvalidIdentifier from morecantile.models import CRS, CRSWKT...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/tests/benchmarks.py
tests/benchmarks.py
"""Morecantile benchmark.""" import pytest import morecantile from morecantile.commons import BoundingBox tms = morecantile.tms.get("WebMercatorQuad") # Test tiles from https://github.com/jessekrubin/utiles/blob/ea58b9a017a2e3528f03cc20f16ef531737b863f/utiles-pyo3/bench/test_bench.py TEST_TILES = ( (0, 0, 0), ...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/tests/__init__.py
tests/__init__.py
"""morecantile tests suite."""
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
developmentseed/morecantile
https://github.com/developmentseed/morecantile/blob/b6c697b13d56470840e45eaf8cc22c90ee60fd62/tests/test_tms_variable_width.py
tests/test_tms_variable_width.py
"""Tests for morecantile.""" import pytest import morecantile from morecantile.commons import BoundingBox, Tile from morecantile.errors import InvalidZoomError from morecantile.models import TileMatrix gnosisg_tms = morecantile.tms.get("GNOSISGlobalGrid") cdb1_tms = morecantile.tms.get("CDB1GlobalGrid") def test_c...
python
MIT
b6c697b13d56470840e45eaf8cc22c90ee60fd62
2026-01-05T07:14:04.097493Z
false
yanring/Megatron-MoE-ModelZoo
https://github.com/yanring/Megatron-MoE-ModelZoo/blob/1b93710746711003f029cbaa3608cae7637ec554/misc/tools/deepseek_mem_estimate.py
misc/tools/deepseek_mem_estimate.py
def calc(name, seq_len, n_layers, n_embed, vocab_size, n_head, n_head_kv, ff_factor, n_experts, n_activated_experts, ffn_hidden,moe_ffn_hidden, first_k_dense=0, q_lora_rank=0, k_lora_rank=0, v_lora_rank=0, qk_head_dim=0, rope_head_dim=0, v_head_dim=0, shared_expert_num=0, mt...
python
MIT
1b93710746711003f029cbaa3608cae7637ec554
2026-01-05T07:14:05.433028Z
false
yanring/Megatron-MoE-ModelZoo
https://github.com/yanring/Megatron-MoE-ModelZoo/blob/1b93710746711003f029cbaa3608cae7637ec554/ckpt_convert_scripts/DeepSeek-V2/deepseek_v2_hf_to_mg.py
ckpt_convert_scripts/DeepSeek-V2/deepseek_v2_hf_to_mg.py
import json import os import random import re import numpy as np import torch import torch.distributed as dist from safetensors import safe_open from megatron.training import get_args from megatron.training.checkpointing import get_checkpoint_name from megatron.training.initialize import initialize_megatron from pret...
python
MIT
1b93710746711003f029cbaa3608cae7637ec554
2026-01-05T07:14:05.433028Z
false
yanring/Megatron-MoE-ModelZoo
https://github.com/yanring/Megatron-MoE-ModelZoo/blob/1b93710746711003f029cbaa3608cae7637ec554/ckpt_convert_scripts/DeepSeek-V3/deepseek_v3_hf_to_mg.py
ckpt_convert_scripts/DeepSeek-V3/deepseek_v3_hf_to_mg.py
import json import os import random import re import numpy as np import torch import torch.distributed as dist from safetensors import safe_open from megatron.training import get_args from megatron.training.checkpointing import get_checkpoint_name from megatron.training.initialize import initialize_megatron from pret...
python
MIT
1b93710746711003f029cbaa3608cae7637ec554
2026-01-05T07:14:05.433028Z
false
NVlabs/TokenBench
https://github.com/NVlabs/TokenBench/blob/dcbb7d587abe2804da4d23ac46f9caf17f4b641c/token_bench/metrics_cli.py
token_bench/metrics_cli.py
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # 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 # # ht...
python
Apache-2.0
dcbb7d587abe2804da4d23ac46f9caf17f4b641c
2026-01-05T07:14:06.639305Z
false
NVlabs/TokenBench
https://github.com/NVlabs/TokenBench/blob/dcbb7d587abe2804da4d23ac46f9caf17f4b641c/token_bench/fvd.py
token_bench/fvd.py
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # 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 # # ht...
python
Apache-2.0
dcbb7d587abe2804da4d23ac46f9caf17f4b641c
2026-01-05T07:14:06.639305Z
false
NVlabs/TokenBench
https://github.com/NVlabs/TokenBench/blob/dcbb7d587abe2804da4d23ac46f9caf17f4b641c/token_bench/video/preprocessing_script.py
token_bench/video/preprocessing_script.py
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # 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 # # ht...
python
Apache-2.0
dcbb7d587abe2804da4d23ac46f9caf17f4b641c
2026-01-05T07:14:06.639305Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/setup.py
setup.py
from __future__ import annotations import os from setuptools import setup dependencies = [ "aiofiles==22.1.0", # Async IO for files "blspy==1.0.16", # Signature library "chiavdf==1.0.7", # timelord and vdf verification "chiabip158==1.1", # bip158-style wallet filters "chiapos==1.0.11", # pro...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/activated.py
activated.py
#!/usr/bin/env python3 from __future__ import annotations import os import pathlib import subprocess import sys here = pathlib.Path(__file__).parent def main(*args: str) -> int: if len(args) == 0: print("Parameters required") return 1 if sys.platform == "win32": script = "activated...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/installhelper.py
installhelper.py
# # Install helper code to manage inserting the correct version for the GUI # Gets the version from the result of "flax version" # Converts to proper symver format so NPM doesn't complain # Adds the version info to the package.json file # from __future__ import annotations import json import os import subprocess from ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/__init__.py
flax/__init__.py
from __future__ import annotations from pkg_resources import DistributionNotFound, get_distribution, resource_filename try: __version__ = get_distribution("flax-blockchain").version except DistributionNotFound: # package is not installed __version__ = "unknown" PYINSTALLER_SPEC_PATH = resource_filename("...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/condition_tools.py
flax/util/condition_tools.py
from typing import Dict, List, Optional, Tuple from clvm.casts import int_from_bytes from flax.types.blockchain_format.coin import Coin from flax.types.blockchain_format.program import Program, SerializedProgram from flax.types.blockchain_format.sized_bytes import bytes32, bytes48 from flax.types.condition_opcodes im...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/db_wrapper.py
flax/util/db_wrapper.py
from __future__ import annotations import asyncio import contextlib import functools import sqlite3 from dataclasses import dataclass, field from datetime import datetime from pathlib import Path from types import TracebackType from typing import Any, AsyncIterator, Dict, Generator, Iterable, Optional, Type, Union im...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/paginator.py
flax/util/paginator.py
from __future__ import annotations import dataclasses from math import ceil from typing import Sequence class InvalidPageSizeLimit(Exception): def __init__(self, page_size_limit: int) -> None: super().__init__(f"Page size limit must be one or more, not: {page_size_limit}") class InvalidPageSizeError(Ex...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/task_timing.py
flax/util/task_timing.py
from __future__ import annotations import asyncio import inspect import os import sys import time from types import FrameType from typing import Any, Dict, List # This is a development utility that instruments tasks (coroutines) and records # wall-clock time they spend in various functions. Since it relies on # setpr...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/path.py
flax/util/path.py
from __future__ import annotations import os from pathlib import Path from typing import Union def path_from_root(root: Path, path_str: Union[str, Path]) -> Path: """ If path is relative, prepend root If path is absolute, return it directly. """ root = Path(os.path.expanduser(str(root))) path...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/dump_keyring.py
flax/util/dump_keyring.py
#!/usr/bin/env python3 import click import colorama import yaml from flax.cmds.passphrase_funcs import prompt_for_passphrase, read_passphrase_from_file from flax.util.default_root import DEFAULT_KEYS_ROOT_PATH from flax.util.file_keyring import FileKeyringContent from flax.util.keyring_wrapper import DEFAULT_PASSPHRA...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/json_util.py
flax/util/json_util.py
from __future__ import annotations import dataclasses import json from typing import Any from aiohttp import web from flax.wallet.util.wallet_types import WalletType class EnhancedJSONEncoder(json.JSONEncoder): """ Encodes bytes as hex strings with 0x, and converts all dataclasses to json. """ def...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/beta_metrics.py
flax/util/beta_metrics.py
from __future__ import annotations import asyncio import logging import platform import socket from dataclasses import dataclass from pathlib import Path from typing import Any, Dict, List, Optional import psutil from flax.util.config import load_config log = logging.getLogger("beta") metrics_log_interval_default ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/make_test_constants.py
flax/util/make_test_constants.py
from __future__ import annotations from typing import Dict from flax.consensus.constants import ConsensusConstants from flax.consensus.default_constants import DEFAULT_CONSTANTS def make_test_constants(test_constants_overrides: Dict) -> ConsensusConstants: return DEFAULT_CONSTANTS.replace(**test_constants_overr...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/hash.py
flax/util/hash.py
from __future__ import annotations from hashlib import sha256 from flax.types.blockchain_format.sized_bytes import bytes32 def std_hash(b, skip_bytes_conversion: bool = False) -> bytes32: """ The standard hash used in many places. """ if skip_bytes_conversion: return bytes32(sha256(b).digest...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/byte_types.py
flax/util/byte_types.py
from typing import BinaryIO, Iterable, SupportsBytes, Type, TypeVar, Union from typing_extensions import SupportsIndex _T_SizedBytes = TypeVar("_T_SizedBytes", bound="SizedBytes") def hexstr_to_bytes(input_str: str) -> bytes: """ Converts a hex string into bytes, removing the 0x if it's present. """ ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/permissions.py
flax/util/permissions.py
from __future__ import annotations import os from pathlib import Path from typing import Tuple def verify_file_permissions(path: Path, mask: int) -> Tuple[bool, int]: """ Check that the file's permissions are properly restricted, as compared to the permission mask """ mode = os.stat(path).st_mode...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/network.py
flax/util/network.py
from __future__ import annotations import asyncio import logging import socket import ssl from aiohttp import web from aiohttp.log import web_logger from dataclasses import dataclass from ipaddress import ip_address, IPv4Network, IPv6Network from typing import Iterable, List, Tuple, Union, Any, Optional, Dict from ty...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/partial_func.py
flax/util/partial_func.py
from __future__ import annotations def partial_async_gen(f, *args): """ Returns an async generator function which is equalivalent to the passed in function, but only takes in one parameter (the first one). """ async def inner(first_param): async for x in f(first_param, *args): ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/service_groups.py
flax/util/service_groups.py
from typing import KeysView, Generator SERVICES_FOR_GROUP = { "all": ( "flax_harvester flax_timelord_launcher flax_timelord flax_farmer " "flax_full_node flax_wallet flax_data_layer flax_data_layer_http" ).split(), # TODO: should this be `data_layer`? "data": "flax_wallet flax_data_laye...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/chunks.py
flax/util/chunks.py
from __future__ import annotations from typing import Iterator, List, TypeVar T = TypeVar("T") def chunks(in_list: List[T], size: int) -> Iterator[List[T]]: size = max(1, size) for i in range(0, len(in_list), size): yield in_list[i : i + size]
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/setproctitle.py
flax/util/setproctitle.py
from __future__ import annotations try: import setproctitle as pysetproctitle no_setproctitle = False except Exception: no_setproctitle = True def setproctitle(ps_name: str) -> None: if no_setproctitle is False: pysetproctitle.setproctitle(ps_name) def getproctitle() -> str: if no_setp...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/profiler.py
flax/util/profiler.py
import asyncio import cProfile import logging import pathlib from flax.util.path import path_from_root # to use the profiler, enable it config file, "enable_profiler" # the output will be printed to your flax root path, e.g. ~/.flax/mainnet/profile/ # to analyze the profile, run: # python flax/utils/profiler.py ~/...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/pip_import.py
flax/util/pip_import.py
"Import a package and install it with PIP if it doesn't exist." from __future__ import annotations import subprocess import sys def pip_import(module, pypi_name=None): """ Return None if we can't import or install it. """ try: return __import__(module) except ImportError: pass ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/generator_tools.py
flax/util/generator_tools.py
from typing import Any, Iterator, List, Tuple, Optional from chiabip158 import PyBIP158 from flax.types.blockchain_format.coin import Coin from flax.types.blockchain_format.sized_bytes import bytes32 from flax.types.full_block import FullBlock from flax.types.header_block import HeaderBlock from flax.types.spend_bundl...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/check_fork_next_block.py
flax/util/check_fork_next_block.py
from typing import List, Callable from flax.consensus.blockchain_interface import BlockchainInterface from flax.util.ints import uint32 async def check_fork_next_block( blockchain: BlockchainInterface, fork_point_height: uint32, peers_with_peak: List, check_block_future: Callable ): our_peak_height = blockch...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/bech32m.py
flax/util/bech32m.py
# Copyright (c) 2017 Pieter Wuille # # 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, copy, modify, merge, publish, distr...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/keychain.py
flax/util/keychain.py
from __future__ import annotations import pkg_resources import sys import unicodedata from bitstring import BitArray # pyright: reportMissingImports=false from blspy import AugSchemeMPL, G1Element, PrivateKey # pyright: reportMissingImports=false from flax.util.errors import ( KeychainException, KeychainNotS...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/lock.py
flax/util/lock.py
from __future__ import annotations from dataclasses import dataclass from pathlib import Path from types import TracebackType from typing import Optional, Type from filelock import BaseFileLock, FileLock, Timeout from typing_extensions import final class LockfileError(Exception): pass @final @dataclass(frozen...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/chain_utils.py
flax/util/chain_utils.py
from typing import List from clvm.casts import int_from_bytes from flax.types.blockchain_format.coin import Coin from flax.types.blockchain_format.program import SerializedProgram from flax.types.blockchain_format.sized_bytes import bytes32 from flax.types.condition_opcodes import ConditionOpcode from flax.util.condi...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/keyring_wrapper.py
flax/util/keyring_wrapper.py
from blspy import PrivateKey # pyright: reportMissingImports=false from flax.util.default_root import DEFAULT_KEYS_ROOT_PATH from flax.util.file_keyring import FileKeyring from flax.util.misc import prompt_yes_no from keyrings.cryptfile.cryptfile import CryptFileKeyring # pyright: reportMissingImports=false from keyr...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/merkle_set.py
flax/util/merkle_set.py
from __future__ import annotations from abc import ABCMeta, abstractmethod from hashlib import sha256 from typing import Any, Dict, List, Tuple from flax.types.blockchain_format.sized_bytes import bytes32 """ A simple, confidence-inspiring Merkle Set standard Advantages of this standard: Low CPU requirements Small ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/validate_alert.py
flax/util/validate_alert.py
from __future__ import annotations import json from pathlib import Path from blspy import AugSchemeMPL, PublicKeyMPL, SignatureMPL from flax.util.byte_types import hexstr_to_bytes from flax.util.hash import std_hash def validate_alert_file(file_path: Path, pubkey: str) -> bool: text = file_path.read_text() ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/struct_stream.py
flax/util/struct_stream.py
from __future__ import annotations from typing import BinaryIO, SupportsInt, Type, TypeVar, Union from typing_extensions import Protocol, SupportsIndex _T_StructStream = TypeVar("_T_StructStream", bound="StructStream") # https://github.com/python/typeshed/blob/c2182fdd3e572a1220c70ad9c28fd908b70fb19b/stdlib/_types...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/flax_logging.py
flax/util/flax_logging.py
import logging from pathlib import Path from typing import Any, Dict, List, Optional import colorlog from concurrent_log_handler import ConcurrentRotatingFileHandler from logging.handlers import SysLogHandler from flax.cmds.init_funcs import flax_full_version_str from flax.util.path import path_from_root from flax.ut...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/ssl_check.py
flax/util/ssl_check.py
import os import stat import sys from flax.util.config import load_config, traverse_dict from flax.util.permissions import octal_mode_string, verify_file_permissions from logging import Logger from pathlib import Path from typing import Dict, List, Optional, Set, Tuple DEFAULT_PERMISSIONS_CERT_FILE: int = 0o644 DEFAUL...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/files.py
flax/util/files.py
import asyncio import logging import os import shutil from pathlib import Path from typing import Union from aiofiles import tempfile from typing_extensions import Literal log = logging.getLogger(__name__) def move_file(src: Path, dst: Path): """ Attempts to move the file at src to dst, falling back to a c...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/streamable.py
flax/util/streamable.py
from __future__ import annotations import dataclasses import io import os import pprint import traceback from enum import Enum from typing import ( Any, BinaryIO, Callable, ClassVar, Collection, Dict, List, Optional, Tuple, Type, TypeVar, Union, get_type_hints, ) fr...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/misc.py
flax/util/misc.py
from __future__ import annotations import dataclasses from pathlib import Path from typing import Any, Dict, Sequence, Union from flax.util.errors import InvalidPathError from flax.util.ints import uint16 from flax.util.streamable import Streamable, recurse_jsonify, streamable @streamable @dataclasses.dataclass(fro...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/errors.py
flax/util/errors.py
from __future__ import annotations from enum import Enum from pathlib import Path from typing import Any, List class Err(Enum): # temporary errors. Don't blacklist DOES_NOT_EXTEND = -1 BAD_HEADER_SIGNATURE = -2 MISSING_FROM_STORAGE = -3 INVALID_PROTOCOL_MESSAGE = -4 # We WILL ban for a protocol ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/memory_profiler.py
flax/util/memory_profiler.py
from __future__ import annotations import asyncio import logging import pathlib import tracemalloc from datetime import datetime from typing import Dict, List, Optional, Set from flax.util.path import path_from_root async def mem_profile_task(root_path: pathlib.Path, service: str, log: logging.Logger) -> None: ...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/recursive_replace.py
flax/util/recursive_replace.py
from __future__ import annotations from dataclasses import replace from typing import Any def recursive_replace(root_obj: Any, replace_str: str, replace_with: Any) -> Any: split_str = replace_str.split(".") if len(split_str) == 1: return replace(root_obj, **{split_str[0]: replace_with}) sub_obj =...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/config.py
flax/util/config.py
from __future__ import annotations import argparse import contextlib import copy import logging import os import shutil import sys import tempfile import time import traceback from pathlib import Path from typing import Any, Callable, Dict, Iterator, Optional, Union import pkg_resources import yaml from typing_extens...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/create_alert_file.py
flax/util/create_alert_file.py
from __future__ import annotations from pathlib import Path from typing import List from blspy import AugSchemeMPL from flax.util.ints import uint32 from flax.util.keychain import Keychain from flax.util.validate_alert import create_alert_file, create_not_ready_alert_file, validate_alert_file bitcoin_hash = None br...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/api_decorators.py
flax/util/api_decorators.py
from __future__ import annotations import functools import logging from dataclasses import dataclass, field from inspect import signature from typing import TYPE_CHECKING, Any, Callable, Coroutine, List, Optional, Union, get_type_hints from flax.protocols.protocol_message_types import ProtocolMessageTypes from flax.s...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false
Flax-Network/flax-blockchain
https://github.com/Flax-Network/flax-blockchain/blob/bb8715f3155bb8011a04cc8c05b3fa8133e4c64b/flax/util/db_synchronous.py
flax/util/db_synchronous.py
from __future__ import annotations def db_synchronous_on(setting: str) -> str: if setting == "on": return "NORMAL" if setting == "off": return "OFF" if setting == "full": return "FULL" # for now, default to synchronous=FULL mode. This can be made more # sophisticated in th...
python
Apache-2.0
bb8715f3155bb8011a04cc8c05b3fa8133e4c64b
2026-01-05T07:13:52.951017Z
false