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
from __future__ import print_function
# For detailed comments on animation and the techniques used here, see
# the wiki entry
# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
import time
import gtk, gobject
import matplotlib
matplotlib.use('GTKAgg')
import numpy as np
import ... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/animation/old_animation/animation_blit_gtk.py | Python | mit | 1,587 |
# ------------------------------------------------------------------------
#
# 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 requi... | dusenberrymw/deep-histopath | deephistopath/wsi/filter.py | Python | apache-2.0 | 50,620 |
import time
import six
from . import packet
from . import payload
class Socket(object):
"""An Engine.IO socket."""
upgrade_protocols = ['websocket']
def __init__(self, server, sid):
self.server = server
self.sid = sid
self.queue = self.create_queue()
self.last_ping = time... | quoclieu/codebrew17-starving | env/lib/python3.5/site-packages/engineio/socket.py | Python | mit | 7,761 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | AnishShah/tensorflow | tensorflow/compiler/xla/python/xla_client.py | Python | apache-2.0 | 46,021 |
#! /usr/local/bin/python
"""FAQ wizard bootstrap."""
# This is a longer version of the bootstrap script given at the end of
# faqwin.py; it prints timing statistics at the end of the regular CGI
# script's output (so you can monitor how it is doing).
# This script should be placed in your cgi-bin directory and made
... | xbmc/xbmc-antiquated | xbmc/lib/libPython/Python/Tools/faqwiz/faqw.py | Python | gpl-2.0 | 1,137 |
# -*- coding: utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import savalidation.validators as val
from pprint import pprint
from datetime import datetime as dt, date as d
from app import db
from savalidation import ValidationMixin
from flask_sqlalchemy import S... | nerevu/prometheus-api | app/models/cronus.py | Python | mit | 9,335 |
import pymongo
def mongo_connect():
try:
connection = pymongo.MongoClient()
print "MongoDB is connected!"
return connection
except pymongo.errors.ConnectionFailure, e:
print "Could not connect to MongoDB: %s" % e
connection = mongo_connect()
db = connection['twitter_stream']
co... | GunnerJnr/_CodeInstitute | Stream-2/Back-End-Development/25.Introduction-To-MongoDB-Intro/2.Create-and-Access-a-MongoDB-Database/3.Add-A-Document-To-A-Database/mongo_connect.py | Python | mit | 588 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2,urllib,sys,time
import cookielib,mechanize
import re
DEBUG =0
reload(sys)
sys.setdefaultencoding('utf8') #@UndefinedVariable
register_openers()
headers = {
... | ptphp/PyLib | src/webpy1/webpy1.1/post/post_anju.py | Python | apache-2.0 | 4,425 |
import io
import random
import docker
from .base import BaseAPIIntegrationTest, TEST_IMG
import pytest
class TestRegressions(BaseAPIIntegrationTest):
def test_443_handle_nonchunked_response_in_stream(self):
dfile = io.BytesIO()
with pytest.raises(docker.errors.APIError) as exc:
for l... | vdemeester/docker-py | tests/integration/regression_test.py | Python | apache-2.0 | 2,167 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2017 Eugene Frolov <eugene@frolov.net.ru>
#
# 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
#
# ... | phantomii/restalchemy | restalchemy/storage/sql/utils.py | Python | apache-2.0 | 746 |
import unittest
try:
import base
except ImportError:
import tests.base as base
import inspect
import os
import sys
from preupg import preupg_diff
class TestPreupgDiff(base.TestCase):
current_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
class argv_mocked(list):
pass
c... | phracek/preupgrade-assistant | tests/test_preupg_diff.py | Python | gpl-3.0 | 2,465 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 PolyBeacon, 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 applica... | kickstandproject/python-payloadclient | payloadclient/shell/v1/agent.py | Python | apache-2.0 | 1,641 |
import csv
import datetime
import numbers
import os
import pkg_resources
import numpy as np
import pandas as pd
import scipy
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import LabelEncoder
from sklearn.ut... | ClimbsRocks/auto_ml | auto_ml/utils.py | Python | mit | 10,179 |
## This file is where you write your event handlers in Python.
## Define functions named like element_id__event(dom) e.g.
# btn_mybutton__click(dom):
# dom['txt_textbox']['value'] = "Button clicked."
# return dom
#
## You can delete this comment once you've read it.
| ContinuumIO/ashiba | ashiba/share/new_project_files/handlers.py | Python | bsd-3-clause | 277 |
import json
import threading
import time
import os
import stat
from . import util
from copy import deepcopy
from .util import user_dir, make_dir, print_error, PrintError
from .bitcoin import MAX_FEE_RATE, FEE_TARGETS
config = None
def get_config():
global config
return config
def set_config(c):
globa... | fyookball/electrum | lib/simple_config.py | Python | mit | 12,614 |
"""
Test the views served by third_party_auth.
"""
import ddt
from lxml import etree
from onelogin.saml2.errors import OneLogin_Saml2_Error
import unittest
from .testutil import AUTH_FEATURE_ENABLED, SAMLTestCase
# Define some XML namespaces:
from third_party_auth.tasks import SAML_XML_NS
XMLDSIG_XML_NS = 'http://www... | defance/edx-platform | common/djangoapps/third_party_auth/tests/test_views.py | Python | agpl-3.0 | 6,360 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# #Introduction to basic Python types and methods
#
# <markdowncell>
# Type each command in your interpreter exactly as I describe it. We're going to move very quickly here. Don't worry. We're going to repeat these ideas over and over in the other... | rnagle/pycar | takehome/PyCAR_basics.py | Python | mit | 6,413 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/apps/search/src/search/models.py | Python | gpl-2.0 | 33,395 |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php.
"""Test that the wallet resends transactions periodically."""
from collections import defaultdict
import ... | PIVX-Project/PIVX | test/functional/wallet_resendwallettransactions.py | Python | mit | 3,200 |
# -*- coding: utf-8 -*-
"""
extension
~~~~~~~~~
A directive to create a box warning that a certain bit of Psycopg is an
extension to the DBAPI 2.0.
:copyright: Copyright 2010 by Daniele Varrazzo.
"""
from docutils import nodes
from sphinx.locale import _
from sphinx.util.compat import Directive,... | kylelwm/ponus | venv/build/psycopg2/doc/src/tools/lib/dbapi_extension.py | Python | mit | 1,422 |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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 versi... | gemrb/gemrb | gemrb/GUIScripts/GUISONGS.py | Python | gpl-2.0 | 2,309 |
import argparse
from vee.cli import style
from vee.commands.main import command, argument
from vee.exceptions import AlreadyInstalled
from vee.packageset import PackageSet
from vee.requirements import Requirements
@command(
argument('--force', action='store_true', help='force install over old package'),
argu... | westernx/vee | vee/commands/install.py | Python | bsd-3-clause | 1,682 |
# -*- coding: utf-8 -*-
import os
import re
import bottle
import string
import inspect
from bottle import static_file, template, url, request
import dispatch
static_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + '/static'
bottle.TEMPLATE_PATH.insert(0, os.path.dirname(os.path.abs... | gotling/PyTach | pytach/web/web.py | Python | mit | 1,769 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import unittest
import sys
import os
import io
import datetime
import numpy as np
try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest
pardir = os.path.abspath(os.path.join(os.path.dirname(__fi... | tomnor/channelpack | tests/test_dbf.py | Python | gpl-3.0 | 11,253 |
import one_server
app = one_server.create_app('one_server.settings.DevConfig', env='dev')
#app.run(port=10000, debug=True)
| ufo22940268/one-server | run.py | Python | bsd-2-clause | 125 |
import os
import shlex
import subprocess
import tempfile
import unittest
class CoreUtilsTestCase(unittest.TestCase):
command = None
def get_process_output(self, cmd):
cmd = shlex.split('%s %s' % (self.command, cmd))
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
... | sepeth/go-coreutils | tests/__init__.py | Python | unlicense | 1,179 |
"""
Import the most commonly used features to save typing in interactive environments and scripts.
Basically, doing from kid_readout.interactive import * should get you up and running for most cases.
Feel free to add additional imports as you find them helpful.
"""
import logging
logger = logging.getLogger('kid_readout... | ColumbiaCMB/kid_readout | kid_readout/interactive.py | Python | bsd-2-clause | 1,638 |
#!/usr/bin/env python
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
import os
from os import path
import shutil
import io
import random
import plac
import re
import spacy.util
from spacy.syntax.util import Config
from spacy.gold import read_json_file
f... | banglakit/spaCy | bin/parser/train.py | Python | mit | 6,586 |
"""Models for SQLAlchemy.
This file contains the original models definitions before schema tracking was
implemented. It is used to test the schema migration logic.
"""
import json
from datetime import datetime
import logging
from sqlalchemy import (Boolean, Column, DateTime, ForeignKey, Index, Integer,
... | kyvinh/home-assistant | tests/components/recorder/models_original.py | Python | apache-2.0 | 5,545 |
from flask import Blueprint
bp = Blueprint("default_routes", __name__)
from . import delete, get, post # noqa: F401, E402
| kubeflow/kubeflow | components/crud-web-apps/volumes/backend/apps/default/routes/__init__.py | Python | apache-2.0 | 125 |
#!/usr/bin/env python
# coding: utf-8
import os
import re
import glob
import subprocess
from odoo_connection import Odoo10Context, context_mapping
from test_server import (get_addons_path, get_server_path, parse_list)
from apis import ApiException, WeblateApi, GitHubApi
from travis_helpers import yellow
from git_run ... | gurneyalex/maintainer-quality-tools | travis/travis_weblate.py | Python | agpl-3.0 | 12,239 |
# import unittest
# from tests.test_views import SqlApiViewTest
#
# def all_tests():
# suite = unittest.TestSuite()
# suite.addTest(unittest.makeSuite(SqlApiViewTest))
# return suite
| devashishsharma2302/testing-heroku-deployment | tests/__init__.py | Python | mit | 195 |
from django import template
from django.template import NodeList
from featureflipper.models import Feature
register = template.Library()
@register.tag
def feature(parser, token):
try:
tag_name, feature = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError, \
... | tobych/django-feature-flipper | featureflipper/templatetags/feature_tag.py | Python | apache-2.0 | 1,196 |
import json
import asyncio
from asyncio import sleep
import queue
import logging
from functools import partial
from collections.abc import Mapping
import kazoo.exceptions
from kazoo.client import KazooClient, KazooState, KazooRetry
from .plugin import subscribe
_missing = object()
def state_to_databases(state, get_... | jinty/zgres | zgres/zookeeper.py | Python | mit | 23,426 |
""" This is a test of using WMSClient and several other functions in WMS
In order to run this test we need the following DBs installed:
- JobDB
- JobLoggingDB
- TaskQueueDB
- SandboxMetadataDB
And the following services should also be on:
- OptimizationMind
- JobManager
- SandboxSt... | DIRACGrid/DIRAC | tests/Integration/WorkloadManagementSystem/Test_Client_WMS.py | Python | gpl-3.0 | 24,118 |
from openerp.osv import fields, osv
import time
import re
from datetime import datetime
from datetime import timedelta
from openerp.tools.translate import _
class tarun_hotel_product_category(osv.osv):
_name = "tarun.hotel.product.category"
_description = "Products Category"
_columns = {
... | thresholdsoftware/asylum-v2.0 | openerp/addons/tarun_hotel_ms/tarun_hotel_stock.py | Python | agpl-3.0 | 12,687 |
import re
import requests
from . import command, send
@command
def isitup(msginfo):
"""
.isitup <domain> - test whether a website is up
Service provided by https://isitup.org
"""
domains = msginfo["msg"].split(" ")[1:]
if len(domains) > 0:
for domain in domains:
doma... | Flat/JiyuuBot | modules/isitup.py | Python | agpl-3.0 | 919 |
from SimpleCV.base import *
from SimpleCV.Features import Feature, FeatureSet, BlobMaker
from SimpleCV.ImageClass import Image
from SimpleCV.Segmentation.SegmentationBase import SegmentationBase
class DiffSegmentation(SegmentationBase):
"""
This method will do image segmentation by looking at the difference b... | jayrambhia/SimpleCV2 | SimpleCV/Segmentation/DiffSegmentation.py | Python | bsd-3-clause | 4,253 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | federated_vision_datasets/inspect_splits.py | Python | apache-2.0 | 3,893 |
import time
import tornado.gen
from waterbutler import tasks
from waterbutler.server.handlers import core
class MoveHandler(core.BaseCrossProviderHandler):
JSON_REQUIRED = True
ACTION_MAP = {
'POST': 'move'
}
@tornado.gen.coroutine
def post(self):
if not self.source_provider.can... | hmoco/waterbutler | waterbutler/server/handlers/move.py | Python | apache-2.0 | 1,883 |
import argparse
import os
import itertools
import random
from math import log10
import scipy.stats as stats
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
import torchvision.utils as vutils
from tensorboardX import SummaryWriter
from torch.autograd impor... | orashi/PaintsPytorch | siv_train.py | Python | mit | 17,276 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Test.
#
import py
from rpython import conftest # pylint: disable=import-error
from rpython.jit.metainterp.test.test_ajit import LLJitMixin # pylint: disable=E
from som.vm.current import current_universe
from som.vm.symbols import symbol_for
from som.vm.universe impor... | SOM-st/PySOM | tests/jit.py | Python | mit | 8,353 |
# -*- coding:utf-8 -*-
import os
import cPickle as pickle
class Launcher(object):
""" Holds Launcher options. """
def __init__(self):
""" Application options. """
self.CLI = True
self.PORT = 5000
self.DEBUG = False
def start(self):
""" Launch the application. """... | Vezpi/dlmp3 | dlmp3/__init__.py | Python | gpl-3.0 | 3,372 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import mock # type: ignore
import pytest # type: ignore
from nixnet import _cconsts
from nixnet import _cfuncs
from nixnet import _enums
from nixnet import _errors
from nixnet import errors
MockXnetLibrar... | epage/nixnet-python | tests/test_errors.py | Python | mit | 2,943 |
"""
Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.
Note:
The length of num is less than 10002 and will be ≥ k.
The given num does not contain any leading zero.
Example 1:
Input: num = "1432219", k = 3
Output: "1219"
E... | franklingu/leetcode-solutions | questions/remove-k-digits/Solution.py | Python | mit | 1,235 |
import warnings
import json
import re
from datetime import datetime, timedelta
from jira import JIRA
from jira.exceptions import JIRAError
from dateutil import parser
from libraries import prettify
from helpers import helper
class JiraLogger:
def __init__(self):
warnings.filterwarnings('ignore') # SNIMiss... | micodls/jirautomatic | jirautomatic/jira_main.py | Python | gpl-3.0 | 10,179 |
# flake8: noqa
# This whole file is full of lint errors
import codecs
import sys
import operator
import functools
import warnings
try:
import builtins
except ImportError:
import __builtin__ as builtins
PY2 = sys.version_info[0] == 2
_identity = lambda x: x
if PY2:
unichr = unichr
text_type = unicod... | tomviner/werkzeug | werkzeug/_compat.py | Python | bsd-3-clause | 6,297 |
"""HomeKit controller session fixtures."""
import datetime
from unittest import mock
import unittest.mock
from aiohomekit.testing import FakeController
import pytest
import homeassistant.util.dt as dt_util
from tests.components.light.conftest import mock_light_profiles # noqa
@pytest.fixture
def utcnow(request):
... | turbokongen/home-assistant | tests/components/homekit_controller/conftest.py | Python | apache-2.0 | 868 |
"""
AdamP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/adamp.py
Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217
Code: https://github.com/clovaai/AdamP
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
impor... | rwightman/pytorch-image-models | timm/optim/adamp.py | Python | apache-2.0 | 3,574 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script for simultaneously copying the pictures from up to 6 cameras.
The primary goal is to copy the pictures from 4 action-cams, make groups of pictures with a cutoff time, create
a subfolder for each cam and copy the renamed pictures (timestamp added to the fil... | Stefal/V4MPod | scripts/copy_pic.py | Python | mit | 15,192 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""Created with Pycharm IDEA
@Create on 2015/9/12 17:12
@my_story service.py
@author : OmegaMiao"""
from app import db, app
from models import Story, Category, Author
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import NoResultFound
PER_PAGE = 2
cla... | OmegaM/story | app/service.py | Python | bsd-3-clause | 4,219 |
import serial
from struct import unpack
# Establish a serial connection and clear the buffer
ser = serial.Serial("/dev/ttyACM0", 38400);
ser.flushInput()
beef = '\xef' + '\xbe'
buffer = ''
# Keep on listening for multi-Spin packets
while True:
buffer = buffer + ser.read(ser.inWaiting())
if beef in buffer:
... | SPAN-UofU/radio-tomography | tools/sniffer.py | Python | gpl-3.0 | 537 |
#!/usr/bin/python2
import os
import sys
import unittest
from data_files import *
from collections import OrderedDict
from os.path import join
import shutil
try:
from process.sequence import AlignmentList, Alignment
from process.error_handling import *
from process.data import Partitions, InvalidPartitionF... | ODiogoSilva/TriFusion | trifusion/tests/test_partitions.py | Python | gpl-3.0 | 24,948 |
from django.conf.urls import patterns, url, include
from tethys_apps.utilities import generate_app_url_patterns
urlpatterns = patterns('',
url(r'^$', 'tethys_apps.views.library', name='app_library'),
)
# Append the app urls urlpatterns
app_url_patterns = generate_app_url_patterns()
for namespace, urls in app_ur... | CI-WATER/django-tethys_apps | tethys_apps/urls.py | Python | bsd-2-clause | 485 |
from django.core.management.base import BaseCommand
from postcode_api.downloaders import PostcodeGssCodeDownloader
class Command(BaseCommand):
args = '<destination_dir (default /tmp/)>'
def handle(self, *args, **options):
destination_dir = None
if len(args) == 1:
destination_dir ... | ministryofjustice/postcodeinfo | postcodeinfo/apps/postcode_api/management/commands/download_postcode_gss_codes.py | Python | mit | 444 |
"""
Copyright 2016 Juergen Edelbluth
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | edelbluth/blackred | src/blackred/test/test_blackred.py | Python | apache-2.0 | 9,792 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | tbachman/group-based-policy | gbpservice/neutron/db/migration/alembic_migrations/env.py | Python | apache-2.0 | 2,575 |
from tkinter import *
from src.element.Card import Card
from src.element.ResourceType import ResourceType
from src.game.GameState import GameState
from src.mvc.EventType import EventType
from src.mvc.GameBoard import GameBoard
from src.mvc.GameRules import GameRules
from src.player.AI import AI
import time
class Displ... | shinigota/dagpi_splendor | SplendorCode/src/mvc/Display.py | Python | gpl-3.0 | 32,173 |
from common import *
import pandas as pd
import multiprocessing as mp
def task_pred(inputdata,outputdata,clf1,clf2,w):
# print("featurize test ")
f, i = featurize(inputdata, w)
p_te = clf1.predict_proba(f)[:, 1] - clf2.predict_proba(f)[:, 1]
df = pd.read_csv(inputdata, index_col="SampleID")
Resu... | Diviyan-Kalainathan/causal-humans | Cause-effect/lib/lopez_codalab/predict.py | Python | mit | 904 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2011 VoltDB Inc.
#
# 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 limitati... | ifcharming/original2.0 | tests/bench/throughput/run.py | Python | gpl-3.0 | 1,927 |
# slider-1.py
from wax import *
from wax.tools.slider import Slider
class MainFrame(Frame):
def Body(self):
self.hpanel = HorizontalPanel(self)
self.vpanel = VerticalPanel(self)
self.slider1 = Slider(self.vpanel, labels=1, event=self.OnScroll)
self.slider2 = Sli... | MSMBA/msmba-workflow | msmba-workflow/srclib/wax/examples/slider-1.py | Python | gpl-2.0 | 1,117 |
from __future__ import absolute_import
from django.db import connection
from django.db.models import Avg, Max, Min, Sum
from django.test import TestCase
from .models import AmountTable
class CastAvgToFloatTest(TestCase):
def setUp(self):
AmountTable.objects.create(amount=100)
AmountTable.objects.... | yousseb/django_pytds | tests/mssql_aggregation_regress/tests.py | Python | mit | 966 |
from pbxproj import PBXGenericObject
class rootObject(PBXGenericObject):
def _resolve_comment(self, key):
return self.get_parent().objects._resolve_comment(key)
| kronenthaler/mod-pbxproj | pbxproj/PBXRootObject.py | Python | mit | 175 |
"""
@name: PyHouse/src/Modules/Families/Insteon/_test/test_Insteon_decoder.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com>
@copyright: (c) 2014-2017 by D. Brian Kimmel
@license: MIT License
@note: Created on Jul 18, 2014
@Summary:
Passed all 8 tests - DBK - 2017-10-08
This _test needs ... | DBrianKimmel/PyHouse | Project/src/Modules/House/Family/Insteon/_test/test_insteon_decoder.py | Python | mit | 6,574 |
'''
Determine server given times served by 2 players.
Status: Accepted
'''
###############################################################################
def main():
"""Predict server given times served"""
n, p, q = map(int, input().strip().split())
if (p + q) % (n + n) < n:
print("paul")
e... | ivanlyon/exercises | kattis/k_pauleigon.py | Python | mit | 471 |
#!/usr/bin/python
# Copyright (c) Arni Mar Jonsson.
# See LICENSE for details.
import rocksdb, pointless, random, string, itertools, collections
from twisted.internet import reactor, defer, threads
def compare(a, b):
return cmp(a, b)
c = 'bytewise'
c = ('rocksdb.BytewiseComparator', compare)
kw = {
'create_if_m... | botify-labs/py-rocksdb | test/try.py | Python | bsd-3-clause | 2,259 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import json
import math
from frappe import _
from frappe.utils import flt, get_datetime, getdate, date_diff, cint, nowdate, get_link_to_fo... | saurabh6790/erpnext | erpnext/manufacturing/doctype/work_order/work_order.py | Python | gpl-3.0 | 32,747 |
import re
import util
import view
import services
import model
"""
Generates the main calandar page
"""
#constants
DEFAULT_TIME = "08:00AM"
ROW_COLOR_TAG = "class=\"alt2\""
ROW_COLOR_TAG2 = "class=\"alt1\""
APP_TEMPLATE = "<a %s href=\"editAppointment?name=%s&time=%s&roleId=%i\">%s</a> "
NO_APP_TEMP... | jworr/scheduler | ui/webCal.py | Python | gpl-2.0 | 6,438 |
# coding: utf-8
from __future__ import print_function
import sys
from .compat import string_types
if False: # MYPY
from typing import Dict, Any, Text # NOQA
class Node(object):
__slots__ = 'tag', 'value', 'start_mark', 'end_mark', 'comment', 'anchor'
def __init__(self, tag, value, start_mark, end_ma... | explosion/srsly | srsly/ruamel_yaml/nodes.py | Python | mit | 3,716 |
# -*-coding: utf-8 -*-
import colander
from . import (
ResourceSchema,
BaseForm,
BaseSearchForm,
BaseAssignForm,
)
from ..resources.hotelcats import HotelcatsResource
from ..models.hotelcat import Hotelcat
from ..models.note import Note
from ..models.task import Task
from ..lib.qb.hotelcats import H... | mazvv/travelcrm | travelcrm/forms/hotelcats.py | Python | gpl-3.0 | 2,107 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... | felipenaselva/felipe.repository | script.module.placenta/lib/resources/lib/sources/en/to_be_fixed/sitedown/watchonline.py | Python | gpl-2.0 | 4,582 |
import lib.record_rate
import lib.puylogger
import lib.record_rate
import lib.getconfig
import lib.commonclient
import datetime
import json
solr_url = lib.getconfig.getparam('Solr', 'stats')
cluster_name = lib.getconfig.getparam('SelfConfig', 'cluster_name')
check_type = 'solr'
timestamp = int(datetime.datetime.no... | net-angels/puypuy | checks_available/check_solr.py | Python | apache-2.0 | 3,602 |
import sys
import os
from Bio.Seq import Seq
from StrongHold import StrongHold
def main(*args, **kwargs):
fpath = os.path.join(os.getcwd(),args[-1])
SH = StrongHold()
dna = SH.parserDNAFile(fpath)
seq = Seq(str(dna))
com = seq.reverse_complement()
print com
if __name__ == '__main__':
ma... | crf1111/Bio-Informatics-Learning | Bio-StrongHold/src/Complementing_a_Strand_of_DNA.py | Python | mit | 333 |
from accounts.cqrs import app
from rest_framework.authentication import BaseAuthentication
from rest_framework.authentication import get_authorization_header
from rest_framework.exceptions import AuthenticationFailed
import re
TOKEN_RE = re.compile(r'^Token (\w+)$')
class TokenAuthentication(BaseAuthentication):
... | lukaszb/cq | examples/djangoapp/accounts/auth.py | Python | mit | 1,222 |
# Copyright 2017 ZTE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | open-o/nfvo | drivers/vnfm/gvnfm/gvnfmadapter/driver/urls.py | Python | apache-2.0 | 1,060 |
"""
WSGI config for HealthNet project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | moiseslorap/RIT | Intro to Software Engineering/Release 2/HealthNet/HealthNet/wsgi.py | Python | mit | 395 |
import asyncio
import datetime
import json
import logging
import discord
from PIL import ImageFont
from .account import AccountMixin
from .achievements import AchievementsMixin
from .api import ApiMixin
from .bt import BtMixin
from .characters import CharactersMixin
from .commerce import CommerceMixin
from .daily imp... | Maselkov/GW2Bot | guildwars2/__init__.py | Python | mit | 5,003 |
#
# Run the production tests for a LOFAR station subrack
#
import sys
from optparse import OptionParser
import cli
import testlog
################################################################################
# Parse command line for subrack ID
#
# -v 0 : only PASSED or FAILED
# -v 1 : overall title
# -v 11 : re... | kernsuite-debian/lofar | LCU/StationTest/subrack_production.py | Python | gpl-3.0 | 6,887 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Manager of RPC calls from plugins.
"""
from golismero.api.config import Config
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014
Golismero project site: https://github.com/golismero
Golismero project mail: contact@golismero-project.com
This p... | golismero/golismero | golismero/managers/rpcmanager.py | Python | gpl-2.0 | 10,792 |
"""Provides a simple socket server and HTTP server utilities."""
from . import app
from . import http
from . import server
from .logger import Logger
__all__ = ['app', 'http', 'Logger', 'server']
Logger.name = __name__
| cheeseywhiz/cheeseywhiz | socket/server/__init__.py | Python | mit | 221 |
import sys
from math import sqrt
from collections import namedtuple
import numpy as NP
import scipy.stats
def mad( l ):
"""Compute the median absolute deviation (a robust measure of spread) of the list of
values *l*."""
median = NP.median(l)
return NP.median([abs(x - median) for x in l])
def robust... | dataplumber/nexus | climatology/clim/util/stats.py | Python | apache-2.0 | 7,130 |
__version__ = '0.4.4'
__all__ = ['CrontabMixin']
from .bot import CrontabMixin
| attakei/errcron | errcron/__init__.py | Python | gpl-3.0 | 83 |
from setuptools import setup, find_packages
setup(
name='zerokspot.recipe.distutils',
author='Horst Gutmann',
author_email='zerok@zerokspot.com',
description="Recipe for zc.buildout that downloads one or multiple distutils-archives and installs them",
version='0.1.2',
pa... | zerok/zerokspot.recipe.distutils | setup.py | Python | bsd-3-clause | 1,072 |
#!/usr/bin/env python
# encoding: utf-8
r"""
This script overrides the initialization and evolve_to_time() function of the chosen solver type
already existing in pyclaw.
It adds more functionality to the solver, i.e. more data in solver.setup, TVD check,
maximum wave speed calculation.
"""
import numpy as np
from cla... | numerical-mathematics/ssp-lmm-vss_RR | overridden_fun.py | Python | bsd-2-clause | 10,378 |
"""
Django admin page for bulk email models
"""
from django.contrib import admin
from bulk_email.models import CourseEmail, Optout, CourseEmailTemplate, CourseAuthorization
from bulk_email.forms import CourseEmailTemplateForm, CourseAuthorizationAdminForm
class CourseEmailAdmin(admin.ModelAdmin):
"""Admin for co... | zofuthan/edx-platform | lms/djangoapps/bulk_email/admin.py | Python | agpl-3.0 | 3,220 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# This script will downgrade the database one revision. You can run it multiple times to downgrade several revisions.
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DAT... | littleDad/mesLucioles | db_downgrade.py | Python | gpl-2.0 | 541 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2018-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/cli/tests/test_timeseries.py | Python | gpl-3.0 | 1,323 |
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 yo... | gangadhar-kadam/mtn-erpnext | utilities/doctype/trash_control/trash_control.py | Python | agpl-3.0 | 2,324 |
'''
'''
import unittest
from smoothtest.webunittest.WebdriverUtils import Url
class TestWebdriverUtilsUrl(unittest.TestCase):
def test_urls(self):
u = u'https://www.google.cl/?gfe_rd=cr&ei=ix0kVfH8M9PgwASPoIFo&gws_rd=ssl'
self.assertAlmostEqual(Url(u).get_path_and_on(), '/?gfe_rd=cr&ei=ix0kVfH8M9Pg... | joaduo/smoothtest | smoothtest/webunittest/tests/test_WebdriverUtils_Url.py | Python | mit | 390 |
import sys
import re
from modules import PyParse
re_as = re.compile('\s+as(\s+|$)')
re_match = re.compile('import\s*$|,\s*$')
def fromimport(win, matchobj):
n = {}
try:
b = re_as.search(matchobj.group())
if b:
return 'blank', ''
b = re_match.search(matchobj.group... | viswimmer1/PythonGenerator | data/python_files/11639340/import.py | Python | gpl-2.0 | 1,498 |
from . import function as f
import numpy as np
from . import util as u
class Relu:
def __init__(self):
self.mask = None
def forward(self,x):
self.mask = (x <= 0)
out = x.copy()
out[self.mask] = 0
return out
def backward(self,dout):
dout[self.mask] ... | mii012345/deep-learning | files/layers_back2.py | Python | mit | 4,023 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | xuleiboy1234/autoTitle | tensorflow/tensorflow/contrib/bayesflow/python/kernel_tests/monte_carlo_test.py | Python | mit | 12,316 |
"""
This class is defined to override standard pickle functionality
The goals of it follow:
-Serialize lambdas and nested functions to compiled byte code
-Deal with main module correctly
-Deal with other non-serializable objects
It does not include an unpickler, as standard python unpickling suffices.
This module wa... | robertnishihara/ray | python/ray/cloudpickle/cloudpickle.py | Python | apache-2.0 | 52,782 |
from collections import OrderedDict
class Scale:
notes = ['C', # Do
'D♭',
'D', # Re
'E♭',
'E', # Mi
'F', # Fa
'G♭',
'G', # Sol
'A♭',
'A', # La
'B♭',
'B'] # Si
... | markhovskiy/nudnost | utils/scale.py | Python | unlicense | 2,146 |
#!/usr/bin/env python
# navigation_buttons.py
#
# Copyright (C) 2015 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
#
# These buttons are the ones along the bottom of the badge screens for
# navigating between the pages.
import os
from gi.repository import Gtk
fro... | rcocetta/kano-profile | kano_profile_gui/navigation_buttons.py | Python | gpl-2.0 | 2,080 |
import sublime_plugin
import sublime
if sublime.version() >= '3000':
from .txt2pynb import txt2pynb
else:
from txt2pynb import txt2pynb
class txt2pynbCommand(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view()
input_file_path = view.file_name()
if inpu... | jmwerner/TXT2PYNB | txt2pynb_build.py | Python | mit | 761 |
#!/usr/bin/env python3
import re
import sys
import shutil
import os.path
import subprocess
import sysconfig
import reindent
import untabify
SRCDIR = sysconfig.get_config_var('srcdir')
def n_files_str(count):
"""Return 'N file(s)' with the proper plurality on 'file'."""
return "{} file{}".format(count, "s" ... | Immortalin/python-for-android | python3-alpha/python3-src/Tools/scripts/patchcheck.py | Python | apache-2.0 | 5,026 |
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
try:
from elftools.elf.elffile import ELFFile
from elftools.elf.sections import SymbolTableSection
from elftools.elf.descriptions import describe_sh_flags
from elftools.elf.descripti... | postfix/viper-1 | modules/elf.py | Python | bsd-3-clause | 5,107 |
from sqlalchemy import *
from impschedules import app
from impschedules import db
from isfunctions import *
import models
import os
from lxml import etree
import datetime
import properties
def score_all(data, publishers, elements, org_data):
out = {}
for publisher in publishers:
out[publisher] = score_... | pwyf/IATI-Implementation-Schedules | impschedules/isprocessing.py | Python | agpl-3.0 | 7,960 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("promrep", "0010_rename_alt_praenomen"),
]
operations = [
migrations.AddField(
model_name="person",
name="review_notes",
field=m... | kingsdigitallab/dprr-django | promrep/migrations/0011_person_review_notes.py | Python | mit | 401 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.