repo_name stringlengths 7 65 | path stringlengths 5 186 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 941 973k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 5 100 | line_max int64 26 999 | alpha_frac float64 0.25 0.93 | ratio float64 1.5 7.35 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mozilla/normandy | normandy/recipes/tests/api/v3/test_shield_identicon.py | 1 | 1396 | import pytest
from normandy.recipes.api.v3.shield_identicon import Genome
@pytest.fixture
def genome():
seed = 123
return Genome(seed)
class TestGenome(object):
"""
Tests the Genome module by setting the seed to a known value and making sure that the
random choices remain consistent, ie. they d... | mpl-2.0 | 67377af2923b76d7e308e3982934b69f | 29.822222 | 89 | 0.553713 | 3.769022 | false | true | false | false |
mozilla/normandy | normandy/recipes/tests/test_checks.py | 1 | 4881 | from datetime import timedelta
from django.core.exceptions import ImproperlyConfigured
from django.db.utils import ProgrammingError
import pytest
import requests.exceptions
from normandy.recipes import checks, signing
from normandy.recipes.tests import ActionFactory, RecipeFactory, SignatureFactory, UserFactory
@p... | mpl-2.0 | cf8ba8829b7a8bf7b06807e3c4f10a75 | 45.485714 | 96 | 0.708052 | 3.700531 | false | true | false | false |
mozilla/normandy | normandy/recipes/api/filters.py | 1 | 4813 | import django_filters
from rest_framework import serializers
from normandy.recipes.models import Recipe
class EnabledStateFilter(django_filters.Filter):
"""A special case filter for filtering recipes by their enabled state"""
def filter(self, qs, value):
if value is not None:
lc_value = ... | mpl-2.0 | af41c1ff1cd7430c0dab073b7a6dec19 | 35.462121 | 101 | 0.584043 | 4.363554 | false | false | false | false |
mozilla/normandy | normandy/recipes/migrations/0008_auto_20180510_2252.py | 1 | 1967 | # Generated by Django 2.0.5 on 2018-05-10 22:52
# flake8: noqa
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USE... | mpl-2.0 | 2401bc713daafd41216f75005b3da123 | 32.338983 | 95 | 0.475852 | 5.122396 | false | false | false | false |
mozilla/normandy | normandy/recipes/exports.py | 1 | 8717 | import logging
import kinto_http
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from normandy.base.utils import ScopedSettings
APPROVE_CHANGES_FLAG = {"status": "to-sign"}
ROLLBACK_CHANGES_FLAG = {"status": "to-rollback"}
logger = logging.getLogger(__name__)
rs_settings = Sc... | mpl-2.0 | 34b143a423a75644a2ca83f9b7e6a801 | 35.780591 | 103 | 0.614087 | 4.571054 | false | true | false | false |
mozilla/normandy | normandy/recipes/migrations/0009_auto_20180510_2328.py | 1 | 1037 | # Generated by Django 2.0.5 on 2018-05-10 23:28
from django.db import migrations
def enabled_to_enabled_state(apps, schema_editor):
Recipe = apps.get_model("recipes", "Recipe")
EnabledState = apps.get_model("recipes", "EnabledState")
for recipe in Recipe.objects.filter(enabled=True):
if recipe.a... | mpl-2.0 | c93381001079413db6083e24aca3a9d3 | 33.566667 | 93 | 0.702025 | 3.743682 | false | false | false | false |
mozilla/normandy | normandy/studies/tests/__init__.py | 1 | 4038 | import factory
import json
import tempfile
import zipfile
from factory.django import DjangoModelFactory
from faker import Faker
from normandy.base.tests import FuzzyUnicode
from normandy.studies.models import Extension
INSTALL_RDF_TEMPLATE = """<?xml version="1.0" encoding="utf-8"?>
<RDF xmlns="http://w3.org/1999/02... | mpl-2.0 | 193a501d87316d4193e4f9305219f558 | 28.911111 | 96 | 0.586924 | 3.628032 | false | false | false | false |
mozilla/normandy | normandy/recipes/management/commands/initial_data.py | 1 | 1928 | from django.core.management.base import BaseCommand
from django_countries import countries
from normandy.recipes.models import Channel, Country, WindowsVersion
class Command(BaseCommand):
"""
Adds some helpful initial data to the site's database. If matching
data already exists, it should _not_ be overwr... | mpl-2.0 | 38c6b007ae090d295399b47eca56512a | 32.824561 | 99 | 0.61722 | 4.17316 | false | false | false | false |
mozilla/normandy | contract-tests/v1_api/test_performance.py | 1 | 3083 | from urllib.parse import urljoin
import html5lib
import pytest
"""These are paths hit by self repair that need to be very fast"""
HOT_PATHS = [
"/en-US/repair",
"/en-US/repair/",
"/api/v1/recipe/?enabled=1",
"/api/v1/recipe/signed/?enabled=1",
"/api/v1/action/",
]
@pytest.mark.parametrize("path... | mpl-2.0 | 5cebd95963e1d0f119d1be4d966f587c | 35.270588 | 97 | 0.626014 | 3.759756 | false | true | false | false |
mozilla/normandy | normandy/recipes/migrations/0004_auto_20180502_2340.py | 1 | 5164 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-05-02 23:40
# flake8: noqa
from __future__ import unicode_literals
import hashlib
from django.db import migrations
def create_tmp_from_revision(apps, revision, parent=None):
ApprovalRequest = apps.get_model("recipes", "ApprovalRequest")
TmpRecipe... | mpl-2.0 | b08fd3e120b5fcd53bc0145f4b760be4 | 28.849711 | 97 | 0.647366 | 3.819527 | false | false | false | false |
mozilla/normandy | normandy/recipes/api/v3/serializers.py | 1 | 11345 | from rest_framework import serializers
from factory.fuzzy import FuzzyText
from normandy.base.api.v3.serializers import UserSerializer
from normandy.base.jexl import get_normandy_jexl
from normandy.recipes import filters
from normandy.recipes.api.fields import (
ActionImplementationHyperlinkField,
FilterObject... | mpl-2.0 | 9e69db44885b75be18a03b20bf883646 | 34.676101 | 96 | 0.606435 | 4.634395 | false | false | false | false |
mozilla/normandy | contract-tests/v3_api/test_group_delete.py | 1 | 1231 | import uuid
from support.assertions import assert_valid_schema
from urllib.parse import urljoin
def test_group_delete(conf, requests_session, headers):
# Create a new group
data = {"name": str(uuid.uuid4())}
response = requests_session.post(
urljoin(conf.getoption("server"), "/api/v3/group/"), he... | mpl-2.0 | 709834fd8468eb48cb136525254f26bc | 33.194444 | 96 | 0.670187 | 3.799383 | false | false | false | false |
developmentseed/landsat-util | docs/conf.py | 9 | 9890 | # -*- coding: utf-8 -*-
#
# Landsat-util documentation build configuration file, created by
# sphinx-quickstart on Thu May 28 17:52:10 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | cc0-1.0 | 299f01338ac03d06f9f64eefa0b432b3 | 30.800643 | 79 | 0.705359 | 3.653491 | false | true | false | false |
rmmh/skybot | plugins/lastfm.py | 3 | 2391 | """
The Last.fm API key is retrieved from the bot config file.
"""
from util import hook, http
api_url = "http://ws.audioscrobbler.com/2.0/?format=json"
@hook.api_key("lastfm")
@hook.command(autohelp=False)
def lastfm(inp, chan="", nick="", reply=None, api_key=None, db=None):
".lastfm <username> [dontsave] | @... | unlicense | 636c141db11c52dd6b085daa4d1fa441 | 27.129412 | 97 | 0.563363 | 3.531758 | false | false | false | false |
rmmh/skybot | plugins/google.py | 2 | 1308 | from __future__ import unicode_literals
import random
from util import hook, http
def api_get(query, key, is_image=None, num=1):
url = (
"https://www.googleapis.com/customsearch/v1?cx=007629729846476161907:ud5nlxktgcw"
"&fields=items(title,link,snippet)&safe=off&nfpr=1"
+ ("&searchType=i... | unlicense | f118032a0344f7392e8812fe3793d67c | 26.829787 | 89 | 0.626147 | 3.056075 | false | false | false | false |
rmmh/skybot | plugins/util/timesince.py | 3 | 4139 | # Copyright (c) Django Software Foundation and individual contributors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notic... | unlicense | aa53f92f5fdd6e27a86d9046dc52bf9f | 39.578431 | 80 | 0.650882 | 3.930674 | false | false | false | false |
rmmh/skybot | plugins/mtg.py | 3 | 2470 | from __future__ import print_function
from builtins import range
from util import hook, http
import random
def card_search(name):
matching_cards = http.get_json(
"https://api.magicthegathering.io/v1/cards", name=name
)
for card in matching_cards["cards"]:
if card["name"].lower() == name.lo... | unlicense | 32c6db1674583320bea728226b9561ab | 25 | 98 | 0.448178 | 3.130545 | false | false | false | false |
pytube/pytube | pytube/cipher.py | 1 | 22529 | """
This module contains all logic necessary to decipher the signature.
YouTube's strategy to restrict downloading videos is to send a ciphered version
of the signature to the client, along with the decryption algorithm obfuscated
in JavaScript. For the clients to play the videos, JavaScript must take the
ciphered ver... | unlicense | 9409df7792d2d6d6536ad2fa31022a4e | 31.322812 | 154 | 0.566337 | 3.357526 | false | false | false | false |
pytube/pytube | pytube/request.py | 1 | 8512 | """Implements a simple wrapper around urlopen."""
import http.client
import json
import logging
import re
import socket
from functools import lru_cache
from urllib import parse
from urllib.error import URLError
from urllib.request import Request, urlopen
from pytube.exceptions import RegexMatchError, MaxRetriesExceede... | unlicense | 7717abb37be2a302ac4afc9880d28652 | 31.120755 | 85 | 0.620301 | 4.112077 | false | false | false | false |
mozilla-iam/cis | python-modules/cis_crypto/cis_crypto/operation.py | 1 | 5491 | import json
import logging
import os
import yaml
from jose import jwk
from jose import jws
from jose.exceptions import JWSError
from cis_crypto import secret
from cis_crypto import common
logger = logging.getLogger(__name__)
# Note:
# These attrs on sign/verify could be refactored to use object inheritance. Leaving a... | mpl-2.0 | 41f5b14b1044c337dd5dde3addfa3cd4 | 40.285714 | 119 | 0.590056 | 4.082528 | false | true | false | false |
mozilla-iam/cis | python-modules/cis_logger/cis_logger/__init__.py | 1 | 1579 | import logging.handlers
from pythonjsonlogger import jsonlogger
import datetime
class JsonFormatter(jsonlogger.JsonFormatter, object):
def __init__(
self,
fmt="%(asctime) %(name) %(processName) %(filename) \
%(funcName) %(levelname) %(lineno) %(module) %(threadName) %(message)",
da... | mpl-2.0 | d294b79b643857c42fe48606e33c9387 | 33.326087 | 118 | 0.59658 | 3.879607 | false | false | false | false |
ibm-watson-iot/iot-python | src/wiotp/sdk/api/registry/devices.py | 2 | 15894 | # *****************************************************************************
# Copyright (c) 2018 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution,... | epl-1.0 | 2ee6e0ceefe91a835b0e38b3a5447d3d | 29.624277 | 118 | 0.577702 | 4.125097 | false | false | false | false |
ibm-watson-iot/iot-python | src/wiotp/sdk/api/dsc/destinations.py | 2 | 4384 | # *****************************************************************************
# Copyright (c) 2019 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution,... | epl-1.0 | 2af7656e3d7285851117f5bc8a1cd1ad | 35.231405 | 115 | 0.627053 | 4.629356 | false | true | false | false |
ibm-watson-iot/iot-python | src/wiotp/sdk/api/state/state.py | 2 | 2752 | # *****************************************************************************
# Copyright (c) 2019 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution,... | epl-1.0 | 58605d9eeb71bac265a21eb036021baf | 36.69863 | 109 | 0.628634 | 3.97114 | false | false | false | false |
ibm-watson-iot/iot-python | src/wiotp/sdk/api/usage/__init__.py | 2 | 2241 | # *****************************************************************************
# Copyright (c) 2018 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution,... | epl-1.0 | a70bd166a2e5bef336742ee9905bf3e0 | 28.486842 | 113 | 0.57162 | 4.18097 | false | false | false | false |
ibm-watson-iot/iot-python | test/test_device_mgd.py | 2 | 11230 | # *****************************************************************************
# Copyright (c) 2016,2018 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribu... | epl-1.0 | 88cc7945d570b3766356e9f5cfe113fe | 40.439114 | 118 | 0.574087 | 4.424744 | false | true | false | false |
mbj4668/pyang | pyang/repository.py | 1 | 5853 | """A repository for searching and holding loaded pyang modules"""
import os
import sys
import io
from . import util
from . import syntax
class Repository(object):
"""Abstract base class that represents a module repository"""
def get_modules_and_revisions(self, ctx):
"""Return a list of all modules a... | isc | 17e8f7f53c9b7c93601f109e9dc07617 | 35.12963 | 79 | 0.537502 | 4.491942 | false | false | false | false |
mbj4668/pyang | test/test_issues/test_i225/test_prefix_deviation.py | 1 | 3107 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
"""
tests for PYANG data files
"""
import os
import sys
# hack to handle pip 10 internals
try:
import pip.locations as locations
except ImportError:
import pip._internal.locations as locations
from pyang.context import Contex... | isc | 48b0babf28f81699b5b6a833358dc176 | 24.891667 | 71 | 0.641455 | 3.86924 | false | false | false | false |
mbj4668/pyang | pyang/plugins/omni.py | 1 | 11901 |
import optparse
from pyang import plugin
paths_in_module = []
leafrefs = []
key = ''
class_keywords = ["container", "list", "case", "choice", "augment"]
servicepoints = ["servicepoint", "productpoint"]
classnamecolor = " {0.113725, 0.352941, 0.670588}"
mandatoryconfig = " {0.600000, 0.152941, 0.152941}"
optionalconf... | isc | be68baeefe1ad69a4479aae3892de1f6 | 36.780952 | 380 | 0.580035 | 3.356176 | false | false | false | false |
mbj4668/pyang | pyang/yacc.py | 1 | 137902 | # -----------------------------------------------------------------------------
# ply: yacc.py
#
# Copyright (C) 2001-2019
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Latest version: https://github.com/dabeaz/ply
#
# Redistribution and use in source and binary forms, with or without
# modification, are p... | isc | 97644d51771f08d4c571307763fe819e | 38.344365 | 119 | 0.46789 | 4.801267 | false | false | false | false |
rdegges/django-twilio | django_twilio/models.py | 1 | 1827 | # -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from phonenumber_field.modelfields import PhoneNumberField
AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
class Caller(models.Model):
"""
A caller is defined uniquely by their phone number.
:par... | unlicense | 4348298ef46615125a833429bcd3cae9 | 28.467742 | 76 | 0.675424 | 3.822176 | false | false | false | false |
rdegges/django-twilio | test_project/test_app/models.py | 1 | 1869 | # -*- coding: utf-8 -*-
from types import MethodType
from django.test import TestCase
from django.contrib.auth.models import User
from django_dynamic_fixture import G
from django_twilio.models import Caller, Credential
class CallerTestCase(TestCase):
"""
Run tests against the :class:`django_twilio.models.... | unlicense | 9a7784fab1c7082497e409f11fdfa3da | 26.485294 | 69 | 0.608347 | 4.134956 | false | true | false | false |
pikepdf/pikepdf | src/pikepdf/_cpphelpers.py | 1 | 2965 | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Support functions called by the C++ library binding layer.
Not intended to be called from Python, and subject to change at any time.
"""
from __future__ import annotations
from typing import Callable
from warnings import warn
from... | mpl-2.0 | 0089edf3fde570663fa1b10f4c4e07c2 | 27.509615 | 88 | 0.571669 | 3.451688 | false | false | false | false |
pikepdf/pikepdf | tests/test_parsers.py | 1 | 9538 | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: CC0-1.0
from __future__ import annotations
import shutil
import sys
from subprocess import PIPE, run
import pytest
import pikepdf
from pikepdf import (
ContentStreamInlineImage,
ContentStreamInstruction,
Dictionary,
Name,
... | mpl-2.0 | 319f8498404a91e7444e065c0a92dc71 | 28.713396 | 86 | 0.602852 | 3.600604 | false | true | false | false |
pikepdf/pikepdf | src/pikepdf/models/_transcoding.py | 1 | 8054 | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import struct
from typing import Any, Callable, NamedTuple, Union
from PIL import Image
from PIL.TiffTags import TAGS_V2 as TIFF_TAGS
BytesLike = Union[bytes, memoryview]
MutableBytesLike = Union[byt... | mpl-2.0 | b25111f680b52bf6eef2e4dbd67af7ef | 32.144033 | 85 | 0.591383 | 3.15472 | false | false | false | false |
marl/jams | jams/sonify.py | 1 | 6973 | #!/usr/bin/env python
# CREATED:2015-12-12 18:20:37 by Brian McFee <brian.mcfee@nyu.edu>
r'''
Sonification
------------
.. autosummary::
:toctree: generated/
sonify
'''
from itertools import product
from collections import OrderedDict, defaultdict
import six
import numpy as np
import mir_eval.sonify
from mir... | isc | 898e4ac4ddaea3ed6558fd91d972f3f3 | 28.175732 | 78 | 0.588986 | 3.837644 | false | false | false | false |
marl/jams | docs/examples/example_beat.py | 1 | 1897 | #!/usr/bin/env python
import librosa
import jams
def beat_track(infile, outfile):
# Load the audio file
y, sr = librosa.load(infile)
# Compute the track duration
track_duration = librosa.get_duration(y=y, sr=sr)
# Extract tempo and beat estimates
tempo, beat_frames = librosa.beat.beat_trac... | isc | 11ad7906f0e204363942f215b9629c0a | 29.596774 | 96 | 0.672114 | 3.449091 | false | false | false | false |
mail-in-a-box/mailinabox | tests/fail2ban.py | 1 | 6372 | # Test that a box's fail2ban setting are working
# correctly by attempting a bunch of failed logins.
#
# Specify a SSH login command (which we use to reset
# fail2ban after each test) and the hostname to
# try to log in to.
######################################################################
import sys, os, time, fu... | cc0-1.0 | 29a186bced94e5b3029d8583694d7fcb | 25.114754 | 102 | 0.689266 | 3.171727 | false | true | false | false |
mail-in-a-box/mailinabox | management/auth.py | 1 | 6049 | import base64, os, os.path, hmac, json, secrets
from datetime import timedelta
from expiringdict import ExpiringDict
import utils
from mailconfig import get_mail_password, get_mail_user_privileges
from mfa import get_hash_mfa_state, validate_auth_mfa
DEFAULT_KEY_PATH = '/var/lib/mailinabox/api.key'
DEFAULT_AUTH_RE... | cc0-1.0 | c91b208667972834dae219583c0e7f27 | 38.279221 | 107 | 0.708712 | 3.462507 | false | false | false | false |
mcedit/pymclevel | minecraft_server.py | 3 | 20215 | import atexit
import itertools
import logging
import os
from os.path import dirname, join, basename
import random
import re
import shutil
import subprocess
import sys
import tempfile
import time
import urllib
import infiniteworld
from mclevelbase import appSupportDir, exhaust, ChunkNotPresent
log = logging.getLogger(... | isc | d7d9be87202ff9fecb699a0206168e1e | 35.227599 | 266 | 0.602622 | 4.065768 | false | false | false | false |
mcedit/pymclevel | block_fill.py | 3 | 3454 | import logging
import materials
log = logging.getLogger(__name__)
import numpy
from mclevelbase import exhaust
import blockrotation
from entity import TileEntity
def blockReplaceTable(blocksToReplace):
blocktable = numpy.zeros((materials.id_limit, 16), dtype='bool')
for b in blocksToReplace:
if b.ha... | isc | b170273c83cfc015c2c0612b019dc011 | 31.895238 | 111 | 0.621309 | 3.933941 | false | false | false | false |
mcedit/mcedit | filters/CreateSpawners.py | 1 | 1386 | # Feel free to modify and use this filter however you wish. If you do,
# please give credit to SethBling.
# http://youtube.com/SethBling
from pymclevel import TAG_Compound
from pymclevel import TAG_Int
from pymclevel import TAG_Short
from pymclevel import TAG_Byte
from pymclevel import TAG_String
from pymclevel import... | isc | 38f5e4fd2ba5c948d9c00e5a731308f4 | 27.875 | 107 | 0.702742 | 3.08686 | false | false | false | false |
mcedit/mcedit | filters/surfacerepair.py | 1 | 2001 |
from numpy import zeros, array
import itertools
#naturally occuring materials
from pymclevel.level import extractHeights
blocktypes = [1, 2, 3, 7, 12, 13, 14, 15, 16, 56, 73, 74, 87, 88, 89]
blockmask = zeros((256,), dtype='bool')
#compute a truth table that we can index to find out whether a block
# is naturally o... | isc | 37d1710d9987494cf6c9f35b78dc2383 | 32.35 | 82 | 0.574713 | 3.638182 | false | false | false | false |
josephmisiti/awesome-machine-learning | scripts/pull_R_packages.py | 1 | 1150 | #!/usr/bin/python
"""
This script will scrape the r-project.org machine learning selection and
format the packages in github markdown style for this
awesome-machine-learning repo.
"""
from pyquery import PyQuery as pq
import urllib
import codecs
import random
text_file = codecs.open("Packages.txt", encod... | cc0-1.0 | 9ccae99e7636264480a1f1c402562478 | 37.333333 | 76 | 0.565217 | 3.674121 | false | false | false | false |
mozilla-services/tecken | docs/exts/adr_log.py | 1 | 5841 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
"""Directive for generating an ADR log from a directory of ADRs.
Usage::
.. adrlog:: PATH
.. adrlog:: PATH
... | mpl-2.0 | c60c712f5069b89643ca02e08dfecf35 | 24.96 | 87 | 0.563602 | 3.810176 | false | false | false | false |
mozilla-services/tecken | tecken/useradmin/management/commands/is-blocked-in-auth0.py | 1 | 1430 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
from urllib.parse import urlparse
from django.conf import settings
from django.core.management.base import BaseCommand... | mpl-2.0 | ab4c7e3a743e5ef908f91e09d8b77006 | 33.878049 | 74 | 0.61958 | 4.028169 | false | false | false | false |
mozilla-services/tecken | eliot-service/eliot/health_resource.py | 1 | 1629 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
"""
Application-health related Falcon resources.
"""
import json
from dockerflow.version import get_version
import fa... | mpl-2.0 | 58af94c9ce1027fba519ae0f992c7d3c | 26.610169 | 88 | 0.642112 | 3.814988 | false | false | false | false |
mozilla-services/tecken | systemtests/bin/make-stacks.py | 1 | 4833 | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Fetches processed crash data for given crash ids and generates
# stacks for use with the Symbo... | mpl-2.0 | 7654f25d6a753dd42548c0b41d787ce6 | 28.290909 | 85 | 0.622388 | 3.73493 | false | false | false | false |
mozilla-services/tecken | tecken/upload/forms.py | 1 | 4406 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
import os
from urllib.parse import urlparse
from requests.exceptions import ConnectionError, RetryError
from django i... | mpl-2.0 | 10814f19975a341d7890b21ff6695121 | 41.365385 | 149 | 0.618021 | 4.273521 | false | false | false | false |
pimutils/todoman | tests/test_ui.py | 1 | 4822 | from datetime import datetime
from unittest import mock
import pytest
import pytz
from freezegun import freeze_time
from urwid import ExitMainLoop
from todoman.interactive import TodoEditor
def test_todo_editor_priority(default_database, todo_factory, default_formatter):
todo = todo_factory(priority=1)
list... | isc | b3d6b385deacf8417a04794015c156d6 | 30.311688 | 85 | 0.684985 | 3.601195 | false | true | false | false |
pimutils/todoman | docs/source/conf.py | 1 | 2282 | #!/usr/bin/env python3
import todoman
from todoman.configuration import CONFIG_SPEC
from todoman.configuration import NO_DEFAULT
# -- Generate confspec.rst ----------------------------------------------
def confspec_rst():
"""Generator that returns lines for the confspec doc page."""
for name, type_, defau... | isc | 1513b180ca2b449d39537a5e91fcbeb0 | 26.493976 | 79 | 0.56617 | 3.716612 | false | true | false | false |
mozilla-services/autopush | autopush/base.py | 1 | 3544 | import sys
import uuid
from typing import TYPE_CHECKING
import cyclone.web
from twisted.logger import Logger
from twisted.python import failure
if TYPE_CHECKING: # pragma: nocover
from autopush.config import AutopushConfig # noqa
from autopush.db import DatabaseManager # noqa
from autopush.metrics impo... | mpl-2.0 | 8cad22eeda4983dbe788ef4a5f2aa0ae | 33.407767 | 75 | 0.561512 | 4.332518 | false | false | false | false |
mozilla-services/autopush | autopush/router/webpush.py | 1 | 10390 | """WebPush Style Autopush Router
This router handles notifications that should be dispatched to an Autopush
node, or stores each individual message, along with its data, in a Message
table for retrieval by the client.
"""
import json
import time
from StringIO import StringIO
from typing import Any # noqa
from botoc... | mpl-2.0 | 99a381a862716c0e8ccf4a6825fb6726 | 40.56 | 78 | 0.5641 | 4.694984 | false | false | false | false |
mozilla-services/autopush | autopush/web/message.py | 1 | 1772 | from cryptography.fernet import InvalidToken
from marshmallow import Schema, fields, pre_load
from twisted.internet.threads import deferToThread
from twisted.internet.defer import Deferred # noqa
from autopush.exceptions import InvalidRequest, InvalidTokenException
from autopush.utils import WebPushNotification
from ... | mpl-2.0 | ff7d2a1d5dd106efa40c2ec5dddb8a24 | 33.076923 | 76 | 0.659707 | 4.300971 | false | false | false | false |
mozilla-services/autopush | autopush/gcdump.py | 1 | 3447 | #! /usr/bin/env python
"""
Prints a human-readable total out of a dumpfile produced
by gc.dump_rpy_heap(), and optionally a typeids.txt.
Syntax: dump.py <dumpfile> [<typeids.txt>]
By default, typeids.txt is loaded from the same dir as dumpfile.
"""
import array
import os
import struct
import sys
class Stat(objec... | mpl-2.0 | 57eda39c31cd4e5c01a6b981eadce2db | 29.504425 | 79 | 0.519002 | 3.366211 | false | false | false | false |
dbr/tvnamer | tvnamer/_titlecase.py | 1 | 3442 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# fmt: off
"""
Original Perl version by: John Gruber http://daringfireball.net/ 10 May 2008
Python version by Stuart Colville http://muffinresearch.co.uk
License: http://www.opensource.org/licenses/mit-license.php
"""
import re
__all__ = ['titlecase']
__version__ = '0.5... | unlicense | 48f2a80686652aef5f6396e1a69b8a91 | 31.742857 | 84 | 0.509889 | 3.111312 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactcore/factories/fsrs.py | 1 | 10488 | from datetime import date, datetime, timezone
import factory
from factory import fuzzy
from dataactcore.models import fsrs
class _FSRSAttributes(factory.Factory):
duns = fuzzy.FuzzyText()
uei_number = fuzzy.FuzzyText()
dba_name = fuzzy.FuzzyText()
principle_place_city = fuzzy.FuzzyText()
princip... | cc0-1.0 | 12768cdcbf34026c215e0a3106c79ac4 | 38.577358 | 83 | 0.705664 | 3.02684 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/4d8408c33fee_add_frec_to_user_model.py | 1 | 2519 | """add FREC to user model
Revision ID: 4d8408c33fee
Revises: da2e50d423ff
Create Date: 2017-07-06 13:19:01.155328
"""
# revision identifiers, used by Alembic.
revision = '4d8408c33fee'
down_revision = 'da2e50d423ff'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(... | cc0-1.0 | 9aa740485204676183f732de3572657b | 39.629032 | 127 | 0.675665 | 3.160602 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/812387580a0b_rename_user_permissions_column.py | 1 | 1298 | """rename user permissions column
Revision ID: 812387580a0b
Revises: a97dabbd44f4
Create Date: 2016-11-09 11:40:11.657516
"""
# revision identifiers, used by Alembic.
revision = '812387580a0b'
down_revision = 'a97dabbd44f4'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def ... | cc0-1.0 | 8879c51c91151e7e298ce544fabc1ca0 | 27.844444 | 128 | 0.693374 | 3.433862 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/11338a6b7e77_adding_business_categories_derivation_.py | 1 | 4287 | """Adding business categories derivation function
Revision ID: 11338a6b7e77
Revises: e26d14b0d235
Create Date: 2021-12-09 09:42:10.715687
"""
# revision identifiers, used by Alembic.
revision = '11338a6b7e77'
down_revision = 'e26d14b0d235'
branch_labels = None
depends_on = None
from alembic import op
import sqlalch... | cc0-1.0 | 22ac24043a80e0b4a9940305dd47d36d | 27.771812 | 94 | 0.504549 | 3.915068 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/d45dde2ba15b_alter_detached_regular_award_procurement.py | 1 | 4837 | """Alter and add many columns in DetachedAwardProcurement and AwardProcurement
Revision ID: d45dde2ba15b
Revises: 001758a1ab82
Create Date: 2018-03-09 14:08:13.058669
"""
# revision identifiers, used by Alembic.
revision = 'd45dde2ba15b'
down_revision = '001758a1ab82'
branch_labels = None
depends_on = None
from ale... | cc0-1.0 | d291a0d60ad6f598712ad00e1e45eaff | 59.4625 | 127 | 0.761422 | 3.408739 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/df2f541291a5_create_gtas_submission_window_table.py | 1 | 1146 | """Create gtas_submission_window table
Revision ID: df2f541291a5
Revises: 427320dea2ab
Create Date: 2017-07-06 12:06:53.946926
"""
# revision identifiers, used by Alembic.
revision = 'df2f541291a5'
down_revision = '427320dea2ab'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
... | cc0-1.0 | 23f64eca8a0b4769d555c34497fe52bf | 23.382979 | 63 | 0.680628 | 3.360704 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/4d66a8d6e11b_create_filerequest_table_for_d_file_.py | 1 | 2841 | """create FileRequest table for D file generation
Revision ID: 4d66a8d6e11b
Revises: bcdf1134f0df
Create Date: 2017-10-19 14:28:03.788883
"""
# revision identifiers, used by Alembic.
revision = '4d66a8d6e11b'
down_revision = 'bcdf1134f0df'
branch_labels = None
depends_on = None
from alembic import op
import sqlalch... | cc0-1.0 | a9064a67d1ac4888888d51de82b9b3f6 | 40.779412 | 107 | 0.675818 | 3.088043 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/7597deb348fb_fabs_created_at_and_fpds_updated_at_.py | 1 | 1251 | """FABS created_at and FPDS updated_at indexes
Revision ID: 7597deb348fb
Revises: b168f0cdc5a8
Create Date: 2018-02-06 16:08:20.985202
"""
# revision identifiers, used by Alembic.
revision = '7597deb348fb'
down_revision = 'b168f0cdc5a8'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy... | cc0-1.0 | 7ce4bf3c93c7df64e5f5b9b4c48d6cdf | 28.785714 | 149 | 0.717026 | 3.191327 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/scripts/load_duns_exec_comp.py | 1 | 14861 | import argparse
import datetime
import logging
import os
import re
import json
import tempfile
import boto3
import requests
from dataactcore.config import CONFIG_BROKER
from dataactcore.interfaces.db import GlobalDB
from dataactcore.interfaces.function_bag import update_external_data_load_date
from dataactcore.broker_... | cc0-1.0 | be7e7644638804e04662161a59c1cfb7 | 48.046205 | 120 | 0.631317 | 3.602667 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs33_1.py | 1 | 1700 | from tests.unit.dataactcore.factories.staging import FABSFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs33_1'
def test_column_headers(database):
expected_subset = {'row_number', 'period_of_performance_curr', 'uniqueid_AssistanceTransactionUniqueKey'}
actual... | cc0-1.0 | 353a34ed30d037cb3ab7dc150928bea1 | 50.515152 | 114 | 0.741765 | 3.359684 | false | true | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/5664b0e3e179_add_agency_name_and_sub_tier_agency_.py | 1 | 1469 | """Add agency name and sub-tier agency name to published award financial assistance
Revision ID: 5664b0e3e179
Revises: ce1087583081
Create Date: 2017-05-19 02:47:18.081619
"""
# revision identifiers, used by Alembic.
revision = '5664b0e3e179'
down_revision = 'ce1087583081'
branch_labels = None
depends_on = None
fro... | cc0-1.0 | 77d42f0b5f93174280fa94f7fbc5d341 | 34.829268 | 124 | 0.730429 | 3.041408 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/ae35bd44ec9a_add_multicolumn_indexes_to_published_.py | 1 | 1326 | """Add multicolumn indexes to published_award_financial_assistance
Revision ID: ae35bd44ec9a
Revises: 66ce64f4c1da
Create Date: 2018-09-19 09:15:27.852093
"""
# revision identifiers, used by Alembic.
revision = 'ae35bd44ec9a'
down_revision = '66ce64f4c1da'
branch_labels = None
depends_on = None
from alembic import ... | cc0-1.0 | 39bac2af114b0638f39d225e04724fe0 | 30.571429 | 170 | 0.711916 | 2.993228 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/6a7fa3623e2c_add_country_code_2_char_column_to_.py | 1 | 1112 | """Add country_code_2_char column to country_code table
Revision ID: 6a7fa3623e2c
Revises: 4d64c79360af
Create Date: 2021-08-25 13:55:39.566227
"""
# revision identifiers, used by Alembic.
revision = '6a7fa3623e2c'
down_revision = '4d64c79360af'
branch_labels = None
depends_on = None
from alembic import op
import s... | cc0-1.0 | 54ac27ab70892b1bff615ba2724bd9d9 | 25.47619 | 119 | 0.686151 | 3.106145 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/scripts/load_historical_published_flex_field.py | 1 | 7805 | import csv
import boto3
import datetime
import logging
import tempfile
import pandas as pd
from pandas import isnull
from sqlalchemy import func
from dataactcore.config import CONFIG_BROKER
from dataactcore.interfaces.db import GlobalDB
from dataactcore.broker_logging import configure_logging
from dataactcore.models.... | cc0-1.0 | bd253be04b2b61294cb2501f6e2d190c | 41.418478 | 120 | 0.665086 | 3.984176 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/d3c10a9f589a_create_states_table.py | 1 | 1124 | """Create States table
Revision ID: d3c10a9f589a
Revises: ff7c3328a4b1
Create Date: 2017-07-20 13:25:58.071561
"""
# revision identifiers, used by Alembic.
revision = 'd3c10a9f589a'
down_revision = 'ff7c3328a4b1'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(eng... | cc0-1.0 | 95eda7b8d8176ce5d35e7c5518c5b382 | 22.914894 | 63 | 0.658363 | 3.355224 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/models/domainModels.py | 1 | 22858 | from datetime import timedelta
import pandas as pd
import sqlalchemy as sa
from sqlalchemy import (Column, Date, DateTime, ForeignKey, Index, Integer, Numeric, Text, Float, UniqueConstraint,
Boolean, ARRAY)
from sqlalchemy.orm import relationship
from dataactcore.models.baseModel import Base
... | cc0-1.0 | 47f665049ef73b5cafc24c1e2b56bb01 | 37.940375 | 119 | 0.682999 | 3.380861 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_sf133_content.py | 1 | 14733 | import re
import os
from dataactcore.config import CONFIG_BROKER
from dataactvalidator.scripts import load_sf133
SF_RE = re.compile(r'sf_133_(?P<year>\d{4})_(?P<period>\d{2})\.csv')
line_sums = {}
def sum_range(tas, start, end, target, join_array, failed_validations, tas_str, extra_line=None):
""" Rule: sum of ... | cc0-1.0 | 96a0eba7670c660f00867b6c5eb3fe23 | 59.381148 | 120 | 0.524265 | 3.686015 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/bab396e50b1f_create_application_type_table_and_.py | 1 | 1549 | """create application_type table and update submission window
Revision ID: bab396e50b1f
Revises: 0ca75433c435
Create Date: 2017-08-03 14:45:39.186161
"""
# revision identifiers, used by Alembic.
revision = 'bab396e50b1f'
down_revision = '0ca75433c435'
branch_labels = None
depends_on = None
from alembic import op
im... | cc0-1.0 | 1cca37d49c5f3f238a1f44ff6871a522 | 29.98 | 152 | 0.701743 | 3.569124 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/06d5bc68c29a_making_historicduns_table.py | 1 | 2336 | """Making HistoricDuns table
Revision ID: 06d5bc68c29a
Revises: 653d47c65df8
Create Date: 2019-07-24 20:46:56.121706
"""
# revision identifiers, used by Alembic.
revision = '06d5bc68c29a'
down_revision = '653d47c65df8'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgra... | cc0-1.0 | 6981916847a50e1e3e3354ace1b1f2c8 | 34.938462 | 135 | 0.672517 | 3.073684 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/0cf297fa927c_adding_unique_transaction_keys_to_.py | 1 | 1146 | """Adding unique transaction keys to staging models
Revision ID: 0cf297fa927c
Revises: 94efce2e7882
Create Date: 2019-03-21 17:14:34.938006
"""
# revision identifiers, used by Alembic.
revision = '0cf297fa927c'
down_revision = '94efce2e7882'
branch_labels = None
depends_on = None
from alembic import op
import sqlal... | cc0-1.0 | d59185d14b39cea3ea47e6f747761d7e | 26.285714 | 108 | 0.707679 | 3.350877 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactbroker/helpers/pandas_helper.py | 1 | 2685 | import pandas as pd
import logging
from dataactcore.interfaces.db import GlobalDB
logger = logging.getLogger(__name__)
def check_dataframe_diff(new_data, model, del_cols, sort_cols, lambda_funcs=None):
""" Checks if 2 dataframes (the new data and the existing data for a model) are different.
Args:
... | cc0-1.0 | 1b0fca089649511a883c13727f998efd | 39.681818 | 116 | 0.676723 | 3.977778 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/interfaces/function_bag.py | 1 | 30559 | import logging
from operator import attrgetter
import time
import uuid
from datetime import datetime
from sqlalchemy import func, or_
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import NoResultFound
from dataactcore.aws.s3Handler import S3Handler
from dataactcore.config import CONFIG_BROKER
from dat... | cc0-1.0 | e68401b7bec390722455397445c19848 | 39.262187 | 119 | 0.637979 | 3.989946 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/0bf2ed508f33_add_state_city_and_county_name_to_.py | 1 | 1405 | """Add state, city, and county name to PublishedAwardFinancialAssistance table
Revision ID: 0bf2ed508f33
Revises: 2c2b9b1ff0e5
Create Date: 2017-07-21 13:05:06.714431
"""
# revision identifiers, used by Alembic.
revision = '0bf2ed508f33'
down_revision = '2c2b9b1ff0e5'
branch_labels = None
depends_on = None
from ale... | cc0-1.0 | 69aa37f27c5256cc13c0798e34c3a3fb | 30.931818 | 124 | 0.720996 | 3.178733 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactbroker/test_generic_helper.py | 1 | 6170 | import pytest
import datetime as dt
import os
import shutil
from filecmp import dircmp
from zipfile import ZipFile
from sqlalchemy import func, or_
from dataactbroker.helpers.generic_helper import (year_period_to_dates, generate_raw_quoted_query, fy, batch as batcher,
... | cc0-1.0 | 676452e24a035918bdaace57005e373c | 33.088398 | 120 | 0.64765 | 3.456583 | false | true | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/73db7d2cc754_add_award_procurement.py | 2 | 14550 | """add_award_procurement
Revision ID: 73db7d2cc754
Revises: 31876fecc214
Create Date: 2016-09-01 15:08:33.267152
"""
# revision identifiers, used by Alembic.
revision = '73db7d2cc754'
down_revision = '31876fecc214'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(e... | cc0-1.0 | c2a33b3a6d028929e5a49086eb36cb90 | 58.387755 | 117 | 0.68433 | 3.169935 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/fd0f86cc5705_fixing_extraneous_columns.py | 1 | 2083 | """fixing extraneous columns
Revision ID: fd0f86cc5705
Revises: 539307ecadea
Create Date: 2017-09-20 13:58:34.720047
"""
# revision identifiers, used by Alembic.
revision = 'fd0f86cc5705'
down_revision = '539307ecadea'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgra... | cc0-1.0 | db7e0a854db347bc222ceaaebc6f73e8 | 40.66 | 144 | 0.731637 | 3.194785 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_b19_object_class_program_activity.py | 1 | 12345 | from dataactcore.models.stagingModels import ObjectClassProgramActivity
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'b19_object_class_program_activity'
def test_column_headers(database):
expected_subset = {'row_number', 'beginning_period_of_availa', 'ending_period_of_av... | cc0-1.0 | b474d066b4617903d8505ce4857c22d4 | 72.922156 | 117 | 0.530741 | 4.105421 | false | false | false | false |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_a3_appropriations.py | 1 | 1790 | from tests.unit.dataactcore.factories.staging import AppropriationFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'a3_appropriations'
def test_column_headers(database):
expected_subset = {'uniqueid_TAS', 'row_number', 'other_budgetary_resources_cpe', 'contract_author... | cc0-1.0 | c880ba1c954a7a62a590058a99c86577 | 51.647059 | 118 | 0.69162 | 3.587174 | false | true | false | false |
fedspendingtransparency/data-act-broker-backend | dataactcore/models/validationModels.py | 1 | 3738 | """ These classes define the ORM models to be used by sqlalchemy for the job tracker database """
from sqlalchemy import Column, Integer, Text, ForeignKey, Boolean, Enum
from sqlalchemy.orm import relationship
from dataactcore.models.baseModel import Base
class FieldType(Base):
__tablename__ = "field_type"
... | cc0-1.0 | 2baaaab6e76104201857b2db02590999 | 37.536082 | 115 | 0.692349 | 3.611594 | false | false | false | false |
purduesigbots/pros-cli | pros/serial/devices/vex/stm32_device.py | 1 | 7686 | import itertools
import operator
import struct
import time
import typing
from functools import reduce
from typing import *
import pros.common.ui as ui
from pros.common import logger, retries
from pros.serial import bytes_to_str
from pros.serial.devices.vex import VEXCommError
from pros.serial.ports import BasePort
fr... | mpl-2.0 | 563af08c95bbde1be97afb119f03b933 | 39.240838 | 113 | 0.579235 | 3.541935 | false | false | false | false |
purduesigbots/pros-cli | pros/cli/main.py | 1 | 3332 | import logging
# Setup analytics first because it is used by other files
import os.path
import pros.common.sentry
import click
import sys
import pros.common.ui as ui
import pros.common.ui.log
from pros.cli.click_classes import *
from pros.cli.common import default_options, root_commands
from pros.common.utils impo... | mpl-2.0 | 1f7cd4a1d68d96842c5a5a3f17ad2558 | 28.22807 | 138 | 0.663866 | 3.375887 | false | false | false | false |
purduesigbots/pros-cli | pros/conductor/interactive/UpdateProjectModal.py | 1 | 6239 | import os.path
from typing import *
from click import Context, get_current_context
from semantic_version import Version
from pros.common import ui
from pros.common.ui.interactive import application, components, parameters
from pros.conductor import BaseTemplate, Conductor, Project
from pros.conductor.project.ProjectT... | mpl-2.0 | 80e25e86760ea71d98cf14df156880c9 | 41.442177 | 116 | 0.633916 | 4.456429 | false | false | false | false |
purduesigbots/pros-cli | pros/serial/devices/vex/v5_device.py | 1 | 50297 | import gzip
import io
import re
import struct
import time
import typing
from collections import defaultdict
from configparser import ConfigParser
from datetime import datetime, timedelta
from enum import IntEnum, IntFlag
from io import BytesIO, StringIO
from pathlib import Path
from typing import *
from typing import B... | mpl-2.0 | 5ef9d59d95974def2a0f2e8b64faf1d3 | 48.214286 | 151 | 0.575919 | 3.839759 | false | false | false | false |
eregs/regulations-parser | tests/notice_sxs_tests.py | 3 | 23353 | # vim: set encoding=utf-8
from unittest import TestCase
from lxml import etree
from regparser.notice import sxs
class NoticeSxsTests(TestCase):
def test_find_page(self):
xml = """<ROOT>
<P />
Text
<P />
<PRTPAGE P="333" />
<P />
<PR... | cc0-1.0 | 3de1251fd72b47e365b48aaa04e02e59 | 39.326425 | 78 | 0.511671 | 3.677008 | false | false | false | false |
eregs/regulations-parser | regparser/tree/struct.py | 3 | 11524 | import hashlib
import re
from json import JSONEncoder
import six
from lxml import etree
from regparser.tree.depth.markers import MARKERLESS
class Node(object):
APPENDIX = u'appendix'
INTERP = u'interp'
REGTEXT = u'regtext'
SUBPART = u'subpart'
EMPTYPART = u'emptypart'
EXTRACT = u'extract'
... | cc0-1.0 | 3d461f627e42a8423a2502e6ccf84a40 | 31.370787 | 79 | 0.590073 | 3.909091 | false | false | false | false |
eregs/regulations-parser | regparser/grammar/tokens.py | 3 | 4697 | """ Set of Tokens to be used when parsing.
@label is a list describing the depth of a paragraph/context. It follows:
[ Part, Subpart/Appendix/Interpretations, Section, p-level-1, p-level-2,
p-level-3, p-level4, p-level5 ]
"""
import attr
import six
def uncertain_label(label_parts):
"""Convert a list o... | cc0-1.0 | aff4fcdf545c971ba132a1b99c981ce1 | 34.854962 | 78 | 0.642751 | 3.856322 | false | false | false | false |
eregs/regulations-parser | regparser/notice/xml.py | 2 | 18106 | """Functions for processing the xml associated with the Federal Register's
notices"""
import logging
import os
from collections import namedtuple
from datetime import date, datetime
import requests
from cached_property import cached_property
from lxml import etree
from six.moves.urllib.parse import urlparse
from regp... | cc0-1.0 | 36c2685616672a99be5dbecdb98d39b2 | 36.958071 | 79 | 0.589473 | 3.764241 | false | false | false | false |
eregs/regulations-parser | tests/commands_fetch_sxs_tests.py | 3 | 2201 | # @todo - right now this is a copy-paste from parse_rule_changes. SxS and
# rule changes will develop different data structures, however, so these files
# will diverge soon
from unittest import TestCase
import pytest
from click.testing import CliRunner
from lxml import etree
from mock import patch
from regparser.comm... | cc0-1.0 | 71f08f8b39d107d47f3df0ea33537d0f | 39.759259 | 78 | 0.652431 | 3.788296 | false | true | false | false |
eregs/regulations-parser | regparser/tree/depth/optional_rules.py | 3 | 4861 | """Depth derivation has a mechanism for _optional_ rules. This module contains
a collection of such rules. All functions should accept two parameters; the
latter is a list of all variables in the system; the former is a function
which can be used to constrain the variables. This allows us to define rules
over subsets o... | cc0-1.0 | 5e72b0759e23676cae530cb5ae2a5292 | 41.269565 | 78 | 0.630323 | 3.961695 | false | false | false | false |
eregs/regulations-parser | regparser/web/management/commands/eregs.py | 2 | 1246 | import logging
import os
import sys
import click
import coloredlogs
import ipdb
from django.core import management
from django.db import connections
from django.db.migrations.loader import MigrationLoader
from djclick.adapter import BaseRegistrator, DjangoCommandMixin
from regparser.commands.retry import RetryingComm... | cc0-1.0 | e3f66131fa0c7cc7ed252a0a6ceb999c | 30.948718 | 79 | 0.741573 | 3.857585 | false | false | false | false |
eregs/regulations-parser | regparser/tree/gpo_cfr/section.py | 3 | 9764 | # -*- coding: utf-8 -*-
import re
import pyparsing
import six
from regparser.citations import remove_citation_overlaps
from regparser.grammar import unified
from regparser.grammar.utils import QuickSearchable
from regparser.tree.depth import markers as mtypes
from regparser.tree.depth import optional_rules
from regpa... | cc0-1.0 | fb7a4fd38fa4dedbb94d46e2ca25ff54 | 36.375479 | 79 | 0.61999 | 3.845093 | false | false | false | false |
eregs/regulations-parser | regparser/commands/layers.py | 3 | 3662 | import logging
import click
from stevedore.extension import ExtensionManager
from regparser.commands import utils
from regparser.index import dependency, entry
logger = logging.getLogger(__name__)
def _init_classes():
"""Avoid leaking state variables by wrapping `LAYER_CLASSES` construction
in a function""... | cc0-1.0 | e465679b239546288e2859e8c409a4c9 | 36.752577 | 78 | 0.666303 | 3.691532 | false | false | false | false |
noisyboiler/wampy | test/integration/roles/test_callers.py | 1 | 3838 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
from datetime import date
import pytest
from wampy.backends import get_async_adapter
from wampy.errors... | mpl-2.0 | a656f066568fe204271d59a1b7e5abf8 | 25.108844 | 79 | 0.637832 | 3.641366 | false | true | false | false |
noisyboiler/wampy | wampy/messages/register.py | 1 | 1217 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import random
class Register(object):
""" A Callee announces the availability of an endpoint implementing
a pr... | mpl-2.0 | 82d22891734a4faa80ea8441f555ebd9 | 28.682927 | 71 | 0.645029 | 3.990164 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.