Dataset Viewer
Auto-converted to Parquet Duplicate
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
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
2