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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wandb/client | wandb/sdk/launch/runner/kubernetes.py | 1 | 18347 | import base64
import json
import time
from typing import Any, Dict, List, Optional
from kubernetes import client # type: ignore
from kubernetes.client.api.batch_v1_api import BatchV1Api # type: ignore
from kubernetes.client.api.core_v1_api import CoreV1Api # type: ignore
from kubernetes.client.models.v1_job import ... | mit | c0c78750dbf7ada63a54994e9d628d65 | 39.771111 | 171 | 0.583202 | 4.177368 | false | false | false | false |
wandb/client | wandb/sdk/internal/sample.py | 1 | 2444 | """
sample.
"""
import math
class UniformSampleAccumulator:
def __init__(self, min_samples=None):
self._samples = min_samples or 64
# force power of 2 samples
self._samples = 2 ** int(math.ceil(math.log(self._samples, 2)))
# target oversample by factor of 2
self._samples2 ... | mit | 7fd4f004a836f6a0e21321a8f552a0e3 | 32.944444 | 83 | 0.498363 | 3.578331 | false | false | false | false |
gae-init/gae-init-docs | main/config.py | 1 | 6466 | # coding: utf-8
import os
PRODUCTION = os.environ.get('SERVER_SOFTWARE', '').startswith('Google App Eng')
DEBUG = DEVELOPMENT = not PRODUCTION
try:
# This part is surrounded in try/except because the config.py file is
# also used in the run.py script which is used to compile/minify the client
# side files (*.l... | mit | 663be227cab8a5be7212c3587ec3cbec | 31.979592 | 114 | 0.530322 | 3.643743 | false | true | false | false |
datosgobar/pydatajson | pydatajson/ckan_reader.py | 1 | 15331 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Extensión de pydatajson para leer catálogos de metadatos a través de la API
de CKAN v3.
"""
from __future__ import unicode_literals, print_function,\
with_statement, absolute_import
import os.path
import logging
import json
import time
from six.moves.urllib_parse im... | mit | 0958a13db2a2804214a783918a997000 | 35.828916 | 79 | 0.59932 | 3.736006 | false | false | false | false |
datosgobar/pydatajson | pydatajson/validators/url_validator.py | 1 | 1314 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import requests
from requests import RequestException, Timeout
from pydatajson.constants import EXCEPTION_STATUS_CODES, \
INVALID_STATUS_CODES_REGEX
from pydatajson.validators.simple_validator import SimpleValidator
class UrlValidator(SimpleValidator):
... | mit | 2f0bbb0bec0c1bdaadc27fc11aeb39c7 | 33.578947 | 78 | 0.612633 | 4.484642 | false | false | false | false |
mozman/ezdxf | src/ezdxf/entities/spline.py | 1 | 23390 | # Copyright (c) 2019-2022 Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import (
TYPE_CHECKING,
List,
Iterable,
Sequence,
cast,
Iterator,
Optional,
)
import array
import copy
from itertools import chain
from ezdxf.audit import AuditError
from ezdxf.lldx... | mit | 07927fe39cc8ace1766e704c167cd076 | 35.319876 | 163 | 0.595212 | 3.787241 | false | false | false | false |
mozman/ezdxf | docs/source/tutorials/src/ucs/polyline3d.py | 1 | 1287 | # Copyright (c) 2020 Manfred Moitzi
# License: MIT License
from pathlib import Path
OUT_DIR = Path('~/Desktop/Outbox').expanduser()
import math
import ezdxf
from ezdxf.math import UCS
doc = ezdxf.new('R2010')
msp = doc.modelspace()
# using an UCS simplifies 3D operations, but UCS definition can happen later
# calcul... | mit | a580eb5a806b930dc45a840b399fc97f | 31.175 | 88 | 0.709402 | 3.071599 | false | false | false | false |
mozman/ezdxf | examples/addons/table_painter_addon.py | 1 | 7367 | # Copyright (c) 2010-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import TYPE_CHECKING
import pathlib
import ezdxf
from ezdxf.enums import TextEntityAlignment, MTextEntityAlignment
from ezdxf.addons import TablePainter
if TYPE_CHECKING:
from ezdxf.document import Drawi... | mit | d4969d23292a2af2ae034f11caeb2b1d | 29.442149 | 85 | 0.61694 | 3.394931 | false | false | false | false |
mozman/ezdxf | tests/test_00_dxf_low_level_structs/test_053_embedded_object_tags.py | 1 | 2167 | # Copyright (c) 2018-2019 Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.lldxf.extendedtags import ExtendedTags
from ezdxf.lldxf.types import is_embedded_object_marker
from ezdxf.entities.mtext import MText
MTEXT = r"""0
MTEXT
5
278
330
1F
100
AcDbEntity
8
0
100
AcDbMText
10
2762.147
20
2327.073
30
0.... | mit | a47c90eb66354b9e76e89dea1039c2df | 13.071429 | 55 | 0.679742 | 2.601441 | false | true | false | false |
mozman/ezdxf | examples/addons/text_string_to_path.py | 1 | 1337 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
from ezdxf import path, zoom
from ezdxf.tools import fonts
from ezdxf.addons import text2path
from ezdxf.enums import TextEntityAlignment
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathl... | mit | 67d7b1d951d7405a902cf6b166cafe93 | 27.276596 | 80 | 0.58164 | 3.289604 | false | false | false | false |
mozman/ezdxf | src/ezdxf/tools/fonts.py | 1 | 19076 | # Copyright (c) 2021, Manfred Moitzi
# License: MIT License
"""
This module manages a backend agnostic font database.
Weight Values: https://developer.mozilla.org/de/docs/Web/CSS/font-weight
Supported by matplotlib, pyqt, SVG
=========== =====
Thin 100
Hairline 100
ExtraLight 200
UltraLight 200
Light ... | mit | a1f73cc431611b6b4cab6945e410f071 | 30.220949 | 103 | 0.623768 | 3.561613 | false | false | false | false |
mozman/ezdxf | src/ezdxf/render/point.py | 1 | 2876 | # Copyright (c) 2020-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import cast
import math
from ezdxf.entities import factory, Point, DXFGraphic
from ezdxf.math import Vec3, UCS, NULLVEC
def virtual_entities(
point: Point, pdsize: float = 1, pdmode: int = 0
) -> list[D... | mit | c9cb3d820dbe20bcec4cc296019b988f | 31.681818 | 76 | 0.622392 | 3.177901 | false | false | false | false |
mozman/ezdxf | src/ezdxf/sections/headervars.py | 1 | 58323 | # Copyright (c) 2019-2021, Manfred Moitzi
# License: MIT License
from functools import partial
from ezdxf.lldxf.hdrvars import SingleValue, Point2D, Point3D, HeaderVarDef
from ezdxf.lldxf.const import (
DXF12,
DXF2000,
DXF2004,
DXF2007,
DXF2010,
DXF2013,
DXF2018,
)
CONST_GUID = "{00000000-00... | mit | 53d665a3cddcc671aa7b9fef68839285 | 23.57775 | 80 | 0.529379 | 3.295085 | false | false | false | false |
mozman/ezdxf | src/ezdxf/acis/hdr.py | 1 | 3978 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from dataclasses import dataclass, field
from datetime import datetime
import struct
from . import const
# ACIS versions exported by BricsCAD:
# R2000/AC1015: 400, "ACIS 4.00 NT", text length has no prefix "@"
# R2004/AC10... | mit | b405c8b9bff627adb2f7c0c9d21b662f | 35.163636 | 98 | 0.620664 | 3.306733 | false | false | false | false |
mozman/ezdxf | tests/test_05_tools/test_526_explode.py | 1 | 1623 | # Copyright (c) 2021-2022, Manfred Moitzi
# License: MIT License
import pytest
import ezdxf
from ezdxf import explode
from ezdxf.layouts import Modelspace
@pytest.fixture(scope="module")
def msp() -> Modelspace:
doc = ezdxf.new()
block = doc.blocks.new("BLK1")
block.add_line((0, 0), (1, 0))
return ... | mit | 1299288feeea88bf8b6e794215db0171 | 27.473684 | 71 | 0.669131 | 2.8879 | false | true | false | false |
mozman/ezdxf | examples/redraw_order.py | 1 | 3698 | # Copyright (c) 2018-2022 Manfred Moitzi
# License: MIT License
import random
import pathlib
import ezdxf
from ezdxf.math import Vec3
from ezdxf.enums import SortEntities
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".")
# ------------------------------------------... | mit | 2b142b8c8433c0eae6013644e5a754e3 | 30.87931 | 80 | 0.598161 | 3.046129 | false | false | false | false |
mozman/ezdxf | src/ezdxf/tools/__init__.py | 1 | 3431 | # Copyright (c) 2015-2022, Manfred Moitzi
# License: MIT License
from __future__ import annotations
from typing import Any, Iterable
from uuid import uuid4
import functools
import html
from .juliandate import juliandate, calendardate
from .binarydata import hex_strings_to_bytes, bytes_to_hexstr
escape = functools.part... | mit | 7c890055716d2af9962d35b7dbe54f10 | 24.796992 | 113 | 0.585544 | 3.62685 | false | false | false | false |
mozman/ezdxf | tests/test_06_math/conftest.py | 1 | 3865 | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
import pytest
class PolyData:
def __init__(self, name, vertices):
self.name = name
self.vertices = vertices
POLYGON_DATA0 = [
PolyData(
name="Star",
vertices=[
(350, 75),
(379, 161),
... | mit | 91c3bea8be19410f47109dcfefb89a41 | 23.006211 | 52 | 0.371281 | 3.089528 | false | false | false | false |
mozman/ezdxf | examples/render/dimension_radius.py | 1 | 12009 | # Copyright (c) 2019-2022, Manfred Moitzi
# License: MIT License
import pathlib
import math
import ezdxf
from ezdxf.math import Vec3, UCS
import logging
# ------------------------------------------------------------------------------
# This example shows how to use radius dimension.
#
# tutorial: https://ezdxf.mozman.... | mit | cf992c69d924aad3529e873a3a671bdc | 33.508621 | 86 | 0.58656 | 3.192185 | false | false | false | false |
mozman/ezdxf | src/ezdxf/addons/drawing/qt_text_renderer.py | 1 | 4977 | # Copyright (c) 2020-2022, Matthew Broadway
# License: MIT License
from __future__ import annotations
from typing import Optional, Union
from collections import defaultdict
from functools import lru_cache
from .text_renderer import TextRenderer
from ezdxf.addons.xqt import QtCore as qc, QtGui as qg
from ezdxf.math impo... | mit | b42de24b84b9f5da4816d551ce8482ce | 34.049296 | 78 | 0.620454 | 3.420619 | false | false | false | false |
mozman/ezdxf | profiling/read_big_R12_files.py | 1 | 2436 | # Copyright (c) 2019 Manfred Moitzi
# License: MIT License
import time
import ezdxf
CWD = ezdxf.options.test_files_path / "CADKitSamples"
_3D_MODEL = CWD / "fanuc-430-arm.dxf"
_2D_PLAN = CWD / "AEC Plan Elev Sample.dxf"
def load_3D_model():
import ezdxf
ezdxf.readfile(filename=_3D_MODEL)
def iter_3D_model... | mit | 51108cdfedbae7107cece0a0dd82e8ba | 22.423077 | 97 | 0.612069 | 2.862515 | false | false | false | false |
python-poetry/poetry-core | src/poetry/core/packages/project_package.py | 1 | 2595 | from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Any
from poetry.core.constraints.version import parse_constraint
from poetry.core.version.markers import parse_marker
if TYPE_CHECKING:
from poetry.core.packages.dependency import Dependency
from poetry.core.constraints.v... | mit | ae894385ae03184a1f77fdf93a3a8b20 | 27.833333 | 78 | 0.623892 | 3.96789 | false | false | false | false |
python-poetry/poetry-core | src/poetry/core/_vendor/attr/setters.py | 4 | 1400 | # SPDX-License-Identifier: MIT
"""
Commonly used hooks for on_setattr.
"""
from . import _config
from .exceptions import FrozenAttributeError
def pipe(*setters):
"""
Run all *setters* and return the return value of the last one.
.. versionadded:: 20.1.0
"""
def wrapped_pipe(instance, attrib, ... | mit | d01ea889c9856ba1410a8d861621342b | 18.178082 | 79 | 0.618571 | 3.743316 | false | false | false | false |
python-poetry/poetry-core | src/poetry/core/_vendor/attr/converters.py | 2 | 3610 | # SPDX-License-Identifier: MIT
"""
Commonly useful converters.
"""
import typing
from ._compat import _AnnotationExtractor
from ._make import NOTHING, Factory, pipe
__all__ = [
"default_if_none",
"optional",
"pipe",
"to_bool",
]
def optional(converter):
"""
A converter that allows an att... | mit | 9bd576df0006ceae0f919c1a284a96cd | 24.069444 | 79 | 0.581163 | 3.733195 | false | false | false | false |
python-poetry/poetry-core | src/poetry/core/_vendor/lark/tree_matcher.py | 2 | 6004 | """Tree matcher based on Lark grammar"""
import re
from collections import defaultdict
from . import Tree, Token
from .common import ParserConf
from .parsers import earley
from .grammar import Rule, Terminal, NonTerminal
def is_discarded_terminal(t):
return t.is_term and t.filter_out
class _MakeTreeMatch:
... | mit | 02f943d1234a6092dc12971735a546dd | 31.27957 | 115 | 0.598101 | 3.886084 | false | false | false | false |
python-poetry/poetry-core | tests/spdx/test_helpers.py | 1 | 1413 | from __future__ import annotations
import pytest
from poetry.core.spdx.helpers import license_by_id
def test_license_by_id() -> None:
license = license_by_id("MIT")
assert license.id == "MIT"
assert license.name == "MIT License"
assert license.is_osi_approved
assert not license.is_deprecated
... | mit | 1c23937360afdca64a162f2265ac646f | 25.166667 | 78 | 0.677282 | 3.372315 | false | true | false | false |
python-poetry/poetry-core | tests/masonry/builders/test_complete.py | 1 | 19528 | from __future__ import annotations
import ast
import os
import platform
import re
import shutil
import sys
import tarfile
import tempfile
import zipfile
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterator
import pytest
from poetry.core import __version__
from... | mit | ac38be9be58a3a1148b9b121421351da | 30.042925 | 145 | 0.616921 | 3.233317 | false | false | false | false |
python-poetry/poetry-core | src/poetry/core/_vendor/jsonschema/cli.py | 3 | 8518 | """
The ``jsonschema`` command line.
"""
from json import JSONDecodeError
from textwrap import dedent
import argparse
import json
import sys
import traceback
import warnings
try:
from importlib import metadata
except ImportError:
import importlib_metadata as metadata # type: ignore
try:
from pkgutil imp... | mit | 4e2b89156151927eff8f236a7d2dc832 | 27.488294 | 79 | 0.609885 | 4.151072 | false | false | false | false |
python-poetry/poetry-core | src/poetry/core/_vendor/pyrsistent/_pdeque.py | 3 | 12203 | from collections.abc import Sequence, Hashable
from itertools import islice, chain
from numbers import Integral
from pyrsistent._plist import plist
class PDeque(object):
"""
Persistent double ended queue (deque). Allows quick appends and pops in both ends. Implemented
using two persistent lists.
A ma... | mit | 5651dff4cf3082ea4db9576fa8847876 | 31.454787 | 115 | 0.574695 | 3.841045 | false | false | false | false |
python-poetry/poetry-core | tests/integration/test_pep517_backend.py | 1 | 1499 | from __future__ import annotations
import shutil
from pathlib import Path
import pytest
from tests.testutils import subprocess_run
pytestmark = pytest.mark.integration
BUILD_SYSTEM_TEMPLATE = """
[build-system]
requires = ["poetry-core @ file://{project_path}"]
build-backend = "poetry.core.masonry.api"
"""
de... | mit | 066f8a212643cdb68bf614b3d8331ec1 | 26.759259 | 104 | 0.657105 | 3.569048 | false | true | false | false |
python-poetry/poetry-core | src/poetry/core/_vendor/pyparsing/util.py | 17 | 6805 | # util.py
import warnings
import types
import collections
import itertools
from functools import lru_cache
from typing import List, Union, Iterable
_bslash = chr(92)
class __config_flags:
"""Internal class for defining compatibility and debugging flags"""
_all_names: List[str] = []
_fixed_names: List[st... | mit | 1e247836b6d756c099c0a4447a4c80e7 | 27.957447 | 98 | 0.568259 | 3.816601 | false | false | false | false |
python-poetry/poetry-core | src/poetry/core/masonry/utils/module.py | 1 | 3697 | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
if TYPE_CHECKING:
from poetry.core.masonry.utils.include import Include
class ModuleOrPackageNotFound(ValueError):
pass
class Module:
def __init__(
self,
name: str,
... | mit | 0792441303f03efad6e16bfba0fe2186 | 31.147826 | 79 | 0.492291 | 4.339202 | false | false | false | false |
lk-geimfari/mimesis | mimesis/providers/base.py | 2 | 6580 | """Base data provider."""
import contextlib
import json
import operator
import typing as t
from functools import reduce
from pathlib import Path
from mimesis.exceptions import NonEnumerableError
from mimesis.locales import Locale, validate_locale
from mimesis.random import Random, get_random_item
from mimesis.types i... | mit | b3c7c77f9a8c85ceb4184e92abc83d39 | 30.932039 | 85 | 0.591821 | 4.333333 | false | false | false | false |
bachya/regenmaschine | regenmaschine/client.py | 1 | 8931 | """Define a client to interact with a RainMachine unit."""
from __future__ import annotations
import asyncio
import json
import ssl
from datetime import datetime
from typing import Any, cast
import async_timeout
from aiohttp import ClientSession, ClientTimeout
from aiohttp.client_exceptions import ClientOSError, Serv... | mit | 4d429fdca15686b6e70f7b8aeecbd3ef | 36.058091 | 87 | 0.595006 | 4.503782 | false | false | false | false |
lk-geimfari/mimesis | mimesis/providers/cryptographic.py | 2 | 3325 | """Cryptographic data provider."""
import hashlib
import secrets
import typing as t
from uuid import UUID, uuid4
from mimesis.data.int.cryptographic import WORDLIST
from mimesis.enums import Algorithm
from mimesis.providers.base import BaseProvider
__all__ = ["Cryptographic"]
class Cryptographic(BaseProvider):
... | mit | 942623a945e4483d6c26bbfd771b3eb5 | 29.504587 | 81 | 0.622256 | 4.306995 | false | false | false | false |
lk-geimfari/mimesis | tests/test_providers/test_path.py | 3 | 2145 | import re
import pytest
from mimesis import Path
from mimesis.data import FOLDERS, PROGRAMMING_LANGS, PROJECT_NAMES
class TestPath:
def test_root(self, path):
result = path.root()
assert result == "C:\\" or result == "/"
def test_home(self, path):
result = path.home()
assert ... | mit | 324d176d9d390e10e4b3409c34167138 | 26.857143 | 88 | 0.586014 | 3.362069 | false | true | false | false |
bachya/regenmaschine | regenmaschine/controller.py | 1 | 4684 | """Define a RainMachine controller class."""
from __future__ import annotations
from collections.abc import Awaitable, Callable
from datetime import datetime, timedelta
from typing import Any
from regenmaschine.endpoints.api import API
from regenmaschine.endpoints.diagnostics import Diagnostics
from regenmaschine.end... | mit | aa449aafff3c5df1951bdd5e4343480c | 32.942029 | 88 | 0.615073 | 4.08726 | false | false | false | false |
tankywoo/simiki | simiki/log.py | 1 | 2428 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from logging import getLogger, Formatter, StreamHandler
from simiki import utils
from simiki.compat import is_linux, is_osx
class ANSIFormatter(Formatter):
"""Use ANSI escape sequences to colore... | mit | 3d0a4ac7b87bfbcadf190c46690b928a | 26.280899 | 76 | 0.581549 | 3.903537 | false | false | false | false |
alphagov/notifications-python-client | notifications_python_client/base.py | 1 | 4017 | import json
import logging
import time
import urllib.parse
import requests
from notifications_python_client import __version__
from notifications_python_client.authentication import create_jwt_token
from notifications_python_client.errors import HTTPError, InvalidResponse
logger = logging.getLogger(__name__)
class... | mit | c6e8717a41cccadb168d0d614e154ba4 | 29.431818 | 97 | 0.5646 | 4.310086 | false | false | false | false |
facebook/prophet | python/prophet/make_holidays.py | 1 | 2146 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function
import warnings
import numpy as np
import pandas as ... | mit | 13ea2291f772d9590547aac8aa2a4138 | 30.558824 | 113 | 0.666822 | 3.887681 | false | false | false | false |
facebook/prophet | python/prophet/serialize.py | 1 | 6858 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
from copy import ... | mit | ecd7584146c964e5ee1967555c79d1d5 | 32.291262 | 113 | 0.638233 | 3.887755 | false | false | false | false |
vim-awesome/vim-awesome | db/migrations/dedupe_plugin_repo_owner.py | 2 | 2415 | """Remove case-sensitive duplicates in the plugins table"""
import rethinkdb as r
import db.plugins
import db.util
r_conn = db.util.r_conn
LOG_FILE = 'deleted_slugs.log'
def dupe_log_line(canonical, dupes):
return '%s: %s\n' % (canonical, ', '.join(dupes))
def merge_plugins(plugins):
def reducer(new, ol... | mit | 099677508b2f78d342e5ad7d9fcfff37 | 27.411765 | 81 | 0.592547 | 3.631579 | false | false | false | false |
vim-awesome/vim-awesome | tools/scrape/github.py | 2 | 27751 | import base64
import collections
import datetime
import logging
import re
import sys
import time
from urllib import urlencode
import urlparse
import configparser
import dateutil.parser
import requests
import rethinkdb as r
from termcolor import colored
from db.github_repos import PluginGithubRepos, DotfilesGithubRepo... | mit | 52068f0faa5afad9bb1a93288e68d27a | 36.40027 | 93 | 0.606681 | 3.860203 | false | false | false | false |
kytos/kytos | kytos/core/buffers.py | 2 | 5301 | """Kytos Buffer Classes, based on Python Queue."""
import logging
# from queue import Queue
from janus import Queue
from kytos.core.events import KytosEvent
__all__ = ('KytosBuffers', )
LOG = logging.getLogger(__name__)
class KytosEventBuffer:
"""KytosEventBuffer represents a queue to store a set of KytosEven... | mit | a885fb2b4ff61c673671694b0e398613 | 31.521472 | 78 | 0.597434 | 3.696653 | false | false | false | false |
kinverarity1/lasio | lasio/las_items.py | 1 | 17824 | import json
import logging
# The standard library OrderedDict was introduced in Python 2.7 so
# we have a third-party option to support Python 2.6
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
import numpy as np
logger = logging.getLogger(__name__)
class ... | mit | f4b5d60aefb2b54146f072a377e5f747 | 31.466302 | 82 | 0.537421 | 4.34308 | false | false | false | false |
kinverarity1/lasio | tests/test_read_header_line.py | 3 | 3499 | # coding=utf-8
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from pprint import pprint
from lasio.reader import read_header_line
def test_time_str_and_colon_in_desc():
line = "TIML.hh:mm 23:15 23-JAN-2001: Time Logger: At Bottom"
result = read_header_line(line, section_na... | mit | 5ca72a8b93a73502e7104580208496fd | 30.718182 | 80 | 0.584122 | 3.106857 | false | true | false | false |
kytos/kytos | kytos/core/napps/napp_dir_listener.py | 2 | 2648 | """Module to monitor installed napps."""
import logging
import re
from pathlib import Path
from watchdog.events import RegexMatchingEventHandler
from watchdog.observers import Observer
LOG = logging.getLogger(__name__)
class NAppDirListener(RegexMatchingEventHandler):
"""Class to handle directory changes."""
... | mit | 5f1e71bb46968dfaf294e41ae4af3d0a | 32.1 | 78 | 0.617447 | 3.877013 | false | false | false | false |
kytos/kytos | docs/blueprints/make_blueprints_table.py | 2 | 2703 | """Generate Blueprints table."""
import glob
import re
def create_table(directory):
"""Create the table header and cells."""
t_header = ''
t_cell = ''
bps_rst = []
bps_titles = []
bps_status = []
max_len_title = -1
max_len_status = -1
max_len_bps = -1
for fp_file in sorted(g... | mit | e4b1c748a55f76898e456fabc7a7302a | 32.7875 | 75 | 0.501665 | 3.089143 | false | false | false | false |
vitalik/django-ninja | tests/test_docs/test_auth.py | 1 | 3738 | from unittest.mock import Mock, patch
import pytest
from ninja import NinjaAPI
from ninja.testing import TestClient
def test_intro():
from docs.src.tutorial.authentication.code001 import api
client = TestClient(api)
assert client.get("/pets").status_code == 401
user = Mock()
user.is_authentica... | mit | d0be4b7eb957b236e2755453305b3073 | 32.981818 | 86 | 0.613965 | 4.107692 | false | true | false | false |
vitalik/django-ninja | tests/test_openapi_params.py | 1 | 1954 | from ninja import NinjaAPI
api = NinjaAPI()
@api.get("/operation1", operation_id="my_id")
def operation_1(request):
"""
This will be in description
"""
return {"docstrings": True}
@api.get("/operation2", description="description from argument", deprecated=True)
def operation2(request):
return {... | mit | a4f3d1d39ab0ded174c3cfce04f542be | 26.521127 | 87 | 0.646878 | 3.578755 | false | true | false | false |
pytransitions/transitions | transitions/extensions/states.py | 1 | 9846 | """
transitions.extensions.states
-----------------------------
This module contains mix ins which can be used to extend state functionality.
"""
from collections import Counter
from threading import Timer
import logging
import inspect
from ..core import MachineError, listify, State
_LOGGER = logging.ge... | mit | d27f8e585e8fc0a7f1dbeba7567e4b94 | 39.854772 | 120 | 0.610908 | 4.305203 | false | false | false | false |
heynemann/pyvows | pyvows/runner/abc.py | 1 | 2790 | # -*- coding: utf-8 -*-
'''Abstract base class for all PyVows Runner implementations.'''
# pyvows testing engine
# https://github.com/heynemann/pyvows
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Bernardo Heynemann heynemann@gmail.com
import sys
import time... | mit | 3ca05ef734ca19de33edab17c8d4f3de | 29.326087 | 114 | 0.554839 | 3.695364 | false | true | false | false |
heynemann/pyvows | tests/captured_output_vows.py | 2 | 4129 | from __future__ import print_function
import sys
from pyvows import Vows, expect
from pyvows.runner.gevent import VowsParallelRunner
from pyvows.runner.executionplan import ExecutionPlanner
from pyvows.runner import VowsRunner
@Vows.batch
class CapturedOutputVows(Vows.Context):
class ResultsFromContextThatExpli... | mit | 34f9a757ab0c67dcfb7172953a00692b | 34.594828 | 111 | 0.633567 | 3.851679 | false | false | false | false |
urinieto/msaf | setup.py | 1 | 2059 | from setuptools import setup, find_packages
import glob
import imp
import numpy.distutils.misc_util
version = imp.load_source('msaf.version', 'msaf/version.py')
# MSAF configuration
setup(
name='msaf',
version=version.version,
description='Python module to discover the structure of music files',
autho... | mit | b70315505eacaba6d77dcad18c7c9ed3 | 32.754098 | 78 | 0.588635 | 3.730072 | false | false | false | false |
urinieto/msaf | msaf/pymf/bnmf.py | 2 | 4326 | #!/usr/bin/python
#
# Copyright (C) Christian Thurau, 2010.
# Licensed under the GNU General Public License (GPL).
# http://www.gnu.org/licenses/gpl.txt
"""
PyMF Binary Matrix Factorization [1]
BNMF(NMF) : Class for binary matrix factorization
[1]Z. Zhang, T. Li, C. H. Q. Ding, X. Zhang: Binary Matrix Factorizati... | mit | dd073ea577e9e7e512b4d60b6354e851 | 33.062992 | 116 | 0.58368 | 3.255079 | false | false | false | false |
urinieto/msaf | examples/compute_features.py | 1 | 3574 | #!/usr/bin/env python
"""
This script computes the features for a single or multiple audio files.
It uses the default parameters. These parameters can be changed the
`.msafrc` config file.
Examples:
Single file mode:
>> ./compute_features.py path_to_audio.mp3 -o my_features.json
Collection mode:
... | mit | d7b1df74881008dd5ad0dd66f5326b23 | 34.386139 | 95 | 0.570229 | 4.249703 | false | false | false | false |
fonttools/fonttools | Tests/voltLib/parser_test.py | 3 | 47859 | from fontTools.voltLib import ast
from fontTools.voltLib.error import VoltLibError
from fontTools.voltLib.parser import Parser
from io import StringIO
import unittest
class ParserTest(unittest.TestCase):
def __init__(self, methodName):
unittest.TestCase.__init__(self, methodName)
# Python 3 rename... | mit | 21cee13f47d76e90aad8a9d92e6f86d9 | 37.752227 | 82 | 0.504022 | 3.472573 | false | true | false | false |
fonttools/fonttools | Lib/fontTools/voltLib/lexer.py | 3 | 3417 | from fontTools.voltLib.error import VoltLibError
class Lexer(object):
NUMBER = "NUMBER"
STRING = "STRING"
NAME = "NAME"
NEWLINE = "NEWLINE"
CHAR_WHITESPACE_ = " \t"
CHAR_NEWLINE_ = "\r\n"
CHAR_DIGIT_ = "0123456789"
CHAR_UC_LETTER_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
CHAR_LC_LETTER_ = "a... | mit | 74957969af72fd2220164c5d601108a2 | 33.515152 | 78 | 0.522973 | 3.654545 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/svgLib/path/shapes.py | 3 | 5331 | import re
def _prefer_non_zero(*args):
for arg in args:
if arg != 0:
return arg
return 0.
def _ntos(n):
# %f likes to add unnecessary 0's, %g isn't consistent about # decimals
return ('%.3f' % n).rstrip('0').rstrip('.')
def _strip_xml_ns(tag):
# ElementTree API doesn't prov... | mit | b8790f423299552750da8af1380d6777 | 28.453039 | 79 | 0.513975 | 3.015271 | false | false | false | false |
fonttools/fonttools | Tests/colorLib/unbuilder_test.py | 3 | 9001 | from fontTools.ttLib.tables import otTables as ot
from fontTools.colorLib.builder import buildColrV1
from fontTools.colorLib.unbuilder import unbuildColrV1
import pytest
TEST_COLOR_GLYPHS = {
"glyph00010": {
"Format": int(ot.PaintFormat.PaintColrLayers),
"Layers": [
{
"... | mit | 92606569015b6bb94ac05ad3b11ed79a | 34.160156 | 78 | 0.313965 | 4.899837 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/merge/tables.py | 3 | 8568 | # Copyright 2013 Google, Inc. All Rights Reserved.
#
# Google Author(s): Behdad Esfahbod, Roozbeh Pournader
from fontTools import ttLib, cffLib
from fontTools.ttLib.tables.DefaultTable import DefaultTable
from fontTools.merge.base import add_method, mergeObjects
from fontTools.merge.cmap import computeMegaCmap
from fo... | mit | 659929c5d52e7ca28ab7213b56e47440 | 26.549839 | 99 | 0.709267 | 2.804583 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ttLib/tables/sbixStrike.py | 3 | 5381 | from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval
from .sbixGlyph import Glyph
import struct
sbixStrikeHeaderFormat = """
>
ppem: H # The PPEM for which this strike was designed (e.g., 9,
# 12, 24)
resolution: H # The screen resolution (in dpi) for which this strike
... | mit | 08305a2973000e500976a1b4de470acf | 35.358108 | 109 | 0.727746 | 3.235719 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ufoLib/validators.py | 3 | 26095 | """Various low level data validators."""
import calendar
from io import open
import fs.base
import fs.osfs
from collections.abc import Mapping
from fontTools.ufoLib.utils import numberTypes
# -------
# Generic
# -------
def isDictEnough(value):
"""
Some objects will likely come in that aren't
dicts but... | mit | 872d7696a770c1e013b4e1ec0bf62038 | 23.617925 | 133 | 0.682353 | 3.190488 | false | false | false | false |
fonttools/fonttools | Snippets/layout-features.py | 3 | 1696 | #! /usr/bin/env python3
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables import otTables
import sys
if len(sys.argv) != 2:
print("usage: layout-features.py fontfile.ttf")
sys.exit(1)
fontfile = sys.argv[1]
if fontfile.rsplit(".", 1)[-1] == "ttx":
font = TTFont()
font.importXML(fontfile)
else:
font ... | mit | ebe355a297a273ee6b7a8ad0f67213ee | 33.612245 | 79 | 0.723467 | 3.249042 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ufoLib/plistlib.py | 3 | 1498 | """DEPRECATED - This module is kept here only as a backward compatibility shim
for the old ufoLib.plistlib module, which was moved to fontTools.misc.plistlib.
Please use the latter instead.
"""
from fontTools.misc.plistlib import dump, dumps, load, loads
from fontTools.misc.textTools import tobytes
# The following fun... | mit | 5ceebcaafcbb9bc826836a964a883b72 | 31.565217 | 79 | 0.699599 | 3.404545 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ttLib/tables/F__e_a_t.py | 3 | 4996 | from fontTools.misc import sstruct
from fontTools.misc.fixedTools import floatToFixedToStr
from fontTools.misc.textTools import safeEval
from . import DefaultTable
from . import grUtils
import struct
Feat_hdr_format='''
>
version: 16.16F
'''
class table_F__e_a_t(DefaultTable.DefaultTable):
"""The ``Fea... | mit | 22e4d2f4e922d8130ddcd5d25dcfdf5a | 40.983193 | 104 | 0.527222 | 3.796353 | false | false | false | false |
fonttools/fonttools | Tests/ttLib/removeOverlaps_test.py | 3 | 1714 | import logging
import pytest
pathops = pytest.importorskip("pathops")
from fontTools.ttLib.removeOverlaps import _simplify, _round_path
def test_pathops_simplify_bug_workaround(caplog):
# Paths extracted from Noto Sans Ethiopic instance that fails skia-pathops
# https://github.com/google/fonts/issues/3365
... | mit | 55ddc12d8b68867ffb113bce9f2a0d33 | 32.607843 | 86 | 0.683781 | 2.875839 | false | true | false | false |
fonttools/fonttools | Lib/fontTools/ttLib/tables/_h_e_a_d.py | 3 | 3965 | from fontTools.misc import sstruct
from fontTools.misc.fixedTools import floatToFixedToStr, strToFixedToFloat
from fontTools.misc.textTools import safeEval, num2binary, binary2num
from fontTools.misc.timeTools import timestampFromString, timestampToString, timestampNow
from fontTools.misc.timeTools import epoch_diff as... | mit | 3623da5904a786216bd52ec04edd0c57 | 32.888889 | 89 | 0.67541 | 3.136867 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/merge/layout.py | 3 | 13314 | # Copyright 2013 Google, Inc. All Rights Reserved.
#
# Google Author(s): Behdad Esfahbod, Roozbeh Pournader
from fontTools import ttLib
from fontTools.ttLib.tables.DefaultTable import DefaultTable
from fontTools.ttLib.tables import otTables
from fontTools.merge.base import add_method, mergeObjects
from fontTools.merge... | mit | 6253b945582bab9d531bb768b9f1147a | 27.570815 | 141 | 0.726754 | 2.975861 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ttLib/tables/_c_v_a_r.py | 3 | 3299 | from . import DefaultTable
from fontTools.misc import sstruct
from fontTools.misc.textTools import bytesjoin
from fontTools.ttLib.tables.TupleVariation import \
compileTupleVariationStore, decompileTupleVariationStore, TupleVariation
# https://www.microsoft.com/typography/otspec/cvar.htm
# https://www.microsoft.c... | mit | d76de193ddd5412d952c2c27e87689ec | 39.231707 | 81 | 0.633222 | 3.840512 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/designspaceLib/__init__.py | 1 | 120195 | from __future__ import annotations
import collections
import copy
import itertools
import math
import os
import posixpath
from io import BytesIO, StringIO
from textwrap import indent
from typing import Any, Dict, List, MutableMapping, Optional, Tuple, Union, cast
from fontTools.misc import etree as ET
from fontTools.... | mit | 5fb8e241dc83fabd2930b100c39e08b7 | 39.459259 | 147 | 0.609517 | 4.506432 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/varLib/cff.py | 1 | 21557 | from collections import namedtuple
from fontTools.cffLib import (
maxStackLimit,
TopDictIndex,
buildOrder,
topDictOperators,
topDictOperators2,
privateDictOperators,
privateDictOperators2,
FDArrayIndex,
FontDict,
VarStoreData
)
from io import BytesIO
from fontTools.cffLib.specializer import (
specializeComma... | mit | 9a2a62e7bdc13a6fa798ed3e5dc81235 | 31.563444 | 95 | 0.706638 | 2.98078 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/feaLib/ast.py | 3 | 73554 | from fontTools.feaLib.error import FeatureLibError
from fontTools.feaLib.location import FeatureLibLocation
from fontTools.misc.encodingTools import getEncoding
from fontTools.misc.textTools import byteord, tobytes
from collections import OrderedDict
import itertools
SHIFT = " " * 4
__all__ = [
"Element",
"Fe... | mit | 63eaacb363aa396cd9c094c6387663f8 | 33.56485 | 138 | 0.578323 | 3.908704 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ttLib/tables/S_I_N_G_.py | 3 | 2661 | from fontTools.misc import sstruct
from fontTools.misc.textTools import bytechr, byteord, tobytes, tostr, safeEval
from . import DefaultTable
SINGFormat = """
> # big endian
tableVersionMajor: H
tableVersionMinor: H
glyphletVersion: H
permissions: h
mainGID: H
unitsPerEm: H
vertAdvance: h
vert... | mit | 136976fcdda8fca51167b4284261137f | 27.612903 | 83 | 0.680947 | 2.849036 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/misc/sstruct.py | 3 | 6054 | """sstruct.py -- SuperStruct
Higher level layer on top of the struct module, enabling to
bind names to struct elements. The interface is similar to
struct, except the objects passed and returned are not tuples
(or argument lists), but dictionaries or instances.
Just like struct, we use fmt strings to describe a data
... | mit | 8ec7752f6cc9d6a0a62d8f9e7bc22f69 | 27.027778 | 82 | 0.672118 | 3.007452 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/misc/py23.py | 3 | 2238 | """Python 2/3 compat layer leftovers."""
import decimal as _decimal
import math as _math
import warnings
from contextlib import redirect_stderr, redirect_stdout
from io import BytesIO
from io import StringIO as UnicodeIO
from types import SimpleNamespace
from .textTools import Tag, bytechr, byteord, bytesjoin, strjoi... | mit | e12d0c3df3a655320f3054fc44724ec4 | 22.3125 | 83 | 0.655496 | 3.858621 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ttLib/tables/_c_v_t.py | 3 | 1145 | from fontTools.misc.textTools import safeEval
from . import DefaultTable
import sys
import array
class table__c_v_t(DefaultTable.DefaultTable):
def decompile(self, data, ttFont):
values = array.array("h")
values.frombytes(data)
if sys.byteorder != "big": values.byteswap()
self.values = values
def compile(s... | mit | 447a018556846687b2fcb4de9f51c295 | 24.444444 | 49 | 0.675983 | 3.029101 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ttLib/ttFont.py | 1 | 33479 | from fontTools.config import Config
from fontTools.misc import xmlWriter
from fontTools.misc.configTools import AbstractConfig
from fontTools.misc.textTools import Tag, byteord, tostr
from fontTools.misc.loggingTools import deprecateArgument
from fontTools.ttLib import TTLibError
from fontTools.ttLib.ttGlyphSet import ... | mit | bc42d5fd27dc442fda704eca22688cfd | 30.854424 | 106 | 0.697004 | 3.240321 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/ttLib/scaleUpem.py | 1 | 10099 | """Change the units-per-EM of a font.
AAT and Graphite tables are not supported. CFF/CFF2 fonts
are de-subroutinized."""
from fontTools.ttLib.ttVisitor import TTVisitor
import fontTools.ttLib as ttLib
import fontTools.ttLib.tables.otBase as otBase
import fontTools.ttLib.tables.otTables as otTables
from fontTools.cff... | mit | cd56618551fa117aad0f14652b4fcde2 | 28.615836 | 86 | 0.572037 | 3.800903 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/feaLib/lexer.py | 1 | 11300 | from fontTools.feaLib.error import FeatureLibError, IncludedFeaNotFound
from fontTools.feaLib.location import FeatureLibLocation
import re
import os
try:
import cython
except ImportError:
# if cython not installed, use mock module with no-op decorators and types
from fontTools.misc import cython
class Le... | mit | 9e38c5b91443f5bbfce83fcf0042f798 | 37.831615 | 88 | 0.548319 | 4.005672 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/varLib/__init__.py | 1 | 38058 | """
Module for dealing with 'gvar'-style font variations, also known as run-time
interpolation.
The ideas here are very similar to MutatorMath. There is even code to read
MutatorMath .designspace files in the varLib.designspace module.
For now, if you run this file on a designspace file, it tries to find
ttf-interpo... | mit | 715799c283ea712d53e096d4f521d6b9 | 31.143581 | 155 | 0.71596 | 3.066473 | false | false | false | false |
fonttools/fonttools | Lib/fontTools/fontBuilder.py | 1 | 31196 | __all__ = ["FontBuilder"]
"""
This module is *experimental*, meaning it still may evolve and change.
The `FontBuilder` class is a convenient helper to construct working TTF or
OTF fonts from scratch.
Note that the various setup methods cannot be called in arbitrary order,
due to various interdependencies between Ope... | mit | 3aac6baf4bd5fbae11feeebc75fe51fc | 31.563674 | 104 | 0.622195 | 3.734706 | false | false | false | false |
watchdogpolska/feder | feder/main/filters.py | 1 | 1091 | from django_filters import DateRangeFilter, FilterSet
from django.conf import settings
from django.utils.timezone import now
class InitialFilterSet(FilterSet):
def __init__(self, data=None, *args, **kwargs):
initial = kwargs.pop("initial", {})
if data is None:
data = {}
data = ... | mit | 808fadda75abcbadbf17fa07907441ad | 37.964286 | 85 | 0.566453 | 4.070896 | false | false | false | false |
watchdogpolska/feder | feder/virus_scan/migrations/0001_initial.py | 1 | 3489 | # Generated by Django 2.2.7 on 2019-11-30 05:25
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import jsonfield.fields
import model_utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
("contenttypes", "0002_remo... | mit | 07fb4455e6d26bc00e24dc724551e90f | 31.607477 | 84 | 0.3683 | 5.766942 | false | false | false | false |
watchdogpolska/feder | feder/monitorings/filters.py | 1 | 1117 | import django_filters
from django.utils.translation import gettext_lazy as _
from .models import Monitoring
from feder.teryt.filters import (
DisabledWhenVoivodeshipFilter,
DisabledWhenCountyFilter,
DisabledWhenCommunityFilter,
)
from feder.cases.filters import CaseReportFilter
class MonitoringFilter(dja... | mit | 6c54c35349cc98b5a4ed997e46acbecd | 30.914286 | 82 | 0.693823 | 3.946996 | false | false | false | false |
ucfopen/canvasapi | canvasapi/enrollment.py | 1 | 1951 | from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs
class Enrollment(CanvasObject):
def __str__(self):
return "{} ({})".format(self.type, self.id)
def deactivate(self, task, **kwargs):
"""
Delete, conclude, or deactivate an enrollment.
T... | mit | 17931612081bf7d6a38583f4647f33a8 | 34.472727 | 101 | 0.597642 | 4.142251 | false | false | false | false |
ucfopen/canvasapi | canvasapi/assignment.py | 1 | 23017 | from canvasapi.canvas_object import CanvasObject
from canvasapi.exceptions import CanvasException, RequiredFieldMissing
from canvasapi.grade_change_log import GradeChangeEvent
from canvasapi.paginated_list import PaginatedList
from canvasapi.peer_review import PeerReview
from canvasapi.progress import Progress
from can... | mit | d1d047cfd3ba1ab71795407d27f9caed | 36.788177 | 117 | 0.605484 | 4.235002 | false | false | false | false |
ucfopen/canvasapi | tests/test_sis_import.py | 1 | 1659 | import unittest
import requests_mock
from canvasapi import Canvas
from canvasapi.progress import Progress
from canvasapi.sis_import import SisImport
from tests import settings
from tests.util import register_uris
@requests_mock.Mocker()
class TestSisImportGroup(unittest.TestCase):
def setUp(self):
... | mit | c29e4c5beeecb1d8c12bf2543485db6f | 31.18 | 79 | 0.625075 | 3.876168 | false | true | false | false |
ucfopen/canvasapi | canvasapi/quiz.py | 1 | 32609 | from canvasapi.canvas_object import CanvasObject
from canvasapi.exceptions import RequiredFieldMissing
from canvasapi.paginated_list import PaginatedList
from canvasapi.quiz_group import QuizGroup
from canvasapi.submission import Submission
from canvasapi.user import User
from canvasapi.util import combine_kwargs, obj_... | mit | efaf37b83a15ea9e33c0c29e57300f15 | 36.961583 | 129 | 0.598638 | 3.972831 | false | false | false | false |
ucfopen/canvasapi | tests/test_outcome.py | 1 | 19528 | import unittest
import requests_mock
from canvasapi import Canvas
from canvasapi.outcome import Outcome, OutcomeGroup, OutcomeLink
from tests import settings
from tests.util import register_uris
@requests_mock.Mocker()
class TestOutcome(unittest.TestCase):
def setUp(self):
self.canvas = Canvas(settings.... | mit | 36f83dbe20aa4c4913dfc0b08cfed609 | 37.440945 | 88 | 0.586747 | 4.053134 | false | true | false | false |
ucfopen/canvasapi | tests/test_assignment.py | 1 | 17832 | import unittest
import uuid
from pathlib import Path
import requests_mock
from canvasapi import Canvas
from canvasapi.assignment import (
Assignment,
AssignmentExtension,
AssignmentGroup,
AssignmentOverride,
)
from canvasapi.exceptions import CanvasException, RequiredFieldMissing
from canvasapi.grade_... | mit | de6dc07af8b670ae2ab5b1898f35a39d | 35.024242 | 87 | 0.629318 | 4.081483 | false | true | false | false |
ucfopen/canvasapi | canvasapi/grading_period.py | 1 | 2156 | from canvasapi.canvas_object import CanvasObject
from canvasapi.exceptions import RequiredFieldMissing
from canvasapi.util import combine_kwargs
class GradingPeriod(CanvasObject):
def __str__(self):
return "{} ({})".format(self.title, self.id)
def delete(self, **kwargs):
"""
Delete a ... | mit | d120ee487732440fe51adfcefe5652d8 | 34.344262 | 101 | 0.624304 | 4.138196 | false | false | false | false |
dj-stripe/dj-stripe | djstripe/migrations/0001_initial.py | 1 | 209454 | # Generated by Django 3.2.11 on 2022-01-17 03:13
import uuid
import django.core.validators
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import djstripe.enums
import djstripe.fields
import djstripe.models.api
import djstripe.models.webhooks
DJSTRIPE_SUBSC... | mit | fa82105ae79761c3029570ddd9acb976 | 43.16997 | 391 | 0.433909 | 5.484668 | false | false | false | false |
alphagov/notifications-api | app/dao/inbound_numbers_dao.py | 1 | 1411 | from app import db
from app.dao.dao_utils import autocommit
from app.models import InboundNumber
def dao_get_inbound_numbers():
return InboundNumber.query.order_by(InboundNumber.updated_at).all()
def dao_get_available_inbound_numbers():
return InboundNumber.query.filter(InboundNumber.active, InboundNumber.s... | mit | 15996397cab5605226ad81eb0d36221e | 31.813953 | 103 | 0.749114 | 3.383693 | false | false | false | false |
alphagov/notifications-api | app/service/callback_rest.py | 1 | 5366 | from flask import Blueprint, jsonify, request
from sqlalchemy.exc import SQLAlchemyError
from app.dao.service_callback_api_dao import (
delete_service_callback_api,
get_service_callback_api,
reset_service_callback_api,
save_service_callback_api,
)
from app.dao.service_inbound_api_dao import (
delet... | mit | 05d8b8f3abc2ea5ceae24fdfa09d9a71 | 33.844156 | 120 | 0.689154 | 3.539578 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0330_broadcast_invite_email.py | 1 | 2200 | """
Revision ID: 0330_broadcast_invite_email
Revises: 0329_purge_broadcast_data
Create Date: 2020-09-15 14:17:01.963181
"""
# revision identifiers, used by Alembic.
from datetime import datetime
from alembic import op
revision = "0330_broadcast_invite_email"
down_revision = "0329_purge_broadcast_data"
user_id = "... | mit | fd659d9b6427085af80b6c6295bee999 | 27.179487 | 106 | 0.636488 | 3.407752 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0128_noti_to_sms_sender.py | 1 | 2236 | """
Revision ID: 0128_noti_to_sms_sender
Revises: 0127_remove_unique_constraint
Create Date: 2017-10-26 15:17:00.752706
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "0128_noti_to_sms_sender"
down_revision = "0127_remove_unique_constraint"
def upgrade():
... | mit | 0383fcc998db92613e7f54e75d4d341e | 35.655738 | 120 | 0.662791 | 3.44 | false | false | false | false |
denisenkom/pytds | src/pytds/lcid.py | 17 | 18871 | # Copyright 2010 Michael Murr
#
# This file is part of LibForensics.
#
# LibForensics is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | mit | 01851bfb53ddca3615ef9abe86173c65 | 36.368317 | 79 | 0.721371 | 2.224567 | false | false | false | false |
alphagov/notifications-api | migrations/env.py | 1 | 2554 | from logging.config import fileConfig
from alembic import context
from sqlalchemy import engine_from_config, pool
from pathlib import Path
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
#... | mit | b97cc045053c06c23097725a453da406 | 30.146341 | 109 | 0.696163 | 4.041139 | false | true | false | false |
alphagov/notifications-api | migrations/versions/0260_remove_dvla_organisation.py | 1 | 4361 | """
Revision ID: 0260_remove_dvla_organisation
Revises: 0259_remove_service_postage
Create Date: 2019-02-12 17:39:02.517571
"""
import sqlalchemy as sa
from alembic import op
revision = "0260_remove_dvla_organisation"
down_revision = "0259_remove_service_postage"
def upgrade():
# ### commands auto generated by... | mit | aa93e6c7d85b19f21bf12634fa5bbc88 | 39.37963 | 111 | 0.584499 | 3.318874 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.