repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 | 305dad0d6a7a428344d25835b0331542 | 33.571429 | 96 | 0.661983 | 3.74613 | false | false | false | false |
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 | 6ff28baceb93bf94e973dfee7c503caa | 26.669643 | 83 | 0.695708 | 3.868914 | false | true | false | false |
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 | 84226085f1856f60fffbc7d1658a6032 | 35.043478 | 95 | 0.577805 | 4.605556 | false | false | false | false |
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 | b8e6270987f62beaf396fe2b9ce6e9d0 | 31.521739 | 95 | 0.637032 | 4.021505 | false | false | false | false |
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 | 0a2d391270318e7b0286c7f6cc490d0f | 30.802469 | 93 | 0.634705 | 4.088889 | false | false | false | false |
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 | 21e308a331aa8210e6c3216ad6ef8e17 | 25.930233 | 93 | 0.66753 | 3.436202 | false | true | false | false |
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 | a023114dc73545a6f35664a0aba26973 | 24.652174 | 104 | 0.554237 | 4.689984 | false | false | false | false |
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 | 8a5ef5e7c64db739c054b8d67d63de1f | 30.329412 | 88 | 0.556515 | 3.705043 | false | false | false | false |
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 | 8d528fae968f41036b202e03cfa36487 | 23.861925 | 87 | 0.619152 | 3.560216 | false | false | false | false |
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 | 4cd3b1805a5fb6ff5a344f4ebe671490 | 28.980998 | 81 | 0.552131 | 4.29612 | false | false | false | false |
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 | ba0aec650f36c17aa80c51e0edb576d3 | 31.473538 | 93 | 0.556613 | 3.81979 | false | false | false | false |
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 | a750825a6ad36ac1a7782e70397c068b | 32.899761 | 89 | 0.558857 | 4.542373 | false | false | false | false |
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 | 6e4ea185859404dd312ca4ca6712d897 | 40.013514 | 107 | 0.604942 | 4.062918 | false | true | false | false |
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 | 0d336f640d1dc4f3cb7fa7d1034befed | 38.340426 | 119 | 0.597801 | 4.381517 | false | false | false | false |
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 | 2d73a38b2f7944d0edc6af411dde9e66 | 32.333333 | 104 | 0.618889 | 4.026846 | false | false | false | false |
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 | 1c316fc1356dd8d975ed5651133bf6c5 | 26.215686 | 116 | 0.64121 | 3.435644 | false | true | false | false |
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 | 03ebfc866c44dd5b025dafca891c805b | 38 | 114 | 0.627333 | 4.388177 | false | true | false | false |
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 | 0436ee43d53172ed8b41cd5cf2c4b40d | 30.938776 | 153 | 0.555911 | 3.927227 | false | false | false | false |
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 | 145ea361c0c78a021c0675ca9b269ad6 | 40.774691 | 137 | 0.590137 | 4.221772 | false | false | false | false |
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 | 0945e4c78d6be15cc3d53a501d7b2024 | 39.301887 | 107 | 0.594569 | 4.377049 | false | false | false | false |
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 | c7fe489f489e7470546c470f3f6a8e4f | 36.296188 | 79 | 0.551109 | 4.419041 | false | false | false | false |
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 | 433a69ad9ffd4ba16f37c8f4cb504c13 | 37.925065 | 79 | 0.497411 | 3.225696 | false | false | false | false |
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 | 9a2d0ef23d5688834407018ea4306364 | 37.58642 | 80 | 0.503279 | 3.976463 | false | false | false | false |
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 | 69e54dec409d3927e831977f003e6393 | 31.870968 | 84 | 0.697089 | 3.73945 | false | false | false | false |
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 | 1517965c5c64a352e8b73259eff50045 | 34.629032 | 78 | 0.463105 | 3.571544 | false | false | false | false |
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 | 21e03933294d545d53727875d93a860f | 31.107955 | 81 | 0.660414 | 4.418296 | false | false | false | false |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 3