text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014-2015 Canonical Limited.
#
# 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
#
# Unl... | konono/equlipse | openstack-install/charm/trusty/charm-keystone/tests/charmhelpers/core/strutils.py | Python | mit | 3,680 | 0 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Asgard Ledger Export (ALE) module,
# Copyright (C) 2005 - 2013
# Héonium (http://www.heonium.com). All Right Reserved
#
# Asgard Ledger Export (ALE) module
# is free software: you can redistribute it and/or modif... | noemis-fr/old-custom | e3z_account_export_grouped/account_export.py | Python | agpl-3.0 | 28,581 | 0.006621 |
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import sys
#
# use pretty plotting if it can be imported
#
try:
import seaborn
except:
pass
sigma=5.67e-8
def find_tau(tot_trans,num_layers):
"""
# -TD- document using
"""
trans_layer=tot_trans**(1./num_layers)
... | dennissergeev/classcode | lib/equil_run.py | Python | cc0-1.0 | 5,877 | 0.029607 |
class PassphraseMapper(object):
def __init__(self, n):
self.n = n
def __getitem__(self, c):
c = chr(c)
if c.isalpha(): # circular shift for letters
a = ord('a') if c.islower() else ord('A')
return chr(a + ((ord(c) - a + self.n) % 26))
if c.isdigit(): ... | SelvorWhim/competitive | Codewars/PlayingWithPassphrases.py | Python | unlicense | 735 | 0.013605 |
# -*- coding: utf-8 -*-
#
# pysaml2 documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 24 08:13:41 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/pysaml2-2.4.0/doc/conf.py | Python | gpl-2.0 | 6,371 | 0.006749 |
#!/usr/bin/env python3
import unittest
TestCase = unittest.TestCase
from BioUtil.decorator import context_decorator
import inspect
print(__file__)
class TestContextDecorator(TestCase):
def test_no_enter(self):
with self.assertRaises(AttributeError):
class A:
pass
wi... | sein-tao/pyBioUtil | tests/test_decorator.py | Python | gpl-2.0 | 850 | 0.004706 |
#!/usr/bin/env python
from setuptools import setup, find_packages
install_requires = [
'antlr4-python2-runtime==4.5',
'click==4.0'
]
setup(
name='json-database',
version='0.4.0',
author='Dmitri Chumak',
author_email='tsudmi@ut.ee',
url='https://github.com/tsudmi/json-database',
descr... | tsudmi/json-database | setup.py | Python | mit | 867 | 0 |
#!/usr/bin/env python3.4
#
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | yusufm/mobly | mobly/controllers/attenuator_lib/minicircuits.py | Python | apache-2.0 | 5,184 | 0.001157 |
"""A simple ctypes Wrapper of FlyCapture2_C API. Currently this only works with
graysale cameras in MONO8 or MONO16 pixel format modes.
Use it as follows:
>>> c = Camera()
First you must initialize.. To capture in MONO8 mode and in full resolution
run
>>> c.init() #default to MONO8
Init also turns... | andrej5elin/camera | camera/bfly.py | Python | mit | 32,554 | 0.0184 |
import numpy as N
import sys as SYS
import os as OS
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
from matplotlib import rc
rc('text', usetex=True)
font = FontProperties()
font.set_size(20)
#------------------------------------------------------
# ... | mostofi/wannier90 | examples/example33/kdotp_plot.py | Python | gpl-2.0 | 6,672 | 0.02473 |
import redis
from django_rq import job
import logging
try:
import cPicle as pickle
except ImportError:
import pickle
logger = logging.getLogger(__name__)
@job('test')
def test_job(testcase):
result = testcase.defaultTestResult()
logger.info('Invoking {}'.format(testcase))
testcase.run(result)... | duct-tape/taped-tests | taped_tests/jobs.py | Python | bsd-3-clause | 563 | 0 |
# This code is part of Wakka.
# Wakka is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Wakka is distributed in the hope that it will... | mayankjohri/wakka-package-manager | wakkacore/terminal.py | Python | gpl-2.0 | 3,148 | 0.006036 |
from __future__ import print_function
from CompyledFunc import CompyledFunc
from copy import copy as shallowcopy, deepcopy
from frozendict import frozendict
from HelpyFuncs.Dicts import combine_dict_and_kwargs, merge_dicts_ignoring_dup_keys_and_none_values
from HelpyFuncs.SymPy import sympy_allclose, sympy_xreplac... | MBALearnsToCode/PyMathFunc | MathFunc/__init__.py | Python | mit | 13,313 | 0.002704 |
class Size(object):
def __init__(self, client_id="", api_key=""):
self.client_id = client_id
self.api_key = api_key
self.name = None
self.id = None
self.memory = None
self.cpu = None
self.disk = None
self.cost_per_hour = None
self.cost_per_mon... | lertech/extra-addons | network/model/digitalocean/Size.py | Python | gpl-3.0 | 330 | 0 |
'''
Created on Oct 4, 2016
@author: pjmartin (but mostly the Google TF tutorial site)
'''
import tensorflow as tf
# variable declaration helper functions
# Make the weight variables be a little noisy around 0.0.
def weight_variable(shape, var_name):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variabl... | drpjm/udacity-mle-project5 | src/tfhelpers.py | Python | mit | 2,195 | 0.010934 |
def resample_to_1km( x, template_raster_mask ):
'''
template_raster_mask should be a mask in in the res/extent/origin/crs of the
existing TEM IEM products.
'''
import rasterio, os
from rasterio.warp import RESAMPLING, reproject
import numpy as np
fn = os.path.basename( x )
fn_split = fn.split( '.' )[0].split... | ua-snap/downscale | snap_scripts/old_scripts/tem_iem_older_scripts_april2018/tem_inputs_iem/old_code/crop_mask_resample_to_iem.py | Python | mit | 6,482 | 0.039185 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/policy_set_result.py | Python | mit | 1,252 | 0.000799 |
import os, re, traceback
from dirtree_node import get_file_info
from util import is_text_file
class SearchAborted(Exception):
pass
def null_filter(info):
return True
class Search(object):
def __init__(self, path, match, output, file_filter=null_filter, dir_filter=null_filter):
self.path = path
... | shaurz/devo | search.py | Python | mit | 3,549 | 0.002254 |
# -*- coding: utf-8 -*-
# -*- mode: python -*-
"""Sources of random data
Copyright (C) 2013 Dan Meliza <dmeliza@uchicago.edu>
Created Wed May 29 14:50:02 2013
"""
from mspikes import util
from mspikes.types import DataBlock, Source, Node, tag_set
from numpy.random import RandomState
class rand_samples(Source):
... | melizalab/mspikes | mspikes/modules/random_sources.py | Python | gpl-3.0 | 1,590 | 0.006918 |
# coding: utf-8
"""
Routines for printing a report.
"""
from __future__ import print_function, division, absolute_import
import sys
from collections import namedtuple
from contextlib import contextmanager
import textwrap
from .adapters import BACK, FRONT, PREFIX, SUFFIX, ANYWHERE
from .modifiers import QualityTrimmer,... | Chris7/cutadapt | cutadapt/report.py | Python | mit | 10,176 | 0.025649 |
#! /usr/bin/env python
# encoding:utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import logging
import random
import multiprocessing
import numpy as np
import sklearn
from sklearn.naive_bayes import MultinomialNB
from sklearn.cross_validation import train_test_split
from sklearn.feature_... | silbertmonaphia/ml | co/20170212/test.py | Python | gpl-3.0 | 5,721 | 0.006817 |
import linuxdvb
import fcntl
fefd = open('/dev/dvb/adapter0/frontend0', 'r+')
# Information
feinfo = linuxdvb.dvb_frontend_info()
fcntl.ioctl(fefd, linuxdvb.FE_GET_INFO, feinfo)
print feinfo.name
for bit, flag in linuxdvb.fe_caps.items():
if (feinfo.caps & bit) > 0:
print("cap = "+flag)
# Close
fefd.clos... | koodilehto/kryptoradio-xmit-tests | receiver/adapter_info.py | Python | mit | 324 | 0 |
#!/usr/bin/env python
import unittest
from textwrap import dedent, indent
from unittest_helpers import FIXTURE_DIR, load_fixture
# NOTE: This test file file only works with scripts/ added to PYTHONPATH so pylint can't find the imports
# pragma pylint: disable=import-error
from isolate_tests import extract_solidity_... | ethereum/solidity | test/scripts/test_isolate_tests.py | Python | gpl-3.0 | 3,398 | 0.002943 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth.models import User
from django.shortcuts import reverse
from django.test import TestCase
from rest_framework.test import APIClient
from ...views.index_views import user_login
from app.models import TheUser
# ------------... | OlegKlimenko/Plamber | api/tests/test_views/test_index.py | Python | apache-2.0 | 8,371 | 0.004778 |
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
from __future__ import absolute_import
import logging
import os
import urwid
from urwidtrees import ArrowTree, TreeBox, NestedTree
fr... | geier/alot | alot/buffers.py | Python | gpl-3.0 | 24,285 | 0 |
"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Verisure s... | nkgilley/home-assistant | homeassistant/components/verisure/switch.py | Python | apache-2.0 | 2,311 | 0.000433 |
from radical.ensemblemd import Kernel
from radical.ensemblemd import Pipeline
from radical.ensemblemd import EnsemblemdError
from radical.ensemblemd import SingleClusterEnvironment
#Used to register user defined kernels
from radical.ensemblemd.engine import get_engine
#Import our new kernel
from new_kernel import MyU... | radical-cybertools/ExTASY | doc/scripts/user_script.py | Python | mit | 1,886 | 0.008484 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from services.application import ApplicationService
from services.application_access import ApplicationAccessService
import tornado.web
from tornado import gen
import tornado.escape
import json
from util.rabbitmq import send_message
from stormed import Message
import settin... | liuhong1happy/DockerConsoleApp | views/application.py | Python | apache-2.0 | 6,294 | 0.016378 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'MentionedEvent'
db.delete_table(u'sentry_hipchat_ac_men... | getsentry/sentry-hipchat-ac | sentry_hipchat_ac/migrations/0002_auto__del_mentionedevent.py | Python | apache-2.0 | 9,514 | 0.007988 |
exts_list = [
('lattice', '0.20-35', cran_options),
('nlme', '3.1-131.1', cran_options),
('Matrix', '1.2-12', cran_options),
('mgcv', '1.8-26', cran_options),
('plotfunctions', '1.3', cran_options),
('itsadug', '2.3', cran_options),
('abind', '1.4-5', cran_options),
('acepack', '1.4.1', ... | npklein/easybuild-easyconfigs | easybuild/easyconfigs/r/RPlus/find_missing_extensions.py | Python | gpl-2.0 | 27,561 | 0.000109 |
import numpy as np
# Loading and existing file
arr = np.loadtxt('somefile.txt')
# Saving a new file
np.savetxt('somenewfile.txt', arr)
# Opening an existing file with the append option
f = open('existingfile.txt', 'a')
# Creating some random data to append to the existing file
data2append = np.random.rand(100)
# W... | ebressert/ScipyNumpy_book_examples | python_examples/numpy_231_ex2.py | Python | mit | 420 | 0 |
from icash import *
from jflow.utils.observer import lazyvalue
class singlecash(icash):
'''
Simple cash flow.
Date, currency and dummy implementation
'''
def __init__(self, date = None, dummy = False, ccy = None):
self.__date = date
if self.__date == None:
... | lsbardel/flow | flow/finance/cashflow/cash.py | Python | bsd-3-clause | 1,829 | 0.02187 |
#!python
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 25 22:38:43 2014
@author: dave
"""
import os
#from argparse import ArgumentParser
import argparse
import paramiko
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("script", help="python script to execute")
parser.a... | davidovitch/prepost-wind-dlc | cluster-tools/run-node.py | Python | gpl-3.0 | 843 | 0.003559 |
# 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... | eadgarchen/tensorflow | tensorflow/contrib/estimator/python/estimator/extenders_test.py | Python | apache-2.0 | 10,770 | 0.00585 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Huyuwei/tvm | python/tvm/hybrid/preprocessor.py | Python | apache-2.0 | 4,765 | 0.005247 |
def build_models(payment_class):
return []
| dekoza/django-getpaid | getpaid/backends/transferuj/models.py | Python | mit | 47 | 0 |
# Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.
R"""DEM pair potentials.
"""
import hoomd
import hoomd.md
import hoomd.md.nlist as nl
from math import sqrt
import json
from hoomd.dem import _dem
from hoomd.de... | joaander/hoomd-blue | hoomd/dem/pair.py | Python | bsd-3-clause | 15,876 | 0.001386 |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | mdworks2016/work_development | Python/05_FirstPython/Chapter9_WebApp/fppython_develop/lib/python3.7/site-packages/zope/interface/tests/test_verify.py | Python | apache-2.0 | 19,156 | 0.00047 |
# -*- coding: utf-8 -*-
gettext("""La “Biblioteca Multimedia” es el lugar desde donde se clasifican nuestros contenidos multimedia, es decir, todo lo que es imágenes, audios, videos, documentos, etc. que luego podremos relacionar entre sí y con artículos, y tendrán vistas HTML en nuestro sitio web.""")
| MauHernandez/cyclope | demo/cyclope_project/locale/dbgettext/articles/article/como-funciona-la-biblioteca-biblioteca-multimedia/summary.py | Python | gpl-3.0 | 312 | 0.003289 |
#!/usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-admin-get-site-mask
# Author : Stuart Paterson
########################################################################
__RCSID__ = "$Id$"
from DIRAC.Core.Base import Script
Script.setUsageMe... | Sbalbp/DIRAC | Interfaces/scripts/dirac-admin-get-site-mask.py | Python | gpl-3.0 | 781 | 0.020487 |
from conda_env.print_env import print_env
import os
import textwrap
import unittest
class EnvironmentAndAliasesTestCase(unittest.TestCase):
ENVIRONMENT = [
{'PATH' : ['mypath1', 'mypath2']},
{'PATH' : ['mypath3']},
{'ANY_LIST_REALLY' : ['something1', 'something2']},
{'SINGLE_VAR' ... | ESSS/conda-env | tests/test_print_env.py | Python | bsd-3-clause | 4,520 | 0.002655 |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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 2.1 of the License,... | hipnusleo/laserjet | resource/pypi/paramiko-2.1.1/paramiko/kex_group1.py | Python | apache-2.0 | 5,689 | 0.001055 |
# testing/assertsql.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from ..engine.default import DefaultDialect
from .. import util
import re
impor... | wildchildyn/autism-website | yanni_env/lib/python3.6/site-packages/sqlalchemy/testing/assertsql.py | Python | gpl-3.0 | 12,590 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from django.core.exceptions import ValidationError
from machina.apps.forum.signals import forum_moved
from machina.core.db.models import get_model
from machina.test.context_managers import mock_signal_receiver
from machina.test.factories i... | franga2000/django-machina | tests/unit/forum/test_models.py | Python | bsd-3-clause | 5,012 | 0.001197 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
os.environ.setdefault("DJANGO_CONFIGURATION", "Production")
from configurations.management import execute_from_command_line
execute_from_command_line(sys.argv)
| oscarmcm/AlzoMiVoz | alzomivoz/manage.py | Python | mit | 316 | 0 |
from auth import authenticate
import sample_upload
def check():
asdf = auth.authenticate()
return asdf
check()
| LockScreen/Backend | test.py | Python | mit | 121 | 0.016529 |
"""
[2017-10-26] Challenge #337 [Intermediate] Scrambled images
https://www.reddit.com/r/dailyprogrammer/comments/78twyd/20171026_challenge_337_intermediate_scrambled/
#Description
For this challenge you will get a couple of images containing a secret word, you will have to unscramble the images to
be able to read th... | DayGitH/Python-Challenges | DailyProgrammer/DP20171026B.py | Python | mit | 1,315 | 0.006844 |
""" Integration test: permit call
"""
import os
import sys
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../../')
import logging
import nose
from nose.tools import *
import inte_testutils
from telewall.core.model import TelephoneNumber
from telewall.core.util import sleep_until... | synox/telewall | telewall/telewall/integrationtests/test_InT01.py | Python | gpl-3.0 | 1,091 | 0.007333 |
#-------------------------------------------------------------------------------
# htmlize-ast-dump.py: Turn a Clang AST dump (-ast-dump) into cross-linked HTML.
#
# Run with --help for usage information.
#
# Note: this script requires Python 3.4; earlier versions of Python 3 should
# work if you install the enum34 mod... | eliben/llvm-clang-samples | tools/htmlize-ast-dump.py | Python | unlicense | 13,724 | 0.000874 |
from seamless import context, cell, transformer, reactor
from seamless.lib import edit, display, link
from seamless.lib.gui.gl import glprogram, glwindow
import numpy as np
from scipy.spatial.distance import cdist
ctx = context()
ctx.params = context()
ctx.links = context()
ctx.code = context()
#for now, gen_sphere ... | sjdv1982/seamless | docs/archive/0.2-cleanup/3D/test-sphere.py | Python | mit | 7,136 | 0.002522 |
"""
Default statement functions.
"""
from muddery.statements.statement_func_set import BaseStatementFuncSet
import muddery.statements.action as action
import muddery.statements.condition as condition
import muddery.statements.attribute as attribute
import muddery.statements.rand as rand
import muddery.statements.skill... | MarsZone/DreamLand | muddery/statements/default_statement_func_set.py | Python | bsd-3-clause | 1,790 | 0 |
import pytest
from nbformat.v4 import new_notebook, new_output
from ...preprocessors import SaveCells, SaveAutoGrades
from ...api import Gradebook
from ...utils import compute_checksum
from .base import BaseTestPreprocessor
from .. import (
create_grade_cell, create_grade_and_solution_cell, create_solution_cell)
... | ellisonbg/nbgrader | nbgrader/tests/preprocessors/test_saveautogrades.py | Python | bsd-3-clause | 8,576 | 0.001632 |
def create_graph(contents):
"""
if you are given a -1 then it does not point to anything.
"""
d = {}
for i in xrange(len(contents)):
d[i] = int(contents[i])
return d
def _cycle(graph, key, stack, stacks):
# print graph, key, stack
if ( key , graph[key] ) in stack: # you have found a cycle
stacks.append(sta... | baallezx/rsp | devtest/q3/3.py | Python | apache-2.0 | 990 | 0.061616 |
import logging
import os
import shutil
import requests
from requests.exceptions import ConnectionError
logger = logging.getLogger(__name__)
class ExistingTransferInProgress(Exception):
pass
class TransferNotYetCompleted(Exception):
pass
class TransferCanceled(Exception):
pass
class TransferNotYetC... | lyw07/kolibri | kolibri/core/content/utils/transfer.py | Python | mit | 6,229 | 0.001284 |
from django.db import models
#from django.contrib.auth.models import User
from django.conf import settings
import hashlib
import time, datetime
def _createHash():
hash = hashlib.sha1()
hash.update(str(time.time()))
return hash.hexdigest()[:-10]
# the dataset class stores parameters about the
class Data... | draperlaboratory/stout | op_tasks/models.py | Python | apache-2.0 | 5,396 | 0.004818 |
# MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from accelerator.models import UserRole
from impact.v1.events.base_user_became_mentor_event import (
BaseUserBecameMentorEvent,
)
class UserBecameDesiredMentorEvent(BaseUserBecameMentorEvent):
EVENT_TYPE = "became desired mentor"
USER_ROLE = UserRole... | masschallenge/impact-api | web/impact/impact/v1/events/user_became_desired_mentor_event.py | Python | mit | 362 | 0 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
#python proto2csv.py --proto_file=/tmp/logs/minitaur_log_2019-01-27-12-59-31 --csv_file=/tmp/logs/out.csv
#each line in csv contains: angle, velocity, action, torque
import tensorflow as tf
import argparse
imp... | MadManRises/Madgine | shared/bullet3-2.89/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/proto2csv.py | Python | mit | 1,333 | 0.020255 |
"""Tests for egta online scheduler"""
import asyncio
import contextlib
import random
import numpy as np
import pytest
from egtaonline import api
from egtaonline import mockserver
from gameanalysis import rsgame
from egta import countsched
from egta import eosched
# TODO general setup may be done with a fixture in p... | egtaonline/quiesce | test/test_eosched.py | Python | apache-2.0 | 6,888 | 0.003049 |
import config
from git import Repository
import os
import yaml
from fnmatch import fnmatch
class Role:
@classmethod
def tree(cls, repository):
return RoleFactory(repository).tree()
@classmethod
def clear(cls, repository):
return RoleFactory(repository).clear()
def __init__(self, n... | iamdork/dork | dork/matcher.py | Python | mit | 7,851 | 0.001019 |
##############################################################################
# Copyright (c) 2013-2017, 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... | wscullin/spack | var/spack/repos/builtin.mock/packages/extendee/package.py | Python | lgpl-2.1 | 1,547 | 0.000646 |
#!/usr/bin/env python
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | firebase/grpc | tools/github/pr_latency.py | Python | apache-2.0 | 6,848 | 0.001606 |
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
import xml.etree.ElementTree as etree
from xml.dom import minidom
import io
"""
using xml.etree.ElementTree
"""
def prettify(elem):
"""Return a pretty-printed XML string for the Element.
"""
rough_string = etree.tostr... | hoaibang07/Webscrap | sources/xmldemo/xmlcreate.py | Python | gpl-2.0 | 731 | 0.005472 |
# Canto rsync Plugin
# by Jack Miller
# v1.1
# This implements a lightweight remote sync based around rsync to a remote
# server, or copying to mounted filesystem, etc.
ENABLED = False
#ENABLED = True
# SSH
# For ssh based rsync (remote hosts) you should have key authentication setup
# so it runs without prompting f... | themoken/canto-next | plugins/sync-rsync.py | Python | gpl-2.0 | 11,388 | 0.005444 |
import operator
def pozicijaSprite(broj, x_velicina):
#vraca pixel na kojem se sprite nalazi
pixel = broj * (x_velicina + 1) #1 je prazan red izmedu spritova
return(pixel)
#spriteSlova = ["A", "B", "C", "D", "E", "F", "G", "H", "i", "s", "e"]
spriteSlova = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "s", ",",... | bebox/lhp | source/lhpFunctions.py | Python | unlicense | 6,564 | 0.043419 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class SpankBangIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/video'
_TESTS = [{
'url': 'http://spankbang.com/3vvn/video/fantasy+solo',
'md5': '1cc433e1d6aa1... | linglung/ytdl | youtube_dl/extractor/spankbang.py | Python | unlicense | 2,167 | 0.001384 |
# :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import pytest
from lucidity import Template, Resolver
from lucidity.error import ParseError, FormatError, ResolveError
class ResolverFixture(Resolver):
'''Example resolver.'''
def __init__(self, template... | BigRoy/lucidity | test/unit/test_template.py | Python | apache-2.0 | 12,561 | 0.001672 |
#!/usr/bin/python
# -*- coding: utf-8; -*-
#
# Copyright (c) 2009 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 copyrigh... | fishpepper/OpenSky | stylecheck/cpplint_unittest.py | Python | gpl-3.0 | 228,992 | 0.002559 |
from inventory import Inventory
import cmd
from room import get_room
from player import Player
import textwrap
import time
import random
class Controls(cmd.Cmd):
prompt = '> '
def __init__(self):
#-----------------------------------------------------------------------
#Here the game is initialized asking for... | kevin2314/TextGame | game/main.py | Python | mit | 4,805 | 0.019771 |
# Generated by Django 2.0.6 on 2018-08-31 10:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('iati', '0030_auto_20180831_1001'),
]
operations = [
migrations.RemoveField(
model_name='resultindicatorperiodtargetdimension',
... | openaid-IATI/OIPA | OIPA/iati/migrations/0031_remove_resultindicatorperiodtargetdimension_result_indicator_period.py | Python | agpl-3.0 | 372 | 0 |
###############################################################################
# ____ _ _ _ ____ _ _ #
# | _ \ __ _ _ __| |_(_) ___| | ___/ ___|| |_ __ _| |_ ___ #
# | |_) / _` | '__| __| |/ __| |/ _ \___ \| __/ _` | __/ __| #
... | darogan/ParticleStats | setup.py | Python | gpl-3.0 | 3,803 | 0.012885 |
# Copyright (c) 2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/third_party/boto/boto/dynamodb/types.py | Python | gpl-3.0 | 10,121 | 0 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/bert_extraction/steal_bert_classifier/utils/preprocess_distill_input_watermark.py | Python | apache-2.0 | 5,277 | 0.006822 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
__author__ = 'Anubhav Jain'
__copyright__ = 'Copyright 2014, The Materials Project'
__version__ = '0.1'
__maintainer__ = 'Anubhav Jain'
__email__ = 'ajain@lbl.gov'
__date__ = 'Oct 03, 2014'
| fraricci/pymatgen | pymatgen/analysis/cost/__init__.py | Python | mit | 300 | 0 |
#! /usr/bin/env python
"""! @package morphosyntax
"""
from utils.attr import check_attr_type, check_attr_range
from common.range import paradigmLabel_range
from config.mdf import pdl_paradigmLabel
class Paradigm():
"""! Paradigm is a class representing a morphological paradigm.
"""
def __init__(self):
... | buret/pylmflib | pylmflib/morphosyntax/paradigm.py | Python | gpl-2.0 | 3,401 | 0.00147 |
"""
Tests for Algorithms using the Pipeline API.
"""
from unittest import TestCase
from os.path import (
dirname,
join,
realpath,
)
from nose_parameterized import parameterized
from numpy import (
array,
arange,
full_like,
float64,
nan,
uint32,
)
from numpy.testing import assert_alm... | ChinaQuants/zipline | tests/pipeline/test_pipeline_algo.py | Python | apache-2.0 | 19,784 | 0.000051 |
# -*- encoding: utf-8 -*-
import re
import decimal
from xml.etree.cElementTree import fromstring, tostring
from xml.etree.cElementTree import Element, iselement
from authorize import responses
API_SCHEMA = 'https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd'
API_SCHEMA_NS = "AnetApi/xml/v1/schema/AnetApiSchem... | simplegeo/authorize | authorize/gen_xml.py | Python | mit | 17,930 | 0.004964 |
#!/usr/bin/env python
import commands, sys
# Get path of the toolbox
status, path_sct = commands.getstatusoutput('echo $SCT_DIR')
# Append path that contains scripts, to be able to load modules
sys.path.append(path_sct + '/scripts')
from msct_parser import Parser
from nibabel import load, save, Nifti1Image
import ... | 3324fr/spinalcordtoolbox | dev/sct_detect_spinalcord/sct_get_centerline_from_labels.py | Python | mit | 5,974 | 0.01473 |
# 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... | zozo123/buildbot | master/buildbot/test/unit/test_db_schedulers.py | Python | gpl-3.0 | 14,846 | 0.000741 |
# Copyright 2013-2015 ARM Limited
#
# 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 w... | chase-qi/workload-automation | wlauto/instrumentation/misc/__init__.py | Python | apache-2.0 | 17,103 | 0.003859 |
#!/usr/bin/env python
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | zhaochao/fuel-web | network_checker/network_checker/net_check/api.py | Python | apache-2.0 | 25,801 | 0.000504 |
# coding=utf-8
from plone import api
from plone.tiles.interfaces import IBasicTile
from ploneintranet.workspace.browser.tiles.sidebar import Sidebar
from ploneintranet.workspace.browser.tiles.sidebar import \
SidebarSettingsMembers
from ploneintranet.workspace.tests.base import BaseTestCase
from zope.component impo... | ploneintranet/ploneintranet.workspace | src/ploneintranet/workspace/tests/test_sidebar.py | Python | gpl-2.0 | 4,580 | 0 |
#!/usr/bin/env python
"""
test cache functions.
- save/load
- mmerge
"""
import unittest
import trustlet.igraphXdigraphMatch as IXD
import networkx as nx
import igraph
import os
#import sys
#import random
#import time
class TestIXD(unittest.TestCase):
def setUp(self):
self.g = IXD.XDiGraph()
self.g.add_edge('da... | guaka/trust-metrics | trustlet/unittest/testXDiGraph.py | Python | gpl-2.0 | 3,116 | 0.08344 |
#! /usr/bin/env python
import os
import sys
from dateutil import parser
BACK_LOG_SIZE = 14
if len(sys.argv) > 1:
print "This script deletes all but the " + str(BACK_LOG_SIZE) +" newest logs generated by the uploader."
print "It prints this message when run with any parameters. None are required."
sys.exit()
st... | jirikadlec2/rushvalley | python/clean_logs.py | Python | mit | 964 | 0.030083 |
"""
The outputs.py module represents some form of all outputs
from the Automater program to include all variation of
output files. Any addition to the Automater that brings
any other output requirement should be programmed in this module.
Class(es):
SiteDetailOutput -- Wrapper class around all functions that print out... | CSIRTUK/TekDefense-Automater | outputs.py | Python | mit | 39,375 | 0.007289 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | rsepassi/tensor2tensor | tensor2tensor/models/xception.py | Python | apache-2.0 | 5,805 | 0.010336 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os, time
from cutout import cutout
datastr = '''
<html>
<head>
<title>html网页标题</title>
</head>
<body>
<ul id="img">
<li> <p>pic1</p> <img src="/img/pic1.jpg" /> </li>
<li> <p>pic... | yangjiePro/cutout | example.py | Python | mit | 4,408 | 0.030525 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/batchai/azure-mgmt-batchai/azure/mgmt/batchai/aio/operations/_jobs_operations.py | Python | mit | 44,498 | 0.005371 |
#import matplotlib.pyplot as plt
import numpy as np
from collections import deque
import numbers
"""
Created on Jun 29, 2016
@author: hans-werner
"""
def convert_to_array(x, dim=None, return_is_singleton=False):
"""
Convert point or list of points to a numpy array.
Inputs:
x: (list of)... | hvanwyk/quadmesh | src/mesh.py | Python | mit | 263,904 | 0.010803 |
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# Copyright 2017 Creu Blanca
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
from odoo import api, fields, models, modules
class MedicalPractitioner(models.Model):
_name = '... | OCA/vertical-medical | medical_practitioner/models/medical_practitioner.py | Python | gpl-3.0 | 1,734 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
try:
from configparser import RawConfigParser
except ImportError:
from ConfigParser import RawConfigParser
import glob
import os
import shutil
import subprocess
import sys
config = RawConfigParser(allow_no_value=True)
config... | gridsync/gridsync | scripts/make_appimage.py | Python | gpl-3.0 | 4,585 | 0.000218 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
nmap.py - version and date, see below
Source code : https://bitbucket.org/xael/python-nmap
Author :
* Alexandre Norman - norman at xael.org
Contributors:
* Steve 'Ashcrow' Milner - steve at gnulinux.net
* Brian Bustin - brian at bustin.us
* old.schepperhand
* Joha... | VillanCh/vscanner | vplugin/nmap/nmap.py | Python | apache-2.0 | 41,045 | 0.004629 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | nkhare/rockstor-core | src/rockstor/storageadmin/urls/users.py | Python | gpl-3.0 | 1,027 | 0.000974 |
import unittest
import obdlib.utils as utils
class TestUtils(unittest.TestCase):
def setUp(self):
utils.unit_english = 0
def test_rpm(self):
assert utils.rpm('0000') == 0.0
assert utils.rpm('FFFF') == 16383.75
def test_speed(self):
# unit_english == 0
self.assertE... | QualiApps/obdlib | tests/test_utils.py | Python | mit | 6,692 | 0.000299 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_versions_delete_version_async.py | Python | apache-2.0 | 1,427 | 0.000701 |
import os
from .views import blueprint
@blueprint.app_context_processor
def inject_permissions():
show_labsys = not os.environ.get('SHOW_LABSYS') == 'False'
return dict(show_labsys=show_labsys)
| gems-uff/labsys | labsys/main/__init__.py | Python | mit | 206 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-10 18:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0006_auto_20160616_1640'),
]
operations = [
migrations.AlterField(
... | xfxf/veyepar | dj/main/migrations/0007_auto_20160710_1833.py | Python | mit | 560 | 0.001786 |
import hashlib
def hash_all(strs):
"""Returns a hash of the concatenation of all the strings in strs."""
sha = hashlib.sha1()
for s in strs:
sha.update(s)
return sha.hexdigest()
| foursquare/commons-old | src/python/twitter/pants/base/hash_utils.py | Python | apache-2.0 | 192 | 0.026042 |
import discord
from discord.ext import commands
from .utils.chat_formatting import escape_mass_mentions, italics, pagify
from random import randint
from random import choice
from enum import Enum
from urllib.parse import quote_plus
import datetime
import time
import aiohttp
import asyncio
settings = {"POLL... | jicruz/heroku-bot | cogs/general.py | Python | gpl-3.0 | 17,226 | 0.002979 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import request
from indico.modules.oauth.controllers import (RHOAuthAdmin, RHOAuthAdminApplica... | pferreir/indico | indico/modules/oauth/blueprint.py | Python | mit | 2,547 | 0.006675 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | mfem/PyMFEM | mfem/_par/eltrans.py | Python | bsd-3-clause | 26,581 | 0.007148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.