repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/_common.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:13.677809 | """
Top-level cross-version primitives for Zarr metadata.
Version-specific types live under `zarr_metadata.v2` and `zarr_metadata.v3`.
Codec and dtype spec types live under `zarr_metadata.v3.codec` and
`zarr_metadata.v3.data_type`.
"""
from collections.abc import Mapping
from typing import NotRequired
from typing_ex... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | ci/check_changelog_entries.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:13.678793 | """
Check changelog entries have the correct filename structure.
"""
import sys
from pathlib import Path
VALID_CHANGELOG_TYPES = ["feature", "bugfix", "doc", "removal", "misc"]
CHANGELOG_DIRECTORY = (Path(__file__).parent.parent / "changes").resolve()
def is_int(s: str) -> bool:
try:
int(s)
except V... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | examples/custom_dtype/custom_dtype.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:13.679922 | # /// script
# requires-python = ">=3.12"
# dependencies = [
# "zarr @ git+https://github.com/zarr-developers/zarr-python.git@main",
# "ml_dtypes==0.5.4",
# "pytest==8.4.1"
# ]
# ///
#
"""
Demonstrate how to extend Zarr Python by defining a new data type
"""
import json
import sys
from pathlib import Path
from ... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | bench/compress_normal.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:13.685010 | import sys
import timeit
import blosc
import line_profiler
import numpy as np
import zarr
if __name__ == "__main__":
sys.path.insert(0, "..")
# setup
a = np.random.normal(2000, 1000, size=200000000).astype("u2")
z = zarr.empty_like(
a,
chunks=1000000,
compression="blosc",
... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:13.685895 | from zarr_metadata._common import NamedConfig
from zarr_metadata.v2.array import (
ArrayDimensionSeparatorV2,
ArrayMetadataV2,
ArrayOrderV2,
DataTypeMetadataV2,
)
from zarr_metadata.v2.codec import CodecMetadataV2
from zarr_metadata.v2.consolidated import ConsolidatedMetadataV2
from zarr_metadata.v2.gro... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v2/consolidated.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:13.735684 | """Zarr v2 consolidated metadata (`.zmetadata` file).
This module models the de-facto `.zmetadata` file used by the reference
Python implementation of Zarr v2. **This is NOT a spec artifact.** There
is no Zarr v2 specification that defines `.zmetadata`; it is a
canonical-implementation convention.
"""
from collection... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/chunk_key_encoding/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.311481 | """
Zarr v3 chunk key encoding metadata types.
Each chunk key encoding lives in its own submodule:
- `default` -- v3 default encoding (`/`-separated)
- `v2` -- v2-compatibility encoding (`.`-separated by default)
Both are defined by the v3 core spec.
The `<X>ChunkKeyEncodingMetadata` aliases re-exported here a... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/chunk_grid/rectilinear.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.314164 | """
Rectilinear chunk grid (zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/tree/main/chunk-grids/rectilinear
"""
from typing import Final, Literal
from typing_extensions import TypedDict
RECTILINEAR_CHUNK_GRID_NAME: Final = "rectilinear"
"""The `name` field value of the rectilinear chunk g... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/array.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.315226 | """Zarr v3 array metadata types."""
from collections.abc import Mapping
from typing import Literal, NotRequired
from typing_extensions import TypedDict
from zarr_metadata.v3._common import MetadataFieldV3
class ExtensionFieldV3(TypedDict, extra_items=object): # type: ignore[call-arg]
"""
Required shape of... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.317626 | """Zarr v3 metadata types."""
from zarr_metadata.v3._common import MetadataFieldV3
from zarr_metadata.v3.array import ArrayMetadataV3, ExtensionFieldV3
from zarr_metadata.v3.consolidated import ConsolidatedMetadataV3
from zarr_metadata.v3.group import GroupMetadataV3
__all__ = [
"ArrayMetadataV3",
"Consolidat... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/chunk_grid/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.327263 | """
Zarr v3 chunk grid metadata types.
Each chunk grid lives in its own submodule:
- `regular` -- core v3 spec
- `rectilinear` -- zarr-extensions
The `<X>ChunkGridMetadata` aliases re-exported here are the canonical type
for each grid's permitted JSON shapes. For the underlying
`<X>ChunkGridObject`, `<X>ChunkGri... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/chunk_grid/regular.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.330021 | """
Regular chunk grid (Zarr v3 core spec).
See https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html#regular-grids
"""
from typing import Final, Literal
from typing_extensions import TypedDict
REGULAR_CHUNK_GRID_NAME: Final = "regular"
"""The `name` field value of the regular chunk grid."""
RegularChunkG... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v2/group.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.331682 | """Zarr v2 group metadata types.
See https://zarr-specs.readthedocs.io/en/latest/v2/v2.0.html
"""
from typing import Literal
from typing_extensions import TypedDict
class GroupMetadataV2(TypedDict):
"""
Zarr v2 group metadata document (the `.zgroup` content).
Attributes live in a sibling `.zattrs` fil... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/chunk_key_encoding/default.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.349320 | """
Default chunk key encoding (Zarr v3 core spec).
The chunk key for a chunk with grid index `(k, j, i, ...)` is formed
by appending `c<sep>k<sep>j<sep>i...` (where `<sep>` is `separator`).
See https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html#chunk-key-encoding
"""
from typing import Final, Literal, N... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/chunk_key_encoding/v2.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.379249 | """
v2-compatibility chunk key encoding (Zarr v3 core spec).
Intended only to allow existing v2 arrays to be converted to v3 without
having to rename chunks. Not recommended for new arrays.
See https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html#chunk-key-encoding
"""
from typing import Final, Literal, No... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/_common.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.380262 | """Internal cross-cutting aliases for Zarr v3 metadata.
This module is private (underscore-prefixed) and exists to avoid circular
imports between leaf modules and sub-package `__init__.py` re-exports.
Public consumers should import `MetadataFieldV3` from `zarr_metadata.v3`.
"""
from zarr_metadata._common import Named... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.909750 | """
Zarr v3 codec spec types.
Each codec defined by the spec or by zarr-extensions has its own submodule
(`blosc`, `bytes`, `cast_value`, `crc32c`, `gzip`, `scale_offset`,
`sharding_indexed`, `transpose`, `zstd`).
The `<X>CodecMetadata` aliases re-exported here are the canonical type for
each codec's permitted JSON s... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/bytes.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.929194 | """
Bytes codec types.
See https://zarr-specs.readthedocs.io/en/latest/v3/codecs/bytes/index.html
"""
from typing import Final, Literal, NotRequired
from typing_extensions import TypedDict
BYTES_CODEC_NAME: Final = "bytes"
"""The `name` field value of the `bytes` codec."""
BytesCodecName = Literal["bytes"]
"""Lite... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/blosc.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.932860 | """
Blosc codec types.
See https://zarr-specs.readthedocs.io/en/latest/v3/codecs/blosc/index.html
"""
from typing import Final, Literal, NotRequired
from typing_extensions import TypedDict
BLOSC_CODEC_NAME: Final = "blosc"
"""The `name` field value of the `blosc` codec."""
BloscCodecName = Literal["blosc"]
"""Lite... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/cast_value.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.946244 | """
Cast-value codec types.
See https://github.com/zarr-developers/zarr-extensions/tree/main/codecs/cast_value
"""
from typing import Final, Literal, NotRequired
from typing_extensions import TypedDict
from zarr_metadata.v3._common import MetadataFieldV3
CAST_VALUE_CODEC_NAME: Final = "cast_value"
"""The `name` fi... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/crc32c.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.946851 | """
CRC32C codec types.
See https://zarr-specs.readthedocs.io/en/latest/v3/codecs/crc32c/index.html
The CRC32C codec has no configuration fields, so the `configuration`
key is absent from the metadata.
"""
from typing import Final, Literal, NotRequired
from typing_extensions import TypedDict
CRC32C_CODEC_NAME: Fin... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/gzip.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.957884 | """
Gzip codec types.
See https://zarr-specs.readthedocs.io/en/latest/v3/codecs/gzip/index.html
"""
from typing import Final, Literal, NotRequired
from typing_extensions import TypedDict
GZIP_CODEC_NAME: Final = "gzip"
"""The `name` field value of the `gzip` codec."""
GzipCodecName = Literal["gzip"]
"""Literal typ... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/scale_offset.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.968024 | """
Scale-offset codec types.
See https://github.com/zarr-developers/zarr-extensions/tree/main/codecs/scale_offset
"""
from typing import Final, Literal, NotRequired
from typing_extensions import TypedDict
SCALE_OFFSET_CODEC_NAME: Final = "scale_offset"
"""The `name` field value of the `scale_offset` codec."""
Sca... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/sharding_indexed.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:14.984909 | """
Sharding-indexed codec types.
See https://zarr-specs.readthedocs.io/en/latest/v3/codecs/sharding-indexed/index.html
"""
from typing import Final, Literal, NotRequired
from typing_extensions import TypedDict
from zarr_metadata.v3._common import MetadataFieldV3
SHARDING_INDEXED_CODEC_NAME: Final = "sharding_inde... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/zstd.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:15.021031 | """
Zstandard codec types.
See https://github.com/zarr-developers/zarr-specs/pull/256 (unmerged at
time of writing; the configuration shape below reflects the proposed
specification).
"""
from typing import Final, Literal
from typing_extensions import TypedDict
ZSTD_CODEC_NAME: Final = "zstd"
"""The `name` field va... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/codec/transpose.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:15.022580 | """
Transpose codec types.
See https://zarr-specs.readthedocs.io/en/latest/v3/codecs/transpose/index.html
"""
from typing import Final, Literal
from typing_extensions import TypedDict
TRANSPOSE_CODEC_NAME: Final = "transpose"
"""The `name` field value of the `transpose` codec."""
TransposeCodecName = Literal["tran... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:16.427233 | """
Zarr v3 data type spec types.
Each v3 data type has its own submodule:
- Core primitives: `bool`, `int8`/`16`/`32`/`64`, `uint8`/`16`/`32`/`64`,
`float16`/`32`/`64`, `complex64`/`128`, `raw` (for `r<N>`)
- zarr-extensions: `bytes`, `string`, `numpy_datetime64`, `numpy_timedelta64`,
`struct`
The two canonical... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/bytes.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:16.428468 | """
Zarr `bytes` data type (variable-length raw bytes, zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/tree/main/data-types/bytes
"""
import re
from typing import Final, Literal, NewType
BYTES_DATA_TYPE_NAME: Final = "bytes"
"""The `data_type` value for the variable-length `bytes` type."""
... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/bool.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:16.429451 | """
Zarr v3 `bool` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
BOOL_DATA_TYPE_NAME: Final = "bool"
"""The `data_type` value for the `bool` type."""
BoolDataTypeName = Literal["bool"]
"""Literal type of the `data_type` field for `bool`."""... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/consolidated.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:16.430997 | """Zarr v3 consolidated metadata types.
There is no Zarr v3 specification for consolidated metadata. This module
models the inline-on-group convention used by the reference Python
implementation (and zarrs), where consolidated metadata is embedded as
an extension field on a group's `zarr.json`.
The shape modeled here... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/complex128.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:16.465669 | """
Zarr v3 `complex128` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
from zarr_metadata.v3.data_type.float64 import Float64FillValue
COMPLEX128_DATA_TYPE_NAME: Final = "complex128"
"""The `data_type` value for the `complex128` type."""
C... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/float64.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:17.700377 | """
Zarr v3 `float64` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
import re
from typing import Final, Literal, NewType
FLOAT64_DATA_TYPE_NAME: Final = "float64"
"""The `data_type` value for the `float64` type."""
Float64DataTypeName = Literal["float64"]
"""Literal type of... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/float32.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:17.735460 | """
Zarr v3 `float32` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
import re
from typing import Final, Literal, NewType
FLOAT32_DATA_TYPE_NAME: Final = "float32"
"""The `data_type` value for the `float32` type."""
Float32DataTypeName = Literal["float32"]
"""Literal type of... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/int8.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.043399 | """
Zarr v3 `int8` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
INT8_DATA_TYPE_NAME: Final = "int8"
"""The `data_type` value for the `int8` type."""
Int8DataTypeName = Literal["int8"]
"""Literal type of the `data_type` field for `int8`."""... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/numpy_datetime64.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.043959 | """
Zarr `numpy.datetime64` data type (zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/tree/main/data-types/numpy.datetime64
"""
from typing import Final, Literal
from typing_extensions import ReadOnly, TypedDict
NUMPY_DATETIME64_DATA_TYPE_NAME: Final = "numpy.datetime64"
"""The `name` fiel... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/int64.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.056192 | """
Zarr v3 `int64` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
INT64_DATA_TYPE_NAME: Final = "int64"
"""The `data_type` value for the `int64` type."""
Int64DataTypeName = Literal["int64"]
"""Literal type of the `data_type` field for `int... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/int32.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.103781 | """
Zarr v3 `int32` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
INT32_DATA_TYPE_NAME: Final = "int32"
"""The `data_type` value for the `int32` type."""
Int32DataTypeName = Literal["int32"]
"""Literal type of the `data_type` field for `int... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/numpy_timedelta64.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.121423 | """
Zarr `numpy.timedelta64` data type (zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/tree/main/data-types/numpy.timedelta64
"""
from typing import Final, Literal
from typing_extensions import ReadOnly, TypedDict
NUMPY_TIMEDELTA64_DATA_TYPE_NAME: Final = "numpy.timedelta64"
"""The `name` ... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/raw.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.319040 | """
Zarr v3 `r<N>` raw-bytes data type (parameterised by bit count).
The `data_type` value is a string of the form `r<N>` where `N` is a
positive multiple of 8 (e.g. `r8`, `r16`, `r24`).
See https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html
"""
import re
from typing import Final, NewType
RawBytesDataTy... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/string.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.332527 | """
Zarr `string` data type (variable-length utf-8, zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/tree/main/data-types/string
"""
from typing import Final, Literal
STRING_DATA_TYPE_NAME: Final = "string"
"""The `data_type` value for the `string` type."""
StringDataTypeName = Literal["stri... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/uint16.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.597490 | """
Zarr v3 `uint16` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
UINT16_DATA_TYPE_NAME: Final = "uint16"
"""The `data_type` value for the `uint16` type."""
Uint16DataTypeName = Literal["uint16"]
"""Literal type of the `data_type` field fo... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/struct.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.625486 | """
Zarr `struct` data type (heterogeneous record, zarr-extensions).
See https://github.com/zarr-developers/zarr-extensions/blob/main/data-types/struct/README.md
"""
from collections.abc import Mapping
from typing import Final, Literal
from typing_extensions import ReadOnly, TypedDict
STRUCT_DATA_TYPE_NAME: Final =... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/uint32.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:18.666595 | """
Zarr v3 `uint32` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
UINT32_DATA_TYPE_NAME: Final = "uint32"
"""The `data_type` value for the `uint32` type."""
Uint32DataTypeName = Literal["uint32"]
"""Literal type of the `data_type` field fo... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/complex64.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:21.034264 | """
Zarr v3 `complex64` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
from zarr_metadata.v3.data_type.float32 import Float32FillValue
COMPLEX64_DATA_TYPE_NAME: Final = "complex64"
"""The `data_type` value for the `complex64` type."""
Compl... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/float16.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:26.052216 | """
Zarr v3 `float16` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
import re
from typing import Final, Literal, NewType
FLOAT16_DATA_TYPE_NAME: Final = "float16"
"""The `data_type` value for the `float16` type."""
Float16DataTypeName = Literal["float16"]
"""Literal type of... |
zarr-developers/zarr-python | https://github.com/zarr-developers/zarr-python | null | null | null | null | 1,970 | null | null | mit | null | null | null | null | null | null | null | packages/zarr-metadata/src/zarr_metadata/v3/data_type/int16.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:26.052746 | """
Zarr v3 `int16` data type.
See https://zarr-specs.readthedocs.io/en/latest/v3/data-types/index.html
"""
from typing import Final, Literal
INT16_DATA_TYPE_NAME: Final = "int16"
"""The `data_type` value for the `int16` type."""
Int16DataTypeName = Literal["int16"]
"""Literal type of the `data_type` field for `int... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | dataset/util.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.199429 | import numpy as np
def all_to_onehot(masks, labels):
if len(masks.shape) == 3:
Ms = np.zeros((len(labels), masks.shape[0], masks.shape[1], masks.shape[2]), dtype=np.uint8)
else:
Ms = np.zeros((len(labels), masks.shape[0], masks.shape[1]), dtype=np.uint8)
for ni, l in enumerate(labels):
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | dataset/vos_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.203225 | import os
from os import path, replace
import torch
from torch.utils.data.dataset import Dataset
from torchvision import transforms
from torchvision.transforms import InterpolationMode
from PIL import Image
import numpy as np
from dataset.range_transform import im_normalization, im_mean
from dataset.reseed import res... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | dataset/range_transform.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.212773 | import torchvision.transforms as transforms
im_mean = (124, 116, 104)
im_normalization = transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
inv_im_trans = transforms.Normalize(
mean=[-0.485/0.229, -0.456/0.224, -0.406/... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | dataset/static_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.214344 | import os
from os import path
import torch
from torch.utils.data.dataset import Dataset
from torchvision import transforms
from torchvision.transforms import InterpolationMode
from PIL import Image
import numpy as np
from dataset.range_transform import im_normalization, im_mean
from dataset.tps import random_tps_warp... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | dataset/tps.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.216786 | import numpy as np
from PIL import Image
import cv2
import thinplate as tps
cv2.setNumThreads(0)
def pick_random_points(h, w, n_samples):
y_idx = np.random.choice(np.arange(h), size=n_samples, replace=False)
x_idx = np.random.choice(np.arange(w), size=n_samples, replace=False)
return y_idx/h, x_idx/w
de... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | eval.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.221928 | import os
from os import path
from argparse import ArgumentParser
import shutil
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
import numpy as np
from PIL import Image
from inference.data.test_datasets import LongTestDataset, DAVISTestDataset, YouTubeVOSTestDataset
from inference... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/data/test_datasets.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.843173 | import os
from os import path
import json
from inference.data.video_reader import VideoReader
class LongTestDataset:
def __init__(self, data_root, size=-1):
self.image_dir = path.join(data_root, 'JPEGImages')
self.mask_dir = path.join(data_root, 'Annotations')
self.size = size
se... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/data/video_reader.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.857366 | import os
from os import path
from torch.utils.data.dataset import Dataset
from torchvision import transforms
from torchvision.transforms import InterpolationMode
import torch.nn.functional as F
from PIL import Image
import numpy as np
from dataset.range_transform import im_normalization
class VideoReader(Dataset):... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/controller.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.857982 | import torch
try:
from torch import mps
except:
pass
from ..fbrs.inference import clicker
from ..fbrs.inference.predictors import get_predictor
class InteractiveController:
def __init__(self, net, device, predictor_params, prob_thresh=0.5):
self.net = net.to(device)
self.prob_thresh = pro... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/clicker.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.860047 | from collections import namedtuple
import numpy as np
from copy import deepcopy
from scipy.ndimage import distance_transform_edt
Click = namedtuple('Click', ['is_positive', 'coords'])
class Clicker(object):
def __init__(self, gt_mask=None, init_clicks=None, ignore_label=-1):
if gt_mask is not None:
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/evaluation.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.861377 | from time import time
import numpy as np
import torch
from ..inference import utils
from ..inference.clicker import Clicker
try:
get_ipython()
from tqdm import tqdm_notebook as tqdm
except NameError:
from tqdm import tqdm
def evaluate_dataset(dataset, predictor, oracle_eval=False, **kwargs):
all_io... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/data/mask_mapper.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.936875 | import numpy as np
import torch
from dataset.util import all_to_onehot
class MaskMapper:
"""
This class is used to convert a indexed-mask to a one-hot representation.
It also takes care of remapping non-continuous indices
It has two modes:
1. Default. Only masks with new indices are supposed ... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/inference_core.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:28.973884 | from inference.memory_manager import MemoryManager
from model.network import XMem
from model.aggregate import aggregate
from util.tensor_util import pad_divide_by, unpad
class InferenceCore:
def __init__(self, network:XMem, config):
self.config = config
self.network = network
self.mem_eve... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/predictors/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.385578 | from .base import BasePredictor
from .brs import InputBRSPredictor, FeatureBRSPredictor, HRNetFeatureBRSPredictor
from .brs_functors import InputOptimizer, ScaleBiasOptimizer
from ..transforms import ZoomIn
from ...model.is_hrnet_model import DistMapsHRNetModel
def get_predictor(net, brs_mode, device,
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/transforms/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.454070 | from .base import SigmoidForPred
from .flip import AddHorizontalFlip
from .zoom_in import ZoomIn
from .limit_longest_side import LimitLongestSide
from .crops import Crops
|
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/predictors/brs.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.455218 | import torch
import torch.nn.functional as F
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
from .base import BasePredictor
from ...model.is_hrnet_model import DistMapsHRNetModel
class BRSBasePredictor(BasePredictor):
def __init__(self, model, device, opt_functor, optimize_after_n_clicks=1, **kwargs... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/predictors/base.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.456788 | import torch
import torch.nn.functional as F
from ..transforms import AddHorizontalFlip, SigmoidForPred, LimitLongestSide
class BasePredictor(object):
def __init__(self, net, device,
net_clicks_limit=None,
with_flip=False,
zoom_in=None,
max_size... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/predictors/brs_functors.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.473780 | import torch
import numpy as np
from ...model.metrics import _compute_iou
from .brs_losses import BRSMaskLoss
class BaseOptimizer:
def __init__(self, optimizer_params,
prob_thresh=0.49,
reg_weight=1e-3,
min_iou_diff=0.01,
brs_loss=BRSMaskLoss(),... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/transforms/base.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.482349 | import torch
class BaseTransform(object):
def __init__(self):
self.image_changed = False
def transform(self, image_nd, clicks_lists):
raise NotImplementedError
def inv_transform(self, prob_map):
raise NotImplementedError
def reset(self):
raise NotImplementedError
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/predictors/brs_losses.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.483304 | import torch
from ...model.losses import SigmoidBinaryCrossEntropyLoss
class BRSMaskLoss(torch.nn.Module):
def __init__(self, eps=1e-5):
super().__init__()
self._eps = eps
def forward(self, result, pos_mask, neg_mask):
pos_diff = (1 - result) * pos_mask
pos_target = torch.sum... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/transforms/flip.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.502930 | import torch
from ..clicker import Click
from .base import BaseTransform
class AddHorizontalFlip(BaseTransform):
def transform(self, image_nd, clicks_lists):
assert len(image_nd.shape) == 4
image_nd = torch.cat([image_nd, torch.flip(image_nd, dims=[3])], dim=0)
image_width = image_nd.sha... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/transforms/crops.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.515867 | import math
import torch
import numpy as np
from ...inference.clicker import Click
from .base import BaseTransform
class Crops(BaseTransform):
def __init__(self, crop_size=(320, 480), min_overlap=0.2):
super().__init__()
self.crop_height, self.crop_width = crop_size
self.min_overlap = mi... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/transforms/limit_longest_side.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:29.563659 | from .zoom_in import ZoomIn, get_roi_image_nd
class LimitLongestSide(ZoomIn):
def __init__(self, max_size=800):
super().__init__(target_size=max_size, skip_clicks=0)
def transform(self, image_nd, clicks_lists):
assert image_nd.shape[0] == 1 and len(clicks_lists) == 1
image_max_size = ... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/transforms/zoom_in.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.023287 | import torch
from ..clicker import Click
from ...utils.misc import get_bbox_iou, get_bbox_from_mask, expand_bbox, clamp_bbox
from .base import BaseTransform
class ZoomIn(BaseTransform):
def __init__(self,
target_size=400,
skip_clicks=1,
expansion_ratio=1.4,
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/initializer.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.045728 | import torch
import torch.nn as nn
import numpy as np
class Initializer(object):
def __init__(self, local_init=True, gamma=None):
self.local_init = local_init
self.gamma = gamma
def __call__(self, m):
if getattr(m, '__initialized', False):
return
if isinstance(m, ... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/is_deeplab_model.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.090728 | import torch
import torch.nn as nn
from .ops import DistMaps
from .modeling.deeplab_v3 import DeepLabV3Plus
from .modeling.basic_blocks import SepConvHead
def get_deeplab_model(backbone='resnet50', deeplab_ch=256, aspp_dropout=0.5,
norm_layer=nn.BatchNorm2d, backbone_norm_layer=None,
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/is_hrnet_model.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.093126 | import torch
import torch.nn as nn
from .ops import DistMaps
from .modeling.hrnet_ocr import HighResolutionNet
def get_hrnet_model(width=48, ocr_width=256, small=False, norm_radius=260,
use_rgb_conv=True, with_aux_output=False, cpu_dist_maps=False,
norm_layer=nn.BatchNorm2d):
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.101278 | import torch
import numpy as np
from ..utils import misc
class TrainMetric(object):
def __init__(self, pred_outputs, gt_outputs):
self.pred_outputs = pred_outputs
self.gt_outputs = gt_outputs
def update(self, *args, **kwargs):
raise NotImplementedError
def get_epoch_value(self):... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/modeling/basic_blocks.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.112334 | import torch.nn as nn
from ...model import ops
class ConvHead(nn.Module):
def __init__(self, out_channels, in_channels=32, num_layers=1,
kernel_size=3, padding=1,
norm_layer=nn.BatchNorm2d):
super(ConvHead, self).__init__()
convhead = []
for i in range(n... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/losses.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.121880 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..utils import misc
class NormalizedFocalLossSigmoid(nn.Module):
def __init__(self, axis=-1, alpha=0.25, gamma=2,
from_logits=False, batch_axis=0,
weight=None, size_average=True, detach_de... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/inference/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.175901 | from datetime import timedelta
from pathlib import Path
import torch
import numpy as np
from ..model.is_deeplab_model import get_deeplab_model
from ..model.is_hrnet_model import get_hrnet_model
def get_time_metrics(all_ious, elapsed_time):
n_images = len(all_ious)
n_clicks = sum(map(len, all_ious))
mea... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/modeling/deeplab_v3.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.616583 | from contextlib import ExitStack
import torch
from torch import nn
import torch.nn.functional as F
from .basic_blocks import SeparableConv2d
from .resnet import ResNetBackbone
from ...model import ops
class DeepLabV3Plus(nn.Module):
def __init__(self, backbone='resnet50', norm_layer=nn.BatchNorm2d,
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/modeling/ocr.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.713781 | import torch
import torch.nn as nn
import torch._utils
import torch.nn.functional as F
class SpatialGather_Module(nn.Module):
"""
Aggregate the context features according to the initial
predicted probability distribution.
Employ the soft-weighted method to aggregate the context.
"""
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/ops.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.729941 | import torch
from torch import nn as nn
import numpy as np
from . import initializer as initializer
from ..utils.cython import get_dist_maps
def select_activation_function(activation):
if isinstance(activation, str):
if activation.lower() == 'relu':
return nn.ReLU
elif activation.lowe... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/modeling/hrnet_ocr.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.730468 | import os
import numpy as np
import torch
import torch.nn as nn
import torch._utils
import torch.nn.functional as F
from .ocr import SpatialOCR_Module, SpatialGather_Module
from .resnetv1b import BasicBlockV1b, BottleneckV1b
relu_inplace = True
class HighResolutionModule(nn.Module):
def __init__(self, num_branch... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/modeling/resnetv1b.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.749096 | import torch
import torch.nn as nn
GLUON_RESNET_TORCH_HUB = 'rwightman/pytorch-pretrained-gluonresnet'
class BasicBlockV1b(nn.Module):
expansion = 1
def __init__(self, inplanes, planes, stride=1, dilation=1, downsample=None,
previous_dilation=1, norm_layer=nn.BatchNorm2d):
super(Basi... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/modeling/resnet.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.749771 | import torch
from .resnetv1b import resnet34_v1b, resnet50_v1s, resnet101_v1s, resnet152_v1s
class ResNetBackbone(torch.nn.Module):
def __init__(self, backbone='resnet50', pretrained_base=True, dilated=True, **kwargs):
super(ResNetBackbone, self).__init__()
if backbone == 'resnet34':
... |
hkchengrex/XMem | https://github.com/hkchengrex/XMem | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | inference/interact/fbrs/model/syncbn/modules/functional/_csrc.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:30.777321 | """
/*****************************************************************************/
Extension module loader
code referenced from : https://github.com/facebookresearch/maskrcnn-benchmark
/*****************************************************************************/
"""
from __future__ import absolute_import
from __f... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/101276_Check_web_page_exists/recipe-101276.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:36.192517 | from httplib import HTTP
from urlparse import urlparse
def checkURL(url):
p = urlparse(url)
h = HTTP(p[1])
h.putrequest('HEAD', p[2])
h.endheaders()
if h.getreply()[0] == 200: return 1
else: return 0
if __name__ == '__main__':
assert checkURL('http://slashdot.org')
a... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/101853_Use_tryexcept_handle_unexpected_input/recipe-101853.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:36.211354 | "minesweeper"
from UserDict import UserDict
class Game(UserDict):
def __init__(self, **kwargs):
"initialize board"
d = {"ROWS":8,"COLS":8,"BOMBS":10}
d.update(kwargs)
UserDict.__init__(self,d)
self.reset()
def random_bombs(self):
"returns list of coordinates in... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/103702_unzip/recipe-103702.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:36.212899 | def unzip(args):
"""
inverse of zip. Given: ((1,"a"),(2,"b")) --> ((1,2),("a","b"))
seq == unzip(zip(seq)) if seq is a rectangular matrix (all of its row has the same length.
"""
result = []
n = min(map(len,args))
for i in range(n):result.append([])
for i in range(len(args)):
fo... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/102187_Singleton_as_a_metaclass/recipe-102187.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:36.214663 | """
USAGE:
class A:
__metaclass__ = Singleton
def __init__(self):
self.a=1
a=A()
b=A()
a is b #true
You don't have access to the constructor,
you only can call a factory that returns always the same instance.
"""
_global_dict = {}
def Singleton(name, bases, namespace):
class Result:pass
Result.__name__ = n... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/102114_ThreadedContext/recipe-102114.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:36.215875 | ThreadedContext is like a dictionary, but stores its data in a private namespace for every thread.
A thread can't access to the data from other thread.
USAGE:
In Thread 1:
d = ThreadedContext()
d[1]=1
In Thread 2:
d[1] #raises KeyError exception
d[1]= 2
In Thread 1:
print d[1] #prints 1
In Thread 2:
print d[1] #prin... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/101521_Using_translate_wbinary_files__like_finding/recipe-101521.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:36.708406 | import string
#Translate in python has 2 pieces, a translation table and the translate call.
#The translation table is a list of 256 characters. Changing the order of the #characters is used for mapping
norm = string.maketrans('', '') #builds list of all characters
print len(norm) #256 characters
print string.maketr... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/102263_Logfilepy__Singletlog_file/recipe-102263.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:36.708888 | import os, os.path, sys, time
class Log:
class Log_File:
def __init__(self, fPath = os.getcwd(), fName = "log.txt"):
""" I intend to add some customization features to this,
e.g., allowing the log file's name and directory to be
specified, but that will be later
"""
self.fpath = fPath # the cla... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/102109_Colorize_xml_source_using_sax_ContentHandler/recipe-102109.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:37.215194 | #!/usr/bin/python2.1
import sys
from xml.dom.ext import SplitQName
from xml.sax.handler import ContentHandler
from xml.sax.saxutils import escape
_ROOT, _STRING, _COMMENT, _NAME, _KEYWORD, _TEXT, _HEAD =0,1,2,3,4,5,6
DOCBOOK = {
_ROOT: ('<programlisting>','</programlisting>'),
_STRING: ('<emphasis>', '</e... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/104734_Using_time_slices_categorize_events/recipe-104734.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:37.524279 | import weblog.combined, sys, time, math
def getTimeslice(period, utime):
low = int(math.floor(utime)) - period + 1
high = int(math.ceil(utime)) + 1
for x in range(low, high):
if x % period == 0:
return x
def main(files):
START = time.mktime([2001,11,12,9,0,0,0,0,0])
END = tim... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/106294_Format_warnings_Visual/recipe-106294.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:37.560575 | # Put this code in your script.
#
# It uses the standard Python warnings framework,
# and installs a custom warning message formatter that
# generates messages Visual Studio will understand.
import warnings
from warnings import warn
def my_formatwarning(message, category, filename, lineno):
""" Return a warning m... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/106430_shift_chars_in_string/recipe-106430.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:37.562050 | shift = lambda text,sft=1:string.joinfields(map(eval("lambda ch:chr((ord(ch)-ord('a')+%d)%%26+ord('a'))"%(sft,)),text),'')
shift2 = lambda txt,sft=1:''.join([[ch,chr((ord(ch) - ord(['A','a'][ch.islower()]) + sft)%26+ord(['A','a'][ch.islower()]))][ch.isalpha()] for ch in txt])
#test
print shift2('Ab-Phkew! 123...',7)... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/104733_Poor_mans_Winzip/recipe-104733.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:37.608575 | """
zip2folder.py by Dirk Krause, d_krause@pixelpark.com, 12/27/2001
Abstract: A poor man's WinZip
This program does the three essential tasks that (at least) I need:
1. Unzip an archive to a folder
2. Zip a folder to an archive
3. Zip a (big) file to an archive
For convenient usage, get Gordon McMillan's Installer ... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/106431_Arithmetics_class_measurement_values_known/recipe-106431.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:37.830997 | # measurement.py
#
# An arithmetics class for measurement values of known percentual error
# This class uses the error propagation formulae of physicists
# --------------------------
# arithmetics uses number tupels consisting of
# measurement value val and error perc (in percent)
# uses operator overloading of '+','-'... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/106469_Yet_another_Set_class_for_Python/recipe-106469.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:38.113513 | class Set:
"""The set class. It can contain mutable objects."""
def __init__(self, seq = None):
"""The constructor. It can take any object giving an iterator as an optional
argument to populate the new set."""
self.elems = []
if seq:
for elem in seq:
... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/107027_Simple_Collection_class/recipe-107027.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:38.153412 | #!/usr/bin/env python
import UserList
class Collection(UserList.UserList):
"""Collections group objects together and forward attribute lookups.
At least this is the Collection I remember from LYMB (an interpreted OO
language developed by Bill Lorensen et al at GE CRD), which almost
certainly got it f... |
ActiveState/code | https://github.com/ActiveState/code | null | null | null | null | 1,969 | null | null | mit | null | null | null | null | null | null | null | recipes/Python/106624_Lock_NT_via_screensaver/recipe-106624.py | null | null | null | null | null | null | Python | 2026-05-04T01:43:38.190524 | """
Locks the users workstation, for Windows NT and 2000
Design philosophy for this was simple, create a utility to lock
a users' workstation, without messing up their screensaver settings.
"""
import win32con
import win32api
#########################################
#Set up the two methods we'll use in this program... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.