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 |
|---|---|---|---|---|---|
from __future__ import absolute_import
from copy import deepcopy
from datetime import datetime
from django.core.exceptions import MultipleObjectsReturned
from django.test import TestCase
from django.utils.translation import ugettext_lazy
from .models import Article, Reporter
class ManyToOneTests(TestCase):
def... | rebost/django | tests/modeltests/many_to_one/tests.py | Python | bsd-3-clause | 20,874 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | tedi3231/openerp | openerp/addons/mail/wizard/invite.py | Python | agpl-3.0 | 4,210 |
# -*- coding: utf-8 -*-
import copy
from ruamel.yaml import YAML
from six import iteritems
_required = ['server']
class Config(object):
def __init__(self, configFile):
self.configFile = configFile
self._configData = {}
self.yaml = YAML()
self._inBaseConfig = []
def loadConf... | MatthewCox/PyMoronBot | pymoronbot/config.py | Python | mit | 4,668 |
import sublime, sublime_plugin
import os
class print_file(sublime_plugin.TextCommand):
def run(self, edit):
os.system('cat -n "%s" > tmp.print; lpr tmp.print' % self.view.file_name())
self.view.show_popup("JIZZ!!")
| NCTU-PCCA/NCTU_Yggdrasill | codebook/ToBeClassify/print_file.py | Python | mit | 221 |
### Attribute IDS
CONTROLLER = 500
RULES = 1000
IS_PREMADE_GAME = 1001
PARTIES_PRIVATE = 2000
PARTIES_PREMADE = 2001
PARTIES_PREMADE_1V1 = 2002
PARTIES_PREMADE_2V2 = 2003
PARTIES_PREMADE_3V3 = 2004
PARTIES_PREMADE_4V4 = 2005
PARTIES_PREMADE_FFA = 2006
PARTIES_PREMADE_5V5 = 2007
PARTIES_PREMADE_6V6 = 2008
PARTIES_PRIVAT... | Blizzard/s2protocol | s2protocol/attributes.py | Python | mit | 1,472 |
"""
Wrapper for pcpe_core external module.
"""
from pypcpe2 import utility
import pcpe2_core
def compare_small_seqs(x_seq_path, y_seq_path):
"""
Wrapper for pcpe2_core.compare_small_seqs.
Users should not call the orignal function directly.
"""
return pcpe2_core.compare_small_seqs(x_seq_path, y_... | yen3/pypcpe2 | pypcpe2/core.py | Python | bsd-3-clause | 1,407 |
# RandTalkBot Bot matching you with a random person on Telegram.
# Copyright (C) 2016 quasiyoke
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
from unittest.mock import create_autospec
import asynctest... | quasiyoke/RandTalkBot | tests/test_stranger.py | Python | agpl-3.0 | 58,086 |
# -*- coding: utf-8 -*-
# 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
# ... | Fokko/incubator-airflow | tests/contrib/operators/test_sagemaker_base_operator.py | Python | apache-2.0 | 1,886 |
# Copyright David Abrahams 2004. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
'''
>>> from bienstman5_ext import *
>>> m = M(1j)
'''
def run(args = None):
import sys
import doctest
if args is not None:... | satya-das/common | third_party/boost_tp/libs/python/test/bienstman5.py | Python | mit | 550 |
from CatalogSurfaceItem import *
FTTextureName = 0
FTColor = 1
FTBasePrice = 2
FlooringTypes = {1000: ('phase_5.5/maps/floor_wood_neutral.jpg', CTBasicWoodColorOnWhite, 150),
1010: ('phase_5.5/maps/flooring_carpetA_neutral.jpg', CTFlatColorDark, 150),
1020: ('phase_4/maps/flooring_tile_neutral.jpg', CTFlatColorDark, ... | ksmit799/Toontown-Source | toontown/catalog/CatalogFlooringItem.py | Python | mit | 6,140 |
from proteus import *
from proteus.default_n import *
from la_gauss_2d_p import *
timeOrder = 1
nStagesTime = timeOrder
runCFL = 0.45
DT = None
nDTout = 10
#BackwardEuler, ForwardEuler
timeIntegration = LinearSSPRKintegration
stepController=Min_dt_RKcontroller
femSpaces = {0:DG_Constants}
# elementQuadrature = Simp... | erdc/proteus | proteus/tests/dg/la_gauss_2d_dgp0_n.py | Python | mit | 997 |
def merge_sort(unsorted):
if len(unsorted) <= 1:
return unsorted
left, right = [], []
midi = len(unsorted) / 2
for elem in unsorted[:midi]:
left.append(elem)
for elem in unsorted[midi:]:
right.append(elem)
left = merge_sort(left)
right = merge_sort(right)
return m... | markcharyk/data-structures | data_structures/merge_sort.py | Python | mit | 1,259 |
{
"uidPageLogin": {
W3Const.w3PropType: W3Const.w3TypePanel,
W3Const.w3PropSubUI: [
"uidLoginTable"
]
},
"uidLoginTable": {
W3Const.w3PropType: W3Const.w3TypeTable,
W3Const.w3PropSubUI: [
[], # No header
["uidUsernameLabel", "uidUs... | eddiedb6/ej | web/metadata/EJUILoginPage.py | Python | mit | 875 |
"""@author Sebastien E. Bourban
"""
"""@note ... this work is based on a collaborative effort between
.________. ,--.
| | . ( (
|,-. / HR Wallingford EDF - LNHE / \_... | ArteliaTelemac/PostTelemac | PostTelemac/meshlayerparsers/libs_telemac/utilstelemac/partitioning.py | Python | gpl-3.0 | 47,115 |
#!/usr/bin/env python
#Copyright 2013 Mitchell Jon Stanton-Cook Licensed under the
#Educational Community 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.osedu.org/licenses/ECL-2.0
#
##Unless required by app... | mscook/rQer | rQer.py | Python | apache-2.0 | 3,743 |
##############################################################################
# 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... | tmerrick1/spack | var/spack/repos/builtin/packages/cuda/package.py | Python | lgpl-2.1 | 3,901 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import re
def multiple_split(_str, splits):
res = [_str]
for sp in splits:
tmp = []
# Why?
list(map(lambda x: tmp.extend(x.split(sp)), res))
res = tmp
return [x for x in ... | quietcoolwu/python-playground | imooc/python_advanced/4_1_multiple_split.py | Python | mit | 486 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# 2015-04-30T10:25+08:00
print(type(Ellipsis))
print(type(NotImplemented))
# memoryview is a built-in class.
v = memoryview(b'abcde')
print(v[0])
#v[0] -= 32 # Read only memory.
print(v)
b = bytes(v[1:4])
print(b)
| myd7349/DiveIntoPython3Practices | chapter_17_PortingCodeToPython3With2to3/types.py | Python | lgpl-3.0 | 265 |
# -*- coding: utf-8 -*-
import re
from twisted.web.http import BAD_REQUEST
from helper.database import DatabaseHelper
from helper.resource import YuzukiResource
from helper.template import render_template
from model.group import Group
from model.user import User
class Register(YuzukiResource):
def __init__(self... | Perlmint/Yuzuki | resource/register.py | Python | mit | 3,820 |
'''@author: lockrecv@gmail.com'''
import unittest
from src.util.PowerOn import PowerOn
class Test(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testName(self):
poweron = PowerOn("../../src/config/power-on.json")
poweron.toString()
if __name... | ylcrow/poweron | test/util/PowerOnTest.py | Python | mit | 406 |
from libsaas import http, parsers
from libsaas.services import base
from . import resource
class SubscriptionsBase(resource.RecurlyResource):
path = 'subscriptions'
def delete(self, *args, **kwargs):
raise base.MethodNotSupported()
class Subscriptions(SubscriptionsBase):
@base.apimethod
... | ducksboard/libsaas | libsaas/services/recurly/subscriptions.py | Python | mit | 2,990 |
#!/usr/bin/env python
# coding:utf-8
import errno
import time
import struct
import zlib
import functools
import re
import io
import string
import socket
import ssl
import httplib
import Queue
import urlparse
import threading
from proxy import xlog
from connect_manager import https_manager
from appids_manager import ... | hexlism/xx_net | gae_proxy/local/gae_handler.py | Python | bsd-2-clause | 28,513 |
# -*- coding: utf-8 -*-
from Products.CMFPlone.utils import safe_unicode
from zope.i18nmessageid import MessageFactory
import gettext
import pycountry
import unicodedata
message_factory = MessageFactory('bda.plone.orders')
def safe_encode(string):
"""Safely unicode objects to UTF-8. If it's a binary string, jus... | andreesg/bda.plone.orders | src/bda/plone/orders/__init__.py | Python | bsd-3-clause | 1,313 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 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.... | linvictor88/vse-lbaas-driver | quantum/scheduler/dhcp_agent_scheduler.py | Python | apache-2.0 | 5,180 |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | cmouse/buildbot | master/buildbot/test/unit/worker/test_protocols_base.py | Python | gpl-2.0 | 2,377 |
import operator
import os
from checksum import calc_checksum
import progress
__author__ = 'snorri.sturluson'
def verify_cache(index, res_folder):
num_files = len(index)
missing = 0
corrupt = 0
scanned = 0
for entry in index:
scanned += 1
progress.write("Scanned %6.1d of %6.1d fil... | evem8/rescache | verify.py | Python | mit | 979 |
# -*- coding: utf-8 -*-
"""
Helper functions used in views.
"""
from __future__ import division
import calendar
import csv
from datetime import datetime
from functools import wraps
from json import dumps
from threading import Lock
from time import time
from xml.etree import ElementTree
from flask import Response
fr... | djallberto/presence-analyzer-anowak | src/presence_analyzer/utils.py | Python | mit | 7,408 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
OTBUtils.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
(C) 2013 by CS Systemes d'information (CS SI)
Email... | luofei98/qgis | python/plugins/processing/algs/otb/OTBUtils.py | Python | gpl-2.0 | 9,300 |
from __future__ import print_function
import argparse
import json
import logging
import os
import re
import sys
import wdl.parser
from jinja2 import Environment, FileSystemLoader
__version__ = '0.2'
handlers = {}
# set up logging
logger = logging.getLogger('Main')
logger.setLevel(logging.INFO)
ch = logging.StreamH... | common-workflow-language/wdl2cwl | wdl2cwl/main.py | Python | apache-2.0 | 25,014 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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... | ramineni/myironic | ironic/tests/drivers/third_party_driver_mocks.py | Python | apache-2.0 | 6,947 |
from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from vi... | wegtam/weather-api | view/views.py | Python | bsd-3-clause | 3,212 |
import mxnet as mx
import numpy as np
from operator_py.nms import py_nms_wrapper
def multiclass_nms(nms, cls_score, bbox_xyxy, min_det_score, max_det_per_image):
# remove background
cls_score = cls_score[:, 1:]
# TODO: the output shape of class_agnostic box is [n, 4], while class_aware box is [n, 4 * (1 +... | TuSimple/simpledet | models/maskrcnn/bbox_post_processing.py | Python | apache-2.0 | 4,679 |
from django.conf import settings
CLIENT_ID = getattr(settings, 'EXACT_TARGET_CLIENT_ID', '')
CLIENT_SECRET = getattr(settings, 'EXACT_TARGET_CLIENT_SECRET', '')
WSDL_URL = getattr(settings, 'EXACT_TARGET_WSDL_URL', '')
| roverdotcom/django-fuelsdk | django_fuelsdk/constants.py | Python | mit | 221 |
from django.conf.urls import *
urlpatterns = patterns('django_braintree.views',
url(r'^payments-billing/$', 'payments_billing', name='payments_billing'),
)
| Tivix/django-braintree | django_braintree/urls.py | Python | mit | 162 |
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from .models import Post
class LatestEntriesFeed(Feed):
title = "Transverbis blog"
link = "/"
description = "Transverbis updates"
def items(self):
return Post.objects.filter(published_date__isnull=F... | filipok/django-transverbis-blog | djtransverbisblog/feeds.py | Python | mit | 643 |
import os
import tornado
from tornado.websocket import WebSocketHandler
from tornado.web import RequestHandler, StaticFileHandler, Application, url
from tornado.escape import json_encode, json_decode
from tornado import ioloop
from rx.subjects import Subject
UP, DOWN, LEFT, RIGHT, B, A = 38, 40, 37, 39, 66, 65
codes... | dbrattli/RxPY | examples/konamicode/konamicode.py | Python | apache-2.0 | 1,905 |
import numpy as np
import scipy.ndimage
import tensorflow as tf
from homer.page import Page
from homer import util
MAX_SIZE = 4096
def get_rotated_page(page):
angle, square_img = get_angle(page)
rotated, = tf.py_func(_rotate_image, [page.image, -angle], [square_img.dtype])
rotated.set_shape(page.image.get_shape... | ringw/MetaOMR | homer/rotate.py | Python | gpl-3.0 | 2,288 |
"""In the pollster approach we no longer see Postalcodes as a separate field
These files are kept for backwards compatability"""
import datetime
import re
from django import forms
from django.utils.safestring import mark_safe
from django.conf import settings
from localflavor.it.forms import ITZipCodeField
from localf... | hrpt-se/hrpt | apps/survey/forms/fields.py | Python | agpl-3.0 | 6,667 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from conte... | sid-kap/pants | tests/python/pants_test/backend/jvm/tasks/test_jvm_platform_analysis_integration.py | Python | apache-2.0 | 5,205 |
import copy
import operator
import numbers
import numpy as np
from .op_base import OpBase, OpBase, OpBase, OpBase
__all__ = ['add', 'sub', 'mul', 'truediv', 'neg', 'pow', 'sum']
class add(OpBase):
def __init__(self, a, b):
OpBase.__init__(self, operator.add, (a, b), name="add")
class sub(OpBase):
d... | qiqi/fds | pascal_lite/operators/arithmetics.py | Python | gpl-3.0 | 1,062 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | Petr-Kovalev/nupic-win32 | tests/integration/py2/nupic/swarming/experiments/dummyV2/description.py | Python | gpl-3.0 | 15,546 |
'''
Simple script to interact with fusion level 02 challenge network daemon,
mkocbayi@gmail.com
'''
from pwn import *
import sys
def doMode(mode): # Either E or Q
print 'Sending mode call: {}'.format(mode)
#Specify encryption function
io.send(mode)
def doEncryption(message, fake_message_size=None):
... | muttiopenbts/fusion | fusion_level02_0.py | Python | gpl-3.0 | 1,689 |
# -*- coding: utf-8 -*-
# Django settings
import os.path
from django.template.defaultfilters import slugify
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# serve media through the staticfiles app.
SERVE_MEDIA = DEBUG
INTERNAL_IPS = [
"127.0.0.1"... | audreyr/opencomparison | settings/base.py | Python | mit | 7,994 |
class BaiduSearch(object):
def __init__(self):
pass
def __call__(self, client, api, **kw):
"""
client --
client
api --
"""
client.driver.get("http://www.baidu.com")
input = client.e("#kw")
input.cle... | emop/webrobot | hello_baidu/libs/actions.py | Python | gpl-2.0 | 725 |
#!/usr/bin/python2
# otl2tags.py
# Convert an OTL file to any tags-based file using config user-
# definable configuration files. HTML, OPML, XML, LATEX and
# many, many others should be easily supportables.
#
# Copyright (c) 2005-2010 Noel Henson All rights reserved
###################################################... | Kriegslustig/dotfiles | .vim/vimoutliner/scripts/otl2tags.py | Python | unlicense | 20,128 |
#!/usr/bin/env python
import random
from IPython.display import Image, HTML, display
import webbrowser
def showStudents(groups):
# make student pictures display in their groups in an IPython notebook
# NB: requires that image file names are the same as student names in the input list
photoDir = './photod... | lmwalkowicz/StudentGroupGenerator | student_group_creator.py | Python | mit | 5,414 |
# STAB: subglacial till advection and bedforms
# Thomas E. Barchyn - University of Calgary, Calgary, AB, Canada
# Copyright 2014-2016 Thomas E. Barchyn
# Contact: Thomas E. Barchyn [tbarchyn@gmail.com]
# This project was developed with input from Thomas P.F. Dowling,
# Chris R. Stokes, and Chris H. Hugenholtz. We wou... | tbarchyn/STAB_1.0 | operations/control_panel.py | Python | gpl-3.0 | 9,285 |
"""
Palindrome REST Web Service
Copyright (C) 2015 Pierre Jodouin
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 lat... | pjodouin/palindrome | rest/views.py | Python | gpl-2.0 | 4,201 |
#!/usr/bin/python
import sys
from week1 import PatternCount
from week1 import FrequentWords
from week1 import ReverseComplement
from week1 import PatternMatching
from week1 import ComputingFrequencies
from week1 import PatternToNumber, NumberToPattern
from week1 import ClumpFinding, BetterClumpFinding
def main():
... | abhyasi/coursera | bioinformatics_i/week1/week1_client.py | Python | mit | 1,853 |
#!/usr/bin/env python
# Copyright 2014 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 c... | damienmg/bazel | third_party/py/gflags/gflags/_helpers_test.py | Python | apache-2.0 | 6,904 |
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Defines operators used in SQL expressions."""
from operator import and_, or_, inv, add, mul, sub, div, mod, truediv, \
lt, le, ne, gt, ge, eq
from sqlalchemy.util import Set, symbol
... | chirpradio/chirpradio-volunteers | site-packages/sqlalchemy/sql/operators.py | Python | mit | 2,286 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.utils.testing import AutoTeacherTest
class TestDefaultTeacher(AutoTeacherTest):
task = "hotpotqa"
cl... | facebookresearch/ParlAI | parlai/tasks/hotpotqa/test.py | Python | mit | 474 |
"""
"""
import widget
class Form(widget.Widget):
"""A form that automatically will contain all named widgets.
After a form is created, all named widget that are subsequently created are
added to that form. You may use dict style access to access named widgets.
Example:
f = gui.Form... | bendmorris/jython-pgu | pgu/gui/form.py | Python | lgpl-2.1 | 2,629 |
# Copyright 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.
import unittest
from dashboard import email_template
class EmailTemplateTest(unittest.TestCase):
def testURLEncoding(self):
actual_output = email_t... | modulexcite/catapult | dashboard/dashboard/email_template_test.py | Python | bsd-3-clause | 1,132 |
# -*- coding: utf-8 -*-
# Copyright 2014 Jean-Francois Paris
#
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version.
... | jfparis/ZopaClient | zopaclient/__init__.py | Python | lgpl-3.0 | 811 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from shrls import app
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
| demophoon/shrls | app.py | Python | mit | 137 |
'''
author : "George Profenza"
url : ("disturb", "disturbmedia.com/blog","My blog, http://tomaterial.blogspot.com")
Export meshes the three.js 3D Engine by mr.doob's et al.
More details on the engine here:
https://github.com/mrdoob/three.js
Currently supports UVs. If the model doesn't display correctly
you might ... | flyingoctopus/three.js | utils/exporters/cinema4d/export_to_three.js.py | Python | mit | 8,574 |
"""
Write a program that will help you play poker by telling you what kind of hand you have.
Input:
The first line of input contains the number of test cases (no more than 20). Each test case consists of one line - five
space separated cards. Each card is represented by a two-letter (or digit) word. The first characte... | DayGitH/Python-Challenges | DailyProgrammer/20120330B.py | Python | mit | 3,384 |
# Exercise 43: Basic Object-Oriented Analysis and Design
# Process to build something to evolve problems
# 1. Write or draw about the problem.
# 2. Extract key concepts from 1 and research them.
# 3. Create a class hierarchy and object map for the concepts.
# 4. Code the classes and a test to run them.
# 5. Repeat and... | Valka7a/python-playground | python-the-hard-way/43-basic-object-oriented-analysis-and-design.py | Python | mit | 13,790 |
#!/usr/bin/python
#
# Copyright (C) 2012 Michael Spreitzenbarth, Sven Schmitt
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... | draekko/ADEL | _getEXIF.py | Python | gpl-3.0 | 3,136 |
"""Get a clinical report, either with extended information or not.
Example usages:
python get_clinical_report.py 1801
python get_clinical_report.py 1801 --e true
"""
import os
import requests
from requests.auth import HTTPBasicAuth
import sys
import simplejson as json
import argparse
# Load environment variables fo... | Omicia/omicia_api_examples | python/ClinicalReportLaunchers/get_clinical_report.py | Python | mit | 1,764 |
# RUN: %python -m artiq.compiler.testbench.jit %s >%t
# RUN: OutputCheck %s --file-to-check=%t
def f():
delay_mu(2)
def g():
with interleave:
f()
delay_mu(2)
print(now_mu())
# CHECK-L: 2
g()
| JQIamo/artiq | artiq/test/lit/interleaving/pure_impure_tie.py | Python | lgpl-3.0 | 222 |
# coding: utf-8
from ..security import passwd, passwd_check, salt_len
import nose.tools as nt
def test_passwd_structure():
p = passwd('passphrase')
algorithm, salt, hashed = p.split(':')
nt.assert_equal(algorithm, 'sha1')
nt.assert_equal(len(salt), salt_len)
nt.assert_equal(len(hashed), 40)
def te... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/notebook/auth/tests/test_security.py | Python | bsd-2-clause | 801 |
import timeit
import sys
import numpy as np
from Lab1 import *
fin = open(sys.argv[1])
sizes = [int(i) for i in fin.readline().split()]
runs = int(fin.readline())
RANGE = 1000000 # Max size of an element (+ or -)
ITERATIONS = 100
functions = ['numpy', 'multIter', 'multDCWrapper', 'strassenWrapper'] ... | Ardustorm/csc349 | lab1/Lab1Test.py | Python | gpl-3.0 | 1,413 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('p311', '0003_auto_20150323_1217'),
]
operations = [
migrations.RenameField(
model_name='commoninfo',
... | max1k/cbs | p311/migrations/0004_auto_20150325_1306.py | Python | gpl-2.0 | 781 |
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
#
# 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 late... | atsaki/ansible | lib/ansible/module_utils/ios.py | Python | gpl-3.0 | 5,894 |
"""Test the Vultr binary sensor platform."""
import pytest
import voluptuous as vol
from homeassistant.components import vultr as base_vultr
from homeassistant.components.vultr import (
ATTR_ALLOWED_BANDWIDTH,
ATTR_AUTO_BACKUPS,
ATTR_COST_PER_MONTH,
ATTR_CREATED_AT,
ATTR_IPV4_ADDRESS,
ATTR_SUBS... | rohitranjan1991/home-assistant | tests/components/vultr/test_binary_sensor.py | Python | mit | 3,539 |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Provide a class for collecting info on one builder run.
There are two public classes, BuilderRun and ChildBuilderRun, that serve
this function. T... | chadversary/chromiumos.chromite | cbuildbot/cbuildbot_run.py | Python | bsd-3-clause | 32,661 |
"""
*Scratch_n_sketch scripting
* Matrix demo
"""
from libs.board import *
#init
mbd = scratch_n_sketch()
#connect board
mbd.connect()
#start
print('Draw circles demo')
#initialize
mbd.backGroundColor(0, 0, 0)
#rotate by 90 deg
mbd.rotateDisplay(mbd.rotate_90)
wait(5)
#variables
xloc = 20
yloc = 10
#start loop
for x in... | warefab/scratch-n-sketch | python/circles.py | Python | mit | 688 |
import os
import stat
from datetime import datetime
from ._compat import open_stream, text_type, filename_to_ui, \
get_filesystem_encoding, get_streerror, _get_argv_encoding, PY2
from .exceptions import BadParameter
from .utils import safecall, LazyFile
class ParamType(object):
"""Helper for converting value... | astaninger/speakout | venv/lib/python3.6/site-packages/click/types.py | Python | mit | 23,287 |
from handlers.handler import Handler
_HIGHWAY_ROAD_TAGS = {'road', 'track', 'living_street', 'service', 'unclassified', 'residential', 'tertiary',
'tertiary_link', 'secondary', 'secondary_link', 'primary', 'primary_link', 'trunk', 'trunk_link',
'motorway', 'motorway_link'}
... | n0s0r0g/perfect_OSM | handlers/checkers/highway/traffic_signals.py | Python | mit | 1,565 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="Tornado-MySQL",
version="0.5.1",
url='https://github.com/PyMySQL/Tornado-MySQL',
author='INADA Naoki',
author_email='songofacandy@gmail.com',
description='Pure Python MySQL Driver for Tornado',
install_requires=[... | PyMySQL/Tornado-MySQL | setup.py | Python | mit | 1,007 |
class _TemplateMetaclass(type):
def __init__(cls, name, bases, dct):
super(_TemplateMetaclass, cls).__init__(name, bases, dct)
| moagstar/python-uncompyle6 | test/simple_source/def/11_classbug.py | Python | mit | 139 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2014-2020)
#
# This file is part of GWpy.
#
# GWpy 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)... | areeda/gwpy | gwpy/io/__init__.py | Python | gpl-3.0 | 831 |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... | Nikea/VisTrails | vistrails/packages/persistence/repo.py | Python | bsd-3-clause | 10,278 |
# This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
from Helpers import show
# Create a simple block with a hole through it that we can split
c = cadquery.Workplane("XY").box(1, 1, 1).faces(">Z").workplane() \
.circle(0.25).cutThruAll()
# Cut the ... | microelly2/cadquery-freecad-module | CadQuery/Examples/Ex021_Splitting_an_Object.py | Python | lgpl-3.0 | 435 |
import time
from sleekxmpp.test import *
class TestStreamPresence(SleekTest):
"""
Test handling roster updates.
"""
def tearDown(self):
self.stream_close()
def testInitialUnavailablePresences(self):
"""
Test receiving unavailable presences from JIDs that
are not o... | skinkie/SleekXMPP--XEP-0080- | tests/test_stream_presence.py | Python | mit | 5,606 |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | Thingee/cinder | cinder/keymgr/conf_key_mgr.py | Python | apache-2.0 | 4,809 |
# --- Day 13: Knights of the Dinner Table ---
#
# In years past, the holiday feast with your family hasn't gone so well. Not everyone gets along! This year, you
# resolve, will be different. You're going to find the optimal seating arrangement and avoid all those awkward
# conversations.
#
# You start by writing up a l... | hubbardgary/AdventOfCode | day13.py | Python | mit | 4,282 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012 Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: debug
short_... | j-carl/ansible | lib/ansible/modules/debug.py | Python | gpl-3.0 | 2,427 |
import libtcodpy as libtcod
import consts
def find_closest_target(caster, entities, range):
closest_target = None
closest_dist = range + 1
for obj in entities:
if obj.fighter and obj != caster:
dist = caster.distance_to(obj)
if dist < closest_dist:
closest_... | MykeMcG/SummerRoguelike | src/utils.py | Python | gpl-3.0 | 2,363 |
"""
Script to generate "labelled" data using random playouts
A lot of this can now be done with the RunExperiment scene
"""
from models.game import *
from models.data import DatabaseConnection as DB, GameDataModel
import timeit
def full_game_experiment(total_games, purge=10):
"""
Simulates many random... | zachdj/ultimate-tic-tac-toe | generate_data.py | Python | mit | 4,760 |
from socket import inet_ntoa
from struct import pack
def calcDottedNetmask(mask):
bits = 0
for i in xrange(32 - mask, 32):
bits |= (1 << i)
packed_value = pack('!I', bits)
addr = inet_ntoa(packed_value)
return addr
| openbmc/openbmc-test-automation | lib/pythonutil.py | Python | apache-2.0 | 245 |
"""Support for WiLight lights."""
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from . import WiLightDevice
from .const... | tchellomello/home-assistant | homeassistant/components/wilight/light.py | Python | apache-2.0 | 5,891 |
# -*- coding: utf-8 -*-
import re
PORT = 443
class XcodeServer(object):
def __init__(self, host=None, port=PORT):
self.host = host
self.port = port
self.validate()
def validate(self):
if not self.host:
return
if not self.url_validate():
rais... | oarrabi/xserverpy | xserverpy/lib/xcode_server.py | Python | bsd-3-clause | 1,086 |
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
# xierpa server
# Copyright (c) 2014+ buro@petr.com, www.petr.com, www.xierpa.com
#
# X I E R P A 3
# Distribution by the MIT License.
#
# ---------------------------------------------------------------... | petrvanblokland/Xierpa3 | xierpa3/server/twistedmatrix/twistedclient.py | Python | mit | 972 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
# DA... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/conf/locale/bg/formats.py | Python | gpl-2.0 | 772 |
#!/usr/bin/env python2
#!/Applications/anaconda/envs/root3 python
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 1 13:50:04 2016
@author: mschull
"""
#python
from .search import Search
import os
import subprocess
import glob
import shutil
import pandas as pd
import datetime
import argparse
import getpass
import keyr... | bucricket/projectMASpreprocess | preparepydisalexi/processLandsatLAI.py | Python | bsd-3-clause | 14,392 |
import numpy as np
import fdasrsf as fs
from scipy.integrate import cumtrapz
from scipy.linalg import norm, expm
import h5py
fun = h5py.File('/home/dtucker/fdasrsf/debug_data_oc_mlogit.h5')
q = fun['q'][:]
y = fun['y'][:]
alpha = fun['alpha'][:]
nu = fun['nu'][:]
max_itr = 8000 # 4000
tol = 1e-4
deltag = .05
deltaO ... | glemaitre/fdasrsf | debug/debug_warp_ocmlogistic.py | Python | gpl-3.0 | 3,202 |
#!/usr/bin/env python
import fnmatch
import os
from pathlib import Path
import re
import shlex
import shutil
import subprocess
import sys
import tempfile
import time
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
from typing import Optional
import click
import git
import typer
... | DIRACGrid/DIRAC | integration_tests.py | Python | gpl-3.0 | 24,355 |
# Copyright 2013 Viewfinder Inc. All Rights Reserved.
"""Handlers for database administration.
MetricsHandler: main handler for detailed metrics. We don't use ajax-y tables, so there is no data handler.
"""
from tornado.escape import url_escape
__author__ = 'marc@emailscrubbed.com (Marc Berhault)'
import base64
i... | 0359xiaodong/viewfinder | backend/www/admin/metrics.py | Python | apache-2.0 | 4,540 |
import traceback
import os
import wx
from wx.lib.embeddedimage import PyEmbeddedImage
try:
import wx.lib.agw.customtreectrl as customtreectrl
except ImportError:
import wx.lib.customtreectrl as customtreectrl
#####################################################################################################
# Fix... | onoga/toolib | toolib/wx/controls/CustomTreeCtrl.py | Python | gpl-2.0 | 10,497 |
"""
Demo light platform that implements lights.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
import asyncio
import random
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT,
ATTR_RGB_COLOR, ATTR_W... | Duoxilian/home-assistant | homeassistant/components/light/demo.py | Python | mit | 5,101 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | gregdek/ansible | lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py | Python | gpl-3.0 | 25,478 |
# coding=utf-8
from __future__ import absolute_import
import gevent
from gevent.pywsgi import WSGIHandler
import sys
from webob import Request
from .response import Response
from .socket import Socket
from ..event_emitter import EventEmitter
from .transports import WebsocketTransport
import logging
logger = logging.g... | shuoli84/gevent_socketio2 | socketio/engine/handler.py | Python | mit | 5,977 |
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy import Column, Integer, String, ForeignKey, Text, Float
from sqlalchemy.orm import relationship, backref
from partsdb.system.Tables import Base, BaseMixIn, PartMixIn, ExonMixIn, AnnotationMixIn
from partsdb.tools.Annotators import BlastAnnotator, Tabl... | HaseloffLab/MarpoDB | server/tables.py | Python | mit | 2,195 |
"""Tests for letsencrypt.renewer."""
import datetime
import os
import tempfile
import shutil
import unittest
import configobj
import mock
import pytz
from letsencrypt import configuration
from letsencrypt import errors
from letsencrypt.storage import ALL_FOUR
from letsencrypt.tests import test_util
CERT = test_uti... | hlieberman/letsencrypt | letsencrypt/tests/renewer_test.py | Python | apache-2.0 | 33,095 |
#!/usr/bin/python
# coding: UTF-8
# Driver for HD44780 LCD display on the RPi
# Written by: Ron Ritchey
# Derived from Lardconcepts
# https://gist.github.com/lardconcepts/4947360
# Which was also drived from Adafruit
# http://forums.adafruit.com/viewtopic.php?f=8&t=29207&start=15#p163445
#
# Useful references
# Genera... | dhrone/pydKeg | displays/hd44780.py | Python | mit | 11,500 |
from __future__ import with_statement
from sympy.matrices.expressions.blockmatrix import (block_collapse, bc_matmul,
bc_block_plus_ident, BlockDiagMatrix, BlockMatrix, bc_dist, bc_matadd,
bc_transpose, blockcut, reblock_2x2, deblock)
from sympy.matrices.expressions import (MatrixSymbol, Identity, MatMul... | lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/matrices/expressions/tests/test_blockmatrix.py | Python | gpl-3.0 | 6,848 |
#!/usr/bin/python3
from PIL import Image, ImageDraw
import glob
import os
def calc_color_conversion( im, src, dest ) :
'''
for each color in src, match the closest color in dest.
src = (u, v) where u and v are color, given in palette index.
dest = (p, q). Same as src.
'''
pal = im.getpalette()... | forcecore/yupgi_alert0 | assets/shp/sant/make.py | Python | gpl-3.0 | 5,762 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.