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 |
|---|---|---|---|---|---|---|
"""`Factory of Factories` pattern."""
from dependency_injector import containers, providers
class SqlAlchemyDatabaseService:
def __init__(self, session, base_class):
self.session = session
self.base_class = base_class
class TokensService:
def __init__(self, id_generator, database):
... | rmk135/objects | examples/miniapps/factory-patterns/factory_of_factories.py | Python | bsd-3-clause | 1,394 | 0 |
"""Local Media Source Implementation."""
from __future__ import annotations
import mimetypes
from pathlib import Path
from aiohttp import web
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.media_player.const import MEDIA_CLASS_DIRECTORY
from homeassistant.components.media_p... | mezz64/home-assistant | homeassistant/components/media_source/local_source.py | Python | apache-2.0 | 7,330 | 0.000546 |
import django.dispatch
# Whenever a permission object is saved, it sends out the signal. This allows
# models to keep their permissions in sync
permission_changed = django.dispatch.Signal(providing_args=('to_whom', 'to_what')) | callowayproject/django-objectpermissions | objectpermissions/signals.py | Python | apache-2.0 | 227 | 0.008811 |
# Copyright 2022 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 or ... | googleapis/python-retail | samples/interactive-tutorials/product/import_products_bq_test.py | Python | apache-2.0 | 1,917 | 0.002087 |
import pytest
from conftest import DeSECAPIV1Client
@pytest.mark.parametrize("init_rrsets", [
{
('www', 'A'): (3600, {'1.2.3.4'}),
('www', 'AAAA'): (3600, {'::1'}),
('one', 'CNAME'): (3600, {'some.example.net.'}),
('other', 'TXT'): (3600, {'"foo" "bar"', '"bar" "foo"'}),
}
])
... | desec-io/desec-stack | test/e2e2/spec/test_api_rrset.py | Python | mit | 2,838 | 0.002467 |
'''
t4_adm.py - this file is part of S3QL (http://s3ql.googlecode.com)
Copyright (C) 2008-2009 Nikolaus Rath <Nikolaus@rath.org>
This program can be distributed under the terms of the GNU GPLv3.
'''
from __future__ import division, print_function, absolute_import
from s3ql.backends import local
from s3ql.backends.c... | thefirstwind/s3qloss | tests/t4_adm.py | Python | gpl-3.0 | 2,378 | 0.002103 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.http import HttpResponse
def hello_world_view(request):
return HttpResponse("hello world", content_type="text/plain")
| ludovic-bouguerra/tutorial-travis-docker | webservice/views.py | Python | gpl-3.0 | 237 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import contents.models
class Migration(migrations.Migration):
dependencies = [
('contents', '0017_auto_20170329_1504'),
]
operations = [
migrations.AlterField(
model_name... | andersonjonathan/Navitas | navitas/contents/migrations/0018_auto_20170329_1549.py | Python | mit | 483 | 0.00207 |
# coding: utf-8
#
# This file is part of Progdupeupl.
#
# Progdupeupl 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 option) any later version.
#
# Progdu... | progdupeupl/pdp_website | pdp/utils/tests.py | Python | agpl-3.0 | 3,776 | 0 |
# Partname: ATmega16U4
# generated automatically, do not edit
MCUREGS = {
'WDTCSR': '&96',
'WDTCSR_WDIF': '$80',
'WDTCSR_WDIE': '$40',
'WDTCSR_WDP': '$27',
'WDTCSR_WDCE': '$10',
'WDTCSR_WDE': '$08',
'PORTD': '&43',
'DDRD': '&42',
'PIND': '&41',
'SPCR': '&76',
'SPCR_SPIE': '$80',
'SPCR_SPE': '... | hickey/amforth | core/devices/atmega16u4/device.py | Python | gpl-2.0 | 10,989 | 0.070252 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Fabio Falcinelli
#
# 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 3 of the License, or
# (at your option) any later version.
#
# Thi... | ffalcinelli/wstunnel | wstunnel/client.py | Python | lgpl-3.0 | 10,007 | 0.001799 |
# 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... | mixturemodel-flow/tensorflow | tensorflow/python/estimator/model_fn.py | Python | apache-2.0 | 12,164 | 0.004357 |
import logging
from airflow.contrib.hooks.bigquery_hook import BigQueryHook
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
class BigQueryOperator(BaseOperator):
"""
Executes BigQuery SQL queries in a specific BigQuery database
"""
template_fields = ('bql', 'destinatio... | Chedi/airflow | airflow/contrib/operators/bigquery_operator.py | Python | apache-2.0 | 2,155 | 0.003712 |
#!/usr/bin/python
# coding: utf-8
# 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... | arenadata/ambari | dev-support/docker/docker/bin/ambaribuild.py | Python | apache-2.0 | 8,584 | 0.033667 |
#!/usr/bin/env python
from setuptools import setup, find_packages
with open('pypd/version.py') as version_file:
exec(compile(version_file.read(), version_file.name, 'exec'))
options = {
'name': 'pypd',
'version': __version__,
'packages': find_packages(),
'scripts': [],
'description': 'A python... | ryplo/helpme | setup.py | Python | mit | 959 | 0 |
import unittest
from autosklearn.pipeline.components.classification.extra_trees import \
ExtraTreesClassifier
from autosklearn.pipeline.util import _test_classifier, \
_test_classifier_iterative_fit, _test_classifier_predict_proba
import numpy as np
import sklearn.metrics
import sklearn.ensemble
class Extra... | hmendozap/auto-sklearn | test/test_pipeline/components/classification/test_extra_trees.py | Python | bsd-3-clause | 3,415 | 0.000586 |
import unittest
from os import mkdir
from os.path import exists
from shutil import rmtree
from whoosh import fields, index, qparser, store, writing
class TestIndexing(unittest.TestCase):
def make_index(self, dirname, schema):
if not exists(dirname):
mkdir(dirname)
st = store.FileStorag... | tallstreet/Whoosh-AppEngine | tests/test_indexing.py | Python | apache-2.0 | 11,352 | 0.019204 |
from django.conf import settings
from datetime import timedelta
# Endpoint settings
OAI_BASE_URL="http"
if settings.HTTPS == "on":
OAI_BASE_URL="https"
OAI_BASE_URL=OAI_BASE_URL+"://"+settings.SITE_NAME
REPOSITORY_NAME = settings.PLATFORM_NAME
ADMIN_EMAIL = settings.TECH_SUPPORT_EMAIL
OAI_ENDPOINT_NAME = 'oai'
R... | dcosentino/edx-platform | lms/djangoapps/oai/settings.py | Python | agpl-3.0 | 1,073 | 0.008388 |
from djoser.conf import settings
__all__ = ['settings']
def get_user_email(user):
email_field_name = get_user_email_field_name(user)
return getattr(user, email_field_name, None)
def get_user_email_field_name(user):
return user.get_email_field_name()
| akalipetis/djoser | djoser/compat.py | Python | mit | 267 | 0 |
from trackers import *
| MikeDMorgan/scRNAseq | pipeline_docs/pipeline_scRnaseq/__init__.py | Python | mit | 24 | 0 |
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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.
#
#... | emesene/emesene | emesene/gui/qt4ui/TrayIcon.py | Python | gpl-3.0 | 5,102 | 0 |
# 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 datetime
import pytz
def now():
return datetime.datetime.utcnow().replace(tzinfo=pytz.UTC)
| Callek/build-relengapi | relengapi/lib/time.py | Python | mpl-2.0 | 304 | 0 |
import smbus
from time import sleep
def delay(time):
sleep(time/1000.0)
def delayMicroseconds(time):
sleep(time/1000000.0)
from hd44780 import HD44780
class Screen(HD44780):
"""A driver for MCP23008-based I2C LCD backpacks. The one tested had "WIDE.HK" written on it."""
def __init__(self, bus=1, ad... | CRImier/pyLCI | output/drivers/mcp23008.py | Python | apache-2.0 | 2,598 | 0.007698 |
# Copyright (c) 2014 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | ChameleonCloud/blazar | blazar/db/exceptions.py | Python | apache-2.0 | 1,705 | 0 |
from urlparse import urljoin
from os.path import dirname, basename
from xml.etree import ElementTree
from mimetypes import guess_type
from StringIO import StringIO
import requests
def update_print(apibase, password, print_id, progress):
"""
"""
params = {'id': print_id}
data = dict(progress=progress,... | stamen/fieldpapers | decoder/apiutils.py | Python | gpl-2.0 | 6,689 | 0.007325 |
# 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 applicable ... | MingLin-home/Ming_slim | preprocessing/cifarnet_preprocessing.py | Python | gpl-3.0 | 4,252 | 0.007291 |
#!/usr/bin/env python
import time
from nicfit.aio import Application
async def _main(args):
print(args)
print("Sleeping 2...")
time.sleep(2)
print("Sleeping 0...")
return 0
def atexit():
print("atexit")
app = Application(_main, atexit=atexit)
app.arg_parser.add_argument("--example", help="Ex... | nicfit/nicfit.py | examples/asyncio_example.py | Python | mit | 371 | 0.005391 |
from compare import expect
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.client import Client
from django.core.management import call_command
import sys
from tardis.tardis_portal.models import \
Experiment, Dataset, Dataset_File, ExperimentACL, License, UserProfile... | steveandroulakis/mytardis | tardis/tardis_portal/tests/test_rmexperiment.py | Python | bsd-3-clause | 4,827 | 0.008494 |
import subprocess
from pkg_resources import resource_filename
def playit(file):
"""
Function used to play a sound file
"""
filepath = resource_filename(__name__, 'sound/' + file)
subprocess.Popen(["paplay", filepath])
| lapisdecor/bzoinq | bzoinq/playit.py | Python | mit | 240 | 0 |
"""revert: add plugin event acl to the admin backend
Revision ID: 97e2d9949db
Revises: 1e5140290977
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '97e2d9949db'
down_revision = '1e5140290977'
POLICY_NAME = 'wazo_default_admin_policy'
ACL_TEMPLATES = ['events... | wazo-pbx/xivo-auth | alembic/versions/97e2d9949db_revert_add_plugin_event_acl_to_the_.py | Python | gpl-3.0 | 2,816 | 0.00071 |
from . import minic_ast
class PrettyGenerator(object):
def __init__(self):
# Statements start with indentation of self.indent_level spaces, using
# the _make_indent method
#
self.indent_level = 0
def _make_indent(self):
return ' ' * self.indent_level
def visit(sel... | martylee/Python | CSC410-Project-1-master/minic/pretty_minic.py | Python | gpl-2.0 | 658 | 0.00152 |
from node_view import NodeGraphView
from node_scene import NodeGraphScene
from items.node_item import NodeItem
from items.connection_item import ConnectionItem
from items.connector_item import BaseConnectorItem, IOConnectorItem, InputConnectorItem, OutputConnectorItem
import node_utils | allebacco/PyNodeGraph | pynodegraph/__init__.py | Python | mit | 286 | 0.006993 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db.models import F, Func, Value
class AlphabeticalPaginationMixin(object):
alphabetical_pagination_field = 'name'
def get_alphabetical_pagination_field(self):
return self.alphabetical_pagination_field
def get_selected_l... | sha-red/django-shared-utils | shared/utils/views/alphabetical_pagination.py | Python | mit | 1,768 | 0.002828 |
"""add graphql ACL to users
Revision ID: 2d4882d39dbb
Revises: c4d0e9ec46a9
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2d4882d39dbb'
down_revision = 'dc2848563b53'
POLICY_NAME = 'wazo_default_user_policy'
ACL_TEMPLATES = ['dird.graphql.me']
policy_tabl... | wazo-pbx/xivo-auth | alembic/versions/2d4882d39dbb_add_graphql_acl_to_users.py | Python | gpl-3.0 | 3,250 | 0.001538 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ndvi_test.py
#
# Copyright 2015 rob <rob@Novu>
#
# 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
# ... | PEAT-AI/Automato | Surveillance/make_ndvi.py | Python | gpl-3.0 | 1,020 | 0.009804 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Flowroute LLC
# Written by Matthew Williams <matthew@flowroute.com>
# Based on yum module written by Seth Vidal <skvidal at fedoraproject.org>
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... | ssssam/ansible-modules-core | packaging/os/apt.py | Python | gpl-3.0 | 24,239 | 0.004868 |
#!/usr/bin/env python
###############################################################################
# $Id: gdal2grd.py 27044 2014-03-16 23:41:27Z rouault $
#
# Project: GDAL Python samples
# Purpose: Script to write out ASCII GRD rasters (used in Golden Software
# Surfer)
# from any source supported b... | tilemapjp/OSGeo.GDAL.Xamarin | gdal-1.11.0/swig/python/samples/gdal2grd.py | Python | mit | 4,946 | 0.006066 |
#!/usr/bin/env python
'''
Faraday Penetration Test IDE - Community Version
Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/)
See the file 'doc/LICENSE' for the license information
'''
import os
import model.api
import model
import time
import datetime
from model.report import ReportManager
from model.dif... | Snifer/BurpSuite-Plugins | faraday/model/workspace.py | Python | gpl-2.0 | 20,725 | 0.008733 |
# This file is part of EventGhost.
# Copyright (C) 2005 Lars-Peter Voss <bitmonster@eventghost.org>
#
# EventGhost 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
# (a... | garbear/EventGhost | plugins/Serial/__init__.py | Python | gpl-2.0 | 13,068 | 0.003367 |
import logging, os, random
from zc.buildout import UserError, easy_install
from zc.recipe.egg import Egg
SETTINGS_TEMPLATE = '''
from %(settings_module)s import *
SECRET_KEY = "%(secret)s"
%(settings_override)s
'''
SCRIPT_TEMPLATES = {
'wsgi': easy_install.script_header + '''
%(relative_paths_setup)s
import s... | abstract-open-solutions/djc.recipe2 | djc/recipe2/recipe.py | Python | bsd-3-clause | 11,686 | 0.00077 |
from distutils.core import setup
setup(
name = 'mirobot',
packages = ['mirobot'],
version = '1.0.3',
description = 'A Python library to control Mirobot (http://mirobot.io)',
author = 'Ben Pirt',
author_email = 'ben@pirt.co.uk',
url = 'https://github.com/mirobot/mirobot-py',
download_url = 'https://githu... | mirobot/mirobot-py | setup.py | Python | mit | 623 | 0.033708 |
"""Base rope package
This package contains rope core modules that are used by other modules
and packages.
"""
__all__ = ["project", "libutils", "exceptions"]
| python-rope/rope | rope/base/__init__.py | Python | lgpl-3.0 | 161 | 0 |
import scipy.sparse as ss
import warnings
warnings.simplefilter('ignore', ss.SparseEfficiencyWarning)
from sparray import FlatSparray
class Operations(object):
params = [['FlatSparray', 'csr_matrix']]
param_names = ['arr_type']
def setup(self, arr_type):
mat = ss.rand(3000, 4000, density=0.1, format='csr'... | perimosocordiae/sparray | bench/benchmarks/ops.py | Python | mit | 1,302 | 0.016129 |
from pyspark import SparkConf, SparkContext
from jsonrpc.authproxy import AuthServiceProxy
import json
import sys
#This is batch processing of bitcoind (locally run bitcoin daemon)
#RPC (Remote Procedure Call) block's json stored
#in HDFS. Currently 187,990 blocks' json representation is
#stored in HDFS. The HDFS file... | tariq786/datafying_bitcoin | sp_batch_hdfs.py | Python | gpl-3.0 | 3,652 | 0.026013 |
# encoding: utf-8
"""Provides collection of events emitters"""
import time
from . import EndPoint
def container_count(host_fqdn, docker_client, statistics):
"""
Emit events providing:
- number of containers
- number of running containers
- number of crashed containers
:param host_fqdn:... | dockermeetupsinbordeaux/docker-zabbix-sender | docker_zabbix_sender/stats.py | Python | apache-2.0 | 2,565 | 0.00234 |
# From Python 3.6 functools.py
# Bug was in detecting "nonlocal" access
def not_bug():
cache_token = 5
def register():
nonlocal cache_token
return cache_token == 5
return register()
assert not_bug()
| rocky/python-uncompyle6 | test/simple_source/bug33/05_nonlocal.py | Python | gpl-3.0 | 230 | 0.004348 |
# coding: utf-8
from flask import Blueprint
__author__ = 'Jux.Liu'
user = Blueprint('user', __name__)
from . import views
| MOOOWOOO/Q400K | app/user/__init__.py | Python | gpl-3.0 | 125 | 0.008 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import apps
from django.forms import widgets
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from cmsplugin_cascade.fields ... | jtiki/djangocms-cascade | cmsplugin_cascade/link/plugin_base.py | Python | mit | 2,939 | 0.003403 |
__all__ = ['scraper', 'local_scraper', 'pw_scraper', 'uflix_scraper', 'watchseries_scraper', 'movie25_scraper', 'merdb_scraper', '2movies_scraper', 'icefilms_scraper',
'movieshd_scraper', 'yifytv_scraper', 'viooz_scraper', 'filmstreaming_scraper', 'myvideolinks_scraper', 'filmikz_scraper', 'clickplay_scraper... | aplicatii-romanesti/allinclusive-kodi-pi | .kodi/addons/plugin.video.salts/scrapers/__init__.py | Python | apache-2.0 | 4,030 | 0.005707 |
# Copyright 2016-2017 Alan F Rubin, Daniel C Esposito
#
# This file is part of Enrich2.
#
# Enrich2 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) ... | daniaki/Enrich2 | enrich2/sequence/aligner.py | Python | gpl-3.0 | 21,237 | 0.002025 |
#!/usr/bin/env python
from distutils.core import setup, run_setup, Command
import zmq.auth
import shutil
import os
OSAD2_PATH = os.path.dirname(os.path.realpath(__file__))
OSAD2_SERVER_CERTS_DIR = "/etc/rhn/osad2-server/certs/"
OSAD2_SERVER_PUB_KEY = os.path.join(OSAD2_SERVER_CERTS_DIR, "public_keys/server.key")
OSA... | SUSE/spacewalk-osad2 | setup.py | Python | gpl-2.0 | 4,111 | 0.002189 |
import pylab as pl
import scipy as sp
from serpentine import *
from elements import *
import visualize
class AtfExt :
def __init__(self) :
print 'AtfExt:__init__'
# set twiss parameters
mytwiss = Twiss()
mytwiss.betax = 6.85338806855804
mytwiss.alphax = 1.11230788371885
... | OscarES/serpentinetracker | examples/atf/atfExt.py | Python | gpl-3.0 | 1,975 | 0.017722 |
#! /usr/bin/env python
""" cryptopy.cipher.rijndael_test
Tests for the rijndael encryption algorithm
Copyright (c) 2002 by Paul A. Lambert
Read LICENSE.txt for license information.
"""
from cryptopy.cipher.rijndael import Rijndael
from cryptopy.cipher.base import noPadding
from binascii ... | repotvsupertuga/tvsupertuga.repository | script.module.cryptolib/lib/cryptopy/cipher/rijndael_test.py | Python | gpl-2.0 | 9,568 | 0.037312 |
# 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... | reneploetz/mesos | src/python/cli_new/lib/cli/plugins/base.py | Python | apache-2.0 | 5,461 | 0.000366 |
"""
Django settings for dts_test_project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR... | sigma-geosistemas/django-tenants | dts_test_project/dts_test_project/settings.py | Python | mit | 3,048 | 0.000656 |
#! /usr/bin/env python3
import argparse
import logging
import os
from utils import run
logging.basicConfig(level=logging.INFO)
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('dist_dir')
parser.add_argument('version')
return parser.parse_args()
args = parse_args()
DIR = os... | jendrikseipp/rednotebook-elementary | win/build-installer.py | Python | gpl-2.0 | 831 | 0.002407 |
from django.contrib import admin
from common.admin import AutoUserMixin
from licenses.models import License
class LicenseAdmin(AutoUserMixin, admin.ModelAdmin):
fieldsets = [
(None, {
'fields': ['added', 'name', 'url', 'creative_commons',
'cc_attribution', 'cc_noncomme... | seanbell/opensurfaces | server/licenses/admin.py | Python | mit | 621 | 0.00161 |
import numpy as np
from ase import Hartree
from gpaw.aseinterface import GPAW
from gpaw.lcao.overlap import NewTwoCenterIntegrals
from gpaw.utilities import unpack
from gpaw.utilities.tools import tri2full, lowdin
from gpaw.lcao.tools import basis_subset2, get_bfi2
from gpaw.coulomb import get_vxc as get_ks_xc
from gp... | ajylee/gpaw-rtxs | gpaw/lcao/pwf2.py | Python | gpl-3.0 | 16,299 | 0.00135 |
import unittest, uuid
from nixie.core import Nixie, KeyError
class NixieErrorsTestCase(unittest.TestCase):
def test_read_missing(self):
nx = Nixie()
self.assertIsNone(nx.read('missing'))
def test_update_missing(self):
nx = Nixie()
with self.assertRaises(KeyError):
nx.update('missing')
de... | eiri/nixie | tests/test_nixie_errors.py | Python | mit | 579 | 0.015544 |
from django.shortcuts import render_to_response
from django.core.context_processors import csrf
from django.conf import settings
def my_render(request, template, context={}):
context.update(csrf(request))
context['STATIC_URL'] = settings.STATIC_URL
context['flash'] = request.get_flash()
context['user'... | MERegistro/meregistro | meregistro/shortcuts.py | Python | bsd-3-clause | 533 | 0 |
# -*- coding: utf-8 -*-
from django import forms
from cmskit.articles.models import Index, Article
from cms.plugin_pool import plugin_pool
from cms.plugins.text.widgets.wymeditor_widget import WYMEditor
from cms.plugins.text.settings import USE_TINYMCE
def get_editor_widget():
"""
Returns the Django form Widg... | ozgurgunes/django-cmskit | cmskit/articles/forms.py | Python | mit | 1,271 | 0.008655 |
"""
"""
import os
import sys
import datetime
import logging
import argparse
import threading
import time
import socket
import json
import base64
import subprocess
import warnings
import numpy as np
import pandas as pd
from scipy.stats import linregress
import tables
warnings.simplefilter('ignore', category=tables.Na... | wehr-lab/RPilot | autopilot/core/pilot.py | Python | gpl-3.0 | 26,194 | 0.005612 |
# -*- coding: ascii -*-
r"""
:Copyright:
Copyright 2014 - 2016
Andr\xe9 Malo or his licensors, as applicable
:License:
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.... | ndparker/wolfe | wolfe/scheduler/_job.py | Python | apache-2.0 | 6,561 | 0 |
from builtins import str
from builtins import object
import smtplib
import email.utils
from biomaj.workflow import Workflow
import logging
import sys
if sys.version < '3':
from email.MIMEText import MIMEText
else:
from email.mime.text import MIMEText
class Notify(object):
"""
Send notifications
""... | horkko/biomaj | biomaj/notify.py | Python | agpl-3.0 | 2,306 | 0.001735 |
from __future__ import print_function
import os
twyg = ximport('twyg')
# reload(twyg)
datafiles = list(filelist( os.path.abspath('example-data')))
datafile = choice(datafiles)
configs = [ 'boxes', 'bubbles', 'edge', 'flowchart', 'hive', 'ios', 'jellyfish',
'junction1', 'junction2', 'modern', 'nazca', '... | karstenw/nodebox-pyobjc | examples/New Functions/twyg/demo1.py | Python | mit | 1,032 | 0.014535 |
# SPDX-License-Identifier: MIT
"""
Unit tests for slots-related functionality.
"""
import pickle
import sys
import types
import weakref
import pytest
import attr
from attr._compat import PY2, PYPY, just_warn, make_set_closure_cell
# Pympler doesn't work on PyPy.
try:
from pympler.asizeof import asizeof
... | python-attrs/attrs | tests/test_slots.py | Python | mit | 18,010 | 0 |
# 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 in the hope that it will be useful,
# but... | Debian/dak | daklib/conftest.py | Python | gpl-2.0 | 1,325 | 0.000755 |
import re
import copy
import logging
import datetime
import objectpath
from indra.statements import *
logger = logging.getLogger(__name__)
class EidosProcessor(object):
"""This processor extracts INDRA Statements from Eidos JSON-LD output.
Parameters
----------
json_dict : dict
A JSON dicti... | johnbachman/belpy | indra/sources/eidos/processor.py | Python | mit | 18,394 | 0 |
#----------------------------------------------------------------------
# Copyright (c) 2008 Board of Trustees, Princeton University
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, i... | dana-i2cat/felix | modules/resource/manager/stitching-entity/src/handler/geni/v3/extensions/sfa/trust/gid.py | Python | apache-2.0 | 10,122 | 0.004149 |
"""
Django settings for DocumentsFlow project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
imp... | meltiseugen/DocumentsFlow | DocumentsFlow/settings.py | Python | mit | 3,117 | 0.001283 |
# -*- coding: utf-8
from __future__ import absolute_import, unicode_literals
import django
DEBUG = True
USE_TZ = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "o0fy)a6pmew*fe9b+^wf)96)2j8)%6oz555d7by7_(*i!b8wj8"
DATABASES = {
"default": {
"ENGINE": "django.db.backe... | rparent/django-lock-tokens | tests/settings.py | Python | mit | 1,481 | 0 |
# coding=utf-8
import pytest
@pytest.fixture
def dns_sd():
from pymachinetalk import dns_sd
return dns_sd
@pytest.fixture
def sd():
from pymachinetalk import dns_sd
sd = dns_sd.ServiceDiscovery()
return sd
def test_registeringServicesFromServiceContainerWorks(dns_sd, sd):
service = dns_s... | strahlex/pymachinetalk | pymachinetalk/tests/test_dns_sd.py | Python | mit | 13,743 | 0.000291 |
from discord.ext import commands
class Github:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def permrole(self, ctx, argument:str):
await self.bot.say(';py for perm in discord.utils.get(ctx.message.server.roles, name="{}").permissions: print(perm)'.for... | shivaco/selfbot | cogs/role_perms.py | Python | gpl-3.0 | 398 | 0.012563 |
from .command_line_mixins import CommandLineMixins
from .module import Module
from .console_app import ConsoleApp
__all__ = ['CommandLineMixins', 'Module', 'ConsoleApp'] | mattvperry/ktane-py | ktane/__init__.py | Python | mit | 173 | 0.005848 |
# -*- coding: utf-8 -*-
'''Caution:
For Python 2.7, `__init__.py` file in folders is nessary.
'''
| JarryShaw/jsntlib | src/NTLArchive/__init__.py | Python | gpl-3.0 | 100 | 0 |
# Copyright 2015 Nicta
#
# 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, softwa... | sirca/clusterous | clusterous/defaults.py | Python | apache-2.0 | 3,073 | 0.002603 |
# -*- coding: utf-8 -*-
""" License
Copyright (C) 2013 YunoHost
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 Free Software Foundation, either version 3 of the License, or
(at your option) any l... | JocelynDelalande/moulinette-yunohost | lib/yunohost/hook.py | Python | agpl-3.0 | 10,947 | 0.004111 |
import sys # this allows you to read the user input from keyboard also called "stdin"
import classOne # This imports all the classOne functions
import classTwo # This imports all the classTwo functions
import classThree # This imports all the classThree functions
import classFour # This imports all the classFour fun... | nischal2002/m-quiz-2016 | quiz.py | Python | mit | 1,704 | 0.016432 |
# -*- coding: utf-8 -*-
import os
import getpass
import json
from qgis.PyQt.QtCore import QSettings
from qgis.PyQt.QtSql import QSqlDatabase, QSqlQuery
from qgis.PyQt.QtWidgets import QMessageBox
from qgis.core import *
import qgis.core
class PostNAS_AccessControl:
def __init__(self, username = None):
if(... | Kreis-Unna/PostNAS_Search | PostNAS_AccessControl.py | Python | gpl-2.0 | 12,848 | 0.006305 |
from behave import given, when, then
from slackrest.app import SlackrestApp
from slackrest.command import Visibility, Method
import json
class GiveMeAReply:
pattern = '!givemeareply'
url_format = '/reply'
visibility = Visibility.Any
body = None
method = Method.GET
class GiveMeANotification:
... | dandeliondeathray/niancat-micro | slackrest/features/steps/chat.py | Python | apache-2.0 | 2,243 | 0.001337 |
# -*- coding: utf-8 -*-
#
# django-getpaid documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 16 21:16:46 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | cypreess/django-getpaid | docs/conf.py | Python | mit | 8,687 | 0.001381 |
# Script loads 3d data from text file (after Gwyddion text importing of AFM file)
import re
import numpy as np
def ReadData(file_name):
'''
Load 3d data array from a text file. The text file is imported from Gwyddion (free SPM data analysis software).
Parameters
----------
file_name : str
... | antonsergeev/tesselect | gwyddion_import.py | Python | mit | 1,734 | 0.008661 |
# -------------------------------- Database models----------------------------------------------------------------------
import sys, os
import sqlalchemy
from sqlalchemy import create_engine
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
import secrets
import settings
MY... | MQFN/MQFN | bbmq/server/models.py | Python | apache-2.0 | 3,993 | 0.004758 |
"""Module for parsing and testing package version predicate strings.
"""
import re
import distutils.version
import operator
re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)",
re.ASCII)
# (package) (rest)
re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses
r... | Orav/kbengine | kbe/src/lib/python/Lib/distutils/versionpredicate.py | Python | lgpl-3.0 | 5,298 | 0.002643 |
import logging
import os
import sys
import time
import re
import shutil
import itertools
import ckan.plugins as p
from pylons import config
from ckan.lib.cli import CkanCommand
from ckan.lib.helpers import OrderedDict
REQUESTS_HEADER = {'content-type': 'application/json'}
class Archiver(CkanCommand):
'''
D... | datagovuk/ckanext-archiver | ckanext/archiver/commands.py | Python | mit | 19,891 | 0.001408 |
from common import bounty, peers, settings
from common.safeprint import safeprint
from multiprocessing import Queue, Value
from time import sleep, time
import pickle
def sync():
from multiprocessing import Manager
man = Manager()
items = {'config': man.dict(),
'peerList': man.list(),
... | gappleto97/Senior-Project | main.py | Python | mit | 2,530 | 0.001581 |
from __future__ import unicode_literals
from future.utils import native_str
from django.contrib import admin
from django.contrib.auth import logout
from django.contrib.messages import error
from django.contrib.redirects.models import Redirect
from django.core.exceptions import MiddlewareNotUsed
from django.core.urlres... | Kniyl/mezzanine | mezzanine/core/middleware.py | Python | bsd-2-clause | 12,608 | 0.000317 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | ademilly/waterflow | waterflow/_version.py | Python | mit | 16,749 | 0 |
# Utility functions for OpenMORA scripts
#
# Part of OpenMora - https://github.com/OpenMORA
import os, sys, string
import platform
import yaml
def get_mora_paths():
""" Returns a list of paths with MORA modules, from the env var MORA_PATH
"""
if not 'MORA_PATH' in os.environ:
print('**ERROR** Environment variabl... | OpenMORA/mora-base | scripts/morautils.py | Python | gpl-3.0 | 2,018 | 0.041625 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from foo_receiver import FooReceiver
from foo_listener_bf import FooListenerBfHelper
from PyCFFIlib_cffi import ffi, lib
import gc
class FooListenerBfImpl:
def delete_fl_in_fl(self):
print ("Not to b... | trafi/djinni | test-suite/handwritten-src/python/test_proxying.py | Python | apache-2.0 | 5,511 | 0.009254 |
# Tests for source4/libnet/py_net_dckeytab.c
#
# Copyright (C) David Mulder <dmulder@suse.com> 2018
#
# 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 3 of the License, or
# (at yo... | kernevil/samba | python/samba/tests/dckeytab.py | Python | gpl-3.0 | 2,161 | 0 |
from __future__ import unicode_literals
import json
import socket
from uuid import uuid4
from time import sleep
from urllib import urlencode
from random import randrange
from unittest import TestCase
from Queue import Queue, Empty
from contextlib import closing
from urlparse import urlparse, parse_qsl
import pytest
im... | robdennis/sideboard | sideboard/tests/test_server.py | Python | bsd-3-clause | 19,922 | 0.001757 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
""" astropy.cosmology contains classes and functions for cosmological
distance measures and other cosmology-related calculations.
See the `Astropy documentation
<https://docs.astropy.org/en/latest/cosmology/index.html>`_ for more
detailed usage examples a... | mhvk/astropy | astropy/cosmology/__init__.py | Python | bsd-3-clause | 830 | 0 |
from django.core.urlresolvers import reverse
from django.test import Client
from amcat.models import ArticleSet, Sentence, Article, Role
from amcat.tools import amcattest, sbd
import navigator.forms
from navigator.views.article_views import ArticleSplitView, handle_split, get_articles, ArticleDetailsView
class TestSp... | amcat/amcat | navigator/views/tests/test_article_views.py | Python | agpl-3.0 | 10,397 | 0.003078 |
import logging
from discord.ext import commands
from bot.cooldowns import CooldownMapping, Cooldown
from bot.globals import Auth
from utils.utilities import is_owner, check_blacklist, no_dm
terminal = logging.getLogger('terminal')
def command(*args, **attrs):
if 'cls' not in attrs:
attrs['cls'] = Comma... | s0hvaperuna/Not-a-bot | bot/commands.py | Python | mit | 2,568 | 0.000389 |
#!/usr/bin/python
################################################################################
# Bus Supervisor Interface
#
# - interfaces to the MCP23017 and PCF8574 IO expander chips
#
# The logic for this was ported from Dr Scott M. Baker's project:
# http://www.smbaker.com/z80-retrocomputing-4-bus-supervisor
#
... | BleuLlama/LlamaPyArdy | Python/devices/lib_RC2014_BusSupervisor.py | Python | mit | 4,512 | 0.068927 |
import sys, os
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from random import randint
import tempfile
def glm_gamma_offset_mojo():
train = h2o.import_file(path=pyunit_utils.locate("smalldata/prostate/prostate_complete.csv.zip"))
y = "DPROS"
x = ["AGE","RACE","CAPSULE","DCAPS... | h2oai/h2o-3 | h2o-py/tests/testdir_javapredict/pyunit_PUBDEV_8330_GLM_mojo_gamma_offset.py | Python | apache-2.0 | 1,402 | 0.021398 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timberwyck.settings")
os.environ.setdefault("DJANGO_CONFIGURATION", "Dev")
from configurations.management import execute_from_command_line
execute_from_command_line(sys.argv)
| powellc/timberwyck | manage.py | Python | bsd-3-clause | 313 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import paramiko
import threading
import sys
import re
import time
import os
def start_shell(h, u, p):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(h, 22, u, p)
s = ssh.invoke_shell()
w = threading.Th... | fangdingjun/example1 | python/ssh_c.py | Python | gpl-3.0 | 1,479 | 0.005409 |
#!/usr/bin/python3
import sys, subprocess
def main(argv=None):
if argv is None:
argv = sys.argv
experiments = {
1 : ('Continuous', 'COPD'),
2 : ('Binary', ' COPD'),
3 : ('Continuous', 'EmphysemaExtentLung'),
4 : ('Binary', 'EmphysemaExtentLung'),
}
try:
... | orting/emphysema-estimation | Experiments/07-MICCAI/Scripts/PredictTrain.py | Python | gpl-3.0 | 1,630 | 0.019018 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.