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 |
|---|---|---|---|---|---|---|
"""
Test suite for ParasitoidModel, for use with py.test
Created on Fri May 08 12:12:19 2015
Author: Christopher Strickland
Email: wcstrick@live.unc.edu
"""
import pytest
import numpy as np
import math
from scipy import sparse, signal
import ParasitoidModel as PM
import globalvars
##################################... | mountaindust/Parasitoids | tests/test_ParsitoidModel.py | Python | gpl-3.0 | 14,934 | 0.014062 |
"""
Conversion pack for October 2021 release
"""
CONVERSIONS = {
# Renamed items
"Quafe Zero": "Quafe Zero Classic",
"Exigent Sentry Drone Navigation Mutaplasmid": "Exigent Sentry Drone Precision Mutaplasmid",
}
| pyfa-org/Pyfa | service/conversions/releaseOct2021.py | Python | gpl-3.0 | 225 | 0.004444 |
# -*- coding:utf-8 -*-
# @version: 1.0
# @author:
# @date: '14-4-10'
import os
import logging
import threading
from ConfigParser import ConfigParser
from ConfigParser import NoSectionError, InterpolationMissingOptionError, Error
import simplejson as json
from utils.logger import Logger
_lock = ... | ChainBoy/init_python_project | utils/environment.py | Python | apache-2.0 | 5,907 | 0.000727 |
"""Helpers for HomeKit data stored in HA storage."""
from homeassistant.core import callback
from homeassistant.helpers.storage import Store
from .const import DOMAIN
ENTITY_MAP_STORAGE_KEY = f"{DOMAIN}-entity-map"
ENTITY_MAP_STORAGE_VERSION = 1
ENTITY_MAP_SAVE_DELAY = 10
class EntityMapStorage:
"""
Holds ... | nkgilley/home-assistant | homeassistant/components/homekit_controller/storage.py | Python | apache-2.0 | 2,471 | 0.000405 |
__author__ = 'thauser'
from mock import patch, MagicMock
from pnc_cli import productreleases
from pnc_cli.swagger_client.models import ProductReleaseRest
def test_create_product_release_object():
compare = ProductReleaseRest()
compare.version = '1.0.1.DR1'
compare.support_level = 'EOL'
result = produc... | jianajavier/pnc-cli | test/unit/test_productreleases.py | Python | apache-2.0 | 4,762 | 0.0021 |
list2=['tom','jerry','mickey']
list1=['hardy','bob','minnie']
print(list1+list2)
print(list2+list1)
print(list1*3)
print(list2+['disney','nick','pogo']) | zac11/AutomateThingsWithPython | Lists/list_concat.py | Python | mit | 155 | 0.058065 |
# 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... | scalingdata/Impala | thirdparty/hive-1.2.1.2.3.0.0-2557/lib/py/thrift/reflection/__init__.py | Python | apache-2.0 | 807 | 0.001239 |
# coding: utf-8
from sqlalchemy import Column, DateTime, ForeignKey, Integer, Text, text
from sqlalchemy.orm import relationship
from Houdini.Data import Base
metadata = Base.metadata
class Ban(Base):
__tablename__ = 'ban'
PenguinID = Column(ForeignKey(u'penguin.ID', ondelete=u'CASCADE', onupdate=u'CASCADE... | TunnelBlanket/Houdini | Houdini/Data/Ban.py | Python | mit | 936 | 0.007479 |
#
# subunit: extensions to python unittest to get test results from subprocesses.
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
#
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project sour... | kraziegent/mysql-5.6 | xtrabackup/test/python/subunit/tests/test_subunit_tags.py | Python | gpl-2.0 | 2,267 | 0.000882 |
"""
Pre-order, in-order and post-order traversal of binary trees.
Author: Wenru Dong
"""
from typing import TypeVar, Generic, Generator, Optional
T = TypeVar("T")
class TreeNode(Generic[T]):
def __init__(self, value: T):
self.val = value
self.left = None
self.right = None
# ... | wangzheng0822/algo | python/23_binarytree/binary_tree.py | Python | apache-2.0 | 2,175 | 0.001839 |
import os
import time
import threading
import warnings
from django.conf import settings
from django.db import connections
from django.dispatch import receiver, Signal
from django.utils import timezone
from django.utils.functional import empty
template_rendered = Signal(providing_args=["template", "context"])
setting... | TimBuckley/effective_django | django/test/signals.py | Python | bsd-3-clause | 4,520 | 0 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Create a ccache binary for mac hosts."""
import argparse
import os
import subprocess
import sys
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
INFRA... | youtube/cobalt | third_party/skia_next/third_party/skia/infra/bots/assets/ccache_mac/create.py | Python | bsd-3-clause | 1,385 | 0.01083 |
# Copyright (c) 2011, 2012, Jeroen Ketema, University of Twente
# 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,... | jeroenk/artisanConvert | odl/odl_extract.py | Python | bsd-3-clause | 30,114 | 0.005678 |
"""my_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | jessamynsmith/my_project | my_project/urls.py | Python | mit | 837 | 0 |
import pygame
fonts = []
is_initialized = False
FONT_TINY = 0
FONT_SMALL = 1
FONT_BIG = 2
CENTER_X = 'center_x'
def render(text, x, y, font_id, surface, render_mode=0):
global is_initialized
global fonts
if not is_initialized:
fonts = [
pygame.font.Font('gfx/MunroSmall.ttf', 10),
... | homecoded/radioberry | radio/TextRenderer.py | Python | mit | 779 | 0.002567 |
class MyClass:
def __init__(self):
print(self.a) # Haven't defined self.a yet, can't use
self.a = 5
| shweta97/pyta | examples/pylint/E0203_access_member_before_definition.py | Python | gpl-3.0 | 121 | 0 |
class Solution:
def dailyTemperatures(self, T):
ans = []
m = [None]*101
for i in range(len(T)-1, -1, -1):
x = T[i]
m[x] = i
ans.append(min([x for x in m[x+1:] if x is not None], default=i)-i)
ans.reverse()
return ans
print(Solution().dailyT... | zuun77/givemegoogletshirts | leetcode/python/739_daily-temperatures.py | Python | apache-2.0 | 367 | 0.002725 |
#!/usr/bin/env python3
# Copyright (c) 2008-11 Qtrac Ltd. All rights reserved.
# This program or module 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... | therealjumbo/python_summer | py31eg/average2_ans.py | Python | gpl-3.0 | 1,820 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-02-16 13:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tmv_app', '0080_auto_20180214_1234'),
]
operations = [
migrations.AddField(... | mcallaghan/tmv | BasicBrowser/tmv_app/migrations/0081_auto_20180216_1308.py | Python | gpl-3.0 | 767 | 0 |
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union
from django.db.models import Model
from zerver.lib.create_user import create_user_profile, get_display_email_address
from zerver.lib.initial_password import initial_password
from zerver.lib.streams import render_stream_description
from zerver.m... | brainwane/zulip | zerver/lib/bulk_create.py | Python | apache-2.0 | 6,975 | 0.004301 |
"""Support for building sinan, bootstraping it on a new version of erlang"""
import sys
import os
import commands
from optparse import OptionParser
class BuildError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
ERTS_VERSION = "5.6.3"
BU... | asceth/sinan | support/support.py | Python | mit | 1,629 | 0.003683 |
from datetime import timedelta
import pytest
from furl import furl
from api.preprint_providers.permissions import GroupHelper
from osf_tests.factories import (
ReviewActionFactory,
AuthUserFactory,
PreprintFactory,
PreprintProviderFactory,
ProjectFactory,
)
def get_actual(app, url, user=None, so... | laurenrevere/osf.io | api_tests/reviews/mixins/filter_mixins.py | Python | apache-2.0 | 9,384 | 0.001492 |
"""Constants used in Mackup."""
# Current version
VERSION = '0.8.7'
# Support platforms
PLATFORM_DARWIN = 'Darwin'
PLATFORM_LINUX = 'Linux'
# Directory containing the application configs
APPS_DIR = 'applications'
# Mackup application name
MACKUP_APP_NAME = 'mackup'
# Default Mackup backup path where it stores its f... | Timidger/mackup | mackup/constants.py | Python | gpl-3.0 | 677 | 0 |
import os
import re
import glob
import sys
#print(str(sys.argv[1]))
files = glob.glob(r'/disk2/octane_node160/'+str(sys.argv[1])+'/*.*')
files.sort()
#print(files)
result = []
for infile in files:
linestring = infile[28:]
f = open(infile)
file = f.read()
f.close()
m = re.search(r"Score \(version 9\)... | mohlerm/hotspot | evaluation/eval_octane.py | Python | gpl-2.0 | 763 | 0.011796 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestWebsiteSettings(unittest.TestCase):
pass
| adityahase/frappe | frappe/website/doctype/website_settings/test_website_settings.py | Python | mit | 227 | 0.008811 |
from product.models import *
from django.shortcuts import render_to_response
from django.views.generic import ListView, DetailView
from datetime import datetime
class ListDrink(ListView):
model = Drink
context_object_name = "product_list"
template_name = "product_list.html"
paginate_by = 5
class DetailDrink(Deta... | Elfhir/apero-imac | product/views.py | Python | mpl-2.0 | 671 | 0.026826 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Source separation algorithms attempt to extract recordings of individual
sources from a recording of a mixture of sources. Evaluation methods for
source separation compare the extracted sources from reference sources and
attempt to measure the perceptual quality of th... | JeroenZegers/Nabu-MSSS | nabu/postprocessing/scorers/bss_eval.py | Python | mit | 57,733 | 0.001472 |
#!/usr/bin/env python3
'''Check online DNSSEC signing module (just basic checks).'''
import dns.rdatatype
from dnstest.test import Test
from dnstest.utils import *
from dnstest.module import ModOnlineSign
t = Test(stress=False)
ModOnlineSign.check()
knot = t.server("knot")
zones = t.zone_rnd(4, dnssec=False, recor... | CZ-NIC/knot | tests-extra/tests/modules/onlinesign/test.py | Python | gpl-3.0 | 2,463 | 0.001624 |
# -*- coding: utf-8 -*-
__author__ = 'Ostico <ostico@gmail.com>'
import unittest
import os
os.environ['DEBUG'] = "1"
os.environ['DEBUG_VERBOSE'] = "0"
import pyorient
class CommandTestCase(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(CommandTestCase, self).__init__(*args, **kwargs)
... | orientechnologies/pyorient | tests/test_record_contents.py | Python | apache-2.0 | 12,906 | 0.000852 |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/LICENSE
import collections
from astroid import nodes
class ASTWalker:
def __init__(self, linter):
# callbacks per node types
self.nbstatements = 0
s... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/pylint/utils/ast_walker.py | Python | mit | 3,263 | 0.000306 |
import datetime, re
from mod_helper import *
debug = True
def sesamstrasseShow():
mediaList = ObjectContainer(no_cache=True)
if debug == True: Log("Running sesamstrasseShow()...")
try:
urlMain = "http://www.sesamstrasse.de"
content = getURL(urlMain+"/home/homepage1077.html")
spl = content.split('<div class=... | realriot/KinderThek.bundle | Contents/Code/mod_sesamstrasse.py | Python | bsd-3-clause | 3,151 | 0.047287 |
import os
from pymco.test import ctxt
from . import base
class RabbitMQTestCase(base.IntegrationTestCase):
'''RabbitMQ integration test case.'''
CTXT = {
'connector': 'rabbitmq',
'plugin.rabbitmq.vhost': '/mcollective',
'plugin.rabbitmq.pool.size': '1',
'plugin.rabbitmq.pool.... | rafaduran/python-mcollective | tests/integration/test_with_rabbitmq.py | Python | bsd-3-clause | 1,771 | 0 |
# -*- coding: utf-8 -
#
# This file is part of socketpool.
# See the NOTICE for more information.
import eventlet
from eventlet.green import select
from eventlet.green import socket
from eventlet import queue
from socketpool.pool import ConnectionPool
sleep = eventlet.sleep
Socket = socket.socket
Select = select.sel... | emidln/django_roa | env/lib/python2.7/site-packages/socketpool/backend_eventlet.py | Python | bsd-3-clause | 1,213 | 0.002473 |
from __future__ import print_function
from __future__ import division
from builtins import input
import subprocess
from time import sleep
from pivotpi import *
try:
import wx
except ImportError:
raise ImportError,"The wxPython module is required to run this program"
total_servos = 8
horizontal_spacer = 20
v... | karan259/PivotPi | Software/Python/Control_Panel/pivot_control_with_sliders.py | Python | mit | 7,313 | 0.008615 |
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(
paramiko.AutoAddPolicy())
ssh.connect('127.0.0.1', username='xxxxxxx',
password='xxxxxxxxxxx')
stdin, stdout, stderr = ssh.exec_command("uptime")
type(stdin)
stdout.readlines()
| eldie1984/Scripts | pg/para.py | Python | gpl-2.0 | 262 | 0.007634 |
# Moothedata command.
import click
import fiona as fio
from fiona.fio.cli import cli
from fio_metasay import moothedata
@cli.command(short_help="Cowsay some dataset metadata.")
@click.argument(
'inputfile',
type=click.Path(resolve_path=True),
required=True,
metavar="INPUT")
@click.option('--item', ... | geowurster/fio-plugin-example | fio_metasay/scripts/cli.py | Python | mit | 575 | 0 |
"""
Powers of Three: Given a positive integer N, return the largest integer k such
that 3**k < N.
For example,
>>> largestPower(3)
0
>>> largestPower(4)
1
>>> largestPower(28)
3
>>> largestPower(80)
3
>>> largestPower(82)
4
>>> largestPower(20700)
9
>>> largestPower(10**7)
14
>>> largestPower(10**8)
16
"""
from mat... | FranzSchubert92/cw | python/powers_of_3.py | Python | bsd-3-clause | 908 | 0.007709 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import chainer
from chainer import functions as F
from chain... | toslunar/chainerrl | tests/agents_tests/basetest_pgt.py | Python | mit | 3,966 | 0 |
import pytest
class TestDmypy:
@pytest.mark.complete(
"dmypy ", require_cmd=True, xfail="! dmypy --help &>/dev/null"
)
def test_commands(self, completion):
assert "help" in completion
assert not any("," in x for x in completion)
@pytest.mark.complete("dmypy -", require_cmd=Tru... | algorythmic/bash-completion | test/t/test_dmypy.py | Python | gpl-2.0 | 423 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-26 04:44
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | qrizan/moopy | moopy/genres/migrations/0001_initial.py | Python | mit | 1,137 | 0.001759 |
import numpy as np
class Site(object):
"""A class for general single site
Use this class to create a single site object. The site comes with identity
operator for a given dimension. To build specific site, additional operators
need be add with add_operator method.
"""
def __init__(sel... | fhqgfss/MoHa | moha/modelsystem/sites.py | Python | mit | 7,169 | 0.02176 |
import attr
import types
import binascii
from eliot import start_action
from eliot.twisted import DeferredContext
from zope.interface import implementer
from sphinxmixcrypto import SphinxParams, SphinxPacket, ReplyBlock
from sphinxmixcrypto import IMixPKI, IReader, SECURITY_PARAMETER
from txmix import IMixTranspor... | applied-mixnetworks/txmix | txmix/client.py | Python | gpl-3.0 | 6,459 | 0.002322 |
"""URL Shortener backend for Zinnia Hashids"""
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from zinnia.settings import PROTOCOL
from zinnia_hashids.factory import hashids
def backend(entry):
"""
Hashids URL shortener backend for Zinnia.
"""
hashed_pk = h... | django-blog-zinnia/zinnia-url-shortener-hashids | zinnia_hashids/backend.py | Python | bsd-3-clause | 501 | 0 |
import rdflib
g = rdflib.Graph()
g.parse('astronomical_database/data/rdf/astronomical_database.rdf')
result = g.query("""
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ontology: <urn://sedatar.org/astronomical_database#>
# All cla... | mathiasuhlenbrock/sedatar | astronomical_database/scripts/python/test_query.py | Python | gpl-3.0 | 1,551 | 0 |
#!/bin/python3
import sys
fact = lambda n: 1 if n <= 1 else n * fact(n - 1)
n = int(input().strip())
fct = fact(n)
print(fct)
| lilsweetcaligula/Online-Judges | hackerrank/algorithms/implementation/medium/extra_long_factorials/py/solution.py | Python | mit | 134 | 0.022388 |
'''
Setup script for FuzzyFileFinder.
'''
import setuptools
from fff import __project__, __version__, CLI
README = 'README.md'
setuptools.setup(name='fff',
version=__version__,
description='Fuzzy File Finder.',
url="https://github.com/jkloo/fff",
... | jkloo/fff | setup.py | Python | mit | 718 | 0.001393 |
__author__ = 'shuai'
class Solution:
# @param {integer[]} nums
# @return {string}
def largestNumber(self, nums):
ret = ""
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
str_i = str(nums[i])
str_j = str(nums[j])
if st... | shuaizi/leetcode | leetcode-python/num179.py | Python | apache-2.0 | 685 | 0.00146 |
import pyb
#from pyb import I2C, SPI, UART
#import staccel
import math
#import os
#import gc # garbage collection for writing?
#import microsnake
#from microsnake import MicroSnakeGame as Game
#from microsnake import move_arrow_pressed
import shared_globals
#from shared_globals import move_arrow_pressed as move_ar... | gr4viton/gr4Dalek | spine/dd/spine/dcmotor.py | Python | gpl-3.0 | 3,260 | 0.009202 |
#!/usr/local/sci/bin/python
#*****************************
#
# Cloud Coverage Logical Check (CCC)
#
#
#************************************************************************
# SVN Info
#$Rev:: 67 $: Revision of last commit
#$Author:: rdunn ... | rjhd2/HadISD_v2 | qc_tests/clouds.py | Python | bsd-3-clause | 8,787 | 0.019119 |
# coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import socket
import os
import re
import select
import time
import paramiko
import struct
import fcntl
import signal
import textwrap
import getpass
import fnmatch
import readline
import datetime
from multiprocessing import Pool
os.environ['DJANGO... | watchsky126/jumpserver | connect.py | Python | gpl-2.0 | 12,846 | 0.002802 |
import unittest
import env
from linalg.vector import Vector
class TestVectorOperations(unittest.TestCase):
def test_vector_equality(self):
a = Vector([1, 2, 3])
b = Vector([1, 2, 3])
self.assertEqual(a, b)
def test_vector_inequality(self):
a = Vector([1, 2, 3])
b = V... | jeancochrane/learning | linear-algebra/tests/test_vector_operations.py | Python | mit | 5,540 | 0.000181 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup script for building clr.pyd and dependencies using mono and into
an egg or wheel.
"""
import collections
import fnmatch
import glob
import os
import subprocess
import sys
import sysconfig
from distutils import spawn
from distutils.command import build_ext, insta... | vmuriart/pythonnet | setup.py | Python | mit | 15,375 | 0 |
def bucketsort(arr, k):
"""
Input:
arr: A list of small ints
k: Upper bound of the size of the ints in arr (not inclusive)
Precondition:
all(isinstance(x, int) and 0 <= x < k for x in arr)
Output:
The elements of arr in sorted order
"""
counts = [0] * k
for x ... | evandrix/Splat | code/demo/quixey/bucket_sort.py | Python | mit | 471 | 0 |
# Copyright (c) 2013 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... | bigswitch/neutron | neutron/tests/unit/extensions/test_agent.py | Python | apache-2.0 | 7,074 | 0 |
# Copyright 2011 Eldar Nugaev
# 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 ... | tylertian/Openstack | openstack F/nova/nova/tests/api/openstack/compute/contrib/test_server_diagnostics.py | Python | apache-2.0 | 2,735 | 0 |
import bpy
# -----------------------------------------------------------------------------
# Draw UI, use an function to be append into 3D View Header
# -----------------------------------------------------------------------------
def ui_3D(self, context):
layout = self.layout
row = layout.row(align=True)
... | stilobique/Icon-Header | views/header.py | Python | gpl-3.0 | 1,454 | 0.002063 |
import bountyfunding
from bountyfunding.core.const import *
from bountyfunding.core.data import clean_database
from test import to_object
from nose.tools import *
USER = "bountyfunding"
class Email_Test:
def setup(self):
self.app = bountyfunding.app.test_client()
clean_database()
def ... | bountyfunding/bountyfunding | test/integration_test/email_test.py | Python | agpl-3.0 | 1,266 | 0.006319 |
import logging
from mongoengine import *
from flask.ext.security import RoleMixin
from flask.ext.security import UserMixin
log = logging.getLogger(__name__)
class AuthRole(Document, RoleMixin):
name = StringField(max_length=80, unique=True)
description = StringField(max_length=255)
def __str__(self):
... | romansalin/testrail-reporting | testrail_reporting/auth/models.py | Python | apache-2.0 | 1,147 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging as loggers
import numpy as np
import theano.tensor as T
from theano.tensor.nnet import conv
from theano.tensor.signal import downsample
from deepy.utils import build_activation, UniformInitializer
from deepy.layers.layer import NeuralLayer
logging = log... | ZhangAustin/deepy | deepy/layers/conv.py | Python | mit | 2,682 | 0.001491 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# Copyright 2011 - 2012, Red Hat, 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
#
# ... | citrix-openstack-build/trove | trove/openstack/common/rpc/impl_qpid.py | Python | apache-2.0 | 26,203 | 0 |
from os import path
from collections import namedtuple
from subprocess import Popen, PIPE
def sys(cmd):
return Popen(cmd, stdout=PIPE, shell=True).stdout.read()
class USB:
'''
Depends on findmnt to find source from target and extra information like fs type
'''
def __init__(self, target):
try:
... | ixtabinnovations/USB_Cryptor | USB.py | Python | gpl-3.0 | 993 | 0.021148 |
from django.test import TestCase, Client
from jpspapp.models import Club, Activity,UserProfile
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
import datetime
# Create your tests here.
class ClubTestCase(TestCase):
def setUp(self):
User.objects.create_user(... | AlienStudio/jpsp_python | jpsp/jpspapp/tests.py | Python | mit | 3,241 | 0.00779 |
#!/usr/bin/env python
from unittest import TestCase
from before_after import before, after, before_after
from before_after.tests import test_functions
class TestBeforeAfter(TestCase):
def setUp(self):
test_functions.reset_test_list()
super(TestBeforeAfter, self).setUp()
def test_before(self... | c-oreills/before_after | before_after/tests/test_before_after.py | Python | gpl-2.0 | 2,890 | 0.000346 |
#! /usr/bin/env python
"""
Simulate DSR over a network of nodes.
Revision Info
=============
* $LastChangedBy: mandke $
* $LastChangedDate: 2011-10-26 21:51:40 -0500 (Wed, 26 Oct 2011) $
* $LastChangedRevision: 5314 $
:author: Ketan Mandke <kmandke@mail.utexas.edu>
:copyright:
Copyright 2009-2011 The Universit... | reidlindsay/wins | sandbox/experiments/dsr/icc/test.py | Python | apache-2.0 | 15,846 | 0.011612 |
# #
# Copyright 2012-2019 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 (... | gppezzi/easybuild-framework | easybuild/toolchains/mpi/psmpi.py | Python | gpl-2.0 | 1,693 | 0.001772 |
"""
Common test utilities for courseware functionality
"""
from abc import ABCMeta, abstractmethod
from datetime import datetime
import ddt
from mock import patch
from lms.djangoapps.courseware.url_helpers import get_redirect_url
from student.tests.factories import AdminFactory, UserFactory, CourseEnrollmentFactory
f... | rhndg/openedx | lms/djangoapps/courseware/testutils.py | Python | agpl-3.0 | 7,021 | 0.002564 |
from uuid import uuid4
from Firefly import logging, scheduler
from Firefly.components.virtual_devices import AUTHOR
from Firefly.const import (COMMAND_UPDATE, DEVICE_TYPE_THERMOSTAT, LEVEL)
from Firefly.helpers.action import Command
from Firefly.helpers.device.device import Device
from Firefly.helpers.metadata.metadat... | Firefly-Automation/Firefly | Firefly/components/nest/thermostat.py | Python | apache-2.0 | 7,969 | 0.010415 |
from __future__ import absolute_import
import itertools
from time import time
from . import Errors
from . import DebugFlags
from . import Options
from .Visitor import CythonTransform
from .Errors import CompileError, InternalError, AbortError
from . import Naming
#
# Really small pipeline stages
#
def dumptree(t):
... | achernet/cython | Cython/Compiler/Pipeline.py | Python | apache-2.0 | 13,086 | 0.003897 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
QGIS Server HTTP wrapper for testing purposes
================================================================================
This script launches a QGIS Server listening on port 8081 or on the port
specified on the environment variable QGIS_SERVER_PORT.
Hostname is ... | minorua/QGIS | tests/src/python/qgis_wrapped_server.py | Python | gpl-2.0 | 19,452 | 0.00257 |
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
__author__ = "Ole Christian Weidner"
__copyright__ = "Copyright 2012, Ole Christian Weidner"
__license__ = "MIT"
import sys, time, uuid
import getpass
import bliss.saga as saga
def run(remote_base_url, local_file_to_copy):
"""Test... | saga-project/bliss | test/compliance/file/03_copy_local_remote_etc.py | Python | mit | 2,709 | 0.014766 |
#! /usr/bin/env python
import numpy as np
def writeDataToFile(filename, data,
fieldNames=[],
constantsNames=[],
constantsValues=[],
appendFile=False,
addTimeField=False,
dataFormat='%10.5f'):
commentsStr = '#! '
delimiterStr =' '
if(a... | valsson/MD-MC-Codes-2016 | LJ7-2D_MD-sampling/DataTools.py | Python | mit | 3,140 | 0.014013 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-22 21:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('statusboard', '0015_merge_20170222_2058'),
]
operations = [
migrations.AddF... | edigiacomo/django-statusboard | statusboard/migrations/0016_service_position.py | Python | gpl-2.0 | 464 | 0 |
# -*- encoding: utf-8 -*-
from dateutil.relativedelta import relativedelta
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q
from django.utils import timezone
from reversion import revisions as reversion
from base.model_utils import TimeStampedModel
from bas... | pkimber/booking | booking/models.py | Python | apache-2.0 | 10,565 | 0.000947 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016 CERN.
#
# CERN Document Server 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 ... | drjova/cds-demosite | cds/modules/ffmpeg/ffmpeg.py | Python | gpl-2.0 | 3,735 | 0.002677 |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth import views as auth_views
from django.contrib.auth import logout
from django.views.decorators.csrf import csrf_protect
from django.shortcuts import render_... | Ignoramuss/LDERP | LDERPdjango/login/views.py | Python | apache-2.0 | 8,998 | 0.002223 |
# -*- coding: utf-8 -*-
"""
Abstract: Creates RDF for earthquake objects.
Gets an Array of Python Earthquake objects and turns them to RDF using RDFlib.
The RDF can either be outputted or written to a file.
This class does not inherit from RDFWriter!
"""
__author__ = "Marc Tim Thiemann"
__copyright__ = "Copyright ... | liangcun/ConceptsOfSpatialInformation | CoreConceptsPy/GdalPy/examples/events/earthquake/EarthquakeRdfWriter2.py | Python | apache-2.0 | 3,451 | 0.010207 |
#!/usr/bin/env python
# Copyright (C) 2012 Andrea Valle
#
# This file is part of swgit.
#
# swgit 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 lat... | andreav/swgit | core/ObjMail.py | Python | gpl-3.0 | 5,260 | 0.028897 |
# Copyright 2009 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 or agreed to in writing, ... | codegooglecom/jaikuengine | common/test/throttle.py | Python | apache-2.0 | 1,689 | 0.003552 |
"""
termcolors.py
"""
from django.utils import six
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = {color_names[x]: '3%s' % x for x in range(8)}
background = {color_names[x]: '4%s' % x for x in range(8)}
RESET = '0'
opt_dict = {'bold': '1', 'underscore': '4', 'blink... | SujaySKumar/django | django/utils/termcolors.py | Python | bsd-3-clause | 7,479 | 0.000669 |
"""Phone number to time zone mapping functionality
>>> import phonenumbers
>>> from phonenumbers.timezone import time_zones_for_number
>>> ro_number = phonenumbers.parse("+40721234567", "RO")
>>> tzlist = time_zones_for_number(ro_number)
>>> len(tzlist)
1
>>> str(tzlist[0])
'Europe/Bucharest'
>>> mx_number = phonenumb... | vicky2135/lucious | oscar/lib/python2.7/site-packages/phonenumbers/timezone.py | Python | bsd-3-clause | 4,947 | 0.001819 |
VERSION_MAJOR = 0
VERSION_MINOR = 2
VERSION_PATCH = 0
version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
version = '%i.%i.%i' % version_info
__version__ = version
__all__ = ['version', 'version_info', '__version__']
| pyblish/pyblish-standalone | pyblish_standalone/version.py | Python | lgpl-3.0 | 229 | 0 |
from pycp2k.inputsection import InputSection
from ._neighbor_lists3 import _neighbor_lists3
from ._subcell1 import _subcell1
from ._ewald_info1 import _ewald_info1
class _print26(InputSection):
def __init__(self):
InputSection.__init__(self)
self.NEIGHBOR_LISTS = _neighbor_lists3()
self.SU... | SINGROUP/pycp2k | pycp2k/classes/_print26.py | Python | lgpl-3.0 | 526 | 0.003802 |
# vim: set fileencoding=UTF-8
import re
from datetime import timedelta
from django.forms import Field
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.dateparse import parse_duration
from django.utils.duration import duration_string
from .uti... | jmerdich/django-natural-duration | natural_duration/fields.py | Python | bsd-3-clause | 4,597 | 0.000218 |
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | murgatroid99/grpc | src/python/grpcio_tests/tests/interop/_insecure_intraop_test.py | Python | apache-2.0 | 1,452 | 0 |
from setuptools import setup, find_packages
import sys
if sys.version_info[0] < 3 or sys.version_info[1] < 5:
sys.exit('Sorry, Python < 3.5 is not supported')
setup(name='waybackscraper',
version='0.5',
description='Scrapes a website archives on the wayback machine using asyncio.',
author='Arthu... | abrenaut/waybackscraper | setup.py | Python | mit | 608 | 0.001645 |
"""
SCL; 2011, 2012.
"""
version = "0.2"
from btsynth import *
from gridworld import *
| slivingston/btsynth | btsynth/__init__.py | Python | bsd-3-clause | 89 | 0.022472 |
# FALL 2014 Computer Networks SEECS NUST
# BESE 3
# Dr Nadeem Ahmed
# BadNet2: Errors every 5th Packet
# Usage: BadNet.transmit instead of sendto
from socket import *
class BadNet:
dummy=' '
counter = 1
@staticmethod
def transmit(csocket,message,serverName,serverPort):
# print 'Got a packet' + str(BadNet.cou... | rupfw/rup1.0 | RUP1.0/Server/Badnet/BadNet2.py | Python | gpl-2.0 | 905 | 0.060773 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | nii-cloud/dodai-compute | nova/scheduler/driver.py | Python | apache-2.0 | 14,688 | 0.000204 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.share
from frappe import _
from frappe.utils import cstr, now_datetime, cint, flt
from erpnext.controllers.status_updater im... | manqala/erpnext | erpnext/utilities/transaction_base.py | Python | gpl-3.0 | 5,360 | 0.024254 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/api_error.py | Python | mit | 1,621 | 0.000617 |
#!/usr/bin/python
#
# Copyright (C) Citrix Systems Inc.
#
# This program 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; version 2.1 only.
#
# This program is distributed in the hope that it will be use... | xapi-project/sm | drivers/mpath_cli.py | Python | lgpl-2.1 | 3,107 | 0.001931 |
"""Support for monitoring OctoPrint sensors."""
from __future__ import annotations
from datetime import datetime, timedelta
import logging
from pyoctoprintapi import OctoprintJobInfo, OctoprintPrinterInfo
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorStateClass,
)
f... | home-assistant/home-assistant | homeassistant/components/octoprint/sensor.py | Python | apache-2.0 | 7,576 | 0.000396 |
#!/usr/bin/env python3
"""
test/unit_tests_d/ut_daemon.py: unit test for the MMGen suite's Daemon class
"""
from subprocess import run,DEVNULL
from mmgen.common import *
from mmgen.daemon import *
from mmgen.protocol import init_proto
def test_flags():
d = CoinDaemon('eth')
vmsg(f'Available opts: {fmt_list(d.avail... | mmgen/mmgen | test/unit_tests_d/ut_daemon.py | Python | gpl-3.0 | 4,118 | 0.043468 |
import re
import os.path
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
README_PATH = os.path.join(HERE, 'README.md')
try:
with open(README_PATH) as fd:
README = fd.read()
except IOError:
README = ''
INIT_PATH = os.path.join(HERE, 'rollbar/__init__.py')
... | rollbar/pyrollbar | setup.py | Python | mit | 3,249 | 0.000308 |
# 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... | jumoconnect/openjumo | jumodjango/lib/suds/sax/parser.py | Python | mit | 4,435 | 0.000676 |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 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 the ZMQ notification interface."""
import struct
from test_framework.address import ADDRESS_BCRT1... | ericshawlinux/bitcoin | test/functional/interface_zmq.py | Python | mit | 4,763 | 0.00189 |
#!/usr/bin/env python
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit import prompt
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
history = InMemoryHistory()
while True:
text = prompt("> ", history=history, auto_suggest=AutoSuggestFromHistory())
if text == 'quit':
... | tleonhardt/CodingPlayground | python/prompt-toolkit/auto_suggestion.py | Python | mit | 410 | 0 |
from .oauth import BaseOAuth2
class EventbriteOAuth2(BaseOAuth2):
"""Eventbrite OAuth2 authentication backend"""
name = 'eventbrite'
AUTHORIZATION_URL = 'https://www.eventbrite.com/oauth/authorize'
ACCESS_TOKEN_URL = 'https://www.eventbrite.com/oauth/token'
METADATA_URL = 'https://www.eventbriteap... | abhikumar22/MYBLOG | blg/Lib/site-packages/social_core/backends/eventbrite.py | Python | gpl-3.0 | 1,055 | 0.000948 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2022 GEM Foundation
#
# OpenQuake 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 Licen... | gem/oq-engine | openquake/engine/tools/viewlog.py | Python | agpl-3.0 | 1,703 | 0 |
# -*- coding: utf-8 -*-
'''
/**************************************************************************************************************************
SemiAutomaticClassificationPlugin
The Semi-Automatic Classification Plugin for QGIS allows for the supervised classification of remote sensing images,
provid... | semiautomaticgit/SemiAutomaticClassificationPlugin | maininterface/editraster.py | Python | gpl-3.0 | 15,191 | 0.032585 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.