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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
alphagov/notifications-api | migrations/versions/0039_fix_notifications.py | 1 | 3473 | """empty message
Revision ID: 0039_fix_notifications
Revises: 0038_test_api_key_type
Create Date: 2016-07-06 13:28:48.381278
"""
# revision identifiers, used by Alembic.
revision = "0039_fix_notifications"
down_revision = "0038_test_api_key_type"
import sqlalchemy as sa
from alembic import op
def upgrade():
o... | mit | c2802ae070ce93ad2ed81d0a892c89e4 | 41.353659 | 179 | 0.571552 | 4.010393 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0007_template_history.py | 1 | 3426 | """empty message
Revision ID: 0007_template_history
Revises: 0006_api_keys_history
Create Date: 2016-04-22 09:51:55.615891
"""
# revision identifiers, used by Alembic.
revision = "0007_template_history"
down_revision = "0006_api_keys_history"
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects i... | mit | 09f0ef4961b3cee037a79b26877f59af | 47.253521 | 148 | 0.676007 | 3.485249 | false | false | false | false |
alphagov/notifications-api | app/clients/email/aws_ses.py | 1 | 4127 | from time import monotonic
import boto3
import botocore
from flask import current_app
from app.clients import STATISTICS_DELIVERED, STATISTICS_FAILURE
from app.clients.email import (
EmailClient,
EmailClientException,
EmailClientNonRetryableException,
)
ses_response_map = {
"Permanent": {
"me... | mit | 7dfc9639e24812d292857b77e19b87d6 | 32.282258 | 99 | 0.584686 | 4.054028 | false | false | false | false |
alphagov/notifications-api | app/dao/users_dao.py | 1 | 5919 | import uuid
from datetime import datetime, timedelta
from random import SystemRandom
from flask import current_app
from sqlalchemy import func
from sqlalchemy.orm import joinedload
from app import db
from app.dao.dao_utils import autocommit
from app.dao.permissions_dao import permission_dao
from app.dao.service_user_... | mit | 42858bf9128767caee47627894b41a01 | 29.817708 | 119 | 0.682271 | 3.478542 | false | false | false | false |
alphagov/notifications-api | tests/app/clients/test_cbc_proxy.py | 1 | 18206 | import json
import uuid
from collections import namedtuple
from datetime import datetime
from io import BytesIO
from unittest.mock import Mock, call
import pytest
from botocore.exceptions import ClientError as BotoClientError
from app import db
from app.clients.cbc_proxy import (
CBCProxyClient,
CBCProxyEE,
... | mit | deb0ef48b47dacef1f0bd6593644eb6b | 29.039604 | 120 | 0.621072 | 3.508867 | false | true | false | false |
alphagov/notifications-api | migrations/versions/0098_service_inbound_api.py | 1 | 2953 | """empty message
Revision ID: 0098_service_inbound_api
Revises: 0097_notnull_inbound_provider
Create Date: 2017-06-13 15:02:33.609656
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "0098_service_inbound_api"
down_revision = "0097_notnull_inbound_provider"
d... | mit | 2a02b19daa8b6ce675bd51af7d743e71 | 41.185714 | 118 | 0.646461 | 3.402074 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0066_add_dvla_provider.py | 1 | 1333 | """empty message
Revision ID: 0066_add_dvla_provider
Revises: 0065_users_current_session_id
Create Date: 2017-03-02 10:32:28.984947
"""
import uuid
from datetime import datetime
revision = "0066_add_dvla_provider"
down_revision = "0065_users_current_session_id"
from alembic import op
def upgrade():
provider_i... | mit | 41cd9cf753083a74c9da0694e0fc6811 | 31.512195 | 184 | 0.645161 | 3.526455 | false | false | false | false |
dfm/emcee | src/emcee/state.py | 1 | 2453 | # -*- coding: utf-8 -*-
from copy import deepcopy
import numpy as np
__all__ = ["State"]
class State(object):
"""The state of the ensemble during an MCMC run
For backwards compatibility, this will unpack into ``coords, log_prob,
(blobs), random_state`` when iterated over (where ``blobs`` will only be
... | mit | 621a38e2a12bb4646bcc9d3f248e8802 | 31.653333 | 79 | 0.581053 | 3.962783 | false | false | false | false |
dfm/emcee | src/emcee/ensemble.py | 1 | 25093 | # -*- coding: utf-8 -*-
import warnings
from itertools import count
from typing import Dict, List, Optional, Union
import numpy as np
from .backends import Backend
from .model import Model
from .moves import StretchMove
from .pbar import get_progress_bar
from .state import State
from .utils import deprecated, deprec... | mit | d6fcee657d5df2767f0679298897b5be | 35.685673 | 84 | 0.559877 | 4.32042 | false | false | false | false |
pybel/pybel | src/pybel/io/fraunhofer_orientdb.py | 1 | 7079 | # -*- coding: utf-8 -*-
"""Transport functions for `Fraunhofer's OrientDB <http://graphstore.scai.fraunhofer.de>`_.
`Fraunhofer <https://www.scai.fraunhofer.de/en/business-research-areas/bioinformatics.html>`_ hosts
an instance of `OrientDB <https://orientdb.com/>`_ that contains BEL in a schema similar to
:mod:`pybe... | mit | 6be875add23c32813a34381e55773ce1 | 38.104972 | 119 | 0.658661 | 3.581984 | false | false | false | false |
pybel/pybel | src/pybel/examples/tloc_example.py | 1 | 2520 | # -*- coding: utf-8 -*-
"""An example describing a translocation.
.. code-block:: none
SET Citation = {"PubMed", "16170185"}
SET Evidence = "These modifications render Ras functional and capable of localizing to the lipid-rich inner surface of the cell membrane. The first and most critical modification, farn... | mit | d450d462e1833709039356a2e03b98ed | 34 | 333 | 0.707937 | 2.961222 | false | false | true | false |
pybel/pybel | tests/test_parse/test_parse_utils.py | 1 | 2439 | # -*- coding: utf-8 -*-
"""Tests for parsing utilities."""
import unittest
import networkx as nx
from pybel.utils import subdict_matches
from tests.constants import any_subdict_matches
class TestSubdictMatching(unittest.TestCase):
"""Tests for matching sub-dictionaries."""
def test_dict_matches_1(self):
... | mit | a83240d27b8b7127f082b4533a54f6cd | 29.4875 | 77 | 0.530545 | 2.927971 | false | true | false | false |
pybel/pybel | src/pybel/canonicalize.py | 1 | 12668 | # -*- coding: utf-8 -*-
"""This module contains output functions to BEL scripts."""
import gzip
import itertools as itt
import logging
import time
import warnings
from typing import Iterable, List, Mapping, Optional, TextIO, Tuple, Union
import bel_resources.constants
from bel_resources import make_knowledge_header
... | mit | 6d9f2685d0faffc8f633634e081fce44 | 33.612022 | 115 | 0.65772 | 3.535585 | false | false | false | false |
spookylukey/django-paypal | setup.py | 2 | 1578 | #!/usr/bin/env python
import os.path
from setuptools import find_packages, setup
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
DESCRIPTION = "A pluggable Django application for integrating PayPal Payments Standard or Payments Pro"
URL = "https://github.com/spookylukey... | mit | 9b9312af084758d61abbfd30c17914b6 | 29.941176 | 103 | 0.608365 | 3.661253 | false | false | false | false |
alphagov/digitalmarketplace-api | tests/test_generate_model_schemas.py | 1 | 2313 | import builtins
import mock
from app.generate_model_schemas import generate_schemas, DMModelSchema, get_models_for_all_db_tables
from app.models import Brief, BriefClarificationQuestion
def test_generate_schema():
# Brief has a JSON field 'data' and a mapped property '_lot_id'
schema = DMModelSchema(Brief)
... | mit | e533becd8d3dc59e47918e719963e6b6 | 27.555556 | 100 | 0.455253 | 3.855 | false | false | false | false |
alphagov/digitalmarketplace-api | app/main/views/outcomes.py | 1 | 4712 | import datetime
from flask import abort, current_app, request
from dmapiclient.audit import AuditTypes
from .. import main
from ... import db
from ...models import AuditEvent, Outcome
from ...utils import (
get_json_from_request,
get_valid_page_or_1,
json_has_required_keys,
paginated_result_response,... | mit | b9d1ecb87cae35907058eee329323d7b | 39.273504 | 120 | 0.677844 | 3.781701 | false | false | false | false |
alphagov/digitalmarketplace-api | migrations/versions/830_add_supplierframework_prefill_declaration.py | 1 | 1304 | """Add SupplierFramework.prefill_declaration_from_framework_id column and constraints
Revision ID: 830
Revises: 820
Create Date: 2017-02-02 14:18:54.512957
"""
# revision identifiers, used by Alembic.
revision = '830'
down_revision = '820'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_co... | mit | 5839ea632acfbba1c4ebdcc29efb2e6b | 49.153846 | 226 | 0.756902 | 3.582418 | false | false | false | false |
alphagov/digitalmarketplace-api | migrations/versions/1160_remove_deprecated_application_close_.py | 1 | 2724 | """Remove deprecated application_close_date field and set the remaining date fields to non-nullable.
Revision ID: 1160
Revises: 1150
Create Date: 2018-05-08 09:53:43.699711
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import table, column, and_
# r... | mit | 9227bf040743a4cff0992f101be7ea12 | 40.907692 | 114 | 0.607562 | 4.393548 | false | false | false | false |
rspeer/python-ftfy | tests/test_bytes.py | 2 | 1624 | from ftfy import guess_bytes
from ftfy.bad_codecs.utf8_variants import IncrementalDecoder
import pytest
TEST_ENCODINGS = [
'utf-16', 'utf-8', 'sloppy-windows-1252'
]
TEST_STRINGS = [
'Renée\nFleming', 'Noël\nCoward', 'Señor\nCardgage',
'€ • £ • ¥', '¿Qué?'
]
@pytest.mark.parametrize("string", TEST_STRI... | mit | f126829ed86bf3ddd32b7eb819a03a3c | 31.22 | 78 | 0.657976 | 3.222 | false | true | false | false |
alphagov/digitalmarketplace-api | migrations/versions/570_create_brief_responses_table.py | 1 | 1048 | """Create brief responses table
Revision ID: 570
Revises: 560
Create Date: 2016-02-10 12:19:22.888832
"""
# revision identifiers, used by Alembic.
revision = '570'
down_revision = '560'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
op.create_table('br... | mit | 0f0399fe43d71f46ea38b201028b8964 | 29.823529 | 107 | 0.69084 | 3.402597 | false | false | false | false |
giampaolo/pyftpdlib | pyftpdlib/filesystems.py | 1 | 24802 | # Copyright (C) 2007 Giampaolo Rodola' <g.rodola@gmail.com>.
# Use of this source code is governed by MIT license that can be
# found in the LICENSE file.
import os
import stat
import tempfile
import time
try:
from stat import filemode as _filemode # PY 3.3
except ImportError:
from tarfile import filemode a... | mit | 16a3c17afb372c13940b07e4c42da6f8 | 36.073244 | 78 | 0.551609 | 4.329202 | false | false | false | false |
hail-is/hail | hail/python/hail/experimental/export_entries_by_col.py | 3 | 3763 | import hail as hl
from hail.typecheck import typecheck
@typecheck(mt=hl.MatrixTable, path=str, batch_size=int, bgzip=bool, header_json_in_file=bool, use_string_key_as_file_name=bool)
def export_entries_by_col(mt: hl.MatrixTable,
path: str,
batch_size: int = 256,
... | mit | 5c4a96c22499d500efc16772f4263ebe | 42.755814 | 145 | 0.560191 | 3.283595 | false | false | false | false |
hail-is/hail | datasets/load/old/load.gtex_v7_gene_tpm.GRCh37.py | 3 | 3861 |
import hail as hl
ht_samples = hl.import_table('gs://hail-datasets/raw-data/gtex/v7/annotations/GTEx_v7_Annotations.SampleAttributesDS.txt',
key='SAMPID',
missing='')
float_cols = ['SMRIN',
'SME2MPRT',
'SMNTRART',
'S... | mit | 21dd3cbbf4a3432b9f63b3a702e0688b | 38 | 170 | 0.51308 | 2.98839 | false | false | false | false |
hail-is/hail | hail/python/hailtop/aiocloud/aiogoogle/credentials.py | 1 | 7224 | from typing import Dict, Optional, Union
import os
import json
import time
import logging
import socket
from urllib.parse import urlencode
import jwt
from hailtop.utils import request_retry_transient_errors
import hailtop.httpx
from ..common.credentials import AnonymousCloudCredentials, CloudCredentials
log = logging.... | mit | ad79669b50f033be7c7634ebe1ae93cb | 40.28 | 206 | 0.645626 | 4.357057 | false | false | false | false |
floooh/fips | yaml/yaml2/__init__.py | 217 | 9776 |
from error import *
from tokens import *
from events import *
from nodes import *
from loader import *
from dumper import *
__version__ = '3.11'
try:
from cyaml import *
__with_libyaml__ = True
except ImportError:
__with_libyaml__ = False
def scan(stream, Loader=Loader):
"""
Scan a YAML stream... | mit | c04f6ebbc416ddba1b4bbd0925a610c3 | 30.034921 | 77 | 0.652823 | 4.078431 | false | false | false | false |
hail-is/hail | hail/python/hail/ir/matrix_ir.py | 1 | 51014 | from typing import Optional
import hail as hl
from hail.expr.types import HailType, tint64
from hail.ir.base_ir import BaseIR, MatrixIR
from hail.ir.utils import modify_deep_field, zip_with_index, zip_with_index_field, default_row_uid, default_col_uid, rng_key, unpack_row_uid, unpack_col_uid
import hail.ir.ir as ir
fro... | mit | aaa1355e7b4b004a404b46161d61c888 | 40.140323 | 164 | 0.590367 | 3.421233 | false | false | false | false |
hail-is/hail | hail/python/hail/genetics/pedigree.py | 3 | 9386 | import re
from collections import Counter
from hail.typecheck import typecheck_method, nullable, sequenceof
from hail.utils.java import Env, FatalError, warning
class Trio(object):
"""Class containing information about nuclear family relatedness and sex.
:param str s: Sample ID of proband.
:param fam_i... | mit | 310927dece01cccfab4b6fe13bcfd8ce | 28.89172 | 152 | 0.536437 | 3.6493 | false | false | false | false |
pre-commit/pre-commit-hooks | pre_commit_hooks/check_added_large_files.py | 1 | 2161 | from __future__ import annotations
import argparse
import math
import os
import subprocess
from typing import Sequence
from pre_commit_hooks.util import added_files
from pre_commit_hooks.util import zsplit
def filter_lfs_files(filenames: set[str]) -> None: # pragma: no cover (lfs)
"""Remove files tracked by gi... | mit | 49127632e1d80c985f0b510e8ddc0500 | 25.679012 | 78 | 0.606664 | 3.725862 | false | false | false | false |
plivo/plivo-python | plivo/resources/multipartycall.py | 1 | 34255 | # -*- coding: utf-8 -*-
"""
Application class - along with its list class
"""
from plivo.base import (ListResponseObject, PlivoResource, PlivoResourceInterface, SecondaryPlivoResource)
from plivo.utils.validators import *
from plivo.utils import to_param_dict
class MultiPartyCall(PlivoResource):
_name = 'MultiPa... | mit | 1bd74a60bf9c3c6b231af9071aff6731 | 53.720447 | 120 | 0.546781 | 4.043796 | false | false | false | false |
plivo/plivo-python | tests/resources/test_multipartycalls.py | 1 | 28284 | # -*- coding: utf-8 -*-
import json
from plivo.base import (ListResponseObject)
from plivo.exceptions import ValidationError
from plivo.resources import MultiPartyCall, MultiPartyCallParticipant
from plivo.utils.signature_v3 import construct_get_url
from tests.base import PlivoResourceTestCase
from tests.decorators im... | mit | 3cf5d0acfa9251c986d3c4c0c5b01784 | 51.474954 | 122 | 0.595531 | 4.013053 | false | false | false | false |
plivo/plivo-python | plivo/utils/signature_v3.py | 1 | 4488 | import sys
from hmac import new as sign
from hashlib import sha256
from .validators import *
PY2 = True if sys.version_info.major == 2 else False
if PY2:
from urlparse import urlparse, urlunparse, parse_qs
from base64 import encodestring as encode
else:
from urllib.parse import urlparse, urlunparse, parse... | mit | e63342aa3c419daaaf80e6020471faff | 36.4 | 108 | 0.631684 | 3.536643 | false | false | false | false |
pre-commit/pre-commit-hooks | pre_commit_hooks/fix_encoding_pragma.py | 1 | 3959 | from __future__ import annotations
import argparse
from typing import IO
from typing import NamedTuple
from typing import Sequence
DEFAULT_PRAGMA = b'# -*- coding: utf-8 -*-'
def has_coding(line: bytes) -> bool:
if not line.strip():
return False
return (
line.lstrip()[:1] == b'#' and (
... | mit | ea500ddeac05fceb1d2dcfc202406631 | 25.57047 | 79 | 0.588532 | 3.919802 | false | false | false | false |
plivo/plivo-python | plivo/rest/client.py | 1 | 13564 | # -*- coding: utf-8 -*-
"""
Core client, used for all API requests.
"""
import os
import platform
from collections import namedtuple
from plivo.base import ResponseObject
from plivo.exceptions import (AuthenticationError, InvalidRequestError,
PlivoRestError, PlivoServerError,
... | mit | f475b53d58e0f5f9d4dd27236d7fbe9f | 42.060317 | 108 | 0.566352 | 4.245383 | false | false | false | false |
plivo/plivo-python | plivo/resources/identities.py | 1 | 8384 | # -*- coding: utf-8 -*-
from plivo.utils import to_param_dict
from plivo.utils.validators import *
from ..base import ListResponseObject, PlivoResource, PlivoResourceInterface
class Identity(PlivoResource):
_name = 'Identity'
_identifier_string = 'id'
def update(self,
country_iso=None,
... | mit | 4997bec20ad8973a63c0e4f8b31aab03 | 34.525424 | 99 | 0.497137 | 3.996187 | false | false | false | false |
plivo/plivo-python | plivo/resources/campaign.py | 1 | 5816 | # -*- coding: utf-8 -*-
from plivo.utils.validators import *
from ..base import ListResponseObject, PlivoResource, PlivoResourceInterface
from ..exceptions import *
from ..utils import *
class Campaign(PlivoResource):
_name = 'Campaign'
_identifier_string = 'campaign_id'
class Campaign(PlivoResourceInterface... | mit | dc4d440a49b375f7936b82d3b6b2fa39 | 37.269737 | 99 | 0.523556 | 4 | false | false | false | false |
baudren/montepython_public | montepython/run.py | 1 | 8734 | """
.. module:: run_mp
:synopsis: Run the code, initialising everything and calling the sampler
.. moduleauthor:: Benjamin Audren <benjamin.audren@epfl.ch>
"""
from initialise import initialise
from data import Data
import io_mp
import sys
import warnings
import os
import re
def run(custom_command=''):
"""
... | mit | a26048d93a419dae892af9766376e075 | 30.644928 | 79 | 0.607511 | 4.100469 | false | false | false | false |
baudren/montepython_public | montepython/likelihoods/sn/__init__.py | 2 | 2674 | import os
import numpy as np
from montepython.likelihood_class import Likelihood
class sn(Likelihood):
# initialization routine
def __init__(self, path, data, command_line):
Likelihood.__init__(self, path, data, command_line)
# define array for values of z and data points
self.z = ... | mit | 700a5078d241d38c3c8d7bd7d50d61c1 | 31.216867 | 79 | 0.575916 | 3.729428 | false | false | false | false |
cltk/cltk | src/cltk/phonology/transcription_processes.py | 4 | 11298 | """This module provides phonological/phonetic transcribers for several languages.
**PhonologicalTranscriptionProcess** is the parent-class for all other custom transcription processes.
"""
from copy import deepcopy
from dataclasses import dataclass
from boltons.cacheutils import cachedproperty
from cltk.core.data_t... | mit | 0df8b8dc9fec1943311de15b81f1a2a2 | 42.253846 | 203 | 0.725236 | 3.569026 | false | false | false | false |
cltk/cltk | src/cltk/prosody/lat/syllabifier.py | 4 | 16259 | """Latin language syllabifier.
Parses a lat word or a space separated list of words into a list of syllables.
Consonantal I is transformed into a J at the start of a word as necessary.
Tuned for poetry and verse, this class is tolerant of isolated single character consonants that
may appear due to elision."""
import c... | mit | dc875355475efd8e4ff5125d8d150c08 | 40.078481 | 98 | 0.566991 | 3.653682 | false | false | false | false |
cltk/cltk | src/cltk/alphabet/grc/grc.py | 2 | 26277 | """The Ancient Greek alphabet. Sources:
- `<https://en.wikipedia.org/wiki/Greek_diacritics#Unicode>`_
- `<https://unicode-table.com/en/blocks/greek-coptic/>`_
- `<https://unicode-table.com/en/blocks/greek-extended/>`_
>>> UPPER[:5]
['Α', 'Ε', 'Η', 'Ͱ', 'Ι']
>>> LOWER_SMOOTH[:5]
['ἀ', 'ἐ', 'ἠ', 'ἰ', 'ὀ']
>>> ACCENTS[:... | mit | bb9dadce36634a8a0a8f80036a7c2e86 | 38.209375 | 116 | 0.64087 | 2.235745 | false | false | false | false |
cltk/cltk | src/cltk/prosody/lat/clausulae_analysis.py | 4 | 3300 | """
Return dictionary of clausulae found in the prosody of Latin prose.
The clausulae analysis function returns a dictionary in which the key is the type of clausula and the value is the number
of times it occurs in the text. The list of clausulae used in the method is derived from the 2019 Journal of Roman Studies
pa... | mit | a465f75ecf4c8e41c2dd626f7486c571 | 56.894737 | 723 | 0.671212 | 2.825342 | false | false | false | false |
cltk/cltk | src/cltk/phonology/non/transcription.py | 4 | 10883 | """Old Norse transcription module. Sources:
- https://fr.wikipedia.org/wiki/%C3%89criture_du_vieux_norrois
- Altnordisches Elementarbuch by Friedrich Ranke and Dietrich Hofmann
"""
from typing import Union
from cltk.phonology.non.syllabifier import BACK_TO_FRONT_VOWELS
from cltk.phonology.non.utils import (
Abst... | mit | 90fb2ab75de0ab8ff46f543ad44ee640 | 26.188917 | 87 | 0.555586 | 2.815336 | false | false | false | false |
cltk/cltk | src/cltk/phonology/non/syllabifier.py | 4 | 1359 | """
Sonority hierarchy for Old Norse
"""
__author__ = ["Clément Besnier <clem@clementbesnier.fr>"]
__license__ = "MIT License"
# Used according to sonority principle
hierarchy = [
[
"a",
"á",
"æ",
"e",
"é",
"i",
"í",
"o",
"ǫ",
"ø",
... | mit | 253bad8e1bb2f6ad3bed4b53b3c6bc1b | 17.208333 | 74 | 0.33791 | 2.188648 | false | false | false | false |
cltk/cltk | src/cltk/phonology/enm/stress.py | 4 | 6844 | """Middle English stress module
"""
import re
from typing import List
from cltk.phonology.enm.syllabifier import (
CONSONANTS,
DIPHTHONGS,
SHORT_VOWELS,
TRIPHTHONGS,
)
from cltk.stem.enm import stem
__author__ = [
"Eleftheria Chatziargyriou <ele.hatzy@gmail.com>",
"Clément Besnier <clem@cleme... | mit | 4f73ed94603c223081ca9b15a1633d86 | 29.373333 | 185 | 0.545215 | 3.35 | false | false | false | false |
cltk/cltk | src/cltk/stops/processes.py | 4 | 1501 | from copy import deepcopy
from dataclasses import dataclass
from boltons.cacheutils import cachedproperty
from boltons.strutils import split_punct_ws
from cltk.core.data_types import Doc, Process
from cltk.stops.words import Stops
@dataclass
class StopsProcess(Process):
"""
>>> from cltk.core.data_types im... | mit | 6a06ebcdd4005549fd2b9565162db642 | 30.93617 | 88 | 0.64024 | 3.608173 | false | false | false | false |
cltk/cltk | src/cltk/utils/utils.py | 2 | 8805 | """Module for commonly reused classes and functions."""
import os
import sys
from contextlib import contextmanager
from enum import EnumMeta, IntEnum
from typing import Any, Dict, List, Optional, Union
import requests
from tqdm import tqdm
class CLTKEnumMeta(EnumMeta):
def __repr__(cls):
return cls.__na... | mit | 64722d295f058d9a75fd2df215f2636c | 32.735632 | 204 | 0.609654 | 3.611567 | false | false | false | false |
cltk/cltk | src/cltk/dependency/stanza.py | 3 | 14801 | """Wrapper for the Python Stanza package.
About: `<https://github.com/stanfordnlp/stanza>`_.
"""
import logging
import os
from typing import Dict, Optional
import stanza # type: ignore
from stanza.models.common.constant import lang2lcode # Dict[str, str]
from stanza.resources.prepare_resources import default_treeba... | mit | 78a9948de1913c322f9d2ec9f123bdc5 | 38.77628 | 143 | 0.587653 | 3.831992 | false | false | false | false |
cltk/cltk | src/cltk/stops/words.py | 4 | 1970 | """Stopwords for languages.
TODO: Give definition here of stopwords.
"""
from typing import List
from cltk.languages.utils import get_lang
from cltk.stops import (
akk,
ang,
arb,
cop,
enm,
fro,
gmh,
grc,
hin,
lat,
non,
omr,
pan,
san,
)
MAP_ISO_TO_MODULE = dict... | mit | 26f792a669a90bddd9741606f8a967ea | 23.320988 | 80 | 0.593909 | 3.162119 | false | false | false | false |
cltk/cltk | src/cltk/prosody/lat/hexameter_scanner.py | 2 | 23238 | """Utility class for producing a scansion pattern for a Latin hexameter.
Given a line of hexameter, the scan method performs a series of transformation and checks
are performed and for each one performed successfully, a note is added to the scansion_notes
list so that end users may view the provenance of a scansion.
... | mit | b46840d494d2d565a2149c93efe8d117 | 46.555328 | 395 | 0.573706 | 3.662721 | false | false | false | false |
cltk/cltk | src/cltk/prosody/lat/macronizer.py | 3 | 7108 | """Delineate length of lat vowels.
The Macronizer class places a macron over naturally long Latin vowels. To discern whether a vowel is long, a word is
first matched with its Morpheus entry by way of its POS tag. The Morpheus entry includes the macronized form of the
matched word.
Since the accuracy of the macronizer... | mit | 7379b2f52757d04b9327d4571783c1e5 | 40.267442 | 117 | 0.62102 | 3.224898 | false | false | false | false |
cltk/cltk | src/cltk/tag/pos.py | 3 | 6188 | """Tag part of speech (POS) using CLTK taggers."""
import os
from nltk.tag import CRFTagger
from nltk.tokenize import wordpunct_tokenize
from cltk.utils import CLTK_DATA_DIR
from cltk.utils.file_operations import open_pickle
__author__ = ["Kyle P. Johnson <kyle@kyle-p-johnson.com>"]
__license__ = "MIT License. See ... | mit | 0691ce81d7c2949eebed52f02e418023 | 33.377778 | 85 | 0.592114 | 3.513913 | false | false | false | false |
pimutils/khal | khal/ui/base.py | 3 | 9167 | # Copyright (c) 2013-2022 khal contributors
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publi... | mit | ab412c31a8a334d7d835357a35ffc692 | 32.578755 | 98 | 0.598778 | 4.077847 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/ext/mypy/names.py | 2 | 10476 | # ext/mypy/names.py
# Copyright (C) 2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
from typing import Dict
from typing import List
fr... | mit | b976402ec47d5b0f45934375b6e1a070 | 30.841945 | 79 | 0.61827 | 3.780585 | false | false | false | false |
zzzeek/sqlalchemy | tools/generate_tuple_map_overloads.py | 2 | 5356 | r"""Generate tuple mapping overloads.
the problem solved by this script is that of there's no way in current
pep-484 typing to unpack \*args: _T into Tuple[_T]. pep-646 is the first
pep to provide this, but it doesn't work for the actual Tuple class
and also mypy does not have support for pep-646 as of yet. Better p... | mit | 088212d77d9141bbab7ac022c8383a81 | 29.781609 | 100 | 0.545743 | 4.148722 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/testing/entities.py | 2 | 3354 | # testing/entities.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
from __future__ import annotations
import sqlalchemy as... | mit | f7a9bc8ec53685cdd0a46a9ebf849d40 | 27.666667 | 77 | 0.473763 | 4.7173 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/orm/mapper.py | 2 | 159479 | # orm/mapper.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: allow-untyped-defs, allow-untyped-calls
"""Logic to map Python classes to and... | mit | 34faa8bfd8a5c2fa7c3e031b16c12c93 | 37.633479 | 111 | 0.582158 | 4.675158 | false | false | false | false |
zzzeek/sqlalchemy | test/ext/mypy/plain_files/experimental_relationship.py | 2 | 2210 | """this suite experiments with other kinds of relationship syntaxes.
"""
import typing
from typing import List
from typing import Optional
from typing import Set
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import Mapped
from sqlalchem... | mit | 6dc99680f12c0976336621948a889b11 | 31.5 | 127 | 0.721267 | 3.507937 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/connectors/pyodbc.py | 2 | 8406 | # connectors/pyodbc.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
import re
from types import ModuleType
imp... | mit | ca02f4f9e0c7c961ed7fc826a1f85651 | 33.45082 | 111 | 0.564716 | 4.21988 | false | false | false | false |
zzzeek/sqlalchemy | test/ext/mypy/plugin_files/decl_base_subclass_two.py | 4 | 1754 | from typing import List
from typing import Optional
from sqlalchemy import Column
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import registry
from sqlalchemy.orm import relationship
from sqlalchemy.orm.decl_api import declared_attr
from sqlalchemy.sql.schema import ForeignKey
from sqlalchemy.sql.sqltypes imp... | mit | add65471f08cd01d13cbe4df5e2fe809 | 23.027397 | 119 | 0.698974 | 3.53629 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/testing/suite/test_rowcount.py | 2 | 5122 | # mypy: ignore-errors
from sqlalchemy import bindparam
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy import testing
from sqlalchemy import text
from sqlalchemy.testing import eq_
from sqlalchemy.test... | mit | f81c68dabfe41d35f32cbf0167b6331d | 28.606936 | 79 | 0.553299 | 4.205255 | false | true | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/testing/fixtures.py | 2 | 31529 | # testing/fixtures.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
from __future__ import annotations
import itertools
imp... | mit | c6cdceacf8107ac26ed1aa09657b5fa2 | 30.434696 | 79 | 0.509023 | 4.571408 | false | true | false | false |
zzzeek/sqlalchemy | examples/association/proxied_association.py | 8 | 3379 | """Same example as basic_association, adding in
usage of :mod:`sqlalchemy.ext.associationproxy` to make explicit references
to ``OrderItem`` optional.
"""
from datetime import datetime
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import DateTime
from sqlalchemy import Float
fro... | mit | 47c6f2e2aa185eb7cbca3e3894e14b80 | 27.394958 | 78 | 0.664398 | 3.818079 | false | false | false | false |
zzzeek/sqlalchemy | examples/association/dict_of_sets_with_default.py | 2 | 2857 | """An advanced association proxy example which
illustrates nesting of association proxies to produce multi-level Python
collections, in this case a dictionary with string keys and sets of integers
as values, which conceal the underlying mapped classes.
This is a three table model which represents a parent table refere... | mit | 3e70616157f37767a2e7fe2c813d3c58 | 27.287129 | 76 | 0.691635 | 4.075606 | false | false | false | false |
zzzeek/sqlalchemy | test/ext/mypy/plugin_files/composite_props.py | 2 | 1391 | from typing import Any
from typing import Tuple
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import select
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import composite
Base = declarative_base()
class Point:
def __init__(self, x: int, y: int):
... | mit | 4a8f7ca86830c65f3f0d1771198c2688 | 22.183333 | 69 | 0.617541 | 3.34375 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/dialects/postgresql/pg8000.py | 2 | 15604 | # postgresql/pg8000.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors <see AUTHORS
# file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
r"""
.. dialect:: postgresql+pg8000
:name: pg8000
... | mit | efdf23c8a9f51fe4dd243067e2f9b20b | 26.520282 | 95 | 0.612663 | 3.968464 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/dialects/mssql/information_schema.py | 2 | 8067 | # mssql/information_schema.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
from ... import cast
from ... import Column
from ... | mit | 50109a5d1b0e1f50dcff21fefb8659c8 | 30.885375 | 77 | 0.679435 | 3.764349 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/sql/schema.py | 2 | 216113 | # sql/schema.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""The schema module provides the building blocks for database metadata.
Each elemen... | mit | 50f9d893ad2b1a5e572c5fbc97e028a1 | 36.260862 | 101 | 0.590853 | 4.554926 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/orm/state_changes.py | 2 | 6587 | # orm/state_changes.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""State tracking utilities used by :class:`_orm.Session`.
"""
from __future... | mit | e2c103e12677a923657c447c88400249 | 33.129534 | 79 | 0.554274 | 4.567961 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/dialects/oracle/types.py | 2 | 6630 | # Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
from ...sql import sqltypes
from ...types import NVARCHAR
from ...types import ... | mit | f41b1b15e1d288a29798f1e56d8543fe | 27.701299 | 79 | 0.592308 | 4.212198 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/testing/suite/test_deprecations.py | 2 | 5082 | # mypy: ignore-errors
from .. import fixtures
from ..assertions import eq_
from ..schema import Column
from ..schema import Table
from ... import Integer
from ... import select
from ... import testing
from ... import union
class DeprecatedCompoundSelectTest(fixtures.TablesTest):
__backend__ = True
@classmet... | mit | ad3935cfb80f1adbd4e3e9da5fb17f29 | 33.571429 | 79 | 0.54388 | 3.543933 | false | true | false | false |
zzzeek/sqlalchemy | test/dialect/mysql/test_on_duplicate.py | 3 | 6813 | from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import exc
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy.dialects.mysql import insert
from sqlalchemy.testing import fixtures
from sqlalchemy.testing.asser... | mit | 383dbf14330f4236b72dd7130a9e4631 | 33.938462 | 79 | 0.516366 | 3.860057 | false | true | false | false |
zzzeek/sqlalchemy | test/orm/inheritance/test_concrete.py | 2 | 53412 | from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import literal
from sqlalchemy import null
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy import union
from sqlalchemy import union_all
from sqlalchemy.ext.declarative import Abst... | mit | 910456de935d84474c8800a63827f53a | 30.792857 | 79 | 0.495113 | 4.198396 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/dialects/postgresql/hstore.py | 2 | 12273 | # postgresql/hstore.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
import re
from .array import ARRAY
from ... import typ... | mit | 2845f942683a3ee44cc9983b701f7a84 | 27.020548 | 79 | 0.599283 | 3.917332 | false | false | false | false |
zzzeek/sqlalchemy | test/orm/test_naturalpks.py | 2 | 54685 | """
Primary key changing capabilities and passive/non-passive cascading updates.
"""
import itertools
import sqlalchemy as sa
from sqlalchemy import bindparam
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy import TypeDecor... | mit | 7fc8676e48cc637bff1c80125e969364 | 27.275595 | 79 | 0.531352 | 3.909422 | false | true | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/ext/asyncio/scoping.py | 2 | 49422 | # ext/asyncio/scoping.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
from typing import Any
from typing impor... | mit | 8d0dc7dec45d1e4c857b5a15b0e3e92a | 31.751491 | 86 | 0.614443 | 4.430082 | false | false | false | false |
lark-parser/lark | docs/ide/app/ignite.py | 2 | 4768 | # -*- coding: utf-8 -*-
from . import core as html5
@html5.tag
class Label(html5.Label):
_parserTagName = "ignite-label"
def __init__(self, *args, **kwargs):
super(Label, self).__init__(style="label ignt-label", *args, **kwargs)
@html5.tag
class Input(html5.Input):
_parserTagName = "ignite-input"
def __init... | mit | 962c04cd6b27cb4d9145283de3b524f5 | 24.634409 | 104 | 0.672399 | 2.896719 | false | false | false | false |
lark-parser/lark | examples/advanced/conf_lalr.py | 1 | 1264 | """
LALR’s contextual lexer
=======================
This example demonstrates the power of LALR's contextual lexer,
by parsing a toy configuration language.
The terminals `NAME` and `VALUE` overlap. They can match the same input.
A basic lexer would arbitrarily choose one over the other, based on priority,
which woul... | mit | 06d6212c0958a1b782ae5d23740b074d | 28.348837 | 88 | 0.68859 | 3.6793 | false | false | false | false |
lark-parser/lark | lark/parser_frontends.py | 2 | 9338 | from typing import Any, Callable, Dict, Tuple
from .exceptions import ConfigurationError, GrammarError, assert_config
from .utils import get_regexp_width, Serialize
from .parsers.grammar_analysis import GrammarAnalyzer
from .lexer import LexerThread, BasicLexer, ContextualLexer, Lexer
from .parsers import earley, xear... | mit | 164c054930eadd4d95e05d071b45c309 | 37.114286 | 150 | 0.649068 | 3.730723 | false | false | false | false |
lark-parser/lark | lark/indenter.py | 2 | 3076 | "Provides Indentation services for languages with indentation similar to Python"
from abc import ABC, abstractmethod
from typing import List, Iterator
from .exceptions import LarkError
from .lark import PostLex
from .lexer import Token
###{standalone
class DedentError(LarkError):
pass
class Indenter(PostLex, A... | mit | c9f6d9a83887b190daa953e182d08426 | 26.464286 | 124 | 0.597854 | 3.8402 | false | false | false | false |
lark-parser/lark | lark/parsers/earley_common.py | 2 | 1581 | """This module implements useful building blocks for the Earley parser
"""
class Item:
"An Earley Item, the atom of the algorithm."
__slots__ = ('s', 'rule', 'ptr', 'start', 'is_complete', 'expect', 'previous', 'node', '_hash')
def __init__(self, rule, ptr, start):
self.is_complete = len(rule.exp... | mit | c06ceb12c65c76c709285fdd526925c9 | 36.642857 | 99 | 0.578115 | 3.497788 | false | false | false | false |
lark-parser/lark | lark/visitors.py | 2 | 21096 | from typing import TypeVar, Tuple, List, Callable, Generic, Type, Union, Optional, Any, cast
from abc import ABC
from .utils import combine_alternatives
from .tree import Tree, Branch
from .exceptions import VisitError, GrammarError
from .lexer import Token
###{standalone
from functools import wraps, update_wrapper
f... | mit | 0ba03a5b7db258b3f6b64ed03e6c0c2b | 34.938671 | 147 | 0.621919 | 4.22935 | false | false | false | false |
coldfix/udiskie | udiskie/depend.py | 1 | 2738 | """
Make sure that the correct versions of gobject introspection dependencies
are installed.
"""
import os
import logging
from gi import require_version
from .locale import _
require_version('Gio', '2.0')
require_version('GLib', '2.0')
def check_call(exc_type, func, *args):
try:
func(*args)
re... | mit | f672cb01cdc0ce35a9abd2b75d568424 | 27.821053 | 79 | 0.668006 | 3.607378 | false | false | false | false |
learningequality/kolibri | kolibri/core/utils/pagination.py | 1 | 11863 | import hashlib
from base64 import b64encode
from collections import OrderedDict
from django.core.cache import cache
from django.core.exceptions import EmptyResultSet
from django.core.paginator import InvalidPage
from django.core.paginator import Page
from django.core.paginator import Paginator
from django.db.models im... | mit | df6535c97a62d9bdd6bf5a1048e352dd | 36.188088 | 135 | 0.575487 | 4.564448 | false | false | false | false |
learningequality/kolibri | kolibri/core/tasks/test/test_api.py | 1 | 28336 | from django.urls import reverse
from mock import call
from mock import Mock
from mock import patch
from rest_framework import serializers
from rest_framework.test import APITestCase
from kolibri.core.auth.models import Facility
from kolibri.core.auth.models import FacilityUser
from kolibri.core.auth.test.test_api impo... | mit | 02ebd19672226678d875c8613b9d9ed1 | 35.005083 | 88 | 0.565888 | 3.839046 | false | true | false | false |
learningequality/kolibri | kolibri/core/discovery/utils/filesystem/__init__.py | 4 | 2411 | import hashlib
import logging
import os
import sys
from collections import namedtuple
from .posix import get_drive_list as get_drive_list_posix
from .windows import get_drive_list as get_drive_list_windows
logger = logging.getLogger(__name__)
# The name of the folder we export data and content to, and what we look f... | mit | a2fc4e3ee37991a9e02b91cad1ff7c62 | 27.702381 | 109 | 0.623393 | 4.031773 | false | false | false | false |
learningequality/kolibri | kolibri/core/auth/permissions/base.py | 1 | 15249 | """
This module defines the base classes for Kolibri's class-based Permissions system.
"""
from django.db.models import Q
from kolibri.core.auth.constants import role_kinds
####################################################################################################################
# This section contains bas... | mit | 163bf254547d88adff3c39c30fe3f8dc | 44.383929 | 127 | 0.627582 | 4.364339 | false | false | false | false |
learningequality/kolibri | kolibri/core/auth/migrations/0006_auto_20171206_1207.py | 4 | 1981 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2017-12-06 20:07
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [("kolibriauth", "0005_auto_20170818_1203")]
oper... | mit | 01c76429ec828dfb8f15ce42de3f0823 | 30.951613 | 113 | 0.46946 | 4.977387 | false | false | false | false |
learningequality/kolibri | kolibri/core/utils/cache.py | 2 | 1736 | import logging
from django.core.cache import caches
from django.core.cache import InvalidCacheBackendError
from django.utils.functional import SimpleLazyObject
logger = logging.getLogger(__name__)
def __get_process_cache():
try:
return caches["process_cache"]
except InvalidCacheBackendError:
... | mit | cd1e34bdc87d563c582fcf4ee098288f | 26.555556 | 83 | 0.646889 | 4.027842 | false | true | false | false |
learningequality/kolibri | kolibri/core/bookmarks/models.py | 1 | 1189 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
from morango.models import UUIDField
from kolibri.core.auth.models import AbstractFacilityDataModel
from kolibri.core.auth.models import FacilityUser
from kolibri.core.auth.permissions.genera... | mit | e0d893f07b99ece6012a42f1b5e2e984 | 29.487179 | 71 | 0.689655 | 3.774603 | false | false | false | false |
learningequality/kolibri | kolibri/core/discovery/utils/network/broadcast.py | 1 | 20048 | import json
import logging
import socket
from magicbus.base import Bus
from magicbus.plugins import SimplePlugin
from six import integer_types
from six import string_types
from zeroconf import get_all_addresses
from zeroconf import InterfaceChoice
from zeroconf import NonUniqueNameException
from zeroconf import Servic... | mit | 8648346aced1bdaa52838ee551c5ae41 | 33.446735 | 103 | 0.613627 | 4.353529 | false | false | false | false |
learningequality/kolibri | kolibri/core/content/migrations/0028_contentnode_metadata_labels.py | 1 | 5063 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-10-05 22:50
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
("content", "0027_channelmetadata_tagline"),
]
operations = [
... | mit | 299a421b15856c0fc60a8b7d2e409c8a | 35.956204 | 74 | 0.425834 | 4.789972 | false | false | false | false |
learningequality/kolibri | kolibri/core/tasks/validation.py | 1 | 1344 | from rest_framework import serializers
class JobValidator(serializers.Serializer):
"""
A serializer class for validating and deserializing job data.
Task is included for completeness of documentation of expected fields.
But we will validate the existence of this before we get to this point.
"""
... | mit | 46562dd8ff9305a9901ba4c907344585 | 34.368421 | 79 | 0.589286 | 4.666667 | false | false | false | false |
learningequality/kolibri | kolibri/core/logger/migrations/0010_min_length_validation.py | 1 | 1440 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-11-04 16:08
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
("logger", "0009_null_channel_id_unconstra... | mit | 8eceabf7c3d1b91ff74833b9d88f94a7 | 28.387755 | 74 | 0.547222 | 4.660194 | false | false | false | false |
learningequality/kolibri | kolibri/core/utils/exception_handler.py | 1 | 2432 | from django.utils import six
from rest_framework import status
from rest_framework.exceptions import ErrorDetail
from rest_framework.views import exception_handler
from kolibri.core import error_constants
def custom_exception_handler(exc, context):
# Call REST framework's default exception handler first,
# t... | mit | ec7a2432012a2be03879c116ced79d28 | 31.864865 | 87 | 0.555099 | 4.597353 | false | false | false | false |
learningequality/kolibri | kolibri/core/notifications/tasks.py | 1 | 3264 | import logging as logger
import threading
import time
from django.db import connection
from django.db import connections
from django.db import transaction
from django.db.utils import OperationalError
from kolibri.core.sqlite.utils import repair_sqlite_db
from kolibri.deployment.default.sqlite_db_names import NOTIFICA... | mit | 8a00975ec2cbe6e63127cdb76bb80685 | 28.672727 | 97 | 0.600797 | 4.878924 | false | false | false | false |
learningequality/kolibri | kolibri/core/content/contentschema/versions/content_schema_5.py | 1 | 7096 | # coding: utf-8
from sqlalchemy import Boolean
from sqlalchemy import CHAR
from sqlalchemy import Column
from sqlalchemy import Float
from sqlalchemy import ForeignKey
from sqlalchemy import Index
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Text
from sqlalchemy.ext.declarative im... | mit | 3e1c8908e0cff05a33b4917aa3fb1e9a | 32.630332 | 103 | 0.687007 | 3.854427 | false | false | false | false |
learningequality/kolibri | kolibri/utils/translation.py | 1 | 5102 | """
This module is used to provide translation support for Kolibri,
prior to the loading of the Django stack.
Most of these functions are vendored from Django:
https://github.com/django/django/blob/stable/1.11.x/django/utils/translation/trans_real.py
In order to give a completely transparent interface.
"""
import gett... | mit | 56ac968527dd12158d2176aecfe0e374 | 28.491329 | 90 | 0.687181 | 4.390706 | false | false | false | false |
learningequality/kolibri | kolibri/core/auth/test/test_api.py | 1 | 61375 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import base64
import collections
import sys
import time
import uuid
from datetime import datetime
from importlib import import_module
import factory
from django.conf import settings
from django.urls im... | mit | d521cc5c0a65093580f33068deb96ec5 | 36.332725 | 146 | 0.584603 | 4.099319 | false | true | false | false |
learningequality/kolibri | kolibri/core/discovery/utils/network/urls.py | 2 | 6206 | import re
from six.moves.urllib.parse import urlparse
from . import errors
# android is served on port 5000
HTTP_PORTS = (8080, 80, 8008, 8000, 5000)
HTTPS_PORTS = (443,)
# from https://stackoverflow.com/a/33214423
def is_valid_hostname(hostname):
if hostname[-1] == ".":
# strip exactly one dot from ... | mit | dfec3b59843685852f6f79adc25679e2 | 33.098901 | 132 | 0.483725 | 3.55441 | false | false | false | false |
learningequality/kolibri | kolibri/core/auth/test/test_auth_tasks.py | 1 | 29419 | from uuid import uuid4
from django.core.management.base import CommandError
from django.test import TestCase
from django.urls import reverse
from mock import Mock
from mock import patch
from requests.exceptions import ConnectionError
from rest_framework import serializers
from rest_framework.exceptions import Authenti... | mit | 5933f49a13b8592814252e92cde3ec7c | 36.098361 | 88 | 0.621027 | 3.887802 | false | true | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.