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
#!/usr/bin/env python # -*- coding: utf-8 -*- from pangram import Pangram
prgmrbill/daily-programmer
pangrams/pangram/__init__.py
Python
mit
73
import pytest from nose.tools import * # flake8: noqa import functools from framework.auth.core import Auth from api.base.settings.defaults import API_BASE from tests.base import ApiTestCase from osf_tests.factories import ( ProjectFactory, AuthUserFactory, RegistrationFactory ) @pytest.mark.enable_qui...
sloria/osf.io
api_tests/registrations/views/test_registration_embeds.py
Python
apache-2.0
3,147
#!/usr/bin/env python3 """ Fair and Square problem for Google Code Jam 2013 Qualification Round Link to problem description: https://code.google.com/codejam/contest/2270488/dashboard#s=p2 author: Chris Nitsas (nitsas) language: Python 3.2.3 date: May, 2012 usage: $ python3 runme.py sample.in or $ runme.py sample....
nitsas/codejamsolutions
Fair and Square/runme.py
Python
mit
3,612
# encoding: UTF-8 import talib as ta import numpy as np from ctaBase import * from ctaTemplate import CtaTemplate ######################################################################## class TalibDoubleSmaDemo(CtaTemplate): """基于Talib模块的双指数均线策略Demo""" className = 'TalibDoubleSmaDemo' author = u'ideap...
sunshinelover/chanlun
vn.trader/ctaAlgo/talibDemo.py
Python
mit
6,279
#!/usr/bin/env python def download_outputs(path_prefix, creds_path, bucket_name, qap_type, \ download_to): import pickle from CPAC.AWS import fetch_creds from CPAC.AWS.aws_utils import s3_download src_list = [] bucket = fetch_creds.return_bucke...
oesteban/quality-assessment-protocol
scripts/qap_download_output_from_S3.py
Python
bsd-3-clause
2,190
import pytest from aiocache import Cache from aiocache.backends.redis import RedisBackend @pytest.fixture def redis_cache(event_loop): cache = Cache(Cache.REDIS, namespace="test", pool_max_size=1) yield cache for _, pool in RedisBackend.pools.items(): pool.close() event_loop.run_until_co...
argaen/aiocache
tests/performance/conftest.py
Python
bsd-3-clause
470
#!/usr/bin/env python import sys import math from gnuradio import blocks, filter, gr from gnuradio.eng_option import eng_option from optparse import OptionParser # Load it locally or from the module try: import cqpsk except: from tetra_demod import cqpsk # accepts an input file in complex format # applies f...
sq5bpf/osmo-tetra-sq5bpf
src/demod/python-3.7/tetra-demod.py
Python
agpl-3.0
2,697
import os import peewee from rivr_peewee import Database DATABASE_URL = os.environ.get('DATABASE_URL') if DATABASE_URL and DATABASE_URL.startswith('postgres://'): DATABASE_URL = DATABASE_URL.replace('postgres://', 'postgres+pool://') # disable auto connection EXTRA_OPTIONS = 'autoconnect=false' if '...
cocodelabs/api.palaverapp.com
palaverapi/models.py
Python
bsd-3-clause
1,143
from direct.directnotify import DirectNotifyGlobal from direct.distributed.DistributedObjectAI import DistributedObjectAI class WelcomeValleyManagerAI(DistributedObjectAI): notify = DirectNotifyGlobal.directNotify.newCategory("WelcomeValleyManagerAI") def clientSetZone(self, todo0): pass def toon...
silly-wacky-3-town-toon/SOURCE-COD
toontown/ai/WelcomeValleyManagerAI.py
Python
apache-2.0
494
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.forms import widgets from cmsplugin_cascade.plugin_base import CascadePluginBase def reduce_breakpoints(plugin, field_name): """ Narrow down the number of breakpoints in the widget of the named glossary_field. This is useful in ca...
Julien-Blanc/djangocms-cascade
cmsplugin_cascade/bootstrap3/utils.py
Python
mit
9,052
from datetime import datetime, timezone from unittest.mock import Mock, ANY import time import sys import pytest from spinach import signals from spinach.worker import ThreadWorkers, AsyncioWorkers from spinach.job import Job # Spinach does not support AsyncIO on Python 3.6 workers_to_test = [ThreadWorkers] if sys....
NicolasLM/spinach
tests/test_worker.py
Python
bsd-2-clause
3,580
import sys # Import cpuinfo.py from up one directory sys.path.append('../cpuinfo') # NOTE: Pyinstaller may spawn infinite processes if __main__ is not used if __name__ == '__main__': from multiprocessing import freeze_support from cpuinfo import get_cpu_info # NOTE: Pyinstaller also requires freeze_support free...
workhorsy/py-cpuinfo
example/example_pyinstaller.py
Python
mit
356
#!/usr/bin/env python import time makefile = ''' { "rules": [ { "inputs": [ "source1" ], "outputs": [ "output" ], "cmd": "cat source1 > output && cat source2 >> output && echo 'output: source1 source2' > deps", "depfile": "deps" } ] } ''' def set_version_1(test): test.writ...
falcon-org/Falcon
test/TestCache.py
Python
bsd-3-clause
2,048
# -*- coding: utf-8 -*- # Copyright 2016-2019 OpenSynergy Indonesia # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import api, fields, models class HrExpense(models.Model): _inherit = "hr.expense.expense" account_id = fields.Many2one(string="Account", comodel_name="account.acco...
open-synergy/opnsynid-hr
hr_expense_header_account/models/hr_expense.py
Python
agpl-3.0
1,823
from django.contrib.auth.forms import AuthenticationForm from django import forms from django.utils.translation import ugettext_lazy as _ class BigAuthenticationForm(AuthenticationForm): username = forms.CharField(label=_("Username"), max_length=70)
TwigWorld/Impostor
impostor/forms.py
Python
mit
252
# -*- coding: utf-8 -*- # # MIT License # # Copyright (c) 2016 Tomas Pavuk <433592@mail.muni.cz>, Institute of Computer Science, Masaryk University # # 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 S...
CSIRT-MU/Stream4Flow
applications/statistics/tls_classification/spark/modules/kafkaIO.py
Python
mit
4,963
#!/usr/bin/python # coding: utf-8 class Solution(object): def numUniqueEmails(self, emails): """ :type emails: List[str] :rtype: int """ seen = set() for email in emails: local, _, domain = email.partition('@') if '+' in local: ...
Lanceolata/code-problems
python/leetcode_easy/Question_929_Unique_Email_Addresses.py
Python
mit
437
#!/usr/bin/python # # 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) any later version. # # Ansible is distribut...
shanemcd/ansible
lib/ansible/modules/network/eos/eos_user.py
Python
gpl-3.0
12,767
"""Tests for acme.challenges.""" import unittest import mock import OpenSSL import requests from six.moves.urllib import parse as urllib_parse # pylint: disable=import-error from acme import errors from acme import jose from acme import other from acme import test_util CERT = test_util.load_cert('cert.pem') KEY =...
solidgoldbomb/letsencrypt
acme/acme/challenges_test.py
Python
apache-2.0
23,208
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # This is a virtual module that is entirely implemented as an action plugin and runs on the controller from __future__ import absolute_import, ...
Dhivyap/ansible
lib/ansible/modules/files/template.py
Python
gpl-3.0
2,564
from . import hardware, GPIORobotDevice class IndicatorLight(GPIORobotDevice): """ Class for controlling an indicator light. """ def __init__(self,control_pin,name=None,frequency=1,duty_cycle=100): """ Initialize the light. control_pin is GPIO pin. frequency and dut...
harmsm/roboDOD
rpyBot/devices/gpio/led.py
Python
mit
7,970
# Copyright (C) 2010 Google Inc. 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, this list of conditions and the ...
lordmos/blink
Tools/Scripts/webkitpy/layout_tests/port/win.py
Python
mit
8,805
# -*- coding:utf-8 -*- # @Author zpf """ Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array. Could you do it without extra space and in O(n) runtime? You may assume the return...
Vonzpf/LeetCode
python/FindNumbersDisappeared.py
Python
mit
738
# 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 may ...
Azure/azure-sdk-for-python
sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py
Python
mit
27,184
# Copyright (C) 2010-2011 Richard Lincoln # # 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 use, copy, modify, merge, publish...
rwl/PyCIM
CIM14/IEC61970/Meas/LimitSet.py
Python
mit
2,248
# Eve W-Space # Copyright (C) 2013 Andrew Austin and other contributors # # 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...
djrscally/eve-wspace
evewspace/account/management/commands/resetadmin.py
Python
gpl-3.0
1,882
"""Test driver interface :copyright: Copyright 2019 Marshall Ward, see AUTHORS for details :license: Apache License, Version 2.0, see LICENSE for details """ import os import shlex import shutil import subprocess from payu.models.model import Model config_files = [ 'data', 'diag', ...
marshallward/payu
payu/models/test.py
Python
apache-2.0
649
from django.db import models from django.contrib.auth.models import User from cards.models import Card class DeckManager(models.Manager): def create_default_decks(self): """ Create default desks for users """ return NotImplemented('Create default desks for users') class Deck(mode...
taopypy/django-cardgame
cardgame/decks/models.py
Python
mit
587
import os import unittest from unittest.mock import patch, mock_open, call, MagicMock import listenbrainz_spark from listenbrainz_spark import config from listenbrainz_spark.exceptions import DumpInvalidException from listenbrainz_spark.tests import SparkNewTestCase class FTPTestCase(SparkNewTestCase): @patch('...
metabrainz/listenbrainz-server
listenbrainz_spark/ftp/tests/test_init.py
Python
gpl-2.0
4,999
#!/usr/bin/env python # Source script by: Volker Strobel # Forked from https://github.com/Pold87/academic-keyword-occurrence # - Fork date: 13/12/2017 # - Forked by Han Bossier from bs4 import BeautifulSoup import urllib from urllib2 import Request, build_opener, HTTPCookieProcessor from cookielib import LWPCookieJ...
NeuroStat/NeuRRoStat
inst/extscrpt/extract_occurrences.py
Python
mit
2,809
""" Contributing Authors: Mona Assarandarban Amirreza Barin Jessica Greenling Nicholas Nelson Reads from dfgen.cfg and produces a Dockerfile based on the info from the config file Dependencies: ConfigParser random os sys """ from ConfigParser import SafeConfigParse...
acgs/ATD
ATD/DFGen/dfgen.py
Python
gpl-2.0
4,347
import bleach from bs4 import BeautifulSoup import re allowed_tags = ['a', 'b', 'p', 'i', 'blockquote', 'span', 'ul', 'li', 'ol', 'strong', 'pre', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'br', 'span'] allowed_attrs = { 'a': ['href', 'rel'], } allowed_tags_media = list(allowed_tags) allowed_tags_media += ['ifr...
asm-products/unsquat-it
lib/sanitize.py
Python
gpl-3.0
2,683
__author__ = 'drobisch' from models import User, Action, Door, RfidTagInfo, Statistic, StatisticEntry from server import db def seed(): stats = Statistic.query.all() if stats is not None: for stat in stats: print stat.description if stat.description == 0: print ...
blinzelaffe/roseguarden
server/app/seed.py
Python
gpl-3.0
530
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-01 05:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('booker', '0024_auto_20170228_2315'), ] operations = [ migrations.AddField( ...
luckiestlindy/osproject
booker/migrations/0025_event_wedding_options.py
Python
gpl-3.0
758
from boardme import app, db app.debug = True app.run(port=8090)
DextrousInc/board-me-server
run-local.py
Python
mit
65
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
EmreAtes/spack
var/spack/repos/builtin/packages/genometools/package.py
Python
lgpl-2.1
1,851
"""Support for Streamlabs Water Monitor Usage.""" from datetime import timedelta from homeassistant.components.streamlabswater import DOMAIN as STREAMLABSWATER_DOMAIN from homeassistant.const import VOLUME_GALLONS from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle DEPENDENCIES = ...
fbradyirl/home-assistant
homeassistant/components/streamlabswater/sensor.py
Python
apache-2.0
3,962
#La siguiente frase me permite poner tildes y spanish caracteres (si no usa solo ASCII) # -*- coding: utf-8 -*- #Hay que poner almohadilla para escribir un comentario de una sola línea ''' Hay que poner 3 comillas simples para varias lineas de comentario: ¿Qué es un comentario? # Una anotación que haces para que te ...
chemabc/raspPi_IED_example
simpleCommands.py
Python
gpl-2.0
3,146
# -*- coding:utf-8 -*- """ WPTools Category module ~~~~~~~~~~~~~~~~~~~~~~~ Support for getting Mediawiki category info. """ from . import core class WPToolsCategory(core.WPTools): """ WPToolsCategory class """ def __init__(self, *args, **kwargs): """ Returns a WPToolsCategory objec...
siznax/wptools
wptools/category.py
Python
mit
5,299
from flask_sqlalchemy import SQLAlchemy Database = SQLAlchemy() Model = Database.Model
nico-arianto/dota2-messenger-platform
Models/Model.py
Python
gpl-3.0
88
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('forms', '0004_form_registration_limit'), ] operations = [ migrations.AlterField( model_name='field', ...
simas/django-forms-builder
forms_builder/forms/migrations/0005_auto_20160912_1534.py
Python
bsd-2-clause
447
# # Code by Alexander Pruss and under the MIT license # from mine import * def draw_surface(xf,yf,zf,a0,a1,asteps,b0,b1,bsteps,ox,oy,oz,scalex,scaley,scalez,mcblock,mcmeta): for i in range(asteps): u = (a0 * (asteps-1-i) + a1 * i) / asteps for j in range(bsteps): v = (b0 * (bsteps-1-j) +...
arpruss/raspberryjam-pe
p2/scripts3/klein2.py
Python
mit
1,839
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth.forms import ReadOnlyPasswordHashWidget from django.forms import ( TextInput, DateInput, FileInput, CheckboxInput, MultiWidget, ClearableFileInput, Select, RadioSelect, CheckboxSelectMultiple ) from django.forms.extras imp...
kaiocesar/django-template
templates/bootstrap3/renderers.py
Python
mit
19,864
import os import csv from datetime import datetime from django.conf import settings def refresh_csv(table_name=""): print("refreshing CSV from StairQuest database...") filename = "{}_{}.csv".format(table_name,datetime.today().strftime("%m%d%Y")) outfile = os.path.join(settings.BASE_DIR,"stairdb","mana...
mradamcox/hkstairs
stairdb/management/commands/_utils.py
Python
gpl-3.0
1,238
from .other_cluster_algos import *
agbs2k8/toolbelt_dev
toolbelt/cluster/__init__.py
Python
mit
35
# test_nose_example.py def my_function(x, y): """Subtract y from x""" return x - y def test_my_function(): assert my_function(7,4) == 3
bas-rustenburg/presentations
choderalab/Oct1702014_Testing/code_examples/test_nose_example.py
Python
lgpl-3.0
149
#!/usr/bin/env python # Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute # Copyright [2016-2021] EMBL-European Bioinformatics Institute # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License...
Ensembl/ensembl-production
scripts/py/dcparse.py
Python
apache-2.0
4,902
# Copyright 2013-2018 Rumma & Ko Ltd # License: BSD (see file COPYING for details) """ Adds a multipurpose concept of "Note". See :doc:`/specs/notes`. .. autosummary:: :toctree: fixtures.demo fixtures.std """ from lino import ad from django.utils.translation import ugettext_lazy as _ class Plugin(ad.Pl...
khchine5/xl
lino_xl/lib/notes/__init__.py
Python
bsd-2-clause
1,309
r""" ############################################################################### :mod:`OpenPNM.Utilities` -- IO, geometry tools and other functions ############################################################################### .. automodule:: OpenPNM.Utilities.IO :members: :undoc-members: :show-inheritan...
stadelmanma/OpenPNM
OpenPNM/Utilities/__init__.py
Python
mit
425
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import datetime from app import context as ctx def get_time(): return int(time.time()) def get_adjusted_time(): return get_time() + ctx.timeOffset def sleep_msec(msec): time.sleep(msec / 1000.0) setKnown = set() # ip s...
JKingdom/KingCoin
app/utils/timeutil.py
Python
gpl-3.0
2,121
import os def get_path_to_parent_dir(filename): return os.path.dirname(os.path.abspath(filename))
morganics/BayesPy
bayespy/utils.py
Python
apache-2.0
102
# Copyright 2009 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/tasks/responses.py
Python
apache-2.0
1,761
def subtrees_equal(expected_schema_node, actual_node): if expected_schema_node[0] != actual_node.get_name(): return False if expected_schema_node[1] != actual_node.get_state(): return False expected_children = expected_schema_node[2] actual_children = actual_node.get_children() actual_children_names = [child.g...
mkobos/tree_crawler
concurrent_tree_crawler/test/subtrees_comparer.py
Python
mit
650
import json import threading import time import os import stat from decimal import Decimal from typing import Union, Optional from numbers import Real from copy import deepcopy from . import util from .util import (user_dir, make_dir, NoDynamicFeeEstimates, format_fee_satoshis, quantize_feerate) fr...
fujicoin/electrum-fjc
electrum/simple_config.py
Python
mit
20,688
# Copyright (C) 2001-2006 Python Software Foundation # Author: Barry Warsaw # Contact: email-sig@python.org """Class representing text/* type MIME documents.""" __all__ = ['MIMEText'] from email.mime.nonmultipart import MIMENonMultipart class MIMEText(MIMENonMultipart): """Class for generating text/* type MI...
ruibarreira/linuxtrail
usr/lib/python3.4/email/mime/text.py
Python
gpl-3.0
1,367
"""Abstract CarType. __author__ = "http://www.gemalto.com" Copyright 2001-2012 gemalto Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com This file is part of pyscard. pyscard is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as publis...
LudovicRousseau/pyscard
smartcard/CardType.py
Python
lgpl-2.1
3,695
from gevent import monkey monkey.patch_all() import gevent from SearchService_pb2 import SearchService_Stub, SearchRequest from protobuf_rpc.channel import ZMQChannel from protobuf_rpc.controller import SocketRpcController import time def callback(response): print "Server response", response.response channel = ...
timcherry/protobuf-rpc
example/search/search_client.py
Python
mit
1,511
# Author : Sr@1 import sys from PyQt5 import QtGui, QtCore, QtWidgets from PyQt5.QtCore import Qt #User file imports from initUI import UI from initMenubar import Menubar #Main class inheriting from the QMainWindow class Main(QtWidgets.QMainWindow): def __init__(self, parent = None): QtWidgets.QMainWindo...
sravankr96/Text-Editor-Using-Python
App/__init__.py
Python
gpl-2.0
597
# -*- coding: utf-8 -*- from __future__ import absolute_import from datetime import datetime import json from flask import ( Blueprint, jsonify, make_response, redirect, render_template, request, url_for, current_app, abort, g, Response ) from flask.ext.babel import lazy_gettext as _ from flask.ext.security imp...
JamesMura/elections
apollo/frontend/views_submissions.py
Python
gpl-3.0
18,377
# Unification Rules # ----------------- from blaze import NDArray, dshape from blaze.engine.pipeline import Pipeline from unittest import skip # XXX Disabling until adding typeinference.py to Pipeline, this is not # solveable in terms of classical numpy promotion. @skip def test_simple_unify(): A = NDArray([0], ...
davidcoallier/blaze
blaze/tests/test_unification.py
Python
bsd-2-clause
1,334
# This file is executed on every boot (including wake-boot from deepsleep) #import esp #esp.osdebug(None) import gc #import webrepl #webrepl.start() gc.collect() # Frankenbot! import frankenbot frankenbot.Frankenbot().start()
mrda/robo-chicken
projects/Frankenbot/boot.py
Python
gpl-3.0
227
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: dan@reciprocitylabs.com # Maintained By: dan@reciprocitylabs.com from datetime import date from datetime import datetime from sqlalchemy import orm...
prasannav7/ggrc-core
src/ggrc_workflows/models/task_group_task.py
Python
apache-2.0
5,606
class Entry: m_name = "" m_description = "Please fill the description." m_required = "No" m_default = "-" m_value = "-" m_example = "Please fill the example." def __init__(self, name, required, default): self.m_name = name self.m_required = required self.m_default = ...
RcRonco/role2md
role2md/types.py
Python
bsd-3-clause
448
import os.path from collections import defaultdict, namedtuple from contextlib import contextmanager import windows import windows.generated_def as gdef import windows.winobject.exception as winexception import windows.native_exec.simple_x86 as x86 import windows.native_exec.simple_x64 as x64 from windows.winobject....
hakril/PythonForWindows
windows/debug/debugger.py
Python
bsd-3-clause
52,256
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('discussions', '0004_auto_20150430_1641'), ] operations = [ migrations.AlterField( model_name='discussion', ...
ZackYovel/studybuddy
server/studybuddy/discussions/migrations/0005_auto_20150430_1645.py
Python
mit
459
############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public L...
jeffery9/mixprint_addons
stock_location/procurement_pull.py
Python
agpl-3.0
6,951
""" Test script that uses two GPUs, one per sub-process, via the Python multiprocessing module. Each GPU fits a logistic regression model. """ # These imports will not trigger any theano GPU binding from multiprocessing import Process, Manager import numpy as np import os def f(shared_args,private_args): """ B...
lzamparo/SdA_reduce
theano_models/SdA/test_multiproc_gpu.py
Python
bsd-3-clause
3,656
class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: total = len(nums1) + len(nums2) nums3 = self.merge(nums1, nums2) return ( nums3[total // 2] if total % 2 else (nums3[total // 2 - 1] + nums3[total // 2]) / 2 ...
chengzhoukun/LeetCode
4. Median of Two Sorted Arrays/solution2.py
Python
lgpl-3.0
887
""" Life of a webhook ----------------- The WebhookService is started by ./inbox and runs continuously as its own greenlet. Now say an API client registers a webhook W. The API server calls WebhookService.register_hook via ZeroRPC with the webhook data. We then insert a row into the Webhook table of the database, cont...
rmasters/inbox
inbox/transactions/webhook.py
Python
agpl-3.0
15,958
# It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square. # 9 = 7 + 2x1^2 # 15 = 7 + 2x2^2 # 21 = 3 + 2x3^2 # 25 = 7 + 2x3^2 # 27 = 19 + 2x2^2 # 33 = 31 + 2x1^2 # It turns out that the conjecture was false. # What is the smallest odd c...
ledbutter/ProjectEulerPython
Problem46.py
Python
mit
1,921
#!/usr/bin/env python # coding=utf-8 from webapp.web import BaseHandler class SignoutHandler(BaseHandler): def get(self): self.clear_cookies() self.session.kill() return self.redirect("/") def post(self): self.get()
vincentpc/yagra_for_wsgi
handlers/signout.py
Python
apache-2.0
261
""" DIRAC JobDB class is a front-end to the main WMS database containing job definitions and status information. It is used in most of the WMS components The following methods are provided for public usage: getJobAttribute() getJobAttributes() getAllJobAttributes() getDistinctJobAttributes...
miloszz/DIRAC
WorkloadManagementSystem/DB/JobDB.py
Python
gpl-3.0
85,632
from TEST_local_base import * @prepare_before_test(num=301, times=1) def test_301_gpload_yaml_with_header(): "301 gpload yaml config with header true" copy_data('external_file_301.txt','data_file.txt') write_config_file(config='config/config_file',format='text',file='data_file.txt',table='texttable', heade...
50wu/gpdb
gpMgmt/bin/gpload_test/gpload2/TEST_local_options.py
Python
apache-2.0
2,454
# coding=utf-8 """ Profiler utility for python Erik de Jonge erik@a8.nl license: gpl2 """ from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from pyp...
erikdejonge/pyprofiler
run_graph_main.py
Python
gpl-2.0
479
from algorithms.maths.polynomial import ( Polynomial, Monomial ) from fractions import Fraction import math import unittest class TestSuite(unittest.TestCase): def setUp(self): self.p0 = Polynomial([ Monomial({}) ]) self.p1 = Polynomial([ Monomial({}), Monomial({}) ]) self.p2 = Polynomial([ Mo...
keon/algorithms
tests/test_polynomial.py
Python
mit
4,694
import urllib.parse import requests TRELLO_API_URL = 'https://trello.com/1' class TrelloError(Exception): def __init__(self, session, status_code, url, text, desc="API call error"): self.session = session self.status_code = status_code self.url = url self.text = text max...
yamnikov-oleg/trello-bot
bot/trello.py
Python
mit
10,187
from OpenGLCffi.GLX import params @params(api='glx', prms=['dpy', 'readCtx', 'writeCtx', 'readTarget', 'writeTarget', 'readOffset', 'writeOffset', 'size']) def glXCopyBufferSubDataNV(dpy, readCtx, writeCtx, readTarget, writeTarget, readOffset, writeOffset, size): pass @params(api='glx', prms=['dpy', 'readCtx', 'writ...
cydenix/OpenGLCffi
OpenGLCffi/GLX/EXT/NV/copy_buffer.py
Python
mit
515
""" An experiment using a variable-sized ES HyperNeat network to perform the simple XOR task. Fitness threshold set in config - by default very high to show the high possible accuracy of this library. """ import pickle import neat import neat.nn from pureples.shared.substrate import Substrate from pureples.shared.visu...
ukuleleplayer/pureples
pureples/experiments/xor/es_hyperneat_xor.py
Python
mit
4,238
#!/usr/bin/env python # encoding: utf-8 ''' Created by Brian Cherinka on 2016-04-28 14:07:58 Licensed under a 3-clause BSD license. Revision History: Initial Version: 2016-04-28 14:07:58 by Brian Cherinka Last Modified On: 2016-04-28 14:07:58 by Brian ''' from __future__ import print_function from __future__...
sdss/marvin
python/marvin/web/controllers/plate.py
Python
bsd-3-clause
3,911
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # 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...
idjaw/horizon
horizon/test/urls.py
Python
apache-2.0
1,611
# This script is designed to score a hand in cribbage. # It should be used as such: # The python script will be ran from the command line, like: python3.5 cribbage.py # The cut card must be set so that a hand can be scored. like: ccard qh # The cut card would now be the queen of Hearts. # A hand can now be scored using...
KyleScharnhorst/PyCribbage
Cribbage.py
Python
gpl-3.0
4,222
#!/usr/bin/env python ############################################################################ # Copyright (C) 2005 by # # # # Milton Inostroza Aguilera # # minoztro@gmail.com ...
minostro/remunex
src/conexionbd.py
Python
gpl-2.0
3,212
#!/usr/bin/env python from bots import xml2botsgrammar if __name__ == '__main__': xml2botsgrammar.start()
eppye-bots/bots
bots-xml2botsgrammar.py
Python
gpl-3.0
111
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2018-01-17 14:09 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('online', '0001_initial'), ] operations = [ migrations.AlterField( ...
liucode/liucode.github.io
online/migrations/0002_auto_20180117_2209.py
Python
mit
438
#!/usr/bin/env python # # Raspberry Pi Rotary Test Encoder Class # # Author : Bob Rathbone # Site : http://www.bobrathbone.com # # This class uses a standard rotary encoder with push switch # import sys import time from rotary_class import RotaryEncoder # Define GPIO inputs PIN_A = 36 # Pin 8 PIN_B = 38 # Pin 10 ...
Wollert/beer
test_rotary_class.py
Python
mit
786
#!/usr/bin/python -Wall #coding:utf-8 import btdb platform_name = "raspberrypi" def gen_cfg_platform(db): btdb.set_uint32 (db,"platform.cfg.size", 1) btdb.set_boolean (db,"platform.cfg[0].is_host", 1) btdb.set_boolean (db,"platform.cfg[0].is_init_console", 0) btdb.set_string (db,"platfo...
YuanYuLin/PackMan_IOPC
utils/cfgs_bdb/pydb/cfg_raspberrypi.py
Python
mit
20,295
__all__ = ["login", "logout", "register"] # Selenium WebDriver from selenium import webdriver from selenium.common.exceptions import NoSuchElementException #from selenium.webdriver.common.keys import Keys from gluon import current from gluon.storage import Storage from .core_utils import * current.data = Storage() cu...
flavour/rgims_as_diff
modules/tests/core/core_auth.py
Python
mit
4,847
#!/usr/bin/env python ''' 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")...
sekikn/ambari
ambari-server/src/main/python/ambari_server/userInput.py
Python
apache-2.0
5,936
# # Copyright (c) 2015, Arista Networks, Inc. # 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, # this list of condit...
aristanetworks/ServiceNowRac
ServiceNowRac/__init__.py
Python
bsd-3-clause
1,627
#pylint: disable=invalid-name """ Base class for instrument-specific user interface """ from __future__ import (absolute_import, division, print_function) import six from PyQt4 import QtGui import sys import os import traceback from reduction_gui.reduction.scripter import BaseReductionScripter if six.PY3: unic...
dymkowsk/mantid
scripts/Interface/reduction_gui/instruments/interface.py
Python
gpl-3.0
11,491
from .pymc import PyMC3Model __all__ = ["PyMC3Model"]
bambinos/bambi
bambi/backend/__init__.py
Python
mit
55
#! /usr/bin/env python #coding=utf-8 from flask import Flask, request, render_template import hashlib,random,os.path app = Flask(__name__) app.debug = True#for debug app.config['UPLOADED_FILES_DEST'] = './static/uploads' app.config['UPLOADED_FILES_URL'] = '/static/uploads/'#need trailing slash #upload set from flask...
shuxiang/flask-sample
flask_upload.py
Python
mit
1,499
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import vms.models.fields import django.db.models.deletion from django.conf import settings import vms.models.base import taggit.managers class Migration(migrations.Migration): dependencies = [ ('gui'...
erigones/esdc-ce
vms/migrations/0001_initial.py
Python
apache-2.0
36,003
#!/usr/bin/env python # # Copyright 2012 Jun Kikuchi # import webapp2 from webapp2_extras import json from webapp2_extras import jinja2 from google.appengine.ext import ndb from google.appengine.api import channel import logging class Client(ndb.Model): def send_message(self, message): try: client_id = se...
JunKikuchi/AppEngineChannel
AppEngineChannelServerExample/main.py
Python
mit
2,324
#!/usr/bin/env python import sys import json from pprint import pprint PRECISION = 8 def load_json(input_file): """ Convert a JSON file to a json.load(open(input_file)) object """ return json.load(open(input_file)) def get_location(task, precision=PRECISION): """ Get a task's location...
SkyTruth/CrowdProjects
bin/DEPRECATED/checkTaskRuns.py
Python
bsd-3-clause
14,766
"""Logging """ import sys import os import logging from pip._vendor import colorama, pkg_resources from pip.compat import WINDOWS def _color_wrap(*colors): def wrapped(inp): return "".join(list(colors) + [inp, colorama.Style.RESET_ALL]) return wrapped def should_color(consumer, environ, std=(sys.s...
1stvamp/pip
pip/log.py
Python
mit
10,187
#!/usr/bin/env python import dbus, gobject, avahi from dbus import DBusException from dbus.mainloop.glib import DBusGMainLoop # Looks for streamdev-servers TYPE = '_vdr_streamdev_server._sub._http._tcp' def service_resolved(*args): print 'service resolved' print 'name:', args[2] print 'address:', args[7]...
flensrocker/vdr-plugin-avahi4vdr
examples/streamdev-client-autoconfig.py
Python
gpl-2.0
1,568
""" Copyright 2016 Author: Elke Schaechtele <elke.schaechtele@web.de> This is a module intended to be used as client to Freesound's API see http://www.freesound.org/docs/api/ Note: You need your own client secret to work with the API. You can request one at http://www.freesound.org/apiv2. The doctest will not work u...
ESchae/SimilarSoundSearch
Evaluation/D1/freesound_utils.py
Python
mit
29,652
#Author Tim Anderton #Created Feb 2012 """A module for representing and fitting piecewise polynomial functions with and without regularity constraints. """ import numpy as np lna = np.linalg poly1d = np.poly1d import matplotlib.pyplot as plt #Legendre = np.polynomial.legendre.Legendre class Centered_Scaled_Polynomi...
quidditymaster/piecewise_polynomial
piecewise_polynomial.py
Python
apache-2.0
17,338
""" Test script. Run sketching with L1 penalization on a 1D signal. """ import numpy as np import matplotlib.pyplot as plt import Sketching as sketch # Parameters. LENGTH = 1000 K = 100 ALPHA = 10.0 # Generate a random 1D signal. signal = np.random.randn(LENGTH) # Obtain Fourier basis. basis, coefficients = sketch....
dfridovi/compressed_sensing
src/python/test_basis_sketching_1D.py
Python
gpl-2.0
568