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 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2