text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.db.models.deletion
import modelcluster.fields
import wagtail.wagtailcore.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0001_squashed_0016_change_page_u... | albertoconnor/website | newsletter/migrations/0001_initial.py | Python | mit | 2,249 | 0.003557 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip i... | maartenq/ansible | test/units/modules/network/f5/test_bigip_profile_http_compression.py | Python | gpl-3.0 | 4,310 | 0.001856 |
from django.apps import AppConfig
class VodConfig(AppConfig):
name = 'vodmanagement'
verbose_name = '视频点播'
| xahhy/Django-vod | vodmanagement/apps.py | Python | lgpl-3.0 | 125 | 0 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the Account Settings page.
"""
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.lms.account_settings import AccountSettingsPage
from common.test.acceptance.tests.helpers import AcceptanceTest, EventsTestMixin
cl... | stvstnfrd/edx-platform | common/test/acceptance/tests/lms/test_account_settings.py | Python | agpl-3.0 | 2,482 | 0.001612 |
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.utils.translation import ugettext_lazy as _
urlpatterns = [
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^fitbit_api... | goodes/fit4school | fit4school/urls.py | Python | apache-2.0 | 677 | 0.001477 |
from django.test import TestCase
from tenancy.filters import *
from tenancy.models import Tenant, TenantGroup
class TenantGroupTestCase(TestCase):
queryset = TenantGroup.objects.all()
filterset = TenantGroupFilterSet
@classmethod
def setUpTestData(cls):
parent_tenant_groups = (
... | digitalocean/netbox | netbox/tenancy/tests/test_filters.py | Python | apache-2.0 | 3,818 | 0.001833 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | openstack/nova | nova/tests/unit/api/openstack/compute/test_limits.py | Python | apache-2.0 | 24,448 | 0.000286 |
# encoding: utf-8
# main.py, copyright 2014 by Marko Čibej <marko@cibej.org>
#
# This file is part of SvgMapper. Full sources and documentation
# are available here: https://github.com/tumbislav/SvgMapper
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General P... | tumbislav/SvgMapper | src/main.py | Python | gpl-3.0 | 2,923 | 0.002396 |
#
# Copyright 2015 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
# Megara DRP 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 3 of the License, or
# (at your option) an... | Pica4x6/megaradrp | megaradrp/tests/test_products.py | Python | gpl-3.0 | 2,054 | 0.011685 |
import cv2
import os
import skimage.io
output_dir = '../training_images/Final_Training/Images/00043/'
images_path = './samples/'
if not os.path.exists(output_dir):
os.makedirs(output_dir)
name = 0;
img_names = [f for f in os.listdir(images_path)
if f.endswith(".ppm")]
for img_name in img_names:
img = cv2.i... | lachaka/traffic_sign_recognition | datasets/neg_images/img_gen.py | Python | mit | 644 | 0.021739 |
#!/usr/bin/python
import re
fi = open("tree8", "r")
fo = open("tree8.dot", "wb")
fo.write("graph test {\n")
fo.write("\nflowexport=text\n")
line = fi.readline()
line = fi.readline()
line = fi.readline()
while line!= 0:
RouterList = re.sub("[^\w]", " ", line).split()
fo.write('%s[\n\tautoack ... | ashishtanwer/DFS | reader.py | Python | gpl-2.0 | 600 | 0.011667 |
import base64
import hashlib
import re
def validate_username(username):
"""Validate username.
Import modules here to prevent dependency breaking.
"""
from models import UsernameBlacklist
username = username.lower()
if (UsernameBlacklist.
objects.filter(value=username, is_regex=False... | glogiotatidis/mozillians-new | mozillians/users/helpers.py | Python | bsd-3-clause | 1,366 | 0.000732 |
from scrapy.spider import BaseSpider
from scrapy.selector import Selector
from ExchangeRate.items import ExchangerateItem
import re
class RaiffeisenSpider(BaseSpider):
name = "Raiffeisen"
allowed_domains = ["www.raiffeisen.ro"]
start_urls = [
"http://www.raiffeisen.ro/curs-valutar",
]
def parse(sel... | quamis/ExchangeRate | ExchangeRate/ExchangeRate/spiders/Raiffeisen.py | Python | gpl-2.0 | 1,581 | 0.025933 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Ad.ad_approval_status'
db.add_column(u'django_google_adwo... | alexhayes/django-google-adwords | django_google_adwords/south_migrations/0003_auto__add_field_ad_ad_approval_status.py | Python | mit | 31,311 | 0.006739 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from os import getcwd, listdir, path
from PyQt4.QtCore import SIGNAL
from Question import *
from State import State
class QCM():
# Constructeur
def __init__(self):
self.qcm={}
self.charger()
def charger(self):
curr=getcwd()
for x in listdir(curr+"/qc... | AdrienVR/ALT | QCM.py | Python | lgpl-3.0 | 2,961 | 0.044917 |
import gzip
import math
import numpy as np
class Renderer:
def reset(self):
self.fmt = getvar('pixel_buffer_format')
self.width = int(getvar('pixel_buffer_width'))
self.height = int(getvar('pixel_buffer_height'))
self.period = getvar('period')
with gzip.open('background.... | mworks/mworks | examples/Tests/Stimulus/PythonImage/image_gen.py | Python | mit | 1,385 | 0.000722 |
# Released under the GNU General Public License version 3 by J2897.
def get_page(page):
import urllib2
source = urllib2.urlopen(page)
return source.read()
title = 'WinSCP Updater'
target = 'Downloading WinSCP'
url = 'http://winscp.net/eng/download.php'
print 'Running: ' + title
print 'Target: ' + target
print ... | J2897/WinSCP_Updater | Update_WinSCP.py | Python | gpl-3.0 | 4,220 | 0.030095 |
from setuptools import setup, find_packages
setup(
name = 'jper-oaipmh',
version = '1.0.0',
packages = find_packages(),
install_requires = [
"octopus==1.0.0",
"esprit",
"Flask"
],
url = 'http://cottagelabs.com/',
author = 'Cottage Labs',
author_email = 'us@cottag... | JiscPER/jper-oaipmh | setup.py | Python | apache-2.0 | 610 | 0.029508 |
# run python freetests.py while server is running
import urllib2
import unittest
BASEURL = "http://cmput410project15.herokuapp.com"
class TestYourWebserver(unittest.TestCase):
"""
Tests some the responses from the server with urllib2
"""
def setUp(self,baseurl=BASEURL):
self.baseurl = baseurl... | TeamUACS1/410Project | tests/testResponse.py | Python | apache-2.0 | 1,144 | 0.012238 |
from sympy import (Symbol, Wild, sin, cos, exp, sqrt, pi, Function, Derivative,
abc, Integer, Eq, symbols, Add, I, Float, log, Rational, Lambda, atan2,
cse, cot, tan, S, Tuple, Basic, Dict, Piecewise, oo, Mul)
from sympy.core.basic import _aresame
from sympy.utilities.pytest import XFAIL
from sympy.abc ... | lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/core/tests/test_subs.py | Python | gpl-3.0 | 18,518 | 0.00054 |
import pprint as pp
import pandas as pd
from sklearn.linear_model import Ridge, Lasso
from sklearn.metrics import mean_absolute_error
from sklearn.model_selection import GridSearchCV, KFold, cross_val_score
from sklearn.svm import LinearSVR
from ionyx.contrib import AveragingRegressor
from ionyx.datasets import DataSet... | jdwittenauer/ionyx | tests/averaging_regressor_test.py | Python | apache-2.0 | 1,583 | 0.00379 |
import asyncio
import time
import unittest
from test_sync import setup
from pyappbase import Appbase
async def hello_world(d, data):
while d[0]:
await asyncio.sleep(0.1)
data.append("Hello")
class AsnycTests(unittest.TestCase):
def setUp(self):
self.data = {
"type": "B... | girishramnani/pyappbase | tests/test_async.py | Python | mit | 3,468 | 0.00346 |
from flask import current_app as app, request
from flask.ext.restful import Resource, abort
from tasks import library_tasks
from util import inject_user
class LibraryCleanIndexEndpoint(Resource):
@inject_user
def get(self):
task_id = request.args.get('task_id')
if not task_id:
abo... | tvgdb/pianissimo | backend/endpoints/library_clean_index_endpoint.py | Python | gpl-3.0 | 1,056 | 0.001894 |
#!/usr/bin/python
# Copyright 2009 Jay Reding
# 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 ... | Ryuno-Ki/BloGTK3 | share/blogtk2/lib/blogtk2/main.py | Python | apache-2.0 | 26,085 | 0.028944 |
import os
from django.conf import settings
def configure_settings():
"""
Configures settings for manage.py and for run_tests.py.
"""
if not settings.configured:
# Determine the database settings depending on if a test_db var is set in CI mode or not
test_db = os.environ.get('DB', None... | minervaproject/django-db-mutex | settings.py | Python | mit | 1,916 | 0.000522 |
#!/usr/bin/env python
import smtplib
mail_server = 'smtp.example.com'
mail_server_port = 465
from_addr = 'foo@example.com'
to_addr = 'bar@exmaple.com'
from_header = 'From: %s\r\n' % from_addr
to_header = 'To: %s\r\n\r\n' % to_addr
subject_header = 'Subject: Testing SMTP Authentication'
body = 'This mail tests SMTP A... | lluxury/P_U_S_A | 4_documentation/code/authentication_email.py | Python | mit | 647 | 0.006299 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 15 20:55:19 2016
@author: ajaver
"""
import json
import os
from collections import OrderedDict
import zipfile
import numpy as np
import pandas as pd
import tables
from tierpsy.helper.misc import print_flush
from tierpsy.analysis.feat_create.obtainFeaturesHelper import ... | ljschumacher/tierpsy-tracker | tierpsy/analysis/wcon_export/exportWCON.py | Python | mit | 9,522 | 0.014073 |
import logging
import re
import numpy
logger = logging.getLogger(__name__)
from hyo2.soundspeed.formats.readers.abstract import AbstractTextReader
from hyo2.soundspeed.profile.dicts import Dicts
from hyo2.soundspeed.base.callbacks.cli_callbacks import CliCallbacks
from hyo2.soundspeed.temp import coordinates
from h... | hydroffice/hyo_soundspeed | hyo2/soundspeed/formats/readers/simrad.py | Python | lgpl-2.1 | 8,879 | 0.003379 |
from ..vendor.lexicon import Lexicon
from .argument import Argument
def to_flag(name):
name = name.replace('_', '-')
if len(name) == 1:
return '-' + name
return '--' + name
def sort_candidate(arg):
names = arg.names
# TODO: is there no "split into two buckets on predicate" builtin?
s... | thedrow/invoke | invoke/parser/context.py | Python | bsd-2-clause | 7,616 | 0.000919 |
"""
File-based Checkpoints implementations.
"""
import os
import shutil
from tornado.web import HTTPError
from .checkpoints import (
Checkpoints,
GenericCheckpointsMixin,
)
from .fileio import FileManagerMixin
from IPython.utils import tz
from IPython.utils.path import ensure_dir_exists
from IPython.utils.py... | madelynfreed/rlundo | venv/lib/python2.7/site-packages/IPython/html/services/contents/filecheckpoints.py | Python | gpl-3.0 | 6,869 | 0 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
class UserAdmin(BaseUserAdmin):
list_display = ('username', 'email',
'first_name', 'last_name',
'is_staff', 'is_active',
)
admin.site.unregi... | art-solopov/mdwiki | common/admin.py | Python | mit | 369 | 0.01626 |
"""
Defines a legend for displaying components.
:copyright: 2015 Agile Geoscience
:license: Apache 2.0
"""
# from builtins import object
from io import StringIO
import csv
import warnings
import random
import re
import itertools
try:
from functools import partialmethod
except: # Python 2
from utils import pa... | agile-geoscience/striplog | striplog/legend.py | Python | apache-2.0 | 30,661 | 0.000457 |
# -*- coding: utf-8 -*-
from mangopay.utils import Address
from tests import settings
from tests.resources import BankAccount
from tests.test_base import BaseTest, BaseTestLive
from datetime import date
import responses
import time
class BankAccountsTest(BaseTest):
@responses.activate
def test_create_bankac... | Mangopay/mangopay2-python-sdk | tests/test_bankaccounts.py | Python | mit | 18,848 | 0.001061 |
"""
Abstract websocket connections (dual channel between clients and server).
"""
import socket
import errno
from datetime import datetime
from tornwamp import topic
from tornwamp.identifier import create_global_id
class ConnectionDict(dict):
"""
Connections manager.
"""
@property
def dict(self... | ef-ctx/tornwamp | tornwamp/session.py | Python | apache-2.0 | 5,335 | 0.000937 |
# pylint: disable=unused-variable,redefined-outer-name,expression-not-assigned
import os
from unittest.mock import call, patch
import pytest
from expecter import expect
from gitman import cli
@pytest.fixture
def config(tmpdir):
tmpdir.chdir()
path = str(tmpdir.join("gdm.yml"))
open(path, 'w').close()
... | jacebrowning/gdm | tests/test_cli.py | Python | mit | 1,452 | 0.000689 |
# -*- coding: utf-8 -*-
# © 2016 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import api, fields, models
from openerp.addons import decimal_precision as dp
class MrpProductionWorkcenterLine(models.Model):
_inherit = 'mrp.production.workcenter.line'
... | esthermm/odoo-addons | mrp_routing_cost/models/mrp_workcenter.py | Python | agpl-3.0 | 6,237 | 0.00016 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('photoplaces_web', '0003_photocluster_normalized_centers_dirty'),
]
operations = [
migrations.AddField(
model_nam... | joonamo/photoplaces | photoplaces/photoplaces_web/migrations/0004_auto_20141105_1236.py | Python | mit | 984 | 0.001016 |
# byteplay - Python bytecode assembler/disassembler.
# Copyright (C) 2006-2010 Noam Yorav-Raphael
# Homepage: http://code.google.com/p/byteplay
#
# This library 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 Found... | qbuat/rootpy | rootpy/extern/byteplay.py | Python | gpl-3.0 | 33,903 | 0.004808 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['PolyTrend'] , ['Seasonal_DayOfWeek'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_PolyTrend_Seasonal_DayOfWeek_NoAR.py | Python | bsd-3-clause | 171 | 0.046784 |
from formadmin.admin import FormAdmin
from formadmin import sites
from test_formadmin.forms import EmailForm, UploadForm
class EmailFormAdmin(FormAdmin):
app_label = "AdminForms"
verbose_name = "Email Staff"
class UploadFormAdmin(FormAdmin):
verbose_name = "Upload Logo"
sites.register(EmailForm, Email... | d0ugal-archive/django-formadmin | tests/test_formadmin/admin.py | Python | mit | 375 | 0.002667 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', ... | WebCampZg/conference-web | people/migrations/0001_initial.py | Python | bsd-3-clause | 2,302 | 0.005213 |
#!/usr/bin/python
# vim:ts=2:sw=2:expandtab
"""
A Python library to perform low-level Linode API functions.
Copyright (c) 2010 Timothy J Fontaine <tjfontaine@gmail.com>
Copyright (c) 2010 Josh Wright <jshwright@gmail.com>
Copyright (c) 2010 Ryan Tucker <rtucker@gmail.com>
Copyright (c) 2008 James C Sinclair <james@irg... | tjfontaine/linode-python | linode/api.py | Python | mit | 40,693 | 0.007028 |
# Copyright 2012 Pinterest.com
#
# 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 to in writing,... | ewdurbin/pymemcache | pymemcache/client/base.py | Python | apache-2.0 | 39,766 | 0 |
# script to convert the newly generated Relative Humidity
def convert_to_hur( tas_arr, vap_arr ):
import numpy as np
with np.errstate( over='ignore' ):
esa_arr = 6.112 * np.exp( 17.62 * tas_arr/ (243.12 + tas_arr) )
# esa_arr = 6.112 * np.exp( 22.46 * tas_arr / (272.62 + tas_arr) )
return vap_arr/esa_arr * 100... | ua-snap/downscale | old/old_bin/convert_tas_hur_to_vap.py | Python | mit | 2,809 | 0.050196 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Programa que actua como proxy-registrar en UDP."""
import socketserver
import socket
import sys
import json
import hashlib as HL
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
from time import time, gmtime, strftime
from random import choice, ran... | robernom/ptavi-pfinal | proxy_registrar.py | Python | gpl-2.0 | 9,377 | 0.000107 |
# coding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from datetime import date
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from haystack import connection_router, connections, indexes
from haystack.que... | fisle/django-haystack | test_haystack/simple_tests/test_simple_backend.py | Python | bsd-3-clause | 7,001 | 0.002716 |
import unittest
from PyFoam.Applications.CommonPlotLines import CommonPlotLines
theSuite=unittest.TestSuite()
| Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | unittests/Applications/test_CommonPlotLines.py | Python | gpl-2.0 | 112 | 0.008929 |
import vtk
import os
import os.path
from vis.vtkpoly import VtkPolyModel
from vis.vtkvol import VtkVolumeModel
from IO.obj import OBJReader
class VtkIO:
def __get_reader(self, file_extension):
'''Returns a reader that can read the file type having the provided extension. Returns None if no such reader.'''
lo... | zibneuro/brainvispy | IO/vtkio.py | Python | bsd-3-clause | 1,198 | 0.010017 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | sputnick-dev/weboob | modules/bp/pages/pro.py | Python | agpl-3.0 | 3,390 | 0.003542 |
# -*- test-case-name: txdav -*-
##
# Copyright (c) 2010-2014 Apple 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
#
#... | trevor/calendarserver | txdav/__init__.py | Python | apache-2.0 | 862 | 0 |
from . import shellinford
VERSION = (0, 4, 1)
__version__ = '0.4.1'
__all__ = ['FMIndex', 'bit_vector', 'bwt']
FMIndex = shellinford.FMIndex
bit_vector = shellinford.bit_vector
bwt = shellinford.bwt
| ikegami-yukino/shellinford-python | shellinford/__init__.py | Python | bsd-3-clause | 201 | 0 |
# -*- coding: utf-8 -*-
"""
################################################
Plataforma ActivUFRJ
################################################
:Author: *Núcleo de Computação Eletrônica (NCE/UFRJ)*
:Contact: carlo@nce.ufrj.br
:Date: $Date: 2009-2010 $
:Status: This is a "work in progress"
:Revision: $Revision: 0.0... | labase/activnce | main/utils/0_14_0207convertlogformat.py | Python | gpl-2.0 | 2,392 | 0.013854 |
import sys
sys.path.append("../../Crawlers/Bing/WAPI/")
from crawlerbing import crawlerbing
sys.path.append("../../Crawlers/Google/")
from crawlergoogle import crawlergoogle
class fingergrampushttp:
def __init__(self,key,header):
self.key = key
self.header = header
self.__selectUrls()
def __searchUrls(s... | overxfl0w/Grampus-Forensic-Utils | Finger-FootPrinting/GrampusHTTP/fingerghttp.py | Python | gpl-2.0 | 1,829 | 0.053581 |
# (C) British Crown Copyright 2013 - 2016, 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 l... | davidnmurray/iris | docs/iris/example_tests/test_polar_stereo.py | Python | gpl-3.0 | 1,351 | 0 |
#!/usr/bin/env python
''' Author : Huy Nguyen
Program : Create operon tree
Start : 01/01/2018
End :
'''
from Bio import SeqIO
import argparse
import os
import homolog4
import shutil
from ete3 import Tree
## Traverses the genome information directory
def traverseAll(path):
res=[]
for root,dir... | nguyenngochuy91/Ancestral-Blocks-Reconstruction | create_operon_tree.py | Python | gpl-3.0 | 9,054 | 0.01712 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 - Garrett Regier
#
# 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.
#
... | VIVEKLUCKY1848/gedit-plugins-1 | plugins/git/git/workerthread.py | Python | gpl-2.0 | 4,422 | 0.000226 |
# pylint: disable-all
import unittest
from circleci.error import CircleCIException, BadKeyError, BadVerbError, InvalidFilterError
class TestCircleCIError(unittest.TestCase):
def setUp(self):
self.base = CircleCIException('fake')
self.key = BadKeyError('fake')
self.verb = BadVerbError('fa... | levlaz/circleci.py | tests/circle/test_error.py | Python | mit | 951 | 0.001052 |
# Copyright (c) 2021, DjaoDjin Inc.
# 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 notice,
# this list of conditions and t... | djaodjin/djaodjin-deployutils | deployutils/__init__.py | Python | bsd-2-clause | 1,370 | 0 |
import json
from psycopg2.extras import Json
from django.contrib.postgres import forms, lookups
from django.core import exceptions
from django.db.models import Field, Transform
from django.utils.translation import ugettext_lazy as _
__all__ = ['JSONField']
class JSONField(Field):
empty_strings_all... | yephper/django | django/contrib/postgres/fields/jsonb.py | Python | bsd-3-clause | 3,093 | 0 |
class Repository(object):
def __init__(self, obj):
self._wrapped_obj = obj
self.language = obj[u'language'] or u'unknown'
self.name = obj[u'full_name']
def __getattr__(self, attr):
if attr in self.__dict__:
return getattr(self, attr)
else:
return ... | Rustem/toptal-blog-celery-toy-ex | celery_uncovered/toyex/models.py | Python | mit | 353 | 0 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# Make this directory into a Python package.
| abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/services/webapp/doc/__init__.py | Python | agpl-3.0 | 186 | 0.005376 |
import cPickle as pickle
import datetime
import json
from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import redis
from mapping.tasks import process_data
CONN = redis.Redis(host=settings.BROKER_HOST, port=settings.BROKER_PORT, db=6)
def pr... | crisisking/udbraaains | brains/mapping/views.py | Python | bsd-3-clause | 3,478 | 0 |
import os.path
import subprocess
from django import template
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.templatetags.static import StaticNode
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import staticfiles_storage
from... | JoltLabs/django-web-sugar | web_sugar/templatetags/jslint.py | Python | bsd-3-clause | 2,355 | 0.000849 |
#!/usr/bin/python
import os
import sys
extra_opts = {'test_suite': 'tests'}
extra_deps = []
extra_test_deps = []
if sys.version_info[:2] == (2, 6):
extra_deps.append('argparse')
extra_deps.append('simplejson')
extra_test_deps.append('unittest2')
extra_opts['test_suite'] = 'unittest2.collector'
try:
... | agilemobiledev/mongo-orchestration | setup.py | Python | apache-2.0 | 2,438 | 0 |
import unittest
from flask import Flask, views
from flask.signals import got_request_exception, signals_available
try:
from mock import Mock, patch
except:
# python3
from unittest.mock import Mock, patch
import flask
import werkzeug
from flask.ext.restful.utils import http_status_message, challenge, unautho... | CanalTP/flask-restful | tests/test_api.py | Python | bsd-3-clause | 27,561 | 0.00381 |
# Copyright 2016 The TensorFlow Authors. 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 by applica... | tornadozou/tensorflow | tensorflow/python/keras/applications/__init__.py | Python | apache-2.0 | 1,675 | 0 |
# -*- coding: utf-8 -*-
#get pricing for rackspace providers by asking rackspace.
#Outputs dicts with providers and pricing per size, per image type, suitable for mist.io's config.py
import urllib
import urllib2
import cookielib
import json
#username and password as you login in https://mycloud.rackspace.com
userna... | DimensionDataCBUSydney/mist.io | scripts/get_rackspace_pricing.py | Python | agpl-3.0 | 3,267 | 0.010713 |
#!/usr/bin/env python
import os
import sys
import dotenv
dotenv.read_dotenv()
if __name__ == "__main__":
ENVIRONMENT = os.getenv('ENVIRONMENT')
if ENVIRONMENT == 'STAGING':
settings = 'staging'
elif ENVIRONMENT == 'PRODUCTION':
settings = 'production'
else:
settings = 'devel... | GetBlimp/boards-backend | manage.py | Python | agpl-3.0 | 584 | 0 |
# Copyright 2015 Metaswitch Networks
#
# 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 to in w... | dalanlan/calico-docker | calico_containers/calico_ctl/node.py | Python | apache-2.0 | 18,774 | 0.001438 |
#!/usr/bin/env python
"""
High amount of parallel connections.
@author: David Siroky (siroky@dasir.cz)
@license: MIT License (see LICENSE.txt or
U{http://www.opensource.org/licenses/mit-license.php})
"""
import time
import logging
import sys
import os
import threading
import multiprocessing
import random
... | dsiroky/snakemq | tests/performance/packeter_connections.py | Python | mit | 3,249 | 0.003693 |
#!/usr/bin/env python
# -*- python -*-
# BEGIN_LEGAL
#
# Copyright (c) 2021 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.apache.org/license... | intelxed/xed | scripts/apply_legal_header.py | Python | apache-2.0 | 5,516 | 0.012509 |
from wtforms.validators import input_required
from wtforms import fields as wtform_fields
from ..serializers import serialize_field
from ..abstract.controller import AbstractController
from wtforms_json import flatten_json
class DummyMultiDict(dict):
def getlist(self, key):
return [self[key]]
class WTF... | firemark/zephryos | zephryos/wtform/controller.py | Python | mit | 3,101 | 0.002257 |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from __... | klahnakoski/cloc | cloc/util/queries/es_query_aggop.py | Python | mpl-2.0 | 3,106 | 0.001932 |
import unittest
import numpy as np
import six
import chainer
from chainer import cuda
import chainer.functions as F
from chainer import optimizers
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
if cuda.available:
cuda.init()
class LinearModel(object):
UNI... | woodshop/chainer | tests/optimizers_tests/test_optimizers_by_linear_model.py | Python | mit | 4,152 | 0 |
# Zeobuilder is an extensible GUI-toolkit for molecular model construction.
# Copyright (C) 2007 - 2009 Toon Verstraelen <Toon.Verstraelen@UGent.be>, Center
# for Molecular Modeling (CMM), Ghent University, Ghent, Belgium; all rights
# reserved unless otherwise stated.
#
# This file is part of Zeobuilder.
#
# Zeobuilde... | woutersmet/Zeosummer | share/plugins/molecular/sketch.py | Python | gpl-3.0 | 21,326 | 0.003189 |
"""Example views. Feel free to delete this app."""
from django import http
import jingo
def home(request):
data = {}
return jingo.render(request, 'examples/home.html', data)
| haoqili/MozSecWorld | apps/examples/views.py | Python | bsd-3-clause | 186 | 0 |
#!/usr/bin/python
# Author: Francois-Jose Serra
# Creation Date: 2010/04/26 17:17:06
from ete3 import CodemlTree
import sys, re
typ = None
while typ != 'L' and typ != 'S':
typ = raw_input (\
"choose kind of example [L]ong or [S]hort, hit [L] or [S]:\n")
TREE_PATH = "./measuring_%s_tree.nw" % (ty... | karrtikr/ete | sdoc/tutorial/examples/measuring_evolution_trees.py | Python | gpl-3.0 | 7,121 | 0.01292 |
#!/usr/bin/env python3
"""SSH into a running appliance and install VMware VDDK.
"""
import argparse
import sys
from urllib.parse import urlparse
from cfme.utils.appliance import get_or_create_current_appliance
from cfme.utils.appliance import IPAppliance
def log(message):
print(f"[VDDK-INSTALL] {message}")
def... | ManageIQ/integration_tests | scripts/install_vddk.py | Python | gpl-2.0 | 1,303 | 0.002302 |
from django.db import models
class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateTimeField()
class Meta:
index_together = [
["headline", "pub_date"],
]
| Proggie02/TestRepo | tests/regressiontests/indexes/models.py | Python | bsd-3-clause | 238 | 0 |
from __future__ import unicode_literals
import re
from django.contrib.auth.models import (AbstractBaseUser, PermissionsMixin,
UserManager)
from django.core import validators
from django.core.mail import send_mail
from django.utils.translation import ugettext_lazy as _
from noti... | othreecodes/MY-RIDE | app/models.py | Python | mit | 11,305 | 0.002565 |
import FWCore.ParameterSet.Config as cms
#---------------------------------------------------------------------------------------------------
# M A I N
#---------------------------------------------------------------------------------------------------
# create the process
pro... | cpausmit/Kraken | filefi/043/mc-notrig.py | Python | mit | 9,131 | 0.013033 |
from beautifulsoup4 import beautifulsoup4
import re
def sanitize(html):
# allow these tags. Other tags are removed, but their child elements remain
whitelist = ['em', 'i', 'strong', 'u', 'a', 'b', 'p', 'br', 'code', 'pre', 'table', 'tr', 'td' ]
# allow only these attributes on these tags. No other tags ar... | fredzannarbor/pagekicker-community | scripts_python_3/bin/sanitize.py | Python | apache-2.0 | 2,661 | 0.010147 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 o... | ProfessionalIT/professionalit-webiste | sdk/google_appengine/google/appengine/tools/devappserver2/static_files_handler.py | Python | lgpl-3.0 | 13,838 | 0.005853 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestC... | ivmech/iviny-scope | lib/xlsxwriter/test/comparison/test_cond_format03.py | Python | gpl-3.0 | 2,548 | 0.000392 |
#!/usr/bin/python
'''
*
* Copyright (C) 2013 Simone Denei <simone.denei@gmail.com>
*
* This file is part of pyrsyncgui.
*
* pyrsyncgui 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 ... | m4tto/pyrsyncgui | pyrsyncgui.py | Python | gpl-2.0 | 8,640 | 0.035069 |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
class ConnectCommand(ModuleData, Command):
implements(IPlugin, IModuleData, ICommand)
name = "ConnectCommand"
core = True
... | ElementalAlchemist/txircd | txircd/modules/rfc/cmd_connect.py | Python | bsd-3-clause | 1,451 | 0.035837 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import traceback
import os
import threading
import time
import socket
import select
descriptors = list()
Desc_Skel = {}
_Worker_Thread = None
_Lock = threading.Lock() # synchronization lock
Debug = False
def dprint(f, *v):
if Debug:
print >>sys.s... | sungyism/sungyism | gmond/python_modules/memcached/memcached.py | Python | bsd-3-clause | 11,706 | 0.009568 |
# -*- coding: utf-8 -*-
###############################################################################
# Name: launchxml.py #
# Purpose: Launch Xml Interface #
# Author: Cody Precord <cprecord@editra.org> ... | garrettcap/Bulletproof-Backup | wx/tools/Editra/plugins/Launch/launch/launchxml.py | Python | gpl-2.0 | 4,699 | 0.003831 |
from unittest import mock
import unittest
from cumulusci.tasks.salesforce import UninstallLocal
from cumulusci.utils import temporary_dir
from .util import create_task
class TestUninstallLocal(unittest.TestCase):
@mock.patch("cumulusci.tasks.metadata.package.PackageXmlGenerator.__call__")
def test_get_destru... | SalesforceFoundation/CumulusCI | cumulusci/tasks/salesforce/tests/test_UninstallLocal.py | Python | bsd-3-clause | 625 | 0.0032 |
import os
from nose.tools import assert_almost_equal, eq_, raises
import mapnik
from .utilities import execution_path, run_all
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
if 'shape' in mapnik.Datasourc... | mapycz/python-mapnik | test/python_tests/shapefile_test.py | Python | lgpl-2.1 | 5,190 | 0.000385 |
# coding:utf8
"""
无法从上层目录进行导入操作
"""
class UnableTest(object):
pass
| unlessbamboo/grocery-shop | language/python/src/package/abs_import/unable/unable_module.py | Python | gpl-3.0 | 104 | 0.012821 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sxjscience/tvm | python/tvm/auto_scheduler/search_policy.py | Python | apache-2.0 | 7,529 | 0.001992 |
#!/usr/bin/env python
from runtest import TestBase
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'float-libcall', result="""
# DURATION TID FUNCTION
[18276] | main() {
0.371 ms [18276] | expf(1.000000) = 2.718282;
0.118 ms [18276] | log(2.718282) = 1.00... | namhyung/uftrace | tests/t198_lib_arg_float.py | Python | gpl-2.0 | 799 | 0.002503 |
"""CLI tests for logging.
:Requirement: Logging
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: logging
:TestType: Functional
:CaseImportance: Medium
:Upstream: No
"""
import re
from fauxfactory import gen_string
from robottelo import (
manifests,
ssh,
)
from robottelo.cli.factory impor... | ldjebran/robottelo | tests/foreman/cli/test_logging.py | Python | gpl-3.0 | 11,539 | 0.001907 |
"""List diff preferences associated with one's account"""
# pylint: disable=invalid-name
import argparse
import logging
from libpycr.exceptions import PyCRError
from libpycr.gerrit.client import Gerrit
from libpycr.meta import GerritAccountBuiltin
from libpycr.pager import Pager
from libpycr.utils.commandline import... | JcDelay/pycr | libpycr/builtin/accounts/ls-diff-prefs.py | Python | apache-2.0 | 3,136 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Attend.user'
db.alter_column(u'events_attend', 'user_id', self.gf('django.db.models.field... | animekita/selvbetjening | selvbetjening/core/events/migrations/0006_auto__chg_field_attend_user__chg_field_payment_signee__chg_field_payme.py | Python | mit | 17,577 | 0.008136 |
from django.db import models
from pygments.lexers import get_all_lexers
from pygments.styles import get_all_styles
LEXERS = [item for item in get_all_lexers() if item[1]]
LANGUAGE_CHOICES = sorted([(item[1][0], item[0]) for item in LEXERS])
STYLE_CHOICES = sorted((item, item) for item in get_all_styles())
class Snip... | caderache2014/django-rest-tutorial | tutorial/snippets/models.py | Python | mit | 819 | 0.001221 |
# -*- coding: utf-8 -*-
'''auto ordering call chain test mixins'''
from inspect import ismodule
from twoq.support import port
class ARandomQMixin(object):
def test_choice(self):
self.assertEqual(len(list(self.qclass(1, 2, 3, 4, 5, 6).choice())), 1)
def test_sample(self):
self.assertEqual(l... | lcrees/twoq | twoq/tests/auto/ordering.py | Python | bsd-3-clause | 2,838 | 0.0074 |
r"""
Fourier transform
=================
The graph Fourier transform :meth:`pygsp.graphs.Graph.gft` transforms a
signal from the vertex domain to the spectral domain. The smoother the signal
(see :meth:`pygsp.graphs.Graph.dirichlet_energy`), the lower in the frequencies
its energy is concentrated.
"""
import numpy as... | epfl-lts2/pygsp | examples/fourier_transform.py | Python | bsd-3-clause | 1,371 | 0 |
##########################################################################
#
# Copyright (c) 2019, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... | appleseedhq/cortex | test/IECoreScene/MeshAlgoNormalsTest.py | Python | bsd-3-clause | 4,040 | 0.036139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.