repo_name stringlengths 7 65 | path stringlengths 5 186 | copies stringclasses 581
values | size stringlengths 4 7 | content stringlengths 805 1.02M | license stringclasses 14
values |
|---|---|---|---|---|---|
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 |
mozilla/normandy | normandy/recipes/tests/api/v3/test_api.py | 1 | 84448 | from datetime import timedelta, datetime
from django.conf import settings
from django.db import connection
from django.test.utils import CaptureQueriesContext
import pytest
from rest_framework import serializers
from rest_framework.reverse import reverse
from pathlib import Path
from normandy.base.api.permissions im... | mpl-2.0 |
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 |
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 |
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 |
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 |
mozilla/normandy | normandy/recipes/tests/test_filters.py | 1 | 25613 | from datetime import datetime
import factory.fuzzy
import pytest
import re
from collections import defaultdict
from rest_framework import serializers
from normandy.base.jexl import get_normandy_jexl
from normandy.recipes import filters
from normandy.recipes.tests import (
ChannelFactory,
CountryFactory,
L... | mpl-2.0 |
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 |
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 |
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 |
mozilla/normandy | normandy/base/tests/test_storage.py | 1 | 1594 | from itertools import chain
import pytest
from django.core.files.base import ContentFile
from normandy.base.storage import PermissiveFilenameStorageMixin
class TestPermissiveFilenameStorageMixin(object):
@pytest.fixture
def storage(self):
return PermissiveFilenameStorageMixin()
class TestGetVa... | mpl-2.0 |
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 |
mozilla/normandy | normandy/recipes/api/v1/views.py | 1 | 6564 | from django.conf import settings
from django.db import transaction
from django.db.models import Q
from django.views.decorators.cache import never_cache
import django_filters
from rest_framework import generics, permissions, views, viewsets
from rest_framework.decorators import action
from rest_framework.exceptions imp... | mpl-2.0 |
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 |
mozilla/normandy | contract-tests/v3_api/test_approval_request_reject.py | 1 | 1850 | from support.assertions import assert_valid_schema
from support.helpers import new_recipe
from urllib.parse import urljoin
def test_approval_request_reject(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/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 |
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 |
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 |
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 |
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 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2