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 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
# Modified by dgranda
#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... | viiru-/pytrainer | pytrainer/gui/windowmain.py | Python | gpl-2.0 | 103,483 | 0.011026 |
import logging
from ftmstore import get_dataset
log = logging.getLogger(__name__)
MODEL_ORIGIN = "model"
def get_aggregator_name(collection):
return "collection_%s" % collection.id
def get_aggregator(collection, origin="aleph"):
"""Connect to a followthemoney dataset."""
dataset = get_aggregator_name(c... | pudo/aleph | aleph/logic/aggregator.py | Python | mit | 378 | 0 |
import RPi.GPIO as GPIO
import time
import sys
#on renseigne le pin sur lequel est branché le cable de commande du servo moteur superieur (haut-bas)
servo_pin = 12
#recuperation de la valeur du mouvement a envoyer au servo
duty_cycle = float(sys.argv[1])
GPIO.setmode(GPIO.BOARD)
GPIO.setup(servo_pin, GPIO.OUT)
# ... | MarionPiEnsg/RaspiModel | Application/Raspberry_Pi/scripts_python/1-activeRobotHaut.py | Python | gpl-3.0 | 910 | 0.015402 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
def configuration(parent_name='special', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('_precompute', parent_name, top_path)
return config
if __name__ == '__main__':
fr... | DailyActie/Surrogate-Model | 01-codes/scipy-master/scipy/special/_precompute/setup.py | Python | mit | 396 | 0 |
# Copyright 2017 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... | tensorflow/tpu | models/experimental/dcgan/mnist_model.py | Python | apache-2.0 | 3,215 | 0.002799 |
# -*- coding: utf-8 -*-
__author__ = 'k'
import re
import scrapy
from bs4 import BeautifulSoup
import logging
from thepaper.items import NewsItem
import json
logger = logging.getLogger("NbdSpider")
from thepaper.settings import *
from thepaper.util import judge_news_crawl
import time
class DonewsSpider(scrapy.spiders... | yinzishao/NewsScrapy | thepaper/thepaper/spiders/donews_spider.py | Python | lgpl-3.0 | 3,445 | 0.02148 |
# pylint: disable-msg=W0401,W0511,W0611,W0612,W0614,R0201,E1102
"""Tests suite for MaskedArray & subclassing.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
"""
from __future__ import division, absolute_import, print_function
__author__ = "Pierre GF Gerard-Marchant"
import warnings
import pickle
i... | pyparallel/numpy | numpy/ma/tests/test_core.py | Python | bsd-3-clause | 161,025 | 0.000689 |
from typing import cast, List, TypeVar, Any, Type, Optional
from uuid import UUID
from graphscale import check
from graphscale.pent import (
create_pent,
delete_pent,
update_pent,
Pent,
PentContext,
PentMutationData,
PentMutationPayload,
)
T = TypeVar('T')
def typed_or_none(obj: Any, cl... | schrockn/graphscale | graphscale/grapple/graphql_impl.py | Python | mit | 2,294 | 0.000872 |
import pytz
from datetime import datetime, timedelta
def is_dst(zonename, date):
local_tz = pytz.timezone(zonename)
localized_time = local_tz.localize(date)
return localized_time.dst() != timedelta(0)
def get_offset(zonename, date):
local_tz = pytz.timezone(zonename)
if zonename == 'UTC':
... | tidepool-org/dfaker | dfaker/tools.py | Python | bsd-2-clause | 3,495 | 0.009442 |
import time
from unittest import TestCase
from unittest import mock
from elasticsearch_raven import utils
class RetryLoopTest(TestCase):
@mock.patch('time.sleep')
def test_delay(self, sleep):
retry_generator = utils.retry_loop(1)
for i in range(4):
retry = next(retry_generator)
... | serathius/elasticsearch-raven | tests/test_utils.py | Python | mit | 838 | 0.001193 |
# encoding: utf-8
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class ExceptionDialog(QMessageBox):
def __init__(self,parent,exc,t1=None,t2=None):
QMessageBox.__init__(self,parent)
if t1==None: t1=(exc.args[0] if len(exc.args)>0 else None)
self.setText(u'<b>'+exc.__class__.__name__+... | sjl767/woo | gui/qt4/ExceptionDialog.py | Python | gpl-2.0 | 1,473 | 0.017651 |
from __future__ import absolute_import
from django.contrib import admin
from django.contrib.admin.models import DELETION
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import Permission
from django.core.urlresolvers import reverse
from django.utils.html import escape
from admin.common... | mluo613/osf.io | admin/common_auth/admin.py | Python | apache-2.0 | 2,230 | 0.000897 |
# -*- coding: utf-8 -*-
import oauth2 # XXX pumazi: factor this out
from webob.multidict import MultiDict, NestedMultiDict
from webob.request import Request as WebObRequest
__all__ = ['Request']
class Request(WebObRequest):
"""The OAuth version of the WebOb Request.
Provides an easier way to obtain O... | karacos/karacos-wsgi | lib/wsgioauth/request.py | Python | lgpl-3.0 | 3,175 | 0.004409 |
"""Geometry functions and utilities."""
from enum import Enum
from typing import Sequence, Union
import numpy as np # type: ignore
from pybotics.errors import PyboticsError
class OrientationConvention(Enum):
"""Orientation of a body with respect to a fixed coordinate system."""
EULER_XYX = "xyx"
EULER... | nnadeau/pybotics | pybotics/geometry.py | Python | mit | 4,716 | 0.000848 |
"Change Manager for literal values (supporting ==)"
from __future__ import annotations
from .bitmap import bitmap
from .index_update import IndexUpdate
from .changemanager_base import BaseChangeManager
from typing import (
Any,
TYPE_CHECKING,
)
if TYPE_CHECKING:
from .slot import Slot
class LiteralChan... | jdfekete/progressivis | progressivis/core/changemanager_literal.py | Python | bsd-2-clause | 2,053 | 0.000487 |
from guizero import App
app = App()
app.info("Info", "This is a guizero app")
app.error("Error", "Try and keep these out your code...")
app.warn("Warning", "These are helpful to alert users")
app.display() | lawsie/guizero | examples/alert.py | Python | bsd-3-clause | 205 | 0.004878 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Softbank Robotics Europe
# 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, t... | aldebaran/strong_typing | strong_typing/__init__.py | Python | bsd-3-clause | 4,043 | 0.004116 |
'''
Copyright 2016, EMC, Inc.
Author(s):
George Paulos
'''
import fit_path # NOQA: unused import
import os
import sys
import subprocess
import fit_common
from nose.plugins.attrib import attr
@attr(all=True, regression=True, smoke=True)
class rackhd20_api_config(fit_common.unittest.TestCase):
def test_api_20_co... | johren/RackHD | test/tests/rackhd20/test_rackhd20_api_config.py | Python | apache-2.0 | 3,739 | 0.006419 |
import numpy as np
import matplotlib.pyplot as plt
N=10000
np.random.seed(34)
lognormal_values = np.random.lognormal(size=N)
_, bins, _ = plt.hist(lognormal_values, np.sqrt(N), normed=True, lw=1, label="Histogram")
sigma = 1
mu = 0
x = np.linspace(min(bins), max(bins), len(bins))
pdf = np.exp(-(np.log(x) - mu)**2 / (2... | moonbury/notebooks | github/Numpy/Chapter6/lognormaldist.py | Python | gpl-3.0 | 563 | 0.008881 |
# -*- coding: utf-8 -*-
import pytest
import numpy as np
from pandas import Series, Timestamp
from pandas.compat import range, lmap
import pandas.core.common as com
import pandas.util.testing as tm
def test_mut_exclusive():
msg = "mutually exclusive arguments: '[ab]' and '[ab]'"
with tm.assert_raises_regex... | lmallin/coverage_test | python_venv/lib/python2.7/site-packages/pandas/tests/test_common.py | Python | mit | 4,870 | 0.000205 |
#!/usr/bin/python
#
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-2010 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... | onedox/selenium | py/test/selenium/webdriver/firefox/ff_profile_tests.py | Python | apache-2.0 | 8,146 | 0.002701 |
#!/usr/bin/env python
import argparse
import gzip
import logging
import os
import shutil
import subprocess
browser_specific_args = {
"firefox": ["--install-browser"]
}
def tests_affected(commit_range):
output = subprocess.check_output([
"python", "./wpt", "tests-affected", "--null", commit_range
... | jimberlage/servo | tests/wpt/web-platform-tests/tools/ci/taskcluster-run.py | Python | mpl-2.0 | 3,009 | 0.000665 |
#!/usr/bin/env python
from subprocess import call
call(["bickle", "builds", "stpettersens/Packager", "-n", "5"])
| stpettersens/Packager | travis.py | Python | mit | 114 | 0 |
"""Module provides provides a convinient class :class:`Attachment` to access (Create,
Read, Delete) document attachments."""
import base64, logging
from os.path import basename
from copy import deepcopy
from mimetypes import guess_type
from httperror import *... | prataprc/CouchPy | couchpy/.Attic/attachment.py | Python | gpl-3.0 | 7,105 | 0.024208 |
from __future__ import absolute_import, print_function, division
from six.moves import xrange
def render_string(string, sub):
"""
string: a string, containing formatting instructions
sub: a dictionary containing keys and values to substitute for
them.
returns: string % sub
The only diffe... | JazzeYoung/VeryDeepAutoEncoder | theano/misc/strutil.py | Python | bsd-3-clause | 1,620 | 0 |
# -*- coding: utf-8 -*-
# Copyright � 2006 Steven J. Bethard <steven.bethard@gmail.com>.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the 3-clause BSD
# license. No warranty expressed or implied.
# For details, see the accompanying file ... | emsrc/pycornetto | lib/cornetto/argparse.py | Python | gpl-3.0 | 77,238 | 0.000531 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_diax.iff"
result.attribute_template_id = 9
result.stf... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_diax.py | Python | mit | 426 | 0.049296 |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 25 10:21:20 2016
@author: suraj
"""
import pickle
import numpy as np
X = pickle.load(open('x_att.p'))
y = pickle.load(open('y_att.p'))
batchX = []
batchy = []
def convertPointsToBatch(day_of_week,data1,data2):
for i in range(5):
batchX.extend(data1... | suraj-jayakumar/lstm-rnn-ad | src/testdata/random_data_15min_ts/point_to_batch_data_conversion.py | Python | apache-2.0 | 762 | 0.018373 |
import webapp2
import models
class PrefsPage(webapp2.RequestHandler):
def post(self):
userprefs = models.get_userprefs()
try:
tz_offset = int(self.request.get('tz_offset'))
userprefs.tz_offset = tz_offset
userprefs.put()
except ValueError:
# ... | jscontreras/learning-gae | pgae-examples-master/2e/python/clock/clock4/prefs.py | Python | lgpl-3.0 | 541 | 0.003697 |
# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-15 Jim Easterbrook jim@jim-easterbrook.me.uk
# 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 F... | 3v1n0/pywws | src/pywws/device_pyusb.py | Python | gpl-2.0 | 5,584 | 0.002328 |
""" Generates a list of [b, N, n] where N is the amount of b-bit primes
and n is the amount of b-bit safe primes. """
import gmpy
import json
for b in xrange(1,33):
N = 0
n = 0
p = gmpy.mpz(2**b)
while True:
p = gmpy.next_prime(p)
if p > 2**(b+1):
break
if gmpy.... | bwesterb/germain | exact.py | Python | gpl-3.0 | 437 | 0.004577 |
# pylint: skip-file
# vim: expandtab:tabstop=4:shiftwidth=4
#pylint: disable=too-many-branches
def main():
''' ansible module for gcloud iam service-account keys'''
module = AnsibleModule(
argument_spec=dict(
# credentials
state=dict(default='present', type='str', choices=['pres... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/roles/lib_gcloud/build/ansible/gcloud_iam_sa_keys.py | Python | apache-2.0 | 2,395 | 0.00334 |
#!/usr/bin/env python2
# encoding=utf-8
from __future__ import division, print_function
from math import ceil, floor, log10, pi
from sys import argv, stdout
from xml.dom import minidom
import bz2
import csv
# local imports
from my_helper_functions_bare import *
def pretty_mean_std(data):
return uncertain_number_... | macioosch/dynamo-hard-spheres-sim | to_csv_pretty.py | Python | gpl-3.0 | 3,184 | 0.005653 |
# Copyright (C) 2016 The OpenTimestamps developers
#
# This file is part of python-opentimestamps.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-opentimestamps including this file, may be copied,
# modified, propagated, or distr... | petertodd/python-opentimestamps | opentimestamps/core/notary.py | Python | lgpl-3.0 | 10,936 | 0.002195 |
# encoding: utf-8
def _unicode_truncate(ustr, length, encoding="UTF-8"):
"Truncate @ustr to specific encoded byte length"
bstr = ustr.encode(encoding)[:length]
return bstr.decode(encoding, 'ignore')
def extract_title_body(text, maxtitlelen=60):
"""Prepare @text: Return a (title, body) tuple
@text... | engla/kupfer | kupfer/textutils.py | Python | gpl-3.0 | 2,681 | 0.001617 |
#! /usr/bin/env python
import re
import math
import collections
import numpy as np
import time
import operator
from scipy.io import mmread, mmwrite
from random import randint
from sklearn import cross_validation
from sklearn import linear_model
from sklearn.grid_search import GridSearchCV
from sklearn import preproces... | Goodideax/CS249 | new.py | Python | bsd-3-clause | 14,678 | 0.014784 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : lookup value selector
Description : Enables the selection of lookup values from a
lookup entity.
Date : 09/February/2017
copyright :... | gltn/stdm | stdm/ui/lookup_value_selector.py | Python | gpl-2.0 | 4,591 | 0 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | trustedanalytics/spark-tk | python/sparktk/frame/ops/box_cox.py | Python | apache-2.0 | 2,662 | 0.003096 |
def test_local_variable():
x = 1
x = 2 | asedunov/intellij-community | python/testData/inspections/PyRedeclarationInspection/localVariable.py | Python | apache-2.0 | 46 | 0.021739 |
"""IETF usage guidelines plugin
See RFC 8407
"""
import optparse
import sys
import re
from pyang import plugin
from pyang import statements
from pyang import error
from pyang.error import err_add
from pyang.plugins import lint
def pyang_plugin_init():
plugin.register_plugin(IETFPlugin())
class IETFPlugin(lint.L... | mbj4668/pyang | pyang/plugins/ietf.py | Python | isc | 7,093 | 0.001551 |
# Copyright (C) 2015 The Android Open Source Project
#
# 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 ... | android-art-intel/Nougat | art-extension/tools/checker/common/archs.py | Python | apache-2.0 | 663 | 0 |
# coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import argparse
import os
import simplejson as json
import grpc
from google.protobuf.json_format import MessageToJson
from qrl.core import config
from qrl.core.AddressS... | cyyber/QRL | src/qrl/grpcProxy.py | Python | mit | 9,400 | 0.002766 |
import statsmodels.api
import statsmodels.genmod.families.family
import numpy as np
from sklearn.metrics import r2_score
class GLM(object):
'''
A scikit-learn style wrapper for statsmodels.api.GLM. The purpose of this class is to
make generalized linear models compatible with scikit-learn's Pipeline obj... | jcrudy/glm-sklearn | glmsklearn/glm.py | Python | bsd-3-clause | 9,972 | 0.017048 |
#Prueba para mostrar los nodos conectados a la red
from base_datos import db
import time
from datetime import timedelta, datetime,date
dir_base="/media/CasaL/st/Documentos/proyectoXbee/WSN_XBee/basesTest/xbee_db02.db"
d=timedelta(minutes=-10)
#now=datetime.now()
#calculo=now+d
#print(calculo.strftime("%H:%M:%S"))
#hoy... | seertha/WSN_XBee | Software/RPI/Display_lcd/nodos_conectados.py | Python | mit | 1,363 | 0.02788 |
#!/bin/python
# -*- coding: utf-8 -*-
# ####################################################################
# gofed-ng - Golang system
# Copyright (C) 2016 Fridolin Pokorny, fpokorny@redhat.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Lice... | gofed/gofed-ng | common/service/storageService.py | Python | gpl-3.0 | 1,413 | 0.001415 |
# -*- coding: iso-8859-1 -*-
"""
RPython implementation of MD5 checksums.
See also the pure Python implementation in lib_pypy/md5.py, which might
or might not be faster than this one on top of CPython.
This is an implementation of the MD5 hash function,
as specified by RFC 1321. It was implemented using Bruce Schneie... | oblique-labs/pyVM | rpython/rlib/rmd5.py | Python | mit | 14,169 | 0.019409 |
import sqlite3
import directORM
class Proveedor:
def __init__(self):
self.idProveedor = -1
self.nombre = ''
self.email = ''
self.tlf_fijo = ''
self.tlf_movil = ''
self.tlf_fijo2 = ''
self.tlf_movil2 = ''
self.banco = ''
self.cuenta_bancaria ... | arkadoel/directORM | python/salida/directORM/forProveedores.py | Python | gpl-2.0 | 3,696 | 0.002976 |
def hsd_inc_beh(rxd, txd):
'''|
| Specify the behavior, describe data processing; there is no notion
| of clock. Access the in/out interfaces via get() and append()
| methods. The "hsd_inc_beh" function does not return values.
|________'''
if rxd.hasPacket():
data = rxd.get() + 1
... | hnikolov/pihdf | examples/hsd_inc/src/hsd_inc_beh.py | Python | mit | 340 | 0.002941 |
import os
import subprocess
import sys
deltext=""
if sys.platform.startswith("linux") :
deltext="rm"
copytext="cp"
if sys.platform.startswith("darwin") :
deltext="rm"
copytext="cp"
if sys.platform.startswith("win") :
deltext="del"
copytext="copy"
def run_in_shell(cmd):
subprocess.check_call(cmd, shell=Tru... | miracl/amcl | version3/c/config64.py | Python | apache-2.0 | 19,998 | 0.069207 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Btc plugin for Varas
Author: Neon & A Sad Loner
Last modified: November 2016
"""
import urllib2
from plugin import Plugin
name = 'Bitcoin'
class Bitcoin(Plugin):
def __init__(self):
Plugin.__init__(self,"bitcoin","<wallet> Return current balance from a ... | GooogIe/VarasTG | plugins/btc.py | Python | gpl-3.0 | 751 | 0.050599 |
from logging import getLogger
from vms.models import Dc, DummyDc
logger = getLogger(__name__)
class DcMiddleware(object):
"""
Attach dc attribute to each request.
"""
# noinspection PyMethodMayBeStatic
def process_request(self, request):
dc = getattr(request, 'dc', None)
if not ... | erigones/esdc-ce | vms/middleware.py | Python | apache-2.0 | 1,676 | 0.00537 |
"""
Example of using cwFitter to generate a HH model for EGL-19 Ca2+ ion channel
Based on experimental data from doi:10.1083/jcb.200203055
"""
import os.path
import sys
import time
import numpy as np
import matplotlib.pyplot as plt
sys.path.append('../../..')
from channelworm.fitter import *
if __name__ == '__main__... | cheelee/ChannelWorm | channelworm/fitter/examples/EGL-19-2.py | Python | mit | 6,529 | 0.013019 |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | hayderimran7/tempest | tempest/api/baremetal/admin/test_chassis.py | Python | apache-2.0 | 3,455 | 0 |
"""Parse (absolute and relative) URLs.
urlparse module is based upon the following RFC specifications.
RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
and L. Masinter, January 2005.
RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
and L.Masinter, Decemb... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/urlparse.py | Python | gpl-2.0 | 14,414 | 0.002081 |
# plugins module for amsn2
"""
Plugins with amsn2 will be a subclass of the aMSNPlugin() class.
When this module is initially imported it should load the plugins from the last session. Done in the init() proc.
Then the GUI should call plugins.loadPlugin(name) or plugins.unLoadPlugin(name) in order to deal with plugins.... | amsn/amsn2 | amsn2/plugins/core.py | Python | gpl-2.0 | 2,184 | 0.009615 |
#
# gPrime - A web-based genealogy program
#
# Copyright (C) 2008 Brian G. Matherly
#
# 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 ) any later ... | sam-m888/gprime | gprime/plug/menu/__init__.py | Python | gpl-2.0 | 1,579 | 0 |
# Copyright (c) Mathias Kaerlev 2012.
# This file is part of Anaconda.
# Anaconda 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.
# ... | joaormatos/anaconda | mmfparser/data/chunkloaders/actions/__init__.py | Python | gpl-3.0 | 749 | 0.001335 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and comp... | bobbyphilip/learn_python | google-python-exercises/basic/wordcount.py | Python | apache-2.0 | 3,007 | 0.006651 |
# -*- coding:utf-8 -*-
"""
Copyright (C) 2013 Nurilab.
Author: Kei Choi(hanul93@gmail.com)
This program 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 Foundation.
This program is distributed in the hope that it... | yezune/kicomav | Engine/plugins/macro.py | Python | gpl-2.0 | 19,013 | 0.017935 |
# Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
import os
#Functions for manipulating datetime objects
#CCYY-MM-DDThh:mm:ssZ
def parseDateClass(s):
year, month, day = s.split("-")
day, tail = day[:2], day[2:]
hour, minute, second = tail[1:].split(... | rebolinho/liveit.repository | script.video.F4mProxy/lib/f4mUtils/datefuncs.py | Python | gpl-2.0 | 2,355 | 0.005096 |
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import subprocess, time
last_ch = 0
class TvServerHandler(BaseHTTPRequestHandler):
def do_GET(self):
global last_ch
cmd = self.path.split('/')
if 'favicon.ico' in cmd:
return
... | mimepp/umspx | htdocs/umsp/plugins/eyetv/eyetv-controller.py | Python | gpl-3.0 | 1,293 | 0.037123 |
import kivy
kivy.require('1.9.1')
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.widget import Widget
from kivy.uix.scatter import Scatter
from kivy.app import Builder
from kivy.metrics import dp
from kivy.graphics import Color, Line
from autosportlabs.racecapture.geo.geopoint i... | ddimensia/RaceCapture_App | autosportlabs/uix/track/racetrackview.py | Python | gpl-3.0 | 1,499 | 0.007338 |
import unittest
from sikuli import *
from java.awt.event import KeyEvent
from javax.swing import JFrame
not_pressed = True
WAIT_TIME = 4
def pressed(event):
global not_pressed
not_pressed = False
print "hotkey pressed! %d %d" %(event.modifiers,event.keyCode)
class TestHotkey(unittest.TestCase):
def testA... | bx5974/sikuli | sikuli-script/src/test/python/test_hotkey.py | Python | mit | 1,110 | 0.034234 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:22713")
else:
access = Se... | Capricoinofficial/Capricoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,842 | 0.038128 |
# -*- coding: utf-8 -*-
import os
"""
Illustration d'un exercice de TD visant à montrer l'évolution temporelle de la
densité de probabilité pour la superposition équiprobable d'un état n=1 et
d'un état n quelconque (à fixer) pour le puits quantique infini.
Par souci de simplicité, on se débrouille pour que E_1/hbar... | NicovincX2/Python-3.5 | Physique/Physique quantique/Mécanique quantique/principe_de_superposition_lineaire.py | Python | gpl-3.0 | 1,519 | 0.003333 |
from __future__ import unicode_literals, division, absolute_import
import re
from argparse import ArgumentParser, ArgumentTypeError
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from flexget import options
from flexget.event import event
from flexget.terminal import TerminalTable, Te... | gazpachoking/Flexget | flexget/components/managed_lists/lists/regexp_list/cli.py | Python | mit | 5,302 | 0.003584 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('flyerapp', '0007_auto_20150629_1135'),
]
operations = [
migrations.AddField(
model_name='schedul... | luzeduardo/antonov225 | flyer/flyerapp/migrations/0008_auto_20150630_1859.py | Python | gpl-2.0 | 924 | 0.002165 |
from __future__ import unicode_literals
from django.apps import AppConfig
class ApplicationsConfig(AppConfig):
name = 'applications'
def ready(self):
super(ApplicationsConfig, self).ready()
from applications.signals import create_draft_application, clean_draft_application, \
auto... | hackupc/backend | applications/apps.py | Python | mit | 506 | 0.001976 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# 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 publi... | pyfa-org/eos | eos/eve_obj/custom/self_skillreq/__init__.py | Python | lgpl-3.0 | 3,165 | 0.000632 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Tuxemon
# Copyright (C) 2014, William Edwards <shadowapex@gmail.com>,
# Benjamin Bean <superman2k5@gmail.com>
#
# This file is part of Tuxemon.
#
# Tuxemon is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | andrefbsantos/Tuxemon | tuxemon/core/components/log.py | Python | gpl-3.0 | 1,644 | 0.000608 |
from django.db import models
from django.core.urlresolvers import reverse
from jsonfield import JSONField
import collections
# Create your models here.
class YelpvisState(models.Model):
title=models.CharField(max_length=255)
slug=models.SlugField(unique=True,max_length=255)
description = models.CharField(max_lengt... | intuinno/vistalk | yelpvis/models.py | Python | mit | 881 | 0.026107 |
# coding=UTF-8
# Author: Dennis Lutter <lad1337@gmail.com>
#
# This file is part of Medusa.
#
# Medusa 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... | fernandog/Medusa | tests/legacy/db_tests.py | Python | gpl-3.0 | 1,788 | 0.001119 |
# Copyright 2014 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, ... | dstrockis/outlook-autocategories | lib/unit_tests/test__helpers.py | Python | apache-2.0 | 6,951 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : 2017/10/18 17:13
# @Author : xxc727xxc (xxc727xxc@foxmail.com)
# @Version : 1.0.0
if __name__ == '__main__':
pass
| DreamerBear/awesome-py3-webapp | www/biz/__init__.py | Python | gpl-3.0 | 181 | 0 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DiskOffering.available_size_kb'
db.add_column(u'physical_... | globocom/database-as-a-service | dbaas/physical/migrations/0025_auto__add_field_diskoffering_available_size_kb.py | Python | bsd-3-clause | 11,926 | 0.00763 |
from pymacaron.log import pymlogger
import multiprocessing
from math import ceil
from pymacaron.config import get_config
log = pymlogger(__name__)
# Calculate resources available on this container hardware.
# Used by pymacaron-async, pymacaron-gcp and pymacaron-docker
def get_gunicorn_worker_count(cpu_count=None):... | erwan-lemonnier/klue-microservice | pymacaron/resources.py | Python | bsd-2-clause | 1,638 | 0.003053 |
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | freedomboxtwh/Plinth | plinth/modules/help/help.py | Python | agpl-3.0 | 2,917 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Anne Archibald <peridot.faceted@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation... | jwvhewitt/dmeternal | old_game/container.py | Python | gpl-2.0 | 8,515 | 0.00916 |
# View more python tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.
... | MediffRobotics/DeepRobotics | DeepLearnMaterials/tutorials/tensorflowTUT/tf5_example2/for_you_to_practice.py | Python | gpl-3.0 | 640 | 0.010938 |
# ---Libraries---
# Standard library
import os
import sys
import math
# Third-party libraries
import cv2
import numpy as np
import scipy.ndimage as ndimage
# Private libraries
import compute_OBIFs
import color_BIFs
sys.path.append(os.path.abspath("../"))
import utils
template_png='algorithms/inputFields/template.pn... | avicorp/firstLook | src/algorithms/check_input_fields.py | Python | apache-2.0 | 11,258 | 0.004264 |
import sys
import os.path
import re
import time
from docutils import io, nodes, statemachine, utils
try:
from docutils.utils.error_reporting import ErrorString # the new way
except ImportError:
from docutils.error_reporting import ErrorString # the old way
from docutils.parsers.rst import Directive, con... | wbinventor/openmc | docs/sphinxext/notebook_sphinxext.py | Python | mit | 3,717 | 0.001345 |
# Problem 28
# Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:
#
# 21 22 23 24 25
# 20 7 8 9 10
# 19 6 1 2 11
# 18 5 4 3 12
# 17 16 15 14 13
#
# It can be verified that the sum of the numbers on the diagonals is 101.
#
# What is the sum of the n... | chriscallan/Euler | Probs_1_to_50/028_NumberSpiralDiagonals.py | Python | gpl-3.0 | 3,489 | 0.004013 |
from __future__ import print_function
from __future__ import absolute_import
from Components.Task import Task, Job, DiskspacePrecondition, Condition, ToolExistsPrecondition
from Components.Harddisk import harddiskmanager
from Screens.MessageBox import MessageBox
from .Project import iso639language
import Tools.Notifica... | openatv/enigma2 | lib/python/Plugins/Extensions/DVDBurn/Process.py | Python | gpl-2.0 | 37,027 | 0.02536 |
# Copyright 2022 The Magenta 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 ... | magenta/magenta | magenta/models/improv_rnn/improv_rnn_create_dataset.py | Python | apache-2.0 | 2,205 | 0.004082 |
'''This allows running a bit of code on couchdb docs.
code should take a json python object, modify it and hand back to the code
Not quite that slick yet, need way to pass in code or make this a decorator
'''
import importlib
from harvester.collection_registry_client import Collection
from harvester.couchdb_init import... | ucldc/harvester | harvester/post_processing/run_transform_on_couchdb_docs.py | Python | bsd-3-clause | 3,271 | 0.002446 |
#!python
from __future__ import with_statement
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import pandas as pd
import wordbatch.batcher
def decorator_apply(func, batcher=None, cache=None, vectorize=None):
def wrapper_func(*args, **kwargs):
return Appl... | anttttti/Wordbatch | wordbatch/pipelines/apply.py | Python | gpl-2.0 | 2,258 | 0.030558 |
import os
#os.system("python D:\prog\python_packages\pyreport-0.3.4c\pyreport\pyreport.py -e -l -s --type pdf D:\m_\\ecPro\pacal\\trunk\pacal\\examples\\functions.py")
#os.system("python D:\prog\python_packages\pyreport-0.3.4c\pyreport\pyreport.py -e -l -s --type pdf D:\m_\\ecPro\pacal\\trunk\pacal\\examples\\how_to_... | jszymon/pacal | tests/examples/makerep.py | Python | gpl-3.0 | 5,081 | 0.011415 |
# Copyright 2018 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... | tombstone/models | research/object_detection/models/ssd_mobilenet_v1_fpn_feature_extractor_tf1_test.py | Python | apache-2.0 | 8,728 | 0.001948 |
# -*- coding: utf-8 -*-
"""
rio.blueprints.api_1
~~~~~~~~~~~~~~~~~~~~~
"""
from flask import Blueprint
bp = Blueprint('api_1', __name__)
| soasme/rio | rio/blueprints/api_1.py | Python | mit | 139 | 0 |
from .base import *
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
try:
from .local import *
except ImportError:
pass
MIDDLEWARE_CLASSES += [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
| greven/vagrant-django | project_name/settings/dev.py | Python | bsd-3-clause | 233 | 0.012876 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Base64Encode
# Returns the specified text or file as a Base64 encoded string.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");... | jordanemedlock/psychtruths | temboo/core/Library/Utilities/Encoding/Base64Encode.py | Python | apache-2.0 | 3,302 | 0.00424 |
"""Define statements for retrieving the data for each of the types."""
CONSTRAINTS = """
select
o.owner,
o.constraint_name,
o.constraint_type,
o.table_name,
o.search_condition,
o.r_owner,
o.r_constraint_name,
o.delete_rule,
... | marhar/cx_OracleTools | cx_PyOracleLib/cx_OracleObject/Statements.py | Python | bsd-3-clause | 5,193 | 0.000193 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
class A:
#classic class
"""this is class A"""
pass
__slots__=('x','y')
def test(self):
# classic class test
"""this is A.test()"""
print "A class"
class B(object):
#new class
"""this is class B"""
__slots__=(... | heibanke/python_do_something | Code/Chapter5/base_classic_new_class.py | Python | apache-2.0 | 596 | 0.028523 |
"""Classes required to create a Bluetooth Peripheral."""
# python-bluezero imports
from bluezero import adapter
from bluezero import advertisement
from bluezero import async_tools
from bluezero import localGATT
from bluezero import GATT
from bluezero import tools
logger = tools.create_module_logger(__name__)
class... | ukBaz/python-bluezero | bluezero/peripheral.py | Python | mit | 6,857 | 0 |
from django import forms
from apps.clientes.models import Cliente
from apps.clientes.choices import SEXO_CHOICES
import re
class ClienteForm(forms.ModelForm):
"""
Se declaran los campos y atributos que se mostraran en el formulario
"""
sexo = forms.ChoiceField(choices=SEXO_CHOICES, required=... | axelleonhart/TrainingDjango | materiales/apps/clientes/forms.py | Python | lgpl-3.0 | 2,527 | 0.002777 |
#!/bin/python3
import sys
import os
import tempfile
import pprint
import logging
from logging import debug, info, warning, error
def process_info(line):
line = line.strip()
arr = line.split(':')
if len(arr) < 2:
return None, None
key = arr[0]
val = None
if key == "freq":
val = "... | lejenome/my_scripts | scan_wifi.py | Python | gpl-2.0 | 2,384 | 0.001678 |
import struct
import uuid
from enum import IntEnum
from typing import List, Optional, Set
from .sid import SID
class ACEFlag(IntEnum):
""" ACE type-specific control flags. """
OBJECT_INHERIT = 0x01
CONTAINER_INHERIT = 0x02
NO_PROPAGATE_INHERIT = 0x04
INHERIT_ONLY = 0x08
INHERITED = 0x10
... | Noirello/PyLDAP | src/bonsai/active_directory/acl.py | Python | mit | 13,344 | 0.000749 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# StartOS Device Manager(ydm).
# Copyright (C) 2011 ivali, Inc.
# hechao <hechao@ivali.com>, 2011.
__author__="hechao"
__date__ ="$2011-12-20 16:36:20$"
import gc
from xml.parsers import expat
from hwclass import *
class Device:
def __init__(self, dev_xml):
... | jun-zhang/device-manager | src/lib/ydevicemanager/devices.py | Python | gpl-2.0 | 8,950 | 0.01676 |
#!/usr/bin/env python
# Copyright (c) 2015 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.
'''Unit tests for writers.android_policy_writer'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(o... | endlessm/chromium-browser | components/policy/tools/template_writers/writers/android_policy_writer_unittest.py | Python | bsd-3-clause | 3,381 | 0.001479 |
#!/usr/bin/env python
# reads data from wind direction thingy (see README)
# labels follow those set out in the Wunderground PWS API:
# http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol
#
# SOURCES:
# RETURNS: two objects for humidity and temperature
# CREATED: 2017-08-02
# ORIGINAL SOURCE: https://github.c... | dirtchild/weatherPi | weatherSensors/windDirection.py | Python | gpl-3.0 | 2,252 | 0.030195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.