repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mozman/ezdxf | profiling/triangulation.py | 1 | 1627 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
import time
from archive import tripy
try:
from archive import tricy
except ImportError:
print("module 'tricy' from archive not importable!")
print("build module:\n")
print(" cd archive")
print(" python setup.py build_ext -i")
ex... | mit | 1113e52646359edbe8bef0e7b0ace6ec | 27.051724 | 77 | 0.668101 | 2.702658 | false | false | false | false |
mozman/ezdxf | examples/transform_entities_by_block.py | 1 | 1539 | # Copyright (c) 2019-2022 Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".")
# ------------------------------------------------------------------------------
# This example shows how to transform entit... | mit | 3943a85bc8e24b273f1dcf23d9eda89c | 31.744681 | 81 | 0.576998 | 3.8 | false | false | false | false |
mozman/ezdxf | docs/source/tutorials/src/ocs/text.py | 1 | 1064 | # Copyright (c) 2018-2020 Manfred Moitzi
# License: MIT License
import ezdxf
from ezdxf.math import UCS, Vec3
from pathlib import Path
OUT_DIR = Path('~/Desktop/Outbox').expanduser()
doc = ezdxf.new('R2010')
msp = doc.modelspace()
# Thickness for text works only with shx fonts not with true type fonts
doc.styles.new... | mit | 52a12ba9cf3b126084a51f66d9e0515e | 28.555556 | 71 | 0.665414 | 2.988764 | false | false | false | false |
mozman/ezdxf | src/ezdxf/reorder.py | 1 | 3415 | # Copyright (c) 2020-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import TYPE_CHECKING, Iterable, Union, Mapping, Optional
import heapq
if TYPE_CHECKING:
from ezdxf.entities import DXFGraphic
__all__ = ["ascending", "descending"]
def ascending(
entities: Iterabl... | mit | aa201e3ee37830dbbb43ddb2a7822ccc | 33.15 | 79 | 0.655051 | 3.876277 | false | false | false | false |
mozman/ezdxf | src/ezdxf/addons/browser/loader.py | 1 | 1245 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Union, Iterable, TYPE_CHECKING
from pathlib import Path
from ezdxf.lldxf import loader
from ezdxf.lldxf.types import DXFTag
from ezdxf.lldxf.tagger import ascii_tags_loader, binary_tags_loader
from e... | mit | 89b567b9871dc05b7844a8a831008483 | 33.583333 | 96 | 0.708434 | 3.233766 | false | false | false | false |
mozman/ezdxf | src/ezdxf/sections/objects.py | 1 | 19094 | # Copyright (c) 2011-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import (
Iterable,
Iterator,
Optional,
TYPE_CHECKING,
Union,
cast,
)
import logging
from ezdxf.entities.dictionary import Dictionary
from ezdxf.entities import factory, is_dxf_object
... | mit | d83eefaa5dedbab3980ef42ce0e7e69e | 34.228782 | 119 | 0.571907 | 4.098304 | false | false | false | false |
mozman/ezdxf | src/ezdxf/acis/mesh.py | 1 | 12488 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Iterator, Sequence, Optional, Iterable
from ezdxf.render import MeshVertexMerger, MeshTransformer, MeshBuilder
from ezdxf.math import Matrix44, Vec3, NULLVEC, BoundingBox
from . import entities
from .enti... | mit | 0037aefa428e4a9a72a1650e67ebda27 | 36.277612 | 81 | 0.616512 | 3.867451 | false | false | false | false |
mozman/ezdxf | tests/test_08_addons/test_818_meshex.py | 1 | 8702 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.addons import meshex
from ezdxf.render import MeshBuilder
from ezdxf.render.forms import cube
from ezdxf.version import __version__
class TestStlLoader:
def test_empty_file_returns_empty_mesh(self):
mesh = meshex.stl_l... | mit | 541fd401e9fc824cd2b3fe6073961468 | 27.437908 | 82 | 0.586877 | 2.829919 | false | true | false | false |
mozman/ezdxf | docs/source/tutorials/src/ucs/insert.py | 1 | 2836 | # Copyright (c) 2020 Manfred Moitzi
# License: MIT License
import math, sys
import ezdxf
from pathlib import Path
OUT_DIR = Path('~/Desktop/Outbox').expanduser()
from ezdxf.lldxf.const import MIRROR_X
from ezdxf.math import UCS, Vec3, Matrix44, Y_AXIS, X_AXIS, Z_AXIS
RED = 1
GREEN = 3
BLUE = 5
def setup_csys(blk, ... | mit | 995fe80c65695eb9ec82434941540f99 | 28.852632 | 106 | 0.666432 | 2.810704 | false | false | false | false |
mozman/ezdxf | src/ezdxf/math/linalg.py | 1 | 37569 | # Copyright (c) 2018-2022 Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import (
Iterable,
Tuple,
List,
Sequence,
Union,
Any,
Iterator,
cast,
Optional,
)
from functools import lru_cache
from itertools import repeat
import math
import reprlib
__... | mit | 500c430eb596671286c9c3d3608b9586 | 29.568755 | 92 | 0.529665 | 3.568823 | false | false | false | false |
mozman/ezdxf | examples/render/dimension_arc.py | 1 | 13654 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
from typing import Optional
import pathlib
import math
import ezdxf
from ezdxf.math import Vec3, UCS, ConstructionArc
import logging
# ------------------------------------------------------------------------------
# This example shows how to use arc dime... | mit | bf1724fa1ffd4e606fc50bf84ebc4a72 | 30.901869 | 82 | 0.544309 | 3.431515 | false | false | false | false |
mozman/ezdxf | src/ezdxf/lldxf/const.py | 1 | 15708 | # Copyright (c) 2011-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from dataclasses import dataclass
DXF9 = "AC1004"
DXF10 = "AC1006"
DXF12 = "AC1009"
DXF13 = "AC1012"
DXF14 = "AC1014"
DXF2000 = "AC1015"
DXF2004 = "AC1018"
DXF2007 = "AC1021"
DXF2010 = "AC1024"
DXF2013 = "AC1027"
DXF201... | mit | e773f7d69bdb744e4a4d1b5ee81dd035 | 21.498567 | 94 | 0.672759 | 2.660342 | false | false | false | false |
mozman/ezdxf | src/ezdxf/math/construct3d.py | 1 | 25495 | # Copyright (c) 2020-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Sequence, Iterable, Optional
from enum import IntEnum
import math
from ezdxf.math import (
Vec3,
Vec2,
Matrix44,
X_AXIS,
Y_AXIS,
Z_AXIS,
AnyVec,
UVec,
)
__all__ = [
... | mit | a0d43f8bcdba6990550cc2056a3dc5d2 | 32.11039 | 84 | 0.618121 | 3.588823 | false | false | false | false |
mozman/ezdxf | src/ezdxf/path/commands.py | 1 | 1166 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
import enum
from typing import NamedTuple, Union
from ezdxf.math import Vec3
__all__ = [
"Command",
"AnyCurve",
"PathElement",
"LineTo",
"Curve3To",
"Curve4To",
"MoveTo",
]
@enum.unique
class Command(enum.IntEnum):
LINE... | mit | ddd4901deca725c9c56dd062d2307f87 | 17.507937 | 77 | 0.639794 | 2.982097 | false | false | false | false |
mozman/ezdxf | archive/tripy.py | 1 | 3828 | # Copyright (c) 2017 Sam Bolgert
# License: MIT License
# https://github.com/linuxlewis/tripy
from __future__ import annotations
from typing import Iterable, Iterator, List, Tuple
import sys
import math
from ezdxf.math import Vec2, UVec, has_clockwise_orientation
EPSILON = math.sqrt(sys.float_info.epsilon)
# This mo... | mit | c09da1c08024aa1723647dacc854698a | 30.9 | 85 | 0.587513 | 3.161024 | false | false | false | false |
mozman/ezdxf | examples/acistools/mesh_from_body.py | 1 | 1289 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
import ezdxf
from ezdxf.acis import api as acis
from ezdxf.entities import Body
doc = ezdxf.readfile("3dsolids.dxf")
msp = doc.modelspace()
doc_out = ezdxf.new()
msp_out = doc_out.modelspace()
for e in msp.query("3DSOLID"):
assert isinstance(e, Body)
... | mit | 5e2f22f5d3104190dac7ccbe053dee62 | 30.439024 | 73 | 0.53685 | 3.521858 | false | false | false | false |
mozman/ezdxf | src/ezdxf/entities/point.py | 1 | 5060 | # Copyright (c) 2019-2022 Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import TYPE_CHECKING, Iterator, Optional
from ezdxf.lldxf import validator
from ezdxf.lldxf.attributes import (
DXFAttr,
DXFAttributes,
DefSubclass,
XType,
RETURN_DEFAULT,
group_code_ma... | mit | a08d5280dfb02e267396c407f582282f | 34.138889 | 186 | 0.655534 | 3.331139 | false | false | false | false |
mozman/ezdxf | src/ezdxf/addons/dwg/classes_section.py | 1 | 3030 | # Copyright (c) 2020-2021, Manfred Moitzi
# License: MIT License
from typing import Iterable, Tuple
import struct
from ezdxf.tools.binarydata import BitStream
from ezdxf.entities import DXFClass
from .const import *
from .crc import crc8
from .fileheader import FileHeader
from .header_section import DwgSectionLoader
... | mit | 9b0d0568ff44790c8b6c63228759b650 | 35.95122 | 82 | 0.59835 | 3.466819 | false | false | false | false |
mozman/ezdxf | examples/addons/r12writer.py | 1 | 2370 | # Copyright (c) 2020-2022 Manfred Moitzi
# License: MIT License
import pathlib
from time import perf_counter
import math
from ezdxf.addons import MengerSponge
from ezdxf.addons import r12writer
from ezdxf.render.forms import sphere, circle, translate
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exist... | mit | 1217b658016dac8ea661e3823eee9ef3 | 30.6 | 80 | 0.562025 | 3.058065 | false | false | false | false |
mozman/ezdxf | tests/test_06_math/test_604_linalg.py | 1 | 9299 | # Copyright (c) 2018-2020 Manfred Moitzi
# License: MIT License
from typing import Iterable
import pytest
import math
from ezdxf.math.linalg import (
Matrix,
gauss_vector_solver,
gauss_matrix_solver,
gauss_jordan_solver,
gauss_jordan_inverse,
LUDecomposition,
tridiagonal_vector_solver,
t... | mit | 50e295b4832f96cae9b05c8202374857 | 20.182232 | 68 | 0.514787 | 2.518007 | false | true | false | false |
mozman/ezdxf | examples/render/render_sphere.py | 1 | 1130 | # Copyright (c) 2020-2022, Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
from ezdxf.render.forms import sphere
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".")
# ------------------------------------------------------------------------------
# Thi... | mit | 883c652053456149fbdb3d867446c728 | 29.540541 | 80 | 0.580531 | 3.520249 | false | false | false | false |
mozman/ezdxf | src/ezdxf/lldxf/fileindex.py | 1 | 5205 | # Copyright (c) 2020-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Iterable, NamedTuple, BinaryIO
from .const import DXFStructureError
from ezdxf.tools.codepage import toencoding
class IndexEntry(NamedTuple):
code: int
value: str
location: int
line:... | mit | 9d4b9594f596613e7b58b9d10a60fa55 | 31.943038 | 80 | 0.58828 | 4.079154 | false | false | false | false |
mozman/ezdxf | src/ezdxf/appsettings.py | 1 | 3916 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
# module to set application specific data
from __future__ import annotations
from typing import TYPE_CHECKING
from ezdxf.lldxf import const, validator
from ezdxf.math import BoundingBox
from ezdxf import bbox
if TYPE_CHECKING:
from ezdxf.document impo... | mit | 6d4d8aab45c0f97e2fd6d544b4618c09 | 31.907563 | 82 | 0.688202 | 3.465487 | false | false | false | false |
mozman/ezdxf | src/ezdxf/urecord.py | 1 | 9573 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
"""
UserRecord(): store user data in a XRECORD entity.
The group code 302 is used as a structure tag.
All supported data types have a fixed group code:
- str: 1
- int: 90 - 32-bit values
- float: 40 - doubles
- Vec3, Vec2: 10, 20, 30 -... | mit | 67e4b18487d555b888008a1a3cb7b2e2 | 30.698675 | 87 | 0.580905 | 3.774842 | false | false | false | false |
mozman/ezdxf | src/ezdxf/addons/pycsg.py | 1 | 15434 | # License
# Copyright (c) 2011 Evan Wallace (http://madebyevan.com/), under the MIT license.
# Python port Copyright (c) 2012 Tim Knip (http://www.floorplanner.com), under the MIT license.
# Additions by Alex Pletzer (Pennsylvania State University)
# Integration as ezdxf add-on, Copyright (c) 2020, Manfred Moitzi, MIT ... | mit | a17ef570a6c233b715d57384099fe24c | 33.761261 | 95 | 0.551574 | 3.8585 | false | false | false | false |
mozman/ezdxf | docs/source/tutorials/src/ocs/polyline3d.py | 1 | 1320 | # Copyright (c) 2018-2020 Manfred Moitzi
# License: MIT License
import math
import ezdxf
from ezdxf.math import UCS, Matrix44
from pathlib import Path
OUT_DIR = Path('~/Desktop/Outbox').expanduser()
doc = ezdxf.new('R2010')
msp = doc.modelspace()
# Using an UCS simplifies 3D operations, but UCS definition can happen... | mit | aa076526176a70e9750a23953319bdbe | 29 | 79 | 0.702273 | 2.939866 | false | false | false | false |
mozman/ezdxf | docs/source/tutorials/src/mleader/mtext_content.py | 1 | 6193 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
import pathlib
import colors
import ezdxf
from ezdxf.math import Vec2
from ezdxf.render import mleader
# reserved for further imports, line numbers have to be preserved for
# .. literalinclude::
#
# ========================================
# Setup your pre... | mit | 0f5771f09672c049044b7f268a39df3f | 33.603352 | 94 | 0.664621 | 3.074975 | false | false | false | false |
mozman/ezdxf | src/ezdxf/entities/appdata.py | 1 | 4715 | # Copyright (c) 2019-2022 Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import TYPE_CHECKING, Iterable, Sequence, Optional, Iterator
from collections import OrderedDict
from ezdxf.lldxf.types import dxftag, uniform_appid
from ezdxf.lldxf.tags import Tags
from ezdxf.lldxf.const imp... | mit | 76224d47954a4ff3c101487ce59ae5dd | 31.972028 | 80 | 0.600848 | 3.615798 | false | false | false | false |
mozman/ezdxf | profiling/stress.py | 1 | 3631 | # Copyright (c) 2020-2022, Manfred Moitzi
# License: MIT License
import pytest
import sys
import argparse
import time
import ezdxf
from ezdxf import recover
from itertools import chain
DIRS = [
"AutodeskSamples",
"AutodeskProducts",
"CADKitSamples",
"",
]
files = list(
chain(*[(ezdxf.options.t... | mit | 661637edaab0c5481a9f6b1f58d5b922 | 28.282258 | 79 | 0.540898 | 3.693795 | false | false | false | false |
mozman/ezdxf | profiling/vector.py | 1 | 3075 | # Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import sys
import time
from datetime import datetime
from pathlib import Path
from ezdxf.acc import USE_C_EXT
if USE_C_EXT is False:
print("C-extension disabled or not available.")
sys.exit(1)
from ezdxf.math._vector import Vec3, Vec2 # Python imple... | mit | 5f3ab26f1eeaaa48cd5cef1a79f0c6ca | 24.204918 | 78 | 0.603577 | 2.782805 | false | false | false | false |
mozman/ezdxf | tools/dump_hatch_pattern.py | 1 | 1028 | # Copyright (c) 2011-2020, Manfred Moitzi
# License: MIT License
import sys
from pathlib import Path
import ezdxf
def main(filename):
doc = ezdxf.readfile(filename)
msp = doc.modelspace()
hatches = msp.query("HATCH[solid_fill==0]")
filename.with_suffix(".py")
dump_pattern(filename.with_suffix(".py... | mit | cddbd990e7344ab73cbf9520e4f1cd35 | 23.47619 | 83 | 0.649805 | 3.096386 | false | false | false | false |
mozman/ezdxf | src/ezdxf/tools/text_size.py | 1 | 6718 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Sequence, Optional
from dataclasses import dataclass
import ezdxf
from ezdxf.math import Matrix44, Vec2
from ezdxf.entities import Text, MText, get_font_name
from ezdxf.tools import text_layout as tl,... | mit | bac418103dd17c46db790bb4cf509e1c | 32.929293 | 92 | 0.663144 | 3.723947 | false | false | false | false |
mozman/ezdxf | src/ezdxf/lldxf/loader.py | 1 | 5117 | # Copyright (c) 2018-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
import logging
from typing import Iterable, TYPE_CHECKING, Optional
from collections import OrderedDict
from .const import DXFStructureError
from .tags import group_tags, DXFTag, Tags
from .extendedtags import ExtendedT... | mit | 7dd3077a7d2b82411c118fcc5d1f373c | 32.227273 | 78 | 0.55384 | 4.190827 | false | false | false | false |
mozman/ezdxf | src/ezdxf/math/arc.py | 1 | 18657 | # Copyright (c) 2018-2022 Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import TYPE_CHECKING, Iterable, Sequence, Iterator, Optional
import math
from ezdxf.math import Vec2, UVec
from .bbox import BoundingBox2d
from .construct2d import enclosing_angles, linspace
from .circle impo... | mit | 26240f1c323de5512e6b43d1b613a295 | 33.807836 | 80 | 0.560379 | 4.078924 | false | false | false | false |
mozman/ezdxf | src/ezdxf/math/_matrix44.py | 1 | 24035 | # original code from package: gameobjects
# Home-page: http://code.google.com/p/gameobjects/
# Author: Will McGugan
# Download-URL: http://code.google.com/p/gameobjects/downloads/list
# Copyright (c) 2011-2022 Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Sequence, Iterable... | mit | 517f2a011866f41300d761b475a5c822 | 31.132353 | 91 | 0.466611 | 3.192747 | false | false | false | false |
mozman/ezdxf | src/ezdxf/entities/dimension.py | 1 | 45573 | # Copyright (c) 2019-2022 Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union, Iterable, Iterator
import math
import logging
from ezdxf.audit import AuditError
from ezdxf.lldxf import validator, const
from ezdxf.lldxf.attributes import (
DXFAttr... | mit | 1dbddc906507da0437c35631bcaae775 | 37.064327 | 86 | 0.591445 | 3.849852 | false | false | false | false |
mozman/ezdxf | tests/test_06_math/test_623_rbspline.py | 1 | 11858 | # Copyright (c) 2012-2020 Manfred Moitzi
# License: MIT License
import math
from math import isclose
from ezdxf.math import (
rational_bspline_from_arc,
rational_bspline_from_ellipse,
ConstructionEllipse,
ConstructionArc,
linspace,
BSpline,
open_uniform_bspline,
)
from ezdxf.math.bspline im... | mit | db85bddef95bc3733a468472f18459ea | 33.979351 | 80 | 0.662928 | 2.61247 | false | false | false | false |
mozman/ezdxf | tests/test_01_dxf_entities/test_116_dictionary.py | 1 | 15249 | # Copyright (c) 2011-2022, Manfred Moitzi
# License: MIT License
import pytest
import ezdxf
from ezdxf.entities import (
Dictionary,
DictionaryWithDefault,
DictionaryVar,
DXFEntity,
factory,
DXFGraphic,
XRecord,
)
from ezdxf import DXFKeyError, DXFValueError
from ezdxf.audit import Auditor... | mit | cea90baf1b7a470c792922827d52f0ed | 25.201031 | 80 | 0.641485 | 3.182843 | false | true | false | false |
mozman/ezdxf | src/ezdxf/entities/factory.py | 1 | 4034 | # Copyright (c) 2019-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from ezdxf.document import Drawing
from ezdxf.entities import DXFEntity
from ezdxf.lldxf.extendedtags import ExtendedTags
__all__ = [
"regis... | mit | 0c694e11341fc47dfbab8137bf1ebc9e | 28.661765 | 82 | 0.643778 | 3.673953 | false | false | false | false |
mozman/ezdxf | tests/test_07_render/test_707_trace.py | 1 | 5409 | # Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import pytest
import ezdxf
from ezdxf.render.trace import TraceBuilder, LinearTrace, CurvedTrace
from ezdxf.math import BSpline, Vec2, BoundingBox
def test_trace_builder_init():
t = TraceBuilder()
assert len(t) == 0
def test_add_station_2d():
t... | mit | e04e570de1536fd9abd15c727b72bd14 | 26.881443 | 75 | 0.586615 | 2.693725 | false | true | false | false |
mozman/ezdxf | tests/test_06_math/test_609_point_on_line.py | 1 | 1624 | # Copyright (c) 2020 Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.math import Vec2, distance_point_line_2d, is_point_on_line_2d
def test_distance_point_horiz_line():
start, end = Vec2(0, 0), Vec2(10, 0)
assert distance_point_line_2d(Vec2(5, 2), start, end) == 2
assert distance_point_line... | mit | 04833ad5a1de112b63278cdf17ba3bb2 | 30.230769 | 79 | 0.588054 | 2.468085 | false | true | false | false |
mozman/ezdxf | tests/test_02_dxf_graphics/test_232_acis_2.py | 1 | 6058 | # Copyright (c) 2019 Manfred Moitzi
# License: MIT License
# created 2019-02-15
import pytest
import math
from ezdxf.entities.acis import (
Body,
Solid3d,
Region,
Surface,
ExtrudedSurface,
LoftedSurface,
RevolvedSurface,
SweptSurface,
)
from ezdxf.lldxf.tagwriter import TagCollector, ba... | mit | dff39e87f46953eb76cf91cdb1865185 | 7.175439 | 70 | 0.670023 | 2.137615 | false | false | false | false |
mozman/ezdxf | examples/simple_page_setup.py | 1 | 1508 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
from ezdxf.layouts import Paperspace
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".")
# ------------------------------------------------------------------------------
# This e... | mit | 0293c1f6f8602016e9628ce10d1c6427 | 34.904762 | 83 | 0.624668 | 3.660194 | false | false | false | false |
mozman/ezdxf | examples/addons/drawing/render_to_scale.py | 1 | 3767 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
import pathlib
import matplotlib.pyplot as plt
import ezdxf
from ezdxf.addons.drawing import RenderContext, Frontend
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend
from ezdxf.math import Vec2
from ezdxf.enums ... | mit | 48047b9d0c6e35ceb53ff3aff8569f39 | 30.655462 | 80 | 0.60154 | 3.149666 | false | false | false | false |
mozman/ezdxf | src/ezdxf/entities/objectcollection.py | 1 | 5050 | # Copyright (c) 2018-2022 Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Iterator,
cast,
Optional,
TypeVar,
Generic,
)
from ezdxf.lldxf.const import (
DXFValueError,
DXFKeyError,
INVALID_NAME_CHARACTERS,
)
from ezdxf.lldxf... | mit | 428b974c3f4bae0a84fa18641a632519 | 29.421687 | 89 | 0.586337 | 3.834472 | false | false | false | false |
mozman/ezdxf | src/ezdxf/math/eulerspiral.py | 1 | 4276 | # Copyright (c) 2010-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Dict, Iterable
from ezdxf.math import Vec3
from ezdxf.math.bspline import global_bspline_interpolation, BSpline
__all__ = ["EulerSpiral"]
def powers(base: float, count: int) -> list[float]:
asse... | mit | 379d7eac4852d4fd73c0c205394696ae | 30.441176 | 79 | 0.55145 | 3.65158 | false | false | false | false |
mozman/ezdxf | src/ezdxf/render/hatching.py | 1 | 23592 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import (
Iterator,
Sequence,
TYPE_CHECKING,
Callable,
Any,
Union,
Optional,
Tuple,
)
from collections import defaultdict
import enum
import math
import dataclasses
from ezdxf.math... | mit | f0210e3ce049eab5324b8ad15f698d17 | 34.154993 | 98 | 0.622705 | 3.97255 | false | false | false | false |
mozman/ezdxf | integration_tests/test_all_ellipse_transformations.py | 1 | 3995 | # Copyright (c) 2021, Manfred Moitzi
# License: MIT License
import pytest
from itertools import product
import math
from ezdxf.math import Matrix44, linspace, Vec3
from ezdxf.entities import Ellipse
UNIFORM_SCALING = [
(2, 2, 2),
(-1, 1, 1),
(1, -1, 1),
(1, 1, -1),
(-2, -2, 2),
(2, -2, -2),
... | mit | 5dc5b4149f12c8920dcde7fa02b6ec8c | 27.949275 | 79 | 0.575219 | 3.099302 | false | true | false | false |
mozman/ezdxf | src/ezdxf/tools/_matplotlib_font_support.py | 1 | 4099 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Optional
from pathlib import Path
from functools import lru_cache
from matplotlib.font_manager import FontProperties
from matplotlib.textpath import TextPath
from matplotlib.font_manager import FontMan... | mit | 6d5a63d5dea935042061a489ed415d15 | 29.819549 | 77 | 0.64162 | 3.866981 | false | false | false | false |
mozman/ezdxf | src/ezdxf/math/_construct.py | 1 | 7054 | # Copyright (c) 2011-2022, Manfred Moitzi
# License: MIT License
# These are the pure Python implementations of the Cython accelerated
# construction tools: ezdxf/acc/construct.pyx
from __future__ import annotations
from typing import Iterable, Sequence, Optional, TYPE_CHECKING
import math
# The pure Python implementa... | mit | 3a6827feddb52ee0b6710f1fb9469b5e | 31.183486 | 81 | 0.609749 | 3.170357 | false | false | false | false |
mozman/ezdxf | src/ezdxf/render/trace.py | 1 | 21835 | # Copyright (c) 2020-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Iterable,
Tuple,
Union,
cast,
Sequence,
Optional,
)
from abc import abstractmethod
from collections import namedtuple
import math
from ezdxf.math import (
... | mit | 3075f313078a505ba10f5934b23eace8 | 33.549051 | 92 | 0.554431 | 4.06006 | false | false | false | false |
mozman/ezdxf | src/ezdxf/addons/browser/views.py | 1 | 1341 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from ezdxf.addons.xqt import QTableView, QTreeView, QModelIndex
from ezdxf.lldxf.tags import Tags
class StructureTree(QTreeView):
def set_structure(self, model):
self.setModel(model)
self.expand(mod... | mit | c5e915a7ede6c2b1f4a41638594e6f97 | 31.707317 | 76 | 0.64355 | 3.725 | false | false | false | false |
mozman/ezdxf | examples/render/show_all_arrows.py | 1 | 2161 | # Copyright (c) 2019-2022, Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
from ezdxf import colors
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".")
# ------------------------------------------------------------------------------
# This example sho... | mit | e0c8c5b006f81e7c65cbe8ed2e7be2ef | 29.013889 | 80 | 0.503933 | 3.274242 | false | false | false | false |
mozman/ezdxf | examples/render/hatch_from_entities.py | 1 | 1868 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
from ezdxf.render.forms import box, translate
from ezdxf import disassemble
from ezdxf import path
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".")
# ---------------------... | mit | bd3485d1f93a70ce3efcc293203fb356 | 30.661017 | 80 | 0.618844 | 3.231834 | false | false | false | false |
exhuma/puresnmp | tests/gh-issues/test_54_endofmibview.py | 1 | 1194 | from unittest.mock import patch
import pytest
from x690.types import Integer, ObjectIdentifier, OctetString
from puresnmp.credentials import V2C
from tests import readbytes
OID = ObjectIdentifier
@pytest.mark.asyncio
async def test_54_endofmibview(mocked_raw):
data = readbytes("gh-issues/54-endofmibview.hex")
... | mit | 198707d4612139786606641c70b636e5 | 34.117647 | 79 | 0.619765 | 2.466942 | false | true | false | false |
python-poetry/poetry-core | src/poetry/core/pyproject/tables.py | 1 | 2127 | from __future__ import annotations
from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from poetry.core.packages.dependency import Dependency
# TODO: Convert to dataclass once python 2.7, 3.5 is dropped
class BuildSystem:
def __init__(
self, b... | mit | f482440839e7ded21a2020f611419da1 | 37.672727 | 87 | 0.587682 | 5.076372 | false | false | false | false |
keras-team/keras-contrib | tests/tooling/test_codeowners.py | 2 | 4034 | import os
import pytest
from github import Github
try:
import pathlib
except ImportError:
import pathlib2 as pathlib
path_to_keras_contrib = pathlib.Path(__file__).resolve().parents[2]
path_to_codeowners = path_to_keras_contrib / 'CODEOWNERS'
authenticated = True
try:
github_client = Github(o... | mit | a7005c53d8d5a3ed770a9d391c02aa34 | 31.616667 | 81 | 0.625682 | 3.560459 | false | true | false | false |
keras-team/keras-contrib | tests/keras_contrib/layers/normalization/test_groupnormalization.py | 2 | 8282 | import numpy as np
import pytest
from keras import backend as K
from keras import regularizers
from keras.layers import Input
from keras.models import Sequential, Model
from numpy.testing import assert_allclose
from keras_contrib.layers import GroupNormalization
from keras_contrib.utils.test_utils import laye... | mit | 6490c8db240b2e3d8d4254a53b35fa6a | 31.666667 | 70 | 0.56327 | 3.054961 | false | true | false | false |
keras-team/keras-contrib | keras_contrib/datasets/conll2000.py | 2 | 2375 | from __future__ import print_function
import numpy
from keras.utils.data_utils import get_file
from zipfile import ZipFile
from collections import Counter
from keras.preprocessing.sequence import pad_sequences
def load_data(path='conll2000.zip', min_freq=2):
path = get_file(path,
origin='https... | mit | e13fb08b32a1251fa0156b888c109c0d | 36.698413 | 87 | 0.632 | 3.175134 | false | true | false | false |
keras-team/keras-contrib | keras_contrib/utils/save_load_utils.py | 2 | 4905 | import warnings
import h5py
import keras.backend as K
from keras import optimizers
from keras.engine import saving
def save_all_weights(model, filepath, include_optimizer=True):
"""
Save model weights and optimizer weights but not configuration to a HDF5 file.
Functionally between `save` and `save_weight... | mit | b1da8f93046689cbf0a912ed1f6e4702 | 44.841121 | 87 | 0.545566 | 4.794721 | false | false | false | false |
keras-team/keras-contrib | keras_contrib/losses/crf_losses.py | 2 | 2041 | from keras import backend as K
from keras.losses import categorical_crossentropy
from keras.losses import sparse_categorical_crossentropy
def crf_nll(y_true, y_pred):
"""The negative log-likelihood for linear chain Conditional Random Field (CRF).
This loss function is only used when the `layers.CRF` layer
... | mit | c8fa33481bda14ce43076a2d6b5192a4 | 32.459016 | 83 | 0.657031 | 3.670863 | false | false | false | false |
pytransitions/transitions | transitions/core.py | 1 | 60614 | """
transitions.core
----------------
This module contains the central parts of transitions which are the state machine logic, state
and transition concepts.
"""
try:
from builtins import object
except ImportError:
# python2
pass
try:
# Enums are supported for Python 3.4+ and Python ... | mit | 2b01fcd04cd3cc06956a9c071197f976 | 46.02405 | 120 | 0.60915 | 4.728081 | false | false | false | false |
vitalik/django-ninja | ninja/orm/fields.py | 1 | 4711 | import datetime
from decimal import Decimal
from typing import (
Any,
Callable,
Dict,
Generator,
List,
Tuple,
Type,
TypeVar,
no_type_check,
)
from uuid import UUID
from django.db.models import ManyToManyField
from django.db.models.fields import Field
from pydantic import IPvAnyAddre... | mit | e54c76b699977aed58f21c68bdd53b5a | 25.466292 | 82 | 0.612184 | 3.935673 | false | false | false | false |
marshmallow-code/apispec | src/apispec/ext/marshmallow/common.py | 2 | 5200 | """Utilities to get schema instances/classes"""
from __future__ import annotations
import copy
import warnings
from apispec.core import Components
import marshmallow
MODIFIERS = ["only", "exclude", "load_only", "dump_only", "partial"]
def resolve_schema_instance(
schema: type[marshmallow.Schema] | marshmall... | mit | a4c40ad20ad6e96fa9b21c94f62851bc | 36.681159 | 89 | 0.672885 | 4.113924 | false | false | false | false |
urinieto/msaf | msaf/algorithms/interface.py | 1 | 5024 | """Interface for all the algorithms in MSAF."""
import numpy as np
import msaf.utils as U
class SegmenterInterface:
"""This class is an interface for all the segmenter algorithms included
in MSAF. These segmenters must inherit from it and implement one of the
following methods:
processFlat()
... | mit | d7ba8282fc149c126fcd09a75be59188 | 39.845528 | 79 | 0.588774 | 4.686567 | false | false | false | false |
urinieto/msaf | msaf/pymf/laesa.py | 2 | 2603 | #!/usr/bin/python
#
# Copyright (C) Christian Thurau, 2010.
# Licensed under the GNU General Public License (GPL).
# http://www.gnu.org/licenses/gpl.txt
"""
PyMF LAESA
"""
import scipy.sparse
import numpy as np
from .dist import *
from .sivm import SIVM
__all__ = ["LAESA"]
class LAESA(SIVM):
"""
LAESA(data... | mit | f38a57f42ed2b18b10efcda430422ed2 | 28.91954 | 85 | 0.609681 | 3.237562 | false | false | false | false |
urinieto/msaf | msaf/pymf/greedy.py | 3 | 5697 | #!/usr/bin/python2.6
#
# Copyright (C) Christian Thurau, 2010.
# Licensed under the GNU General Public License (GPL).
# http://www.gnu.org/licenses/gpl.txt
#$Id$
"""
PyMF GREEDY[1]
GREEDY: class for a deterministic SVD based greedy matrix reconstruction [1].
[1] Ali Civril, Malik Magdon-Ismail. Deterministic Spa... | mit | b8d81e372a8b8be0deba997d95d1d1df | 31.741379 | 85 | 0.489731 | 3.51233 | false | false | false | false |
urinieto/msaf | msaf/pymf/cmd.py | 2 | 2509 | #!/usr/bin/python
#
# Copyright (C) Christian Thurau, 2010.
# Licensed under the GNU General Public License (GPL).
# http://www.gnu.org/licenses/gpl.txt
"""
PyMF Compact Matrix Decomposition [1]
CMD(CUR): Class for Compact Matrix Decomposition
[1] Sun, J., Xie, Y., Zhang, H. and Faloutsos, C. (2007), Less is Mor... | mit | c4e16708e2c9b08c3725201055f74d62 | 25.691489 | 110 | 0.577919 | 3.381402 | false | false | false | false |
urinieto/msaf | msaf/pymf/sivm_gsat.py | 2 | 6147 | #!/usr/bin/python2.6
#
# Copyright (C) Christian Thurau, 2010.
# Licensed under the GNU General Public License (GPL).
# http://www.gnu.org/licenses/gpl.txt
"""
PyMF Simplex Volume Maximization [1]
SIVM_GSAT: class for gsat-SiVM
[1] C. Thurau, K. Kersting, and C. Bauckhage. Yes We Can - Simplex Volume
Maximization... | mit | 51ed35161ac4d9f8423fa789c65eaf8e | 32.227027 | 83 | 0.551326 | 3.457255 | false | false | false | false |
watchdogpolska/feder | feder/virus_scan/management/commands/virus_scan.py | 1 | 1665 | from time import sleep
from django.core.management.base import BaseCommand
from feder.virus_scan.models import Request
from feder.virus_scan.engine import get_engine
current_engine = get_engine()
class Command(BaseCommand):
help = "Commands to send request to scan files & receive results"
def add_arguments... | mit | e7e31a6428e9b65916e283a344a1ab55 | 36 | 88 | 0.61982 | 4.204545 | false | false | false | false |
watchdogpolska/feder | feder/letters/factories.py | 1 | 2405 | import random
from email.mime.text import MIMEText
from email.utils import make_msgid, parseaddr
import factory.fuzzy
from factory.django import FileField
from feder.institutions.factories import InstitutionFactory
from feder.records.factories import RecordFactory
from feder.users.factories import UserFactory
from .m... | mit | 599ddb554c607d96e142bd1ac43dbf83 | 26.965116 | 82 | 0.713514 | 3.627451 | false | false | false | false |
watchdogpolska/feder | feder/letters/forms.py | 1 | 5243 | from textwrap import wrap
from atom.ext.crispy_forms.forms import HelperMixin, SingleButtonMixin
from braces.forms import UserKwargModelFormMixin
from crispy_forms.layout import Submit
from dal import autocomplete
from django import forms
from django.utils.translation import gettext_lazy as _
from django.conf import s... | mit | a2c629b220362ab35c2a9b9d9e3b56c2 | 33.715232 | 87 | 0.601679 | 3.891611 | false | false | false | false |
watchdogpolska/feder | feder/institutions/migrations/0008_auto_20161001_2053.py | 1 | 2085 | # Generated by Django 1.10.1 on 2016-10-01 20:53
import django.utils.timezone
import model_utils.fields
from django.db import migrations, models
def forwards_func(apps, schema_editor):
# We get the model from the versioned app registry;
# if we directly import it, it'll be the wrong version
Institution =... | mit | 5ab0b52eebe1724c4c2f75418fe52322 | 34.338983 | 87 | 0.596163 | 4.371069 | false | false | false | false |
watchdogpolska/feder | feder/main/tests.py | 1 | 4821 | from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.urls import reverse
from guardian.shortcuts import assign_perm
from feder.users.factories import UserFactory
import feder
class PermissionStatusMixin:
"""Mixin to verify object permission status codes for differe... | mit | 64832b601f7ea12d1ac7cd8697e869c9 | 32.713287 | 83 | 0.630575 | 4.386715 | false | true | false | false |
watchdogpolska/feder | api_examples/insert_institution_csv.py | 1 | 15804 | #!/bin/python
"""
A tool to insert institutions from CSV files.
Requirements:
- requests
- gusregon
- unicodecsv
- tqdm
Example usage:
To run help text use:
$ python insert_institution_generic.py -h
"""
import argparse
import sys
import requests
import csv
from gusregon import GUS
from utils import environ
fr... | mit | c56fe63c3979a7f76a94bf913ea17dc5 | 32.19958 | 88 | 0.505157 | 4.096164 | false | false | false | false |
watchdogpolska/feder | feder/cases/forms.py | 1 | 1028 | from atom.ext.crispy_forms.forms import SingleButtonMixin
from braces.forms import UserKwargModelFormMixin
from dal import autocomplete
from django import forms
from .models import Case
from feder.cases_tags.models import Tag
class CaseForm(SingleButtonMixin, UserKwargModelFormMixin, forms.ModelForm):
def __init_... | mit | 2d0084d9c3948e33af96db615746b2da | 37.074074 | 87 | 0.675097 | 4.230453 | false | false | false | false |
watchdogpolska/feder | feder/institutions/migrations/0010_auto_20170808_0252.py | 1 | 1126 | # Generated by Django 1.11.2 on 2017-08-08 02:52
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [("institutions", "0009_auto_20170708_2222")]
operations = [
migrations.AddField(
model_name="institution",
... | mit | 17bdf12345466604672a5de5285489bd | 28.631579 | 78 | 0.539964 | 4.652893 | false | false | false | false |
alphagov/notifications-api | app/user/rest.py | 1 | 21994 | import json
import uuid
from datetime import datetime
from urllib.parse import urlencode
from flask import Blueprint, abort, current_app, jsonify, request
from notifications_utils.recipients import (
is_uk_phone_number,
use_numeric_sender,
)
from sqlalchemy.exc import IntegrityError
from app.config import Que... | mit | 7cfd8c89c76d3e6b5a34667623ba6e79 | 35.595674 | 115 | 0.665181 | 3.480063 | false | false | false | false |
denisenkom/pytds | src/pytds/login.py | 2 | 6548 | # vim: set fileencoding=utf8 :
"""
.. module:: login
:platform: Unix, Windows, MacOSX
:synopsis: Login classes
.. moduleauthor:: Mikhail Denisenko <denisenkom@gmail.com>
"""
import socket
import logging
logger = logging.getLogger(__name__)
class SspiAuth(object):
""" SSPI authentication
:platform: Wi... | mit | f7b274f32be76ca3c2c33d549a303ca0 | 34.204301 | 105 | 0.594227 | 3.944578 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0341_new_letter_rates.py | 1 | 1781 | """
Revision ID: 0341_new_letter_rates
Revises: 0340_stub_training_broadcasts
Create Date: 2021-01-27 11:58:21.393227
"""
import itertools
import uuid
from datetime import datetime
from alembic import op
from sqlalchemy.sql import text
from app.models import LetterRate
revision = "0341_new_letter_rates"
down_revis... | mit | ef22bba0926f015b07ffd7e355526032 | 27.269841 | 113 | 0.601909 | 3.485323 | false | false | false | false |
dj-stripe/dj-stripe | tests/test_invoice.py | 1 | 46992 | """
dj-stripe Invoice Model Tests.
"""
from copy import deepcopy
from decimal import Decimal
from unittest.mock import ANY, patch
import pytest
import stripe
from django.contrib.auth import get_user_model
from django.test.testcases import TestCase
from stripe.error import InvalidRequestError
from djstripe.enums impor... | mit | b0f89a94380d21417a27828e3267af35 | 32.046414 | 87 | 0.629724 | 3.876908 | false | false | false | false |
alphagov/notifications-api | app/clients/cbc_proxy.py | 1 | 9090 | import json
import uuid
from abc import ABC, abstractmethod
import boto3
import botocore
from flask import current_app
from notifications_utils.template import non_gsm_characters
from sqlalchemy.schema import Sequence
from app.config import BroadcastProvider
from app.utils import DATETIME_FORMAT, format_sequential_nu... | mit | 4d48864293971bb5ab5fe4df9049b2e8 | 30.023891 | 119 | 0.6044 | 4.111262 | false | false | false | false |
alphagov/notifications-api | app/complaint/complaint_rest.py | 1 | 1498 | from datetime import datetime
from flask import Blueprint, jsonify, request
from app.complaint.complaint_schema import complaint_count_request
from app.dao.complaint_dao import (
fetch_count_of_complaints,
fetch_paginated_complaints,
)
from app.errors import register_errors
from app.schema_validation import v... | mit | 9156591bfa01dbcca3f427da563486d6 | 32.288889 | 96 | 0.699599 | 3.427918 | false | false | false | false |
alphagov/notifications-api | app/service/rest.py | 1 | 45585 | import itertools
from datetime import datetime
from flask import Blueprint, current_app, jsonify, request
from notifications_utils.letter_timings import (
letter_can_be_cancelled,
too_late_to_cancel_letter,
)
from notifications_utils.timezones import convert_utc_to_bst
from sqlalchemy.exc import IntegrityError... | mit | 92c5942dbb203b685d2e17a6eba13955 | 38.668407 | 120 | 0.678909 | 3.585792 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0015_fix_template_data.py | 1 | 1718 | """empty message
Revision ID: 0015_fix_template_data
Revises: 0014_add_template_version
Create Date: 2016-05-16 13:55:27.179748
"""
# revision identifiers, used by Alembic.
revision = "0015_fix_template_data"
down_revision = "0014_add_template_version"
import sqlalchemy as sa
from alembic import op
from sqlalchemy.... | mit | 5ccd23ee2d0d90ab3f276a3d50c4ad65 | 40.902439 | 107 | 0.709546 | 3.601677 | false | false | false | false |
dj-stripe/dj-stripe | djstripe/webhooks.py | 1 | 3045 | """
Utils related to processing or registering for webhooks
A model registers itself here if it wants to be in the list of processing
functions for a particular webhook. Each processor will have the ability
to modify the event object, access event data, and do what it needs to do
registrations are keyed by top-level ... | mit | f0f24a379acafad279a36e9ff72d1c5a | 30.071429 | 87 | 0.711002 | 4.235049 | false | false | false | false |
alphagov/notifications-api | tests/app/service/test_api_key_endpoints.py | 1 | 6400 | import json
from flask import url_for
from app.dao.api_key_dao import expire_api_key
from app.models import KEY_TYPE_NORMAL, ApiKey
from tests import create_admin_authorization_header
from tests.app.db import create_api_key, create_service, create_user
def test_api_key_should_create_new_api_key_for_service(notify_a... | mit | 9021dce8ba89b29cffb0e0f2cfbb380b | 44.714286 | 118 | 0.606875 | 3.762493 | false | true | false | false |
alphagov/notifications-api | app/broadcast_message/rest.py | 1 | 6455 | import iso8601
from flask import Blueprint, jsonify, request
from notifications_utils.template import BroadcastMessageTemplate
from app.broadcast_message import utils as broadcast_utils
from app.broadcast_message.broadcast_message_schema import (
create_broadcast_message_schema,
update_broadcast_message_schema... | mit | 28b823dabf42659f5ab26b14b7481dbb | 41.189542 | 117 | 0.707514 | 3.856033 | false | false | false | false |
alphagov/notifications-api | app/dao/provider_details_dao.py | 1 | 7117 | from datetime import datetime, timedelta
from flask import current_app
from notifications_utils.timezones import convert_utc_to_bst
from sqlalchemy import asc, desc, func
from app import db
from app.dao.dao_utils import autocommit
from app.models import (
SMS_TYPE,
FactBilling,
ProviderDetails,
Provid... | mit | b1e919ebbf1954dbcf526866c7b36783 | 35.497436 | 119 | 0.702684 | 4.064535 | false | false | false | false |
alphagov/notifications-api | tests/app/user/test_rest.py | 1 | 39657 | import uuid
from datetime import datetime
from unittest import mock
import pytest
from flask import current_app
from freezegun import freeze_time
from app.dao.permissions_dao import default_service_permissions
from app.dao.service_user_dao import (
dao_get_service_user,
dao_update_service_user,
)
from app.mod... | mit | bc97700f768f6159427018e795c71cb3 | 33.785088 | 119 | 0.652553 | 3.467559 | false | true | false | false |
alphagov/notifications-api | app/v2/notifications/post_notifications.py | 1 | 18906 | import base64
import functools
import uuid
from datetime import datetime
import botocore
from flask import abort, current_app, jsonify, request
from gds_metrics import Histogram
from notifications_utils.recipients import try_validate_and_format_phone_number
from app import (
api_user,
authenticated_service,
... | mit | 8a0554e50813b36afc2c6ffdebf2d0a5 | 36.289941 | 120 | 0.671744 | 4.018278 | false | false | false | false |
alphagov/notifications-api | app/dao/organisation_dao.py | 1 | 9359 | from flask import current_app
from sqlalchemy import and_
from sqlalchemy.sql.expression import func
from app import db
from app.dao.dao_utils import VersionOptions, autocommit, version_class
from app.dao.email_branding_dao import dao_get_email_branding_by_id
from app.dao.letter_branding_dao import dao_get_letter_bran... | mit | 3b2d894adca7937ec213625e2eee6626 | 33.156934 | 118 | 0.715247 | 3.517099 | false | false | false | false |
alphagov/notifications-api | tests/app/v2/template/test_template_schemas.py | 1 | 4490 | import uuid
import pytest
from flask import json
from jsonschema.exceptions import ValidationError
from app.models import EMAIL_TYPE, SMS_TYPE, TEMPLATE_TYPES
from app.schema_validation import validate
from app.v2.template.template_schemas import (
get_template_by_id_request,
get_template_by_id_response,
... | mit | 0cef0b3f790afaaea8ea05b5a76a9731 | 33.806202 | 114 | 0.667261 | 3.321006 | false | true | false | false |
osm2vectortiles/osm2vectortiles | src/export/export_remote.py | 2 | 8256 | #!/usr/bin/env python
"""Wrapper around tilelive-copy for exporting vector tiles from tm2source.
Usage:
export_remote.py <rabbitmq_url> --tm2source=<tm2source> [--job-queue=<job-queue>] [--bucket=<bucket>] [--render_scheme=<scheme>]
export_remote.py (-h | --help)
export_remote.py --version
Options:
-h --help ... | mit | 82bec0842890b64b9864c64ac2211972 | 28.485714 | 130 | 0.610344 | 3.567848 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0178_add_filename.py | 1 | 1399 | """
Revision ID: 0178_add_filename
Revises: 0177_add_virus_scan_statuses
Create Date: 2018-03-14 16:15:01.886998
"""
import sqlalchemy as sa
from alembic import op
revision = "0178_add_filename"
down_revision = "0177_add_virus_scan_statuses"
def upgrade():
# Deleting the data here is ok because a full migratio... | mit | 6e6c51f3ec6244c027f46561ffa754fb | 45.633333 | 117 | 0.713367 | 3.081498 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0119_add_email_reply_to.py | 1 | 1215 | """
Revision ID: 0119_add_email_reply_to
Revises: 0118_service_sms_senders
Create Date: 2017-09-07 15:29:49.087143
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "0119_add_email_reply_to"
down_revision = "0118_service_sms_senders"
def upgrade():
op.crea... | mit | 22d958833b888994eaf8bde27d1202eb | 30.973684 | 108 | 0.64856 | 3.30163 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0063_templates_process_type.py | 1 | 1822 | """empty message
Revision ID: 0063_templates_process_type
Revises: 0062_provider_details_history
Create Date: 2017-01-10 15:39:30.909308
"""
# revision identifiers, used by Alembic.
revision = "0063_templates_process_type"
down_revision = "0062_provider_details_history"
import sqlalchemy as sa
from alembic import o... | mit | 2dad58c458720d0081d1d31d26bce104 | 41.372093 | 119 | 0.698134 | 3.418386 | false | false | false | false |
alphagov/notifications-api | app/authentication/auth.py | 1 | 6308 | import time
import uuid
from flask import current_app, g, request
from gds_metrics import Histogram
from notifications_python_client.authentication import (
decode_jwt_token,
get_token_issuer,
)
from notifications_python_client.errors import (
TokenAlgorithmError,
TokenDecodeError,
TokenError,
... | mit | f5f6d83399044e7b78ac8898e37b420d | 35.045714 | 179 | 0.665504 | 3.699707 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0300_migrate_org_types.py | 1 | 2070 | import os
"""
Revision ID: 0300_migrate_org_types
Revises: 0299_org_types_table
Create Date: 2019-07-24 16:18:27.467361
"""
import sqlalchemy as sa
from alembic import op
revision = "0300_migrate_org_types"
down_revision = "0299_org_types_table"
environment = os.environ["NOTIFY_ENVIRONMENT"]
def upgrade():
i... | mit | 3eb24666943695d175234591a3437ba6 | 24.243902 | 116 | 0.538647 | 4.181818 | false | false | false | false |
alphagov/notifications-api | app/dao/notifications_dao.py | 1 | 29589 | from datetime import datetime, timedelta
from itertools import groupby
from operator import attrgetter
from botocore.exceptions import ClientError
from flask import current_app
from notifications_utils.international_billing_rates import (
INTERNATIONAL_BILLING_RATES,
)
from notifications_utils.recipients import (
... | mit | de625456c8b934daf458e6a6700d7655 | 36.167085 | 119 | 0.672604 | 4.037254 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.