code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import unittest
import time
from friendloc.base.splitproc import SplitProcess
class AdderSplitProc(SplitProcess):
def __init__(self, delay, **kwargs):
SplitProcess.__init__(self, **kwargs)
self.delay = delay
def produce(self):
for x in xrange(10):
time.sleep(self.delay)
... | JeffAMcGee/friendloc | friendloc/base/tests/splitproc_tests.py | Python | bsd-2-clause | 954 |
from django.contrib import admin
from django.contrib.auth.models import User
from .models import FCM
# Register your models here.
admin.site.register(FCM)
| gtsapelas/TRANSrisk_fcm_project | fcm_app/admin.py | Python | mit | 156 |
import numpy as np
import cv2
from matplotlib import pyplot as plt
'''
a = np.empty((1,10),np.uint8)
cv2.randn(a,(0),(10))
print(a)
'''
img = cv2.imread('nature.jpg',0)
noise = img.copy()
cv2.randn(noise,(32),(20)) #Mean = 0, Variance = 1
noise_img = img + noise #* 200 #Sigma for noise = 25
cv2.imshow('image',img)
cv2... | rohithredd94/Computer-Vision-using-OpenCV | cv2test2.py | Python | mit | 824 |
from gopigo import *
import sys
fwd()
enable_com_timeout(2000) | slowrunner/goRWpigo | tests/timeout_test.py | Python | lgpl-3.0 | 63 |
"""
Provide pre-made queries on top of the recorder component.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/history/
"""
import asyncio
from collections import defaultdict
from datetime import timedelta
from itertools import groupby
import logging
imp... | ewandor/home-assistant | homeassistant/components/history.py | Python | apache-2.0 | 13,984 |
import string
import subprocess
import re
# yield n-sized chunks
# reference: https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks
def chunks(data, byte_size):
length = len(data)
for i in range(0, length, byte_size):
yield data[i:i + byte_size]
def autoN_cmd(data... | henrytran28/CPSC-526 | assignment_3/commands.py | Python | mit | 3,046 |
#!/usr/bin/env python
import glob
import re
import os
list=glob.glob("*00")
for img in list:
tmp1 = re.sub("_00_","_01_",img)
tiltname = re.sub("en_00","en_01",tmp1)
f1 = "./%s/down4_%s.raw" %(img,img)
f2 = "./%s/down4_%s.raw" %(tiltname,tiltname)
if os.path.isfile(f1) & os.path.isfile(f2):
print "%s %s 1"... | leschzinerlab/XMIPP | create_tiltSelFiles.py | Python | mit | 332 |
#
# ABC iView XBMC Addon
# Copyright (C) 2012 Andy Botting
#
# This addon includes code from python-iview
# Copyright (C) 2009-2012 by Jeremy Visser <[email protected]>
#
# This addon is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | sdt/xbmc-addon-abc-iview | resources/lib/parse.py | Python | gpl-3.0 | 7,401 |
# -*- coding: utf-8 -*-
#
# AWL simulator - instructions
#
# Copyright 2012-2014 Michael Buesch <[email protected]>
#
# 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
... | gion86/awlsim | awlsim/core/instructions/insn_rrd.py | Python | gpl-2.0 | 1,729 |
# -*- coding: utf-8 -*-
"""
Custom module logger
"""
import logging
module_name = 'moflow'
logger = logging.getLogger(module_name)
logger.addHandler(logging.NullHandler()) # best practice to not show anything
def use_basic_config(level=logging.INFO, format=logging.BASIC_FORMAT):
"""Add basic configuration and f... | mwtoews/moflow | moflow/_logger.py | Python | bsd-2-clause | 773 |
from django import forms
from order.models import Pizza, Bread, Customer
class PizzaForm(forms.ModelForm):
class Meta:
model = Pizza
fields = ('size', 'toppings', 'crust')
widgets = {
'size': forms.RadioSelect(),
'crust': forms.RadioSelect(),
'toppings': forms.C... | ajpocus/pizzeria | order/forms.py | Python | bsd-3-clause | 1,411 |
# Kivy Imports
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.dropdown import DropDown
from kivy.uix.button import Button
from kivy.properties import ObjectProperty, StringProperty
from kivy.app import App
# Utility Imports
import yaml
# Game Imports
from scripts.events import Event
# File Loads
loc_file = fil... | DinkWerks/Kivy-Game | main.py | Python | mit | 4,529 |
#! /usr/bin/env python
#
#Copyright (c) 2012 Robert Rouhani <[email protected]>, Nick Richard <[email protected]>, Hayden Lee <[email protected]>
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Softw... | Robmaister/RPI-Game-Jam-9-22-12 | src/player.py | Python | mit | 5,660 |
# -*- coding: utf-8 -*-
# +---------------------------------------------------------------------------+
# | pylstar : Implementation of the LSTAR Grammatical Inference Algorithm |
# +---------------------------------------------------------------------------+
# | Copyright (C) 2015 Georges Bossert ... | gbossert/pylstar | src/pylstar/KnowledgeTree.py | Python | gpl-3.0 | 12,988 |
import boto3
import json
import sure # noqa
from moto import mock_lambda, mock_cloudformation, mock_apigateway, mock_iam, mock_logs
from string import Template
template = """{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "The AWS CloudFormation template for this Serverless application",
"Resources"... | william-richard/moto | tests/test_apigateway/test_apigateway_cloudformation.py | Python | apache-2.0 | 9,464 |
class ParameterError(Exception):
"""An error in the parameters passed to a function."""
pass | jlorieau/mollib | mollib/utils/exceptions.py | Python | gpl-3.0 | 100 |
# coding: utf-8
#
# Monk is an unobtrusive data modeling, manipulation and validation library.
# Copyright © 2011—2014 Andrey Mikhaylenko
#
# This file is part of Monk.
#
# Monk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | andifined/monk | monk/validators.py | Python | lgpl-3.0 | 21,852 |
# for rgenetics - lped to fbat
# recode to numeric fbat version
# much slower so best to always
# use numeric alleles internally
import sys,os,time
prog = os.path.split(sys.argv[0])[-1]
myversion = 'Oct 10 2009'
galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/lib/galaxy/datatypes/converters/lped_to_fped_converter.py | Python | gpl-3.0 | 3,564 |
"""
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
"""
class Solution:
# @param A, a... | cyandterry/Python-Study | Ninja/Leetcode/33_Search_in_Rotated_Sorted_Array.py | Python | mit | 2,223 |
from p2ner.abstract.interface import Interface
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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/licen... | schristakidis/p2ner | p2ner/components/ui/gtkgui/gtkgui/interface/localinterface.py | Python | apache-2.0 | 3,773 |
# Copyright 2013 the Melange 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 wr... | rhyolight/nupic.son | app/soc/modules/gci/logic/conversation.py | Python | apache-2.0 | 22,136 |
# -*- coding: utf-8 -*-
from collections import Iterable
from helpers import add_attribute_self, yesman
@add_attribute_self('filter_constructor')
class ftuple(tuple):
"""
Replacement class for tuple, with better API.
In place methods return 'self' instead of None, better for chaining and returning
"... | francois-vincent/containers | base_containers.py | Python | gpl-2.0 | 3,025 |
from .base import *
import warnings
import pandas as pd
def validate_set_ops(df, other):
"""
Helper function to ensure that DataFrames are valid for set operations.
Columns must be the same name in the same order, and indices must be of the
same dimension with the same names.
"""
if df.column... | kieferk/dfply | dfply/set_ops.py | Python | gpl-3.0 | 6,022 |
# Copyright 2017 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 ag... | JavaRabbit/CS496_capstone | storage/cloud-client/notification_polling_test.py | Python | apache-2.0 | 1,621 |
response.title = "LEL"
response.subtitle = "List Extraction Learning"
response.menu = [
(T('Home'), False, URL('default','index')),
(T('Tutorial'), False, URL('default','tutorial')),
(T('Contribute'), False, URL('default','contribute')),
]
| satwantrana/lelui | models/menu.py | Python | mit | 240 |
# Copyright (c) 2015 Advanced Micro Devices, Inc.
# All rights reserved.
#
# For use for simulation and test purposes only
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retai... | vineodd/PIMSim | GEM5Simulation/gem5/configs/ruby/GPU_VIPER_Baseline.py | Python | gpl-3.0 | 23,064 |
#! /usr/bin/env python
import os
import sys
import select
import time
import math
import getopt
import RPi.GPIO as GPIO
# Debug flag
debug = False
def Usage():
print('Usage: stepper.py -d -h -v --debug --help --version degrees timing-in-milliseconds')
# Stepper motor operation -- 28BYJ48 5V DC motor
# 32 teeth ... | hankster/pi-eye | stepper.py | Python | mit | 4,952 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-03 22:23
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):
dependencies = [
migrations.swappable_depende... | Petrole/MaturePyRobots | WebPyRobot/backend/migrations/0007_battlehistory.py | Python | gpl-3.0 | 1,190 |
# -*-coding:utf-8 -*
from django.db import models
from agency.models import Vehicle, Agency
from django.contrib.auth.models import User
EVENT_TYPE = (
('code', 'Session de code'),
('driving', 'Conduite en circulation'),
('plateau', 'Conduite sur plateau'),
('code_exam', 'Examen de code'),
('driving_exam', 'Exame... | SBillion/aegroupware | planner/models.py | Python | mit | 954 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Osmo Salomaa
#
# 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.
#
# This pr... | otsaloma/pan-bikes | pan/test/test_http.py | Python | gpl-3.0 | 3,443 |
from plyer.platforms.win.libs.batterystatus import battery_status
from plyer.facades import Battery
class WinBattery(Battery):
def _get_status(self):
status = {"connected": None, "percentage": None}
query = battery_status()
if (not query):
return status
status["conne... | brousch/pyohio-kivy-2014 | plyer/platforms/win/battery.py | Python | mit | 480 |
import datetime
import logging
import os
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.mail import EmailMultiAlternatives
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as ... | Goury/django-mail-queue | mailqueue/models.py | Python | mit | 5,805 |
#
# serialize.py
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# from https://github.com/jgarzik/python-bitcoinlib/blob/master/bitcoin/script.py
# from __future__ import absolute_import, division, print_function, unicode_... | JKingdom/KingCoin | app/base/serialize.py | Python | gpl-3.0 | 24,827 |
#!/bin/env python2.7
# -*- coding: utf-8 -*-
# This file is part of EPlatform.
#
# EPlatform 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 ... | bjura/EPlatform | EMatch.py | Python | gpl-3.0 | 18,227 |
# -*- coding: utf-8 -*-
"""
by LW 03/20/2015
some wrapper functions for ophyd
"""
import Tkinter, tkFileDialog
def det_select(det):
"""
by LW 03/20/2015
function to select detector for scanning and ct
removes all existing detectors from ophyd function ascan.user_detectors
and replaces them with the... | sameera2004/chxtools | chxtools/chx_wrapper.py | Python | bsd-3-clause | 10,326 |
#!/usr/bin/env python3
# Copyright (C) 2016 Kaspar Schleiser <[email protected]>
# Copyright (C) 2017 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import sys
def testf... | MichelRottleuthner/RIOT | tests/thread_cooperation/tests/01-run.py | Python | lgpl-2.1 | 611 |
import numpy, pylab
D2S = 86400
PROT_SUN = 27.0
OMEGA_SUN = 2 * numpy.pi / (27.0 * D2S)
root = '/Users/aigrain/Data/Kepler/diffrot/'
X = numpy.genfromtxt('%snoise_free/regions_par.txt' % root).T
lmin = X[4]
lmax = X[5]
nsim = len(lmin)
incl = numpy.arcsin(numpy.sqrt(numpy.random.uniform(0, 1, nsim)))
n1 = nsim/10
n2 ... | RuthAngus/LSST-max | code/soft/simlc_check.py | Python | mit | 2,065 |
#!/usr/bin/env python
"""
Network
(C) 2008 Michael 'Mickey' Lauer <[email protected]>
(C) 2008 Openmoko, Inc.
GPLv2 or later
Package: onetworkd
Module: network
"""
MODULE_NAME = "onetworkd"
__version__ = "0.0.1"
import gobject
import os
import socket
import fcntl
import struct
import logging
logger = loggin... | freesmartphone/framework | framework/subsystems/onetworkd/network.py | Python | gpl-2.0 | 2,048 |
from __future__ import print_function
import re
import traceback
class MiniObject(object):
def __init__(self, py_object, **meta):
( "The following python types map to the following mini types:\n"
" bool -> boolean\n"
" str -> string\n"
" int -> integer\n"
... | kerkeslager/sandbox | mini/mini.py | Python | mit | 27,970 |
from PyQt4.QtCore import QSettings
__author__ = 'Igor Maculan <[email protected]>'
config = QSettings('pushbullet','qpushbullet') | n3wtron/qpushbullet | qpushbullet/__init__.py | Python | gpl-3.0 | 131 |
# This flexes PR#170 which is caused by a suspected JIT bug. Said bug for
# some reason breaks exception matching. There is now a workaround that seems
# to do the trick most of the time.
try:
int("foo")
except ValueError:
pass
| DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/test/bugs/pr170.py | Python | gpl-3.0 | 245 |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | boto/botocore | tests/functional/test_waiter_config.py | Python | apache-2.0 | 7,458 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/route_filter_rule_paged.py | Python | mit | 967 |
#! /usr/bin/env python
import eris.server as server
if __name__ == "__main__":
server.run()
| jedisct1/eris | eris-server.py | Python | bsd-2-clause | 95 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | strint/tensorflow | tensorflow/python/ops/image_ops_test.py | Python | apache-2.0 | 100,652 |
import logging
from bs4 import BeautifulSoup as BS
class ResponseParser(object):
#def __init__(self):
# print('nothing')
"""
Attempt to write a generic parser for the perverted, non-uniformed html tables.
Works with the following URLs
"""
def generic_parse(self, html_code):
###... | UlmApi/bw-srdb-parser | lib/ResponseParser.py | Python | mit | 1,327 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | anish/buildbot | master/docs/bbdocs/ext.py | Python | gpl-2.0 | 17,319 |
from base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "bakehouse",
"USER": "",
"PASSWORD": "",
"HOST": "localhost",
"PORT": "",
}
}
BROKER_URL = 'amqp://guest:guest@localhos... | rollstudio/djangodash-2013 | bakehouse/settings/patrick_local.py | Python | mit | 366 |
# Copyright (c) 2013 Alan McIntyre
import urllib
import hashlib
import hmac
import warnings
from datetime import datetime
import common
class TradeAccountInfo(object):
'''An instance of this class will be returned by
a successful call to TradeAPI.getInfo.'''
def __init__(self, info):
funds ... | dashscar/btc-e_Trade_bot | btceapi/btceapi/trade.py | Python | mit | 8,660 |
import json
from decimal import Decimal
from jwt.algorithms import Algorithm
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError, InvalidAlgorithmError, InvalidSignatureError,
InvalidTokenError
)
from jwt.utils import base64url_decode, force_bytes, force_unicode
import pytest
from .compat... | cloudera/hue | desktop/core/ext-py/PyJWT-1.7.1/tests/test_api_jws.py | Python | apache-2.0 | 26,697 |
from django import forms
from django.core.validators import validate_email
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from .utils import get_user_model
class PasswordRecoveryForm(forms.Form):
username_or_email = forms.CharField()
error_messages = {
'not_fo... | xsunfeng/cir | password_reset/forms.py | Python | mit | 4,276 |
#!/usr/bin/env python3
import numpy as np
import cv2
import argparse
import glob
from os.path import splitext, basename
debug = False
debug_dir = '.'
def get_output_path(out_dir, file_ext):
imgs = glob.glob('{}/*.{}'.format(out_dir, file_ext))
if len(imgs) == 0:
next_num = 0
else:
nums = [int(splitex... | acarabott/ten-sided-dice-dataset | 04-processing/segment.py | Python | mit | 5,087 |
from django.db import models
import mixins
import query
class ArticleManager(models.Manager, mixins.ArticleManagerMixin):
def get_query_set(self):
return query.ArticleQuerySet(self.model, using=self._db)
class ImageManager(models.Manager, mixins.ImageManagerMixin):
def get_query_set(self):
... | megaprojectske/megaprojects.co.ke | megaprojects/articles/managers.py | Python | apache-2.0 | 377 |
# -*- coding: utf-8 -*-
#
# Copyright 2013, Not All Rights Reserved.
# Author: Windriver
# Email: [email protected]
# Created: 2013-09-26 01:13
#
# Description:
from evernote.edam.userstore import UserStore
from evernote.edam.notestore import NoteStore
import thrift.protocol.TBinaryProtocol as TBinaryPro... | Windriver/codelab | evernote/visit_my_evernote.py | Python | apache-2.0 | 1,795 |
# Choregraphe bezier export in Python.
from naoqi import ALProxy
names = list()
times = list()
keys = list()
names.append("LShoulderPitch")
times.append([ 2.00000, 4.00000])
keys.append([ [ 1.39626, [ 3, -0.66667, 0.00000], [ 3, 0.66667, 0.00000]], [ 1.39626, [ 3, -0.66667, 0.00000], [ 3, 0.00000, 0.00000]]])
names.... | Rctue/nao-lib | gestures/HappyGesture_4.py | Python | gpl-2.0 | 2,776 |
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/furnace/tasks/ldeo/preferences.py | Python | apache-2.0 | 2,603 |
from sympy.integrals.transforms import (mellin_transform,
inverse_mellin_transform, laplace_transform, inverse_laplace_transform,
fourier_transform, inverse_fourier_transform,
sine_transform, inverse_sine_transform,
cosine_transform, inverse_cosine_transform,
hankel_transform, inverse_hankel_transfo... | kaichogami/sympy | sympy/integrals/tests/test_transforms.py | Python | bsd-3-clause | 33,356 |
from setuptools import setup, find_packages
import os
name = "revot"
version = "0.1"
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name=name,
version=version,
description="revot software",
long_description=read('README'),
# Get strings from h... | iskracat/revot | setup.py | Python | apache-2.0 | 1,864 |
# -*- coding: utf-8 -*-
#
# odmlviz documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 17 13:22:00 2015.
#
# 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.
#
# A... | j-pick/python-odmlviz | doc/source/conf.py | Python | bsd-2-clause | 8,318 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter, MaxNLocator
import numpy as np
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplotlib.finance ... | JoshuaMichaelKing/MyLearning | learn-python2.7/matplotlib/plot_demos.py | Python | mit | 4,309 |
# -*- coding: utf-8 -*-
"""The Elastic Search output module CLI arguments helper."""
from __future__ import unicode_literals
import getpass
import os
from uuid import uuid4
from plaso.cli.helpers import interface
from plaso.cli.helpers import manager
from plaso.cli.helpers import server_config
from plaso.cli import... | rgayon/plaso | plaso/cli/helpers/elastic_output.py | Python | apache-2.0 | 6,071 |
# Copyright 2012 Nebula, 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 agree... | luzheqi1987/nova-annotation | nova/tests/unit/api/openstack/compute/contrib/test_flavor_disabled.py | Python | apache-2.0 | 4,015 |
import cProfile
import ProfilingTest
import pstats
import os
print "starting profiling"
path = 'ProfilingTest.stats'
cProfile.run('ProfilingTest.run()', path)
p = pstats.Stats(path)
p.sort_stats('cumulative').print_stats(10)
p.sort_stats('time').print_stats(10)
os.system("gprof2dot -f pstats {0} | dot -Tsvg -o ca... | lcameron05/PCWG | Profiling.py | Python | mit | 425 |
from sys import stdin
import string
def reversewords(line):
line.reverse()
print " ".join(line)
map((lambda l: reversewords(string.split(l.strip()))), stdin.readlines())
| aqibmushtaq/codeeval | reverse-words/reverse.py | Python | mit | 180 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Tests the pooled server
:license: Apache License 2.0
"""
# JSON-RPC library
from jsonrpclib import ServerProxy
from jsonrpclib.SimpleJSONRPCServer import PooledJSONRPCServer
from jsonrpclib.threadpool import ThreadPool
# Standard library
import random
import thre... | CloudI/CloudI | src/service_api/python/jsonrpclib/tests/test_server.py | Python | mit | 1,597 |
def _mask_border_keypoints(image, keypoints, dist):
"""Removes keypoints that are within dist pixels from the image border."""
width = image.shape[0]
height = image.shape[1]
keypoints_filtering_mask = ((dist - 1 < keypoints[:, 0]) &
(keypoints[:, 0] < width - dist + 1)... | almarklein/scikit-image | skimage/feature/util.py | Python | bsd-3-clause | 1,135 |
################################################################################
# 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... | shaoxuan-wang/flink | flink-python/pyflink/table/table.py | Python | apache-2.0 | 24,237 |
from netfields import MACAddressField
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from nodeshot.core.base.models import BaseAccessLevel
from choices import INTERFACE_TYPE_CHOICES
from django_hstore.fields import DictionaryField, ReferencesFiel... | SCORE42/nodeshot | nodeshot/networking/net/models/interface.py | Python | gpl-3.0 | 3,968 |
import math, re
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from pyramid.view import view_defaults, view_config
from jinja2 import Environment, Template
from pymongo import MongoClient
client = MongoClient()
db = client.blog
db.authenticat... | jesopo/python-blog | blog.py | Python | gpl-3.0 | 2,242 |
# -*- coding: utf-8 -*-
# This code was generously pilfered from https://bitbucket.org/Jeffrey/gevent-websocket
# written by Jeffrey Gelens (http://noppo.pro/) and licensed under the Apache License, Version 2.0
import six
import struct
from socket import error as socket_error
from django.core.handlers.wsgi import logge... | dalou/django-flow | django_flow/redis_ws/websocket.py | Python | bsd-3-clause | 14,168 |
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... | ME-ICA/me-ica | meica.libs/nibabel/loadsave.py | Python | lgpl-2.1 | 5,048 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import pipes
import sys
from telemetry.core import util
util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android')
from pylib.dev... | SaschaMester/delicium | tools/telemetry/telemetry/internal/backends/android_command_line_backend.py | Python | bsd-3-clause | 3,990 |
import re
import json
import os
import logging
from logging.handlers import RotatingFileHandler
from logging import Formatter
from ngram import NGram
from hashlib import md5
from flask import Flask, send_from_directory, send_file, render_template, request, redirect
import imgur
from memegenerator import gen_meme
AP... | monu27mr/gret | url.py | Python | mit | 4,989 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
f... | laudaa/bitcoin | test/functional/test_runner.py | Python | mit | 21,842 |
# Copyright (c) 2015 Tanium Inc
#
# Generated from console.wsdl version 0.0.1
#
#
from .base import BaseType
class PluginSchedule(BaseType):
_soap_tag = 'plugin_schedule'
def __init__(self):
BaseType.__init__(
self,
simple_properties={'id': int,
... | tanium/pytan | lib/taniumpy/object_types/plugin_schedule.py | Python | mit | 1,932 |
from __future__ import division # allows floating point division from integers
import globalVars as gv
import datetime
import os
# Resistance is in ohms per 100 feet
# for 0 to 40 gauge wire
wireResistance = {0: 0.009827, 1: 0.01239, 2: 0.01563, 3: 0.01970, 4: 0.02485, 5: 0.03133, 6: 0.03951, 7: 0.04982,
... | masterperson40/retr3d | old/heatedbed.py | Python | gpl-3.0 | 2,664 |
# utility functions
import fcntl, os, subprocess
class PipeException(Exception):
def __init__(self, message, errno):
self.errno = errno
message = '%s: %d, %s' % (message, errno, os.strerror(errno))
Exception.__init__(self, message)
class Lock(object):
"""advisory lock"""
def __in... | YongMan/Xen-4.3.1 | tools/python/xen/remus/util.py | Python | gpl-2.0 | 2,139 |
# -*- coding:utf-8 -*-
# 206. Reverse Linked List QuestionEditorial Solution My Submissions
# Difficulty: Easy
# Reverse a singly linked list.
#
# click to show more hints.
#
# Hint:
# A linked list can be reversed either iteratively or recursively. Could you implement both?
# Definition for singly-linked list.
cla... | Baz2013/blog_demo | leetcode/easy/reverse_linked_list.py | Python | gpl-3.0 | 1,048 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Run data tests for cclib."""
import importlib
import logging
import os
import sys
import unittest
import cclib
__fi... | cclib/cclib | test/test_data.py | Python | bsd-3-clause | 12,415 |
# Copyright 2011 Cloudscaling Group, 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 applicabl... | citrix-openstack-build/oslo.log | oslo/log/openstack/common/rpc/impl_zmq.py | Python | apache-2.0 | 26,437 |
import sys
import requests
from bs4 import BeautifulSoup
# Google Search Class
class googleSearch():
def __init__(self, query):
self.query = "http://google.com/search?q=" + "+".join(query.split()) + "&num=100&start="
self.page = 1
self.content = requests.get(self.query).text
self.websiteList = self.... | tomarrell/Email-Scraper | lib/googleSearch.py | Python | gpl-3.0 | 1,172 |
# Set default logging handler to avoid "No handler found" warnings.
#import logging
#import logging.config
#
#try: # Python 2.7+
# from logging import NullHandler
#except ImportError:
# class NullHandler(logging.Handler):
# def emit(self, record):
# pass
#
#log = logging.getLogger(__name__)
#tr... | SPRACE/python-odl | odl/__init__.py | Python | gpl-3.0 | 431 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'FormText'
db.create_table(u'landing_formtext', (
(u'id', self.gf('django.db.mode... | andresfcardenas/marketing-platform | landing/migrations/0003_auto__add_formtext.py | Python | bsd-3-clause | 3,656 |
__author__ = 'oier'
import json
from flask import Flask, make_response
app = Flask(__name__)
import seaborn as sns
import numpy as np
import pandas as pd
import os
from datetime import datetime
import matplotlib.pyplot as plt
import sys
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg impo... | oiertwo/vampyr | flask/index.py | Python | mit | 1,592 |
import os
import sys
from _pydevd_bundle.pydevd_constants import IS_PYCHARM
IS_PY36_OR_GREATER = sys.version_info >= (3, 6)
frame_eval_func = None
stop_frame_eval = None
dummy_trace_dispatch = None
show_frame_eval_warning = False
clear_thread_local_info = None
# "NO" means we should not use frame evaluation, 'YES' ... | Elizaveta239/PyDev.Debugger | _pydevd_frame_eval/pydevd_frame_eval_main.py | Python | epl-1.0 | 1,550 |
from __future__ import (absolute_import, division, print_function)
import unittest
import numpy as np
from mantid.simpleapi import logger
import AbinsModules
class AbinsKpointsDataTest(unittest.TestCase):
_good_data_1 = {"k_vectors": np.asarray([[0.2, 0.1, 0.2], [0.1, 0.0, 0.2], [0.2, 0.2, 0.2]]),
... | dymkowsk/mantid | scripts/test/AbinsKpointsDataTest.py | Python | gpl-3.0 | 11,416 |
import six
class AbstractIter(six.Iterator):
def __init__(self, node, filter_=None, stop=None, maxlevel=None):
"""
Iterate over tree starting at `node`.
Base class for all iterators.
Keyword Args:
filter_: function called with every `node` as argument, `node` is retu... | c0fec0de/anytree | anytree/iterators/abstractiter.py | Python | apache-2.0 | 1,704 |
# -*- coding: utf-8 -*-
'''
Created on 10 Jul 2015
@author: Kimon Tsitsikas
Copyright © 2015 Kimon Tsitsikas, Delmic
This file is part of Odemis.
Odemis is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Founda... | delmic/odemis | src/odemis/driver/test/blinkstick_test.py | Python | gpl-2.0 | 2,773 |
# (c) 2012-2014, Michael DeHaan <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | 2ndQuadrant/ansible | lib/ansible/inventory/group.py | Python | gpl-3.0 | 9,635 |
''' ResourceManagementHandler
Module that allows users to access the ResourceManagementDB remotely.
'''
from DIRAC import gConfig, S_OK, gLogger
from DIRAC.Core.DISET.RequestHandler import RequestHandler
from DIRAC.ResourceStatusSystem.Utilities import Synchronizer
from DIRAC.ResourceStatusSystem.Service.ResourceSt... | andresailer/DIRAC | ResourceStatusSystem/Service/ResourceManagementHandler.py | Python | gpl-3.0 | 6,815 |
from django.conf.urls.defaults import *
from django.conf import settings
from ella import newman
# make sure to import ella error handlers
from ella.core.urls import handler404, handler500
# register ella's admin
newman.autodiscover()
urlpatterns = patterns('',)
if settings.DEBUG:
# only use these urls in DEB... | ella/ellablog | ellablog/urls.py | Python | bsd-3-clause | 1,254 |
# 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... | frreiss/tensorflow-fred | tensorflow/python/kernel_tests/linalg/linear_operator_addition_test.py | Python | apache-2.0 | 16,884 |
def main(request, response):
cookie = request.cookies.first("COOKIE_NAME", None)
response_headers = [("Content-Type", "text/javascript"),
("Access-Control-Allow-Credentials", "true")]
origin = request.headers.get("Origin", None)
if origin:
response_headers.append(("Acce... | saneyuki/servo | tests/wpt/web-platform-tests/workers/modules/resources/credentials.py | Python | mpl-2.0 | 502 |
#
# 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 n... | wangyixiaohuihui/spark2-annotation | python/pyspark/ml/stat.py | Python | apache-2.0 | 6,611 |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/agents/ppo/ppo_agent_test.py | Python | apache-2.0 | 53,941 |
#!/usr/bin/env python
"""
jsonxs uses a path expression string to get and set values in JSON and Python
datastructures.
For example:
>>> d = {
... 'feed': {
... 'id': 'my_feed',
... 'url': 'http://example.com/feed.rss',
... 'tags': ['devel', 'example', 'python'],
... 'short.... | fboender/jsonxs | jsonxs/jsonxs.py | Python | mit | 5,644 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2018 David Arroyo Menéndez
# Author: David Arroyo Menéndez <[email protected]>
# Maintainer: David Arroyo Menéndez <[email protected]>
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | davidam/python-examples | ai/linear_algebra.py | Python | gpl-3.0 | 4,600 |
import json
import xbmc
import time
import urllib2
from quasar.addon import ADDON
from quasar.config import QUASARD_HOST
from quasar.provider import closing
def library_thread():
trakt_sync = int(ADDON.getSetting("trakt_sync"))
if trakt_sync > 0:
limit = trakt_sync * 3600
count = limit - int(AD... | felipenaselva/felipe.repository | plugin.video.quasar/resources/site-packages/quasar/library.py | Python | gpl-2.0 | 2,059 |
# -*- coding: utf-8 -*-
"""
jinja.constants
~~~~~~~~~~~~~~~
Various constants.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
#: list of lorem ipsum words used by the lipsum() helper function
LOREM_IPSUM_WORDS = u'''\
a ac accumsan ad adipiscing aenean a... | wildchildyn/autism-website | yanni_env/lib/python3.6/site-packages/jinja2/constants.py | Python | gpl-3.0 | 1,626 |
#!/usr/bin/python
'''
Copyright(c)2009 Internet Archive. Software license AGPL version 3.
This file is part of IA Bookserver.
IA Bookserver 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, eit... | internetarchive/bookserver | aggregator/install/install_crawler.py | Python | agpl-3.0 | 2,701 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.