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
# -*- coding: utf-8 -*- # # flask-ponywhoosh documentation build configuration file, created by # sphinx-quickstart on Tue Jun 1 14:31:57 2010. # # 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...
compiteing/flask-ponywhoosh
docs/src/conf.py
Python
mit
8,701
0.004252
from django.contrib import admin from video.models import TaggedVideo, Video class VideoAdmin(admin.TabularInline): model = Video @admin.register(TaggedVideo) class TaggedVideoAdmin(admin.ModelAdmin): search_fields = ['^tag'] inlines = [VideoAdmin]
stevecassidy/signbank-video
video/admin.py
Python
bsd-3-clause
264
0.007576
# -*- coding: utf-8 -*- import unittest import weakref from pyopenapi.migration.scan import Scanner, Dispatcher, scan from pyopenapi.migration.versions.v1_2.objects import ( ApiDeclaration, Authorization, Operation, ResponseMessage, Parameter) from pyopenapi.migration.versions.v3_0_0.objects import ( Header as...
mission-liao/pyopenapi
pyopenapi/tests/migration/test_scan.py
Python
mit
6,151
0.000488
# Copyright (c) 2014 Mirantis 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 writ...
tellesnobrega/sahara
sahara/utils/notification/sender.py
Python
apache-2.0
2,996
0
# coding: utf-8 from __future__ import unicode_literals from django.contrib import admin from .models import Book, Author, Publisher, Genre admin.site.register(Book, admin.ModelAdmin) admin.site.register(Author, admin.ModelAdmin) admin.site.register(Publisher, admin.ModelAdmin) admin.site.register(Genre, admin.ModelA...
ToxicWar/bibliotheque
library/admin.py
Python
mit
326
0
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies actions which are not depended on by other targets get executed. """ import TestGyp test = TestGyp.TestGyp() test.run_gyp('b...
ibc/MediaSoup
worker/deps/gyp/test/actions-bare/gyptest-bare.py
Python
isc
558
0
from django.test import TestCase from django.core import mail from django.contrib.auth.models import User from userena.models import UserenaSignup from userena import settings as userena_settings from guardian.shortcuts import get_perms import datetime, re class UserenaManagerTests(TestCase): """ Test the manag...
pirata-cat/agora-ciudadana
userena/tests/managers.py
Python
agpl-3.0
6,047
0.001984
""" The "engine room" of django mailer. Methods here actually handle the sending of queued messages. """ from django_mailer import constants, models, settings from lockfile import FileLock, AlreadyLocked, LockTimeout from socket import error as SocketError import logging import os import smtplib import tempfile impo...
selwin/django-mailer
django_mailer/engine.py
Python
mit
7,863
0.001145
# -*- coding: utf-8 -*- import config from metodos import * from mensagens import myid def my_id(msg): chat_id = msg['chat']['id'] try: user = '@' + msg['from']['username'] except:user = " " if msg['text'] == '/id': if msg['chat']['type'] == 'private': sendMessage(chat_id, myid['p...
francis-taylor/Timotty-Master
cybot/plug/myid.py
Python
mit
625
0.0224
from typing import Any, Generator, List, Optional from backend.common.consts.suggestion_state import SuggestionState from backend.common.models.account import Account from backend.common.models.suggestion import Suggestion from backend.common.queries.database_query import DatabaseQuery from backend.common.tasklets imp...
the-blue-alliance/the-blue-alliance
src/backend/common/queries/suggestion_query.py
Python
mit
1,368
0.000731
""" Courseware views functions """ import logging import urllib import json from collections import defaultdict from django.utils.translation import ugettext as _ from django.conf import settings from django.core.context_processors import csrf from django.core.exceptions import PermissionDenied from django.core.urlr...
hkawasaki/kawasaki-aio8-1
lms/djangoapps/courseware/views.py
Python
agpl-3.0
32,876
0.002555
import numpy as np from week3 import lnn, tools import os def f(x): if 0 <= x < 0.25: return float(0) elif 0.25 <= x < 0.5: return 16.0 * (x - 0.25) elif 0.5 <= x < 0.75: return -16.0 * (x - 0.75) elif 0.75 < x <= 1: return float(0) else: raise ValueError('v...
cyruscyliu/diffentropy
week3/w3_lnn.py
Python
mit
2,275
0
# Time: O(n) # Space: O(n) # Given a binary tree, return the tilt of the whole tree. # # The tilt of a tree node is defined as the absolute difference # between the sum of all left subtree node values and # the sum of all right subtree node values. Null node has tilt 0. # # The tilt of the whole tree is defined as th...
kamyu104/LeetCode
Python/binary-tree-tilt.py
Python
mit
1,289
0
#!/usr/bin/python # # Generate the build trees and Makefiles for PyQwt. import compileall import glob import optparse import os import pprint import re import shutil import sys import traceback class Die(Exception): def __init__(self, info): Exception.__init__(self, info) # __init__() # class Die ...
PyQwt/PyQwt4
configure/configure.py
Python
gpl-2.0
29,680
0.003605
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
alexandrucoman/vbox-neutron-agent
neutron/tests/unit/api/v2/test_attributes.py
Python
apache-2.0
35,656
0
import numpy as np import logging from plunc.common import round_to_digits from plunc.exceptions import SearchFailedException, InsufficientPrecisionError, OutsideDomainError from plunc.WaryInterpolator import WaryInterpolator class IntervalChoice(object): """Base interval choice method class """ method = ...
JelleAalbers/plunc
plunc/intervals/base.py
Python
mit
13,686
0.004749
from ..utils import getif def init_config(): config = {} getif(config, "token", "SLACK_TOKEN") getif(config, "loglevel", "LIMBO_LOGLEVEL") getif(config, "logfile", "LIMBO_LOGFILE") getif(config, "logformat", "LIMBO_LOGFORMAT") getif(config, "plugins", "LIMBO_PLUGINS") getif(config, "heroku"...
serverdensity/sdbot
limbo/settings/__init__.py
Python
mit
431
0.00464
#!/usr/bin/env python from gnuradio import gr from gnuradio.eng_option import eng_option from optparse import OptionParser import LTE_fdd_dl_fg import sys class LTE_fdd_dl_file_gen (gr.top_block): def __init__(self): gr.top_block.__init__(self) usage = "usage: %prog [options] file N_frames N_ant...
LucaBongiorni/openlte
LTE_fdd_dl_file_gen/python/LTE_fdd_dl_file_gen.py
Python
agpl-3.0
1,147
0.004359
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
werkt/bazel
src/test/py/bazel/bazel_windows_cpp_test.py
Python
apache-2.0
32,128
0.001276
from datetime import datetime class store: def __init__(self, delta): self.delta = delta self.dataDict = {} self.ordList = [] def store(self, data, info): ob2store = [data,info] if data in self.dataDict: try: self.ordList.remove(self.dataDict[data]) e...
jlzirani/cache-storing
store.py
Python
gpl-3.0
1,439
0.039611
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except jin compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
chengduoZH/Paddle
python/paddle/fluid/dygraph/parallel_helper.py
Python
apache-2.0
1,499
0
#! /usr/bin/env python ############################################################################## # # Copyright (C) Zenoss, Inc. 2008, 2009, all rights reserved. # # This content is made available according to terms specified in # License.zenoss under the directory where your Zenoss product is installed. # #####...
krull/docker-zenoss4
init_fs/usr/local/zenoss/ZenPacks/ZenPacks.zenoss.ZenJMX-3.12.1.egg/ZenPacks/zenoss/ZenJMX/zenjmx.py
Python
gpl-3.0
25,284
0.006051
import webapp2 from jinja2 import Environment, FileSystemLoader from os.path import dirname, join import os import json import base64 import hashlib import StringIO from google.appengine.api import users import numpy as np if not os.environ.get('SERVER_SOFTWARE','').startswith('Development'): import PIL import...
EvanBianco/pickr
main.py
Python
apache-2.0
13,664
0.009075
from elasticsearch_dsl import query from kuma.core.tests import eq_, ok_ from kuma.wiki.search import WikiDocumentType from . import ElasticTestCase class WikiDocumentTypeTests(ElasticTestCase): fixtures = ElasticTestCase.fixtures + ['wiki/documents.json'] def test_get_excerpt_strips_html(self): se...
safwanrahman/kuma
kuma/search/tests/test_types.py
Python
mpl-2.0
1,629
0
"""config URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
thomasperrot/MTGTrader
mtg/config/urls.py
Python
mit
915
0
# Copyright 2020 D-Wave Systems 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...
dwavesystems/dimod
dimod/bqm/construction.py
Python
apache-2.0
4,145
0.000241
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> # # 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 h...
luetgendorf/Espruino
boards/ESP32.py
Python
mpl-2.0
4,723
0.035994
# -*- coding: utf-8 -*- # # This file is part of Istex_Mental_Rotation. # Copyright (C) 2016 3ST ERIC Laboratory. # # This is a free software; you can redistribute it and/or modify it # under the terms of the Revised BSD License; see LICENSE file for # more details. # Load and transform ISTEX and wiki articles into ba...
ERICUdL/ISTEX_MentalRotation
ids2docs_years.py
Python
bsd-3-clause
2,227
0.021105
# -*- coding: utf-8 -*- from pulp.server.db.model.base import Model class Role(Model): """ Represents a role and a set of permissions associated with that role. Users that are added to this role will inherit all the permissions associated with the role. @ivar id: role's id, must be unique for ea...
ulif/pulp
server/pulp/server/db/model/auth.py
Python
gpl-2.0
1,467
0.001363
#: one x = 1 print(x) import time time.sleep(10) #: two #x = 2 print(x)
lemon24/intercessor
examples/book.py
Python
bsd-3-clause
78
0.038462
from selenium import webdriver from selenium.webdriver import ActionChains from os import path import time #NOTE: this demo uses images under images subfolder to find by name. # Be sure to configure AutoPyDriverServer to use that folder for images by name # start up both Firefox & AutoPyDriver for demo browser = web...
daluu/AutoPyDriverServer
sample-code/webdriver_integration_demo.py
Python
apache-2.0
1,719
0.007563
# encoding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( float_or_none, parse_age_limit, ) class TvigleIE(InfoExtractor): IE_NAME = 'tvigle' IE_DESC = 'Интернет-телевидение Tvigle.ru' _VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?...
0x7678/youtube-dl
youtube_dl/extractor/tvigle.py
Python
unlicense
2,889
0.001065
def count_moves(a, x, y): character = a[x][y] if character == ".": count = 0 rows = len(a) columns = len(a[x]) # Top Check if ((x - 2) >= 0) and (a[x - 1][y] == "o") and (a[x - 2][y] == "o"): count += 1 # Bottom Check if ((x + 2) < rows) and (a[x + 1][y] == "o") and (a[x + 2][y] == "o"): count += ...
ehouarn-perret/EhouarnPerret.Python.Kattis
Trivial/Peg.py
Python
mit
719
0.030598
from decimal import Decimal as D from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.template.defaultfilters import striptags, truncatechars from django.utils.translation import gettext_lazy as _ from paypalcheckoutsdk.core import LiveEnvironment, PayPalHttpClient, Sand...
lpakula/django-oscar-paypal
paypal/express_checkout/gateway.py
Python
bsd-3-clause
7,616
0.001576
# 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...
kobejean/tensorflow
tensorflow/python/ops/numerics.py
Python
apache-2.0
4,096
0.004395
# # # Copyright (C) 2012 Google Inc. # # 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 ...
vladimir-ipatov/ganeti
lib/outils.py
Python
gpl-2.0
4,426
0.005874
# 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 sys from measurements import media from telemetry import test class Media(test.Test): """Obtains media metrics for key user scenarios.""" test =...
DirtyUnicorns/android_external_chromium-org
tools/perf/benchmarks/media.py
Python
bsd-3-clause
1,514
0.015852
from numpy.linalg import norm from numpy import zeros, array, any as npany import new from copy import copy # local imports from ..identity_quadratic import identity_quadratic as sq from ..algorithms import FISTA from ..objdoctemplates import objective_doc_templater from ..doctemplates import (doc_template_user, doc...
klingebj/regreg
code/regreg/problems/composite.py
Python
bsd-3-clause
14,743
0.005698
# -*- coding: utf-8 -*- # # Copyright 2014-2022 BigML # # 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 ...
bigmlcom/python
bigml/api_handlers/evaluationhandler.py
Python
apache-2.0
3,626
0
# Copyright (c) 2015, Matt Layman import gettext import os localedir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'locale') translate = gettext.translation('tappy', localedir, fallback=True) _ = translate.gettext
blakev/tappy
tap/i18n.py
Python
bsd-2-clause
229
0
from .. import BASE_SCHEMA_URL, BASE_DATA_URL from rdflib.namespace import Namespace TRANS_NS = Namespace(BASE_SCHEMA_URL + '/translators/') TRANS_DATA_NS = Namespace(BASE_DATA_URL + '/translators/') DS_NS = Namespace(BASE_SCHEMA_URL + '/data_sources/') DS_DATA_NS = Namespace(BASE_DATA_URL + '/data_sources/') class ...
openworm/PyOpenWorm
owmeta/data_trans/common_data.py
Python
mit
496
0
# $Id$ # Copyright 2013 Matthew Wall # See the file LICENSE.txt for your full rights. # # Thanks to Eddie De Pieri for the first Python implementation for WS-28xx. # Eddie did the difficult work of decompiling HeavyWeather then converting # and reverse engineering into a functional Python implementation. Eddie's # wor...
sai9/weewx-gitsvn
bin/weewx/drivers/ws28xx.py
Python
gpl-3.0
174,398
0.006061
# -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 ## ## Copyright (C) 2007 Async Open Source <http://www.async.com.br> ## All rights reserved ## ## 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 Foundati...
andrebellafronte/stoq
stoqlib/gui/dialogs/tillhistory.py
Python
gpl-2.0
4,857
0.003088
# -*- coding: utf-8 -*- # This file is part of Shoop. # # Copyright (c) 2012-2015, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from __future__ import unicode_literals from django import forms from djang...
jorge-marques/shoop
shoop/discount_pricing/admin_form_part.py
Python
agpl-3.0
2,820
0.000355
# -*- coding:utf-8 -*- from .inception import InceptionDao from .models import DataMaskingRules, DataMaskingColumns from simplejson import JSONDecodeError import simplejson as json import re inceptionDao = InceptionDao() class Masking(object): # 脱敏数据 def data_masking(self, cluster_name, db_name, sql, sql_res...
jly8866/archer
sql/data_masking.py
Python
apache-2.0
16,236
0.002478
#!/usr/bin/python # coding=utf-8 ################################################################################ import os from test import CollectorTestCase from test import get_collector_config from test import unittest from test import run_only from mock import Mock from mock import patch from mock import mock_open...
TAKEALOT/Diamond
src/collectors/docker_collector/test/testdocker_collector.py
Python
mit
5,993
0.001335
from datetime import datetime def prettyDateNow(): """ Returns a good looking string for the local time. """ return datetime.now().ctime() def prettyDateNowUTC(): """ Returns a good looking string for utc time. """ return datetime.utcnow().ctime() def timestampNowLongUTC(): """ ...
0xPoly/ooni-probe
ooni/otime.py
Python
bsd-2-clause
479
0.006263
#!/usr/bin/python3 # # Polychromatic is licensed under the GPLv3. # Copyright (C) 2020-2021 Luke Horwell <code@horwell.me> # """ This module controls the 'Preferences' window of the Controller GUI. """ from .. import common from .. import effects from .. import locales from .. import middleman from .. import procpid f...
lah7/polychromatic
pylib/controller/preferences.py
Python
gpl-3.0
23,790
0.003153
#!/usr/bin/env python # -*- coding: utf-8 -*- # {{pkglts pysetup, from os import walk from os.path import abspath, normpath from os.path import join as pj from setuptools import setup, find_packages short_descr = "Set of data structures used in openalea such as : graph, grid, topomesh" readme = open('README.rst').re...
revesansparole/oacontainer
setup.py
Python
mit
1,872
0.001603
from __future__ import absolute_import from pprint import pprint # pylint: disable=import-error from twisted.internet import defer, threads, reactor from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver @defer.inlineCallbacks def create_node(name): node = yield threads.de...
StackPointCloud/libcloud
docs/examples/misc/twisted_create_node.py
Python
apache-2.0
898
0.001114
""" Tests for locust api module These tests requires locust installed """ #pylint: disable=W0403,C0103,too-many-public-methods import unittest from subprocess import call from netifaces import interfaces from locust.api import Agent from time import time, sleep STATUSES = {'success': 'success', 'error': ...
arozumenko/locust
tests/locust/tests_enable_network_adapters.py
Python
apache-2.0
8,175
0.000367
from django.shortcuts import render from django.http import HttpResponse def home(request): return render(request, 'home.html') def contact(request): return render(request, 'contact.html')
kaiocesar/simplemooc
simplemooc/core/views.py
Python
mit
192
0.026042
# -*- coding: utf-8 -*- # # Picard, the next-generation MusicBrainz tagger # # Copyright (C) 2007 Lukáš Lalinský # Copyright (C) 2014 Shadab Zafar # Copyright (C) 2015-2021 Laurent Monin # Copyright (C) 2019 Wieland Hoffmann # Copyright (C) 2019-2020 Philipp Wolfer # # This program is free software; you can redistribut...
metabrainz/picard
picard/pluginmanager.py
Python
gpl-2.0
17,081
0.000995
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers import pybindgen.settings import warnings class ErrorHandler(pybindgen.settings.ErrorHandler): def handle_error(self, wrapper, exception, traceback_): warnings.warn("exception %r in wrapper %s" % (exception, wrapper)) ...
tomhenderson/ns-3-dev-git
src/olsr/bindings/modulegen__gcc_LP64.py
Python
gpl-2.0
542,189
0.014563
"""Python part of the warnings subsystem.""" # Note: function level imports should *not* be used # in this module as it may cause import lock deadlock. # See bug 683658. import linecache import sys import types __all__ = ["warn", "warn_explicit", "showwarning", "formatwarning", "filterwarnings", "simplefil...
gusai-francelabs/datafari
windows/python/Lib/warnings.py
Python
apache-2.0
14,748
0.001492
#!/usr/bin/env python from setuptools import find_packages, setup from eventlet import __version__ from os import path setup( name='eventlet', version=__version__, description='Highly concurrent networking library', author='Linden Lab', author_email='eventletdev@lists.secondlife.com', url='htt...
collinstocks/eventlet
setup.py
Python
mit
1,289
0
# -*- encoding: utf-8 -*- # # Copyright 2013 Jay Pipes # # 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 la...
openilabs/falconlab
env/lib/python2.7/site-packages/talons/helpers.py
Python
mit
1,777
0
import DeepFried2 as df from .. import dfext def mknet(mkbn=lambda chan: df.BatchNormalization(chan, 0.95)): kw = dict(mkbn=mkbn) net = df.Sequential( # -> 128x48 df.SpatialConvolutionCUDNN(3, 64, (7,7), border='same', bias=None), dfext.resblock(64, **kw), df.PoolingCUDNN((2,2...
VisualComputingInstitute/towards-reid-tracking
lib/models/lunet2.py
Python
mit
1,896
0.007384
from utilities import docs, ftom, mtof, scale_val from dynamic_value import * from behaviors import * from schedule import now, wait, sprout from rtcmix_import.commands import * from instruments import * import busses #__all__ = ["rtcmix_import", "utilities", "abstract", "dynamic_value", "instruments", "behavior...
bennymartinson/Oort
oort/__init__.py
Python
gpl-3.0
335
0.008955
#!/usr/bin/env python #Copyright (C) 2013 by Thomas Keane (tk2@sanger.ac.uk) # #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 Software without restriction, including without limitation the rights #to u...
harvardinformatics/jobTree
batchSystems/lsf.py
Python
mit
12,569
0.010661
from src.platform.weblogic.interfaces import WINTERFACES, WLConsole class FPrint(WLConsole): """ WebLogic 10 is bugged when using Oracle's custom implementation of SSL. Only if the default Java implementation is set will this work; otherwise, Oracle sends an SSL23_GET_SERVER_HELLO and breaks OpenSSL. ...
GHubgenius/clusterd
src/platform/weblogic/fingerprints/WL10s.py
Python
mit
510
0.001961
import pytest from waterbutler.providers.onedrive.path import OneDrivePath from tests.providers.onedrive.fixtures import (path_fixtures, root_provider_fixtures, subfolder_provider_fixtures) class TestApiIdentifier: de...
rdhyee/waterbutler
tests/providers/onedrive/test_path.py
Python
apache-2.0
5,141
0.003307
import logging # Disable logging in unit tests logging.disable(logging.CRITICAL)
bramfoo/solarstats
tests/__init__.py
Python
gpl-2.0
82
0
import math def square_root ( a ): """Computes squar root of a """ espilon = 0.1e-11 x = a while True: y = ( x + a / x ) / 2.0 if abs( y - x ) < espilon: return y x = y def test_square_root(): """Compares custom square and math.sqrt. """ a = 1.0 ...
hacpai/show-me-the-code
Python/0033/main.py
Python
gpl-2.0
540
0.038889
from sendit.logger import bot from sendit.apps.main.models import Batch from django.core.management.base import ( BaseCommand ) from sendit.apps.main.models import Batch from sendit.apps.main.tasks import import_dicomdir from sendit.apps.main.utils import ls_fullpath from sendit.apps.api.utils import get_size imp...
pydicom/sendit
sendit/apps/main/management/commands/export_metrics.py
Python
mit
1,497
0.014028
""" ProofResourceStrategy is the real implementation of initializing the resource data for ProofResource. There can be multiple strategies for one ProofResource. Main considerations are configure file, database (may use a ProofInstance), XML file. This is the base class with all interfaces needed by ProofResource. Eac...
mattduan/proof
ProofResourceStrategy.py
Python
bsd-3-clause
946
0.004228
# -*- coding: utf-8 -*- # Copyright(C) 2015 Vincent A # # This file is part of weboob. # # weboob 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 opt...
sputnick-dev/weboob
modules/lutim/browser.py
Python
agpl-3.0
1,959
0.001021
import pandas as pd from enviropy import Enviropy def read_csv(fname): df = pd.read_csv(fname) return Enviropy(df)
jentjr/enviropy
enviropy/io/file.py
Python
mit
123
0.01626
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.forms import ModelForm, TextInput from django.contrib import admin from blog.models import Post class PostAdmin(admin.ModelAdmin): list_display = ['id', 'title', 'created', 'status'] list_filter = ('status', ) admin.site.register(...
pythonvlc/PyConES-2015
pycones/blog/admin.py
Python
mit
336
0.002976
#!/usr/bin/python '''test that the build and run results are OK''' # threads.heapprof should have 2 call stacks allocating 1024 blocks each import commands, sys print 'testing that *.heapprof files contain the expected results...' assert commands.getoutput("grep ' 1024 ' threads.heapprof | wc -l").strip() == '2' sec...
yosefk/heapprof
ok.py
Python
bsd-2-clause
823
0.010936
#!/usr/bin/env python ############################################################################# ## ## Copyright (C) 2013 Riverbank Computing Limited. ## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ## ## This file is part of the examples of PyQt. ## ## $QT_BEGIN_LICENSE:BSD$ ## You may use this file ...
DevinDewitt/pyqt5
examples/quick/scenegraph/customgeometry/customgeometry.py
Python
gpl-3.0
5,911
0.005414
import os, sys, commands def print_debug( msg, verbose ): data_dir_root = os.environ.get('DATADIR') debug_level = int(os.environ.get('DEBUGLEVEL')) #print the message to debug log if debug variable is set #add 'from debug import *' to header # call with print_debug("my message",5) # outputs to Datadi...
achamely/omniwallet
api/debug.py
Python
agpl-3.0
530
0.032075
# Rekall Memory Forensics # Copyright 2014 Google Inc. All Rights Reserved. # # Authors: # Michael Cohen <scudette@google.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; either version 2 ...
dsweet04/rekall
rekall-core/rekall/plugins/renderers/xls.py
Python
gpl-2.0
9,365
0.000427
""" Module responsible for translating reference sequence data into GA4GH native objects. """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals import hashlib import json import os import random import pysam import ga4gh.datamodel as datamodel import ga4gh....
diekhans/ga4gh-server
ga4gh/datamodel/references.py
Python
apache-2.0
15,873
0.000126
from concurrency.get_websites import get_number_of_links import time # Run get_number_of_links and compare it to a serial version # stub out load_url with a sleep function so the time is always the same # Show that the concurrent version takes less time than the serial import unittest from unittest.mock import patch...
b-ritter/python-notes
concurrency/tests_integration/test_collection_times.py
Python
mit
1,528
0.003272
#!/usr/bin/env python """ C to C++ Translator Convert a C program or whole project to C++ Copyright (C) 2001-2009 Denis Sureau 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 F...
2Habibie/ctocpp
c2cpp/pmake.py
Python
gpl-2.0
1,606
0.009963
from django.conf import settings from django.db.models import Prefetch from midnight_catalog.models import Product, ParamValue def get_all(slug=None): """ Возвращает QuerySet содержащий выборку товаров :param slug: символьный код категории каталога, если не задан выбираются товары в не зависимости от кате...
webadmin87/midnight
midnight_catalog/services.py
Python
bsd-3-clause
1,282
0.00266
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 Nicira Networks, 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.apac...
oeeagle/quantum
neutron/plugins/nicira/extensions/maclearning.py
Python
apache-2.0
1,838
0
# coding=utf-8 """ InaSAFE Disaster risk assessment tool developed by AusAid and World Bank - **GUI Test Cases.** Contact : ole.moller.nielsen@gmail.com .. note:: 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 Fre...
Jannes123/inasafe
safe/gui/widgets/test/test_dock.py
Python
gpl-3.0
37,784
0.000106
import os from multiprocessing import cpu_count _cpu_count = cpu_count() if hasattr(os, 'getloadavg'): def load_fair(): return 'load', os.getloadavg()[0] / _cpu_count else: from winperfmon import PerformanceCounter from threading import Thread from collections import deque from time impor...
buhe/judge
sysinfo.py
Python
agpl-3.0
1,249
0.001601
from django.contrib import admin # Register your models here. from polls.models import Question,Choice class ChoiceInline(admin.TabularInline): model = Choice extra = 3 class QuestionAdmin(admin.ModelAdmin): fields = ["question_text", "pub_date"] inlines = [ChoiceInline] list_display = ('question_te...
Tassemble/jewelry
polls/admin.py
Python
mit
475
0.023158
from people.models import Person from optparse import make_option try: import json except ImportError: try: import simplejson as json except ImportError: raise ImportError("Neither json or simplejson are available on your system") from django.core.management.base import BaseCommand, CommandE...
gdetrez/MyConf
apps/people/management/commands/addperson.py
Python
agpl-3.0
933
0.004287
#!/usr/bin/env pythonw #from __future__ import print_function import sys import wx import os import matplotlib if matplotlib.get_backend() != "WXAgg": matplotlib.use("WXAgg") import matplotlib.pyplot as plt from pmagpy import pmagplotlib import pmagpy.command_line_extractor as extractor import pmagpy.ipmag as ipm...
lfairchild/PmagPy
programs/core_depthplot.py
Python
bsd-3-clause
8,467
0.005551
from kivy.app import App from kivy.factory import Factory from kivy.lang import Builder Factory.register('QRScanner', module='electrum.gui.kivy.qr_scanner') class QrScannerDialog(Factory.AnimatedPopup): __events__ = ('on_complete', ) def on_symbols(self, instance, value): instance.stop() sel...
cryptapus/electrum
electrum/gui/kivy/uix/dialogs/qr_scanner.py
Python
mit
1,153
0.001735
""" Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. """ import common from conf import const def setUp(): """ set env """ common.print_debug_msg(1, "setup()") def test_create_user(): cmd = ...
linyvxiang/tera
test/testcase/test_root.py
Python
bsd-3-clause
3,730
0.006702
# -*- coding: utf-8 -*- from . import models from . import controllers from . import wizard
ddico/odoo
addons/sale_product_configurator/__init__.py
Python
agpl-3.0
93
0
# -*- coding: utf-8 -*- # # django-timegraph - monitoring graphs for django # Copyright (c) 2011-2012, Wifirst # Copyright (c) 2013, Jeremy Lainé # All rights reserved. # # See AUTHORS file for a full list of contributors. # # Redistribution and use in source and binary forms, with or without modification, # are permit...
jlaine/django-timegraph
timegraph/admin.py
Python
bsd-2-clause
2,072
0.005794
import qctests.EN_stability_check import util.testingProfile import numpy import util.main as main ##### EN_stability_check ---------------------------------------------- class TestClass(): parameters = { "table": 'unit' } def setUp(self): # this qc test will go looking for the profile ...
s-good/AutoQC
tests/EN_stability_check_validation.py
Python
mit
2,925
0.008547
# -*- coding: utf-8 -*- """ Script to cache anonymous houseprint data into hp_anonymous.pkl Created on 05/07/2014 by Roel De Coninck """ import os, sys import inspect script_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # add the path to opengrid to sys.path sys.path.a...
EnergyID/opengrid
scripts/job_cache_anonymous_houseprint.py
Python
gpl-2.0
730
0.005479
#!/usr/bin/env python from keyring import get_password from boto.iam.connection import IAMConnection import lib.LoadBotoConfig as BotoConfig from sys import exit envs = ['dev', 'qa', 'staging', 'demo', 'prod'] for env in envs: id = BotoConfig.config.get(env, 'aws_access_key_id') key = get_password(BotoConfig.co...
johnkastler/aws
get_account_urls.py
Python
gpl-3.0
456
0.013158
import time import picamera import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(23, GPIO.IN) GPIO.setup(18, GPIO.OUT) GPIO.output(18, False) while True: if(GPIO.input(23) == 1): print "motion" GPIO.output(18, True) with picamera.PiCamera() as camera: # Turn the camera's ...
jmbott/test-repo
motion_cam.py
Python
mit
1,069
0
import os.path from uuid import uuid4 import shutil import logging logger = logging.getLogger(__name__) _MARKER = object() class FileUploadTempStore(object): session_storage_slug = 'websauna.tempstore' def __init__(self, request): self.tempdir = request.registry.settings['websauna.uploads_tempdir'...
enkidulan/enkiblog
src/enkiblog/core/deform/tempstorage.py
Python
apache-2.0
2,365
0
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Presidentielcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test BIP68 implementation # from test_framework.test_framework import PresidentielcoinTestF...
presidentielcoin/presidentielcoin
qa/rpc-tests/bip68-sequence.py
Python
mit
18,409
0.003477
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
Jgarcia-IAS/SAT
openerp/addons-extra/odoo-pruebas/odoo-server/addons-extra/ifrs_report/wizard/ifrs_report_wizard.py
Python
agpl-3.0
7,032
0.002418
## Changemonger: An OpenStreetMap change analyzer ## Copyright (C) 2012 Serge Wroclawski ## ## 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...
emacsen/changemonger
features.py
Python
agpl-3.0
10,844
0.003689
""" A client/server code for Raspberry Pi ADC input Xaratustrah@GitHUB 2016 adapted from: https://wiki.python.org/moin/PyQt/Writing%20a%20client%20for%20a%20zeromq%20service """ from PyQt5.QtCore import pyqtSignal, QThread import zmq class ZMQListener(QThread): message = pyqtSignal(str) err_msg = pyqtSig...
xaratustrah/pypiscope
zmq_listener.py
Python
gpl-3.0
1,215
0
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc import match_pb2 as match__pb2 class MatchServiceStub(object): """MatchService is a Google managed service for efficient vector similarity search at sc...
GoogleCloudPlatform/analytics-componentized-patterns
retail/recommendation-system/bqml-scann/ann_grpc/match_pb2_grpc.py
Python
apache-2.0
4,364
0.008937
import sys import time import uuid import pandaserver.userinterface.Client as Client from pandaserver.taskbuffer.JobSpec import JobSpec from pandaserver.taskbuffer.FileSpec import FileSpec aSrvID = None prodUserNameDefault = 'unknown-user' prodUserName = None prodUserNameDP = None prodUserNamePipeline = None site = '...
PanDAWMS/panda-server
pandaserver/test/lsst/lsstSubmit.py
Python
apache-2.0
5,693
0.006499
#!/usr/bin/env python3 # Copyright (c) 2015-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. """Test BIP 9 soft forks. Connect to a single node. regtest lock-in with 108/144 block signalling activat...
globaltoken/globaltoken
test/functional/feature_bip9_softforks.py
Python
mit
12,919
0.004722
from django.forms import ModelForm from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm class UserLogin(ModelForm): class Meta: model = User fields = ['username', 'password'] class UserRegister(UserCreationForm): email = ...
GAngelov5/Sportvendor
sportvendor/sportvendor/users/forms.py
Python
gpl-2.0
1,164
0