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 -*-
from gettext import gettext as _
EXP1 = [
_('Provinces'),
['lineasDepto'],
[],
['deptos']
]
EXP2 = [
_('Provincial capitals'),
['lineasDepto', 'capitales'],
[],
['capitales']
]
EXP3 = [
_('Cities'),
['lineasDepto', 'capitales', 'ciudades'],
[],
... | AlanJAS/iknowAmerica | recursos/0panama/datos/explorations.py | Python | gpl-3.0 | 554 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000269',
version=20140916,
description='BIOMD0000000269 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000269',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000269 | setup.py | Python | cc0-1.0 | 377 |
from neb.plugins import Plugin
import urllib
class UrlPlugin(Plugin):
"""URL encode or decode text.
url encode <text>
url decode <text>
"""
name = "url"
def cmd_encode(self, event, *args):
"""URL encode text. 'url encode <text>'"""
# use the body directly so quotes are parse... | Kegsay/Matrix-NEB | plugins/url.py | Python | apache-2.0 | 622 |
# Copyright 2014 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... | s9xie/convnet2_misc | convnet.py | Python | apache-2.0 | 14,754 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public ... | andrius-preimantas/purchase-workflow | purchase_order_force_number/__openerp__.py | Python | agpl-3.0 | 1,589 |
"""Convert CSV containing grid row/column IDs and category values to GeoJSON."""
import csv
import argparse
from geojson import Polygon, Feature, FeatureCollection, dump
def main():
parser = argparse.ArgumentParser()
parser.add_argument("csv_in")
parser.add_argument("-columns", nargs="+", default=[])
... | joh12041/route-externalities | utils/grid_csv_to_geojson.py | Python | mit | 1,678 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... | edgedb/edgedb | edb/ir/staeval.py | Python | apache-2.0 | 13,571 |
# Copyright (c) 2014 OpenStack Foundation
#
# 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 ... | nadeemsyed/swift | test/unit/common/test_splice.py | Python | apache-2.0 | 10,235 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('identities', '0001_initial'),
('finance', '0001_initial'),
('core', '0001_initial'),
]
... | thiagof/treeio | treeio/infrastructure/migrations/0001_initial.py | Python | mit | 6,480 |
c = float(input('Celsius: '))
f = 9*c/5 + 32
print ('%.2f Fahrenheit' %f)
| SANDEISON/Python | Exercicios/01 Exercício de Programação/Feitos pelo Professor/Lista I exercício 7.py | Python | gpl-2.0 | 74 |
"""Testing of module table."""
# pylint: disable=no-self-use
import unittest
from hamcrest import assert_that, equal_to, contains_string
from spline.tools.table import calculate_columns, calculate_row_format, pprint
from spline.tools.stream import stdout_redirector
class TestTable(unittest.TestCase):
"""Testing ... | Nachtfeuer/pipeline | tests/tools/test_table.py | Python | mit | 2,688 |
from flask_wtf import Form
from wtforms import StringField, DateField, PasswordField
from wtforms.validators import Optional, AnyOf, DataRequired, \
Email
from datetime import datetime
from dmutils.formats import DATE_FORMAT
class ServiceUpdateAuditEventsForm(Form):
audit_date = DateField(
'Audit Date... | mtekel/digitalmarketplace-admin-frontend | app/main/forms.py | Python | mit | 1,398 |
#!/usr/bin/env python3
import unittest
import os
import shutil
from mapping import waymaker
TMPDIR = '/tmp/test-waymaker'
class TestWaymaker(unittest.TestCase):
def test_waymaker(self):
self.maxDiff = None # to see full errors
if os.path.exists(TMPDIR):
shutil.rmtree(TMPDIR)
... | akkana/scripts | test/test_waymaker.py | Python | gpl-2.0 | 1,966 |
#!/usr/bin/env python2
# Copyright 2013-present Barefoot Networks, 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 b... | Emil-501/block.p4 | env/runtime_CLI.py | Python | apache-2.0 | 80,370 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import psycopg2
from socorrolib.lib import (
MissingArgumentError,
BadArgumentError,
external_common,
)
fro... | KaiRo-at/socorro | socorro/external/postgresql/graphics_devices.py | Python | mpl-2.0 | 3,440 |
input = """
a:-b.
b:-a.
a v b.
:- not a.
:- not b.
"""
output = """
{a, b}
"""
| Yarrick13/hwasp | tests/wasp1/AllAnswerSets/choice_14.test.py | Python | apache-2.0 | 81 |
# Copyright (c) Members of the EGEE Collaboration. 2004.
# See http://www.eu-egee.org/partners/ for details on the copyright
# holders.
#
# 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
#... | pandreetto/info-glue-provider | src/GLUEInfoProvider/GLUEClusterHandler.py | Python | apache-2.0 | 4,801 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging, os
from datetime import datetime
from inspect import get... | alirizakeles/zato | code/zato-client/src/zato/client/__init__.py | Python | gpl-3.0 | 17,345 |
import astropy.units as u
import astropy.constants as con
import numpy as np
from radio_beam import Beam
'''
Recording the conversion from NHI to M, since I keep getting close to the
apparent correct numerical factor with slight differences everytime I try.
In the optically-thin limit, NHI = 1.82e18 * int T_B dv, wh... | e-koch/ewky_scripts | proposal_tools/hi_column_density_to_mass.py | Python | mit | 2,001 |
__all__ = (
'BaseTransition',
'Transition',
)
import collections
import itertools
from .errors import AnnotationError
from .expression import make_expression
from .iterable import Iterable
from .node import BaseTransition
from .token_list import TokenList
class Substitution(collections.OrderedDict):
pas... | simone-campagna/petra | petra/transition.py | Python | apache-2.0 | 3,240 |
"""
Exports from this provider
"""
from .provider import AzureCloudProvider # noqa
from .provider import MockAzureCloudProvider # noqa
| ms-azure-cloudbroker/cloudbridge | cloudbridge/cloud/providers/azure/__init__.py | Python | mit | 138 |
import h5py
import numpy as np
import pyfits as pf
data = pf.open("wfc3_f160w_clean_central100.fits")[0].data[0:120,:]
F = h5py.File("data&mask.hdf5",'r')
FF = h5py.File("masked_data.hdf5",'r')
FD = h5py.File('sampler.hdf5','r')
GD = h5py.File('masked_sampler.hdf5','r')
r = np.array(F["data_mask"]["data"])
w= np... | mjvakili/supermean | code/test_h5.py | Python | mit | 465 |
"""Tests for the views of the ``event_rsvp`` app."""
from django.test import TestCase
from django.utils import timezone
from django_libs.tests.factories import UserFactory
from django_libs.tests.mixins import ViewTestMixin
from event_rsvp.models import Event, Guest
from event_rsvp.tests.factories import EventFactory,... | bitmazk/django-event-rsvp | event_rsvp/tests/integration_tests/views_tests.py | Python | mit | 7,036 |
#!/usr/bin/env python
#
# Copyright (C) 2015 Joseph W. Metcalf
#
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby
# granted, provided that the above copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND... | sabas1080/dsame | dsame.py | Python | isc | 12,438 |
import os;
# Django settings for wordlinks project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgre... | gcusacrificialvictim/wordlinks | wordlinks/settings.py | Python | gpl-2.0 | 5,516 |
# Copyright 2012 Andrew Bogott for the Wikimedia Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | sacharya/nova | nova/network/ldapdns.py | Python | apache-2.0 | 13,197 |
from flask import redirect, request, url_for, Blueprint, request, jsonify, session, Response
from flask.ext.login import login_user, login_required, logout_user, abort
from project import utils, database_wrapper
from project.services.auth import Auth
from flask.ext.api import FlaskAPI, exceptions
from flask.ext.api.sta... | AustinStoneProjects/Founderati-Server | project/api/invites.py | Python | apache-2.0 | 2,204 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2011 - 2014 by Wilbert Berendsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | shimpe/frescobaldi | frescobaldi_app/miditool/widget.py | Python | gpl-2.0 | 13,401 |
#---------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------
"""
QUEUES :
Queue is a collection of objects that are inserted and removed according to the first-in,
first-out (FIFO) principl... | MithileshCParab/Algorithms | Python/Data Structure/Queue/Queues.py | Python | apache-2.0 | 8,845 |
"""Generated file that augments the standard schema L{datatype
definitions<pyxb.binding.datatypes>} with their respective
U{constraining facets<http://www.w3.org/TR/xmlschema-2/index.html#rf-facets>}. At
one time, the C{maintainer/xsdfacet.py} script could be used to
generate this. No idea if that's still true.
"""
i... | jonfoster/pyxb1 | pyxb/binding/datatypes_facets.py | Python | apache-2.0 | 18,254 |
#!/usr/bin/env python
from nose.tools import assert_equal
import networkx as nx
from networkx.algorithms import bipartite
from networkx.testing import assert_edges_equal, assert_nodes_equal
class TestBipartiteProject:
def test_path_projected_graph(self):
G=nx.path_graph(4)
P=bipartite.projected_gr... | jcurbelo/networkx | networkx/algorithms/bipartite/tests/test_project.py | Python | bsd-3-clause | 14,106 |
# -*- coding: utf-8 -*-
import json
import os
import re
import sublime
def import_dir(name, fromlist=()):
PACKAGE_EXT = '.sublime-package'
dirname = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
if dirname.endswith(PACKAGE_EXT):
dirname = dirname[:-len(PACKAGE_EXT)]
return __im... | Iristyle/ChocolateyPackages | EthanBrown.SublimeText2.WebPackages/tools/PackageCache/Hayaku - tools for writing CSS faster/templates.py | Python | mit | 17,208 |
# -*- coding: utf-8 -*-
"""
Generate centreline and write it out as .vtk legacy format.
"""
import os
import sys
# Run in current directory.
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# Import path for the CentrelineGenerator script.
importPath = os.path.abspath(os.path.join(os.path.dirname(__file__), '../... | BlueFern/DBiharMesher | meshes/c4080ang/Generate4080Centreline_80.py | Python | gpl-2.0 | 1,015 |
def steps(number):
if number < 1:
raise ValueError("The given value must be a positive integer")
step = 0
while True:
if number == 1:
return step
if number % 2 == 0:
number = number / 2
else:
number = 3 * number + 1
step += 1
| TGITS/programming-workouts | exercism/python/collatz-conjecture/collatz_conjecture.py | Python | mit | 318 |
"""
Test functions for multivariate normal distributions.
"""
from __future__ import division, print_function, absolute_import
import pickle
from numpy.testing import (assert_allclose, assert_almost_equal,
assert_array_almost_equal, assert_equal,
assert_array_les... | lhilt/scipy | scipy/stats/tests/test_multivariate.py | Python | bsd-3-clause | 64,227 |
#! /usr/bin/env python
import sys, os
import os.path
output_dir = sys.argv[1]
task_id = sys.argv[2]
if not os.path.exists(output_dir):
os.mkdir(output_dir)
new_gene_list = []
refGene = output_dir+"/"+task_id+".txt"
fh = open(refGene, "r")
for line in fh:
line = line.rstrip('\n')
F = line.split('\t')
... | ken0-1n/GenomonHotspotDatabase | scripts/modify_refGene_coding.py | Python | gpl-3.0 | 763 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... | yasharmaster/scancode-toolkit | src/scancode/timeouts/windows.py | Python | apache-2.0 | 2,328 |
import factory
from adhocracy4.test import factories as a4_factories
from meinberlin.apps.livequestions import models
from meinberlin.test.factories import CategoryFactory
class LiveQuestionFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.LiveQuestion
text = factory.Faker('tex... | liqd/a4-meinberlin | meinberlin/test/factories/livequestions.py | Python | agpl-3.0 | 452 |
# Copyright 2019 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | rjschwei/WALinuxAgent | tests/common/osutil/test_nsbsd.py | Python | apache-2.0 | 3,180 |
"""
Tests of the core auth models (Role, Membership, Collection, FacilityUser, DeviceOwner, etc).
"""
from __future__ import absolute_import, print_function, unicode_literals
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.test import TestCase
from ..constant... | MCGallaspy/kolibri | kolibri/auth/test/test_models.py | Python | mit | 20,210 |
import os
import sys
def which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""Given a command, mode, and a PATH string, return the path which
conforms to the given mode on the PATH, or None if there is no such
file.
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
of os.environ.ge... | fpietka/rds-pgbadger | package/which.py | Python | mit | 2,371 |
# 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 agreed to in writing, ... | google/neural-light-transport | nlt/networks/convnet.py | Python | apache-2.0 | 3,625 |
# coding=utf-8
from datetime import datetime
import codecs
from psi.app import const
from tests import fixture
from tests.base_test_case import BaseTestCase
class TestImportStoreDataView(BaseTestCase):
def test_import(self):
from psi.app.models import SalesOrder, SalesOrderLine, Product, Supplier
... | betterlife/psi | tests/views/import_store_data_test.py | Python | mit | 4,050 |
#!/usr/bin/env python2
import argparse
import json
import sys
import socket
import time
from pkg_resources import parse_version
import tinctools
if parse_version(tinctools.__version__) >= parse_version('0.3') and \
parse_version(tinctools.__version__) < parse_version('0.4'):
from tinctools import connection... | exioReed/tinc-vis | bin/gen-data.py | Python | bsd-3-clause | 5,622 |
#!/usr/bin/env python
'''Data Logging classes
'''
import abc
import os
import shutil
import numpy as np
import pandas as pd
class EpochLogger(object):
'''Logs data for each epoch
'''
__metaclass__ = abc.ABCMeta
def __init__(self):
pass
@abc.abstractmethod
def log(self, data, epoch):... | wclark3/machine-learning | final-project/code/data_logger.py | Python | mit | 1,787 |
"""
This is a working sample CloudBolt plug-in for you to start with. The run method is required,
but you can change all the code within it. See the "CloudBolt Plug-ins" section of the docs for
more info and the CloudBolt forge for more examples:
https://github.com/CloudBoltSoftware/cloudbolt-forge/tree/master/actions/... | CloudBoltSoftware/cloudbolt-forge | blueprints/azure_databricks/create_databricks_workspace_cluster.py | Python | apache-2.0 | 8,721 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import json
from django.core.urlresolvers import reverse
from sentry.models import GroupSeen
from sentry.constants import MAX_JSON_RESULTS
from sentry.testutils import TestCase, fixture
class GroupDetailsTest(TestCase):
@fixture
def path(self)... | SilentCircle/sentry | tests/sentry/web/frontend/groups/tests.py | Python | bsd-3-clause | 5,628 |
# -*- coding: utf-8 -*-
###
# Copyright (c) 2010 by Elián Hanisch <lambdae2@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) an... | qguv/config | weechat/plugins/python/completion.py | Python | gpl-3.0 | 7,678 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2015 Midokura Europe SARL, All Rights Reserved.
# 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://w... | celebdor/python-midonetclient | src/midonetclient/protobuf/utils.py | Python | apache-2.0 | 5,989 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import tensorflow as tf
from decomposable import DecomposableNLIModel, mask_3d
class LSTMClassifier(DecomposableNLIModel):
"""
Improvements over the multi feed forward classifier. This is mostly
based on "Enhancing and Combining Sequential a... | erickrf/multiffn-nli | src/classifiers/lstm.py | Python | mit | 4,074 |
#!/usr/bin/python
import threading
import time
#from foam.sfa.util.sfalogging import logger
"""
Callids: a simple mechanism to remember the call ids served so fas
memory-only for now - thread-safe
implemented as a (singleton) hash 'callid'->timestamp
"""
debug=False
class _call_ids_impl (dict):
_instance = No... | dana-i2cat/felix | ofam/src/src/foam/sfa/util/callids.py | Python | apache-2.0 | 2,260 |
from collections import deque
import re
class Formula(object):
"""
Formula allows translation from a prefix-notation expression in a string to a complex number.
This is eventually to be replaced with a cython, c++, or openCL implementation as I'm sure
the performance of this class... | dtwiers/PyFracking | src/Formula.py | Python | gpl-3.0 | 2,090 |
"""Create mandate table
Revision ID: 32f5eec11778
Revises: 3a41443d8839
Create Date: 2015-06-29 22:49:29.941746
"""
# revision identifiers, used by Alembic.
revision = '32f5eec11778'
down_revision = '3a41443d8839'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'mandate'... | scorphus/politicos | politicos/migrations/versions/32f5eec11778_create_mandate_table.py | Python | agpl-3.0 | 1,317 |
import errno
import os
import shutil
import socket
import subprocess
import sys
import tempfile
import time
import urllib2
import pytest
from tools.wpt import wpt
here = os.path.abspath(os.path.dirname(__file__))
def is_port_8000_in_use():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
... | danlrobertson/servo | tests/wpt/web-platform-tests/tools/wpt/tests/test_wpt.py | Python | mpl-2.0 | 18,674 |
from django.conf.urls import url
from kitsune.flagit import views
urlpatterns = [
url(r'^$', views.queue, name='flagit.queue'),
url(r'^/flag$', views.flag, name='flagit.flag'),
url(r'^/update/(?P<flagged_object_id>\d+)$', views.update,
name='flagit.update'),
]
| anushbmx/kitsune | kitsune/flagit/urls.py | Python | bsd-3-clause | 283 |
from Queue import Queue
from flask import Flask
from flask.ext.socketio import SocketIO
sio = SocketIO()
app = Flask(__name__)
app.debug = False
app.config['SECRET_KEY'] = 'eicu5jichab5aQuooshohrahghaekajaekahgayaequ0Aix7IHaigh3auphaeCh5'
app.comman... | noah/bobby | bobby/__init__.py | Python | mit | 552 |
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
""""
Populate the blank entity and auth group fields for the user groups.
For the blank entity field, fill out with the default entity (id=1).
For the blank auth group field, get or create one by name if not ... | alirizakeles/tendenci | tendenci/apps/user_groups/management/commands/populate_entity_and_auth_group_columns.py | Python | gpl-3.0 | 960 |
"""Subclass of LogViewerBase, which is generated by wxFormBuilder."""
import wx
import mst_gui
import LogEntry
# Implementing LogViewerBase
class LogViewer( mst_gui.LogViewerBase ):
def __init__( self, parent, log_entry ):
mst_gui.LogViewerBase.__init__( self, parent )
self.mLogEntry = log_entry
... | zstars/weblabdeusto | tools/ExperimentServerTester/src/LogViewer.py | Python | bsd-2-clause | 605 |
"""
ConfigurationModel for the mobile_api djangoapp.
"""
from config_models.models import ConfigurationModel
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from . import utils
from .mobile_platform import PLATFORM_CLASSES
class MobileApiConfig(ConfigurationModel):
""... | cpennington/edx-platform | lms/djangoapps/mobile_api/models.py | Python | agpl-3.0 | 3,642 |
# Copyright 2017, Rackspace US, 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 w... | cfarquhar/rpc-openstack | scripts/artifacts-building/apt/lookup/packages_to_install.py | Python | apache-2.0 | 6,059 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/rl_unplugged/rlu_rwrl/rlu_rwrl_test.py | Python | apache-2.0 | 1,352 |
from hashlib import sha1
from django.test import TestCase
from mooch.postfinance import PostFinanceMoocher
from testapp.models import Payment
def _messages(response):
return [m.message for m in response.context["messages"]]
class Request:
def build_absolute_uri(*arg):
return ""
class MoochTest(T... | matthiask/django-mooch | tests/testapp/test_mooch.py | Python | mit | 2,802 |
"""Acceptances tests using py.test fixtures.
All fixtures from ../conftest.py and :mod: `pytest_splinter.plugin` are
available.
The test case structure should follow the If-When-Then pattern.
"""
#########
# Tests #
#########
def test_user_want_to_explore_news(browser):
# import ipdb; ipdb.set_trace() # pytho... | FabiApfelkern/policycompass | tests-acceptance-frontend/test_example_story.py | Python | agpl-3.0 | 1,073 |
#!/usr/bin/env python3
import re
COMPRESSION_CUTOFF = 3
def compress(string_to_compress: str) -> str:
output = "" # The compressed string that will be outputted
character = "" # character the string_to_compress at blank
occurrences = 0 # the number of occurrences of this letter
for index, char in... | mindm/2017Challenges | challenge_12/python/slandau3/compression.py | Python | mit | 2,546 |
# 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/artifact_parameter_properties.py | Python | mit | 1,047 |
from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.interpolate as interp
from numpy.testing import assert_almost_equal
class TestRegression(object):
def test_spalde_scalar_input(self):
"""Ticket #629"""
x = np.linspace(0,10)
y = x**3
t... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/interpolate/tests/test_regression.py | Python | mit | 484 |
'''
_ __ ___ ___ _ __ ___ _ __ ___ ___ _ __ _ _
| '__/ _ \/ __| '_ \ / _ \| '_ \/ __|/ _ \ | '_ \| | | |
| | | __/\__ \ |_) | (_) | | | \__ \ __/_| |_) | |_| |
|_| \___||___/ .__/ \___/|_| |_|___/\___(_) .__/ \__, |
|_| |_| |___/
'''
from contextlib import conte... | gsamokovarov/response.py | response.py | Python | mit | 2,531 |
"""
Django settings for testproject project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import os
import os.path
import sys
# Build paths inside the project ... | nathforge/django-roma | testproject/testproject/settings.py | Python | gpl-3.0 | 2,177 |
import codecs
import os
import re
from setuptools import setup, find_packages
###################################################################
NAME = "omsim"
PACKAGES = find_packages(where="src")
META_PATH = os.path.join("src", "omsim", "__init__.py")
KEYWORDS = ["optical maps"]
CLASSIFIERS = [
"Development ... | biointec/omsim | omsim/setup.py | Python | gpl-2.0 | 2,077 |
# A list is used to manage the list of Particles.
from particle import Particle
from crazy_particle import CrazyParticle
class ParticleSystem(object):
def __init__(self, num, v):
self.particles = [] # Initialize the list.
self.origin = v.get() # Store the origin point.
for i in range(n... | kantel/processingpy | sketches/modes/PythonMode/examples/Topics/Simulate/MultipleParticleSystems/particle_system.py | Python | mit | 1,129 |
# -*- coding: utf-8 -*-
"""Test Call class
"""
import vcfpy
from vcfpy import record
__author__ = "Manuel Holtgrewe <manuel.holtgrewe@bihealth.de>"
def build_rec(calls=None, format_extras=None):
calls = calls or []
format_extras = format_extras or []
alt1 = record.Substitution(vcfpy.SNV, "T")
alt2 =... | bihealth/vcfpy | tests/test_call.py | Python | mit | 4,742 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 Jose-Ignacio Riaño Chico
#
# 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 a... | riga/luigi | luigi/contrib/dropbox.py | Python | apache-2.0 | 11,273 |
# -*- encoding: utf-8 -*-
"""
Hymmnoserver support module: add_words
Purpose
=======
Endlessly prompts the user to provide word elements so that new Hymmnos may be
quickly added to the database.
Note that this script performs NO error-handling.
Legal
=====
All code, unless otherwise indicated, is original, and... | Baughn/hymmnoserver | database/add_words.py | Python | gpl-3.0 | 3,279 |
import wx
import odict
from cuttlebug import util
import random, inspect
# APPLICATION SPECIFIC
# pub/sub topics
PROJECT_OPEN = 1
PROJECT_CLOSE = 2
TARGET_ATTACHED = 3
TARGET_DETACHED = 4
TARGET_RUNNING = 5
TARGET_HALTED = 6
BUILD_STARTED = 7
BUILD_FINISHED = 8
class MenuItemProxy(object):
def __init__(self, ... | ryansturmer/cuttlebug | cuttlebug/ui/menu.py | Python | mit | 9,395 |
import director_unroll
class MyFoo(director_unroll.Foo):
def ping(self):
return "MyFoo::ping()"
a = MyFoo()
b = director_unroll.Bar()
b.set(a)
c = b.get()
if not (a.this == c.this):
print a, c
raise RuntimeError
| jrversteegh/softsailor | deps/swig-2.0.4/Examples/test-suite/python/director_unroll_runme.py | Python | gpl-3.0 | 225 |
#!/usr/bin/env python
#
# Copyright (C) 2012 Per Myren
#
# This file is part of Bryton-GPS-Linux
#
# Bryton-GPS-Linux 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 ... | Pitmairen/bryton-gps-linux | code/brytongps.py | Python | gpl-3.0 | 14,536 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import quote
import sys
import unittest
verbose = False
# Wrapped versions of the functions that we're testing, ... | tierney/mustached-bear | tools/quote_test.py | Python | bsd-3-clause | 5,459 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/conn_string_info.py | Python | mit | 1,412 |
from ..cache import cache_class, cache_provider, set_storage, do_updates
from ..backends.Local import LocalBackend
from ..backends import Cache
from nose.tools import with_setup
_provider_count = 0
class MockBackend(Cache):
def __init__(self, Backend):
super(MockBackend, self).__init__(Backend)
def... | trb/Multicache | tests/test_class.py | Python | bsd-2-clause | 3,710 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
# Ralf Habacker, 2006 (rh)
# Yinon Ehrlich, 2009
"""
g++/llvm detection.
"""
import os, sys
from waflib import Configure, Options, Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_avr_gxx(conf):
"""
Fin... | sofian/qualia | examples/makefiletests/avr_gxx.py | Python | gpl-3.0 | 4,490 |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class StreamcloudEu(XFSHoster):
__name__ = "StreamcloudEu"
__type__ = "hoster"
__version__ = "0.13"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?streamcloud\.eu/\w{12}'
... | fzimmermann89/pyload | module/plugins/hoster/StreamcloudEu.py | Python | gpl-3.0 | 788 |
# -*- coding: utf-8 -*-
__author__ = 'Joel Bastos'
__email__ = 'kintoandar@gmail.com'
__version__ = '0.2.5'
| kintoandar/caixabreak | caixabreak/__init__.py | Python | mit | 109 |
from collections import Iterator, namedtuple
from operator import add, setitem
import pickle
from random import random
from toolz import identity, partial
import pytest
from dask.compatibility import PY2, PY3
from dask.delayed import delayed, to_task_dasks, compute, Delayed
def test_to_task_dasks():
a = delayed... | cowlicks/dask | dask/tests/test_delayed.py | Python | bsd-3-clause | 9,711 |
"""
WSGI config for jiuye 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | liucode/liucode.github.io | jiuye/wsgi.py | Python | mit | 388 |
# a minimal tracking script - this will start all peer
# services and attach everything appropriately
# change parameters depending on your pan tilt, pins and
# Arduino details
# all commented code is not necessary but allows custom
# options
port = "COM15"
xServoPin = 13
yServoPin = 12
tracker = Runtime.createAndSta... | sstocker46/pyrobotlab | home/Alessandruino/Tracking.faceDetection.py | Python | apache-2.0 | 1,267 |
#!/usr/bin/env python3
from pathlib import Path
def main():
rootdir = Path('.')
def input_files():
for path in rootdir.glob('*.*'):
if path.suffix in ('.html', '.txt'):
yield path
text = ''
for path in input_files():
text += path.read_text(encoding... | WojciechMula/toys | avx512-utf8-to-utf32/dataset/combine.py | Python | bsd-2-clause | 548 |
from __future__ import print_function
import argparse
import ast
import cProfile
import imp
import locale
import os
import pkgutil
import select
import sys
from collections import OrderedDict
from contextlib import contextmanager
from copy import deepcopy
from datetime import datetime, timedelta
from json import dump... | Shir0kamii/py3status | py3status/__init__.py | Python | bsd-3-clause | 63,701 |
import csv
import gzip
import cPickle
import numpy as np
def convert_kaggle_data_to_npy(choice='train'):
print 'Converting data, please wait...'
if choice is 'train':
X = np.zeros((105471, 769), dtype=np.float32)
y = np.zeros((105471, 1), dtype=np.float32)
one_percent_const = 1055
... | abhitopia/DimReductionMissingData | utils.py | Python | mit | 1,691 |
# init this directory
| genegis/genegis | Install/__init__.py | Python | mpl-2.0 | 23 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('pycon', '0001_initial'),
... | njl/pycon | pycon/tutorials/migrations/0001_initial.py | Python | bsd-3-clause | 1,093 |
from urllib.parse import urlencode
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from bedrock.base.middleware import LocaleURLMiddleware
@override_settings(DEV=True)
class TestLocaleURLMiddleware(TestCase):
def setUp(self):
self.rf = RequestFactory()
... | sgarrity/bedrock | bedrock/base/tests/test_middleware.py | Python | mpl-2.0 | 1,763 |
#from django.conf.urls import patterns, include, url
from django.conf.urls import *
from mysite.views import *
from contact.views import *
from django.contrib import admin
#from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', search),... | kk47/Python | django/mysite/mysite/urls.py | Python | lgpl-3.0 | 1,234 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2018 D. de Vries
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 appli... | daniel-de-vries/OpenLEGO | openlego/core/discipline_component.py | Python | apache-2.0 | 5,874 |
import sys
import getopt
import os.path
from project import Project, RugError
import output
from version import __version__
def init(output_buffer, optdict, project_dir=None):
Project.init(project_dir, optdict.has_key('--bare'), output_buffer=output_buffer)
def clone(output_buffer, optdict, url=None, project_dir=Non... | abstrakraft/rug | rug/rug.py | Python | gpl-3.0 | 4,932 |
"""
Error types
"""
class AlreadyBoundError(Exception):
"""
Raised if a factory is already bound to a name.
"""
pass
class CyclicGraphError(Exception):
"""
Raised if a graph has a cycle.
"""
pass
class LockedGraphError(Exception):
"""
Raised when attempting to create a c... | globality-corp/microcosm | microcosm/errors.py | Python | apache-2.0 | 595 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# Python AI Battle
#
# Copyright 2011 Matthew Thompson
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | rjm535/BrainTank | brains/wander.py | Python | gpl-3.0 | 3,925 |
# powerup.py
# this function defines classes for powerups
import pygame
import globalvars
import info
from pygame.locals import *
class PowerUp(pygame.sprite.Sprite):
""" PowerUp:
this class is the generic class for PowerUps. It will not be used directly, but other classes will
inherit Power... | prg318/invade-spacers | powerup.py | Python | gpl-2.0 | 1,863 |
#!/usr/bin/python
'''Test for an openGL based stereo renderer - test rendering same scene to multiple windows
David Dunn
Feb 2017 - created
www.qenops.com
'''
__author__ = ('David Dunn')
__version__ = '1.0'
import OpenGL
OpenGL.ERROR_CHECKING = False # Uncomment for 2x speed up
OpenGL.ERROR_LOGGING = False ... | qenops/dGraph | test/test7.py | Python | apache-2.0 | 5,724 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... | hanlind/nova | nova/config.py | Python | apache-2.0 | 1,807 |
import os
import sys
import sphinx_rtd_theme
sys.path.append(os.path.abspath('../'))
VERSION = open('../setup.py').read().split("version='")[1].split("'")[0]
project = 'facadedevice'
version = VERSION
author = 'Vincent Michel'
copyright = u'2016, MAX-IV'
master_doc = 'index'
highlight_language = 'python'
extensions ... | MaxIV-KitsControls/tango-facadedevice | docs/conf.py | Python | gpl-3.0 | 504 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.