repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_template/__init__.py
src/cqparts_template/__init__.py
""" Copyright 2018 Peter Boin Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distrib...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_template/catalogue/scripts/build.py
src/cqparts_template/catalogue/scripts/build.py
#!/usr/bin/env python import argparse import os import inspect import csv import cqparts from cqparts.catalogue import JSONCatalogue # TODO: import your library # TODO: if you don't offer a catalogue for your library, then # remove this `scripts` folder. import cqparts_template from cqparts_template.clamp.peg...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_template/clamp/peg.py
src/cqparts_template/clamp/peg.py
# TODO: illustrative model only; remove this file import cadquery import cqparts from cqparts.params import * from cqparts.display import render_props from cqparts import constraint from cqparts.utils import CoordSystem from .. import register class _PegSide(cqparts.Part): """ One side of a wooden clothes...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_template/clamp/__init__.py
src/cqparts_template/clamp/__init__.py
__all__ = [ 'ClothesPeg', ] from .peg import ClothesPeg
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/runtests.py
tests/runtests.py
#!/usr/bin/env python import sys import unittest import re import functools import logging import mock import os import inspect from contextlib import contextmanager _this_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) class MyTestRunner(unittest.runner.TextTestRunner): def __...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/base.py
tests/base.py
import unittest import sys import os import inspect from collections import defaultdict from copy import copy from cqparts import codec # ------------------- TestCase labels ------------------- def testlabel(*labels): """ Usage:: @testlabel('quick') class MyTest(unittest.TestCase): ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/test-files/thread_catalogue_build.py
tests/test-files/thread_catalogue_build.py
#!/usr/bin/env python import argparse import sys import itertools import cqparts from cqparts.catalogue import JSONCatalogue # Threads from cqparts_fasteners.solidtypes import threads # Commandline arguments parser = argparse.ArgumentParser(description="Generate a test catalogue") parser.add_argument( 'out',...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/test-files/catalogue_build.py
tests/test-files/catalogue_build.py
#!/usr/bin/env python import argparse import sys import cqparts from cqparts.catalogue import JSONCatalogue sys.path.append('..') import partslib # Commandline arguments parser = argparse.ArgumentParser(description="Generate a test catalogue") parser.add_argument( 'out', type=str, nargs='?', default='cat...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_fasteners/test_fasteners_fasteners_screw.py
tests/t_cqparts_fasteners/test_fasteners_fasteners_screw.py
from base import CQPartsTest from base import testlabel # units under test from cqparts_fasteners.fasteners.screw import ScrewFastener # ---------- Test Assembly ---------- import cadquery import cqparts from partslib.basic import Box from cqparts import constraint from cqparts.utils import CoordSystem class Faste...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_fasteners/test_fasteners_catalogue.py
tests/t_cqparts_fasteners/test_fasteners_catalogue.py
from base import testlabel from cqparts.utils.test import CatalogueTest from cqparts.catalogue import JSONCatalogue def add_catalogue(filename): catalogue = JSONCatalogue(filename) cls = testlabel('catalogue')(CatalogueTest.create_from(catalogue)) globals()[cls.__name__] = cls # BoltDepot catalogues ad...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_fasteners/__init__.py
tests/t_cqparts_fasteners/__init__.py
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_fasteners/test_fasteners_fasteners_nutbolt.py
tests/t_cqparts_fasteners/test_fasteners_fasteners_nutbolt.py
from base import CQPartsTest from base import testlabel # units under test from cqparts_fasteners.fasteners.nutbolt import NutAndBoltFastener # ---------- Test Assembly ---------- import cadquery import cqparts from partslib.basic import Box from cqparts import constraint from cqparts.utils import CoordSystem class...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_fasteners/test_fasteners_thread.py
tests/t_cqparts_fasteners/test_fasteners_thread.py
import unittest from base import testlabel from cqparts.utils.test import CatalogueTest from cqparts.catalogue import JSONCatalogue catalogue = JSONCatalogue('test-files/thread_catalogue.json') cls = testlabel('complex_thread')(CatalogueTest.create_from(catalogue)) # FIXME: when #1 is fixed, remove this so tests ar...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_template/test_template_catalogue.py
tests/t_cqparts_template/test_template_catalogue.py
from base import testlabel from cqparts.utils.test import CatalogueTest from cqparts.catalogue import JSONCatalogue def add_catalogue(filename): catalogue = JSONCatalogue(filename) cls = testlabel('catalogue')(CatalogueTest.create_from(catalogue)) globals()[cls.__name__] = cls # BoltDepot catalogues ad...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_template/__init__.py
tests/t_cqparts_template/__init__.py
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_part.py
tests/t_cqparts/test_part.py
from copy import copy from math import sqrt from base import CQPartsTest from base import testlabel import cadquery from partslib import Box, Cylinder # Unit under test import cqparts from cqparts.errors import MakeError from cqparts.utils import CoordSystem from cqparts.params import Int class PreMaturePartTests...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_params.py
tests/t_cqparts/test_params.py
from copy import copy from base import CQPartsTest from base import testlabel import cadquery from partslib import Box from cqparts.constraint import Fixed # Unit under test from cqparts.params import * from cqparts.errors import ParameterError from cqparts import Part, Assembly class ParametricObjectTests(CQParts...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_codecs.py
tests/t_cqparts/test_codecs.py
import unittest import mock import os import tempfile import shutil from collections import defaultdict from contextlib import contextmanager from base import CQPartsTest, CodecRegisterTests from base import testlabel from base import suppress_stdout_stderr # Unit(s) under test from cqparts import codec from cqparts ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_wrappers.py
tests/t_cqparts/test_wrappers.py
from base import CQPartsTest from base import testlabel import cadquery # Units under test import cqparts from cqparts.utils import as_part class TestAsPart(CQPartsTest): def test_basic(self): @as_part def Box(x=1, y=2, z=3): return cadquery.Workplane('XY').box(x, y, z) bo...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_catalogue_test.py
tests/t_cqparts/test_catalogue_test.py
from cqparts.utils.test import CatalogueTest from cqparts.catalogue import JSONCatalogue catalogue = JSONCatalogue('test-files/catalogue.json') CatalogueTest.create_from(catalogue, add_to=globals())
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_constraint.py
tests/t_cqparts/test_constraint.py
from base import CQPartsTest from base import testlabel # Unit under test from cqparts.constraint import Mate from cqparts.constraint import Fixed from cqparts.constraint import Coincident from cqparts.utils import CoordSystem from cqparts.constraint.solver import solver from partslib.basic import Box class MateT...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_solver.py
tests/t_cqparts/test_solver.py
from base import CQPartsTest from base import testlabel import cadquery # Unit under test from cqparts.constraint import Fixed, Coincident from cqparts.constraint import Mate from cqparts.utils import CoordSystem from cqparts.constraint.solver import solver from partslib.basic import Box class FixedSolverTests(CQ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_component.py
tests/t_cqparts/test_component.py
from base import CQPartsTest, CodecRegisterTests from base import testlabel # Unit(s) under test import cqparts from cqparts.utils import CoordSystem from cqparts.constraint import Mate from cqparts import codec class ComponentTests(CQPartsTest): def test_premature(self): c = cqparts.Component() ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/__init__.py
tests/t_cqparts/__init__.py
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_coordsystem.py
tests/t_cqparts/test_coordsystem.py
import mock from base import CQPartsTest from base import testlabel from cadquery import Plane, Vector import cadquery # Unit under test from cqparts.utils import CoordSystem class CoordSystemTests(CQPartsTest): @staticmethod def mat2list(m, digits=7): """Converts FreeCAD.Base.Matrix to a list""" ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_search.py
tests/t_cqparts/test_search.py
from collections import defaultdict from base import CQPartsTest from base import testlabel from partslib import Box, Cylinder # Unit under test import cqparts from cqparts.search import register from cqparts.search import search, find from cqparts.search import common_criteria from cqparts.errors import SearchNone...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_display.py
tests/t_cqparts/test_display.py
import unittest import mock import sys import cadquery from base import CQPartsTest from base import testlabel from base import skip_if_no_freecad from base import suppress_stdout_stderr from partslib import Box from partslib import CubeStack # Unit under test import cqparts from cqparts import display # Forgivin...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_assembly.py
tests/t_cqparts/test_assembly.py
import re from base import CQPartsTest from base import testlabel from partslib import Box, Cylinder, CubeStack, SimpleCar from partslib import simplecar # Unit under test import cqparts from cqparts.constraint import Fixed, Coincident from cqparts.utils import CoordSystem from cqparts.errors import AssemblyFindErro...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts/test_catalogue.py
tests/t_cqparts/test_catalogue.py
import os import tempfile import mock from base import CQPartsTest from base import testlabel from partslib import Box # Unit under test from cqparts.catalogue import JSONCatalogue from cqparts.errors import SearchNoneFoundError, SearchMultipleFoundError class JSONCatalogueTests(CQPartsTest): def setUp(self): ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/partslib/simplecar.py
tests/partslib/simplecar.py
import cadquery import cqparts from cqparts.params import * from cqparts.constraint import Mate from cqparts.constraint import Fixed, Coincident from cqparts.utils import CoordSystem # A greatly simplified version of the tutorial toy car class Wheel(cqparts.Part): width = PositiveFloat(10, doc="wheel width") ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/partslib/basic.py
tests/partslib/basic.py
import cadquery import cqparts from cqparts.params import * from cqparts.constraint import Mate from cqparts.constraint import Fixed, Coincident from cqparts.utils import CoordSystem # --------------- Basic Parts ---------------- # Parts with the express intent of being concise, and quick to process class Box(cqpa...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/partslib/__init__.py
tests/partslib/__init__.py
__all__ = [ 'Box', 'Cylinder', 'CubeStack', 'SimpleCar', ] from .basic import Box from .basic import Cylinder from .basic import CubeStack from .simplecar import SimpleCar
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/manual/screwdrives.py
tests/manual/screwdrives.py
#!/usr/bin/env python import os import sys import math import argparse import cadquery import cqparts from cqparts.params import * from cqparts.constraint import * from cqparts.utils import CoordSystem from cqparts.display import display, render_props import cqparts_fasteners from cqparts_fasteners.solidtypes.screw_...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/manual/block_tree.py
tests/manual/block_tree.py
#!/usr/bin/env python import os import sys import inspect if 'MYSCRIPT_DIR' in os.environ: _this_path = os.environ['MYSCRIPT_DIR'] else: _this_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) sys.path.insert(0, os.path.join(_this_path, '..', '..', 'src')) #cadquery_path = os.pa...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/manual/fastenerheads.py
tests/manual/fastenerheads.py
#!/usr/bin/env python import os import sys import math import argparse import cadquery import cqparts from cqparts.params import * from cqparts.constraint import * from cqparts.utils import CoordSystem from cqparts.display import display, render_props import cqparts_fasteners from cqparts_fasteners.solidtypes.fasten...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/manual/thread_custom.py
tests/manual/thread_custom.py
import os import sys import inspect if 'MYSCRIPT_DIR' in os.environ: _this_path = os.environ['MYSCRIPT_DIR'] else: _this_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) sys.path.insert(0, os.path.join(_this_path, '..', '..', 'src')) import cadquery import cqparts import Part a...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/manual/thread_eval.py
tests/manual/thread_eval.py
import os import sys import inspect if 'MYSCRIPT_DIR' in os.environ: _this_path = os.environ['MYSCRIPT_DIR'] else: _this_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) sys.path.insert(0, os.path.join(_this_path, '..', '..', 'src')) import cadquery import cqparts from Helpers ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/manual/threads.py
tests/manual/threads.py
#!/usr/bin/env python import os import sys import math import argparse import cadquery import cqparts from cqparts.params import * from cqparts.constraint import * from cqparts.utils import CoordSystem from cqparts.solidtypes.threads import * from cqparts.display import display, render_props import logging log = log...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/manual/fastener.py
tests/manual/fastener.py
#!/usr/bin/env python import os import sys import inspect import logging import cadquery import cqparts from cqparts.params import * from cqparts_misc.basic.primatives import Box from cqparts.constraint import Fixed, Coincident from cqparts.constraint import Mate from cqparts.display import display from cqparts.util...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_motors/test_motors_catalogue.py
tests/t_cqparts_motors/test_motors_catalogue.py
from base import testlabel from cqparts.utils.test import CatalogueTest from cqparts.catalogue import JSONCatalogue def add_catalogue(filename): catalogue = JSONCatalogue(filename) cls = testlabel('catalogue')(CatalogueTest.create_from(catalogue)) globals()[cls.__name__] = cls # Stepper Catalogue(s) ad...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/tests/t_cqparts_motors/__init__.py
tests/t_cqparts_motors/__init__.py
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/localweb.py
docs-sphinx/localweb.py
# run using: # ./go.sh web import os import time import SimpleHTTPServer import SocketServer import threading import webbrowser PORT = 9040 SocketServer.TCPServer.allow_reuse_address = True Handler = SimpleHTTPServer.SimpleHTTPRequestHandler os.chdir('./_build/html/') httpd = SocketServer.ThreadingTCPServer(("", ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/conf.py
docs-sphinx/conf.py
# -*- coding: utf-8 -*- # # cqparts documentation build configuration file, created by # sphinx-quickstart on Thu Nov 16 13:21:56 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/_static/iframes/easy-install/generate.py
docs-sphinx/_static/iframes/easy-install/generate.py
#!/usr/bin/env python import cadquery import logging cadquery.freecad_impl.console_logging.enable(logging.INFO) # ------------------- Wood Screw ------------------- import cadquery import cqparts from cqparts.params import * from cqparts_fasteners.params import HeadType, DriveType, ThreadType from cqparts_fastener...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/_static/iframes/parts/generate.py
docs-sphinx/_static/iframes/parts/generate.py
#!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Box ------------------- import cadquery import cqparts from cqparts.params import * from cqparts.display import display class Box(cqparts.Part): len...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/_static/iframes/toy-car/generate.py
docs-sphinx/_static/iframes/toy-car/generate.py
#!/usr/bin/env python # Get repository root from subprocess import check_output CQPARTS_ROOT = check_output(["git", "rev-parse", "--show-toplevel"]).rstrip('\n') # Add examples folder to path import sys import os sys.path.append(os.path.join(CQPARTS_ROOT, 'examples')) # ------------------- Import Module -----------...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/_static/iframes/asm-build-cycle/generate.py
docs-sphinx/_static/iframes/asm-build-cycle/generate.py
#!/usr/bin/env python # -------------------------- Cylinder Part -------------------------- import cadquery import cqparts from cqparts.params import * from cqparts.display import display, render_props from cqparts.utils.geometry import CoordSystem from cqparts.constraint import Mate class Cylinder(cqparts.Part): ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/_static/iframes/biscuit/generate.py
docs-sphinx/_static/iframes/biscuit/generate.py
#!/usr/bin/env python # ------------------- Wood Panel ------------------- from math import radians, tan, cos import cadquery import cqparts from cqparts.params import * from cqparts.constraint import Mate from cqparts.utils import CoordSystem from cqparts.display import display, render_props class Panel(cqparts....
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/_static/iframes/fastener-screw/generate.py
docs-sphinx/_static/iframes/fastener-screw/generate.py
#!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Thing ------------------- import cqparts from cqparts.constraint import Fixed, Coincident from cqparts_fasteners.fasteners.screw import ScrewFastener fro...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs-sphinx/_static/iframes/fastener-nut-bolt/generate.py
docs-sphinx/_static/iframes/fastener-nut-bolt/generate.py
#!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Thing ------------------- import cqparts from cqparts.constraint import Fixed, Coincident from cqparts_fasteners.fasteners.nutbolt import NutAndBoltFaste...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs/doc/_static/iframes/easy-install/generate.py
docs/doc/_static/iframes/easy-install/generate.py
#!/usr/bin/env python import cadquery import logging cadquery.freecad_impl.console_logging.enable(logging.INFO) # ------------------- Wood Screw ------------------- import cadquery import cqparts from cqparts.params import * from cqparts_fasteners.params import HeadType, DriveType, ThreadType from cqparts_fastener...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs/doc/_static/iframes/parts/generate.py
docs/doc/_static/iframes/parts/generate.py
#!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Box ------------------- import cadquery import cqparts from cqparts.params import * from cqparts.display import display class Box(cqparts.Part): len...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs/doc/_static/iframes/toy-car/generate.py
docs/doc/_static/iframes/toy-car/generate.py
#!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Wheel ------------------- import cadquery import cqparts from cqparts.params import * from cqparts.display import render_props, display class Wheel(cqpar...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs/doc/_static/iframes/asm-build-cycle/generate.py
docs/doc/_static/iframes/asm-build-cycle/generate.py
#!/usr/bin/env python # -------------------------- Cylinder Part -------------------------- import cadquery import cqparts from cqparts.params import * from cqparts.display import display, render_props from cqparts.utils.geometry import CoordSystem from cqparts.constraint import Mate class Cylinder(cqparts.Part): ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs/doc/_static/iframes/biscuit/generate.py
docs/doc/_static/iframes/biscuit/generate.py
#!/usr/bin/env python # ------------------- Wood Panel ------------------- from math import radians, tan, cos import cadquery import cqparts from cqparts.params import * from cqparts.constraint import Mate from cqparts.utils import CoordSystem from cqparts.display import display, render_props class Panel(cqparts....
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs/doc/_static/iframes/fastener-screw/generate.py
docs/doc/_static/iframes/fastener-screw/generate.py
#!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Thing ------------------- import cqparts from cqparts.constraint import Fixed, Coincident from cqparts_fasteners.fasteners.screw import ScrewFastener fro...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/docs/doc/_static/iframes/fastener-nut-bolt/generate.py
docs/doc/_static/iframes/fastener-nut-bolt/generate.py
#!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Thing ------------------- import cqparts from cqparts.constraint import Fixed, Coincident from cqparts_fasteners.fasteners.nutbolt import NutAndBoltFaste...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/examples/logo.py
examples/logo.py
""" This example makes the cqparts logo """ from cqparts import Assembly class CQPartsLogo(Assembly): # TODO pass
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/examples/fastener_easyinstall.py
examples/fastener_easyinstall.py
""" Functional implementation of the tutorial in :ref:`tutorials_fastener-easy-install` """ import cadquery import cqparts # cqparts: parameters from cqparts.params import PositiveFloat, Boolean # cqparts: fasteners from cqparts_fasteners import Fastener from cqparts_fasteners.utils.evaluator import VectorEvaluator ...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/examples/toy_car.py
examples/toy_car.py
#!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Wheel ------------------- import cadquery import cqparts from cqparts.params import * from cqparts.display import render_props, display class Wheel(cqpar...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/examples/servo.py
examples/servo.py
from cqparts import Assembly class Servo(Assembly): # TODO pass
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
cqparts/cqparts
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/deployment/make-setup.py
deployment/make-setup.py
import codecs import os import io import sys import re import setuptools from distutils.version import LooseVersion import argparse import pprint import jinja2 LIB_PARENT_DIR = os.path.join('..', 'src') HERE = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, LIB_PARENT_DIR) parser = argparse.ArgumentPa...
python
Apache-2.0
018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53
2026-01-05T07:14:41.025281Z
false
mortensteenrasmussen/docker-registry-manifest-cleanup
https://github.com/mortensteenrasmussen/docker-registry-manifest-cleanup/blob/b03663e699c7e3c0df7ed1d4b96a3d90528a4cf5/docker-registry-cleanup.py
docker-registry-cleanup.py
import glob import urllib3 from requests.auth import HTTPBasicAuth import requests import json import re import os import boto from boto.s3.key import Key ############################ ######## Functions ######### ############################ def exit_with_error(message): print(message) print("Exiting") exit(1) # I...
python
Apache-2.0
b03663e699c7e3c0df7ed1d4b96a3d90528a4cf5
2026-01-05T07:14:47.461126Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/gradio_app.py
gradio_app.py
import argparse import glob import os import re import signal import subprocess import tempfile import time from dataclasses import dataclass from datetime import datetime from typing import Optional import gradio as gr import numpy as np import psutil import trimesh from threestudio.utils.config import load_config f...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/launch.py
launch.py
import argparse import contextlib import logging import os import sys class ColoredFilter(logging.Filter): """ A logging filter to add color to certain log levels. """ RESET = "\033[0m" RED = "\033[31m" GREEN = "\033[32m" YELLOW = "\033[33m" BLUE = "\033[34m" MAGENTA = "\033[35m" ...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/Reward3D.py
Reward3D/Reward3D.py
''' * Adapted from ImageReward (https://github.com/THUDM/ImageReward) ''' import os import torch import torch.nn as nn from PIL import Image from .models.BLIP.blip_pretrain import BLIP_Pretrain from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize try: from torchvision.transforms impo...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/__init__.py
Reward3D/__init__.py
from .BLIP import * from .Reward3D import *
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/BLIP/vit.py
Reward3D/BLIP/vit.py
''' * Adapted from BLIP (https://github.com/salesforce/BLIP) * Based on timm code base * https://github.com/rwightman/pytorch-image-models/tree/master/timm ''' import torch import torch.nn as nn import torch.nn.functional as F from functools import partial from timm.models.vision_transformer import _cfg, PatchEmbe...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/BLIP/blip_pretrain.py
Reward3D/BLIP/blip_pretrain.py
''' * Adapted from BLIP (https://github.com/salesforce/BLIP) ''' import transformers transformers.logging.set_verbosity_error() from torch import nn import os from .med import BertConfig, BertModel from .blip import create_vit, init_tokenizer class BLIP_Pretrain(nn.Module): def __init__(self, ...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/BLIP/med.py
Reward3D/BLIP/med.py
''' * Adapted from BLIP (https://github.com/salesforce/BLIP) * Based on huggingface code base * https://github.com/huggingface/transformers/blob/v4.15.0/src/transformers/models/bert ''' import math from typing import Tuple import torch from torch import Tensor, device, nn import torch.utils.checkpoint from torch i...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
true
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/BLIP/blip.py
Reward3D/BLIP/blip.py
''' * Adapted from BLIP (https://github.com/salesforce/BLIP) ''' import warnings warnings.filterwarnings("ignore") import torch import os from urllib.parse import urlparse from timm.models.hub import download_cached_file from transformers import BertTokenizer from .vit import VisionTransformer, interpolate_pos_embed...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/BLIP/__init__.py
Reward3D/BLIP/__init__.py
from .blip_pretrain import *
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/models/BLIPScore.py
Reward3D/models/BLIPScore.py
import os import torch import torch.nn as nn import torch.nn.functional as F from PIL import Image from Reward3D.models.BLIP.blip import load_checkpoint from Reward3D.models.BLIP.blip_pretrain import BLIP_Pretrain from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize try: from torchvi...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/models/__init__.py
Reward3D/models/__init__.py
from .BLIPScore import * from .BLIP import *
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/models/BLIP/vit.py
Reward3D/models/BLIP/vit.py
''' * Adapted from BLIP (https://github.com/salesforce/BLIP) * Based on timm code base * https://github.com/rwightman/pytorch-image-models/tree/master/timm ''' import torch import torch.nn as nn import torch.nn.functional as F from functools import partial from timm.models.vision_transformer import _cfg, PatchEmbe...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/models/BLIP/blip_pretrain.py
Reward3D/models/BLIP/blip_pretrain.py
''' * Adapted from BLIP (https://github.com/salesforce/BLIP) ''' import transformers transformers.logging.set_verbosity_error() from torch import nn import os from .med import BertConfig, BertModel from .blip import create_vit, init_tokenizer class BLIP_Pretrain(nn.Module): def __init__(self, ...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/models/BLIP/med.py
Reward3D/models/BLIP/med.py
''' * Adapted from BLIP (https://github.com/salesforce/BLIP) * Based on huggingface code base * https://github.com/huggingface/transformers/blob/v4.15.0/src/transformers/models/bert ''' import math from typing import Tuple import torch from torch import Tensor, device, nn import torch.utils.checkpoint from torch i...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
true
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/models/BLIP/blip.py
Reward3D/models/BLIP/blip.py
''' * Adapted from BLIP (https://github.com/salesforce/BLIP) ''' import warnings warnings.filterwarnings("ignore") import torch import os from urllib.parse import urlparse from timm.models.hub import download_cached_file from transformers import BertTokenizer from .vit import VisionTransformer, interpolate_pos_embed...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/Reward3D/models/BLIP/__init__.py
Reward3D/models/BLIP/__init__.py
#from .blip_pretrain import * from .blip import load_checkpoint from .blip_pretrain import BLIP_Pretrain
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/zero123.py
extern/zero123.py
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/__init__.py
extern/__init__.py
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/extras.py
extern/ldm_zero123/extras.py
import logging from contextlib import contextmanager from pathlib import Path import torch from omegaconf import OmegaConf from extern.ldm_zero123.util import instantiate_from_config @contextmanager def all_logging_disabled(highest_level=logging.CRITICAL): """ A context manager that will prevent any logging...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/guidance.py
extern/ldm_zero123/guidance.py
import abc from typing import List, Tuple import matplotlib.pyplot as plt import numpy as np import torch from IPython.display import clear_output from scipy import interpolate class GuideModel(torch.nn.Module, abc.ABC): def __init__(self) -> None: super().__init__() @abc.abstractmethod def prep...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/util.py
extern/ldm_zero123/util.py
import importlib import os import time from inspect import isfunction import cv2 import matplotlib.pyplot as plt import numpy as np import PIL import torch import torchvision from PIL import Image, ImageDraw, ImageFont from torch import optim def pil_rectangle_crop(im): width, height = im.size # Get dimensions ...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/lr_scheduler.py
extern/ldm_zero123/lr_scheduler.py
import numpy as np class LambdaWarmUpCosineScheduler: """ note: use with a base_lr of 1.0 """ def __init__( self, warm_up_steps, lr_min, lr_max, lr_start, max_decay_steps, verbosity_interval=0, ): self.lr_warm_up_steps = warm_up_step...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/thirdp/psp/id_loss.py
extern/ldm_zero123/thirdp/psp/id_loss.py
# https://github.com/eladrich/pixel2style2pixel import torch from torch import nn from extern.ldm_zero123.thirdp.psp.model_irse import Backbone class IDFeatures(nn.Module): def __init__(self, model_path): super(IDFeatures, self).__init__() print("Loading ResNet ArcFace") self.facenet = Ba...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/thirdp/psp/model_irse.py
extern/ldm_zero123/thirdp/psp/model_irse.py
# https://github.com/eladrich/pixel2style2pixel from torch.nn import ( BatchNorm1d, BatchNorm2d, Conv2d, Dropout, Linear, Module, PReLU, Sequential, ) from extern.ldm_zero123.thirdp.psp.helpers import ( Flatten, bottleneck_IR, bottleneck_IR_SE, get_blocks, l2_norm, ...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/thirdp/psp/helpers.py
extern/ldm_zero123/thirdp/psp/helpers.py
# https://github.com/eladrich/pixel2style2pixel from collections import namedtuple import torch from torch.nn import ( AdaptiveAvgPool2d, BatchNorm2d, Conv2d, MaxPool2d, Module, PReLU, ReLU, Sequential, Sigmoid, ) """ ArcFace implementation from [TreB1eN](https://github.com/TreB1e...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/models/autoencoder.py
extern/ldm_zero123/models/autoencoder.py
from contextlib import contextmanager import pytorch_lightning as pl import torch import torch.nn.functional as F from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer from extern.ldm_zero123.modules.diffusionmodules.model import Decoder, Encoder from extern.ldm_zero123.modules.distributions.d...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/models/diffusion/ddim.py
extern/ldm_zero123/models/diffusion/ddim.py
"""SAMPLING ONLY.""" from functools import partial import numpy as np import torch from einops import rearrange from tqdm import tqdm from extern.ldm_zero123.models.diffusion.sampling_util import ( norm_thresholding, renorm_thresholding, spatial_norm_thresholding, ) from extern.ldm_zero123.modules.diffus...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/models/diffusion/ddpm.py
extern/ldm_zero123/models/diffusion/ddpm.py
""" wild mixture of https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py https://github.com/openai/improved-diffusion/blob/e94489283bb876ac1477d5dd7709bbbd2d9902ce/improved_diffusion/gaussian_diffusion.py https...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
true
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/models/diffusion/__init__.py
extern/ldm_zero123/models/diffusion/__init__.py
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/models/diffusion/sampling_util.py
extern/ldm_zero123/models/diffusion/sampling_util.py
import numpy as np import torch def append_dims(x, target_dims): """Appends dimensions to the end of a tensor until it has target_dims dimensions. From https://github.com/crowsonkb/k-diffusion/blob/master/k_diffusion/utils.py""" dims_to_append = target_dims - x.ndim if dims_to_append < 0: rais...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/models/diffusion/classifier.py
extern/ldm_zero123/models/diffusion/classifier.py
import os from copy import deepcopy from glob import glob import pytorch_lightning as pl import torch from einops import rearrange from natsort import natsorted from omegaconf import OmegaConf from torch.nn import functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from extern....
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/models/diffusion/plms.py
extern/ldm_zero123/models/diffusion/plms.py
"""SAMPLING ONLY.""" from functools import partial import numpy as np import torch from tqdm import tqdm from extern.ldm_zero123.models.diffusion.sampling_util import norm_thresholding from extern.ldm_zero123.modules.diffusionmodules.util import ( make_ddim_sampling_parameters, make_ddim_timesteps, noise...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/modules/ema.py
extern/ldm_zero123/modules/ema.py
import torch from torch import nn class LitEma(nn.Module): def __init__(self, model, decay=0.9999, use_num_upates=True): super().__init__() if decay < 0.0 or decay > 1.0: raise ValueError("Decay must be between 0 and 1") self.m_name2s_name = {} self.register_buffer("de...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/modules/attention.py
extern/ldm_zero123/modules/attention.py
import math from inspect import isfunction import torch import torch.nn.functional as F from einops import rearrange, repeat from torch import einsum, nn from extern.ldm_zero123.modules.diffusionmodules.util import checkpoint def exists(val): return val is not None def uniq(arr): return {el: True for el i...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/modules/x_transformer.py
extern/ldm_zero123/modules/x_transformer.py
"""shout-out to https://github.com/lucidrains/x-transformers/tree/main/x_transformers""" from collections import namedtuple from functools import partial from inspect import isfunction import torch import torch.nn.functional as F from einops import rearrange, reduce, repeat from torch import einsum, nn # constants D...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/modules/image_degradation/bsrgan.py
extern/ldm_zero123/modules/image_degradation/bsrgan.py
# -*- coding: utf-8 -*- """ # -------------------------------------------- # Super-Resolution # -------------------------------------------- # # Kai Zhang (cskaizhang@gmail.com) # https://github.com/cszn # From 2019/03--2021/08 # -------------------------------------------- """ import random from functools import part...
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false
liuff19/DreamReward
https://github.com/liuff19/DreamReward/blob/eeb5c648e6c2a25c8f6f8038edfe75d73c811614/extern/ldm_zero123/modules/image_degradation/bsrgan_light.py
extern/ldm_zero123/modules/image_degradation/bsrgan_light.py
# -*- coding: utf-8 -*- import random from functools import partial import albumentations import cv2 import numpy as np import scipy import scipy.stats as ss import torch from scipy import ndimage from scipy.interpolate import interp2d from scipy.linalg import orth import extern.ldm_zero123.modules.image_degradation....
python
MIT
eeb5c648e6c2a25c8f6f8038edfe75d73c811614
2026-01-05T07:14:33.752935Z
false