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 django.conf import settings
from django.http import HttpResponseForbidden
from django.template import Context, Template
from django.utils.translation import ugettext as _
from django.utils.version import get_docs_version
# We include the template inline since we need to be able to reliably display
# this error me... | iambibhas/django | django/views/csrf.py | Python | bsd-3-clause | 5,059 |
"""
Load WKB into pysal shapes.
Where pysal shapes support multiple parts,
"MULTI"type shapes will be converted to a single multi-part shape:
MULTIPOLYGON -> Polygon
MULTILINESTRING -> Chain
Otherwise a list of shapes will be returned:
MULTIPOINT -> [pt0, ..., ptN]
Some concepts aren't well supported by... | sjsrey/pysal_core | pysal_core/io/util/wkb.py | Python | bsd-3-clause | 7,872 |
#!/usr/bin/env python
# coding: utf-8
"""Unit tests for vtdb.tablet"""
import unittest
import mock
from net import gorpc
import utils
from vtdb import tablet
class TestRPCCallAndExtract(unittest.TestCase):
"""Tests rpc_call_and_extract_error is tolerant to various responses."""
tablet_conn = tablet.TabletConn... | cgvarela/vitess | test/tablet_test.py | Python | bsd-3-clause | 2,879 |
"""tests module"""
| justinslee/Wai-Not-Makahiki | makahiki/apps/widgets/quests/tests/__init__.py | Python | mit | 19 |
from __future__ import unicode_literals
import os
from os import path
import re
def split(text):
"""Split an annotation file by sentence. Each sentence's annotation should
be a single string."""
return text.strip().split('\n')[1:-1]
def parse(string, strip_bad_periods=False):
"""Given a sentence... | wbwseeker/spaCy | spacy/munge/read_ner.py | Python | mit | 3,728 |
l1 = TimeSeries.fetch_open_data('L1', 1126259457, 1126259467)
from gwpy.plotter import TimeSeriesPlot
plot = TimeSeriesPlot()
ax = plot.gca()
ax.plot(h1, color='gwpy:ligo-hanford')
ax.plot(l1, color='gwpy:ligo-livingston')
ax.set_ylabel('Strain noise')
plot.show()
| gwpy/gwpy.github.io | docs/latest/plotter/index-2.py | Python | gpl-3.0 | 265 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | crmccreary/openerp_server | openerp/addons/product_manufacturer/__openerp__.py | Python | agpl-3.0 | 1,833 |
"""revert account unique constraint
Revision ID: 4032709362da
Revises: 211e93aff1e1
Create Date: 2015-03-25 23:46:25.649192
"""
# revision identifiers, used by Alembic.
revision = '4032709362da'
down_revision = '211e93aff1e1'
from alembic import op
def upgrade():
conn = op.get_bind()
index_name = conn.exe... | nylas/sync-engine | migrations/versions/153_revert_account_unique_constraint.py | Python | agpl-3.0 | 921 |
# Copyright 2016 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 types
from py_trace_event.trace_event_impl import decorators
class TracedMetaClass(type):
def __new__(cls, name, bases, attrs):
for attr_name... | mrtnrdl/.macdots | scripts/bin/platform-tools/systrace/catapult/common/py_trace_event/py_trace_event/trace_event_impl/meta_class.py | Python | unlicense | 538 |
from gppylib.gparray import FAULT_STRATEGY_FILE_REPLICATION, get_gparray_from_config
class MirrorMatchingCheck:
def run_check(self, db_connection, logger):
logger.info('-----------------------------------')
logger.info('Checking mirroring_matching')
is_config_mirror_enabled = get_gparray... | cjcjameson/gpdb | gpMgmt/bin/gpcheckcat_modules/mirror_matching_check.py | Python | apache-2.0 | 1,789 |
# -*- coding: utf-8 -*-
"""
Edit Toolbar middleware
"""
from cms.utils.conf import get_cms_setting
from cms.toolbar.toolbar import CMSToolbar
from cms.utils.i18n import force_language
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE
from menus.menu_pool import menu_pool
from django.http import HttpRes... | vstoykov/django-cms | cms/middleware/toolbar.py | Python | bsd-3-clause | 5,441 |
#!/usr/bin/env python
#
# 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.
"""Utility for dart_pkg and dart_pkg_app rules"""
import argparse
import errno
import os
import shutil
import sys
# Disable lint ch... | hgl888/chromium-crosswalk | third_party/mojo/src/mojo/public/tools/dart_pkg.py | Python | bsd-3-clause | 7,740 |
import sqlite3
import datetime
class DataStore:
def __init__(self):
self.conn = None
def read(variable):
if self.is_connected():
c = self.conn.cursor()
t = (variable.name,)
c.execute('SELECT * FROM curve WHERE name=? ORDER BY time ASC', t)
return c.fetchall()
else:
... | victor-rene/MicroScada | archive/day_13/datastore.py | Python | mit | 1,020 |
# -*- coding: latin-1 -*-
"""Tests for cookielib.py."""
import cookielib
import os
import re
import time
from unittest import TestCase
from test import test_support
class DateTimeTests(TestCase):
def test_time2isoz(self):
from cookielib import time2isoz
base = 1019227000
... | ktan2020/legacy-automation | win/Lib/test/test_cookielib.py | Python | mit | 73,964 |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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 later version.
CVXPY is distributed i... | argriffing/cvxpy | cvxpy/atoms/norm1.py | Python | gpl-3.0 | 735 |
##################################################################################################
# $HeadURL$
##################################################################################################
"""Collection of DIRAC useful statistics related modules.
.. warning::
By default on Error they return N... | avedaee/DIRAC | Core/Utilities/Statistics.py | Python | gpl-3.0 | 2,281 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | elsigh/browserscope | third_party/appengine_tools/devappserver2/endpoints/discovery_api_proxy.py | Python | apache-2.0 | 3,882 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
... | jtrobec/pants | src/python/pants/backend/jvm/tasks/jvm_compile/analysis_parser.py | Python | apache-2.0 | 5,221 |
#!/usr/bin/env python2
"""Demo checker script.
Given a demo .cpp file PATH.cpp we can make it a small test if there is a file
PATH.cpp.stdout and/or PATH.cpp.stderr. The test is implemented using this
script.
The script is called with the options --binary-path and one or both of
--stdout-path and --stderr-path. The... | xenigmax/seqan | util/bin/demo_checker.py | Python | bsd-3-clause | 4,665 |
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.postgres.operations import HStoreExtension
class Migration(migrations.Migration):
dependencies = [
('product', '0020_attribute_data_to_class'),
]
operations = [
HStoreExtension(),
]
| tfroehlich82/saleor | saleor/product/migrations/0021_add_hstore_extension.py | Python | bsd-3-clause | 312 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... | renatofb/weblate | weblate/sitemaps.py | Python | gpl-3.0 | 3,132 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError:
from django.contrib.auth.models import User
else:
User = get_user_mode... | canhhs91/greenpointtrees | src/paypal/pro/south_migrations/0001_initial.py | Python | mit | 7,020 |
# Written by Bram Cohen
# see LICENSE.txt for license information
from time import time
class Measure:
def __init__(self, max_rate_period, fudge = 1):
self.max_rate_period = max_rate_period
self.ratesince = time() - fudge
self.last = self.ratesince
self.rate = 0.0
self.tota... | vyrus/wubi | src/bittorrent/CurrentRateMeasure.py | Python | gpl-2.0 | 1,016 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... | thaim/ansible | lib/ansible/modules/network/fortios/fortios_system_custom_language.py | Python | mit | 9,447 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import o... | krishna11888/ai | third_party/gensim/gensim/test/test_hdpmodel.py | Python | gpl-2.0 | 2,047 |
import re
import sys
# Write the config.c file
never = ['marshal', '__main__', '__builtin__', 'sys', 'exceptions', '_warnings']
def makeconfig(infp, outfp, modules, with_ifdef=0):
m1 = re.compile('-- ADDMODULE MARKER 1 --')
m2 = re.compile('-- ADDMODULE MARKER 2 --')
while 1:
line = infp.readline... | teeple/pns_server | work/install/Python-2.7.4/Tools/freeze/makeconfig.py | Python | gpl-2.0 | 1,676 |
#!/usr/bin/env python
"""
This file provides a more advanced example of vtkTable access and
manipulation methods.
"""
from __future__ import print_function
from vtk import *
#------------------------------------------------------------------------------
# Script Entry Point (i.e., main() )
#--------------------------... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Examples/Infovis/Python/tables4.py | Python | gpl-3.0 | 1,335 |
"""fix invalid RAISE NOTICE in update_signatures_hourly.
Revision ID: 495bf3fcdb63
Revises: 3f007539efc
Create Date: 2014-07-07 20:33:34.634141
"""
# revision identifiers, used by Alembic.
revision = '495bf3fcdb63'
down_revision = '1baef149e5d1'
from alembic import op
from socorro.lib import citexttype, jsontype, b... | AdrianGaudebert/socorro | alembic/versions/495bf3fcdb63_fix_invalid_notice_in_update_signatures_hourly.py | Python | mpl-2.0 | 692 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Manuel Sousa <manuel.sousa@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_... | alxgu/ansible | lib/ansible/modules/messaging/rabbitmq/rabbitmq_binding.py | Python | gpl-3.0 | 9,638 |
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | nuclear-wizard/moose | python/mms/test/mms_spatial.py | Python | lgpl-2.1 | 973 |
from __future__ import division, print_function, absolute_import
import os
import sys
if sys.version_info[0] >= 3:
from io import StringIO
else:
from StringIO import StringIO
import tempfile
import numpy as np
from numpy.testing import assert_equal, \
assert_array_almost_equal_nulp
from scipy.sparse imp... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/io/harwell_boeing/tests/test_hb.py | Python | mit | 2,375 |
__all__ = ["foo"]
| kerneltask/micropython | tests/cpydiff/modules3/__init__.py | Python | mit | 18 |
# -*- coding: utf-8 -*-
from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo
class CryptItCom(DeadCrypter):
__name__ = "CryptItCom"
__type__ = "crypter"
__version__ = "0.12"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?crypt-it\.com/(s|e|d|c)/\w+'
__c... | fayf/pyload | module/plugins/crypter/CryptItCom.py | Python | gpl-3.0 | 542 |
from ..models import models
class AllOGRFields(models.Model):
f_decimal = models.FloatField()
f_float = models.FloatField()
f_int = models.IntegerField()
f_char = models.CharField(max_length=10)
f_date = models.DateField()
f_datetime = models.DateTimeField()
f_time = models.TimeField()
... | loic/django | tests/gis_tests/inspectapp/models.py | Python | bsd-3-clause | 713 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The freesurfer module provides basic functions for interfacing with
freesurfer tools.
Currently these tools are supported:
* Dicom2Nifti: using mri_convert
* Resample: using mri_convert
Exam... | mick-d/nipype_source | nipype/interfaces/freesurfer/base.py | Python | bsd-3-clause | 4,569 |
#!/usr/bin/python
#
# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | EvanK/ansible | lib/ansible/modules/cloud/azure/azure_rm_devtestlabvirtualnetwork_facts.py | Python | gpl-3.0 | 6,547 |
"""Django admin interface for the shopping cart models. """
from django.contrib import admin
from shoppingcart.models import (
Coupon,
CourseRegistrationCodeInvoiceItem,
DonationConfiguration,
Invoice,
InvoiceTransaction,
PaidCourseRegistrationAnnotation
)
class SoftDeleteCouponAdmin(admin.Mo... | ahmedaljazzar/edx-platform | lms/djangoapps/shoppingcart/admin.py | Python | agpl-3.0 | 5,178 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | scheib/chromium | third_party/protobuf/python/google/protobuf/internal/enum_type_wrapper.py | Python | bsd-3-clause | 4,495 |
# Copyright (c) 2009 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions... | BIT-SYS/gem5-spm-module | src/mem/ruby/system/DirectoryMemory.py | Python | bsd-3-clause | 2,226 |
"""
Stop the test run after the first error or failure.
This plugin implements :func:`testOutcome` and sets
``event.result.shouldStop`` if it sees an outcome with exc_info that
is not expected.
"""
from nose2 import events
__unittest = True
class FailFast(events.Plugin):
"""Stop the test run after error or ... | usc-isi-i2/WEDC | spark_dependencies/python_lib/nose2/plugins/failfast.py | Python | apache-2.0 | 615 |
#!/usr/bin/env python
import sys
import os
import getpass
import datetime
from github import Github
from github_issues import GithubIssues
gh = Github(login_or_token=raw_input("Enter github username: "),
password=getpass.getpass('Enter github password: '),
user_agent='PyGithub/Python')
print ... | ypu/virt-test | tools/github/cache_populate.py | Python | gpl-2.0 | 718 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, Steve Gargan <steve.gargan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 th... | CenturylinkTechnology/ansible-modules-extras | clustering/consul_session.py | Python | gpl-3.0 | 9,707 |
# (c) 2016, Allen Sanabria <asanabria@linuxdynasty.org>
#
# This file is part of Ansible
#
# Ansible 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 l... | Tatsh-ansible/ansible | lib/ansible/plugins/action/include_vars.py | Python | gpl-3.0 | 10,206 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vispy: testskip
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ------------------------------------------------------... | drufat/vispy | examples/benchmark/simple_glut.py | Python | bsd-3-clause | 1,363 |
# Copyright (C) 2010 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 writ... | lucidbard/NewsBlur | vendor/oauth2client/appengine.py | Python | mit | 19,989 |
#!/usr/bin/env python
"""
crackfortran --- read fortran (77,90) code and extract declaration information.
Copyright 1999-2004 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESSE... | kiwifb/numpy | numpy/f2py/crackfortran.py | Python | bsd-3-clause | 126,846 |
# pylint: disable=too-many-lines
"""
homeassistant.components.camera
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to interface with various cameras.
The following features are supported:
- Returning recorded camera images and streams
- Proxying image requests via HA for external access
- Converting a still image url i... | alanbowman/home-assistant | homeassistant/components/camera/__init__.py | Python | mit | 6,728 |
import os
from clang.cindex import Config
if 'CLANG_LIBRARY_PATH' in os.environ:
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
from clang.cindex import LinkageKind
from clang.cindex import Cursor
from clang.cindex import TranslationUnit
from .util import get_cursor
from .util import get_tu
import uni... | endlessm/chromium-browser | third_party/llvm/clang/bindings/python/tests/cindex/test_linkage.py | Python | bsd-3-clause | 1,175 |
# -*- coding: utf-8 -*-
import numpy as np
import scipy.special
from bokeh.plotting import figure, output_file, show, VBox
mu, sigma = 0, 0.5 # NOTE: you can tinker with these values if you like
# sample the distribution
measured = np.random.normal(mu, sigma, 1000)
hist, edges = np.histogram(measured, density... | almarklein/bokeh | sphinx/source/tutorial/solutions/histogram.py | Python | bsd-3-clause | 4,587 |
""" Sahana Eden Module Automated Tests - INV001 Send Items
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
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 w... | gallifrey17/eden | modules/tests/inv/send_item.py | Python | mit | 3,148 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test RPC calls related to blockchain state. Tests correspond to code in
# rpcblockchain.cpp.
#
from ... | puzcoin/test1 | qa/rpc-tests/blockchain.py | Python | mit | 2,834 |
import time
__author__ = 'bromix'
import tempfile
from ..abstract_context import AbstractContext
from .mock_settings import MockSettings
from .mock_context_ui import MockContextUI
from .mock_system_version import MockSystemVersion
from ...logging import log
class MockContext(AbstractContext):
def __init__(self... | azumimuo/family-xbmc-addon | zips/plugin.video.youtube/resources/lib/kodion/impl/mock/mock_context.py | Python | gpl-2.0 | 2,846 |
# -*- coding: utf-8 -*-
from framework.exceptions import HTTPError
from website.util.client import BaseClient
from website.addons.googledrive import settings
class GoogleAuthClient(BaseClient):
def userinfo(self, access_token):
return self._make_request(
'GET',
self._build_url(se... | zachjanicki/osf.io | website/addons/googledrive/client.py | Python | apache-2.0 | 1,530 |
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2009 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@gmail.com>
# Angelos Tzotsos <tzotsos@gmail.com>
#
# Contact email: tomkralidis@gmail.com
# ================================... | Gaia3D/QGIS | python/ext-libs/owslib/iso.py | Python | gpl-2.0 | 36,451 |
import keyword
import sys
import warnings
import rope.base.codeanalyze
import rope.base.evaluate
from rope.base import pyobjects, pyobjectsdef, pynames, builtins, exceptions, worder
from rope.base.codeanalyze import SourceLinesAdapter
from rope.contrib import fixsyntax
from rope.refactor import functionutils
def cod... | JetChars/vim | vim/bundle/python-mode/pymode/libs3/rope/contrib/codeassist.py | Python | apache-2.0 | 25,419 |
from setuptools import setup, find_packages
import storages
setup(
name = 'django-storages',
version = storages.__version__,
packages = find_packages(),
author = 'David Larlet',
author_email = 'david@larlet.fr',
license = 'BSD',
description = 'Support for many storages (S3, MogileFS, etc) ... | mattcaldwell/django-storages-py3 | setup.py | Python | bsd-3-clause | 774 |
class MutableValue:
def __init__(self, val=None):
self.value = val
| yland/coala | coalib/misc/MutableValue.py | Python | agpl-3.0 | 80 |
{
'name': 'Base import',
'description': """
New extensible file import for Odoo
======================================
Re-implement Odoo's file import system:
* Server side, the previous system forces most of the logic into the
client which duplicates the effort (between clients), makes the
import system ... | Aravinthu/odoo | addons/base_import/__manifest__.py | Python | agpl-3.0 | 1,164 |
# -*- coding: utf-8 -*-
"""
Pygments unit tests
~~~~~~~~~~~~~~~~~~
Usage::
python run.py [testfile ...]
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
import sys, os
# only find tests... | markeldigital/design-system | vendor/ruby/2.0.0/gems/pygments.rb-0.6.3/vendor/pygments-main/tests/run.py | Python | mit | 951 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | mitch-kyle/message-board | support/apache-cassandra-2.2.1/pylib/cqlshlib/test/basecase.py | Python | apache-2.0 | 2,608 |
# validate.py
# A Validator object
# Copyright (C) 2005 Michael Foord, Mark Andrews, Nicola Larosa
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# mark AT la-la DOT com
# nico AT tekNico DOT net
# This software is licensed under the terms of the BSD license.
# http://www.voidspace.org.uk/python/licens... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/configobj/validate.py | Python | gpl-2.0 | 46,768 |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Gael Varoquaux <gael.varoquaux@inria.fr>
#
# License: BSD 3 clause
import sys
import warnings
from abc import ABCMeta, abstractmethod
import n... | ky822/scikit-learn | sklearn/linear_model/coordinate_descent.py | Python | bsd-3-clause | 75,144 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, api
class event_confirm(models.TransientModel):
"""Event Confirmation"""
_name = "event.confirm"
@api.multi
def confirm(self):
events = self.env['event.event'].brows... | vileopratama/vitech | src/addons/event/wizard/event_confirm.py | Python | mit | 441 |
# 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... | Metaswitch/horizon | openstack_dashboard/test/test_data/heat_data.py | Python | apache-2.0 | 11,072 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrays in the Ruby Koans
#
from runner.koan import *
class AboutLists(Koan):
def test_creating_lists(self):
empty_list = list()
self.assertEqual(list, type(empty_list))
self.assertEqual(__, len(empty_list))
def test_lis... | tokyo-jesus/university | src/python/koans/python2/koans/about_lists.py | Python | unlicense | 2,995 |
"""Utility functions for copying and archiving files and directory trees.
XXX The functions here don't copy the resource fork or other metadata on Mac.
"""
import os
import sys
import stat
from os.path import abspath
import fnmatch
import collections
import errno
try:
from pwd import getpwnam
except ImportError... | Symmetry-Innovations-Pty-Ltd/Python-2.7-for-QNX6.5.0-x86 | usr/pkg/lib/python2.7/shutil.py | Python | mit | 18,302 |
# test floating point floor divide and modulus
# it has some tricky corner cases
# pyboard has 32-bit floating point and gives different (but still
# correct) answers for certain combinations of divmod arguments.
def test(x, y):
div, mod = divmod(x, y)
print(div == x // y, mod == x % y, abs(div * y + mod - x)... | martinribelotta/micropython | tests/float/float_divmod_relaxed.py | Python | mit | 705 |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer that turns <> into !=."""
# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
class FixNe(fixer_base.BaseFix):
# This is so simple that we don't need the pattern com... | teeple/pns_server | work/install/Python-2.7.4/Lib/lib2to3/fixes/fix_ne.py | Python | gpl-2.0 | 573 |
from django.dispatch import Signal
class_prepared = Signal(providing_args=["class"])
pre_init = Signal(providing_args=["instance", "args", "kwargs"])
post_init = Signal(providing_args=["instance"])
pre_save = Signal(providing_args=["instance", "raw", "using"])
post_save = Signal(providing_args=["instance", "raw", "c... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/db/models/signals.py | Python | bsd-3-clause | 658 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/layer3/net_l3_interface.py | Python | bsd-3-clause | 2,074 |
__author__ = 'tgupta'
| janeen666/mi-instrument | mi/instrument/wetlabs/fluorometer/flord_d/test/__init__.py | Python | bsd-2-clause | 22 |
import copy
from django.core.exceptions import ValidationError
from django.core.validators import (
MaxLengthValidator, MaxValueValidator, MinLengthValidator,
MinValueValidator,
)
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
clas... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/contrib/postgres/validators.py | Python | mit | 2,718 |
def _IsColor(color):
"""Try to determine if color is a hex color string.
Labels that look like hex colors will match too, unfortunately."""
if not isinstance(color, basestring):
return False
color = color.strip('#')
if len(color) != 3 and len(color) != 6:
return False
hex_letters = '0123456789abcd... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/graphy/graphy/util.py | Python | bsd-3-clause | 420 |
import setuptools
setuptools.setup(name='txyoga',
version='0',
description='REST toolkit for Twisted',
url='https://github.com/lvh/txyoga',
author='Laurens Van Houtven',
author_email='_@lvh.cc',
packages = setuptools.find_packages(),
requires=['twisted'],
license='IS... | lvh/txyoga | setup.py | Python | isc | 528 |
from unittest import TestCase
from mock import Mock
from cloudshell.cp.openstack.domain.services.nova.nova_instance_service import NovaInstanceService
import cloudshell.cp.openstack.domain.services.nova.nova_instance_service as test_nova_instance_service
from cloudshell.cp.openstack.common.driver_helper import Cloudsh... | QualiSystems/OpenStack-Shell | package/tests/test_cp/test_openstack/test_domain/test_services/test_nova/test_nova_instance_service.py | Python | isc | 27,295 |
# Part of Mead. See LICENSE file for full copyright and licensing details.
import datetime, re
def datetime_convert(time):
"""
Convert time to YYYYY-MM-DD HH:MM:SS
"""
_time = str(time)
retime = re.compile(r'\W+')
_list = retime.split(_time)
if len(_list) >= 6:
year = int(_list[... | kennethreitz-archive/mead | mead/core/tools/date_time.py | Python | isc | 3,456 |
import csv
with open('export.csv', newline='') as csvfile:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
for row in spamreader:
# if row[0].find('laminat'):
print(row[0])
| Boris1961/My-Projects | tst_csv_read.py | Python | mit | 208 |
"""
WSGI config for proxy 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/dev/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... | phyng/python-google-proxy | proxy/wsgi.py | Python | mit | 387 |
# -*- coding: utf-8 -*-
import json
import pytest
from keyard_client import KeyardClient, testutils
@pytest.mark.skipif(not testutils.keyard_is_available(), reason="keyard is missing")
class TestKeyardClient(object):
def setup_method(self, method):
self.client = KeyardClient('http://127.0.0.1:8000')
... | rzanluchi/keyard-client | tests/test_client_integration.py | Python | mit | 890 |
# Authors: Aaron Qiu <zqiu@ulg.ac.be>,
# Antonio Sutera <a.sutera@ulg.ac.be>,
# Arnaud Joly <a.joly@ulg.ac.be>,
# Gilles Louppe <g.louppe@ulg.ac.be>,
# Vincent Francois <v.francois@ulg.ac.be>
#
# License: BSD 3 clause
from __future__ import division, print_function, absolute_import
... | orlandi/connectomicsPerspectivesPaper | participants_codes/aaagv/directivity.py | Python | mit | 2,853 |
from hippy.objects.base import W_Root
class W_BaseIterator(W_Root):
def done(self):
return self.finished
def next(self, space):
raise NotImplementedError
def next_item(self, space):
raise NotImplementedError
class W_InstanceIterator(W_BaseIterator):
def __init__(self, space... | ericpp/hippyvm | hippy/objects/iterator.py | Python | mit | 1,367 |
import _plotly_utils.basevalidators
class MetaValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="meta", parent_name="pointcloud", **kwargs):
super(MetaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
array_o... | plotly/plotly.py | packages/python/plotly/plotly/validators/pointcloud/_meta.py | Python | mit | 438 |
"""247. Strobogrammatic Number II
https://leetcode.com/problems/strobogrammatic-number-ii/
Given an integer n, return all the strobogrammatic numbers that
are of length n. You may return the answer in any order.
A strobogrammatic number is a number that looks the same when
rotated 180 degrees (looked at upside down).... | isudox/leetcode-solution | python-algorithm/leetcode/problem_247.py | Python | mit | 1,241 |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
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 ... | jiivan/python-oauth2 | oauth2/__init__.py | Python | mit | 25,600 |
import unittest
from katas.kyu_6.write_number_in_expanded_form import expanded_form
class ExpandedFormTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(expanded_form(12), '10 + 2')
def test_equal_2(self):
self.assertEqual(expanded_form(42), '40 + 2')
def test_equal_3... | the-zebulan/CodeWars | tests/kyu_6_tests/test_write_number_in_expanded_form.py | Python | mit | 394 |
#!/usr/bin/env python
import sys
import os
import getopt
import time
import random
from messageQueue import MessageQueue
VERSION = 0.5
REQUEST_EXCHANGE = {"name":"Request", "ex_type":"headers"}
IDENTIFY_EXCHANGE = {"name":"Identify", "ex_type":"headers"}
RESULTS_EXCHANGE = {"name":"Results", "ex_type":"headers"}
TR... | ted-dunstone/ivs | hub_demo/send_msg.py | Python | mit | 11,161 |
#!/usr/bin/env python
#
# v0.1 --
#
# fmount <francesco.pantano@linux.com>
#
#
from argparse import ArgumentParser as argparser
import libtmux
import logging
import subprocess as sub
'''
'''
class Tmuxer(object):
def __init__(self, args):
self.logger = logging.getLogger('Tmuxer')
for attr in args.keys():
s... | fmount/tmux-layout | scripts/menu/tmuxer.py | Python | mit | 1,794 |
# -*- coding: utf-8 -*-
from ipaddress import IPv4Network
from sipa.backends import DataSource, Dormitory
from sipa.backends.exceptions import InvalidConfiguration
from . import user, api, userdb
def init_pycroft_api(app):
try:
app.extensions['pycroft_api'] = api.PycroftApi(
endpoint=app.con... | MarauderXtreme/sipa | sipa/model/pycroft/__init__.py | Python | mit | 3,323 |
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', UserWarning)
from kairos import Timeseries
# ignore undefined backend warnings
from collections import defaultdict
import time
MX_FIELDS = ['dns_lookup', 'mx_lookup', 'mx_conn', 'custom_grammar', 'parsing']
class Metrics(ob... | spacedogXYZ/email-validator | app/metrics.py | Python | mit | 1,291 |
class Solution(object):
def leastBricks(self, wall):
"""
:type wall: List[List[int]]
:rtype: int
"""
if len(wall) == 0:
return 0
count = 0
hash_map = {}
for row in wall:
length = 0
for brick in row[:-1]:
... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/554_Brick_Wall.py | Python | mit | 498 |
# -*- coding: utf-8 -*-
import logging
from flask.ext import wtf
from google.appengine.api import mail
import flask
import config
import util
app = flask.Flask(__name__)
app.config.from_object(config)
app.jinja_env.line_statement_prefix = '#'
app.jinja_env.line_comment_prefix = '##'
app.jinja_env.globals.update(sl... | jaja14/lab5 | main/main.py | Python | mit | 5,013 |
#!/usr/bin/env python
import pysam
import argparse
import multiprocessing as mp
import subprocess
import logging
logger = logging.getLogger(__name__)
FORMAT = '%(asctime)s %(message)s'
logging.basicConfig(format=FORMAT)
logger.setLevel(logging.INFO)
from math import log10
import pandas as pd
import scipy.stats as s... | adamewing/tebreak | scripts/bam_cpm_mask.py | Python | mit | 2,815 |
"""Attachment utils."""
from pathlib import Path
from uuid import uuid4
from blobstash.docstore.error import DocStoreError
from blobstash.filetree import FileTreeClient
_FILETREE_POINTER_FMT = "@filetree/ref:{}"
_FILETREE_ATTACHMENT_FS_PREFIX = "_filetree:docstore"
class Attachment:
"""An attachment represents ... | tsileo/blobstash-python-docstore | blobstash/docstore/attachment.py | Python | mit | 2,286 |
from autobahn.twisted.websocket import WebSocketServerFactory, \
WebSocketServerProtocol
from tws_game.lobby import Lobby
from tws_game.tetris import Tetris
from pprint import pprint
import json
class ClientConnection(WebSocketServerProtocol):
def onOpen(self):
self.factory.register(self)
def... | tomreitsma/the-weird-science | tws_game/server.py | Python | mit | 3,918 |
import datetime
import csv
with open('SYSTEMS.csv') as f:
reader = csv.reader(f)
ALLOWED_SYSTEMS = [l[0] for l in reader]
class IntelEntry:
KEYS = ["timer_name", "alliance", "system", "time", "date", "location"]
def __init__(self, timer_name="", alliance="", system="", time="", date="", location=""... | cameronobrien/BroadsideBot | app/intel_entry.py | Python | mit | 1,447 |
from __future__ import absolute_import
from __future__ import print_function
import autograd.numpy as np
import itertools as it
from autograd.core import grad, safe_type
from copy import copy
from autograd.numpy.use_gpu_numpy import use_gpu_numpy
from autograd.container_types import ListNode, TupleNode
from builtins im... | barak/autograd | autograd/util.py | Python | mit | 4,829 |
import nacl.exceptions
import nacl.utils
import nacl.secret
from salty.config import encoder, Store
from salty.exceptions import NoValidKeyFound, DefaultKeyNotSet
__all__ = ['new', 'current', 'select', 'add_secret', 'get_secret', 'encrypt', 'decrypt']
def _new():
return encoder.encode(nacl.utils.random(nacl.se... | Markcial/salty | salty/api.py | Python | mit | 1,918 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def problem05(nrlst, oplst, answer):
if len(nrlst) == 0:
return []
else:
exprlst = []
def _problem05(expr, i):
if i < len(nrlst):
for op in oplst:
_problem05(expr + op + str(nrlst[i]), i + 1)
... | koturn/FiveProgrammingProblems | Python/problem05.py | Python | mit | 602 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Ian Kronquist'
SITENAME = u'CS290 How-To Guide'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Los_Angeles'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGO... | iankronquist/numinous-nimbus | cs290/howto/site/pelicanconf.py | Python | mit | 883 |
from django.db import models
class Item(models.Model):
text = models.TextField()
| gnufede/tddgoat | tddgoat/lists/models.py | Python | mit | 87 |