text stringlengths 185 73.3k | repo stringlengths 7 100 | path stringlengths 4 146 | language stringclasses 7
values | hash stringlengths 16 16 | score float64 7 8.5 | stars int64 0 237k |
|---|---|---|---|---|---|---|
from datetime import UTC, datetime, timedelta
import pytest
from helpers import igepn_client
from helpers.cache import TtlCache
SAMPLE_CSV = (
"latitude,longitude,mag,depth,time,status,id,place\n"
"-2.1043,-77.6736,4.30,12.9727,2026/06/30 06:02:05,confirmed,igepn2026mrim,"
"a 53.97 km de Macas, Morona Sa... | DweskZ/EcuDataMCP | tests/test_igepn_client.py | .py | a37860e54ee6f292 | 7.06 | 12 |
import dash_mantine_components as dmc
from dash_iconify import DashIconify
from lib.constants import HEADER_HEIGHT
excluded_links = [
"/404",
"/styles-api",
"/style-props",
"/dash-iconify",
"/migration",
"/learning-resources",
]
def create_nav_link(icon, text, href, external=False):
"""C... | pip-install-python/dash-model-viewer | components/navbar.py | .py | 6b8b862396c323b1 | 7.48 | 8 |
"""Button entities for PANDA ESL writes."""
from __future__ import annotations
from collections.abc import Awaitable, Callable
from homeassistant.components.button import ButtonEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAss... | moryoav/ha-panda | custom_components/panda_esl/button.py | .py | 32de8d0e7d482fc3 | 7.45 | 7 |
"""Image entities for PANDA ESL rendered content."""
from __future__ import annotations
import base64
from dataclasses import dataclass
from datetime import datetime
import logging
from typing import Any
from homeassistant.components.image import Image, ImageEntity
from homeassistant.config_entries import ConfigEntr... | moryoav/ha-panda | custom_components/panda_esl/image.py | .py | 424132d24cdceb1d | 7.45 | 7 |
"""Data models for PANDA ESL advertisements."""
from __future__ import annotations
from collections.abc import Iterable
from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Any
from homeassistant.components.bluetooth import BluetoothServiceInfoBleak
from .const import (... | moryoav/ha-panda | custom_components/panda_esl/models.py | .py | 103537c1fd45d971 | 7.45 | 7 |
"""Supported PANDA ESL display profiles."""
from __future__ import annotations
import re
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class PandaEslDeviceProfile:
"""Geometry and identity for a supported PANDA ESL variant."""
key: str
family: str
tag_prefix: str
model: ... | moryoav/ha-panda | custom_components/panda_esl/profiles.py | .py | 5bb60bbacdef6942 | 7.45 | 7 |
"""Switch entities for PANDA ESL."""
from __future__ import annotations
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import... | moryoav/ha-panda | custom_components/panda_esl/switch.py | .py | 809251895cc9b4ab | 7.45 | 7 |
#!/usr/bin/env python3
"""
Parse *_acc.csv and *_score.csv files in a multi-model directory structure and extract ONLY the overall accuracy/score.
New directory layout supported:
<input-dir>/
<model-A>/
<run-1>/ (e.g., T20260108_G28768874)
... *_acc.csv / *_score.csv ...
<run-2>/
<model-B>/
<run... | shulin16/v-rubrics | evaluation/summarize_results.py | .py | eace4961ab237b25 | 7.52 | 10 |
#!/usr/bin/env python3
"""
Convert JSONL data with rubrics to VERL-compatible Parquet format.
Input format (JSONL):
- question: str
- answer: str; when absent, original_data.answers must be a non-empty list[str]
- rubrics: List[Dict] with fields: name, description, weight, type
- uid: str
- qa_type... | shulin16/v-rubrics | src/v_rubrics/training/data/convert_to_verl.py | .py | 800a993448635306 | 7.52 | 10 |
"""Answer-equivalence reward shared by both canonical GRPO recipes."""
from __future__ import annotations
import asyncio
from dataclasses import dataclass
from typing import Protocol
from v_rubrics.training.rewards.judge_client import (
JudgeError,
OpenAIJudgeClient,
parse_yes_no,
)
from v_rubrics.traini... | shulin16/v-rubrics | src/v_rubrics/training/rewards/answer_equivalence.py | .py | 6725fc228e39ba95 | 7.52 | 10 |
"""Sequence-level answer, rubric, and format reward from the final recipe."""
from __future__ import annotations
import asyncio
import json
import math
import os
import re
from dataclasses import dataclass
from v_rubrics.training.rewards.answer_equivalence import (
JudgeProtocol,
score_answer_equivalence,
)
... | shulin16/v-rubrics | src/v_rubrics/training/rewards/sequence_rubric_reward.py | .py | caac3744ab8908ae | 7.52 | 10 |
import json
import requests
from bs4 import BeautifulSoup
from rss_generator import generate_rss_feed
import argparse
def fetch_html(url):
"""Fetches HTML content from a given URL."""
try:
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like G... | huangboming/huggingface-daily-paper-feed | parser.py | .py | a2b7e1ebcd68b4ae | 7.57 | 13 |
"""
aggregation.py: CNA-level aggregation and trend logic for CNA Scorecard pipeline.
"""
import os
import json
import logging
from typing import List, Dict, Tuple, Any, Optional
from datetime import datetime
logger = logging.getLogger('cnascorecard.aggregation')
def aggregate_cna_scores(scored_cves: List[Dict], peri... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/aggregation.py | .py | 7554da53e30b21a7 | 7.48 | 8 |
"""
CNA Scorecard Badge Generator.
This module generates SVG badges for CNAs to display on their homepages,
showing their current CNA Scorecard rank and score.
"""
import logging
from typing import Dict, Optional
from pathlib import Path
logger = logging.getLogger('cnascorecard.badge_generator')
# Mapping of individ... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/badge_generator.py | .py | 27fe9e1fba5d3add | 7.48 | 8 |
"""
cache.py: Caching layer for computed CVE scores.
This module provides caching functionality to avoid recomputing scores
for CVEs that haven't changed, significantly improving pipeline performance
for incremental runs.
"""
import hashlib
import json
import logging
from datetime import datetime, timezone
from pathli... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/cache.py | .py | 9b8346fca99fcdcd | 7.48 | 8 |
"""
completeness.py: Calculate field utilization/completeness for all schema fields
using a robust, schema-driven approach with full parity to the V.01 analyzer.
"""
import re
from collections import defaultdict
from typing import Dict, Any, List
# Pre-compiled regex for CWE ID extraction (used in completeness hot pat... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/completeness.py | .py | 0653d5ae22b1fffe | 7.48 | 8 |
"""
Configuration management for CNA Scorecard Pipeline.
This module centralizes all configuration values, file paths, and scoring rules
to improve maintainability and make the pipeline more configurable.
"""
import os
import json
from typing import Dict, Any, List
from pathlib import Path
# Base directories
PIPELINE... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/config.py | .py | db5192430e6f2765 | 7.48 | 8 |
"""
sync_cna_list.py: Download and sync official CNAs list from CVE Project GitHub repository.
Ensures web/data/cna_list.json stays current with daily updates.
"""
import json
import logging
import os
import requests
from typing import Dict, List, Any
from pathlib import Path
def download_official_cnas_list() -> Lis... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/sync_cna_list.py | .py | ddf6f88164493f5c | 7.48 | 8 |
"""
Tests for cache.py - Score caching for CVE data.
"""
import json
import pytest
from pathlib import Path
from datetime import datetime, timezone, timedelta
from cache import ScoreCache, get_cache, reset_cache
class TestScoreCacheInit:
"""Tests for ScoreCache initialization."""
def test_default_cache_... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/tests/test_cache.py | .py | d20b00d73599ff0b | 7.98 | 8 |
"""
Tests for chunking.py - Data chunking for web lazy loading.
"""
import json
import pytest
from pathlib import Path
from unittest.mock import patch, MagicMock
from chunking import (
write_chunked_cna_data,
write_chunked_completeness_data,
generate_search_index,
generate_summary_stats,
cleanup_ol... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/tests/test_chunking.py | .py | 74ecb8c595911c82 | 7.98 | 8 |
"""
Tests for completeness.py - Field utilization and completeness analysis.
"""
import pytest
from completeness import (
_get_schema_fields,
_get_nested_value,
_custom_check,
compute_field_utilization,
compute_individual_cna_field_utilization
)
class TestGetSchemaFields:
"""Tests for _get_sch... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/tests/test_completeness.py | .py | 2bd9456667cf7701 | 7.98 | 8 |
"""
Tests for utils.py - Utility functions for the CNA Scorecard pipeline.
"""
import json
import pytest
from pathlib import Path
from unittest.mock import patch, MagicMock
from utils import (
setup_logging,
ensure_directory_exists,
load_json_file,
write_json_file,
sanitize_filename,
validate_c... | RogoLabs/CNAScoreCard | cnascorecard_pipeline/tests/test_utils.py | .py | bb44faa320062c57 | 7.98 | 8 |
"""Generic integration for RF fans."""
from __future__ import annotations
import logging
from pathlib import Path
import homeassistant.helpers.config_validation as cv
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant, callback
f... | dasimon135/ha-rf-fan | custom_components/rf_fan/__init__.py | .py | 2a558a0a62741996 | 7.48 | 8 |
"""Pure RF action selection/validation logic (testable without Home Assistant)."""
from __future__ import annotations
try: # Home Assistant runtime: relative import within the package
from .const import (
ACTION_FAN_NATURAL,
ACTION_FAN_NATURAL_REVERSE,
ACTION_FAN_OFF,
ACTION_FAN_O... | dasimon135/ha-rf-fan | custom_components/rf_fan/actions.py | .py | 43f13acd9d6e36df | 7.48 | 8 |
"""Button platform for RF Fan (sleep timers)."""
from __future__ import annotations
from datetime import timedelta
from homeassistant.components.button import ButtonEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant
... | dasimon135/ha-rf-fan | custom_components/rf_fan/button.py | .py | 63571d0c529c3915 | 7.48 | 8 |
"""Base entity for RF Fan."""
from __future__ import annotations
import logging
from asyncio import CancelledError, sleep
from collections.abc import Callable
from contextlib import suppress
from typing import Any
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
fr... | dasimon135/ha-rf-fan | custom_components/rf_fan/entity.py | .py | 133afcb8f1404266 | 7.48 | 8 |
"""Fan platform for RF Fan."""
from __future__ import annotations
from typing import Any
from homeassistant.components.fan import (
DIRECTION_FORWARD,
DIRECTION_REVERSE,
FanEntity,
FanEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, c... | dasimon135/ha-rf-fan | custom_components/rf_fan/fan.py | .py | 040e024fa18bb64d | 7.48 | 8 |
"""Light platform for RF Fan."""
from __future__ import annotations
from typing import Any
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatch... | dasimon135/ha-rf-fan | custom_components/rf_fan/light.py | .py | a45f32020feaed8e | 7.48 | 8 |
"""Select platform for RF Fan (color temperature, assumed brightness position)."""
from __future__ import annotations
from typing import Any
from homeassistant.components.select import SelectEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.... | dasimon135/ha-rf-fan | custom_components/rf_fan/select.py | .py | a16f420dddc100e5 | 7.48 | 8 |
"""Sensor platform for RF Fan (assumed sleep-timer switch-off time)."""
from __future__ import annotations
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import Home... | dasimon135/ha-rf-fan | custom_components/rf_fan/sensor.py | .py | d13abb25e03757c6 | 7.48 | 8 |
"""Switch platform for RF Fan (sound toggle)."""
from __future__ import annotations
from typing import Any
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant, callbac... | dasimon135/ha-rf-fan | custom_components/rf_fan/switch.py | .py | 88a8e3aefaa9bcdc | 7.48 | 8 |
"""Shared fixtures/helpers for the tests that need a Home Assistant environment.
Import this module ONLY after `pytest.importorskip("pytest_homeassistant_custom_component")`
in the calling test module: it imports Home Assistant at module level and would
otherwise break the pure (HA-free) suite.
"""
from __future__ im... | dasimon135/ha-rf-fan | tests/ha_helpers.py | .py | a273e71f30b73489 | 7.98 | 8 |
"""The shipped automation blueprint (requires a Home Assistant environment).
A blueprint is YAML nobody runs until a user imports it, so it is exactly the
kind of file that rots silently. These tests put it through Home Assistant's own
blueprint schema and then validate the substituted automation.
"""
from __future__... | dasimon135/ha-rf-fan | tests/test_blueprint.py | .py | a6d1bd6bd36a0efa | 7.98 | 8 |
"""Two colour keys stop at the ends; one cycling key comes round (#18).
@elmr91 pressed "warmer" on the top position of a five-position lamp: the lamp did
not move — it was already at the end — and the assumed position rolled back to the
first one. The value looked like a cycle because the only remote shape modelled w... | dasimon135/ha-rf-fan | tests/test_color_end_stops.py | .py | e234695ff505819b | 7.98 | 8 |
"""Diagnostics payload (requires a Home Assistant environment via phcc).
Diagnostics is what a user attaches to a bug report, so it has to carry the
assumed state — the dead-reckoned colour position, the anti-echo window, the
sleep timer. Those are exactly the things that go wrong and none of them can be
read back fro... | dasimon135/ha-rf-fan | tests/test_diagnostics.py | .py | 54b41290b4328f60 | 7.98 | 8 |
"""How many positions the stepped controls model is a property of the hardware.
Both counts used to be constants — ten brightness steps and the three named colour
positions. @elmr91 measured his Inspire Aruba Plus at eight of each (issue #18),
which is the whole reason they are declared per fan now: a count that is to... | dasimon135/ha-rf-fan | tests/test_step_counts.py | .py | 5ecfa0f28930355e | 7.98 | 8 |
"""Every action the config flow can ask for must have a label, in every language.
This gap has now shipped three times. @elmr91 reported the first two on
[#18](https://github.com/dasimon135/ha-rf-fan/issues/18) — the twelve `_reverse`
speeds and speeds 7 to 12 were raw keys on screen, because the files stopped at
`fan... | dasimon135/ha-rf-fan | tests/test_translations.py | .py | ac15a1178552eac5 | 7.98 | 8 |
import torch
import torch.nn.functional as F
import efel
from typing import Tuple
def get_start_and_end_times(stimulus: torch.Tensor, dt: float, ds: int) -> Tuple[torch.Tensor, torch.Tensor]:
"""
Get the start and end times of the stimulus for each batch element.
Args:
stimulus: (B, T) tensor
... | neuraloperator/noble | src/training/neuro/differentiable_sagamplitude.py | .py | 9c001b3c3d324c5c | 7.57 | 13 |
import numpy as np
import efel
from efel import get_feature_values, get_mean_feature_values
from collections import defaultdict
from typing import Tuple
import torch
def extract_features(stimulus: np.ndarray, response: np.ndarray, data_config: dict) -> dict:
"""
Extract electrophysiological features from neur... | neuraloperator/noble | src/training/neuro/extract_features.py | .py | c3258141136d1d2d | 7.57 | 13 |
"""
Module for computing electrophysiological feature losses for neuronal data.
"""
import inspect
import os
import torch
from typing import Tuple, Callable
from training.neuro.extract_features import extract_features
from training.neuro.differentiable_sagamplitude import compute_differentiable_sag_amplitude
import dat... | neuraloperator/noble | src/training/neuro/neuro_losses.py | .py | 17ccb0c3cfd8ffab | 7.57 | 13 |
import os
import pandas as pd
import torch
from sklearn.preprocessing import MinMaxScaler
import numpy as np
def extract_scaled_e_features(config: dict, device: str, features_to_embed: list, feature_range: tuple = (0.5, 3.5)) -> pd.DataFrame:
"""
This function reads electrophysiological features from a CS... | neuraloperator/noble | src/training/neuro/neuron_model_utils.py | .py | 1df7c1978c0f70d5 | 7.57 | 13 |
import argparse, wandb, yaml, shutil, os
from training.engine.noble import train_model
from training.utils.path_setup import build_wandb_run_name
import json
def get_args() -> argparse.Namespace:
"""
This function is used to collect arguments passed from the command line
Returns:
argparse.Namespac... | neuraloperator/noble | src/training/train_noble.py | .py | 4c37c09a556f40ac | 7.57 | 13 |
import argparse, wandb, yaml, shutil, os
from training.engine.noble_finetune import finetune_model
from training.utils.path_setup import build_wandb_run_name
import json
def get_args() -> argparse.Namespace:
"""
This function is used to collect arguments passed from the command line
Returns:
argpa... | neuraloperator/noble | src/training/train_noble_finetune.py | .py | 0686986a311c3558 | 7.57 | 13 |
import os
from datetime import datetime
def get_job_info() -> dict:
"""Extract SLURM job information from environment variables."""
return {
'slurm_job_id': os.getenv("SLURM_JOB_ID"),
'run_index': os.getenv("SWEEP_RUN_INDEX"),
'sweep_idx': os.getenv("SWEEP_ID")
}
def generate_run_i... | neuraloperator/noble | src/training/utils/path_setup.py | .py | 5269e3541e4cd855 | 7.57 | 13 |
import os
import numpy as np
import matplotlib.pyplot as plt
from training.utils.fft_utils import run_fft
import torch
def plot_response(
stimulus: np.ndarray,
true_response: np.ndarray,
data_config: dict,
predicted_response: np.ndarray = None,
path: str = None,
FFT: bool = False,
data... | neuraloperator/noble | src/training/visualization/plotting.py | .py | 5c837fc09afe4aa3 | 7.57 | 13 |
import numpy as np
import geopandas as gpd
import hashlib
from rasterio.io import MemoryFile
from .grid_cell_fragment import *
from .models import *
import cv2
class MajorTOM_Embedder(torch.nn.Module):
"""
MajorTOM Embedder class that applies a model to geospatial image fragments,
computes embeddings, an... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/embedder/MajorTOM_Embedder.py | .py | 1ed6da4efc015dfe | 7.6 | 15 |
import torch
from transformers import AutoImageProcessor, AutoModel
class DINOv2_S2RGB_Embedder(torch.nn.Module):
"""
Embedding wrapper for DINOv2 and Sentinel-2 data.
This model uses the DINOv2 architecture to generate embeddings for Sentinel-2 RGB data. The input data (RGB bands)
is preprocessed by... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/embedder/models/DINOv2_S2RGB.py | .py | 17a87f287be8788f | 7.6 | 15 |
import torch
from torchgeo.models import ResNet50_Weights
import timm
import numpy as np
class SSL4EO_S1RTC_Embedder(torch.nn.Module):
"""
SSL4EO Embedder for Sentinel-1 data using a pre-trained model.
This model is based on the SSL4EO (Self-Supervised Learning for Earth Observation) approach,
using ... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/embedder/models/SSL4EO_S1RTC.py | .py | 9a3663914dd6f197 | 7.6 | 15 |
import torch
from torchgeo.models import ResNet50_Weights
import timm
class SSL4EO_S2L1C_Embedder(torch.nn.Module):
"""
SSL4EO Embedder for Sentinel-2 data using a pre-trained model.
This model is based on the SSL4EO (Self-Supervised Learning for Earth Observation) approach,
using a pre-trained ResNet... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/embedder/models/SSL4EO_S2L1C.py | .py | eb1bbbea9d93e7e8 | 7.6 | 15 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import PIL
def get_mask(df):
"""
Take a Major TOM dataframe and create a mask corresponding to available cells
"""
mask = np.zeros((2004,4008), dtype=np.uint8)
row_offset = -1002... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/extras/coverage_vis.py | .py | a641da4a464b7d9d | 7.6 | 15 |
"""
NOTE: Major TOM standard does not require any specific type of thumbnail to be computed.
Instead these are shared as optional help since this is how the Core dataset thumbnails have been computed.
"""
from rasterio.io import MemoryFile
from PIL import Image
import numpy as np
import os
from pathlib im... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/extras/thumbnail_dem.py | .py | 714599e2d7c88168 | 7.6 | 15 |
"""
NOTE: Major TOM standard does not require any specific type of thumbnail to be computed.
Instead these are shared as optional help since this is how the Core dataset thumbnails have been computed.
"""
from rasterio.io import MemoryFile
from PIL import Image
import numpy as np
def s1rtc_thumbnail(vv, ... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/extras/thumbnail_s1rtc.py | .py | 984243cb8e2b4b4f | 7.6 | 15 |
"""
NOTE: Major TOM standard does not require any specific type of thumbnail to be computed.
Instead these are shared as optional help since this is how the Core dataset thumbnails have been computed.
"""
from rasterio.io import MemoryFile
from PIL import Image
import numpy as np
def s2l2a_thumbnail(B04,... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/extras/thumbnail_s2.py | .py | f5cc4aed5b52cdd3 | 7.6 | 15 |
import numpy as np
import math
import pandas as pd
import geopandas as gpd
from shapely.geometry import LineString, Polygon
from tqdm import tqdm
import re
class Grid():
RADIUS_EQUATOR = 6378.137 # km
def __init__(self,dist,latitude_range=(-85,85),longitude_range=(-180,180),utm_definition='bottomleft'):
... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/grid.py | .py | 3877c8296e45f39c | 7.6 | 15 |
import pyarrow.parquet as pq
import pandas as pd
import geopandas as gpd
from pathlib import Path
import urllib.request
import fsspec
from fsspec.parquet import open_parquet_file
from io import BytesIO
from PIL import Image
from rasterio.io import MemoryFile
from tqdm.notebook import tqdm
import os
from .sample_helper... | OpenGeoScope/EarthEmbeddingExplorer | MajorTOM/metadata_helpers.py | .py | f89b5ba58f2f710e | 7.6 | 15 |
"""Filter options and application for search results."""
import numpy as np
import pandas as pd
def build_filter_options(
enable_time=False,
start_date="2016-01-01",
end_date="2024-12-31",
enable_geo=False,
lat_min=-90,
lat_max=90,
lon_min=-180,
lon_max=180,
):
"""Pack UI filter c... | OpenGeoScope/EarthEmbeddingExplorer | core/filters.py | .py | 4642febcce9a468d | 7.6 | 15 |
"""Model initialization and management for EarthEmbeddingExplorer."""
from typing import ClassVar
import torch
from models.clay_model import ClayModel
from models.dinov2_model import DINOv2Model
from models.farslip_model import FarSLIPModel
from models.load_config import load_and_process_config
from models.olmoearth... | OpenGeoScope/EarthEmbeddingExplorer | core/model_manager.py | .py | ee2f30e72366824e | 7.6 | 15 |
import os
from io import BytesIO
import cv2
import fsspec
import numpy as np
import pyarrow.parquet as pq
from PIL import Image, ImageDraw, ImageFont
from rasterio.io import MemoryFile
def preprocess_s2_true_color(rgb_array):
"""
Normalize raw Sentinel-2 RGB bands to true-color values for display.
Appli... | OpenGeoScope/EarthEmbeddingExplorer | data_utils.py | .py | c7c9b5025fcf8c8b | 7.6 | 15 |
from lightning.pytorch.callbacks import Callback
from lightning.pytorch.callbacks.finetuning import BaseFinetuning
class ProgressiveResizing(Callback):
def __init__(self):
self.resize_schedule = {
0: {"batch_size": 4, "num_workers": 4, "size": 64},
10: {"batch_size": 2, "num_worker... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/callbacks.py | .py | 6cd54c69cb277a55 | 7.6 | 15 |
"""
Lightning callback functions for logging to Weights & Biases.
Includes a way to visualize RGB images derived from the raw logits of a Masked
Autoencoder's decoder during the validation loop. I.e. to see if the Vision
Transformer model is learning how to do image reconstruction.
Usage:
```
import lightning as L
... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/callbacks_wandb.py | .py | fa619aaba5054eea | 7.6 | 15 |
"""
LightningDataModule to load Earth Observation data from GeoTIFF files using
rasterio.
"""
import math
import random
from collections import defaultdict
from pathlib import Path
from typing import Literal
import lightning as L
import numpy as np
import torch
# import torchdata
import yaml
from box import Box
from... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/datamodule.py | .py | 99beb998fcebd2f1 | 7.6 | 15 |
import lightning as L
import torch
import yaml
from box import Box
from torch.utils.data import DataLoader
from torchgeo.datasets import EuroSAT as TGEuroSAT
from torchvision.transforms import v2
S2_BANDS = [
"B02",
"B03",
"B04",
"B05",
"B06",
"B07",
"B08",
"B8A",
"B11",
"B12",
... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/classify/eurosat_datamodule.py | .py | 60ee57abe2875793 | 7.6 | 15 |
import lightning as L
import torch
from torch import nn, optim
from torchmetrics import Accuracy
from claymodel.finetune.classify.factory import Classifier
class EuroSATClassifier(L.LightningModule):
"""
LightningModule for training and evaluating a classifier on the EuroSAT
dataset.
Args:
n... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/classify/eurosat_model.py | .py | 8b4963d0eb8b5407 | 7.6 | 15 |
import re
import torch
from torch import nn
from claymodel.model import Encoder
class Classifier(nn.Module):
"""
Classifier class uses Clay Encoder for feature extraction and a head for
classification.
Attributes:
clay_encoder (Encoder): The encoder for feature extraction.
head (nn.... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/classify/factory.py | .py | 245e1ae821a090e7 | 7.6 | 15 |
"""Export the Clay model to ONNX and pytorch ExportedProgram format.
This script exports the Clay model to ONNX and pytorch ExportedProgram format
for deployment. The model is exported with dynamic shapes for inference.
How to use:
```bash
python -m finetune.embedder.factory \
--img_size 256 \
--ckpt_path ch... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/embedder/factory.py | .py | 8329d43d316e93f6 | 7.6 | 15 |
"""
DataModule for the BioMasters dataset for a regression task.
BioMassters: A Benchmark Dataset for Forest Biomass Estimation using
Multi-modal Satellite Time-series https://nascetti-a.github.io/BioMasster/
This implementation provides a structured way to handle the data loading and
preprocessing required for train... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/regression/biomasters_datamodule.py | .py | 9786b48e9d7efb1b | 7.6 | 15 |
import lightning as L
import torch
import torch.nn.functional as F
from torch import nn, optim
from torchmetrics import MeanSquaredError
from claymodel.finetune.regression.factory import Regressor
class NoNaNRMSE(nn.Module):
def __init__(self, threshold=400):
super().__init__()
self.threshold = ... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/regression/biomasters_model.py | .py | 050716219dfef63f | 7.6 | 15 |
"""
Clay Regressor for semantic regression tasks using PixelShuffle.
Attribution:
Decoder inspired by PixelShuffle-based upsampling.
"""
import re
import torch
import torch.nn.functional as F
from einops import rearrange, repeat
from torch import nn
from claymodel.model import Encoder
class RegressionEncoder(Enco... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/regression/factory.py | .py | 0aad246b26c25739 | 7.6 | 15 |
"""
DataModule for the Chesapeake Bay dataset for segmentation tasks.
This implementation provides a structured way to handle the data loading and
preprocessing required for training and validating a segmentation model.
Dataset citation:
Robinson C, Hou L, Malkin K, Soobitsky R, Czawlytko J, Dilkina B, Jojic N.
Large... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/segment/chesapeake_datamodule.py | .py | b67ba2c9296c3eb5 | 7.6 | 15 |
"""
LightningModule for training and validating a segmentation model using the
Segmentor class.
"""
import lightning as L
import segmentation_models_pytorch as smp
import torch
import torch.nn.functional as F
from torch import optim
from torchmetrics.classification import F1Score, MulticlassJaccardIndex
from claymode... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/segment/chesapeake_model.py | .py | 2fc82cc4a937b357 | 7.6 | 15 |
"""
Clay Segmentor for semantic segmentation tasks.
Attribution:
Decoder from Segformer: Simple and Efficient Design for Semantic Segmentation
with Transformers
Paper URL: https://arxiv.org/abs/2105.15203
"""
import re
import torch
import torch.nn.functional as F
from einops import rearrange, repeat
from torch impor... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/finetune/segment/factory.py | .py | df2ef3841ac99dd6 | 7.6 | 15 |
import math
import os
import random
import timm
import torch
import torch.nn.functional as F
from einops import rearrange, reduce, repeat
from torch import nn
from torchvision.transforms import v2
from claymodel.backbone import Transformer
from claymodel.factory import DynamicEmbedding
from claymodel.utils import pos... | OpenGeoScope/EarthEmbeddingExplorer | models/Clay/claymodel/model.py | .py | ebf06103d64a8746 | 7.6 | 15 |
#!/usr/bin/env python3
"""
Israeli Address Lookup and Validation
Standalone utility for formatting, validating, and looking up
Israeli addresses and settlement (semel yishuv) codes.
Hebrew input is the primary case. An earlier version keyed the table on Latin
transliterations only, so `city "תל אביב"` returned "not f... | skills-il/government-services | israeli-address-autocomplete/scripts/lookup_address.py | .py | 40e290823c23cdd1 | 7.56 | 12 |
#!/usr/bin/env python3
"""
plan_shipments.py - Plan the 3-shipment aliyah customs exemption.
Reads a JSON inventory, classifies each item against per-family caps,
proposes a 3-shipment split, and drafts a declaration per shipment.
Usage:
python plan_shipments.py --inventory inventory.json \
--aliyah-date ... | skills-il/government-services | israeli-aliyah-customs-shipment-planner/scripts/plan_shipments.py | .py | 60af281b027d9a28 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Aliyah Checklist Generator
Generates a personalized checklist for new immigrants (olim) to Israel
based on their specific situation: current stage, family status,
country of origin, and profession.
Usage:
python scripts/aliyah-checklist.py --stage pre-arrival --family single --country u... | skills-il/government-services | israeli-aliyah-navigator/scripts/aliyah-checklist.py | .py | 598383640bc767c3 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Israeli University Admissions Calculator
Calculate Bagrut averages (with 5-unit bonuses) and estimate
university admission composite scores (sekhem).
Usage:
python calculate_sekhem.py bagrut --subjects '{"Math":{"units":5,"grade":90},"English":{"units":5,"grade":85}}'
python calcula... | skills-il/government-services | israeli-education-system/scripts/calculate_sekhem.py | .py | 7bba261acce29952 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Query Israeli Knesset Open Data API (OData v4).
Standalone utility for querying the Knesset (Israeli Parliament) OData API for
MK information, bills, factions, plenum votes (per-MK), and the position-ID
lexicon.
Targets OData v4 at https://knesset.gov.il/OdataV4/ParliamentInfo/. The legacy
... | skills-il/government-services | israeli-election-data/scripts/query_knesset.py | .py | 706a781577c82a0e | 7.56 | 12 |
#!/usr/bin/env python3
"""
Israeli Government Form Field Helper
Validates and populates common Israeli government form fields:
- Teudat Zehut (ID number) with check digit validation
- Israeli phone numbers (mobile and landline)
- Israeli addresses with mikud (postal code)
- Common form data structures for gov.il, Rash... | skills-il/government-services | israeli-gov-form-automator/scripts/fill_form.py | .py | ee3cdec272b47fca | 7.56 | 12 |
#!/usr/bin/env python3
"""Estimate the post-discharge rent assistance for a recognized lone soldier.
Rule (hachvana SingleSolders/Rent): up to 1,000 NIS per month for up to 12
months of rent, capped at 12,000 NIS in the first year after discharge.
If the actual rent is below 1,000 NIS/month the reimbursement is the am... | skills-il/government-services | israeli-lone-soldier-rights/scripts/post-discharge-rent-estimator.py | .py | 3d8073bf8a1fa51d | 7.56 | 12 |
#!/usr/bin/env python3
"""Dump the EXIF/metadata fields that matter for authenticity, via exiftool.
What to read from the output:
- Make / Model / DateTimeOriginal / GPS: capture provenance. Present and
internally consistent supports a real-camera origin.
- Software: an edit fingerprint. A generator or editor ... | skills-il/government-services | israeli-media-authenticity-verifier/scripts/dump_metadata.py | .py | d756bcefb3cd5145 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Miluim Tax Credit Calculator
Estimates tax credits for Israeli combat reserve duty (miluim) based on
the number of combat service days in a given tax year.
Amendment 283 to the Income Tax Ordinance (Section 39B), effective
January 1, 2026, introduced a 15-tier graduated credit system for
co... | skills-il/government-services | israeli-miluim-manager/scripts/miluim-tax-credit-calculator.py | .py | 417fc9816e227506 | 7.56 | 12 |
#!/usr/bin/env python3
"""Compute the statutory deadline chain for an Israeli municipal internal audit report.
Per sections 170C(a) to 170C(e) of the Municipalities Ordinance. Two fallback branches
lead to two different end dates, which is the most common source of error.
Usage:
python3 audit_timeline.py --audited-... | skills-il/government-services | israeli-municipal-audit-report/scripts/audit_timeline.py | .py | 5badc0a4df542650 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Israeli Purchase Tax (Mas Rechisha) Calculator
Calculate purchase tax for Israeli real estate transactions
based on the 2026 tax brackets for all four documented tracks:
first apartment, non-first apartment, new immigrant (Regulation 12a)
and the Regulation 11 reduced track (disability, blin... | skills-il/government-services | israeli-real-estate/scripts/calculate_mas_rechisha.py | .py | a8df093e1f169c4d | 7.56 | 12 |
#!/usr/bin/env python3
"""
Vehicle Decision Worksheet for Israeli Returning Residents
Produces a side-by-side comparison: ship the existing car from abroad vs. sell it
abroad and buy locally in Israel. Captures the key truth that returnees pay
FULL Israeli tax on a personally-imported vehicle (no purchase-tax exemptio... | skills-il/government-services | israeli-returning-resident-customs-vehicle/scripts/vehicle-decision.py | .py | 1d59bd299c22d5c3 | 7.56 | 12 |
#!/usr/bin/env python3
"""Returnee eligibility router.
Prints which of the three independent eligibility tracks (Misrad HaAliyah,
Mas Hachnasa, Bituach Leumi) the user likely qualifies for and which sources
to verify against. NO numeric tax math here, on purpose: Section 14 mechanics
live in the sister skill israeli-t... | skills-il/government-services | israeli-returning-resident-navigator/scripts/check-eligibility.py | .py | 9170fb2a6d6fe791 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Fetch Israeli CBS (Central Bureau of Statistics) Data
Standalone utility for querying the Israeli Central Bureau of Statistics.
Economic / price time series (CPI, housing prices, producer prices, building
input costs) come from the CBS Price Indices API at api.cbs.gov.il. That API
is the ca... | skills-il/government-services | israeli-statistics/scripts/fetch_cbs_data.py | .py | e9a2d779e0151a44 | 7.56 | 12 |
#!/usr/bin/env python3
"""Estimate a monthly Bituach Leumi survivor benefit for Israel.
ESTIMATE ONLY. This is a rough, educational estimate. It is NOT an official
determination and it does NOT decide eligibility. The real amount depends on the
qualifying (akhshara) period, the exact family status, the income test, an... | skills-il/government-services | israeli-survivor-benefits-navigator/scripts/estimate_survivor_allowance.py | .py | c970a67e915c6e45 | 7.56 | 12 |
#!/usr/bin/env python3
"""detect_layout.py — probe a standalone opencode binary for the embedded Bun
version and the module-graph record layout format (36B vs 52B records).
Input: path to a standalone binary, or a .tgz (npm package) containing
package/bin/opencode (auto-extracted to a temp file).
Output: sing... | Hope2333/MiMoCode-Termux | tools/transplant/detect_layout.py | .py | df4b10aafdd89b1e | 7.56 | 12 |
#!/usr/bin/env python3
"""probe_assemble.py — Bind the official android Bun with the extracted module graph.
guysoft Step 6 (scripts/build-opencode-android.ts), empirically verified:
[android bun bytes] + [module graph bytes] + [u64 LE = androidBunSize + mgLen + 8]
The trailing u64 is the total byte count of the ... | Hope2333/MiMoCode-Termux | tools/transplant/probe_assemble.py | .py | e4447fba94cb37cf | 7.56 | 12 |
#!/usr/bin/env python3
"""
revive_patch.py -- C1 revival surgery for android bun (pure-android branch).
Grafts an opencode standalone module graph onto the official android Bun ELF
and patches BUN_COMPILED so the runtime enters standalone mode (loads the
grafted graph) instead of falling back to interpreter mode.
Sem... | Hope2333/MiMoCode-Termux | tools/transplant/revive_patch.py | .py | ea60058aeb61d942 | 7.56 | 12 |
#!/usr/bin/env python3
"""swap_tui.py — replace the embedded glibc libopentui.so inside a transplanted
opencode-native binary with a bionic-built one (equal-length byte swap).
The embedded asset is stored RAW (uncompressed) in the bun standalone payload,
immediately after its registry name string:
\\x00/$bunfs/roo... | Hope2333/MiMoCode-Termux | tools/transplant/swap_tui.py | .py | ea1be744c173b45e | 7.56 | 12 |
"""Base channel interface for chat platforms."""
from abc import ABC, abstractmethod
from typing import Any, List
from core.bus import MessageBus
from core.events import OutboundMessage, InboundMessage
class BaseChannel(ABC):
"""
Abstract base class for chat channel implementations.
"""
name: str =... | Ethereal-Lemons/LimeBot-OS | channels/base.py | .py | 10ef37caaa531213 | 7.62 | 16 |
import time
import hashlib
import json
from collections import OrderedDict
from typing import Any, Optional
class ToolCache:
"""
Simple LRU Cache for tool results with TTL support.
"""
def __init__(self, max_size: int = 100):
self.cache = OrderedDict()
self.max_size = max_size
... | Ethereal-Lemons/LimeBot-OS | core/cache.py | .py | a361aec823a96213 | 7.62 | 16 |
"""Event definitions for the message bus."""
from dataclasses import dataclass, field
from typing import Any, List, Dict
@dataclass
class InboundMessage:
"""Message received from a channel."""
channel: str
sender_id: str
chat_id: str
content: str
media: List[str] = field(default_factory=list... | Ethereal-Lemons/LimeBot-OS | core/events.py | .py | 99461b974ec035eb | 7.62 | 16 |
import logging
import os
from typing import List, Dict, Any, Optional, Tuple
try:
import httpx
except Exception:
httpx = None
from core.oauth_profiles import resolve_codex_oauth_api_key
logger = logging.getLogger(__name__)
QWEN_COMPAT_BASE_URLS = [
"https://dashscope-intl.aliyuncs.com/compatible-mode/v1"... | Ethereal-Lemons/LimeBot-OS | core/llm_utils.py | .py | 7481f774a2b709e3 | 7.62 | 16 |
"""Runtime task registry with stable IDs and exactly-once terminal state.
``TaskTracker`` is the durable projection used by the dashboard. This module
keeps the live ``asyncio.Task`` handles that make that projection actionable:
callers can wait for, cancel, and await every task created by the agent loop.
The regist... | Ethereal-Lemons/LimeBot-OS | core/managed_tasks.py | .py | 8bab12fcda126b3a | 7.62 | 16 |
import asyncio
import json
import os
import re
import time
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
from loguru import logger
try:
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
MCP_AVAILABLE = True
except ImportError:
... | Ethereal-Lemons/LimeBot-OS | core/mcp_client.py | .py | 144282afb2fc0122 | 7.62 | 16 |
"""Intent helpers for chat media delivery vs image generation.
A request like "download a picture of X and send it in this chat" must route
to host-owned ``web_search(kind="images")``. The host attaches the photo.
``generate_image`` is only for newly created art.
"""
from __future__ import annotations
import re
from... | Ethereal-Lemons/LimeBot-OS | core/media_intent.py | .py | 00f2385f0f2754d6 | 7.62 | 16 |
"""Recoverable per-provider circuit breakers for LLM failover.
The breaker deliberately keeps authentication failures open until the provider
credential/configuration fingerprint changes. Transient failures use a bounded
failure window and a single half-open probe after the recovery timeout.
"""
from __future__ impor... | Ethereal-Lemons/LimeBot-OS | core/provider_circuit_breaker.py | .py | d25b2b04a85b7d9e | 7.62 | 16 |
"""Mission and deployment ID validation.
iRobot's `missionId` / `deploymentId` are ULIDs: a 26-character
Crockford base32 string (48-bit timestamp + 80-bit randomness). The
alphabet is `0123456789ABCDEFGHJKMNPQRSTVWXYZ` -- the digits and
uppercase letters with I, L, O and U removed, so a human reading one
aloud cannot... | johnnyh1975/roombapy-prime | roombapy_prime/ids.py | .py | be2a39437162a362 | 7.42 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.