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 |
|---|---|---|---|---|---|
from dependencies.dependency import implements
from lims.browser.bika_listing import BikaListingView
from dependencies.dependency import IFolderContentsView
from dependencies.dependency import IViewView
from lims import bikaMessageFactory as _
class MultifileView(BikaListingView):
"""
This class implements a ... | yasir1brahim/OLiMS | lims/browser/multifile.py | Python | agpl-3.0 | 3,461 |
# encoding: 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):
# Adding field 'UserProfile.jabber_id'
db.add_column('profiles_userprofile', 'jabber_id', self.gf('django.... | chirilo/remo | remo/profiles/migrations/0011_auto__add_field_userprofile_jabber_id.py | Python | bsd-3-clause | 6,831 |
from graphite.logger import log
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError: # Django < 1.10
MiddlewareMixin = object
class LogExceptionsMiddleware(MiddlewareMixin):
def process_exception(self, request, exception):
log.exception('Exception encountered in <{0} {1}>... | criteo-forks/graphite-web | webapp/graphite/middleware.py | Python | apache-2.0 | 396 |
###
# Copyright (c) 2005, Jeremiah Fincher
# 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 list of conditi... | tecan/xchat-rt | plugins/scripts/encryption/supybot-code-6361b1e856ebbc8e14d399019e2c53a35f4e0063/plugins/ChannelLogger/test.py | Python | gpl-2.0 | 1,753 |
# Copyright (C) 2015 Equinor ASA, Norway.
#
# The file 'test_active_list.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 th... | joakim-hove/ert | tests/libres_tests/res/enkf/test_active_list.py | Python | gpl-3.0 | 2,392 |
"""
overseer.templatetags.overseer_helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
import datetime
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.... | RPiIR/django-inforad | radiator/templatetags/radiator_helpers.py | Python | apache-2.0 | 1,553 |
# coding: utf-8
'''
This script reads data from various sources to process and store in MongoDB.
'''
import pyexcel
import logging
import json
import models
from transform_date import *
from accent_remover import *
logging.basicConfig(
filename='logs/avalicacao-contatos.info.txt', level=logging.INFO)
logger = log... | scieloorg/journals-catalog | jcatalog/transform/scielo_avaliacao_contatos_update.py | Python | bsd-2-clause | 2,509 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# API module of cve-search. Returns queries in JSON format
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 2013-2016 Alexandre Dulaunoy - [email protected]
# Copyright (c) 2014-2017 Pieter-Jan Moreels - [email protected]
# i... | deontp/misc | zenoic_api/cve-search-master/web/api.py | Python | gpl-3.0 | 13,761 |
import csv
import pytest
from .etlharness import EtlHarness
@pytest.fixture
def testopenssdp():
e = EtlHarness("openssdp", "ssdp-data")
return e
def test_file_has_header(testopenssdp):
data = (
"1470096003:128.184.1.1:'HTTP/1.1 200 OK CACHE-CONTROL\: max-age=120 ST\: urn\:schemas-upnp-org\:dev... | cybergreen-net/etl2 | tests/etl2/test_integration_openssdp.py | Python | gpl-3.0 | 5,620 |
#!/usr/bin/python
import os
from time import sleep
# The workload class MUST be loaded before the LisaBenchmark
from android import Workload
from android import LisaBenchmark
from devlib.exception import TargetError
class GeekbenchTest(LisaBenchmark):
bm_conf = {
# Target platform and board
"p... | joelagnel/lisa | tests/benchmarks/android_geekbench.py | Python | apache-2.0 | 5,646 |
# we should be able to load in a plugin multiple times without issues,
# as long as it's the same plugin.
import sys
import paraview.simple
paraview.simple.LoadDistributedPlugin("EyeDomeLightingView", True, globals())
print 'loaded the first time successfully'
paraview.simple.LoadDistributedPlugin("EyeDomeLightingVie... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/Plugins/EyeDomeLighting/ParaViewPlugin/Testing/ReloadPlugin.py | Python | gpl-3.0 | 385 |
# Copyright 2007 Matt Chaput. 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 the... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/whoosh/query/wrappers.py | Python | mit | 6,748 |
#!/usr/bin/python
import sys
from esd import ESDParser
esd = ESDParser()
esd.setEsdName(sys.argv[1])
esd.parse()
print esd.toBuildString() | nickurt/esd-parser | run.py | Python | mit | 139 |
from setuptools import setup, find_packages
setup(name='MODEL1173105855',
version=20140916,
description='MODEL1173105855 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL1173105855',
maintainer='Stanley Gu',
maintainer_url='[email protected]',
packages=find_packages(... | biomodels/MODEL1173105855 | setup.py | Python | cc0-1.0 | 377 |
# coding: utf-8
"""
weasyprint.document
-------------------
:copyright: Copyright 2011-2014 Simon Sapin and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division, unicode_literals
import io
import math
import shutil
import functools
... | johnlb/strange_wp | strange_bak/document.py | Python | gpl-3.0 | 28,054 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""build query for doclistview and return results"""
import frappe, json
import frappe.defaults
import frappe.share
import frappe.permissions
from frappe.utils import flt, cint, ... | gangadhar-kadam/verve_test_frappe | frappe/model/db_query.py | Python | mit | 12,822 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-21 18:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0004_auto_20160731_1858'),
]
operations = [
migrations.AddField(
... | TexasLAN/texaslan.org | texaslan/users/migrations/0005_user_resume.py | Python | mit | 496 |
from functools import wraps
from twisted.internet.defer import maybeDeferred
def tap(f):
"""
"Tap" a Deferred callback chain with a function whose return value is
ignored.
"""
@wraps(f)
def _cb(res, *a, **kw):
d = maybeDeferred(f, res, *a, **kw)
d.addCallback(lambda ignored: ... | fusionapp/fusion-util | fusion_util/tap.py | Python | mit | 357 |
'''Test the search interface against datafinder using solr'''
import unittest
import fetch
from sources import Datafinder8000
class TestDataFinderBasic(unittest.TestCase):
'''Check the basic functionality of Solr search of datafinder.'''
def setUp(self):
self.NAME = 'dfinder_solr'
sel... | bodleian/autobib | autobibpack/fetch_test_datafinder.py | Python | gpl-3.0 | 2,972 |
#The covariance matrix and its eigenvalues the hard way
from random import random, seed
import numpy as np
def covariance(x, y, n):
sum = 0.0
mean_x = np.mean(x)
mean_y = np.mean(y)
for i in range(0, n):
sum += (x[(i)]-mean_x)*(y[i]-mean_y)
return sum/n
n = 10
x = np.random.normal(size=n... | CompPhysics/MachineLearning | doc/Programs/DimRed/covariance.py | Python | cc0-1.0 | 876 |
# Copyright 2015 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... | karllessard/tensorflow | tensorflow/python/training/session_manager_test.py | Python | apache-2.0 | 34,121 |
# -*- coding: utf-8 -*-
import os
from pprint import pprint
import stat
import sys
from wsgiref import util
from string import Template
from watson.common.contextmanagers import suppress
from watson.console import ConsoleError, colors, command
from watson.console.decorators import arg
from watson.di import ContainerAwa... | watsonpy/watson-framework | watson/framework/support/console/commands/project.py | Python | bsd-3-clause | 15,784 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Test for -rpcbind, as well as -rpcallowip and -rpcconnect
from test_framework.test_framework im... | realzzt/BitCoin2013 | qa/rpc-tests/rpcbind_test.py | Python | mit | 4,774 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Ericsson AB
#
# 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 ... | EricssonResearch/calvin-base | calvin/runtime/north/control_apis/application_api.py | Python | apache-2.0 | 26,689 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import inspect
import logging
import logging.config
class LoggingController(object):
def __init__(self):
pro_root = os.getcwd().split("src")[0]
f_path = os.path.join(pro_root, "testconfig\\logging.conf")
logging.config.fileConfig(f... | gitjayzhen/AppiumTestProject | src/com/framework/utils/reporterutils/LogWithConfUtil.py | Python | apache-2.0 | 1,333 |
"""Linter demo"""
class Greeter(object):
"""our greeter"""
def __init__(self, name='Aleck'):
super(Greeter, self).__init__()
self.name = name
def greet(self):
"""prints hello ``self.name``"""
print('hello {}'.format(self.name))
def rename(name):
"""renames Gre... | alecklandgraf/pdbpdx | greeter.py | Python | mit | 365 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2014,2015,2016,2017 Jeremie DECOCK (http://www.jdhp.org)
# 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, ... | jeremiedecock/pyai | ailib/optimize/minimizers/cutting_plane.py | Python | mit | 40,577 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... | cackharot/suds-py3 | suds/umx/basic.py | Python | lgpl-3.0 | 1,343 |
# -*- coding: utf-8 -*-
"""Contains integration test of different learning methods on chain domain."""
from unittest import TestCase
import lspi
import numpy as np
class TestChainDomainLearning(TestCase):
def setUp(self):
self.domain = lspi.domains.ChainDomain()
sampling_policy = lspi.Policy(lsp... | rhololkeolke/lspi-python | lspi_testsuite/test_learning_chain_domain.py | Python | bsd-3-clause | 2,015 |
"""
An example that runs a single decision tree using MNIST. This single tree can
achieve ~20% error rate on a random 70/30 train/test split on the original MNIST
data (with a depth limit of 10).
==============
Copyright Info
==============
This program is free software: you can redistribute it and/or modify
it under ... | bdol/bdol-ml | decision_trees/run_decision_tree.py | Python | lgpl-3.0 | 1,993 |
import os
import numpy as np
from ase.units import Bohr, Hartree
from ase.io.elk import read_elk
from ase.calculators.calculator import FileIOCalculator, Parameters, kpts2mp, \
ReadError
elk_parameters = {
'swidth': Hartree,
}
class ELK(FileIOCalculator):
command = 'elk > elk.out'
implemented_pr... | askhl/ase | ase/calculators/elk.py | Python | gpl-2.0 | 16,824 |
# Copyright (C) 2014 Andrey Antukh <[email protected]>
# Copyright (C) 2014 Jesús Espino <[email protected]>
# Copyright (C) 2014 David Barragán <[email protected]>
# This program 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 F... | Zaneh-/bearded-tribble-back | tests/integration/test_occ.py | Python | agpl-3.0 | 15,015 |
"""
quote.py - A simple quotes module for willie
Copyright (C) 2014 Andy Chung - iamchung.com
iamchung.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 yo... | mogui/willie-modules | quote.py | Python | apache-2.0 | 9,244 |
"""
sentry.models.group
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
import math
import six
import time
import warnings
from base64 import b16decod... | wong2/sentry | src/sentry/models/group.py | Python | bsd-3-clause | 9,620 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import sys
def parse_argv():
"""Parses arguments for use with the test launcher.
Arguments are:
1. Working directory.
2. Test runner, `pytest` or `nose`
3. Rest of the arguments are passed into... | jwatson/dotfiles | config/coc/extensions/node_modules/coc-python/pythonFiles/testlauncher.py | Python | mit | 1,549 |
"""
Classes used to model the roles used in the courseware. Each role is responsible for checking membership,
adding users, removing users, and listing members
"""
from abc import ABCMeta, abstractmethod
from django.contrib.auth.models import User, Group
from xmodule.modulestore import Location
from xmodule.modulest... | mjg2203/edx-platform-seas | lms/djangoapps/courseware/roles.py | Python | agpl-3.0 | 7,324 |
"""
Various bayesian regression
"""
from __future__ import print_function
# Authors: V. Michel, F. Pedregosa, A. Gramfort
# License: BSD 3 clause
from math import log
import numpy as np
from scipy import linalg
from .base import LinearModel
from ..base import RegressorMixin
from ..utils.extmath import fast_logdet, p... | thilbern/scikit-learn | sklearn/linear_model/bayes.py | Python | bsd-3-clause | 15,086 |
#
# 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 by applicable law ... | nerdymcnerdyson/pythonPlay | openHouses/google-maps-services-python-master/googlemaps/directions.py | Python | apache-2.0 | 5,276 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 直接遍历删除
l = [1, 2, 3, 4]
for i in l:
if i != 4:
l.remove(i)
print l
# 利用index来遍历删除
l = [1, 2, 3, 4]
# l = [1, 2, 3, 4, 5]
for i in range(len(l)):
if l[i] == 4:
del l[i]
print l
print("倒序删除")
# 倒序删除
l = [1,2,3,4,5]
for i in range(len(l) - 1, ... | Akagi201/learning-python | misc/for_remove.py | Python | mit | 832 |
"""Serializers for contributor REST APIs"""
from django.contrib.auth import get_user_model
from rest_framework import serializers
from channels.serializers.validators import validate_email, validate_username
from open_discussions.serializers import WriteableSerializerMethodField
from profiles.models import Profile
Us... | mitodl/open-discussions | channels/serializers/contributors.py | Python | bsd-3-clause | 2,199 |
#!/usr/bin/env python
# Disect the wav data and plot it using pylab.
import pylab
import wave # Contains reference to struct. No point in importing it twice
FORMAT = { "11" : "1b", # Mono, 8-bit sound
"12" : "1h", # Mono, 16-bit sound
"21" : "2b", # Stereo, 8-bit sound
"22" : "2h",... | jakbob/guitarlegend | slask/readwav.py | Python | gpl-3.0 | 1,131 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Author: wwwins
# @Date: 2017-08-08 18:45:16
# @Last Modified by: wwwins
# @Last Modified time: 2017-08-11 17:52:33
import cv2
import sys
import os
import time
import argparse
import crop_face
import numpy as np
from glob import glob
from crop_face import *
DEBUG = 0
#... | wwwins/OpenCV-Samples | create-face-dataset.py | Python | mit | 3,682 |
# This challenge is similar to the previous one. It operates under the same
# premise that you will have to replace the check_equals_ function. In this
# case, however, check_equals_ is called so many times that it wouldn't make
# sense to hook where each one was called. Instead, use a SimProcedure to write
# your own ... | jakespringer/angr_ctf | solutions/10_angr_simprocedures/solve10.py | Python | gpl-3.0 | 4,935 |
import phone_number_validator
valid_numbers = ["1234567890", "123-456-7890", "123.456.7890", "(123)456-7890",
"(123) 456-7890", "456-7890"]
invalid_numbers = ["123-45-6789", "123:4567890", "123/456-7890", "123--456-7890",
"(1234)567890"]
failed_tests = []
def test_validator():
for number in valid_numbers... | JuBzzz/dailyprogrammer-challenges | easy/challenge #10/test.py | Python | mit | 830 |
#!/usr/bin/python
import re
import sys
sys.path.append('c:\\zcc\\zcc')
from public.ZCCglobal import *
from data import Data
class utility:
def __init__(self,Gen):
self.gen=Gen
self.currentMap={}
# record all map of scope
self.mapStack=[]
# global record for register uses
... | BadStudent/ZCC | generation/utility.py | Python | gpl-2.0 | 60,636 |
import pytest
from api.base.settings.defaults import API_BASE
from api_tests.providers.mixins import ProviderSubmissionListViewTestBaseMixin
from osf_tests.factories import (
ProjectFactory,
CollectionProviderFactory,
)
class TestSubmissionList(ProviderSubmissionListViewTestBaseMixin):
provider_class = C... | erinspace/osf.io | api_tests/providers/collections/views/test_collection_provider_submissions_list.py | Python | apache-2.0 | 546 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.contrib.contenttypes.management import update_contenttypes
from django.contrib.auth.management import create_permissions
from django.db import models
from django.db.models import get_app, get_models
class ... | holgerd77/django-public-project | public_project/south_migrations/0005_auto__add_sitecategory.py | Python | bsd-3-clause | 24,132 |
# Enter your code here. Read input from STDIN. Print output to STDOUT
t = int(input())
for _ in range(t):
n_A = int(input())
set_A = set(map(int, input().split()))
n_B = int(input())
set_B = set(map(int, input().split()))
print(set_A.issubset(set_B))
| MithileshCParab/HackerRank-10DaysOfStatistics | Python/Sets/check_subset.py | Python | apache-2.0 | 287 |
# Embedded file name: /usr/lib/enigma2/python/Components/Renderer/RunningText.py
from enigma import eWidget, eLabel, eTimer, ePoint, eSize, gFont, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_HALIGN_RIGHT, RT_HALIGN_BLOCK, RT_VALIGN_TOP, RT_VALIGN_CENTER, RT_VALIGN_BOTTOM, RT_WRAP
from Renderer import Renderer
from skin imp... | kingvuplus/boom | lib/python/Components/Renderer/RunningText.py | Python | gpl-2.0 | 17,373 |
def branch(str):
print("branch function: ", str)
| dcminnix/cs3240-labdemo | branch.py | Python | mit | 53 |
"""Generate reStructuredText documentation from Protocol Buffers."""
import argparse
import subprocess
import sys
import tempfile
import textwrap
from google.protobuf import descriptor_pb2
INFINITY = 10000
# pylint: disable=no-member
LABEL_TO_STR = {value: name.lower()[6:] for name, value in
descrip... | AshenDrops/hangups | docs/generate_proto_docs.py | Python | mit | 7,452 |
from django.conf.urls import url
from .views import search_app
urlpatterns = [
url(r'^$', search_app, name='search_app'),
]
| JacekKarnasiewicz/HomePage | apps/search_app/urls.py | Python | mit | 128 |
import mysql.connector
import os, yaml
class MySQLDatabaseConnection:
def __init__(self, dbname, user, host, password, options=None):
self.dbname = dbname
self.user = user
self.host = host
self.connection = mysql.connector.connect(user=user, password=password, host=host, database=db... | starakaj/wikisonnet | src/db/dbconnect.py | Python | mit | 1,322 |
from buildbot.status import html, words
from buildbot.status.web.authz import Authz
from .djangoauth import DjangoAuth
authz = Authz(
auth = DjangoAuth(),
gracefulShutdown = 'auth',
forceBuild = 'auth',
forceAllBuilds = 'auth',
pingBuilder = 'auth',
stopBuild = 'auth',
stopAllBuilds = 'auth... | hochanh/django-buildmaster | djangobotcfg/status.py | Python | bsd-3-clause | 1,158 |
import django.dispatch
project_created = django.dispatch.Signal(providing_args=["project", "user_id"])
| kanellov/openstack_project_create | openstack_project_create/signals.py | Python | mit | 104 |
from collections import defaultdict
from miniworld import singletons
from miniworld.Scenario import scenario_config
from miniworld.management.network.manager.provisioner.NetworkConfigurator import NetworkConfigurator
from miniworld.model.emulation.nodes import EmulationNode
from miniworld.util import DictUtil
from min... | miniworld-project/miniworld_core | miniworld/management/network/manager/provisioner/NetworkConfiguratorConnectionLess.py | Python | mit | 3,343 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Edilson Alzemand
import pynotify
pynotify.init("Aplicativo")
notify = pynotify.Notification("CARBONO", "Server is connected", "/opt/carbono/www/images/products.png")
notify.show()
| Computiva/carbono | notify.py | Python | mit | 241 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- mode: python -*-
# This file is part of opensearch.
# Copyright © 2009, Dansk Bibliotekscenter a/s,
# Tempovej 7-11, DK-2750 Ballerup, Denmark. CVR: 15149043
#
# opensearch is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | DBCDK/opensearch | bin/setup_postgres_check_fedora.py | Python | gpl-3.0 | 2,862 |
def move(n, fr, to, via):
if n == 1:
print "Moving pole {0} to {1}".format(fr, to)
else:
move(n - 1, fr, via, to)
move(1, fr, to, via)
move(n - 1, via, to, fr)
move(2, 1, 3, 2)
| GabrielGhe/Fun-Problems-Sol | Q7TowerOfHanoi.py | Python | mit | 202 |
import re
import itty
from restkiss.constants import OK, NO_CONTENT
from restkiss.resources import Resource
class IttyResource(Resource):
"""
A Itty-specific ``Resource`` subclass.
Doesn't require any special configuration, but helps when working in a
Itty environment.
"""
debug = False
... | CraveFood/restkiss | restkiss/it.py | Python | bsd-3-clause | 1,427 |
# Test audioop.
import audioop
from test_support import verbose
def gendata1():
return '\0\1\2'
def gendata2():
if verbose:
print 'getsample'
if audioop.getsample('\0\1', 2, 0) == 1:
return '\0\0\0\1\0\2'
else:
return '\0\0\1\0\2\0'
def gendata4():
if verbose:
prin... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/test/test_audioop.py | Python | mit | 6,587 |
"""
created on Sep 22, 2017
@author: Nikola Jajcay, jajcay(at)cs.cas.cz
"""
from .data_loaders import *
from .empirical_model import *
from .functions import *
from .geofield import *
from .mutual_inf import *
from .ssa import *
from .surrogates import *
from .var_model import *
from .wavelet_analysis import *
__all... | jajcayn/pyclits | pyclits/__init__.py | Python | mit | 661 |
from sqlalchemy import *
from migrate import *
meta = MetaData()
user_tbl = Table('user', meta)
status_col = Column('email_status', String, default='not_verified')
activation_code_col = Column('email_activation_code', String, nullable=True)
notify_new_meetup = Column('email_notify_new_meetup', Boolean, default=False... | pygraz/old-flask-website | migrations/versions/002_notificationflags.py | Python | bsd-3-clause | 896 |
__author__ = "Chris Lucian; Llewellyn Falco; Jim Counts"
from tests.approvals_config import configure_approvaltests
# begin-snippet: configure_approvaltests_under_init
# From __init__.py
configure_approvaltests()
# end-snippet
| approvals/ApprovalTests.Python | tests/__init__.py | Python | apache-2.0 | 229 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | luzheqi1987/nova-annotation | nova/tests/unit/integrated/v3/test_extended_server_attributes.py | Python | apache-2.0 | 1,583 |
from django.test import TestCase
from django.core.exceptions import ValidationError
import contacts as contact_constants
from contacts import forms
from contacts import factories
from contacts import models
class ContactFormTests(TestCase):
def setUp(self):
self.book = factories.BookFactory.create()
... | phildini/logtacts | contacts/tests/test_forms.py | Python | mit | 11,070 |
# Copyright 2015 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... | pavelchristof/gomoku-ai | tensorflow/python/ops/variable_scope.py | Python | apache-2.0 | 79,288 |
import ast
import threading
import os
from util import user_dir, print_error, print_msg
SYSTEM_CONFIG_PATH = "/etc/electrum-NMC.conf"
config = None
def get_config():
global config
return config
def set_config(c):
global config
config = c
class SimpleConfig(object):
"""
The SimpleConfig ... | testalt/electrum-NMC | lib/simple_config.py | Python | gpl-3.0 | 5,574 |
# -*- coding: utf-8 -*-
from . import order_check_prices_wizard | jgmanzanas/CMNT_004_15 | project-addons/order_line_check_price/wizard/__init__.py | Python | agpl-3.0 | 64 |
"""
This module contains a mock service setup for testing/developing the ingester engine.
Created on Mar 13, 2013
@author: nigel
"""
import logging
import time
import datetime
from twisted.web import xmlrpc
from dc24_ingester_platform.ingester.data_sources import DataSource
from dc24_ingester_platform.service impo... | jcu-eresearch/TDH-dc24-ingester-platform | dc24_ingester_platform/mock.py | Python | bsd-3-clause | 3,080 |
from django.contrib.auth import logout
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseForbidden
from churchlife.core.models import Organization, Member
class OrganizationMiddleware(object):
def process_request(self, request):
# hostname = Organization._st... | hebronlin/churchlife | authentication/middleware.py | Python | gpl-3.0 | 987 |
try:
import unittest2 as unittest
except ImportError:
import unittest
import errno
import socket
from mock import patch
from lighthouse.checks.tcp import TCPCheck
@patch("lighthouse.checks.tcp.socket")
class TCPCheckTests(unittest.TestCase):
def test_no_dependencies(self, mock_socket):
self.ass... | wglass/lighthouse | tests/checks/tcp_tests.py | Python | apache-2.0 | 6,990 |
#!/usr/bin/env python
# Test whether a client will is transmitted correctly with a null character in the middle.
import struct
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.... | zhkzyth/better-mosquitto | test/broker/07-will-null.py | Python | bsd-3-clause | 1,620 |
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from .field import *
from .boolean import *
from .integer import *
from .char import *
from .sha import *
from .text import *
from .float import *
from .numeric import *
from .d... | mediafactory/tryton_core_daemon | trytond/model/fields/__init__.py | Python | gpl-3.0 | 549 |
# -*- coding: utf-8 -*-
from __future__ import print_function
"""
This script Verifies the VNMRS Digital Controllers Flash Contents
It Compares the files on the controller's flash to those in /Vnmr/acq/download
If it finds mismatches , it downdloads the files from /vnmr/acq/download to
the controller's f... | OpenVnmrJ/OpenVnmrJ | src/ddr/adm/acq/verifyCntlrsFlash3.py | Python | apache-2.0 | 44,092 |
#! /usr/bin/env python
# author Vikas Bansal [email protected]
## TODO
## 1. print # of sites and average read-depth per site in calculateGLL code
## 3. option to flip alleles for - strand SNPs
## 4. option to delete intermediate ancestry files created
## 5. option to match SNPs using rsid or chr:position
## 6. ... | sandipchatterjee/23andus | twentythreeandus/iadmix/runancestry.py | Python | mit | 16,720 |
# K-modes clustering for categorical data
from collections import defaultdict
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.utils.validation import check_array
import sklearn.metrics
import numpy as np
from scipy import sparse
from utilities import get_max_value_key, encode_features, get_unique_r... | tab10/student_retainer | kmodes/kmodes.py | Python | mit | 16,592 |
"""
Copyright (C) 2016 kanishka-linux [email protected]
This file is part of AnimeWatch.
AnimeWatch 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) any... | abhishek-archlinux/AnimeWatch | Python-SETUP/AnimeWatch_PyQt5/stream.py | Python | gpl-3.0 | 23,453 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <[email protected]>
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1... | hryamzik/ansible | lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py | Python | gpl-3.0 | 10,400 |
#!/usr/bin/env python3
__copyright__ = 'Copyright (c) 2021-2022, Utrecht University'
__license__ = 'GPLv3, see LICENSE'
import io
from uuid import UUID
from flask import abort, Blueprint, g, render_template, request, Response, stream_with_context
import api
vault_bp = Blueprint('vault_bp', __name__,
... | UtrechtUniversity/yoda-portal | vault/vault.py | Python | gpl-3.0 | 2,943 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Customize Form is a Single DocType used to mask the Property Setter
Thus providing a better UI from user perspective
"""
import frappe
import frappe.translate
from frappe im... | StrellaGroup/frappe | frappe/custom/doctype/customize_form/customize_form.py | Python | mit | 11,412 |
ID = "commands"
permission = 0
rankdict = {"@@" : 3, "@" : 2, "+" : 1, "" : 0}
rankname = ("Guest", "Voiced", "OP", "Owner")
def execute(self, name, params, channel, userdata, rank):
perms = rankdict[rank]
group = {}
for i in range(perms+1):
group[i] = []
for cmd in self.command... | NightKev/Renol-IRC | commands/listCommands.py | Python | mit | 653 |
import numpy as np
import pytest
from pandas._libs.tslib import iNaT
from pandas.core.dtypes.dtypes import PeriodDtype
import pandas as pd
from pandas.core.arrays import PeriodArray
from pandas.tests.extension import base
@pytest.fixture
def dtype():
return PeriodDtype(freq='D')
@pytest.fixture
def data(dtyp... | cbertinato/pandas | pandas/tests/extension/test_period.py | Python | bsd-3-clause | 4,296 |
'''
Created on Jul 15, 2013
@author: http://djangosnippets.org/snippets/1961/
'''
from django.core.exceptions import ValidationError
from django.db import models
from django.forms import fields, widgets
from ipaddr import _IPAddrBase, IPAddress, IPNetwork
# from django.forms import ValidationError as FormValidationE... | tecip-nes/pyot | pyot/models/fields.py | Python | gpl-3.0 | 4,188 |
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from core.models.utils import QuerySet
from multiviews.models import View
from hashlib import md5
from re import compile as r_compile
class Skeleton_QuerySet... | redhat-cip/numeter | web-app/numeter_webapp/multiviews/models/skeleton.py | Python | agpl-3.0 | 3,317 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... | digwanderlust/pants | src/python/pants/option/global_options.py | Python | apache-2.0 | 7,890 |
#
# (c) 2017 Red Hat Inc.
#
# 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 Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | jnerin/ansible | lib/ansible/plugins/netconf/__init__.py | Python | gpl-3.0 | 9,779 |
from django import forms
class RegisterForm(forms.Form):
username = forms.SlugField(label='User Name', min_length=6, max_length=64)
password = forms.CharField(label='Password', min_length=6, max_length=64, widget=forms.PasswordInput())
passwordConfirm = forms.CharField(label='Password Confirm', min_length=... | 99cloud/keystone_register | openstack_dashboard/register/forms.py | Python | apache-2.0 | 831 |
#! /usr/bin/env python
########################################################################
# $HeadURL: $
########################################################################
__RCSID__ = "$Id: $"
from DIRAC.Core.Base import Script
Script.setUsageMessage( """
Monitor the status of the given FTS request
Usag... | avedaee/DIRAC | DataManagementSystem/scripts/dirac-dms-fts-monitor.py | Python | gpl-3.0 | 1,304 |
import unittest
import httmock
import mock
import datetime
import dateutil.tz
import json
import productstatus.api
import productstatus.exceptions
BASE_URL = 'http://192.168.254.254'
BLANK_UUID = '00000000-0000-0000-0000-000000000000'
foo_unserialized = {
"id": "66340f0b-2c2c-436d-a077-3d939f4f7283",
"slug... | metno/python-productstatus-client | productstatus/tests/test_external.py | Python | gpl-2.0 | 19,014 |
"""Support for LightwaveRF TRV - Associated Battery."""
from homeassistant.const import CONF_NAME, DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.entity import Entity
from . import CONF_SERIAL, LIGHTWAVE_LINK
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""F... | sdague/home-assistant | homeassistant/components/lightwave/sensor.py | Python | apache-2.0 | 1,686 |
"""Contains tests for xml stream writing service classes."""
from io import StringIO
from unittest import TestCase
from bidon.xml import StreamWriter
class XMLStreamWriterTestCase(TestCase):
"""Test case for the xml.StreamWriter service class."""
def test_output(self):
output = StringIO()
expected = """<... | treycucco/bidon | tests/xml/test_stream_writer.py | Python | mit | 845 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014 windpro
Author : windpro
E-mail : [email protected]
Date : 14/12/26
Desc : 路由,具体实现需要继承interface.BaseSpeed
外部缓存控制,需要添加请求头:
key : REQUESTPOOL.CACHECONTROL
value :
* async_update 异步强制更新,返回之前的数据
* async_noupdate 强制不更新,返... | windprog/requestspool | requestspool/route.py | Python | mit | 15,206 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/k8s/custom_resources/crd.py | Python | apache-2.0 | 1,140 |
from django import forms
from .models import *
class TeamForm(forms.ModelForm):
crest = forms.ImageField(required=False)
class Meta:
model = Team
fields = ('name', 'short_name', 'crest', )
widgets = {
'name': forms.TextInput(attrs={
'class': 'input-sm form-c... | Marcelpv96/SITWprac2017 | sportsBetting/forms.py | Python | gpl-3.0 | 1,955 |
from django.apps import AppConfig
class ClassesConfig(AppConfig):
name = 'classes'
| i544c/funny-dating | classes/apps.py | Python | mit | 89 |
from abc import ABC, abstractmethod
class Mutator(ABC):
"""docstring"""
mutationFactor = 0.1
def __init__(self):
pass
@abstractmethod
def applyMutation(self, problemMap, population):
pass
@abstractmethod
def make(self, problemMap, unit):
pass
| akkenoth/TSPGen | Operators/Mutation/Mutator.py | Python | mit | 304 |
##
# Copyright 2009-2018 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | bartoldeman/easybuild-easyblocks | easybuild/easyblocks/r/rosetta.py | Python | gpl-2.0 | 12,847 |
# Copyright 2014 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... | hplustree/trove | trove/rpc.py | Python | apache-2.0 | 3,857 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from jenkinsflow.flow import parallel, serial
from .framework import api_select
def test_single_level_serial(api_type):
with api_select.api(__file__, api_type) as api:
... | lechat/jenkinsflow | test/single_level_test.py | Python | bsd-3-clause | 1,549 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.