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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2017 GiovanniMCMXCIX
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, co... | GiovanniMCMXCIX/async-connect.py | tests/test_get_all_catalog.py | Python | mit | 2,905 |
#!/usr/bin/env python
# Copyright 2016 Vimal Manohar
# 2016 Xiaohui Zhang
# Apache 2.0.
# we're using python 3.x style print but want it to work in python 2.x,
from __future__ import print_function
import argparse
import sys
class StrToBoolAction(argparse.Action):
""" A custom action to convert bools... | michellemorales/OpenMM | kaldi/egs/wsj/s5/steps/dict/prons_to_lexicon.py | Python | gpl-2.0 | 7,717 |
from helpers import NavItemTypeError, AbstractNavItem, LinkItem
class Div(object):
children = []
def add_children(self, children):
not_allowed = filter(lambda child: not issubclass(type(child), self.child_type), children)
if not_allowed:
raise NavItemTypeError("Unsupported Navigat... | bingorabbit/django-toffee | toffee/ui.py | Python | bsd-3-clause | 1,280 |
"""
Config module
.. versionchanged:: 0.5
The function set_default_options was removed. To achieve the same behaviour,
set a module-level dict called "DEFAULT_OPTIONS" where the keys are the
option names and the values are the default values in your plugin.
"""
import logging
from appdirs import user_config_dir
from... | mineo/lala | lala/config.py | Python | mit | 4,962 |
from patapy import render_text_table
from methods import Method, MethodResult
class MyMethod(Method):
name = 'my analysis method'
help = ''
def run(self, experiment):
pass
class MyResult(MethodResult):
columns = ['score', 'p_value']
class ResultRow:
def __init__(self, score, p_value... | kn-bibs/pathways-analysis | tests/test_run.py | Python | mit | 955 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Condition.condtion_data'
db.delete_column(u'server_condition', 'condtion_data')
#... | salsoftware/sal | server/migrations/0015_auto__del_field_condition_condtion_data__add_field_condition_condition.py | Python | gpl-3.0 | 10,306 |
#!/usr/bin/python
# *****************************************************************************
#
# Copyright (c) 2016, EPAM SYSTEMS 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
#
#... | epam/DLab | integration-tests/examples/scenario_tensor/tensor_tests.py | Python | apache-2.0 | 3,794 |
s3gis_tests = load_module("tests.unit_tests.modules.s3.s3gis")
def test_GeoJSONLayer():
s3gis_tests.layer_test(
db,
db.gis_layer_geojson,
dict(
name = "Test GeoJSON",
description = "Test GeoJSON layer",
enabled = True,
created_on = datetime.d... | devinbalkind/eden | tests/unit_tests/modules/s3/s3gis/GeoJSONLayer.py | Python | mit | 812 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011 Kévin Gomez <contact@kevingomez.fr>
#
# 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 withou... | K-Phoen/GigaDl | gigadl/result/MegaResult.py | Python | mit | 1,414 |
#!/usr/bin/env python3
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''
Sets up githooks.
'''
import os
import subprocess
import sys
SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.... | flutter/engine | tools/githooks/setup.py | Python | bsd-3-clause | 852 |
# 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... | jwlawson/tensorflow | tensorflow/contrib/receptive_field/python/util/receptive_field.py | Python | apache-2.0 | 23,712 |
# Copyright 2015: Mirantis Inc.
# 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 b... | go-bears/rally | tests/unit/plugins/openstack/scenarios/murano/test_environments.py | Python | apache-2.0 | 3,933 |
import pathlib
from ...helpers import article
from .._helpers import _read, register
source = article(
authors=["Linbo Zhang", "Tao Cui", "Hui Liu"],
title="A set of symmetric quadrature rules on triangles and tetrahedra",
journal="Journal of Computational Mathematics",
volume="27",
number="1",
... | nschloe/quadpy | src/quadpy/t2/_zhang_cui_liu/__init__.py | Python | mit | 793 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# cellulist documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# a... | eddiejessup/cellulist | docs/conf.py | Python | bsd-3-clause | 8,421 |
# 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 | contrack/preprocess.py | Python | apache-2.0 | 14,924 |
#!/usr/bin/env python
"""
Usage: genrandt.py [-p] [-i FILE] [-t N] [-g G] [-b] [H W]
will generate a random gridworld of the height H and width W (default
is 5 by 10), with N trolls (default 1) at random positions, G goals
(default 2) at random positions, and dump the resulting specification.
Troll region radii are s... | pombredanne/nTLP | examples/gridworlds/genrandt.py | Python | bsd-3-clause | 2,809 |
from __future__ import division
from __future__ import unicode_literals
from builtins import range
from past.utils import old_div
import hashlib
import os
import random
import string
import tempfile
import re
import time
import urllib
from datetime import datetime
from datetime import timedelta
from elodie.compatabil... | jmathai/elodie | elodie/tests/helper.py | Python | apache-2.0 | 5,170 |
import mock
from unittest import TestCase
from pantsmud.driver import hook, session
from pantsmud.util import error
class TestSessionClass(TestCase):
def setUp(self):
self.session = session.Session(mock.MagicMock())
self.session.environment = mock.MagicMock()
self.identity = mock.MagicMock... | ecdavis/pantsmud | test/pantsmud/driver/test_session.py | Python | apache-2.0 | 4,484 |
# Copyright 2021 The TF-Coder Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | google-research/tensorflow-coder | tf_coder/value_search/filtered_values_cache_test.py | Python | apache-2.0 | 1,986 |
#
# Create the WP1 Graphics ROM.
#
# The original spec allowed for 64 ASCII characters (6 bit ASCII) only. I have extended
# this with something allowing 32x24 pixel resolution, and some graphics characters which
# come from a mixture of the Superboard II/UK101 Character ROM, and the Sharp MZ80K Rom
#
# At present, ch... | paulscottrobson/wallpaper-one | miscellany/font/process.py | Python | mit | 4,698 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | RealImpactAnalytics/airflow | airflow/default_login.py | Python | apache-2.0 | 2,618 |
#!/usr/bin/env python
################################################################################
# Copyright 2015 Brecht Baeten
# This file is part of mpcpy.
#
# mpcpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# th... | BrechtBa/mpcpy | tests/emulator.py | Python | gpl-3.0 | 1,982 |
# Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http... | rest-of/the-deck | lambda/lib/python2.7/site-packages/botocore/session.py | Python | mit | 37,568 |
from core.entities import DefaultRaceEntity
class DwarfRaceEntity(DefaultRaceEntity):
def __init__(self):
super(DwarfRaceEntity, self).__init__()
self.set_ability_score(constitution=2, wisdom=2)
| jklemm/py-dnd | core/entities/dwarf_race_entity.py | Python | mit | 217 |
"""
.. moduleauthor:: Gilbert Maitre <gilbert.maitre@hevs.ch>
"""
from enum import Enum
from gridsim.decorators import accepts
from gridsim.core import AbstractSimulationElement
from gridsim.unit import units
from gridsim.util import Position
class AbstractElectricalElement(AbstractSimulationElement):
@accepts... | gridsim/gridsim | gridsim/electrical/core.py | Python | gpl-3.0 | 11,459 |
from spym.generic import Spm_image, load_from_gsf
import matplotlib.pyplot as plt
import numpy as np
from spym.indentation import Indenter_orientation
file_name = 'wg_berk-0deg_n2_6um_000_TR.gsf'
#file_name = 'BMG8-zr60cu30al10_375c_10mN_6um_000_TR.gsf'
image =load_from_gsf(file_name)
image.change_z_unit('nm')
image.c... | lcharleux/spym | doc/example_code/generic/Spm_image-section.py | Python | gpl-2.0 | 1,326 |
from unittest import TestCase
from mock import Mock
from mock import MagicMock
from mock import patch
from employee import Employee
from data import list_employees
def my_employee():
return [{
"id":"1",
"employee_name":"testing",
"employee_salary":"1",
"employee_age":"1",
... | rolandovillca/python_basis | unittest_mocks/test_employee.py | Python | mit | 1,306 |
# Copyright 2014 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | blueboxgroup/neutron | neutron/agent/metadata/driver.py | Python | apache-2.0 | 5,140 |
import os
import tempfile
configdir = os.path.abspath(os.path.dirname(__file__))
basedir = os.path.dirname(configdir)
tempdir = tempfile.gettempdir()
FIGSHARE_CALLBACK_URI = 'http://localhost:5000/callback'
# These articles appear in the dashboard if the user did not authenticate with Figshare
FIGSHARE_PREVIEW_IDS =... | Data2Semantics/linkitup | linkitup/config.py | Python | mit | 1,597 |
# coding=utf-8
"""models.py
用于定义ORM中用到的类、关系及某些表中的初始数据及工具函数。
新建数据库时应该依次调用::
Role.insert_roles()
School.insert_school_structure()
Attributes:
"""
from __future__ import absolute_import, unicode_literals
from datetime import datetime
import tsxypy
from flask import current_app, url_for, abort
from flask_logi... | bllli/tsxyAssistant | app/models.py | Python | gpl-3.0 | 24,028 |
from django.db import models
from django.core.exceptions import ValidationError
from cyder.cydns.domain.models import Domain, _name_to_domain
from cyder.cydns.ip.models import Ip
from cyder.cydns.validation import validate_name
from cyder.cydns.mixins import ObjectUrlMixin
class PTR(Ip, ObjectUrlMixin):
"""A PTR... | ngokevin/cyder | cyder/cydns/ptr/models.py | Python | bsd-3-clause | 2,688 |
# -*- coding: utf-8 -*-
# Copyright 2022 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-video-stitcher | samples/generated_samples/videostitcher_v1_generated_video_stitcher_service_get_cdn_key_sync.py | Python | apache-2.0 | 1,467 |
#!/usr/bin/env python
# Copyright 2015 The PDFium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import difflib
import sys
def main(argv):
if len(argv) != 3:
print '%s: invalid arguments' % argv[0]
return 2
filename1 = ... | guorendong/iridium-browser-ubuntu | third_party/pdfium/testing/tools/text_diff.py | Python | bsd-3-clause | 823 |
# Copyright (c) 2018 PaddlePaddle 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 app... | chengduoZH/Paddle | python/paddle/fluid/tests/test_detection.py | Python | apache-2.0 | 22,717 |
# Copyright 2022 The Deluca Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | google/deluca | deluca/lung/utils/data/transform.py | Python | apache-2.0 | 1,238 |
# Copyright 2017 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 law or agreed to in writing, ... | GoogleCloudPlatform/training-data-analyst | courses/developingapps/v1.3/python/cloudstorage/start/quiz/gcp/storage.py | Python | apache-2.0 | 1,312 |
"""
=====================================================================
Decision boundary of label propagation versus SVM on the Iris dataset
=====================================================================
Comparison for decision boundary generated on iris dataset
between Label Propagation and SVM.
This demon... | chrsrds/scikit-learn | examples/semi_supervised/plot_label_propagation_versus_svm_iris.py | Python | bsd-3-clause | 2,391 |
from TestBase import TestBase
testfile = 'BIOV/cust_BIOV.20131112173319.ok'
class TestWorker(TestBase):
def setUp(self):
TestBase.setUp(self)
self.mc.src_cur = self.mc.src_main_dir+testfile
self.mc.keep_in_memory = True
self.mc.work()
first = self.mc.data_array.items()[0]... | groovehunter/xmlflat2db | test/TestWorker.py | Python | gpl-2.0 | 523 |
__author__ = 'baohua'
__doc__ = 'glance specific checks'
| yeasy/tripled | tripled/case/glance/__init__.py | Python | apache-2.0 | 57 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_pitchtools_Octave_from_pitch_name_01():
assert pitchtools.Octave.from_pitch_name("cs'") == 4
assert pitchtools.Octave.from_pitch_name('cs') == 3
assert pitchtools.Octave.from_pitch_name('cs,') == 2 | mscuthbert/abjad | abjad/tools/pitchtools/test/test_pitchtools_Octave_from_pitch_name.py | Python | gpl-3.0 | 267 |
import os
import re
import sys
import socket
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import configuration
import lib
SessionsMixin = lib.make_sessions_mixin([('otherrods', 'apass')], [('alice', 'password'), ('anonymous', None)])
class Test_Iticket(SessionsMixin, un... | janiheikkinen/irods | tests/pydevtest/test_iticket.py | Python | bsd-3-clause | 15,559 |
# 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... | naturali/tensorflow | tensorflow/contrib/rnn/python/kernel_tests/lstm_ops_test.py | Python | apache-2.0 | 11,637 |
#!/usr/bin/env python
import os
print('2.3')
os.system('mvn clean test')
| izrik/maven-auto-versioning-poc | build_script.py | Python | gpl-2.0 | 77 |
import subprocess
import os
class VM(object):
def __init__(self, vm_dict, iso_dir, work_dir, br_names):
self.name = vm_dict['name']
self.version = vm_dict['version']
self.start_port = vm_dict['port_list']['start_port']
self.end_port = vm_dict['port_list']['end_port']
self.co... | intfrr/Network_Topology | vm.py | Python | apache-2.0 | 1,991 |
from statsmodels.compat.python import (lrange, iterkeys, iteritems, lzip,
reduce, itervalues, zip, string_types,
range)
from statsmodels.compat.collections import OrderedDict
import numpy as np
import pandas as pd
import datetime
import textw... | hlin117/statsmodels | statsmodels/iolib/summary2.py | Python | bsd-3-clause | 19,583 |
# -*- coding: utf-8 -*-
try:
from django.conf.urls import patterns, include, url
except ImportError:
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'... | mateuspadua/django-pagseguro2 | testapp/testapp/urls.py | Python | mit | 419 |
import teneto
import pytest
import numpy as np
import pandas as pd
def test_errors():
# Make sure that only 1 of three different input methods is specified
with pytest.raises(ValueError):
teneto.TemporalNetwork(from_dict={}, from_array=np.zeros([2, 2]))
# Make sure error raised from_array if not a... | wiheto/teneto | test/classes/test_temporalnetwork.py | Python | gpl-3.0 | 7,833 |
import requests
import os
import re
import time
from selenium import webdriver
import multiprocessing
import sys
from socket import error as SocketError
import errno
import argparse
import imghdr
import uuid
import csv
import codecs
import platform
import downloader
# define default chrome download path
global default... | whcacademy/imageDownloader | googleImageDownload.py | Python | mit | 7,660 |
import click
from chakin.cli import pass_context, json_loads
from chakin.decorators import custom_exception, None_output
@click.command('export_fasta')
@click.argument("organism_id", type=int)
@click.option(
"--file",
help="If true, write to files in CWD",
is_flag=True
)
@pass_context
@custom_exception
@N... | abretaud/python-chado | chakin/commands/export/export_fasta.py | Python | mit | 503 |
import numpy as np
from os import environ, getenv
import sys
import matplotlib as mpl
mpl.use('cairo')
import matplotlib.pylab as pl
from matplotlib.colors import LogNorm
from matplotlib import pyplot as plt
import seaborn
DOPDF = True
## turn on/off gpu
def set_processor(name):
name = name.lower()
if na... | sidnarayanan/BAdNet | python/subtlenet/utils.py | Python | mit | 18,014 |
#!/usr/bin/python
import subprocess
import praw
import pyperclip
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
from base64 import b64decode
from ConfigParser import ConfigParser
import OAuth2Util
import ... | foobarbazblarg/stayclean | stayclean-2016-march/serve-challenge-with-flask.py | Python | mit | 10,622 |
def rigmarole(instr):
print("rigmarole %s" % instr)
i = 0
out = ""
while i < len(instr):
c1 = instr[i:i+2]
c2 = instr[i+2:i+4]
cc = int(c1,16) - int(c2, 16)
out += chr(cc)
# print("%s %s" % (c1, c2))
i += 4
return out
def ca... | gray-panda/grayrepo | 2020_flareon/04_report/soln.py | Python | gpl-2.0 | 2,149 |
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell
from tensorflow.models.rnn import seq2seq
import numpy as np
class Model():
def __init__(self, args, infer=False):
self.args = args
if infer:
args.batch_size = 1
args.seq_length = 1
if args.model ==... | DeepLearningProjects/poem-bot | model.py | Python | mit | 3,724 |
from endpoints_proto_datastore.ndb import EndpointsModel
from google.appengine.api import search
from google.appengine.ext import ndb
class Leadstatus (EndpointsModel):
_message_fields_schema = ('id','entityKey','created_at','updated_at','status','owner','organization')
owner = ndb.StringProperty()
organi... | ioGrow/iogrowCRM | crm/iomodels/leadstatuses.py | Python | agpl-3.0 | 1,390 |
##########################################################################
#
# Copyright 2008-2009 VMware, Inc.
# 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 withou... | surround-io/apitrace | specs/winapi.py | Python | mit | 6,000 |
#! /usr/bin/env python
from __future__ import absolute_import, print_function
"""
A sample implementation of a single coinjoin script,
adapted from `sendpayment.py` in Joinmarket-Org/joinmarket.
For notes, see scripts/README.md; in particular, note the use
of "schedules" with the -S flag.
"""
import random
import sys... | chris-belcher/joinmarket-clientserver | scripts/sendpayment.py | Python | gpl-3.0 | 9,275 |
import numpy as np
def sv_main(n_items=1500, q_factor_x=2, q_factor_y=2, seed=6, scale=100.0):
in_sockets = [
['s', 'n_items', n_items],
['s', 'q_factor_x', q_factor_x],
['s', 'q_factor_y', q_factor_y],
['s', 'seed', seed],
['s', 'scale', scale]]
np.random.seed(seed)
... | taxpon/sverchok | node_scripts/templates/zeffii/matrices.py | Python | gpl-3.0 | 804 |
# -*- coding: utf-8 -*-
import datetime
from django.utils.timezone import now
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
TYPE_CHOICES = {
'F': orm.Tag.objects.get_or_create(label='Feature', def... | mostateresnet/django-ticket | issues/migrations/0003_tags_apply.py | Python | mit | 6,862 |
#!/usr/bin/env python
import serial, sys
serialPort = sys.argv[1]
ser = serial.Serial(
port=serialPort,
baudrate=1200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS
)
ser.isOpen()
ser.close() # always close port
| arsh0r/heatmeter | heatmeter/reset.py | Python | mit | 270 |
"""setup.py"""
from setuptools import setup
with open("README.md") as readme_file:
README = readme_file.read()
test_requirements = ["mock", "pytest", "responses", "testfixtures", "requests", "pyzmq"]
# Async requirements
test_requirements.extend(["pytest-asyncio", "aiohttp", "tornado", "websockets"])
setup(
... | bcb/jsonrpcclient | setup.py | Python | mit | 1,595 |
# -*- coding: utf-8 -*-
"""
================================================
Following the Metal to Mott insulator Transition
================================================
Plot of the Quasiparticle weigth decay for the Hubbard
Model in the Bethe Lattice as the local interaction is raised.
"""
# Code source: Óscar ... | Titan-C/learn-dmft | examples/twosite/plot_halffill_z.py | Python | gpl-3.0 | 1,346 |
"""
SoftLayer.tests.managers.ipsec_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
from mock import MagicMock
import SoftLayer
from SoftLayer.exceptions import SoftLayerAPIError
from SoftLayer import testing
class IPSECTests(testing.TestCase):
def set_up(s... | nanjj/softlayer-python | tests/managers/ipsec_tests.py | Python | mit | 15,462 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import logging
import sys
from setuptools import setup
def read_file(fname):
"""
Read file and decode in py2k
"""
if sys.version_info < (3,):
return open(fname).read().decod... | christianmemije/kolibri-exercise-perseus-plugin | setup.py | Python | mit | 2,312 |
import py, os, sys
import subprocess
def pytest_funcarg__standalone(request):
return request.cached_setup(scope="module",
setup=lambda: Standalone(request))
class Standalone:
def __init__(self, request):
self.testdir = request.getfuncargvalue("testdir")
script = "mypytest"
res... | lotaku/pytest-2.3.5 | testing/test_genscript.py | Python | mit | 1,311 |
#
# Copyright (C) 2017 Kevin Thornton <krthornt@uci.edu>
#
# This file is part of fwdpy11.
#
# fwdpy11 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any... | molpopgen/fwdpy11 | tests/test_ts_from_msprime.py | Python | gpl-3.0 | 2,969 |
# Copyright 2013 Google Inc. 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 applicable law or ... | ehiller/CourseBuilderV19-TeacherDashboard | models/services.py | Python | apache-2.0 | 5,349 |
def isAnagram(s, t):
t = reversed(t)
if t == "":
return False
time = 0
for i in t:
if s[time] == i:
time += 1
continue
else:
return False
return True
| ccqpein/Arithmetic-Exercises | Valid-Anagram/VA.py | Python | apache-2.0 | 230 |
# -*- coding: utf-8 -*-
__author__ = 'Young King'
__email__ = 'yanckin@gmail.com'
__version__ = '0.1.0'
from .tlcache import TLCache | youngking/tlcache | tlcache/__init__.py | Python | isc | 134 |
from rx import AnonymousObservable
from rx.disposables import CompositeDisposable
from .exceptions import DisposedException
def add_ref(xs, r):
def subscribe(observer):
return CompositeDisposable(r.disposable, xs.subscribe(observer))
return AnonymousObservable(subscribe)
def adapt_call(func):
... | dbrattli/RxPY | rx/internal/utils.py | Python | apache-2.0 | 1,477 |
class LinkedListNode:
def __init__(self, value):
self.value = value
self.next = None
def kth_to_last_node(fromLast, rootNode):
node = rootNode
totalNodes = 0
while node != None:
totalNodes += 1
node = node.next
#initially forgot this error case
if fromLast >... | katchengli/tech-interview-prep | interview_cake/ic25.py | Python | apache-2.0 | 844 |
# Generated by Django 1.11.11 on 2018-04-12 01:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zilencer', '0008_customer_billing_user'),
]
operations = [
migrations.CreateModel(
name='Plan',
fields=[
... | showell/zulip | zilencer/migrations/0009_plan.py | Python | apache-2.0 | 617 |
import logging
from collections import OrderedDict
from django.conf import settings
from django.core.cache import cache
from django.shortcuts import render
from apiclient.errors import Error as GoogleAPIError
from oauth2client.client import Error as Oauth2Error
from OpenSSL.crypto import Error as OpenSSLError
from ... | anushbmx/kitsune | kitsune/dashboards/utils.py | Python | bsd-3-clause | 4,356 |
#!/usr/bin/env python3
import os
import sys
import getopt
import xml.dom.minidom
class CppCreator(object):
def __init__(self, file_name, xml_root, output_path):
if not os.path.exists(output_path):
print ("CppCreator create error")
exit(1)
self.xml_root = xml_r... | face2wind/Elegance | tools/serialize_creator/cpp_creator.py | Python | lgpl-3.0 | 8,346 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, unicode_literals, division,
print_function)
from ..representation import CartesianRepresentation
from ..baseframe import BaseCoordinateFrame, TimeFrameAttribute
from ... | joergdietrich/astropy | astropy/coordinates/builtin_frames/itrs.py | Python | bsd-3-clause | 1,296 |
__author__ = 'mramire8'
__copyright__ = "Copyright 2014, ML Lab"
__version__ = "0.1"
__status__ = "Research"
import sys
import os
sys.path.append(os.path.abspath("."))
sys.path.append(os.path.abspath("../"))
sys.path.append(os.path.abspath("../experiment/"))
from experiment.experiment_utils import *
import argparse
... | mramire8/active | sentences/sent_cheat.py | Python | apache-2.0 | 26,275 |
from collections import defaultdict
import pronouncing
import re
from sortedcontainers import SortedList
# https://en.wikipedia.org/wiki/Arpabet
CONSONANT_PHONES = {
'P', 'B', 'T', 'D', 'K', 'G',
'CH', 'JH',
'F', 'V', 'TH', 'DH', 'S', 'Z', 'SH', 'ZH', 'HH',
'M', 'EM', 'N', 'EN', 'NG', 'ENG',
'L',... | scottynomad/spoonerist | spoonerist/data.py | Python | apache-2.0 | 3,416 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
import os
class LatexTableCreator(object):
def create_latex_table_for_specifications_for_model(self, specification, model_name, dir):
... | apdjustino/DRCOG_Urbansim | src/opus_core/latex_table_creator.py | Python | agpl-3.0 | 1,814 |
# 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... | xuleiboy1234/autoTitle | tensorflow/tensorflow/examples/speech_commands/models.py | Python | mit | 14,160 |
from __future__ import print_function
# Author: Brendan Le Foll <brendan.le.foll@intel.com>
# Contributions: Sarah Knepper <sarah.knepper@intel.com>
# Copyright (c) 2014 Intel Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation fi... | sasmita/upm | examples/python/grovetemp.py | Python | mit | 1,892 |
#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2005
# Author: Li Ge <lge@us.ibm.com)
# Positive Test: create domain, attach block device, verify list
from XmTestLib import *
from XmTestLib.block_utils import block_attach
if ENABLE_HVM_SUPPORT:
SKIP("Block-list not supported for HVM do... | YongMan/Xen-4.3.1 | tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py | Python | gpl-2.0 | 1,170 |
import viper.lexer as vl
import os
import pytest
from importlib import import_module
from typing import List, Type
###############################################################################
#
# INDIVIDUAL TOKENS
#
###############################################################################
def _test_singl... | pdarragh/Viper | tests/test_lexer.py | Python | apache-2.0 | 7,284 |
"""
Webapp core app.
"""
| redhat-cip/numeter | web-app/numeter_webapp/core/__init__.py | Python | agpl-3.0 | 25 |
"""Query for a nonexistent language to see the resulting error message."""
from ask_api_examples import make_query
query = '[[Programming language::xxyyzz]]'
def main():
r = make_query(query, __file__)
return r
if __name__ == '__main__':
print main()
| mdpiper/csdms-wiki-api-examples | ask_api_examples/show_query_error.py | Python | mit | 269 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-sql/azure/mgmt/sql/models/service_objective_paged.py | Python | mit | 906 |
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
import os
import sys
import urllib
#get defaults and folders/folder helpers
addon = xbmcaddon.Addon()
addonID = addon.getAddonInfo('id')
def ensure_dir(d):
if not os.path.exists(d):
os.makedirs(d)
ADDON_PATH = addon.getAddonInfo('path').deco... | Drakulix/plugin.program.steam.streaming | utils.py | Python | mit | 4,747 |
from peewee import *
from app import Account, PageView
DEFAULT_ACCOUNT_ID = 1
class Report(object):
def __init__(self, account_id=DEFAULT_ACCOUNT_ID):
self.account = Account.get(Account.id == account_id)
self.date_range = None
def get_query(self):
query = PageView.select().where(Pag... | coleifer/peewee | examples/analytics/reports.py | Python | mit | 4,400 |
from urlparse import urlparse
PROTOCOL_TO_PORT = {
'http': 80,
'https': 443,
}
def client_from_config(
client_cls, configuration, prefix='unicorehub.', **kwargs):
settings = dict((key[len(prefix):], value)
for key, value in configuration.iteritems()
if key... | universalcore/unicore.hub.client | unicore/hub/client/utils.py | Python | bsd-2-clause | 1,081 |
from flask import request, render_template
from flask.ext.login import current_user
def index():
return render_template('index.html', active_page='index') | PhoenixRacing/PhoenixRacingWebApp-noregrets | application/controllers/index.py | Python | bsd-3-clause | 156 |
from rest_framework import serializers
class MailTestSerializer(serializers.Serializer):
EMAIL_HOST = serializers.CharField(max_length=1024, required=True)
EMAIL_PORT = serializers.IntegerField(default=25)
EMAIL_HOST_USER = serializers.CharField(max_length=1024)
EMAIL_HOST_PASSWORD = serializers.CharF... | sdgdsffdsfff/jumpserver | apps/settings/serializers.py | Python | gpl-2.0 | 1,513 |
#!/usr/bin/env python
from convoy.meta import main
main()
| adamlincoln/Bookie | scripts/js/generate_meta.py | Python | agpl-3.0 | 60 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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.or... | FederatedAI/FATE | python/federatedml/feature/instance.py | Python | apache-2.0 | 2,143 |
#
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# Lead Developers: Dan Lovell and Jay Baxter
# Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka
# Research Leads: Vikash Mansinghka, Patrick Shafto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may... | probcomp/crosscat | src/utils/file_utils.py | Python | apache-2.0 | 2,073 |
# -*- coding: utf8 -*-
from yanntricks import *
def ratrap():
pspict,fig = SinglePicture("ratrap")
pspict.dilatation(1)
a=1
b=2
O=Point(0,0)
c1 = Circle(O,a).parametric_curve(0,pi/2)
c2 = Circle(O,b).parametric_curve(0,pi/2)
surface = SurfaceBetweenParametricCurves(c1,c2,interval=(0,p... | LaurentClaessens/mazhe | src_yanntricks/yanntricksratrap.py | Python | gpl-3.0 | 959 |
# -*- coding: utf-8 -*-
from __future__ import division
import geohash
from haversine import haversine
from .trie import Trie, KeyNotFound
DEFAULT_PRECISION = 10
PRECISION_LEVELS = (
(0.00925, 12),
(0.074, 11),
(0.6, 10),
(2.4, 9),
(19, 8),
(76, 7),
(610, 6),
(2400, 5),
(20000,... | alexmic/geotrie-python | geotrie/__init__.py | Python | mit | 2,494 |
# -*- coding: utf-8 -*-
from resources.lib.modules import cache
class Indexer:
def get_live_channels(self):
import scraper_live as scraper
live = scraper.get_live_channels()
return live
def get_vod(self):
import scraper_vod as scraper
vod = scraper.get_globoplay_c... | bruno-briner/plugin.video.brplay | resources/lib/modules/globoplay/indexer.py | Python | gpl-3.0 | 3,863 |
"""
Copyright 2016 Brandon Michael Hoffman
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,... | BrandonHoffman/python-fossil | tests/test_virtual_dirs.py | Python | apache-2.0 | 5,631 |
# Copyright 2013 OpenStack Foundation
# Copyright 2015 Mirantis, Inc.
# 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... | bswartz/manila | manila/tests/network/neutron/test_neutron_plugin.py | Python | apache-2.0 | 70,016 |
"""
Task
Students of District College have subscription of English and French newspapers. Some students have subscribed to only English, some have subscribed to only French and some have subscribed to both newspapers.
You are given two sets of roll numbers of students, who have subscribed to English and French newspap... | spradeepv/dive-into-python | hackerrank/domain/python/sets/intersection.py | Python | mit | 1,336 |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2020 Samuele Carcagno <sam.carcagno@gmail.com>
# This file is part of pychoacoustics
# pychoacoustics 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,... | sam81/pychoacoustics | pychoacoustics/dialog_memory_file_parameters_differ.py | Python | gpl-3.0 | 3,413 |
"""
WSGI config for SSECTA 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SSECTA.settings")
from django.core.wsg... | Xivid/Programming-Training-Helper | SSECTA/wsgi.py | Python | cc0-1.0 | 387 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.