code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
"""Utils tests"""
import pytest
from social_django.models import UserSocialAuth
from authentication.backends.micromasters import MicroMastersAuth
from authentication.exceptions import UserMissingSocialAuthException
from authentication.strategy import DjangoRestFrameworkStrategy
from authentication.utils import (
l... | mitodl/open-discussions | authentication/utils_test.py | Python | bsd-3-clause | 1,459 |
"""App configuration for custom_user."""
from django.apps import AppConfig
class CustomUserConfig(AppConfig):
"""
Default configuration for custom_user.
"""
name = "custom_user"
verbose_name = "Custom User"
# https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-create... | jcugat/django-custom-user | src/custom_user/apps.py | Python | bsd-3-clause | 389 |
import os
import pandas as pd
import numpy as np
# Folders where results are and will be saved
savefolder=r'/scratch/sayala/RadianceScenes/BasicSimulations/'
posSampled = 50 #!! Modify to the number of positions sampled
for jj in range(0, 2):
# 0 - With
# 1 - Without
if jj == 0:
testfolder=... | NREL/bifacial_radiance | bifacial_radiance/HPCScripts/Other Examples (unorganized)/compile_basic_module_sampling.py | Python | bsd-3-clause | 3,651 |
class MatchIndicatorStatus(object):
SINGLE_TRANSACTION_MATCH = '1'
MULTIPLE_TRANS_IDENTICAL_CARD_MATCH = '2'
MULTIPLE_TRANS_DIFFERING_CARDS_MATCH = '3'
NO_MATCH_FOUND = '4'
| M4gn4tor/mastercard-api-python | Tests/services/fraud_scoring/matchindicatorstatus.py | Python | bsd-3-clause | 190 |
# -*- encoding:utf-8 -*-
import libmc
import unittest
import cPickle as pickle
import marshal
import time
TEST_SERVER = "localhost"
class BigObject(object):
def __init__(self, letter='1', size=2000000):
self.object = letter * size
def __eq__(self, other):
return self.object == other.object
c... | davies/libmc-ctypes | test.py | Python | bsd-3-clause | 10,467 |
class TerminationInquiryRequestOptions(object):
def __init__(self, page_offset, page_length):
self.page_offset = page_offset
self.page_length = page_length
if self.page_length > 25:
self.page_length = 25 | M4gn4tor/mastercard-api-python | Services/match/domain/options/terminationinquiryrequestoptions.py | Python | bsd-3-clause | 243 |
#!/usr/bin/env python
"""
Demo of "operate-and-get-next".
(Actually, this creates one prompt application, and keeps running the same app
over and over again. -- For now, this is the only way to get this working.)
"""
from prompt_toolkit.shortcuts import PromptSession
def main():
session = PromptSession("prompt> ... | jonathanslenders/python-prompt-toolkit | examples/prompts/operate-and-get-next.py | Python | bsd-3-clause | 404 |
"""
Tests for offsets.CustomBusinessHour
"""
from __future__ import annotations
from datetime import datetime
import numpy as np
import pytest
from pandas._libs.tslibs import Timestamp
from pandas._libs.tslibs.offsets import (
BusinessHour,
CustomBusinessHour,
Nano,
)
import pandas._testing as tm
from p... | pandas-dev/pandas | pandas/tests/tseries/offsets/test_custom_business_hour.py | Python | bsd-3-clause | 12,823 |
#!/usr/bin/env python
#
# Author: Patrick Hung (patrickh @caltech)
# Copyright (c) 1997-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE
"""
Solve the dual form of test_circle.py.
Cur... | jcfr/mystic | examples_other/qld_circle_dual.py | Python | bsd-3-clause | 1,952 |
from bokeh.models import HoverTool
from bokeh.plotting import figure, output_file, show
from bokeh.sampledata.glucose import data
x = data.loc['2010-10-06'].index.to_series()
y = data.loc['2010-10-06']['glucose']
# Basic plot setup
p = figure(width=800, height=400, x_axis_type="datetime",
tools="", toolbar... | bokeh/bokeh | examples/plotting/file/hover_glyph.py | Python | bsd-3-clause | 832 |
def extractAntlerscoloradoCom(item):
'''
Parser for 'antlerscolorado.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractAntlerscoloradoCom.py | Python | bsd-3-clause | 551 |
from dateutil import parser
from flask import request
from werkzeug.exceptions import NotFound, BadRequest
from rdr_service import clock
from rdr_service.api.base_api import BaseApi, log_api_request
from rdr_service.api_util import GEM, RDR_AND_PTC, RDR
from rdr_service.app_util import auth_required, restrict_to_gae_... | all-of-us/raw-data-repository | rdr_service/api/genomic_api.py | Python | bsd-3-clause | 7,595 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... | bitcraft/pyglet | pyglet/media/drivers/openal/lib_openal.py | Python | bsd-3-clause | 28,461 |
def extractWwwAfterhourssolaceCom(item):
'''
Parser for 'www.afterhourssolace.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWwwAfterhourssolaceCom.py | Python | bsd-3-clause | 560 |
from functools import partial
from django.test import TestCase
from django.utils.safestring import SafeText
from wagtail.admin import compare
from wagtail.core.blocks import StreamValue
from wagtail.images import get_image_model
from wagtail.images.tests.utils import get_test_image_file
from wagtail.tests.testapp.mod... | nealtodd/wagtail | wagtail/admin/tests/test_compare.py | Python | bsd-3-clause | 33,922 |
from wtforms import fields
from peewee import (DateTimeField, DateField, TimeField,
PrimaryKeyField, ForeignKeyField, BaseModel)
from wtfpeewee.orm import ModelConverter, model_form
from flask.ext.admin import form
from flask.ext.admin._compat import itervalues
from flask.ext.admin.model.form imp... | saadbinakhlaq/flask-admin | flask_admin/contrib/peeweemodel/form.py | Python | bsd-3-clause | 5,481 |
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000121'
addresses_name = 'parl.2017-06-08/Version 1/Lancaster (and Fleetwood) && (Morecambe and Lunesdale) Democracy_Club__08June2017.tsv'
stations_name = '... | chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_lancaster.py | Python | bsd-3-clause | 494 |
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
from werkzeug.contrib.fixers import ProxyFix
from flask import Flask, request, abort, session, g, redirect, url_for, jsonify, render_template
from decouple import config as config_from_env
from . import PYMONGO2
from . import geoip_tools
fr... | radical-software/mongo-mail-web | mongo_mail_web/wsgi.py | Python | bsd-3-clause | 11,323 |
import pytest
import tardis.montecarlo.montecarlo_numba.macro_atom as macro_atom
import numpy as np
@pytest.mark.parametrize(
["seed", "expected"],
[(1963, 10015), (1, 9993), (2111963, 17296), (10000, 9993)],
)
def test_macro_atom(
static_packet,
verysimple_numba_plasma,
verysimple_numba_model,
... | tardis-sn/tardis | tardis/montecarlo/montecarlo_numba/tests/test_macro_atom.py | Python | bsd-3-clause | 851 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2019 Edgewall Software
# Copyright (C) 2007 Eli Carter <retracile@gmail.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.... | rbaumg/trac | sample-plugins/workflow/DeleteTicket.py | Python | bsd-3-clause | 2,006 |
"""Timeseries model using FSL's gaussian least squares."""
import re
import os.path as op
import numpy as np
from scipy import stats, signal
import pandas as pd
import nibabel as nib
import matplotlib.pyplot as plt
from moss import glm
from moss.mosaic import Mosaic
import seaborn as sns
from nipype import Node, MapNo... | tuqc/lyman | lyman/workflows/model.py | Python | bsd-3-clause | 20,567 |
import json
import logging
import os
from django import forms
from django.conf.urls import url
from django.contrib import admin
from django.contrib import messages
from django.contrib.gis.admin import OSMGeoAdmin
from django.core.cache import cache
from django.shortcuts import render
from django.utils.html import form... | terranodo/eventkit-cloud | eventkit_cloud/jobs/admin.py | Python | bsd-3-clause | 13,376 |
from django.http import Http404
from django.template.response import TemplateResponse
from django.urls import URLResolver, re_path
from django.urls.resolvers import RegexPattern
from wagtail.core.models import Page
from wagtail.core.url_routing import RouteResult
_creation_counter = 0
def route(pattern, name=None)... | torchbox/wagtail | wagtail/contrib/routable_page/models.py | Python | bsd-3-clause | 5,962 |
""" Code for calculations of P(DM|z) and P(z|DM)"""
import numpy as np
import os
from pkg_resources import resource_filename
from scipy.stats import norm, lognorm
from frb.dm import igm
from frb.dm import cosmic
from frb import defs
from IPython import embed
class P_DM_z(object):
pass
def prob_DMcosmic_FRB(frb... | FRBs/FRB | frb/dm/prob_dmz.py | Python | bsd-3-clause | 4,572 |
from itertools import chain
from django import forms, VERSION
from django.template import loader
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext, ugettext_lazy
__all__ = (
'TextInput', 'PasswordInput', 'HiddenInput', 'ClearableFileInput',
'FileInput', 'DateInput',... | ojii/django-floppyforms | floppyforms/widgets.py | Python | bsd-3-clause | 9,637 |
#!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, 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:
# 1. Redistributions of source code must retain the above copyright n... | brocade/pysdn | samples/sampleopenflow/demos/demo1.py | Python | bsd-3-clause | 4,024 |
import graphene
from graphene_django.rest_framework.mutation import SerializerMutation
from rest_framework import serializers
# from utils import parse_global_ids
from . import schema
from .utils import parse_global_ids
from django_workflow.models import Workflow, State, StateVariableDef, Transition, Condition, Functio... | dani0805/django_workflow | django_workflow/mutation.py | Python | bsd-3-clause | 8,601 |
from zeit.calendar.i18n import MessageFactory as _
import zc.sourcefactory.basic
class PrioritySource(zc.sourcefactory.basic.BasicSourceFactory):
values = (
(1, _('^^ mandatory')),
(0, _('^ important')),
(-1, _('> suggestion')))
titles = dict(values)
def getValues(self):
... | ZeitOnline/zeit.calendar | src/zeit/calendar/source.py | Python | bsd-3-clause | 423 |
from __future__ import absolute_import, division, print_function
import os
import tempfile
import unittest
import blaze
from blaze.datadescriptor import dd_as_py
# A CSV toy example
csv_buf = u"""k1,v1,1,False
k2,v2,2,True
k3,v3,3,False
"""
csv_schema = "{ f0: string; f1: string; f2: int16; f3: bool }"
csv_ldict = ... | aaronmartin0303/blaze | blaze/tests/test_array_opening.py | Python | bsd-3-clause | 3,006 |
import sys
import random
import os
print os.getcwd()
f = open('t.txt','w')
f.write(str(random.randint(0,10000)))
| jaredgk/IMgui-electron | IMa/make_random_number.py | Python | bsd-3-clause | 117 |
# Copyright 2015, 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 f... | arkmaxim/grpc | src/python/grpcio/grpc_core_dependencies.py | Python | bsd-3-clause | 27,122 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bublfish.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| ideal/bublfish | manage.py | Python | bsd-3-clause | 251 |
# -*- coding: utf-8 -*-
#
# © 2011 SimpleGeo, Inc All rights reserved.
# Author: Ian Eure <ian@simplegeo.com>
#
"""Make your code robust."""
| simplegeo/tillicum | tillicum/__init__.py | Python | bsd-3-clause | 143 |
from dataclasses import dataclass
from datetime import datetime
from googleapiclient import discovery
import logging
from typing import List
from rdr_service import config
from rdr_service.services.gcp_config import RdrEnvironment
from rdr_service.config import GAE_PROJECT
@dataclass
class ServiceAccount:
email:... | all-of-us/raw-data-repository | rdr_service/offline/service_accounts.py | Python | bsd-3-clause | 4,239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Little utility that help automate tests and optimization with XDS.
"""
__version__ = "0.1.0"
__date__ = "11-10-2011"
__author__ = "Pierre Legrand (pierre.legrand@synchrotron-soleil.fr)"
__copyright__ = "Copyright (c) 2011 Pierre Legrand"
__license__ = "New BSD http://... | jsburg/xdsme | XDS/runxds_indexer.py | Python | bsd-3-clause | 2,582 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Nicolas P. Rougier
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ----------------------------------------------------------------------------... | duyuan11/glumpy | examples/collection-point.py | Python | bsd-3-clause | 998 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.common import DataSegment
import cybox.test
from cybox.test import EntityTestCase
class TestByteRun(EntityTestCase, unittest.TestCase):
klass = DataSegment
_full_dict = {
... | CybOXProject/python-cybox | cybox/test/common/datasegment_test.py | Python | bsd-3-clause | 615 |
from django.conf import settings
MAP_POI_ACTIVITIES = getattr(
settings, 'WIDGETS_MAP_POI_ACTIVITIES', (
('place-see', 'Places to see'),
('place-eat', 'Places to eat')
)
)
MAP_POI_VENUES = getattr(
settings, 'WIDGETS_MAP_POI_VENUES', (
('atm', 'ATM'),
('bar', 'Bar'),
... | publica-io/django-publica-widgets | widgets/settings.py | Python | bsd-3-clause | 562 |
# the keys and values you want to keep
# '*' is a wildcard, will accept anything
# in order of prevalence, http://taginfo.openstreetmap.org/keys
# at my own (huh, is this interesting?) discretion
wantedTags = {
'highway': {
'bus_stop', 'rest_area'},
'name': '*',
'addr:housenumber': '*',
'add... | aaronlidman/openstreetPOIs | settings.py | Python | bsd-3-clause | 2,332 |
#------------------------------------------------------------------------------
# Name: pychrono example
# Purpose:
#
# Author: Alessandro Tasora
#
# Created: 1/01/2019
# Copyright: (c) ProjectChrono 2019
#
#
# This file shows how to
# - create a small stack of bricks,
# - create a support that sh... | dariomangoni/chrono | src/demos/python/irrlicht/demo_IRR_earthquake.py | Python | bsd-3-clause | 8,081 |
from django.db.models import get_model
from django.core.urlresolvers import reverse
from oscar.test.testcases import WebTestCase
from oscar_mws.test import factories
AmazonProfile = get_model('oscar_mws', 'AmazonProfile')
class TestAmazonProfileDashboard(WebTestCase):
is_staff = True
def setUp(self):
... | django-oscar/django-oscar-mws | tests/functional/test_dashboard.py | Python | bsd-3-clause | 1,448 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import tempo.django.fields
class Migration(migrations.Migration):
dependencies = [
('anapp', '0002_nullablemodel'),
]
operations = [
migrations.CreateModel(
name='Movie',... | AndrewPashkin/python-tempo | tests/test_django/aproject/anapp/migrations/0003_movie.py | Python | bsd-3-clause | 670 |
import chainer
from chainer_wing.node import Input, Output, Link
# TODO(fukatani): implement systematically.
class Linear(Link):
Input('in_array', (chainer.Variable,))
Input('out_size', (int,))
Input('nobias', (bool,), select=[True, False])
Output('out_array', (chainer.Variable,))
def call_init(... | fukatani/CW_gui | chainer_wing/CustomNodes/LinkNodes.py | Python | bsd-3-clause | 1,089 |
#!/usr/bin/env python2
import timeit
import numpy as np
import random
from control.optimizer import Optimizer
N = 100
o = Optimizer()
o.mapper = o.tm.thrusts_to_outputs()
thrusts = np.array([8.45, 1.12, -0.15, -12.2, 6.4, 4.4])
desires = np.array([123, 45, -13, -31.123, 31, 90])
def timed():
o.objective(thrusts, ... | cuauv/software | control/benchmark.py | Python | bsd-3-clause | 558 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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
# lis... | stormi/tsunami | src/primaires/joueur/contextes/__init__.py | Python | bsd-3-clause | 2,332 |
# Defintion of estimate function function
import numpy as np
import numpy.linalg as lg
############ MIXING TO CONSTUCT H ############
class Polynomial_Matrix(object):
@property
def H(self):
N=len(self.x_axis)
H=np.matrix(np.vander(self.x_axis,self.order+1,increasing=True))
return H
... | vincentchoqueuse/parametrix | parametrix/polynomial/tools.py | Python | bsd-3-clause | 396 |
#!/usr/bin/python2.7
"""Tool to generate a graph of commits per day.
The tool reads the repository information of one or more Mercurial repositories
and builds a chart with commit activity per day. This is similar to the commit
chart in github, but generated locally. It creates an SVG file, and launches a
file viewer... | tordable/activity-chart | work.py | Python | bsd-3-clause | 5,034 |
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from core.constants import ACTIONS
class ActionSerializer(serializers.ModelSerializer):
action_list = serializers.SerializerMethodField()
model = serializers.StringRelatedField... | ikcam/django-skeleton | core/api/serializers.py | Python | bsd-3-clause | 1,841 |
#!/bin/python3
#
# Examples:
# python3 info.py -p /dev/ttyUSB0
#
import sys
import fcntl
import argparse
from time import sleep
sys.path.append("../")
import buttshock.et312
def main():
modes = {0x76:"Waves", 0x77:"Stroke", 0x78:"Climb", 0x79:"Combo", 0x7a:"Intense", 0x7b:"Rhythm",
0x7c:"Audio1... | metafetish/buttshock-py | examples/et312-info.py | Python | bsd-3-clause | 3,960 |
import os
import traceback
from datetime import datetime
from rdflib import Namespace, Graph
# To avoid duplication of namespaces across converters
NS = {
'en': Namespace("http://www.dfki.de/lt/en.owl#"),
'dax': Namespace("http://www.dfki.de/lt/dax.owl#"),
'cfi': Namespace("http://www.dfki.de/lt/cfi.owl#"),
... | monnetproject/rdfconverters | rdfconverters/util.py | Python | bsd-3-clause | 7,438 |
import os
from setuptools import (
setup,
find_packages,
)
version = '1.0a1'
shortdesc = "AGX UML to Filesystem Transform"
longdesc = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
longdesc += open(os.path.join(os.path.dirname(__file__), 'LICENSE.rst')).read()
setup(name='agx.transform.u... | bluedynamics/agx.transform.uml2fs | setup.py | Python | bsd-3-clause | 1,283 |
# -*- coding:utf8 -*-
'''
功能: XML-RPC 服务端
1. 实现允许RPC服务, 被远程结束掉.
依赖: SimpleXMLRPCServer
说明:
1. 命令行,先运行服务器端,再运行客户端.
2. 服务执行一次,就自动关闭.需要手动重启.
'''
__author__ = 'hhstore'
from SimpleXMLRPCServer import SimpleXMLRPCServer
running = True # 全局运行状态
def rpc_test_service():
global running
running = ... | hhstore/learning-notes | python/src/exercise/py27/03_Network/RPC/XMLRPC/03_rpc_serv_cli_exit/rpc_server.py | Python | mit | 1,044 |
import re, json, sys
if sys.version_info[0] == 2:
def _is_num(o):
return isinstance(o, int) or isinstance(o, long) or isinstance(o, float)
def _stringify(o):
if isinstance(o, str):
return unicode(o)
if isinstance(o, unicode):
return o
return None
else:
... | idleberg/sublime-cson | all/cson/writer.py | Python | mit | 6,879 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutAsserts(Koan):
def test_assert_truth(self):
"""
We shall contemplate truth by testing reality, via asserts.
"""
# Confused? This video should help:
#
# http://bit.ly/about_assert... | GGXH/python_koans | python_koans/python2/koans/about_asserts.py | Python | mit | 2,296 |
# Generated by Django 2.2 on 2019-06-02 09:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('part', '0006_auto_20190526_1215'),
]
operations = [
migrations.RemoveField(
model_name='part',
... | inventree/InvenTree | InvenTree/part/migrations/0007_auto_20190602_1944.py | Python | mit | 1,574 |
class ArtifactMetadataUpdater(object):
def __init__(self, bucket_container, identity):
"""
Args:
bucket_container(shelf.metadata.bucket_container.BucketContainer)
identity(shelf.resource_identity.ResourceIdentity)
"""
self.bucket_container = bucket... | kyle-long/pyshelf | shelf/bucket_update/artifact_metadata_updater.py | Python | mit | 1,142 |
# encoding: UTF-8
from __future__ import absolute_import
from .vnokex import *
# 在OkCoin网站申请这两个Key,分别对应用户名和密码
apiKey = '你的accessKey'
secretKey = '你的secretKey'
# 创建API对象
api = OkexSpotApi()
api.connect(apiKey, secretKey, True)
sleep(3)
#api.login()
api.subscribeSpotTicker("bch_btc")
api.subscribeSpotDepth("bch_btc... | mumuwoyou/vnpy-master | beta/api/okex/test.py | Python | mit | 1,501 |
# vim: set et ts=4 sw=4 fdm=marker
"""
MIT License
Copyright (c) 2016 Jesse Hogan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to u... | jhogan/commonpy | logs.py | Python | mit | 3,390 |
import time
import sys
import _mysql
import random
import string
import re
import os
import urllib.parse
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import selenium.webdriver.chrome.service as service
from shutil import copyfile
service = service.Service('D:\ChromeDriver\chromedri... | TheParrotsAreComing/PAWS | TestingAssets/Fosters/delta_default_pic.py | Python | mit | 4,314 |
#!/usr/bin/python
#
# isprime.py
# Generates a list of prime numbers in a given range.
#
# Exercise 4.4:
# a) Write a function that determines whether a number is prime.
# b) Use this function in a program that determines and prints all the prime
# numbers between 2 and 1,000.
#
# Author: Billy Wilson Arante
# Created... | arantebillywilson/python-snippets | py2/htp/ex04/isprime.py | Python | mit | 718 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def pred_visualization(fname, arrays, picks, img_shape, tile_spacing=(0,0),
scale_rows_to_unit_interval=True,
output_pixel_vals=True):
"""Used ... | saebrahimi/Emotion-Recognition-RNN | common/disptools.py | Python | mit | 11,942 |
"""Component to integrate the Home Assistant cloud."""
import asyncio
import json
import logging
import os
import voluptuous as vol
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, CONF_REGION, CONF_MODE)
from . import http_api, iot
from .const import CONFIG_DIR, DOMAIN, SERVERS
REQUIREMENTS = ['war... | stefan-jonasson/home-assistant | homeassistant/components/cloud/__init__.py | Python | mit | 4,402 |
#! /usr/bin/env python
from setuptools import find_packages, setup
setup(
name='morph_seg',
version='0.1.0',
description="Morphological segmentation experiments",
author='Judit Acs',
author_email='judit@sch.bme.hu',
packages=find_packages(),
package_dir={'': '.'},
provides=['morph_seg... | juditacs/morph-segmentation-experiments | setup.py | Python | mit | 326 |
from argparse import ArgumentParser
from flexget import options
from flexget.event import event
from flexget.terminal import TerminalTable, colorize, console, disable_colors, table_parser
try:
from irc_bot.simple_irc_bot import IRCChannelStatus, SimpleIRCBot
except ImportError:
SimpleIRCBot = None
IRCChan... | Flexget/Flexget | flexget/components/irc/cli.py | Python | mit | 3,979 |
from django import forms
from . import models
class AccountForm(forms.ModelForm):
class Meta:
model = models.User
exclude = ('first_name', 'last_name', 'password', 'is_staff',
'is_active', 'is_superuser', 'last_login', 'date_joined',
'groups', 'user_permissi... | reidwooten99/botbot-web | botbot/apps/accounts/forms.py | Python | mit | 1,038 |
#!/usr/bin/env python
#|
#| This python script takes a traits files, which looks like the following
#|
#| samplename trait1 trait2 etc
#|
#| By finding the traits and breaking them into bit strings, so they can be loaded
#| into the nexus output file
#|
import os
import numpy
import argparse
import sys
import uuid
T... | smilefreak/ancient_dna_pipeline | python_scripts/make_traits.py | Python | mit | 5,026 |
import json
import io
from datetime import datetime
def util_load_json(path):
with io.open(path, mode='r', encoding='utf-8') as f:
return json.loads(f.read())
def get_headers_for_login():
headers_for_login = {
'Authorization': 'Basic some-alphanumeric',
'X-Domain': 'Domain-1',
... | VirusTotal/content | Packs/ConcentricAI/Integrations/ConcentricAI/ConcentricAi_test.py | Python | mit | 5,758 |
from __future__ import absolute_import
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'phoenix.settings')
from django.conf import settings # noqa
app = Celery('phoenix')
# Using a string here means the worker ... | vchrisb/emc_phoenix2 | phoenix/celery.py | Python | mit | 574 |
from distutils.core import setup
setup(
name='PhotoRename',
version='1.0.9',
author="Jordan Dunn",
author_email="me@jordan-dunn.com",
url="https://github.com/JorDunn/photorename",
packages=['photorename'],
license='MIT',
long_description="A utility to rename photos and give them a more ... | JorDunn/rename-photos | setup.py | Python | mit | 470 |
'''
'''
import sys, subprocess
sys.path.insert(0, '/nethome/asalomatov/projects/ppln')
import logProc
options = ''' \
--standard_min_confidence_threshold_for_calling 30.0 \
--standard_min_confidence_threshold_for_emitting 30.0 \
--downsample_to_coverage 2000 \
--downsampling_type BY_SAMPLE \
--annotation BaseQu... | simonsfoundation/pipeline | ppln/gatkVariantAnnotator.py | Python | mit | 1,892 |
#Github pull reqest builder for Jenkins
import json
import os
import re
import urllib2
import urllib
import base64
import requests
import sys
import traceback
import platform
import subprocess
import codecs
from shutil import copy
#set Jenkins build description using submitDescription to mock browser behavior
#TODO:... | LuckyGameCn/LHCocosGame | cocos2d/tools/jenkins-scripts/pull-request-builder.py | Python | mit | 10,288 |
# Copyright 2018 Palantir Technologies, Inc.
import logging
import uuid
import sys
from concurrent import futures
from .exceptions import JsonRpcException, JsonRpcRequestCancelled, JsonRpcInternalError, JsonRpcMethodNotFound
log = logging.getLogger(__name__)
JSONRPC_VERSION = '2.0'
CANCEL_METHOD = '$/cancelRequest'
... | glenngillen/dotfiles | .vscode/extensions/ms-toolsai.jupyter-2021.6.832593372/pythonFiles/lib/python/pyls_jsonrpc/endpoint.py | Python | mit | 9,502 |
import pyparsing as pp
import six
import re
import ast
# Grammar for Field inputs
TRUE = pp.CaselessKeyword('true')
FALSE = pp.CaselessKeyword('false')
WILDCARD = pp.Word('*')
INT_LIT = pp.Word(pp.nums)
NEG_DASH = pp.Word('-', exact=1)
FLOAT_LIT = pp.Word(pp.nums + '.')
DEC_POINT = pp.Word('.', exact=1)
FLOAT_LIT_FULL... | OpenSourcePolicyCenter/webapp-public | webapp/apps/taxbrain/helpers.py | Python | mit | 4,161 |
#!/usr/bin/env python3
from test import support
import marshal
import sys
import unittest
import os
class HelperMixin:
def helper(self, sample, *extra):
new = marshal.loads(marshal.dumps(sample, *extra))
self.assertEqual(sample, new)
try:
with open(support.TESTFN, "wb") as f:
... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.2/Lib/test/test_marshal.py | Python | mit | 7,626 |
# encoding: UTF-8
'''
本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。
使用DR_setting.json来配置需要收集的合约,以及主力合约代码。
'''
import copy
import json
from Queue import Queue, Empty
from collections import OrderedDict
from datetime import datetime
from threading import Thread
from vnpy.event import Event
from vnpy.trader.app.dataRecorder.... | cmbclh/vnpy1.7 | vnpy/trader/app/dataRecorder/drEngine.py | Python | mit | 12,770 |
import logging
from pecan import expose, request
from pecan.ext.notario import validate
from uuid import uuid4
from ceph_installer.controllers import error
from ceph_installer.tasks import call_ansible
from ceph_installer import schemas
from ceph_installer import models
from ceph_installer import util
logger = logg... | ceph/ceph-installer | ceph_installer/controllers/agent.py | Python | mit | 1,471 |
"""
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each
of their nodes contain a single digit. Add the two numbers and return it as a linked list.
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
"""
__author__ = 'Danyang'
class Li... | algorhythms/LeetCode | 004 Add Two Numbers.py | Python | mit | 2,135 |
'''
Configuration object
====================
The :class:`Config` object is an instance of a modified Python ConfigParser.
See the `ConfigParser documentation
<http://docs.python.org/library/configparser.html>`_ for more information.
Kivy has a configuration file which determines the default settings. In
order to cha... | rnixx/kivy | kivy/config.py | Python | mit | 37,560 |
# coding: utf-8
"""test_isort.py.
Tests all major functionality of the isort library
Should be ran using py.test by simply running py.test in the isort project directory
Copyright (C) 2013 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associ... | adamchainz/isort | test_isort.py | Python | mit | 87,978 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('robocrm', '0034_robouser_rfid_card'),
]
operations = [
migrations.AlterField(
model_name='robouser',
... | sreidy/roboticsclub.org | robocrm/migrations/0035_auto_20150130_1557.py | Python | mit | 529 |
from __future__ import unicode_literals
def _build_mimetype(resource_name, fmt='json'):
return 'application/vnd.reviewboard.org.%s+%s' % (resource_name, fmt)
api_token_list_mimetype = _build_mimetype('api-tokens')
api_token_item_mimetype = _build_mimetype('api-token')
archived_item_mimetype = _build_mimetype(... | davidt/reviewboard | reviewboard/webapi/tests/mimetypes.py | Python | mit | 5,834 |
from __future__ import absolute_import
import Cookie
import urllib
import urlparse
import time
import copy
from email.utils import parsedate_tz, formatdate, mktime_tz
import threading
from netlib import http, tcp, http_status
import netlib.utils
from netlib.odict import ODict, ODictCaseless
from .tcp import TCPHandler
... | xtso520ok/mitmproxy | libmproxy/protocol/http.py | Python | mit | 52,925 |
__author__ = "Nick Isaacs"
import shutil
import time
import os
import tests.TestHelper
from src.processor.MongoProcessor import MongoProcessor
from src.utils.Envirionment import Envirionment
class SaveThreadProcessorTest(object):
def setup(self):
self.test_helper = tests.TestHelper.TestHelper()
s... | gnip/sample-python-connector | tests/specs/MongoStgreamProcessorTest.py | Python | mit | 1,081 |
import os.path, sys
import distutils.util
# Append the directory in which the binaries were placed to Python's sys.path,
# then import the D DLL.
libDir = os.path.join('build', 'lib.%s-%s' % (
distutils.util.get_platform(),
'.'.join(str(v) for v in sys.version_info[:2])
))
sys.path.append(os.path.abspath(libDi... | ariovistus/pyd | examples/arraytest/test.py | Python | mit | 566 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# File: cifar10-resnet.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import numpy as np
import tensorflow as tf
import argparse
import os
from tensorpack import *
from tensorpack.tfutils.symbolic_functions import *
from tensorpack.tfutils.summary import *
"""
CIFAR10 ResNet... | hclhkbu/dlbench | synthetic/experiments/tensorflow/cnn/resnet/cifar10-resnet.py | Python | mit | 6,463 |
from .config import SQLALCHEMY_DATABASE_URI
from .config import SQLALCHEMY_MIGRATE_REPO
from .app import db
def create_or_update_db():
import os.path
db.create_all()
if __name__ == '__main__':
create_or_update_db()
| gauravyeole/iDigBio-appliance | idigbio_media_appliance/create_db.py | Python | mit | 230 |
from urlparse import urljoin
from flask import request
from werkzeug.contrib.atom import AtomFeed
import flask
import os
import dateutil.parser
from .query import QueryFinder
from .indexer import read_json_file
PARAM_TOKEN = '$$'
ALLOWED_FEED_PARAMS = ('feed_title', 'feed_url')
ALLOWED_ENTRY_PARAMS = ('entry_url', 'e... | rosskarchner/sheer | sheer/feeds.py | Python | cc0-1.0 | 2,701 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
##---------------------------------------------------------------------------##
##
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2009 Skomoroh
##
## This program is free ... | TrevorLowing/PyGames | pysollib/wizardpresets.py | Python | gpl-2.0 | 3,786 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__date__= 'Aug 19, 2015 '
__author__= 'samuel'
import yaml
import sys
import os
import docker
from docker import Client
def check_image_name(docker, service):
print 'check_image_name,',
#pwd = os.path.dirname(os.path.realpath(__file__)).split('/')[-1]
#folder ... | bowlofstew/BuildbotDocker | test/docker-compose-rmi.py | Python | gpl-2.0 | 1,987 |
import datetime
import pytest
from manageiq_client.filters import Q
from cfme import test_requirements
from cfme.infrastructure.provider import InfraProvider
from cfme.markers.env_markers.provider import ONE
from cfme.rest.gen_data import vm as _vm
from cfme.utils.blockers import BZ
from cfme.utils.rest import assert... | nachandr/cfme_tests | cfme/tests/infrastructure/test_vm_retirement_rest.py | Python | gpl-2.0 | 6,932 |
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptions to ... | analogue/mythbox | resources/lib/mysql-connector-python/python3/mysql/connector/network.py | Python | gpl-2.0 | 13,834 |
"""
python-calais v.1.4 -- Python interface to the OpenCalais API
Author: Jordan Dimov (jdimov@mlke.net)
Last-Update: 01/12/2009
"""
import httplib, urllib, urllib2, re
try:
import simplejson as json
except ImportError:
import json
from StringIO import StringIO
PARAMS_XML = """
<c:params xmlns:c="http://s.op... | collective/collective.taghelper | collective/taghelper/calais.py | Python | gpl-2.0 | 7,318 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014, 2015 CERN.
#
# Invenio 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 optio... | egabancho/invenio-communities | tests/__init__.py | Python | gpl-2.0 | 983 |
#!/usr/bin/env python
from httplib import HTTP
from string import replace
from struct import unpack
import sys
latitude=0
longitude=0
def doLookup(cellId, lac, host = "www.google.com", port = 80):
page = "/glm/mmap"
http = HTTP(host, port)
result = None
errorCode = 0
content_type, body = encode_request(cel... | udit-gupta/socialmaps | socialmaps/mobile_pages/lib/my_location.py | Python | gpl-2.0 | 1,282 |
print "--------------- tn5250j test fields script start ------------"
screen = _session.getScreen()
screenfields = screen.getScreenFields()
fields = screenfields.getFields()
for x in fields:
print x.toString()
print x.getString()
print "number of fields %s " % screenfields.getSize()
print "---------------... | zenovalle/tn5250j | scripts/Test/testfields.py | Python | gpl-2.0 | 368 |
"""
Interpret is a collection of utilities to list the import plugins.
An import plugin is a script in the interpret_plugins folder which has the function getCarving.
The following examples shows functions of fabmetheus_interpret. The examples are run in a terminal in the folder which contains fabmetheus_interpret.p... | natetrue/ReplicatorG | skein_engines/skeinforge-40/fabmetheus_utilities/fabmetheus_tools/fabmetheus_interpret.py | Python | gpl-2.0 | 6,236 |
# Copyright (C) 2014-2016 Apple 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:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | Debian/openjfx | modules/web/src/main/native/Tools/Scripts/webkitpy/port/ios.py | Python | gpl-2.0 | 19,676 |
from pyx import *
text.preamble(r"\parindent0pt")
c = canvas.canvas()
t = c.text(0, 0, r"spam \& eggs", [trafo.scale(6), text.parbox(1.2, baseline=text.parbox.top)])
t2 = text.text(0, 0, "eggs", [trafo.scale(6)])
b, b2 = t.bbox(), t2.bbox()
c.stroke(t.path(), [style.linewidth.THin])
c.stroke(path.line(-0.3, b.top(), ... | mjg/PyX-svn | manual/textvalign.py | Python | gpl-2.0 | 1,409 |
# common.py - common code for the convert extension
#
# Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import base64, errno, subprocess, os, datetime, re
import cPick... | hekra01/mercurial | hgext/convert/common.py | Python | gpl-2.0 | 15,243 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 v... | lnielsen/zenodo | zenodo/modules/sipstore/api.py | Python | gpl-2.0 | 3,440 |