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 |
|---|---|---|---|---|---|---|
import numpy
import sys
import time
from mceditlib.test import templevel
from mceditlib import relight
# run me with the source checkout as the working dir so I can find the test_files folder.
def natural_relight():
world = templevel.TempLevel("AnvilWorld")
dim = world.getDimension()
positions = []
f... | vorburger/mcedit2 | src/mceditlib/bench/time_relight_natural.py | Python | bsd-3-clause | 1,455 | 0.003436 |
"""
Docstrings are another source of information for functions and classes.
:mod:`jedi.evaluate.dynamic` tries to find all executions of functions, while
the docstring parsing is much easier. There are three different types of
docstrings that |jedi| understands:
- `Sphinx <http://sphinx-doc.org/markup/desc.html#info-f... | technologiescollege/Blockly-rduino-communication | scripts_XP/Lib/site-packages/jedi/evaluate/docstrings.py | Python | gpl-3.0 | 10,503 | 0.000952 |
def apple():
print "I AM APPLES!"
# this is just a variable
tangerine = "Living reflection of a dream."
| Valka7a/python-playground | python-the-hard-way/mystuff.py | Python | mit | 106 | 0.018868 |
#
# 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... | clemensv/qpid-proton | tests/python/proton_tests/engine.py | Python | apache-2.0 | 75,989 | 0.007054 |
from slpp import SLPP
import re
class diObj(object):
def __init__(self,type,name,luaData):
self.objectType=type
self.objectName=name
self.objectKey=type+name
self.DictLuaData=luaData
self.DictTotal={}
self.setDict()
def setDict(self):
self.DictTotal["Name"]=self.objectName
self.DictTotal["Type"]=sel... | guzzijones/parseDI | parseDI.py | Python | gpl-2.0 | 1,926 | 0.065421 |
import collections
from supriya import CalculationRate
from supriya.ugens.PureUGen import PureUGen
class LFTri(PureUGen):
"""
A non-band-limited triangle oscillator unit generator.
::
>>> supriya.ugens.LFTri.ar()
LFTri.ar()
"""
### CLASS VARIABLES ###
__documentation_sect... | Pulgama/supriya | supriya/ugens/LFTri.py | Python | mit | 542 | 0.001845 |
from parsers.paragraphs import Paragraphs, Sentences
from parsers.blocks import Blocks, Words
class Saw:
paragraphs = Paragraphs
sentences = Sentences
blocks = Blocks
words = Words
@staticmethod
def load(text):
return Paragraphs.load(text) | diNard/Saw | saw/saw.py | Python | mit | 274 | 0.00365 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... | elianerpereira/gtg | GTG/core/__init__.py | Python | gpl-3.0 | 10,171 | 0.000098 |
__author__ = 'sweemeng'
from popit.models import Person
from popit.models import Contact
from popit.models import ContactDetail
from popit.models import Link
from popit.models import Identifier
from popit.models import OtherName
from hvad.contrib.restframework import TranslatableModelSerializer
from rest_framework.seri... | Sinar/popit_ng | popit/serializers/misc.py | Python | agpl-3.0 | 13,241 | 0.00287 |
from StringIO import StringIO
import unittest
import lob
# Setting the API key
lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
class ObjectFunctions(unittest.TestCase):
def setUp(self):
lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
self.obj = lob.Object.list(count=1).data[0]
... | ami/lob-python | tests/test_object.py | Python | mit | 2,744 | 0.00984 |
import os
from os import walk
templatePath = r'templates/serviceTemplate.txt'
writePath = r'/Source/Api/service-hmlFhirConverter/src/main/java/org/nmdp/hmlfhirconverter/service'
class ServiceGenerator:
def get_template(self):
with open(templatePath, 'r') as fileReader:
return fileReader.read(... | nmdp-bioinformatics/service-hml-fhir-converter | CodeGen/hmlFhirConverterCodeGenerator/codegen/service/ServiceGenerator.py | Python | apache-2.0 | 776 | 0.002577 |
#!/usr/bin/env python
"""
Reduce samples that have too high energies by comparing
between the same group of samples.
The group is defined according to the name of directory before the last 5 digits.
For example, the directory `smpl_XX_YYYYYY_#####` where `#####` is the
last 5 digits and the group name would be `smpl_XX... | ryokbys/nap | nappy/fitpot/reduce_high_energy_samples.py | Python | mit | 2,920 | 0.009589 |
#!/usr/bin/env python
#
# Copyright 2007-2013 The Python-Twitter Developers
#
# 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 requi... | MosheBerman/brisket-mashup | source/libraries/python-twitter-1.1/setup.py | Python | mit | 2,426 | 0.010717 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from .models import Category, Product, Transaction, UserTag, ProductTag, Account
class AccountInline(admin.StackedInline):
model = Account
can_delete = False
verbose_name_plural = ... | mylvari/namubufferi | namubufferiapp/admin.py | Python | mit | 1,669 | 0.002996 |
"""
Boolean geometry utilities.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
import sys
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
... | dob71/x2swn | skeinforge/fabmetheus_utilities/geometry/geometry_utilities/evaluate_fundamentals/print.py | Python | gpl-3.0 | 984 | 0.018293 |
# 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/.
from datetime import datetime
from optparse import make_option
from django.core.management.base import BaseCommand
from... | jicksy/oneanddone_test | oneanddone/tasks/management/commands/updatemetrics.py | Python | mpl-2.0 | 954 | 0.001048 |
# -------------------------------------------------------------------------------
# Copyright IBM Corp. 2017
#
# 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/licens... | ibm-cds-labs/pixiedust | pixiedust/apps/cfBrowser.py | Python | apache-2.0 | 9,821 | 0.004175 |
#!/usr/bin/env python
#
# 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... | sacsant/avocado-misc-tests | security/evmctl-tests.py | Python | gpl-2.0 | 2,182 | 0.001833 |
# Copyright 2018 Gianmarco Conte (gconte@dinamicheaziendali.it)
import logging
from odoo import api, models
from odoo.tools.misc import formatLang
_logger = logging.getLogger(__name__)
class ReportGiornale(models.AbstractModel):
_name = "report.l10n_it_central_journal.report_giornale"
_description = "Journ... | OCA/l10n-italy | l10n_it_central_journal/models/central_journal.py | Python | agpl-3.0 | 2,270 | 0.000881 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module's main purpose is to act as a script to create new versions
of ufunc.c when ERFA is updated (or this generator is enhanced).
`Jinja2 <http://jinja.pocoo.org/>`_ must be installed for this
module/script to function.
Note that this does *no... | bsipocz/astropy | astropy/_erfa/erfa_generator.py | Python | bsd-3-clause | 27,369 | 0.000548 |
class A:
def foo(self):
print('A.foo()')
class B(A):
def foo(self):
print('B.foo()')
class C(A):
def foo(self):
print('C.foo()')
class D(B, C):
def foo(self):
print('D.foo()')
x = D()
print(D.__mro__) # (D, B, C, A, object)
x.foo() # D.foo()
| s3rvac/talks | 2017-03-07-Introduction-to-Python/examples/23-inheritance.py | Python | bsd-3-clause | 303 | 0.016502 |
"""
WSGI config for hummer project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | wangtaoking1/hummer | hummer/wsgi.py | Python | apache-2.0 | 389 | 0 |
import cubed
print(cubed.cub(2,106))
| Frikeer/LearnPython | exc8/exc8.py | Python | unlicense | 38 | 0.026316 |
# Copyright (c) 2014 eBay Software 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
#
# Unl... | Tesora-Release/tesora-python-troveclient | troveclient/v1/clusters.py | Python | apache-2.0 | 3,850 | 0 |
'''
pdbparser.py - Yevheniy Chuba - 6/1/2017
Parse local or external (PDB Database) 3D structure files (.pdb, .cif)
Usage:
parser = PdbParser("2128-1.pdb").pdb_processing()
output: [['L', 'DIQ...'], ['H', 'EVQL...']]
'''
import os
from Bio.PDB import *
from Bio.Seq import Seq
class PdbParser:
'''... | yevheniyc/Projects | 1h_NGL_3D_Viewer/pyscripts/pdbmapper/PdbParser.py | Python | mit | 2,840 | 0.002817 |
#!/usr/bin/env python
from ConfigParser import SafeConfigParser, NoSectionError, Error
import argparse
import os
import smtplib
import re
import sys
def main():
argument_parser = argparse.ArgumentParser(prog='mail')
argument_parser.add_argument('subject', help='The subject of the email')
argument_parser... | cmcdowell/CLI-email | emailer.py | Python | mit | 2,010 | 0.000498 |
# -*- coding: utf-8 -*-
from openerp.tests import common
from openerp.osv.orm import except_orm
from datetime import datetime
from . import test_util
class TestPlanning(common.TransactionCase):
def setUp(self):
super(TestPlanning, self).setUp()
# Cursor and user initialization
cr, uid =... | jeacaveo/planning_70 | tests/test_planning.py | Python | agpl-3.0 | 19,305 | 0.002176 |
from django.contrib.auth import authenticate,login
from django.contrib import messages
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.template import RequestContext
def user_logi... | paleocore/paleocore | login/views.py | Python | gpl-2.0 | 1,470 | 0.005442 |
#!/usr/bin/env python
#
# Copyright (C) 2014-2017 Nextworks
# Author: Vincenzo Maffione <v.maffione@nextworks.it>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of... | edugrasa/demonstrator | gen.py | Python | gpl-2.0 | 37,281 | 0.005526 |
"""Test config flow."""
from unittest.mock import Mock, patch
from homeassistant.components.hassio.handler import HassioAPIError
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.setup import async_setup_component
from tests.common import mock_coro
async def test_hassio_discovery_startup(... | leppa/home-assistant | tests/components/hassio/test_discovery.py | Python | apache-2.0 | 5,530 | 0.000723 |
import posixpath
class UrlPackage:
""" Represents a package specified as a Url """
def __init__(self, url):
""" Initialize with the url """
if ':' in url:
self.url = url
else:
self.url = posixpath.join('git+git://github.com', url)
@p... | cloew/tidypip | tidypip/packages/url_package.py | Python | mit | 604 | 0.008278 |
class Solution:
def minDeletionSize(self, A):
"""
:type A: List[str]
:rtype: int
"""
rows, cols = len(A), len(A[0])
if rows == 1: return 0
ans = 0
for j in range(cols):
sort = True
for i in range(1, rows):
... | YiqunPeng/Leetcode-pyq | solutions/944DeleteColumnsToMakeSorted.py | Python | gpl-3.0 | 467 | 0.010707 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "buildops.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the... | lukewink/buildops | manage.py | Python | gpl-3.0 | 806 | 0 |
''' Module containing tests for the network data structure
'''
import unittest
from power_grid import network
class TestNetwork(unittest.TestCase):
''' Class containing all unit tests related to
the network data structure.
'''
def test_randomly_generated_network(self):
''' Tests if the averag... | ABM-project/power-grid | test/test_network.py | Python | mit | 814 | 0.001229 |
input = """
:- not b.
b :- a, not a.
a v c.
"""
output = """
"""
| Yarrick13/hwasp | tests/wasp1/AllAnswerSets/choice_30.test.py | Python | apache-2.0 | 66 | 0 |
"""Add archived field to custom form
Revision ID: 391b3fa1471
Revises: 473f91b5874
Create Date: 2016-01-23 15:51:40.304025
"""
# revision identifiers, used by Alembic.
revision = '391b3fa1471'
down_revision = '473f91b5874'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upg... | viaict/viaduct | migrations/versions/2016_01_23_391b3fa1471_add_archived_field_to_custom_form.py | Python | mit | 1,019 | 0.01472 |
import numpy as np
from Interpolation import *
class HermiteInterpolation(Interpolation):
def __init__(self, x, y, yDrv):
Interpolation.__init__(self, x, y)
sizeyDrv = yDrv.shape
if not (len(sizeyDrv) == 1 or (len(sizeyDrv) == 2 and sizeyDrv[0] == 1)):
raise ValueError("Size o... | LanceVan/SciCycle | HermiteInterpolation.py | Python | mit | 1,740 | 0.011494 |
import copy
from django import http
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured
from django.template import RequestContext
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext_lazy as _
class View(object):
"""
Parent ... | livni/old-OK | src/knesset/hashnav/base.py | Python | bsd-3-clause | 6,270 | 0.008931 |
from __future__ import division
def bound(c,(bndH,method),d1,f,g,d2,D,A=None,b=None,E=None,d=None,U=None,optimality=None,initialRadius=None):
# Norm function
from numpy import ones, sqrt
from numpy.linalg import norm
# Our own functions
from trsq import trsq
from mest import mest
from doma... | coin-or/oBB | obb/lboundme_loc_rr.py | Python | lgpl-3.0 | 2,004 | 0.021956 |
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.proto import rfc1902
import time
def add_menu_entry(button, func, user, host, appnum,
duration=360, brid=''):
global cmdGen, authData, transportTarget
cmd = 'TYPE=BR;BUTTON=%s;USER="%s";FUNC=%s;HOST=%s;APPNUM=%s;DURATION=%s;BRID=%... | esben/brother-scan | brscan/snmp.py | Python | gpl-3.0 | 1,777 | 0.003376 |
from . import Model, CollectionModel
class Contact(Model):
"""
A Contact object model
.. attribute:: id
.. attribute:: phone
.. attribute:: email
.. attribute:: firstName
.. attribute:: lastName
.. attribute:: companyName
.. attribute:: country
Dictionary like this:... | textmagic/textmagic-rest-python | textmagic/rest/models/contacts.py | Python | mit | 8,232 | 0.001944 |
# /bin/sh
def generate(cmd='/bin/sh'):
"""Executes cmd
Args:
cmd(str): executes cmd (default: ``/bin/sh``)
"""
sc = """
adr r0, bin_sh_1
mov r2, #0
push {r0, r2}
mov r1, sp
movw r7, #11
svc 1
bin_sh_1:
.asciz "%s"
""" % (cmd) # sometimes we have to change to spe... | alexpark07/ARMSCGen | shellcodes/arm/sh.py | Python | gpl-2.0 | 355 | 0.005634 |
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import cv2
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxySubscriberCached
from sensor_msgs.msg import PointCloud2
class TakePictureState(EventState):
'''
Stores the pic... | pschillinger/lamor15 | lamor_flexbe_states/src/lamor_flexbe_states/take_picture_state.py | Python | mit | 877 | 0.028506 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.camino.convert import ProcStreamlines
def test_ProcStreamlines_inputs():
input_map = dict(allowmultitargets=dict(argstr='-allowmultitargets',
),
args=dict(argstr='%s',
),
datadims=di... | JohnGriffiths/nipype | nipype/interfaces/camino/tests/test_auto_ProcStreamlines.py | Python | bsd-3-clause | 3,121 | 0.030119 |
#!/usr/bin/env python
import traceback
import os
import re
import sys
if __name__ != "__main__": # we're imported as a module
_registered = []
_tests = 0
_fails = 0
def wvtest(func):
""" Use this decorator (@wvtest) in front of any function you want to run
as part of the unit tes... | Zearin/git-bup | wvtest.py | Python | lgpl-2.1 | 5,331 | 0.003189 |
# -*- coding: utf-8 -*-
# _______ _______ _______ _______ _
# |\ /|( ___ )( ____ )( )( ___ )( ( /||\ /|
# | ) ( || ( ) || ( )|| () () || ( ) || \ ( |( \ / )
# | (___) || (___) || (____)|| || || || | | || \ | | \ (_) /
# | ___ || ___ || __)| |(_)| || | | || (... | Northshoot/AndroidContentProvider | acp/model/table.py | Python | apache-2.0 | 4,807 | 0.000208 |
# encoding: UTF-8
# Copyright Krzysztof Sopyła (krzysztofsopyla@gmail.com)
#
#
# Licensed under the MIT
# Network architecture:
# Five layer neural network, input layer 28*28= 784, output 10 (10 digits)
# Output labels uses one-hot encoding
# input layer - X[batch, 784]
# 1 layer - W1[784,... | ksopyla/tensorflow-mnist-convnets | mnist_2.0_5_layer_nn.py | Python | mit | 6,492 | 0.00909 |
"""
tests.test_manager
~~~~~~~~~~~~~~~~~~
Provides unit tests for the :mod:`flask_restless.manager` module.
:copyright: 2012 Jeffrey Finkelstein <jeffrey.finkelstein@gmail.com>
:license: GNU AGPLv3+ or BSD
"""
import datetime
from flask import json
try:
from flask.ext.sqlalchemy import SQLAl... | CommonsCloud/CommonsRestless | tests/test_manager.py | Python | agpl-3.0 | 27,696 | 0.000217 |
import numpy as np
import theano
import theano.tensor as T
theano.config.exception_verbosity = 'high'
theano.config.compute_test_value = 'warn'
floatX = theano.config.floatX
def iscalar(name=None):
Av = 1
A = T.iscalar(name=name)
A.tag.test_value = Av
return A, Av
def fscalar(name=None):
Av... | jbornschein/y2k | learning/tests/testing.py | Python | agpl-3.0 | 974 | 0.013347 |
# encoding: utf-8
import os
HERE = os.path.dirname(__file__)
# Hosted config files
BUILDOUT_USER = 'pythonpackages'
BUILDOUT_INDEX = open(os.path.join(HERE, 'templates', 'buildout.html')).read()
BUILDOUT_REPOS = (
('buildout-apache-modwsgi', 'apache-modwsgi'),
('buildout-bluebream', 'bluebream'),
('buildo... | python-packages/vanity_app | src/vanity_app/vanity_app/config.py | Python | mit | 11,226 | 0.001161 |
#! /usr/bin/env python
import socket
print "creating socket..."
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #ipv4, tcp
print "done."
print "looking up port number..."
port = socket.getservbyname('http', 'tcp')
print "done."
print "connecting to remote host on port %d..." % port
s.connect(("www.google.c... | qzxx-syzz/study | python/Net/connect.py | Python | gpl-3.0 | 446 | 0.006726 |
from __future__ import absolute_import
from jsonschema import Draft4Validator
SELECT_OPTIONS_SCHEMA = {
"type": "array",
"definitions": {
"select-option": {
"type": "object",
"properties": {"label": {"type": "string"}, "value": {"type": "string"}},
"required": ["lab... | mvaled/sentry | src/sentry/mediators/external_requests/util.py | Python | bsd-3-clause | 953 | 0.003148 |
# Hihi is the grandfather of all geeks in IIITA. He and his crazy ideas.....Huh..... Currently, hihi is working on his most famous project
# named 21 Lane, but he is stuck at a tricky segment of his code.
# Hihi wants to assign some random IP addresses to users, but he won't use rand(). He wants to change the current... | OmkarPathak/Python-Programs | CompetitiveProgramming/HackerEarth/Bit_Manipulation/P05_HihiAndCrazyBits.py | Python | gpl-3.0 | 1,216 | 0.011513 |
"""Tests to ensure that the html5lib tree builder generates good trees."""
import warnings
try:
from bs4.builder import HTML5TreeBuilder
HTML5LIB_PRESENT = True
except ImportError, e:
HTML5LIB_PRESENT = False
from bs4.element import SoupStrainer
from bs4.testing import (
HTML5TreeBuilderSmokeTest,
... | listyque/TACTIC-Handler | thlib/side/bs42/tests/test_html5lib.py | Python | epl-1.0 | 6,494 | 0.001386 |
"""add post media
Revision ID: 04da9abf37e2
Revises: 2e3a2882e5a4
Create Date: 2017-08-08 15:15:50.911420
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '04da9abf37e2'
down_revision = '2e3a2882e5a4'
branch_labels = None
depends_on = None
def upgrade():
o... | codl/forget | migrations/versions/04da9abf37e2_add_post_media.py | Python | isc | 683 | 0.002928 |
#
# QAPI event generator
#
# Copyright (c) 2014 Wenchao Xia
# Copyright (c) 2015-2016 Red Hat Inc.
#
# Authors:
# Wenchao Xia <wenchaoqemu@gmail.com>
# Markus Armbruster <armbru@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2.
# See the COPYING file in the top-level directory.
from qa... | afaerber/qemu-cpu | scripts/qapi-event.py | Python | gpl-2.0 | 5,197 | 0 |
from Cython.Compiler import Options
from Cython.Compiler import PyrexTypes
from Cython.Compiler.Visitor import CythonTransform
from Cython.Compiler.StringEncoding import EncodedString
from Cython.Compiler.AutoDocTransforms import (
ExpressionWriter as BaseExpressionWriter,
AnnotationWriter as BaseAnnotationWrit... | mpi4py/mpi4py | conf/cyautodoc.py | Python | bsd-2-clause | 9,170 | 0.000545 |
# -*- coding: utf-8 -*-
from warnings import warn
import numpy as np
import matplotlib.pyplot as plt
from ....lib.utilities import isSignal, isContainer
from ....lib.globals import FdpWarning
from ...fft import Fft
def fft(obj, *args, **kwargs):
"""
Calculate FFT(s) for signal or container.
Return Fft ... | drsmith48/fdp | fdp/methods/nstxu/bes/fft.py | Python | mit | 3,236 | 0 |
# coding: utf-8
from collections import namedtuple
from pandas.io.msgpack.exceptions import * # noqa
from pandas.io.msgpack._version import version # noqa
class ExtType(namedtuple("ExtType", "code data")):
"""ExtType represents ext type in msgpack."""
def __new__(cls, code, data):
if not isinstan... | toobaz/pandas | pandas/io/msgpack/__init__.py | Python | bsd-3-clause | 1,223 | 0 |
# The following has been generated automatically from src/core/qgsmaplayer.h
QgsMapLayer.LayerType = QgsMapLayerType
# monkey patching scoped based enum
QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer
QgsMapLayer.VectorLayer.__doc__ = ""
QgsMapLayer.RasterLayer = QgsMapLayerType.RasterLayer
QgsMapLayer.RasterLaye... | rldhont/Quantum-GIS | python/core/auto_additions/qgsmaplayer.py | Python | gpl-2.0 | 1,706 | 0.002345 |
import matplotlib.pyplot as plt
import numpy as np
from image_funcs import *
from scipy.misc import imread, imsave
def grid(image, threshold):
###############################################################################
import scipy.misc
nuclei = imread('3.jpg')
nuclei = scipy.misc.imresize(nuclei, 0.05)
nuclei =... | varnivey/hakoton_images | image_preparation/cells_search.py | Python | gpl-2.0 | 1,484 | 0.020889 |
from soppa.contrib import *
class Celery(Soppa):
def setup(self):
self.action('up', 'celery_supervisor.conf',
'{supervisor_conf_dir}celery_supervisor_{project}.conf',
handler=['supervisor.restart'],
when=lambda x: x.soppa_proc_daemon=='supervisor',)
| futurice/fabric-deployment-helper | soppa/celery/__init__.py | Python | bsd-3-clause | 311 | 0.016077 |
# Copyright (C) 2011-2015 Claas Abert
#
# This file is part of magnum.fe.
#
# magnum.fe is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... | micromagnetics/magnum.fe | site-packages/magnumfe/common/wrapped_mesh.py | Python | lgpl-3.0 | 4,232 | 0.007798 |
import unittest
from katas.kyu_7.bug_fixing_unfinished_loop import create_array
class CreateArrayTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(create_array(1), [1])
def test_equals_2(self):
self.assertEqual(create_array(2), [1, 2])
def test_equals_3(self):
... | the-zebulan/CodeWars | tests/kyu_7_tests/test_bug_fixing_unfinished_loop.py | Python | mit | 541 | 0 |
import os
import sys
def getRootDir():
cwd = os.getcwd()
print(cwd)
pos = cwd.find("hm65Vault")
print(pos)
pos += len("hm65Vault")
cwd = cwd[0:pos]
print(cwd)
getRootDir()
sys.exit(0) | humanist1965/hm65Vault | test.py | Python | gpl-3.0 | 212 | 0.04717 |
from datetime import datetime as dt
from functools import reduce
import transmissionrpc
from config import config
TRANSMISSION_ENABLED = config['TRANSMISSION_ENABLED']
TRANS_HOST = config['TRANS_HOST']
TRANS_PORT = config['TRANS_PORT']
TRANS_USER = config['TRANS_USER']
TRANS_PASS = config['TRANS_PASS']
TRANS_PUBLIC_... | sgtsquiggs/PlexThrottle | TransmissionCleanUp.py | Python | unlicense | 3,486 | 0.003155 |
#-------------------------------------------------------------------------------
# Copyright 2017 Cognizant Technology Solutions
#
# 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:... | CognizantOneDevOps/Insights | PlatformAgents/com/cognizant/devops/platformagents/agents/deployment/rundeck/RundeckAgent.py | Python | apache-2.0 | 2,690 | 0.005204 |
from itertools import groupby
from lxml import etree
def xml2d(e):
"""Convert an etree into a dict structure
@type e: etree.Element
@param e: the root of the tree
@return: The dictionary representation of the XML tree
"""
def _xml2d(e):
kids = dict(e.attrib)
# if e.text:
... | IndiciumSRL/wirecurly | tests/test_serialization/utils.py | Python | mpl-2.0 | 2,146 | 0.007922 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-08 20:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cooperativa', '0002_auto_20171005_1404'),
]
operations = [
migrations.Alter... | adbetin/organico-cooperativas | cooperativa/migrations/0003_auto_20171008_1549.py | Python | gpl-3.0 | 464 | 0 |
# encoding= utf-8
##
# VisibilityCheck.
# <p>
# Description of the test.
#
# @data INSTANCE_ID [String] instance id
##
from qtaste import *
import time
# update in order to cope with the javaGUI extension declared in your testbed configuration.
javaguiMI = testAPI.getJavaGUI(INSTANCE_ID=testData.getValue("JAVAGUI_I... | remybaranx/qtaste | demo/TestSuites/PlayBack/VisibilityCheck/TestScript.py | Python | gpl-3.0 | 1,239 | 0.008071 |
#-*- coding: utf-8 -*-
__author__ = 'tsbc'
import sys
reload(sys)
sys.setdefaultencoding('utf-8') | radiateboy/Demo126mail | testcase/public/__init__.py | Python | gpl-2.0 | 98 | 0.020408 |
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2010, 2012-2013 Rocky Bernstein
#
# 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 lat... | kamawanu/pydbgr | trepan/bwprocessor/command/base_cmd.py | Python | gpl-3.0 | 3,660 | 0.001366 |
from rlib import jit
from som.primitives.integer_primitives import IntegerPrimitivesBase as _Base
from som.vmobjects.double import Double
from som.vmobjects.integer import Integer
from som.vmobjects.primitive import Primitive, TernaryPrimitive
def get_printable_location_up(block_method):
from som.vmobjects.metho... | SOM-st/PySOM | src/som/primitives/bc/integer_primitives.py | Python | mit | 4,603 | 0.000652 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/core/plot/memory.py | Python | mit | 7,242 | 0.002762 |
# -*- encoding: utf-8 -*-
# This file is part of IRIS: Infrastructure and Release Information System
#
# Copyright (C) 2013-2015 Intel Corporation
#
# IRIS is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2.0 as published by the Free Software Found... | sunshine027/iris-panel | iris/etl/scm.py | Python | gpl-2.0 | 8,948 | 0.000112 |
import logging
from flask_script import Manager
from flask_migrate import MigrateCommand
from seedbox.app import app
manager = Manager(app)
manager.add_command('db', MigrateCommand)
@manager.command
def watch_updates():
"""Starts component updates watcher in foreground (CoreOS, k8s, etcd)"""
from seedbox i... | nailgun/seedbox | src/seedbox/manage.py | Python | apache-2.0 | 478 | 0 |
"""LU decomposition functions."""
from __future__ import division, print_function, absolute_import
from warnings import warn
from numpy import asarray, asarray_chkfinite
# Local imports
from .misc import _datacopied, LinAlgWarning
from .lapack import get_lapack_funcs
from .flinalg import get_flinalg_funcs
__all__ ... | jor-/scipy | scipy/linalg/decomp_lu.py | Python | bsd-3-clause | 6,757 | 0.000444 |
from builtins import str
from builtins import object
import httplib2
import MySQLdb
import json
import os
import sys
import time
import config
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run
class Erro... | Spoken-tutorial/spoken-website | cron/upload-subtitle.py | Python | gpl-3.0 | 7,439 | 0.010082 |
#!/usr/bin/python
# First parameter: the pattern for the files in ""
# Second parameter: output file
import glob
import sys
read_files = sorted(glob.glob(sys.argv[1]))
with open(sys.argv[2], "wb") as outfile:
for f in read_files:
with open(f, "rb") as infile:
outfile.write(infile.read())
prin... | CodeAtCode/CSVEmailVerifier | mergecsv.py | Python | gpl-2.0 | 340 | 0 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio 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 opt... | MSusik/invenio | invenio/modules/deposit/restful.py | Python | gpl-2.0 | 18,728 | 0.000694 |
#!/usr/bin/python
import json
import httplib
import os
import subprocess
import time
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.topo import Topo
from mininet.util import irange
HOME_FOLDER = os.getenv('HO... | onebsv1/floodlight | example/mininet/dhcp_linear_sw.py | Python | apache-2.0 | 6,108 | 0.009987 |
from django.core.management.base import BaseCommand
from django.db.models import Q
from ajapaik.ajapaik.models import Album
class Command(BaseCommand):
help = 'Connects to TartuNLP API and retrieves neuro machine translations for empty name fields'
def handle(self, *args, **options):
albums = Album.... | Ajapaik/ajapaik-web | ajapaik/ajapaik/management/commands/tartunlp_on_all_albums.py | Python | gpl-3.0 | 963 | 0.001038 |
from nose.tools import eq_, raises
from ...errors import DependencyError, DependencyLoop
from ..dependent import Dependent
from ..functions import dig, draw, expand, normalize_context, solve
def test_solve():
# Simple functions
eq_(solve(lambda: "foo"), "foo")
eq_(list(solve([lambda: "foo", lambda: "bar"... | yafeunteun/wikipedia-spam-classifier | revscoring/revscoring/dependencies/tests/test_functions.py | Python | mit | 4,537 | 0 |
# -*- coding: utf-8 -*-
from admesh import Stl
from utils import asset
import filecmp
class TestIO(object):
'''Tests for the basic IO operations'''
def test_saved_equals_original_ascii(self):
'''Tests if saved ASCII file is identical to the loaded one'''
stl = Stl(asset('block.stl'))
... | admesh/python-admesh | test/test_io.py | Python | gpl-2.0 | 1,085 | 0.00093 |
import unittest
from antelope_catalog.data_sources.local import TEST_ROOT
from antelope_catalog import LcCatalog
from lcatools.interfaces import IndexRequired
cat = LcCatalog(TEST_ROOT)
ref = 'calrecycle.antelope'
cat.new_resource(ref, 'http://www.antelope-lca.net/uo-lca/api/', 'AntelopeV1Client',
... | bkuczenski/lca-tools | antelope_catalog/providers/v1_client/tests/test_antelope_v1_client.py | Python | gpl-2.0 | 1,973 | 0.005068 |
"""
Support for HomeMatic devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/homematic/
"""
import asyncio
from datetime import timedelta
from functools import partial
import logging
import os
import socket
import voluptuous as vol
from homeassis... | ewandor/home-assistant | homeassistant/components/homematic/__init__.py | Python | apache-2.0 | 29,766 | 0 |
# -*- coding: utf-8 -*-
#
# MothBall documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 30 20:11:36 2016.
#
# 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.
#
# ... | MarionTheBull/watchmaker | docs/conf.py | Python | apache-2.0 | 9,706 | 0.000206 |
from rsqueakvm.util.cells import QuasiConstant
from rsqueakvm.plugins.vmdebugging.model import wrap_oplist, wrap_greenkey, wrap_debug_info
from rpython.rlib.jit import JitHookInterface, Counters
jit_iface_recursion = QuasiConstant(False)
def make_hook(args, func):
import inspect, re
src = "\n".join([
... | HPI-SWA-Lab/RSqueak | rsqueakvm/plugins/vmdebugging/hooks.py | Python | bsd-3-clause | 3,381 | 0.002958 |
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | gluke77/rally | rally/plugins/common/sla/outliers.py | Python | apache-2.0 | 4,530 | 0 |
"""
Django settings for sample project.
Generated by 'django-admin startproject' using Django 1.10.1.
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/
"""
import os
... | pablotcarreira/django-arangodb | sample_project/settings.py | Python | apache-2.0 | 4,023 | 0.001491 |
import tempfile
import nox
nox.options.sessions = "lint", "tests"
locations = "src", "tests", "noxfile.py"
def install_with_constraints(session, *args, **kwargs):
with tempfile.NamedTemporaryFile() as requirements:
session.run(
"poetry",
"export",
"--dev",
... | yerejm/ttt | noxfile.py | Python | isc | 1,940 | 0.000515 |
from xsvm import instructions
from tabulate import tabulate
class Memory:
def __init__(self):
self.memory_storage = {}
self.labels_map = {}
def set(self, address, value):
self.memory_storage[address] = value
def set_label(self, label, address):
self.labels_map[label] = add... | GedRap/xs-vm | xsvm/vm.py | Python | mit | 4,947 | 0.001819 |
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos 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, ... | Ebag333/Pyfa | eos/db/gamedata/item.py | Python | gpl-3.0 | 3,101 | 0.002902 |
"""Utility functions."""
import numpy as np
def vec(X, order='F'):
"""Returns the vectorization of X. Columns of X are stacked. (The opposite of X.flatten())."""
assert X.ndim == 2, 'vec operator requires a matrix.'
return X.flatten(order=order)
def from_vec(x, m, n, order='F'):
return x.resh... | jtaylor/pysfm | sfm/util.py | Python | bsd-3-clause | 3,379 | 0.025155 |
"""
Test more expression command sequences with objective-c.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipUnlessDarwin
class FoundationTestCaseString(TestBase):
mydir = TestBase.comp... | llvm-mirror/lldb | packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethodsString.py | Python | apache-2.0 | 2,009 | 0.00896 |
from __future__ import division
from time import sleep, time
from threading import Event
from collections import deque
from RPi import GPIO
from w1thermsensor import W1ThermSensor
from .devices import GPIODeviceError, GPIODevice, GPIOThread
class InputDeviceError(GPIODeviceError):
pass
class InputDevice(GPIO... | agiledata/python-gpiozero | gpiozero/input_devices.py | Python | bsd-3-clause | 5,990 | 0.001503 |
from __future__ import unicode_literals
from django.test import TestCase
from django.utils import six
from .models import Person, Book, Car, PersonManager, PublishedBookManager
class CustomManagerTests(TestCase):
def setUp(self):
self.b1 = Book.published_objects.create(
title="How to program... | ericholscher/django | tests/custom_managers/tests.py | Python | bsd-3-clause | 6,629 | 0.000905 |
# *****************************************************************************
# conduct - CONvenient Construction Tool
#
# 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... | birkenfeld/conduct | conduct/loggers.py | Python | gpl-2.0 | 10,769 | 0.000464 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('anagrafica', '0024_auto_20160129_0053'),
]
operations = [
migrations.AlterIndexTogether(
name='delega',
... | CroceRossaItaliana/jorvik | anagrafica/migrations/0025_auto_20160129_0056.py | Python | gpl-3.0 | 670 | 0.001493 |
"""
Braubuddy LibratoAPI unit tests.
"""
from mock import call, patch, MagicMock
from braubuddy.tests import BraubuddyTestCase
from braubuddy.output import libratoapi
@patch('braubuddy.output.libratoapi.librato.connect')
class LibratoAPIOutput(BraubuddyTestCase):
def test_librato_api_connect(self, mk_libratoapi... | amorphic/braubuddy | braubuddy/tests/output/test_libratoapi.py | Python | bsd-3-clause | 1,721 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.