code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""
In this package, You can find test environment for Ella taggit unittest project.
As only true unittest and "unittest" (test testing programming unit, but using
database et al) are there, there is not much setup around.
"""
import os
test_runner = None
old_config = None
os.environ['DJANGO_SETTINGS_MODULE'] = 'test... | ella/ella-taggit | test_ella_taggit/__init__.py | Python | mit | 700 |
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The arg spec for the vyos facts module.
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class FactsArgs(object): # pylint: disable=R0903
""" The ar... | amenonsen/ansible | lib/ansible/module_utils/network/vyos/argspec/facts/facts.py | Python | gpl-3.0 | 863 |
import urllib, urllib2, re
def doit(op, **kw):
try:
kw['op'] = op
kw['pass'] = 'PASSWORD'
data = urllib.urlencode(kw)
req = urllib2.Request("http://console.existencia.org/ss/status.php", data)
response = urllib2.urlopen(req, timeout=5)
return response.read()
exce... | jrising/console | local/status.py | Python | gpl-2.0 | 972 |
#!/usr/bin/env python
# 12.01.2007, c
from __future__ import absolute_import
from argparse import ArgumentParser
import sfepy
from sfepy.base.base import output
from sfepy.base.conf import ProblemConf, get_standard_keywords
from sfepy.homogenization.band_gaps_app import AcousticBandGapsApp
from sfepy.base.plotutils im... | lokik/sfepy | phonon.py | Python | bsd-3-clause | 3,037 |
{
'cisco':{
'hosts': ['al-switch1','al-switch2','l2-l3-1','l2-l3-2','provider','provider-bu','internet'],
'vars':{
'ansible_connection': 'local',
'hostname': '1.2.3.4',
'password': 'cisco',
'username': 'cisco'
}
},
'local':{
'hosts': ['localhost'],
'vars': {'ansible_connection': 'local'}
}
}
| joergullrich/virl-lab | dyn_inv.py | Python | gpl-3.0 | 319 |
'''
TelegramAPy
Copyright (C) 2015 Giove Andrea
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed i... | aadeg/TelegramAPy | telegramapy/api.py | Python | gpl-2.0 | 21,062 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010, Dan Eicher.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# thi... | jemandez/creaturas-magicas | Configuraciones básicas/scripts/addons/piemenus/pie_modeMenu.py | Python | gpl-3.0 | 10,349 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | dayatz/taiga-back | taiga/base/api/generics.py | Python | agpl-3.0 | 15,996 |
#!/usr/bin/env python
#
# Documentation:
# Purpose: This script helps generate migration file for ts-events child tables.
# Usage: ./scripts/migrations/create-ts-events.py 2017 > ./migrations/core/0033_add-ts-events-2017.up.sql
# Arguments:
# 1. The year. Example: 2017
#
# Examples:
# ./scripts/migrations/create-ts-... | resourced/resourced-master | scripts/migrations/create-ts-events.py | Python | mit | 771 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015 Language Technology, Technische Universitaet Darmstadt (author: Benjamin Milde)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License ... | tudarmstadt-lt/kaldi-tuda-de | s5/local/maryclient.py | Python | apache-2.0 | 2,370 |
# -*- coding: utf-8 -*-
# Import the AbstractUser model
from django.contrib.auth.models import AbstractUser
# Import the basic Django ORM models library
from django.db import models
from django.utils.translation import ugettext_lazy as _
# Subclass AbstractUser
class Chart(models.Model):
title = models.CharFiel... | lewchuk/chartio_embed | chartio_embed/charts/models.py | Python | bsd-3-clause | 392 |
#!/usr/bin/env python
#
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | alexandregz/simian | src/simian/mac/admin/panic.py | Python | apache-2.0 | 2,215 |
"""
pip._vendor is for vendoring dependencies of pip to prevent needing pip to
depend on something external.
Files inside of pip._vendor should be considered immutable and should only be
updated to versions from upstream.
"""
from __future__ import absolute_import
| Orav/kbengine | kbe/res/scripts/common/Lib/site-packages/pip/_vendor/__init__.py | Python | lgpl-3.0 | 274 |
# -*- coding: utf-8 -*-
#
##################################################################################
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... | i3visio/osrframework | osrframework/utils/exceptions.py | Python | agpl-3.0 | 3,670 |
# -*- coding: utf-8 -*-
"""Tests for nacelle's mail functionality
"""
# marty mcfly imports
from __future__ import absolute_import
# stdlib imports
import base64
# third-party imports
import webapp2
from nacelle.conf import settings
from nacelle.test.testcases import NacelleTestCase
# local imports
from nacelle.cont... | nacelle/nacelle | nacelle/contrib/mail/tests.py | Python | mit | 4,967 |
import hashlib
import json
import os
import uuid
from django import forms
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.core.paginator import Emp... | takeflight/wagtail | wagtail/tests/testapp/models.py | Python | bsd-3-clause | 43,462 |
"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is ... | google-research/self-organising-systems | mplp/mplp/sinusoidals.py | Python | apache-2.0 | 1,573 |
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.utils.domutils
import os.path
schema_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../schemas/test-include-daq.xsd'))
code = pyxb.bin... | CantemoInternal/pyxb | tests/drivers/test-include-daq.py | Python | apache-2.0 | 1,094 |
import json
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from student.models import Registration
from django.test import TestCase
def get_request_for_user(user):
"""Create a request object for user."""
request = Requ... | carsongee/edx-platform | lms/djangoapps/courseware/tests/helpers.py | Python | agpl-3.0 | 4,674 |
import re
from core.actionModule import actionModule
from core.keystore import KeyStore as kb
from core.utils import Utils
class scan_anonldap(actionModule):
def __init__(self, config, display, lock):
super(scan_anonldap, self).__init__(config, display, lock)
self.title = "Test for Anonymous LDAP ... | MooseDojo/apt2 | modules/action/scan_anonldap.py | Python | mit | 1,841 |
melody_pad_pattern = {
"Center+Halfmoon-Alt-LR": [4, 0, 1, 2, 3, 5, 12, 6, 11, 7, 10, 8, 9],
"Center+Halfmoon-Alt-LR (no M5)": [0, 1, 2, 3, 5, 12, 6, 11, 7, 10, 8, 9],
"Center+Halfmoon-Alt-LR (no M5,M1,M2)": [2, 3, 5, 12, 6, 11, 7, 10, 8, 9],
"Center+Halfmoon-Alt-LR (Handpan style)": [0, 1, 2, 3, 5, 1... | scjurgen/hpd-20 | hpd20/melodypadpattern.py | Python | gpl-3.0 | 1,102 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Cisco Systems, Inc.
# Copyright 2012 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use... | sandvine/horizon | openstack_dashboard/api/neutron.py | Python | apache-2.0 | 50,711 |
import matplotlib.pyplot as plt
ax = plt.subplot(311)
b1 = ax.bar([0, 1, 2], [0.2, 0.3, 0.1], width=0.4,
label="Bar 1", align="center")
b2 = ax.bar([0.5, 1.5, 2.5], [0.3, 0.2, 0.2], color="red", width=0.4,
label="Bar 2", align="center")
ax.legend()
ax = plt.subplot(312)
err1 = ax.errorbar(... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/pylab_examples/legend_demo4.py | Python | mit | 723 |
# -*- coding: utf-8 -*-
"""
SQLpie License (MIT License)
Copyright (c) 2011-2016 André Lessa, http://sqlpie.com
See LICENSE file.
"""
from flask import Response
import json
import sqlpie
class SearchController(sqlpie.BaseController):
@staticmethod
@sqlpie.BaseController.controller_wrapper
def service_i... | lessaworld/SQLpie | sqlpie/controllers/search_controller.py | Python | mit | 3,464 |
import os
from conf import settings
from util import *
class ProjectDefinition(object):
SRID=settings.GEOGRAPHIC_SRID
def __unicode__(self):
return '<ProjectDefinition "{0}">'.format(self.title)
def __str__(self):
return unicode(self)
def __init__(self, name, title, industrial_par... | maackle/ILC-app | conf/projects.py | Python | gpl-3.0 | 3,813 |
__author__ = 'amarch'
# -*- coding: utf-8 -*-
from utils import strutils as infoutils
import itertools
from scipy.integrate import *
from RotationCurve import *
from Galaxy import *
from utils import strutils as infoutils
import itertools
import copy
from RadialToAzimuthalRatioHandler import *
import scipy.optimize
... | Amarchuk/2FInstability | core/RadialToVerticalRatioHandler.py | Python | gpl-3.0 | 8,998 |
#from bin2kernel import Bin2Kernel
#from bin2kernel import makeBin2KernelAsEstimator
#from bin2kernel import Bin2KernelLaplaceLinearN
#from bin2kernel import getFastestBin2Kernel
#from bin2kernel import Bin2KernelEPLinearN
from laplace import LaplaceGLMM_N3K1, LaplaceGLMM_N1K3
from ep import EPGLMM_N3K1, EPGLMM... | zhonghualiu/FaST-LMM | fastlmm/inference/__init__.py | Python | apache-2.0 | 1,419 |
# Copyright (C) 2010 Todd Kennedy <todd.kennedy@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This ... | toddself/beermaker-archive | old/ListCtrlWithTree.py | Python | gpl-3.0 | 1,147 |
"""Unit tests for servicediscovery-supported APIs."""
import boto3
import sure # noqa # pylint: disable=unused-import
from moto import mock_servicediscovery
# See our Development Tips on writing tests for hints on how to write good tests:
# http://docs.getmoto.org/en/latest/docs/contributing/development_tips/tests.h... | spulec/moto | tests/test_servicediscovery/test_servicediscovery_tags.py | Python | apache-2.0 | 3,419 |
from datetime import datetime
from verleihtool.test import ClientTestCase
from depot.models import Depot, Organization
from rental.models import Rental
class RentalDetailTestCase(ClientTestCase):
def create_rental(self, state):
return Rental.objects.create(
depot=self.depot,
start... | verleihtool/verleihtool | rental/tests/test_rental_detail.py | Python | agpl-3.0 | 6,570 |
"""Foyer: Atomtyping and forcefield applying. """
from __future__ import print_function
from setuptools import find_packages, setup
#####################################
VERSION = "0.11.0"
ISRELEASED = True
if ISRELEASED:
__version__ = VERSION
else:
__version__ = VERSION + ".dev0"
###########################... | mosdef-hub/foyer | setup.py | Python | mit | 2,142 |
def multiply(*args):
res = 1
for x in args:
res *= x
return res
| OliverTED/pyshapes | pyshapes/dummy.py | Python | gpl-3.0 | 84 |
# 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 time
from unittestzero import Assert
from tests import TestCase
from pages.dashboard import DashboardPage
from... | staranjeet/fjord | smoketests/tests/fxos/test_fxos_feedback.py | Python | bsd-3-clause | 3,419 |
"""
Tests for DOT Adapter
"""
import unittest
from datetime import timedelta
from django.conf import settings
from django.test import TestCase
from django.utils.timezone import now
import ddt
from oauth2_provider import models
from student.tests.factories import UserFactory
# oauth_dispatch is not in CMS' INSTALLED... | a-parhom/edx-platform | openedx/core/djangoapps/oauth_dispatch/tests/test_dot_adapter.py | Python | agpl-3.0 | 4,303 |
import json
import os
import sys
import datetime
from unittest import TestCase
# Prevent relative import errors
file_ = os.path.abspath(__file__)
tests_ = os.path.dirname(file_)
products_ = os.path.dirname(tests_)
shopify_ = os.path.dirname(products_)
root = os.path.dirname(shopify_)
sys.path.append(root)
from shopi... | ziplokk1/python-shopify-api | shopify/products/tests/test_product.py | Python | unlicense | 2,175 |
import hsm
from hsm import actor
from hsm import runtime
class Machine(actor.TopState):
def __init__(self):
self._error = None
def on_error(self, error):
self._error = error
self.transition(ErrorState)
@actor.initial_state
class Off(Machine):
def on_start(self):
self.transition(On)
class On(Machine):... | eneabio/hsm | hsm/test/simple_hsm.py | Python | mit | 1,058 |
from decimal import Decimal as D
from django.test import TestCase
from oscar.apps.offer import models
from oscar.test.basket import add_product, add_products
from oscar.test import factories
class TestACountConditionWithPercentageDiscount(TestCase):
def setUp(self):
range = models.Range(
na... | ahmetdaglarbas/e-commerce | tests/integration/offer/combination_tests.py | Python | bsd-3-clause | 2,562 |
#!/usr/bin/env python
import os
import re
import sys
group_id = '142394'
def stamp(html):
"""Stamp a Python HTML documentation page with the SourceForge logo"""
def replace(m):
return ('<span class="release-info">%s '
'Hosted on <a href="http://sourceforge.net">'
'<im... | PyQwt/PyQwt5 | Doc/sourceforge.py | Python | gpl-2.0 | 990 |
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | Jozhogg/iris | lib/iris/fileformats/um/_fast_load_structured_fields.py | Python | lgpl-3.0 | 9,902 |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use... | eswartz/RenderPipeline | rpcore/stages/apply_lights_stage.py | Python | mit | 1,854 |
from social.backends.bitbucket import BitbucketOAuth as BitbucketBackend
| vxvinh1511/django-social-auth | social_auth/backends/contrib/bitbucket.py | Python | bsd-3-clause | 73 |
from __future__ import absolute_import, unicode_literals
import re
OEMBED_ENDPOINTS = {
"https://speakerdeck.com/oembed.{format}": [
"^http(?:s)?://speakerdeck\\.com/.+$"
],
"https://alpha-api.app.net/oembed": [
"^http(?:s)?://alpha\\.app\\.net/[^#?/]+/post/.+$",
"^http(?:s)?://pho... | Toshakins/wagtail | wagtail/wagtailembeds/oembed_providers.py | Python | bsd-3-clause | 12,377 |
from model.contact import Contact
testdata = [Contact(firstname="firstname1", middlename="middlename1", lastname="lastname1", nickname="nickname1",
address="addr1", company="company1", home="home1", homephone="homephone1", mobilephone="mobilephone1",
workphone="workphone1", sec... | VitalyW/python_training | data/contacts.py | Python | apache-2.0 | 930 |
# -*- coding: UTF-8 -*-
# Copyright 2017 Luc Saffre
# License: BSD (see file COPYING for details)
""".. management_command:: qtclient
Runs a Qt client for this application.
This requires::
pip install pyqt5
which is only available under Python 3.
"""
from __future__ import print_function
from django.core.ma... | khchine5/lino | lino/management/commands/qtclient.py | Python | bsd-2-clause | 5,132 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
this admin script allows you to :
- la base minimale du programme : ./administration 1
- base de test : ./administration 2
- add an user to the db : ./administration 0 email password (firstname timezone)
"""
from sys import argv, exc_info
from app import models
f... | littleDad/mesLucioles | administration.py | Python | gpl-2.0 | 4,438 |
import time
from threading import Event, Thread
class TimerError(Exception):
pass
class Timer:
"""A super simple wall clock timer.
After an instance is created, it must be started with
:meth:`start`. It will run until it is :meth:`stop`pped.
A timer can be reset/reused by calling :meth:`stop... | bycycle-org/bycycle.core | bycycle/core/util.py | Python | gpl-3.0 | 2,920 |
import concurrent.futures
from functools import update_wrapper, partial
class SingleProcess(object):
"""
A fall-back parallel context that executes jobs sequentially.
"""
def __repr__(self):
return "{name}({extra})".format(name=self.__class__.__name__,
... | INM-6/elephant | elephant/parallel/parallel.py | Python | bsd-3-clause | 3,668 |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from tardis.tardis_portal.models import Dataset
@python_2_unicode_compatible
class Equipment(models.Model):
key = models.CharField(unique=True, max_length=30)
dataset = models.ManyToManyField(Da... | wettenhj/mytardis | tardis/apps/equipment/models.py | Python | gpl-3.0 | 826 |
# -*- coding: utf-8 -*-
from pydwd.crawler.basecrawler import BaseCrawler
from pydwd.utils import ftphelper, translator
from pydwd.parser import weatherparser
class HourlyCrawler(BaseCrawler):
def __init__(self):
self._host = 'ftp-cdc.dwd.de'
self._station_file = 'TU_Stundenwerte_Beschreibung_Sta... | ckaus/pydwd | pydwd/crawler/hourlycrawler.py | Python | mit | 1,940 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2016 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/primaires/objet/types/clef.py | Python | bsd-3-clause | 1,750 |
# Copyright 2019 The meson development team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | becm/meson | mesonbuild/compilers/mixins/visualstudio.py | Python | apache-2.0 | 15,968 |
import json
import math
from etherealpost.db import helpers
from etherealpost.db.cache import Cache
from etherealpost.db.helpers import gold_string, time_left_string
from etherealpost.db.item import Item
import time
from etherealpost.db.realm import Realm
from etherealpost.db.realm_name import RealmName
class Db(ob... | etherealpost/etherealpost.com | etherealpost/db/db.py | Python | mit | 17,493 |
# Ansible lookup plugin for getting the first available file given a list of items and a template
# (c) 2015,2016 David Lundgren <dlundgren@syberisle.net>
#
# Given a list of items it will attempt to find a file in the regular list of paths that is similar to the name
#
# - name: Add SSH keys
# authorized_key:
# us... | dlundgren/ansible-plugins | plugins/lookup/available_file_from_items.py | Python | mit | 3,607 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-10-26 17:48
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | Hasan-Jawaheri/games | sweeper/migrations/0001_initial.py | Python | gpl-3.0 | 1,834 |
from django import forms
import datetime
from gestion import models
class ObservacionesBecarioForm(forms.Form):
def __init__(self, *args, **kwargs):
self.becario = kwargs.pop('becario')
super(ObservacionesBecarioForm, self).__init__(*args, **kwargs)
if self.becario:
self.field... | jeplasenciap/gespai | cambios/forms.py | Python | agpl-3.0 | 2,554 |
from django.shortcuts import render
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponseRedirect
from .forms import NameForm
paginaPrincipal='/paginaPrincipal'
def loginUsuario(request):
if request.user.is_authenticated():
return HttpResponseRedirect(paginaPri... | AliGhahraei/RateMe | login/views.py | Python | gpl-3.0 | 1,373 |
"""
Describe usage of our default container/image domain.
"""
from typing import Hashable
from benchbuild.environments.domain import model
def describe_layers():
def from_is_hashable():
layer = model.FromLayer('a')
assert isinstance(layer, Hashable)
def add_is_hashable():
layer = mo... | PolyJIT/benchbuild | tests/environments/domain/test_model.py | Python | mit | 2,780 |
"""Game of life, see https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
rules:
cells living in a 2d- array
Any live cell with two or three live neighbours survives.
Any dead cell with three live neighbours becomes a live cell.
All other live cells die in the next generation. Similarly, all other dead cells stay dead... | horstjens/ThePythonGameBook | en/python/unsorted/game_of_life.py | Python | gpl-3.0 | 2,429 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2017, Netservers Ltd. <support@netservers.co.uk>
# (c) 2017, René Moser <mail@renemoser.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... | hryamzik/ansible | lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py | Python | gpl-3.0 | 15,962 |
import numpy as np
import sys
sys.path.append("../Pipeline/Audio/Pipeline/")
from AudioPipe.features import mfcc # Feature Extraction Module, part of the shared preprocessing
import AudioPipe.speaker.recognition as SR # Speaker Recognition Module
import scipy.io.wavfile as wav
import commands, os
import json
import ar... | RedHenLab/Audio | CNN/detect_outlier.py | Python | gpl-2.0 | 3,781 |
from unittest.mock import patch, MagicMock
from django.core.urlresolvers import reverse
from django.test import RequestFactory
from test_plus.test import TestCase
from ..models import (
Minion,
MinionData
)
from ..views import(
MinionCreateView,
MinionDetailView
)
class TestMinionCreateView(TestCase)... | Farforr/overlord | overlord/minions/tests/test_views.py | Python | bsd-3-clause | 1,246 |
from test_helper import plpy_mock_config
def setup():
plpy_mock_config()
| CartoDB/dataservices-api | server/lib/python/cartodb_services/test/__init__.py | Python | bsd-3-clause | 79 |
import pytest
from mock.mock import Mock
from insights.core.dr import SkipComponent
from insights.core.spec_factory import DatasourceProvider
from insights.specs.datasources.lpstat import LocalSpecs, lpstat_protocol_printers_info
LPSTAT_V = """
device for test_printer1: ipp://cups.test.com/printers/test_printer1
devi... | RedHatInsights/insights-core | insights/tests/datasources/test_lpstat.py | Python | apache-2.0 | 1,623 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class DefaultValue(Document):
pass
def on_doctype_update():
"""Create indexes for `tabDefaultValue` on `(parent, d... | gangadharkadam/v5_frappe | frappe/core/doctype/defaultvalue/defaultvalue.py | Python | mit | 850 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_ipv6_nd_cfg.py | Python | apache-2.0 | 5,876 |
# -*- coding: utf-8 -*-
"""
News for state space models
Author: Chad Fulton
License: BSD-3
"""
import numpy as np
import pandas as pd
from statsmodels.iolib.table import SimpleTable
from statsmodels.iolib.summary import Summary
from statsmodels.iolib.tableformatting import fmt_params
class NewsResults(object):
... | jseabold/statsmodels | statsmodels/tsa/statespace/news.py | Python | bsd-3-clause | 49,282 |
# ******************************************************************************
# Copyright 2014-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | NervanaSystems/neon | examples/video-c3d/network.py | Python | apache-2.0 | 2,289 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtWidgets.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
************************... | dwadler/QGIS | python/PyQt/PyQt5/QtWidgets.py | Python | gpl-2.0 | 1,207 |
#! /usr/bin/env python
# $Id: test_option_lists.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for states.py.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTest... | spreeker/democracygame | external_apps/docutils-snapshot/test/test_parsers/test_rst/test_option_lists.py | Python | bsd-3-clause | 19,677 |
"""
A Jinja2-based tag engine for tags.
"""
import asyncio
import inspect
import random
import string
from concurrent.futures import ThreadPoolExecutor
import discord
import functools
import lupa
from discord.abc import GuildChannel
from jinja2 import Template
from jinja2.sandbox import SandboxedEnvironment
from lupa... | MJB47/Jokusoramame | joku/core/tagengine.py | Python | mit | 4,461 |
import sys
from collections import defaultdict
from django.core.management.base import BaseCommand
from django.core.management import call_command
from wazimap.data.utils import get_session
from wazimap.data.utils import get_datatable
from wazimap.models import FieldTable, SimpleTable
from wazimap.geo import geo_data... | Code4SA/wazimap-za | wazimap_za/management/commands/checkdata.py | Python | mit | 11,305 |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
try:
from platformio import util
except ImportError:
import sys
for _path in sys.path:
if "platformio" in _path:
sys.path.insert(0, _path[:_path.rfind("platformio") - 1])
break
from platformio impo... | bkudria/platformio | platformio/builder/main.py | Python | mit | 3,989 |
# -*- coding: utf-8 -*-
class Item(object):
def __init__(self, uid, name, time):
self._uid = uid
self._name = name
self._time = time
@property
def name(self):
return self._name
@property
def uid(self):
return self._uid
def display(self, size):
... | NiZiL/clitube | clitube/model.py | Python | mit | 3,663 |
from sympy import *
x = symbols('x')
print limit(sin(x)/x, x, 0) | NTomtishen/src | SympyTest.py | Python | cc0-1.0 | 64 |
import numpy as np
from numpy.testing import assert_array_almost_equal
from mne.connectivity import phase_slope_index
def test_psi():
"""Test Phase Slope Index (PSI) estimation."""
sfreq = 50.
n_signals = 3
n_epochs = 10
n_times = 500
rng = np.random.RandomState(42)
data = rng.randn(n_epo... | adykstra/mne-python | mne/connectivity/tests/test_effective.py | Python | bsd-3-clause | 1,238 |
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicen... | lightmare/mapnik | scons/scons-local-4.1.0/SCons/Tool/MSCommon/sdk.py | Python | lgpl-2.1 | 15,044 |
# Copyright 2020 The UniqueRandomizer Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | google-research/unique-randomizer | unique_randomizer/tsp/tsp.py | Python | apache-2.0 | 10,950 |
# SPDX-FileCopyrightText: 2019 Jean-Louis Fuchs <ganwell@fangorn.ch>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Test if the tree stays consistent."""
import mpipe
import os
from os import path
from build._rbtree_tests import lib, ffi
from hypothesis.stateful import GenericStateMachine
from hypothesis.strategi... | ganwell/rbtree | old_dev/src/test_tree.py | Python | mit | 7,326 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
----------------------------------------------------------------------
This model acts as a bridge between the DataViewCtrl and the data
This model provides these data columns:
0. DisplayName: string
1. ControllerName:string
2. Connector: integer
3... | stampedeboss/lights | lights/connection/datamodel.py | Python | cc0-1.0 | 6,388 |
import praw
import random
import requests
import sqlite3
import bot
import datetime
import time
import string
sql = sqlite3.connect('un.db')
cur = sql.cursor()
cur.execute('CREATE TABLE IF NOT EXISTS users(idint INT, idstr TEXT, created INT, human TEXT, name TEXT, link_karma INT, comment_karma INT, total_karma INT, a... | tehp/reddit | Usernames/un.py | Python | mit | 11,873 |
#!/usr/bin/python
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | dietrichc/streamline-ppc-reports | examples/dfp/v201405/placement_service/get_all_placements.py | Python | apache-2.0 | 1,709 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule_paged.py | Python | mit | 952 |
# -*- coding: utf-8 -*-
{
'name': 'Stock EAN128',
'version': '1.0',
'category': 'Warehouse Management',
'sequence': 14,
'summary': '',
'description': """
Stock EAN128
============
""",
'author': 'ADHOC',
'website': 'www.adhoc.com.ar',
'images': [
],
'depends': [
... | syci/ingadhoc-odoo-addons | stock_ean128/__openerp__.py | Python | agpl-3.0 | 608 |
# This is a basic program showing the functionality of the turtle module.
# It generates a very pretty spiraling pattern.
import turtle # import the turtle module so we can draw
import math # import the math module, we need this for e and pi
t = turtle.Pen() # set a variable to draw with
t.reset() ... | annamacmillan/python-drabbles | rosette.py | Python | mit | 760 |
import os
import sys
import collections
import numpy as np
import d4rl.infos
from d4rl.offline_env import set_dataset_path, get_keys
SUPPRESS_MESSAGES = bool(os.environ.get('D4RL_SUPPRESS_IMPORT_ERROR', 0))
_ERROR_MESSAGE = 'Warning: %s failed to import. Set the environment variable D4RL_SUPPRESS_IMPORT_ERROR=1 to s... | rail-berkeley/d4rl | d4rl/__init__.py | Python | apache-2.0 | 5,963 |
#pingpong
from vpython import *
import math
import random
import string
GRAVITY = -0.2
HALF_RADIUS_OF_BALL = 0.075
TIME_COEFFICIENT = 0.45
score = 0
game_over = False
color_list = [color.red, color.blue, color.black, color.yellow]
color_index = 0
computer = box (pos = vector(0, 0, -3), color = color.green, size = ... | shafeeqr2/python | Ping Pong Game/PingPongGame.py | Python | gpl-3.0 | 3,798 |
""" This module is responsible for finding properties
related to bond interface and bond member interfaces """
from collections import OrderedDict
import netshowlib.linux.iface as linux_iface
import netshowlib.linux.bridge as linux_bridge
import netshowlib.linux.lacp as lacp
import re
import io
class Bond(linux_iface... | CumulusNetworks/netshow-linux-lib | netshowlib/linux/bond.py | Python | gpl-2.0 | 10,806 |
#!/usr/bin/python
# \file VARION.py
# This script implements the VARION algorithm for real-time
# detection of sTEC variations using GNSS observations.
# author Giorgio Savastano, 23.10.2015. giorgio.savastano[AT]gmail.com
# modified by Michela Ravanelli, michela.ravanelli[AT]uniroma1.it
#
# Notice: Please acknowled... | giorgiosavastano/VARION | scripts/VARION.py | Python | gpl-3.0 | 13,099 |
# environment variables
ATOM_PROGRAM = '/home/physics/bin/atm'
ATOM_UTILS_DIR ='/home/physics/bin/pseudo'
element = "Al"
equil_volume = 16.4796
# general calculation parameters
calc = {"element": element,
"lattice": "FCC",
"xc": "pb",
"n_core": 3,
"n_val": 2,
"is_spin_pol": Fa... | ansobolev/PseudoGenerator | settings/settings_Al.py | Python | mit | 879 |
import os
import shlex
import subprocess
from tempfile import mkstemp, mkdtemp
def find_files(directory:str, extension:str= '', ignore_mark=None):
"""
Walk recursively :arg directory,
ignoring dirs that contain file named :arg ignore_mark,
and return all files matching :arg extension
"""
if... | 5nizza/bene | utils.py | Python | mit | 1,962 |
#!/usr/bin/env python
"""
File to plot the Learning Curve of a Random Forrest
"""
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import matplotlib as mpl
from sklearn.model_selection import KFold
from sklearn.model_selection import learning_curve
mpl.use('TkAgg')
import matp... | cBeaird/SemEval_Character-Identification-on-Multiparty-Dialogues | Classifiers/Random_Forest/Learning_Curve.py | Python | mit | 2,718 |
from gazetteer.models import GazSource,GazSourceConfig,LocationTypeField,CodeFieldConfig,NameFieldConfig
from skosxl.models import Concept, Scheme, MapRelation
from gazetteer.settings import TARGET_NAMESPACE_FT
(sch,created) = Scheme.objects.get_or_create(uri=TARGET_NAMESPACE_FT[:-1], pref_label="Gaz Feature types... | rob-metalinkage/django-gazetteer | gazetteer/fixtures/mapstory_geonames_config.py | Python | cc0-1.0 | 1,907 |
#!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
''' Installs and runs (a subset of) the gcc toolchain test suite against
various nacl and non-nacl toolchains
'''
import glob
imp... | sbc100/native_client | tools/toolchain_tester/torture_test.py | Python | bsd-3-clause | 4,893 |
from pytest import raises
from sanic.app import Sanic
from sanic.blueprints import Blueprint
from sanic.request import Request
from sanic.response import HTTPResponse, text
MIDDLEWARE_INVOKE_COUNTER = {"request": 0, "response": 0}
AUTH = "dGVzdDp0ZXN0Cg=="
def test_bp_group_indexing(app: Sanic):
blueprint_1 =... | yunstanford/sanic | tests/test_blueprint_group.py | Python | mit | 5,549 |
''' Face: Blend Shape Mesh connected to the rig. '''
#system global imports
#Bungie C# library imports
#software specific imports
import pymel.core as pm
import maya.cmds as cmds
import os
#Bungie python imports
import model.blendnode
import metautil.node_attributes
import metautil.lists
class Mesh(object):
'''Thi... | deathglitch/metarigging | python/model/mesh.py | Python | mit | 10,929 |
"""Base class for creating scikit-learn Pipeline compatible steps"""
from abc import ABC, abstractmethod
class Step(ABC):
"""Step in pipeline.
You *must* override "transform"
"""
@abstractmethod
def transform(self, df, y=None):
"""Transform a DataFrame"""
pass
# API compati... | tebeka/pythonwise | sklearn-pipes.py | Python | bsd-3-clause | 1,410 |
import json
from datetime import datetime
import tornado.web
from sqlalchemy import and_
from pylm.registry.handlers.persistency.db import DB
from pylm.registry.handlers.persistency.models import ClusterLog, Cluster
from pylm.registry.messages.registry_pb2 import LogMessages
class LogsHandler(tornado.web.RequestHan... | nfqsolutions/pylm-registry | pylm/registry/handlers/logs.py | Python | agpl-3.0 | 1,876 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-23 19:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0002_auto_20170824_0252'),
]
operations = [
migrations.AddField(
... | kurniantoska/ichsan_proj | unisan/base/migrations/0003_auto_20170824_0312.py | Python | apache-2.0 | 627 |
# !/usr/bin/env python3
"""
Custom Bi Directional Binary Data Parser
ModParser
"""
# ====================== GPL License and Copyright Notice ======================
# This file is part of ModParser
# Copyright (C) 2017 Diana Land
#
# This program is free software: you can redistribute it and/or modify
# it under the te... | iaz3/ModParser | modparser/__init__.py | Python | gpl-3.0 | 983 |
#!/usr/bin/env python
NOT_SURE = 2
TRUE = 1
FALSE = 0
class Expression():
def __init__(self):
self.conditions = []
def saysIsDifFrom(self, origin, different, fr):
self.conditions.append(str(origin)+'?'+str(different)+'!'+str(fr)+':'+str(different)+'='+str(fr))
def saysIsEqTo(self, origin, equals, to):
self... | diogobohm/codejam | python/2010-africa/D.py | Python | gpl-3.0 | 9,239 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.