code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class TimeStampedModel(models.Model):
"""
An abstract base class model that provides self-updating "created" and "modified" fields.
"""
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeFiel... | joehalloran/shoppinglist_project | shoppinglist/core/models.py | Python | apache-2.0 | 368 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 requir... | JioCloud/horizon | openstack_dashboard/dashboards/admin/domains/tables.py | Python | apache-2.0 | 6,160 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | sebrandon1/tempest | tempest/api/orchestration/stacks/test_soft_conf.py | Python | apache-2.0 | 7,882 |
"""
Test parsing of complex date and times
"""
import unittest, time, datetime
import parsedatetime as pdt
class test(unittest.TestCase):
@pdt.tests.assertEqualWithComparator
def assertExpectedResult(self, result, check, **kwargs):
return pdt.tests.compareResultByTimeTuplesAndFlags(result, check, **... | r3tard/BartusBot | lib/parsedatetime/tests/TestComplexDateTimes.py | Python | apache-2.0 | 3,487 |
# Code in this file is copied and adapted from
# https://github.com/openai/evolution-strategies-starter.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
class Optimizer(object):
def __init__(self, policy):
self.policy = poli... | ujvl/ray-ng | rllib/agents/ars/optimizers.py | Python | apache-2.0 | 1,862 |
# Generated from java-escape by ANTLR 4.4
from antlr4 import *
from io import StringIO
package = globals().get("__package__", None)
ischild = len(package)>0 if package is not None else False
if ischild:
from .ProtoParserListener import ProtoParserListener
else:
from ProtoParserListener import ProtoParserListene... | asifmadnan/protobuf2uml | bin/protobuf/ProtoParser.py | Python | apache-2.0 | 86,857 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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
#
# Unle... | nicolewhite/py2neo | py2neo/legacy/__init__.py | Python | apache-2.0 | 826 |
import os
from invoke import task
WHEELHOUSE_PATH = os.environ.get('WHEELHOUSE')
def monkey_patch(ctx):
# Force an older cacert.pem from certifi v2015.4.28, prevents an ssl failure w/ identity.api.rackspacecloud.com.
#
# SubjectAltNameWarning: Certificate for identity.api.rackspacecloud.com has no `subj... | TomBaxter/waterbutler | tasks.py | Python | apache-2.0 | 3,064 |
# (c) Copyright [2015] Hewlett Packard Enterprise Development LP
#
# 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 r... | hpe-storage/horizon-hpe-storage-ui | horizon_hpe_storage/storage_panel/storage_arrays/tables.py | Python | apache-2.0 | 4,728 |
# Copyright (c) 2012 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... | mahak/neutron | neutron/extensions/securitygroup.py | Python | apache-2.0 | 14,709 |
# Copyright 2014 OpenStack Foundation.
# Copyright 2014 Intel Corporation
# 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/lic... | paramite/blazar | climate/db/migration/alembic_migrations/versions/0_1_initial.py | Python | apache-2.0 | 5,677 |
__author__ = 'mthompson'
import copy
import inspect
import importlib
import urllib
import json
from urlparse import urlparse
import collections
import re
import os
import keyword
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class A10BaseClass(object):
is_POST = True
def __init__(self):
self... | a10networks/a10sdk-python | a10sdk/common/A10BaseClass.py | Python | apache-2.0 | 37,904 |
# Copyright [2015] Hewlett-Packard Development Company, L.P.
# 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... | zhangg/trove | trove/guestagent/datastore/experimental/vertica/system.py | Python | apache-2.0 | 5,231 |
# 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... | hehongliang/tensorflow | tensorflow/python/util/tf_export_test.py | Python | apache-2.0 | 6,573 |
# Copyright (c) 2010-2019 openpyxl
from warnings import warn
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
)
from openpyxl.descriptors.sequence import NestedSequence
from openpyxl.descriptors.excel import ExtensionList
from openpyxl.utils.indexed_list import ... | kawamon/hue | desktop/core/ext-py/openpyxl-2.6.4/openpyxl/styles/stylesheet.py | Python | apache-2.0 | 7,976 |
# Copyright 2011 VMware, 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 ... | onecloud/neutron | neutron/common/config.py | Python | apache-2.0 | 8,079 |
import re
from nltk.corpus import stopwords
from nltk.corpus import words
from nltk.stem.snowball import SnowballStemmer
from apiv2.models import QuestionText, Question
from apiv2.search.fsearch import formula_extractor as fe
cachedStopWords = stopwords.words("english")
english_vocab = set(w.lower() for w in words.wo... | deka108/meas_deka | apiv2/utils/text_util.py | Python | apache-2.0 | 2,391 |
# Copyright 2017 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 a... | mlperf/training_results_v0.7 | Google/benchmarks/gnmt/implementations/gnmt-research-TF-tpu-v4-512/utils/vocab_utils.py | Python | apache-2.0 | 6,145 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Cohorte Debug REST API
:authors: Bassem Debbabi
:copyright: Copyright 2015, isandlaTech
:license: Apache Software License 2.0
"""
# iPOPO decorators
from pelix.ipopo.decorators import ComponentFactory, Provides, Property, Instantiate, \
Validate, Invalidate, ... | gattazr/cohorte-platforms | repo/debug/api.py | Python | apache-2.0 | 19,258 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | mtreinish/stestr | stestr/tests/test_selection.py | Python | apache-2.0 | 7,058 |
#!/usr/bin/env python
"""
Script to update the current edX iOS App with different names, resources, etc.
Requirements:
pip install pyyaml
"""
import argparse
import logging
import os
import shutil
import subprocess
import sys
import yaml
class WhitelabelApp:
"""
Update the current edX iOS App using co... | proversity-org/edx-app-ios | script/whitelabel.py | Python | apache-2.0 | 8,765 |
"""The vimdoc parser."""
from vimdoc import codeline
from vimdoc import docline
from vimdoc import error
from vimdoc import regex
def IsComment(line):
return regex.comment_leader.match(line)
def IsContinuation(line):
return regex.line_continuation.match(line)
def StripContinuator(line):
assert regex.line_c... | google/vimdoc | vimdoc/parser.py | Python | apache-2.0 | 3,977 |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import re
import requests
from pants.subsystem.subsystem import Subsystem
from pants.util.memo import memoized_method
from pants.contrib.go.subsystems.imported_repo import ImportedRepo
... | tdyas/pants | contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py | Python | apache-2.0 | 2,841 |
''' Example dangerous usage of urllib[2] opener functions
The urllib and urllib2 opener functions and object can open http, ftp,
and file urls. Often, the ability to open file urls is overlooked leading
to code that can unexpectedly open files on the local server. This
could be used by an attacker to leak information ... | pombredanne/bandit | examples/urlopen.py | Python | apache-2.0 | 1,879 |
# -*- 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/gapic-generator-python | tests/integration/goldens/logging/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py | Python | apache-2.0 | 1,381 |
"""Helper functions for an SVN build."""
from __future__ import absolute_import
from __future__ import print_function
import re
import os
import errno
from .constants import SVN_ROOT, SVN_REDHAT_PATH, SVN_RESTRICTED_BRANCHES, KOJI_RESTRICTED_TARGETS
from .error import Error, SVNError, UsageError
from . import utils
... | opensciencegrid/osg-build | osgbuild/svn.py | Python | apache-2.0 | 10,034 |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Rupesh Tare <rupesht@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import
import os.path
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK... | stephane-martin/salt-debian-packaging | salt-2016.3.3/tests/unit/modules/linux_lvm_test.py | Python | apache-2.0 | 11,687 |
# -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2016 mrknow
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) any ... | mrknow/filmkodi | plugin.video.fanfilm/resources/lib/sources/segos_mv.py | Python | apache-2.0 | 5,195 |
from django.http import FileResponse
from django.core.files.base import ContentFile
from rest_framework import generics
from rest_framework import permissions as drf_permissions
from rest_framework.exceptions import NotFound, PermissionDenied, ValidationError
from framework.auth.oauth_scopes import CoreScopes
from o... | mattclark/osf.io | api/files/views.py | Python | apache-2.0 | 9,504 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.test import TestCase
from zilencer.models import Deployment
from zerver.models import (
get_realm, get_user_profile_by_email,
PreregistrationUser, Realm, ScheduledJob, UserProfile,
)
from zerver.lib.actions import (
create_stream_if_nee... | gkotian/zulip | zerver/test_signup.py | Python | apache-2.0 | 20,333 |
from simpletcp.clientsocket import ClientSocket
s1 = ClientSocket("localhost", 5000)
response = s1.send("Hello, World!")
s2 = ClientSocket("localhost", 5000, single_use=False)
r1 = s2.send("Hello for the first time...")
r2 = s2.send("...and hello for the last!")
s2.close()
# Display the correspondence
print("s1 sent... | gragas/simpletcp | examples/echoreverse/client.py | Python | apache-2.0 | 664 |
ACCOUNT_NAME = 'Bosch'
| 0--key/lib | portfolio/Python/scrapy/bosch_russian/__init__.py | Python | apache-2.0 | 23 |
#!/usr/bin/env python
#
# 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 (th... | radicalbit/ambari | ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/shell_config.py | Python | apache-2.0 | 2,414 |
#!/usr/bin/env python
# vim:ts=4:sw=4:et:
# no unicode literals
from __future__ import absolute_import, division, print_function
import argparse
import json
import math
import multiprocessing
import os
import os.path
import random
import shutil
import signal
import subprocess
import sys
import tempfile
import threadi... | nodakai/watchman | runtests.py | Python | apache-2.0 | 18,169 |
# Copyright 2012 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 requ... | alexandrucoman/vbox-neutron-agent | neutron/tests/unit/agent/linux/test_ip_lib.py | Python | apache-2.0 | 43,884 |
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.AZURE)
driver = cls(subscription_id="subscription-id", key_file="/path/to/azure_cert.pem")
| apache/libcloud | docs/examples/compute/azure/instantiate.py | Python | apache-2.0 | 212 |
# Copyright 2013 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 in... | ajayaa/keystone | keystone/tests/unit/test_v3_credential.py | Python | apache-2.0 | 19,309 |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | gforcada/jenkins-job-builder | jenkins_jobs/sphinx/yaml.py | Python | apache-2.0 | 4,991 |
from django.shortcuts import render
# Create your views here.
def proindex(request):
return render(request, 'example/probase.html' )
def index(request):
return render(request, 'e_index.html' )
def badges_labels(request):
return render(request, 'badges_labels.html' )
def four(requ... | chenqi123/ipaas | example/views.py | Python | apache-2.0 | 6,131 |
#!/usr/bin/env python
##
## Copyright 2009 Adriana Lukas & Alec Muffett
##
## 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... | vavavr00m/pymine | util/base58.py | Python | apache-2.0 | 1,596 |
import contextlib
import gzip
import hashlib
import io
import mmap
from builtins import (
map as imap,
)
def gzip_compress(data, compresslevel=6):
compressed = io.BytesIO()
with gzip.GzipFile(fileobj=compressed,
mode="wb",
compresslevel=compresslevel) as comp... | nanshe-org/nanshe_workflow | nanshe_workflow/util.py | Python | apache-2.0 | 733 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | sasha-gitg/python-aiplatform | samples/snippets/job_service/cancel_data_labeling_job_sample.py | Python | apache-2.0 | 1,485 |
#
# 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... | irinabov/debian-qpid-python | qpid_tests/broker_0_8/tx.py | Python | apache-2.0 | 8,155 |
# Copyright 2018 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... | hfp/tensorflow-xsmm | tensorflow/contrib/distribute/python/minimize_loss_test.py | Python | apache-2.0 | 20,274 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | rcbops/nova-buildpackage | nova/tests/rpc/test_carrot.py | Python | apache-2.0 | 1,534 |
#!/usr/bin/python3
# Generate .js files defining Blockly core and language messages.
#
# Copyright 2013 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... | rachel-fenichel/blockly | scripts/i18n/create_messages.py | Python | apache-2.0 | 6,375 |
from setuptools import setup
import re
def read(filename):
with open(filename) as f:
return f.read()
__version__ = re.search(r'^__version__ = ([\'"])(?P<version>.*)\1$',
read('numtraits.py'), re.M).groupdict()['version']
try:
import pypandoc
long_description = pypandoc.con... | astrofrog/numtraits | setup.py | Python | bsd-2-clause | 790 |
# -*- coding: utf-8 -*-
# pylint: disable=no-self-use, line-too-long
from __future__ import absolute_import, print_function, with_statement
import sys
import unittest
from mock import Mock, patch
from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import
import six
from six.moves import range ... | benthomasson/behave | test/test_model.py | Python | bsd-2-clause | 31,063 |
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Alex Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD
import numpy as np
from nose.tools import assert_equal, assert_raises
from numpy.testing import assert_array... | jaeilepp/eggie | mne/tests/test_fixes.py | Python | bsd-2-clause | 4,590 |
'''
Created on Jan 06, 2016
@author: kashefy
'''
from nose.tools import assert_greater, assert_equal, assert_is_instance, assert_true
import nideep.iow.lmdb_utils as lu
class TestLMDBConsts:
def test_map_sz(self):
assert_greater(lu.MAP_SZ, 0)
assert_is_instance(lu.MAP_SZ, int)
def test_num_... | kashefy/caffe_sandbox | nideep/iow/test_lmdb_utils.py | Python | bsd-2-clause | 1,119 |
import numpy
try:
import matplotlib.pyplot as pypl
plotting = True
except:
plotting = False
import os, shutil
this_dir = os.path.dirname(os.path.realpath(__file__))
import condor
import logging
logger = logging.getLogger('condor')
logger.setLevel("INFO")
#logger.setLevel("DEBUG")
out_dir = this_dir + "... | FXIhub/condor | examples/scripts/rotations/example.py | Python | bsd-2-clause | 6,922 |
# -*- coding: utf-8 -*-
"""
Extensible permission system for pybbm
"""
from __future__ import unicode_literals
from django.db.models import Q
from pybb import defaults, util
class DefaultPermissionHandler(object):
"""
Default Permission handler. If you want to implement custom permissions (for example,
... | skolsuper/pybbm | pybb/permissions.py | Python | bsd-2-clause | 7,490 |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
import logging
import click
import socket
from mkdocs import __version__
from mkdocs import utils
from mkdocs import exceptions
from mkdocs import config
from mkdocs.commands import build, gh_deploy, new, serve
log = logging.getLogger(__na... | lukfor/mkdocs | mkdocs/__main__.py | Python | bsd-2-clause | 8,721 |
from __future__ import absolute_import
from sentry import tsdb, ratelimits
from sentry.api.serializers import serialize
from sentry.plugins.base import Plugin
from sentry.plugins.base.configuration import react_plugin_config
from sentry.plugins.status import PluginStatus
class DataForwardingPlugin(Plugin):
statu... | mvaled/sentry | src/sentry/plugins/bases/data_forwarding.py | Python | bsd-3-clause | 1,514 |
#!/usr/bin/env python
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
###############################... | arrayfire/arrayfire_python | tests/simple/algorithm.py | Python | bsd-3-clause | 3,357 |
import pytest
import numpy as np
import scipy.linalg
import scipy.sparse
import qutip
if qutip.settings.has_mkl:
from qutip._mkl.spsolve import mkl_splu, mkl_spsolve
pytestmark = [
pytest.mark.skipif(not qutip.settings.has_mkl,
reason='MKL extensions not found.'),
]
class Test_spsolve... | qutip/qutip | qutip/tests/test_mkl.py | Python | bsd-3-clause | 3,447 |
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pytest
import dask.dataframe as dd
from dask.dataframe.utils import assert_eq, PANDAS_ge_0190
@pytest.mark.parametrize('data', [
pd.Series([1, 1, 1, 2, 2, 1, 3, 4], dtype='category'),
pd.Series(pd.Categorical([1, 1, 1, 2, 2, 1, ... | chrisbarber/dask | dask/dataframe/tests/test_reshape.py | Python | bsd-3-clause | 6,521 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('custom_image', '0002_auto_20160621_1510'),
]
operations = [
migrations.AlterModelOptions(
name='image',
options={'verbose_name': 'image', 'verbose_name_plural': 'ima... | webu/django-filer | tests/utils/custom_image/migrations/0003_auto_20180414_2059.py | Python | bsd-3-clause | 839 |
#!/usr/bin/env python
from mvbb.box_db import MVBBLoader
import multiprocessing, subprocess
from multiprocessing import Pool
import sys
from plugins import soft_hand
def grasp_boxes(filename):
subprocess.call(['python', './grasp_boxes_batch.py', filename])
if __name__ == '__main__':
try:
import os.p... | lia2790/grasp_learning | python/simple_batch_splitter.py | Python | bsd-3-clause | 913 |
# encoding: latin1
"""createVariable
"""
__author__ = "Juan C. Duque, Alejandro Betancourt, Juan Sebastian Marín"
__credits__ = "Copyright (c) 2010-11 Juan C. Duque"
__license__ = "New BSD License"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "contacto@rise-group.org"
__all__ = ['fieldOperation']
im... | clusterpy/clusterpy | clusterpy/core/data/createVariable.py | Python | bsd-3-clause | 2,144 |
tests=[
("python","UnitTestBuildComposite.py",{}),
("python","UnitTestScreenComposite.py",{}),
("python","UnitTestAnalyzeComposite.py",{}),
]
for dir in ['Cluster','Composite','Data','DecTree','Descriptors','FeatureSelect','InfoTheory','KNN','ModelPackage','NaiveBayes','Neural','SLT']:
tests.append(('pyth... | rdkit/rdkit-orig | rdkit/ML/test_list.py | Python | bsd-3-clause | 523 |
from unittest import TestCase
from rfxcom.protocol.temperature import Temperature
from rfxcom.exceptions import (InvalidPacketLength, UnknownPacketSubtype,
UnknownPacketType)
class TemperatureTestCase(TestCase):
def setUp(self):
self.data = bytearray(b'\x08\x50\x02\x11\x... | skimpax/python-rfxcom | tests/protocol/test_temperature.py | Python | bsd-3-clause | 3,484 |
from MergeIndependent import *
| mica-gossip/MiCA | tools/micavis/custom/RoundRobinMerge.py | Python | bsd-3-clause | 31 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from .. import config as _config
class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `astropy.table`.
"""
auto_colname = _config.ConfigItem(
'col{0}',
'The template that determines the name of a column ... | funbaker/astropy | astropy/table/__init__.py | Python | bsd-3-clause | 2,381 |
from django.db.models import CharField
from django.utils.translation import ugettext_lazy as _
from localflavor.deprecation import DeprecatedPhoneNumberField
from . import forms
from .au_states import STATE_CHOICES
from .validators import AUBusinessNumberFieldValidator, AUCompanyNumberFieldValidator, AUTaxFileNumberF... | thor/django-localflavor | localflavor/au/models.py | Python | bsd-3-clause | 5,128 |
from reportlab.test import unittest
from reportlab.test.utils import makeSuiteForClasses, outputfile, printLocation, NearTestCase
from reportlab.pdfgen.canvas import Canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase import pdfutils
from reportlab.platy... | alexissmirnov/donomo | donomo_archive/lib/reportlab/test/test_pdfbase_encodings.py | Python | bsd-3-clause | 10,317 |
# -*- coding: utf-8 -*-
"""
Auth-SHA1/HMAC
~~~~~~~~~~~~~~
Securing an Eve-powered API with Basic Authentication (RFC2617).
This script assumes that user accounts are stored in a MongoDB collection
('accounts'), and that passwords are stored as SHA1/HMAC hashes. All API
resources/methods will ... | mugurrus/eve | examples/security/sha1-hmac.py | Python | bsd-3-clause | 1,400 |
r"""
Used to configure the main parameters for each implemented model.
.. currentmodule:: compmech.conecyl.modelDB
"""
import numpy as np
from scipy.sparse import coo_matrix
from clpt import *
from fsdt import *
db = {
'clpt_donnell_bc1': {
'linear static': True,
'linear... | saullocastro/compmech | compmech/conecyl/modelDB.py | Python | bsd-3-clause | 17,932 |
import os.path
import gwt
from ...weights import W
from warnings import warn
__author__ = "Myunghwa Hwang <mhwang4@gmail.com>"
__all__ = ["DatIO"]
class DatIO(gwt.GwtIO):
"""
Opens, reads, and writes file objects in DAT format.
Spatial weights objects in DAT format are used in
Dr. LeSage's MatLab Ec... | sjsrey/pysal_core | pysal_core/io/IOHandlers/dat.py | Python | bsd-3-clause | 3,059 |
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class AdvDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py | Python | bsd-3-clause | 11,243 |
""" Module to correct pulsar and FRB DMs for the MW ISM """
from ne2001 import ne_io, density #ne2001 ism model
import pygedm #ymw ism model
import numpy as np
import pandas as pd
from astropy import units as u
from astropy.coordinates import SkyCoord, Galactic
import logging
logging.basicConfig(format='%(asctime)s -... | FRBs/DM | frb/dm_kde/sort_transient_data.py | Python | bsd-3-clause | 4,742 |
from django import forms
METHOD_CHOICES = (
("GET", "GET"),
("POST", "POST")
)
class ApiCallForm(forms.Form):
method = forms.ChoiceField(choices=METHOD_CHOICES, initial="GET")
path = forms.CharField(initial="/api/myself/")
data = forms.CharField(widget=forms.Textarea, required=False)
| hylje/lbtcex | lbtcex/main/forms.py | Python | bsd-3-clause | 307 |
# -*- coding:utf-8 -*-
import unittest
import mock
from ..models import JobPosting
class JobPostingTestCase(unittest.TestCase):
def test_unicode_should_return_position_name(self):
# setup
model = JobPosting()
model.position_name = 'Position Name'
# action
email = unicode(... | hellhovnd/dentexchange | dentexchange/apps/employer/tests/test_job_posting.py | Python | bsd-3-clause | 398 |
# -*- coding: utf-8 -*-
"""
Test output formatting for Series/DataFrame, including to_string & reprs
"""
from __future__ import print_function
from datetime import datetime
import itertools
from operator import methodcaller
import os
import re
import sys
import textwrap
import warnings
import dateutil
import numpy ... | GuessWhoSamFoo/pandas | pandas/tests/io/formats/test_format.py | Python | bsd-3-clause | 110,932 |
# Copyright 2015 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.
from copy import deepcopy
from recipe_engine import recipe_test_api
class iOSTestApi(recipe_test_api.RecipeTestApi):
@recipe_test_api.mod_test_data
@sta... | eunchong/build | scripts/slave/recipe_modules/ios/test_api.py | Python | bsd-3-clause | 1,200 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from mock import patch
from oauthlib.oauth2 import LegacyApplicationClient
from ....unittest import TestCase
@patch('time.time', new=lambda: 1000)
class LegacyApplicationClientTest(TestCase):
client_id = "someclientid"
scope ... | lepture/oauthlib | tests/oauth2/rfc6749/clients/test_legacy_application.py | Python | bsd-3-clause | 2,383 |
# (c) 2011, 2012 Georgia Tech Research Corporation
# This source code is released under the New BSD license. Please see
# http://wiki.quantsoftware.org/index.php?title=QSTK_License
# for license details.
#
# Created on October <day>, 2011
#
# @author: Vishal Shekhar
# @contact: mailvishalshekhar@gmail.com
# @summary: ... | grahesh/Stock-Market-Event-Analysis | qstkstudy/stockListGen.py | Python | bsd-3-clause | 1,592 |
import collections
def make_enum(name, fields):
return collections.namedtuple(name, fields)(*range(len(fields)))
| tingelst/pymanopt | pymanopt/tools/__init__.py | Python | bsd-3-clause | 119 |
# coding=utf-8
"""
Collector that reports amavis metrics as reported by amavisd-agent
#### Dependencies
* amavisd-agent must be present in PATH
"""
import os
import subprocess
import re
import diamond.collector
import diamond.convertor
from diamond.collector import str_to_bool
class AmavisCollector(diamond.coll... | MichaelDoyle/Diamond | src/collectors/amavis/amavis.py | Python | mit | 3,732 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import subprocess
import gdb
import pwndbg.arch
import pwndbg.color.memory as M
import pwndbg.commands
imp... | 0xddaa/pwndbg | pwndbg/commands/xinfo.py | Python | mit | 4,499 |
# -*- coding: utf-8 -*-
from .models import User
from .views import user
from .constants import USER_ROLE, ADMIN, USER, USER_STATUS, NEW, ACTIVE
| jessekl/flixr | fbone/modules/user/__init__.py | Python | mit | 146 |
#!/usr/bin/env python
"""Parses language data from IANA subtag registry plus several other files,
and outputs JSON data in the following format:
[
{
'name': 'Ghotuo',
'code': { 'three': 'aaa' },
'country': ['Nigeria'],
'altNames': [],
},
{
'name': 'Alumu',
'c... | sil-jterm-2015/sfwebchecks | src/scripts/language picker/build-json-language-data.py | Python | mit | 8,241 |
#!/usr/bin/python
"""This script run the pathologic """
try:
import optparse, sys, re, csv, traceback
from optparse import OptionGroup
import pickle
import math
from libs.python_modules.taxonomy.LCAComputation import *
import operator
from os import path, _exit, remove, rename
import logging.... | kishori82/MetaPathways_Python.3.0 | utilities/extract_flat_files.py | Python | mit | 7,627 |
#!/usr/bin/env python
# Copyright(C) 2011-2016 Thomas Voegtlin
#
# 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, copy, m... | bauerj/electrum-server | src/storage.py | Python | mit | 22,202 |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
class WeibopError(Exception):
"""Weibopy exception"""
def __init__(self, reason):
self.reason = reason.encode('utf-8')
def __str__(self):
return self.reason
| sunner/buzz2weibo | weibopy/error.py | Python | mit | 256 |
# ~autogen spec_version
spec_version = "spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3"
# ~autogen
| ddemidov/ev3dev-lang-python-1 | spec_version.py | Python | mit | 108 |
"""
===========
N2D+ fitter
===========
Reference for line params:
Dore (priv. comm.) line frequencies in CDMS,
line strength can also be obtained from Splatalogue
L. Dore, P. Caselli, S. Beninati, T. Bourke, P. C. Myers and G. Cazzoli A&A 413, 1177-1181 (2004)
http://adsabs.harvard.edu/abs/2004A%26A...413.1177D
L. ... | vlas-sokolov/pyspeckit | pyspeckit/spectrum/models/n2dp.py | Python | mit | 7,091 |
# coding: utf-8
from smarthumb import SMARTHUMB
from gluon.contrib.imageutils import RESIZE
# Noticias
db.noticias.titulo.requires = [
IS_NOT_EMPTY(error_message=T('Este campo não pode ficar vazio!')),
IS_NOT_IN_DB(db, db.noticias.titulo,
error_message=T('Título deve ser único.')),
IS_LENG... | pvsousalima/marolo | models/20_validators.py | Python | mit | 6,559 |
"""
Django settings for tests project.
"""
from __future__ import unicode_literals
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.c... | romansalin/django-seo | tests/settings.py | Python | mit | 2,490 |
#-- GAUDI jobOptions generated on Fri Jul 17 16:39:48 2015
#-- Contains event types :
#-- 11104124 - 106 files - 1087377 events - 233.68 GBytes
#-- Extra information about the data processing phases:
#-- Processing Pass Step-124620
#-- StepId : 124620
#-- StepName : Digi13 with G4 dE/dx
#-- ApplicationN... | Williams224/davinci-scripts | ksteta3pi/Consideredbkg/MC_12_11104124_MagUp.py | Python | mit | 12,177 |
# -*- coding: utf-8 -*-
from flask_login import LoginManager
from tamactiluya.models import User
login_manager = LoginManager()
login_manager.session_protection = 'strong'
login_manager.login_view = 'user.login'
@login_manager.user_loader
def user_loader(uname) -> User or None:
"""
:param uname:
:retu... | tokyo-jesus/tamactiluya | tamactiluya/auth.py | Python | mit | 413 |
replacing='qwertyuiopasdfghjklzxcvbnm )([]\/{}!@#$%^&*'
a='\/abcdefghijklmnopqrstuvwxyz() }{][*%$&^#@!'
replacing=list(replacing)
a=list(a)
d={}
e={}
if len(replacing)==len(a):
for x in range(len(a)):
d[replacing[x]]=a[x]
e[a[x]]=replacing[x]
def encypt(dict,stri... | javaarchive/PIDLE | ccode.py | Python | mit | 846 |
from unittest import TestCase
import six
from regparser.tree.depth import markers, optional_rules, rules
from regparser.tree.depth.derive import debug_idx, derive_depths
from regparser.tree.depth.markers import INLINE_STARS, MARKERLESS, STARS_TAG
class DeriveTests(TestCase):
def assert_depth_match(self, markers... | tadhg-ohiggins/regulations-parser | tests/tree_depth_derive_tests.py | Python | cc0-1.0 | 11,439 |
#!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script retrieves the history of all V8 branches and trunk revisions and
# their corresponding Chromium revisions.
# Requires ... | hellotomfan/v8-coroutine | deps/v8/tools/push-to-trunk/releases.py | Python | gpl-2.0 | 18,090 |
import os
import sys
import yaml
import re
from subprocess import Popen, PIPE, call
from random import randrange
from threading import Thread
import SocketServer
import struct
import pdb
sys.path.insert(0, '/usr/local/lib/python2.6/dist-packages/rethinkdb')
import ql2_pb2 as p
# tree of YAML documents defining docume... | felixonmars/app | lib/vendor/php-rql/docs/scripts/validate_examples.py | Python | gpl-2.0 | 5,917 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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) any ... | AMOboxTV/AMOBox.LegoBuild | plugin.video.titan/resources/lib/resolvers/ishared.py | Python | gpl-2.0 | 1,793 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class prelink(test.test):
"""
Autotest module for testing basic functionality
of prelink
@author Athira Rajeev <atraj... | rajashreer7/autotest-client-tests | linux-tools/prelink/prelink.py | Python | gpl-2.0 | 1,662 |
import sys
import gevent
from gevent import socket
import greentest
class Test(greentest.TestCase):
def start(self):
self.server = socket.socket()
self.server.bind(('127.0.0.1', 0))
self.server.listen(1)
self.server_port = self.server.getsockname()[1]
self.acceptor = geven... | mgadi/naemonbox | sources/psdash/gevent-1.0.1/greentest/test__socket_timeout.py | Python | gpl-2.0 | 1,258 |
from __future__ import with_statement
from xdrdef.pnfs_block_pack import PNFS_BLOCKPacker as Packer
from xdrdef.pnfs_block_pack import PNFS_BLOCKUnpacker as Unpacker
from xdrdef.pnfs_block_type import *
from xdrdef.pnfs_block_const import *
import fs_base
from threading import Lock
import struct
# draft 8
# All size... | srimalik/pynfs | nfs4.1/block.py | Python | gpl-2.0 | 10,274 |
from gevent import monkey; monkey.patch_all()
import threading
localdata = threading.local()
localdata.x = "hello"
assert localdata.x == 'hello'
success = []
def func():
try:
localdata.x
raise AssertionError('localdata.x must raise AttributeError')
except AttributeError:
pass
asse... | mgadi/naemonbox | sources/psdash/gevent-1.0.1/greentest/test__threading_patched_local.py | Python | gpl-2.0 | 510 |