repo_name stringlengths 7 65 | path stringlengths 5 187 | copies stringclasses 483
values | size stringlengths 4 7 | content stringlengths 805 1.02M | license stringclasses 14
values |
|---|---|---|---|---|---|
mozilla/normandy | contract-tests/v3_api/test_group_update.py | 1 | 1210 | import uuid
from support.assertions import assert_valid_schema
from urllib.parse import urljoin
def test_group_update(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 |
mozilla/normandy | normandy/conftest.py | 1 | 3099 | from django.core.management import call_command
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
import pytest
import requests_mock
from graphene.test import Client as GrapheneClient
from rest_framework.test import APIClient
from normandy.schema import schema as normandy_sc... | mpl-2.0 |
mozilla/normandy | normandy/base/tests/test_checks.py | 1 | 1449 | import pytest
from django.core.checks.registry import run_checks
from normandy.base import checks as base_checks
from normandy.recipes import checks as recipe_checks, geolocation as geolocation_module
@pytest.mark.django_db
def test_run_checks_happy_path():
errors = set(e.id for e in run_checks())
expected ... | mpl-2.0 |
mozilla/normandy | normandy/base/tests/test_auth_backends.py | 1 | 3238 | import pytest
from django.test import RequestFactory
from normandy.base.auth_backends import (
INFO_LOGIN_SUCCESS,
LoggingModelBackend,
EmailOnlyRemoteUserBackend,
WARNING_LOGIN_FAILURE,
)
from normandy.base.tests import UserFactory, Whatever
class TestLoggingModelBackend(object):
@pytest.fixtur... | mpl-2.0 |
mozilla/normandy | normandy/recipes/tests/test_signing.py | 1 | 17765 | import base64
import os
from datetime import datetime, timedelta
from unittest.mock import MagicMock, call
from django.core.exceptions import ImproperlyConfigured
import pytest
import pytz
from pyasn1.type import useful as pyasn1_useful
from pyasn1_modules import rfc5280
from normandy.base.tests import Whatever
from... | mpl-2.0 |
mozilla/normandy | normandy/recipes/migrations/0005_auto_20180503_2146.py | 1 | 2487 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-05-03 21:46
from __future__ import unicode_literals
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 = [("recip... | mpl-2.0 |
mozilla/normandy | normandy/base/tests/test_utils.py | 1 | 2452 | import json
from normandy.base.utils import canonical_json_dumps, get_client_ip, sri_hash
class TestGetClientIp(object):
def test_no_proxies(self, rf, settings):
"""If there are no proxies, REMOTE_ADDR should be used."""
settings.NUM_PROXIES = 0
client_ip = "1.1.1.1"
req = rf.get(... | mpl-2.0 |
mozilla/normandy | contract-tests/v3_api/test_approval_request_close.py | 1 | 1496 | from support.assertions import assert_valid_schema
from support.helpers import new_recipe
from urllib.parse import urljoin
def test_approval_request_close(conf, requests_session, headers):
# Get an action we can work with
action_response = requests_session.get(
urljoin(conf.getoption("server"), "/api/... | mpl-2.0 |
mozilla/normandy | normandy/recipes/migrations/0014_auto_20190228_1128.py | 1 | 2576 | # Generated by Django 2.0.13 on 2019-02-28 11:28
import json
import sys
from urllib.parse import unquote_plus, urlparse
from django.db import migrations
def get_filename_from_url(url):
return unquote_plus(urlparse(url).path.split("/")[-1])
def add_extension_id(apps, schema_editor):
Action = apps.get_mode... | mpl-2.0 |
mozilla/normandy | normandy/recipes/tests/test_schema.py | 1 | 2480 | import pytest
from normandy.base.tests import GQ
from normandy.recipes.tests import ActionFactory, ApprovalRequestFactory, RecipeFactory
@pytest.mark.django_db
class TestQuery(object):
def test_resolve_all_action(self, gql_client):
a = ActionFactory()
res = gql_client.execute(GQ().query.allAction... | mpl-2.0 |
developmentseed/landsat-util | setup.py | 1 | 1158 | #!/usr/bin/env python
# Landsat Util
# License: CC0 1.0 Universal
try:
from setuptools import setup
setup_kwargs = {'entry_points': {'console_scripts':['landsat=landsat.landsat:__main__']}}
except ImportError:
from distutils.core import setup
setup_kwargs = {'scripts': ['bin/landsat']}
from land... | cc0-1.0 |
developmentseed/landsat-util | landsat/mixins.py | 3 | 2950 | # Pansharpened Image Process using Rasterio
# Landsat Util
# License: CC0 1.0 Universal
from __future__ import print_function, division, absolute_import
import sys
import subprocess
from termcolor import colored
class VerbosityMixin(object):
"""
Verbosity Mixin that generates beautiful stdout outputs.
"... | cc0-1.0 |
rmmh/skybot | plugins/seen.py | 3 | 3063 | " seen.py: written by sklnd in about two beers July 2009"
from builtins import object
import time
import unittest
from util import hook, timesince
def db_init(db):
"check to see that our db has the the seen table and return a connection."
db.execute(
"create table if not exists seen(name, time, quot... | unlicense |
rmmh/skybot | test/plugins/test_choose.py | 3 | 1458 | from unittest import TestCase
from mock import patch
from choose import choose
class TestChoose(TestCase):
def test_choose_one_choice(self):
expected = "the decision is up to you"
actual = choose("foo")
assert expected == actual
def test_choose_same_thing(self):
expected = "... | unlicense |
rmmh/skybot | core/irc.py | 3 | 10652 | from __future__ import print_function
from builtins import map
from builtins import object
import re
import socket
import time
import _thread
import queue
from ssl import wrap_socket, CERT_NONE, CERT_REQUIRED, SSLError
DEFAULT_NAME = "skybot"
DEFAULT_REALNAME = "Python bot - http://github.com/rmmh/skybot"
DEFAULT_NI... | unlicense |
rmmh/skybot | plugins/util/http.py | 3 | 5942 | from future.standard_library import hooks
from lxml import etree, html
import binascii
import collections
import hmac
import json
import random
import time
from hashlib import sha1
from builtins import str
from builtins import range
try:
from http.cookiejar import CookieJar
except:
from future.backports.ht... | unlicense |
rmmh/skybot | plugins/crowdcontrol.py | 3 | 1132 | # crowdcontrol.py by craisins in 2014
# Bot must have some sort of op or admin privileges to be useful
import re
import time
from util import hook
# Use "crowdcontrol" array in config
# syntax
# rule:
# re: RegEx. regular expression to match
# msg: String. message to display either with kick or as a warning
# k... | unlicense |
pytube/pytube | pytube/query.py | 1 | 12622 | """This module provides a query interface for media streams and captions."""
from collections.abc import Mapping, Sequence
from typing import Callable, List, Optional, Union
from pytube import Caption, Stream
from pytube.helpers import deprecated
class StreamQuery(Sequence):
"""Interface for querying the availab... | unlicense |
pytube/pytube | pytube/innertube.py | 1 | 11658 | """This module is designed to interact with the innertube API.
This module is NOT intended to be used directly by end users, as each of the
interfaces returns raw results. These should instead be parsed to extract
the useful information for the end user.
"""
# Native python imports
import json
import os
import pathlib... | unlicense |
pytube/pytube | tests/test_request.py | 1 | 1820 | import socket
import os
import pytest
from unittest import mock
from urllib.error import URLError
from pytube import request
from pytube.exceptions import MaxRetriesExceeded
@mock.patch("pytube.request.urlopen")
def test_streaming(mock_urlopen):
# Given
fake_stream_binary = [
os.urandom(8 * 1024),
... | unlicense |
pytube/pytube | pytube/contrib/playlist.py | 1 | 14204 | """Module to download a complete playlist from a youtube channel."""
import json
import logging
from collections.abc import Sequence
from datetime import date, datetime
from typing import Dict, Iterable, List, Optional, Tuple, Union
from pytube import extract, request, YouTube
from pytube.helpers import cache, Deferre... | unlicense |
mozilla-iam/cis | python-modules/cis_profile/tests/test_fake_profile.py | 1 | 2844 | import pytest
from boto3.dynamodb.types import TypeDeserializer
from cis_profile import fake_profile
from cis_profile import profile
from cis_profile import exceptions
class TestFakeProfile(object):
def test_fake_user(self):
u = fake_profile.FakeUser()
print(u.user_id.value)
j = u.as_json... | mpl-2.0 |
mozilla-iam/cis | python-modules/cis_crypto/cis_crypto/cli.py | 1 | 3035 | #!/usr/bin/env python3
import argparse
import jose
import logging
import sys
from cis_crypto import common
from cis_crypto import operation
class cli:
def __init__(self):
self.config = None
self.prog = sys.argv[0].split("/")[-1]
def parse_args(self, args):
parser = argparse.ArgumentP... | mpl-2.0 |
mozilla-iam/cis | python-modules/cis_notifications/cis_notifications/event.py | 1 | 5547 | import logging
import time
import requests
from cis_notifications import common
from cis_notifications import secret
logger = logging.getLogger(__name__)
def expired(ts, leeway=0):
return ts < time.time() + leeway
class Event(object):
"""Handle events from lambda and generate hooks out to publishers."""
... | mpl-2.0 |
mozilla-iam/cis | python-modules/cis_logger/setup.py | 1 | 1188 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
requirements = ["python-json-logger", "everett", "everett[ini]"]
test_requirements = ["pytest", "pytest-watch", "pytest-cov", "flake8", "flask", "flask_graphql... | mpl-2.0 |
mozilla-iam/cis | python-modules/cis_crypto/cis_crypto/secret.py | 1 | 5055 | """Class for following a default provider chain in the fetching of key material for sign/verify operations."""
import boto3
import json
import os
import logging
import time
from cis_crypto import common
from jose import jwk
from botocore.exceptions import ClientError
logger = logging.getLogger(__name__)
class Manag... | mpl-2.0 |
mozilla-iam/cis | python-modules/cis_profile_retrieval_service/cis_profile_retrieval_service/schema.py | 1 | 1800 | import json
import graphene
import cis_profile.graphene
from cis_identity_vault.models import user
from cis_profile_retrieval_service.common import get_table_resource
def is_json(payload):
"""Check if a payload is valid JSON."""
try:
json.loads(payload)
except (TypeError, ValueError):
retu... | mpl-2.0 |
mozilla-iam/cis | python-modules/cis_profile/tests/test_well_known.py | 1 | 1091 | from cis_profile.common import WellKnown
from cis_profile.profile import User
import os
class Test_WellKnown(object):
def test_wellknown_file_force(self):
wk = WellKnown(always_use_local_file=True)
data = wk.get_well_known()
assert isinstance(data, dict)
assert isinstance(data.get(... | mpl-2.0 |
mozilla-iam/cis | python-modules/cis_crypto/setup.py | 1 | 1388 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
requirements = [
"python-jose[cryptography]",
"cryptography",
"everett",
"everett[ini]",
"configobj",
"boto3",
"boto",
"botocor... | mpl-2.0 |
mozilla-iam/cis | python-modules/cis_change_service/tests/test_api.py | 1 | 18809 | import json
import logging
import mock
import os
import random
import subprocess
import string
import cis_profile
from cis_profile import common
from cis_profile import FakeUser
from cis_profile.fake_profile import FakeProfileConfig
from cis_profile import profile
from datetime import datetime
from datetime import time... | mpl-2.0 |
ibm-watson-iot/iot-python | test/test_api_registry_devices_ext.py | 2 | 3189 | # *****************************************************************************
# 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 |
ibm-watson-iot/iot-python | src/wiotp/sdk/device/client.py | 2 | 4102 | # *****************************************************************************
# Copyright (c) 2014, 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 distrib... | epl-1.0 |
ibm-watson-iot/iot-python | test/test_api_registry_devicetypes.py | 2 | 6161 | # *****************************************************************************
# 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 |
ibm-watson-iot/iot-python | test/test_api_state_logical_interfaces.py | 2 | 7820 | # *****************************************************************************
# 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 |
ibm-watson-iot/iot-python | test/test_codecs_utf8.py | 2 | 1309 | # *****************************************************************************
# 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 |
ibm-watson-iot/iot-python | src/wiotp/sdk/application/client.py | 2 | 21444 | # *****************************************************************************
# Copyright (c) 2014, 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 distrib... | epl-1.0 |
ibm-watson-iot/iot-python | src/wiotp/sdk/gateway/client.py | 2 | 6109 | # *****************************************************************************
# 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 distrib... | epl-1.0 |
ibm-watson-iot/iot-python | samples/deviceFactory/deviceStatus.py | 2 | 3130 | #!/usr/bin/env python
# *****************************************************************************
# 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 accompa... | epl-1.0 |
ibm-watson-iot/iot-python | src/wiotp/sdk/device/managedClient.py | 2 | 27070 | # *****************************************************************************
# Copyright (c) 2014, 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 distrib... | epl-1.0 |
ibm-watson-iot/iot-python | test/test_device.py | 2 | 9913 | # *****************************************************************************
# Copyright (c) 2016-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 distribu... | epl-1.0 |
ibm-watson-iot/iot-python | src/wiotp/sdk/gateway/messages.py | 2 | 2136 | # *****************************************************************************
# 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 |
mbj4668/pyang | pyang/transforms/edit.py | 1 | 12718 | """Edit transform plugin
This plugin currently has quite limited functionality. Only some specific
top-level items can be edited, and only existing statements are edited.
"""
import copy
import optparse
import re
import sys
from pyang import error
from pyang import plugin
from pyang import statements
plugin_name = ... | isc |
mbj4668/pyang | pyang/syntax.py | 1 | 15064 | """Description of YANG & YIN syntax."""
import os
import re
import shlex
import sys
import datetime
### Regular expressions - constraints on arguments
# keywords and identifiers
identifier = r"[_A-Za-z][._\-A-Za-z0-9]*"
prefix = identifier
keyword = '((' + prefix + '):)?(' + identifier + ')'
comment = r'(/\*([^*]|[\... | isc |
mbj4668/pyang | pyang/translators/yin.py | 1 | 6251 | """YIN output plugin"""
from xml.sax.saxutils import quoteattr
from xml.sax.saxutils import escape
import optparse
import re
from .. import plugin
from .. import util
from .. import grammar
from .. import syntax
from .. import statements
yin_namespace = "urn:ietf:params:xml:ns:yang:yin:1"
def pyang_plugin_init():
... | isc |
rdegges/django-twilio | test_project/test_app/client.py | 1 | 1200 | # -*- coding: utf-8 -*-
from django.test import TestCase
from django.contrib.auth.models import User
from django.conf import settings
from twilio.rest import Client
from django_dynamic_fixture import G
from django_twilio.client import twilio_client
from django_twilio.models import Credential
from django_twilio.utils... | unlicense |
rdegges/django-twilio | test_project/settings.py | 1 | 6114 | # -*- coding: utf-8 -*-
import sys
# Django settings for test_project project.
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import django
import packaging.version
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
ADMINS = (
# ('Your Na... | unlicense |
mozilla-services/buildhub | jobs/tests/test_lambda_s3_event_functional.py | 1 | 4418 | # 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 unittest
import os
import json
import kinto_http
from decouple import config
from buildhub import lambda_s3_eve... | mpl-2.0 |
pikepdf/pikepdf | src/pikepdf/models/encryption.py | 1 | 5651 | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""For managing PDF encryption."""
from __future__ import annotations
import sys
from typing import TYPE_CHECKING, Any, NamedTuple, cast
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions im... | mpl-2.0 |
mail-in-a-box/mailinabox | management/dns_update.py | 1 | 46993 | #!/usr/local/lib/mailinabox/env/bin/python
# Creates DNS zone files for all of the domains of all of the mail users
# and mail aliases and restarts nsd.
########################################################################
import sys, os, os.path, urllib.parse, datetime, re, hashlib, base64
import ipaddress
import... | cc0-1.0 |
mcedit/pymclevel | mce.py | 2 | 47597 | #!/usr/bin/env python
import mclevelbase
import mclevel
import materials
import infiniteworld
import sys
import os
from box import BoundingBox, Vector
import numpy
from numpy import zeros, bincount
import logging
import itertools
import traceback
import shlex
import operator
import codecs
from math import floor
try:
... | isc |
mcedit/pymclevel | box.py | 3 | 6660 | from collections import namedtuple
import itertools
import math
_Vector = namedtuple("_Vector", ("x", "y", "z"))
class Vector(_Vector):
__slots__ = ()
def __add__(self, other):
return Vector(self[0] + other[0], self[1] + other[1], self[2] + other[2])
def __sub__(self, other):
return Vec... | isc |
mcedit/mcedit | albow/file_dialogs.py | 1 | 9481 | # -*- coding: utf-8 -*-
#
# Albow - File Dialogs
#
import os
from pygame import draw, Rect
from pygame.locals import *
from albow.widget import Widget
from albow.dialogs import Dialog, ask, alert
from albow.controls import Label, Button
from albow.fields import TextField
from albow.layout import Row, Column
from alb... | isc |
mozilla-services/tecken | tecken/upload/views.py | 1 | 18470 | # 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 re
import logging
import fnmatch
import zipfile
import hashlib
import os
import time
import concurrent.futures
... | mpl-2.0 |
mozilla-services/tecken | tecken/api/urls.py | 1 | 1554 | # 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 django.urls import path
from . import views
app_name = "api"
# NOTE(peterbe): The endpoints that start with a ... | mpl-2.0 |
mozilla-services/tecken | bin/debug-sym-file.py | 1 | 1332 | #!/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/.
# Prints information about a sym file including whether it kicks up
# a parse error.
# Usage: d... | mpl-2.0 |
pimutils/todoman | tests/test_backend.py | 1 | 3329 | from datetime import date
from datetime import datetime
import icalendar
import pytest
import pytz
from dateutil.tz import tzlocal
from freezegun import freeze_time
from todoman.model import Todo
from todoman.model import VtodoWriter
def test_datetime_serialization(todo_factory, tmpdir):
now = datetime(2017, 8,... | isc |
pimutils/todoman | todoman/formatters.py | 1 | 9862 | import json
from datetime import date
from datetime import datetime
from datetime import timedelta
from time import mktime
from typing import Iterable
from typing import Optional
from typing import Union
import click
import humanize
import parsedatetime
import pytz
from dateutil.tz import tzlocal
from todoman.model i... | isc |
pimutils/todoman | todoman/model.py | 1 | 35300 | from __future__ import annotations
import logging
import os
import socket
import sqlite3
from datetime import date
from datetime import datetime
from datetime import time
from datetime import timedelta
from os.path import normpath
from os.path import split
from typing import Iterable
from uuid import uuid4
import ica... | isc |
pimutils/todoman | tests/test_config.py | 2 | 4629 | from unittest.mock import patch
import pytest
from click.testing import CliRunner
from todoman.cli import cli
from todoman.configuration import ConfigurationException
from todoman.configuration import load_config
def test_explicit_nonexistant(runner):
result = CliRunner().invoke(
cli,
env={"TODO... | isc |
mozilla-services/autopush | autopush/logging.py | 1 | 9732 | """Custom Logging Setup
"""
import io
import json
import Queue
import pkg_resources
import socket
import sys
import time
import threading
from typing import Any # noqa
import boto3
import raven
from raven.transport.twisted import TwistedHTTPTransport
from raven.utils.stacks import iter_stack_frames
from twisted.inter... | mpl-2.0 |
mozilla-services/autopush | autopush/jwt.py | 1 | 4878 | import base64
import binascii
import json
import os
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.primitives.asymmetric import ec, utils
from cryptography.hazmat.primitives import hashes
from pyasn1.error import PyAsn1Error
from twisted.logger import Logger
from typing import Tuple # n... | mpl-2.0 |
mozilla-services/autopush | autopush/http.py | 1 | 7885 | """HTTP Server Protocol Factories on top of cyclone"""
from typing import ( # noqa
Any,
Callable,
Dict,
Optional,
Sequence,
Tuple,
Type
)
import cyclone.web
from twisted.internet import reactor
from twisted.web.client import (
_HTTP11ClientFactory,
Agent,
HTTPConnectionPool,
)
... | mpl-2.0 |
mozilla-services/autopush | autopush/ssl.py | 1 | 5050 | """Custom SSL configuration"""
from __future__ import absolute_import
import socket # noqa
import ssl
from typing import ( # noqa
Any,
Dict,
FrozenSet,
Optional,
Tuple,
)
from OpenSSL import SSL
from twisted.internet.ssl import DefaultOpenSSLContextFactory
try:
SSL_PROTO = ssl.PROTOCOL_TLS
e... | mpl-2.0 |
mozilla-services/autopush | autopush/router/apns2.py | 1 | 7384 | import json
from collections import deque
from decimal import Decimal
import hyper.tls
from hyper import HTTP20Connection
from hyper.http20.exceptions import HTTP20Error
from autopush.exceptions import RouterException
SANDBOX = 'api.development.push.apple.com'
SERVER = 'api.push.apple.com'
APNS_MAX_CONNECTIONS = 2... | mpl-2.0 |
mozilla-services/autopush | autopush/config.py | 1 | 16793 | """Autopush Config Object and Setup"""
import json
import socket
from argparse import Namespace # noqa
from hashlib import sha256
from typing import ( # noqa
Any,
Dict,
List,
Optional,
Type,
Union
)
from attr import (
attrs,
attrib,
Factory
)
from cryptography.fernet import Fernet... | mpl-2.0 |
mozilla-services/autopush | autopush/tests/test_metrics.py | 1 | 3703 | import unittest
import twisted.internet.base
import pytest
from mock import Mock, patch, call
from autopush.metrics import (
IMetrics,
DatadogMetrics,
TwistedMetrics,
SinkMetrics,
periodic_reporter,
)
class IMetricsTestCase(unittest.TestCase):
def test_default(self):
im = IMetrics()
... | mpl-2.0 |
mozilla-services/autopush | autopush/tests/test_z_main.py | 1 | 16788 | """Test main instantiation
This is named test_z_main.py to run it last. Due to issues in this test, the
testing environment is unclean and no further tests can be run reliably.
"""
import unittest
import datetime
import json
from mock import Mock, patch
import pytest
from twisted.internet.defer import Deferred
from ... | mpl-2.0 |
unitedstates/congress | congress/tasks/bill_info.py | 1 | 50773 | from congress.tasks import utils
import logging
import re
import json
from lxml import etree
import copy
import datetime
def create_govtrack_xml(bill, options):
govtrack_type_codes = {'hr': 'h', 's': 's', 'hres': 'hr', 'sres': 'sr', 'hjres': 'hj', 'sjres': 'sj', 'hconres': 'hc', 'sconres': 'sc'}
root = etree.... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/mock_helpers.py | 1 | 1924 | from unittest.mock import Mock
class DynamicObject:
pass
class MockFilter(object): # This is the ONE parameter constructor
def __init__(self):
self._count = 0
self._first = DynamicObject()
def first(self): # This is the another method that's just coming along for the ride.
ret... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_c23_award_financial_4.py | 1 | 7997 | from random import choice
from string import ascii_uppercase, ascii_lowercase, digits
from tests.unit.dataactcore.factories.staging import AwardFinancialFactory, AwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'c23_award_financial_4'
def test_col... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/c42d328ef2fa_add_frec_code_to_submission_model.py | 1 | 1050 | """add frec_code to submission model
Revision ID: c42d328ef2fa
Revises: 4d8408c33fee
Create Date: 2017-07-10 13:16:56.855163
"""
# revision identifiers, used by Alembic.
revision = 'c42d328ef2fa'
down_revision = '4d8408c33fee'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
d... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/4a1988f74a78_add_detached_d2_submission_models.py | 1 | 7389 | """add detached D2 submission models
Revision ID: 4a1988f74a78
Revises: 4bf29ae16467
Create Date: 2017-01-20 11:40:50.782401
"""
# revision identifiers, used by Alembic.
revision = '4a1988f74a78'
down_revision = '4bf29ae16467'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
d... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/2ae156c8f46d_update_d1_and_d2_for_daims_v1_1.py | 1 | 4727 | """update d1 and d2 for daims v1.1
Revision ID: 2ae156c8f46d
Revises: 4b1ee78268fb
Create Date: 2017-08-28 15:16:00.926683
"""
# revision identifiers, used by Alembic.
revision = '2ae156c8f46d'
down_revision = '4b1ee78268fb'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs37_1.py | 1 | 3684 | from tests.unit.dataactcore.factories.staging import FABSFactory
from dataactcore.models.domainModels import CFDAProgram
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs37_1'
def test_column_headers(database):
expected_subset = {'row_number', 'cfda_number', 'action_date... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_load_usps_files.py | 1 | 5408 | import urllib.parse
import pytest
import json
import re
from datetime import datetime
from unittest.mock import MagicMock
from dataactcore.models.domainModels import ExternalDataLoadDate
from dataactcore.models.lookups import EXTERNAL_DATA_TYPE_DICT
from dataactvalidator.scripts.load_usps_files import get_payload_str... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/4be5e411246b_adding_principle_place_street_to_.py | 1 | 1093 | """Adding principle place street to subaward
Revision ID: 4be5e411246b
Revises: 87d7a9b0ea7b
Create Date: 2019-08-07 15:13:50.092991
"""
# revision identifiers, used by Alembic.
revision = '4be5e411246b'
down_revision = '87d7a9b0ea7b'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy a... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactbroker/routes/file_routes.py | 1 | 14201 | from flask import request
from webargs import fields as webargs_fields, validate as webargs_validate
from webargs.flaskparser import use_kwargs
from dataactbroker.handlers.fileHandler import (
FileHandler, get_status, list_submissions as list_submissions_handler,
list_published_files as list_published_files_ha... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/3b9dffe063a6_create_zips_grouped_table_and_add_.py | 1 | 2745 | """Create zips_grouped table and add multicolumn index to zips table
Revision ID: 3b9dffe063a6
Revises: be4dcb9eede6
Create Date: 2020-08-03 11:48:55.068356
"""
# revision identifiers, used by Alembic.
revision = '3b9dffe063a6'
down_revision = 'be4dcb9eede6'
branch_labels = None
depends_on = None
from alembic impor... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs32_2.py | 1 | 1706 | from tests.unit.dataactcore.factories.staging import FABSFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs32_2'
def test_column_headers(database):
expected_subset = {'row_number', 'period_of_performance_star', 'uniqueid_AssistanceTransactionUniqueKey'}
actual... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/1e0b1d3e3cca_d_model_to_text.py | 2 | 3725 | """d-model-to-text
Revision ID: 1e0b1d3e3cca
Revises: 1ae491ca0925
Create Date: 2016-09-08 09:34:56.153584
"""
# revision identifiers, used by Alembic.
revision = '1e0b1d3e3cca'
down_revision = '1ae491ca0925'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(engine_... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs13_1.py | 1 | 1673 | from tests.unit.dataactcore.factories.staging import FABSFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs13_1'
def test_column_headers(database):
expected_subset = {'row_number', 'record_type', 'legal_entity_zip5', 'uniqueid_AssistanceTransactionUniqueKey'}
... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactbroker/helpers/filters_helper.py | 1 | 6379 | from sqlalchemy import or_, and_
from flask import g
from dataactcore.models.lookups import FILE_TYPE_DICT_LETTER_ID, RULE_SEVERITY_DICT
from dataactcore.models.domainModels import CGAC, FREC
from dataactcore.models.errorModels import PublishedErrorMetadata, ErrorMetadata
from dataactcore.models.jobModels import Submi... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_a22_appropriations.py | 1 | 2209 | from dataactcore.models.stagingModels import Appropriation
from dataactcore.models.domainModels import SF133
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'a22_appropriations'
def test_column_headers(database):
expected_subset = {'uniqueid_TAS', 'row_number', 'obligations... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_b6_object_class_program_activity_1.py | 1 | 1389 | from tests.unit.dataactcore.factories.staging import ObjectClassProgramActivityFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'b6_object_class_program_activity_1'
def test_column_headers(database):
expected_subset = {'row_number', 'gross_outlays_undelivered_fyb', '... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/a98cd1871ea9_remove_user_status_id_from_user.py | 1 | 1073 | """remove user_status_id from user
Revision ID: a98cd1871ea9
Revises: e97127c44797
Create Date: 2016-12-22 11:59:35.173573
"""
# revision identifiers, used by Alembic.
revision = 'a98cd1871ea9'
down_revision = 'e97127c44797'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_script_read_zips.py | 1 | 6618 | from io import StringIO
from dataactvalidator.scripts.read_zips import update_state_congr_table_census, group_zips
from dataactcore.models.domainModels import StateCongressional, Zips, ZipsGrouped
def test_parse_census_district_file(database):
census_file_mock = StringIO("""state_code,congressional_district_no,c... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/c4d42e86c655_add_descriptions_to_published_.py | 1 | 3105 | """Add descriptions to (Published)AwardFinancialAssistance
Revision ID: c4d42e86c655
Revises: 668d9fa93acb
Create Date: 2018-04-04 11:00:18.103961
"""
# revision identifiers, used by Alembic.
revision = 'c4d42e86c655'
down_revision = '668d9fa93acb'
branch_labels = None
depends_on = None
from alembic import op
impor... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/scripts/backfill_ppop_scope_fabs.py | 1 | 2049 | import logging
from dataactcore.interfaces.db import GlobalDB
from dataactcore.broker_logging import configure_logging
from dataactvalidator.health_check import create_app
logger = logging.getLogger(__name__)
BACKFILL_FABS_PPOP_SCOPE_SQL_1 = """
UPDATE published_fabs
SET place_of_performance_scope =
... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs34_2.py | 1 | 1873 | from tests.unit.dataactcore.factories.staging import FABSFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs34_2'
def test_column_headers(database):
expected_subset = {'row_number', 'period_of_performance_star', 'period_of_performance_curr',
... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/scripts/populate_published_comments.py | 1 | 2470 | import logging
from sqlalchemy import func
from dataactcore.interfaces.db import GlobalDB
from dataactcore.broker_logging import configure_logging
from dataactcore.models.jobModels import Submission, PublishHistory, Comment, PublishedComment
from dataactvalidator.health_check import create_app
from dataactcore.mode... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs38_2_1.py | 1 | 2802 | from tests.unit.dataactcore.factories.domain import OfficeFactory
from tests.unit.dataactcore.factories.staging import FABSFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs38_2_1'
def test_column_headers(database):
expected_subset = {'row_number', 'funding_office... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/models/lookups.py | 1 | 22140 | # This file defines a series of constants that represent the values used in the
# broker's "helper" tables. Rather than define the values in the db setup scripts
# and then make db calls to lookup the surrogate keys, we'll define everything
# here, in a file that can be used by the db setup scripts *and* the applicatio... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/778cabef7323_rename_and_add_office_type_booleans_in_.py | 1 | 1561 | """Rename and add office type booleans in office table
Revision ID: 778cabef7323
Revises: 7dd3f4b007e5
Create Date: 2019-05-10 10:01:26.888903
"""
# revision identifiers, used by Alembic.
revision = '778cabef7323'
down_revision = '5f29b283f23e'
branch_labels = None
depends_on = None
from alembic import op
import sq... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs39_2.py | 1 | 2847 | from tests.unit.dataactcore.factories.staging import FABSFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs39_2'
def test_column_headers(database):
expected_subset = {'row_number', 'record_type', 'place_of_performance_code', 'place_of_perform_country_c',
... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/integration/integration_test_helper.py | 1 | 3026 | import calendar
from datetime import datetime
from dataactcore.models.jobModels import Submission, Job
def insert_submission(sess, submission_user_id, cgac_code=None, frec_code=None, start_date=None, end_date=None,
is_quarter=False, number_of_errors=0, publish_status_id=1, is_fabs=False,
... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/361fbffcf08b_added_named_job_dep_fks.py | 2 | 1044 | """added_named_job_dep_fks
Revision ID: 361fbffcf08b
Revises: 9058e0136aba
Create Date: 2016-08-26 10:33:18.803848
"""
# revision identifiers, used by Alembic.
revision = '361fbffcf08b'
down_revision = '9058e0136aba'
branch_labels = None
depends_on = None
from alembic import op
def upgrade(engine_name):
globa... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/scripts/populate_subaward_table.py | 1 | 6271 | import os
import argparse
import datetime
import logging
import json
import sys
from dataactcore.interfaces.db import GlobalDB
from dataactcore.config import CONFIG_BROKER
from dataactcore.broker_logging import configure_logging
from dataactvalidator.health_check import create_app
from dataactbroker.fsrs import GRANT,... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_a7_appropriations.py | 1 | 2660 | from dataactcore.models.stagingModels import Appropriation
from dataactcore.models.domainModels import SF133
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'a7_appropriations'
_TAS = 'a7_appropriations_tas'
def test_column_headers(database):
expected_subset = {'uniqueid_TA... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/da2e50d423ff_create_frec_table.py | 1 | 1237 | """create FREC table
Revision ID: da2e50d423ff
Revises: aa10ae595d3e
Create Date: 2017-07-06 10:27:04.738865
"""
# revision identifiers, used by Alembic.
revision = 'da2e50d423ff'
down_revision = 'aa10ae595d3e'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(engin... | cc0-1.0 |
fedspendingtransparency/data-act-broker-backend | dataactcore/scripts/generate_comments_files.py | 1 | 4873 | import logging
from sqlalchemy import func
from dataactcore.aws.s3Handler import S3Handler
from dataactcore.config import CONFIG_BROKER
from dataactcore.interfaces.db import GlobalDB
from dataactcore.interfaces.function_bag import filename_fyp_sub_format
from dataactcore.broker_logging import configure_logging
from d... | cc0-1.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.