repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
blackbliss/callme | flask/lib/python2.7/site-packages/sqlalchemy/testing/suite/test_sequence.py | 76 | 3770 | from .. import fixtures, config
from ..config import requirements
from ..assertions import eq_
from ... import testing
from ... import Integer, String, Sequence, schema
from ..schema import Table, Column
class SequenceTest(fixtures.TablesTest):
__requires__ = ('sequences',)
__backend__ = True
run_create... | mit |
PuckCh/battlenet | battlenet/__init__.py | 1 | 1307 | from .connection import Connection
from .constants import UNITED_STATES
from .constants import EUROPE
from .constants import KOREA
from .constants import TAIWAN
from .constants import CHINA
from .enums import RACE
from .enums import CLASS
from .enums import QUALITY
from .enums import RACE_TO_FACTION
from .enums impor... | mit |
18F/regulations-parser | tests/layer_preamble_internal_citations_tests.py | 3 | 1345 | from unittest import TestCase
import six
from regparser.layer.preamble.internal_citations import InternalCitations
from regparser.tree.struct import Node
class InternalCitationsTests(TestCase):
def setUp(self):
self.ic = InternalCitations(Node(label=['111_22']))
cits = ['111_22', '111_22-I', '11... | cc0-1.0 |
chouseknecht/ansible | lib/ansible/modules/network/fortios/fortios_vpn_ipsec_concentrator.py | 13 | 11192 | #!/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... | gpl-3.0 |
AydinSakar/node-gyp | gyp/pylib/gyp/MSVSNew.py | 225 | 12061 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""New implementation of Visual Studio project generation for SCons."""
import os
import random
import gyp.common
# hashlib is supplied as of Python 2.5 as the ... | mit |
elky/django | django/db/migrations/graph.py | 10 | 15508 | import warnings
from functools import total_ordering
from django.db.migrations.state import ProjectState
from django.utils.datastructures import OrderedSet
from .exceptions import CircularDependencyError, NodeNotFoundError
RECURSION_DEPTH_WARNING = (
"Maximum recursion depth exceeded while generating migration g... | bsd-3-clause |
wyolum/ClockFOUR | fabricate_bak/ClockFOUR_Chronogram_v2.1/cnc.py | 9 | 14084 | from numpy import *
import os.path
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import glob
import os.path
import PIL.Image
from numpy import array, sin, cos, dot, arange
from constants import *
from copy import deepcopy
from reportlab.pdfgen import canvas
from reportlab.graphi... | mit |
apple/llvm-project | lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py | 5 | 5715 | import unittest2
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
THREAD_COUNT = 5
def gather_... | apache-2.0 |
RealTimeWeb/wikisite | MoinMoin/action/thread_monitor.py | 1 | 1932 | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - Thread monitor action
Shows the current traceback of all threads.
@copyright: 2006 MoinMoin:AlexanderSchremmer
@license: GNU GPL, see COPYING for details.
"""
import os, time
from StringIO import StringIO
from MoinMoin import Page, wikiutil
from MoinMoin.ut... | apache-2.0 |
jorik041/clusterd | src/lib/cifstrap.py | 8 | 7769 | import socket
import time
import struct
import sys
import threading
import datetime
""" Bulk of this code is credited to bwall (@botnet_hunter)
This was modified to be quieter and to support NTLMv1
Simple CIFS service that obtains the hash and rejects the connection.
Original:
https://github.com/bwall/BAMF/blob... | mit |
cowlicks/blaze | blaze/compute/numba.py | 6 | 5004 | from __future__ import absolute_import, division, print_function
import threading
import numpy as np
from toolz import memoize
import datashape
import numba
from datashape import isdatelike, TimeDelta
from .core import optimize
from ..expr.strings import isstring
from ..expr import Expr, Map, BinOp, UnaryOp
from ..e... | bsd-3-clause |
kylebebak/Requester | deps/urllib3/request.py | 290 | 5946 | from __future__ import absolute_import
from .filepost import encode_multipart_formdata
from .packages.six.moves.urllib.parse import urlencode
__all__ = ['RequestMethods']
class RequestMethods(object):
"""
Convenience mixin for classes who implement a :meth:`urlopen` method, such
as :class:`~urllib3.con... | mit |
nirmeshk/oh-mainline | vendor/packages/requests/requests/packages/chardet/mbcsgroupprober.py | 2769 | 1967 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | agpl-3.0 |
robotics-silver-surfer/surfer-main | lab3/thrusterMapping/build/catkin_generated/installspace/_setup_util.py | 44 | 11235 | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, 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 cod... | mit |
sanjeevtripurari/hue | desktop/core/ext-py/Django-1.6.10/django/utils/datetime_safe.py | 179 | 2747 | # Python's datetime strftime doesn't handle dates before 1900.
# These classes override date and datetime to support the formatting of a date
# through its full "proleptic Gregorian" date range.
#
# Based on code submitted to comp.lang.python by Andrew Dalke
#
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was... | apache-2.0 |
IOArmory/quarterbackpython | lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/fields.py | 514 | 5931 | from __future__ import absolute_import
import email.utils
import mimetypes
from .packages import six
def guess_content_type(filename, default='application/octet-stream'):
"""
Guess the "Content-Type" of a file.
:param filename:
The filename to guess the "Content-Type" of using :mod:`mimetypes`.
... | mit |
avrem/ardupilot | libraries/AP_Terrain/tools/create_terrain.py | 1 | 11287 | #!/usr/bin/env python
'''
create ardupilot terrain database files
'''
from MAVProxy.modules.mavproxy_map import srtm
import math, struct, os, sys
import crc16, time, struct
# MAVLink sends 4x4 grids
TERRAIN_GRID_MAVLINK_SIZE = 4
# a 2k grid_block on disk contains 8x7 of the mavlink grids. Each
# grid block overlaps... | gpl-3.0 |
teamstoreheddinge/osmc | package/mediacenter-eventclients-common-osmc/files/usr/share/pyshared/xbmc/ps3/sixaxis.py | 52 | 11090 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2009 Team XBMC http://www.xbmc.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; either version 2 of the License, or
#... | gpl-2.0 |
dmlc/tvm | python/tvm/relay/frontend/change_datatype.py | 3 | 3475 | # 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... | apache-2.0 |
pcm17/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/operator_pd_full_test.py | 33 | 2355 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
zycdragonball/tensorflow | tensorflow/compiler/tests/binary_ops_test.py | 41 | 28020 | # 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... | apache-2.0 |
sowe9385/qiime | tests/test_denoiser/test_denoise_postprocess.py | 15 | 2578 | #!/usr/bin/env python
"""tests for denoiser_postprocess functions
"""
__author__ = "Jens Reeder"
__copyright__ = "Copyright 2011, The QIIME Project"
# remember to add yourself if you make changes
__credits__ = ["Jens Reeder", "Rob Knight"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Jens Reeder"
_... | gpl-2.0 |
BabeNovelty/numpy | numpy/core/code_generators/generate_ufunc_api.py | 37 | 5425 | from __future__ import division, print_function
import os
import genapi
import numpy_api
from genapi import \
TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
h_template = r"""
#ifdef _UMATHMODULE
#ifdef NPY_ENABLE_SEPARATE_COMPILATION
extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
#else
NPY_NO_EXPORT Py... | bsd-3-clause |
naturali/tensorflow | tensorflow/python/kernel_tests/variable_ops_test.py | 29 | 9619 | # Copyright 2015 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... | apache-2.0 |
snurkabill/pydeeplearn | code/lib/ann.py | 2 | 21874 | """ Implementation of a simple ANN. """
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import numpy as np
import theano
from theano import tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
import matplotlib.pyplot as plt
theanoFloat = theano.config.floatX
"""In all ... | bsd-3-clause |
synergeticsedx/deployment-wipro | common/djangoapps/startup_configurations/validate_config.py | 22 | 1199 | """
Common Functions to Validate Configurations
"""
def validate_lms_config(settings):
"""
Validates configurations for lms and raise ValueError if not valid
"""
validate_common_config(settings)
# validate feature based configurations
validate_marketing_site_config(settings)
def validate_cm... | agpl-3.0 |
elainexmas/boto | boto/services/__init__.py | 782 | 1108 | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# 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, modi... | mit |
don-github/edx-platform | cms/djangoapps/contentstore/views/assets.py | 113 | 14959 | import logging
from functools import partial
import math
import json
from django.http import HttpResponseBadRequest
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_http_methods, require_POST
from djan... | agpl-3.0 |
randomtask1155/gpdb | gpMgmt/bin/gppylib/programs/clsAddMirrors.py | 17 | 31629 | #!/usr/bin/env python
# Line too long - pylint: disable=C0301
# Invalid name - pylint: disable=C0103
#
# Copyright (c) Greenplum Inc 2010. All Rights Reserved.
#
# import mainUtils FIRST to get python version check
# THIS IMPORT SHOULD COME FIRST
from gppylib.mainUtils import *
from optparse imp... | apache-2.0 |
mapr/hue | desktop/core/ext-py/Django-1.6.10/django/contrib/staticfiles/handlers.py | 106 | 2440 | from django.conf import settings
from django.core.handlers.base import get_path_info
from django.core.handlers.wsgi import WSGIHandler
from django.utils.six.moves.urllib.parse import urlparse
from django.utils.six.moves.urllib.request import url2pathname
from django.contrib.staticfiles import utils
from django.contrib... | apache-2.0 |
sxslex/rows | rows/utils.py | 1 | 4354 | # coding: utf-8
# Copyright 2014-2015 Álvaro Justen <https://github.com/turicas/rows/>
#
# 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 yo... | gpl-3.0 |
danieldresser/cortex | contrib/IECoreMantra/test/IECoreMantra/procedurals/sphereProcedural/sphereProcedural-1.py | 12 | 2627 | ##########################################################################
#
# Copyright 2012, Electric Theatre Collective Limited. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Re... | bsd-3-clause |
oscaro/django | django/core/serializers/base.py | 181 | 6813 | """
Module for abstract serializer/unserializer base classes.
"""
import warnings
from django.db import models
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
pass
class Serializ... | bsd-3-clause |
helenst/django | django/http/cookie.py | 21 | 4390 | from __future__ import unicode_literals
import sys
from django.utils.encoding import force_str
from django.utils import six
from django.utils.six.moves import http_cookies
# Some versions of Python 2.7 and later won't need this encoding bug fix:
_cookie_encodes_correctly = http_cookies.SimpleCookie().value_encode(';... | bsd-3-clause |
abdullah2891/remo | remo/profiles/migrations/0002_auto__add_field_userprofile_added_by.py | 3 | 6846 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserProfile.added_by'
db.add_column('profiles_userprofile', 'added_by', self.gf('django.db... | bsd-3-clause |
bpwook/auto-cert-kit | autocertkit/testbase.py | 1 | 16772 | # Copyright (c) Citrix Systems 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 condition... | bsd-2-clause |
malkavi/Flexget | flexget/tests/api_tests/test_schedule_api.py | 3 | 12182 | from unittest.mock import patch
from flexget.api.app import base_message
from flexget.components.scheduler.api import ObjectsContainer as OC
from flexget.manager import Manager
from flexget.utils import json
class TestEmptyScheduledAPI:
config = 'tasks: {}'
def test_empty_schedules_get(self, api_client, sch... | mit |
MadCat34/Sick-Beard | lib/requests/packages/chardet/eucjpprober.py | 215 | 3506 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | gpl-3.0 |
Gobie/gjslinter | tools/closure_linter/common/erroroutput.py | 266 | 1549 | #!/usr/bin/env python
#
# Copyright 2012 The Closure Linter 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
#... | mit |
rwaterspf1/android_kernel_lge_hammerhead | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 11088 | 3246 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
aidanheerdegen/mom | test/test.py | 9 | 1222 | #!/usr/bin/env python
import sys
import os
import nose
import nose.loader as loader
import subprocess
import test_bit_reproducibility as tb
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("platform")
parser.add_argument("type")
parser.add_argument("experiment")
... | gpl-2.0 |
mojeto/django | django/forms/forms.py | 4 | 20327 | """
Form classes
"""
import copy
from collections import OrderedDict
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
# BoundField is imported for backwards compatibility in Django 1.9
from django.forms.boundfield import BoundField # NOQA
from django.forms.fields import Field, FileField
# pretty_... | bsd-3-clause |
sergiusens/snapcraft | snapcraft/internal/lxd/errors.py | 2 | 4612 | # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope ... | gpl-3.0 |
sumanthha/fundafriend | django/contrib/admin/actions.py | 98 | 3205 | """
Built-in, globally-available admin actions.
"""
from django.core.exceptions import PermissionDenied
from django.contrib.admin import helpers
from django.contrib.admin.util import get_deleted_objects, model_ngettext
from django.db import router
from django.template.response import TemplateResponse
from django.utils... | bsd-3-clause |
ArcherSys/ArcherSys | eclipse/plugins/org.python.pydev_4.5.5.201603221110/pysrc/pydevd_attach_to_process/winappdbg/win32/dbghelp.py | 88 | 46488 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2014, Mario Vilas
# 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... | mit |
hryamzik/ansible | lib/ansible/modules/cloud/cloudstack/cs_user.py | 37 | 11702 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, René Moser <mail@renemoser.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supporte... | gpl-3.0 |
Azure/azure-sdk-for-python | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py | 1 | 22466 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | mit |
PsychoGame/android_kernel_lge_apq8064 | tools/perf/python/twatch.py | 7370 | 1334 | #! /usr/bin/python
# -*- python -*-
# -*- coding: utf-8 -*-
# twatch - Experimental use of the perf python interface
# Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com>
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License... | gpl-2.0 |
c2g14/2015cd_0512 | static/Brython3.1.1-20150328-091302/Lib/site-packages/pygame/event.py | 603 | 19086 | #!/usr/bin/env python
'''Pygame module for interacting with events and queues.
Pygame handles all it's event messaging through an event queue. The routines
in this module help you manage that event queue. The input queue is heavily
dependent on the pygame display module. If the display has not been
initialized and a ... | agpl-3.0 |
deseret-tech/litecoin-python | src/litecoinrpc/config.py | 1 | 2715 | # Copyright (c) 2010 Witchspace <witchspace81@gmail.com>
#
# 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, modify,... | mit |
otherness-space/myProject003 | my_project_003/lib/python2.7/site-packages/django/contrib/sitemaps/tests/test_http.py | 109 | 6713 | from __future__ import unicode_literals
import os
from datetime import date
from django.conf import settings
from django.contrib.sitemaps import Sitemap, GenericSitemap
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.test.utils import override_settings
... | mit |
40223208/2015cdb_g4_0420 | static/Brython3.1.1-20150328-091302/Lib/unittest/signals.py | 1016 | 2403 | import signal
import weakref
from functools import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.original_handler = default_handler
if isinstance(default_handler, int):
if default_handler == signal.SIG_D... | gpl-3.0 |
hgdeoro/pilas | pilasengine/ejemplos/vaca_voladora.py | 5 | 4979 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# El juego de la vaca voladora
#
# Creado por Hugo Ruscitti y Walter Velazquez durante
# un taller en las oficinas de huayra linux.
#
# El código detallado y el material del taller se puede
# descagar desde:
#
# https://github.com/hugoruscitti/la-vaca-voladora
# ... | lgpl-3.0 |
rivimey/rwmapmaker | zziplib/docs/zzipdoc/htm2dbk.py | 14 | 7044 | #! /usr/bin/env python
"""
this file converts simple html text into a docbook xml variant.
The mapping of markups and links is far from perfect. But all we
want is the docbook-to-pdf converter and similar technology being
present in the world of docbook-to-anything converters. """
from datetime import date
import ma... | gpl-3.0 |
mavit/ansible | lib/ansible/modules/storage/netapp/na_ontap_net_ifgrp.py | 5 | 11332 | #!/usr/bin/python
# (c) 2018, NetApp, 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',
'status': ['preview'],
... | gpl-3.0 |
tlatzko/spmcluster | .tox/clean/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py | 477 | 30319 | import errno
import logging
import sys
import warnings
from socket import error as SocketError, timeout as SocketTimeout
import socket
try: # Python 3
from queue import LifoQueue, Empty, Full
except ImportError:
from Queue import LifoQueue, Empty, Full
import Queue as _ # Platform-specific: Windows
fr... | bsd-2-clause |
wzbozon/scikit-learn | sklearn/covariance/shrunk_covariance_.py | 209 | 18133 | """
Covariance estimators using shrinkage.
Shrinkage corresponds to regularising `cov` using a convex combination:
shrunk_cov = (1-shrinkage)*cov + shrinkage*structured_estimate.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile ... | bsd-3-clause |
dgillis/scrapy | tests/test_utils_datatypes.py | 144 | 3592 | import copy
import unittest
from scrapy.utils.datatypes import CaselessDict
__doctests__ = ['scrapy.utils.datatypes']
class CaselessDictTest(unittest.TestCase):
def test_init(self):
seq = {'red': 1, 'black': 3}
d = CaselessDict(seq)
self.assertEqual(d['red'], 1)
self.assertEqual(... | bsd-3-clause |
dbertha/odoo | addons/account_analytic_plans/report/crossovered_analytic.py | 321 | 8149 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
varunnaganathan/django | tests/file_storage/tests.py | 6 | 32196 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import errno
import os
import shutil
import sys
import tempfile
import threading
import time
import unittest
from datetime import datetime, timedelta
from django.core.cache import cache
from django.core.exceptions import SuspiciousFileOperation, Suspicio... | bsd-3-clause |
GheRivero/ansible | lib/ansible/modules/network/nxos/nxos_static_route.py | 7 | 9231 | #!/usr/bin/python
#
# 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 later version.
#
# Ansible is distribut... | gpl-3.0 |
yanheven/horizon | openstack_dashboard/dashboards/project/stacks/tabs.py | 65 | 5501 | # 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... | apache-2.0 |
goosechooser/cps2-zmq | cps2zmq/gather/Broker.py | 1 | 10126 | # pylint: disable=E1101
"""
Contains Broker, WorkerRepresentative, and ServiceQueue classes.
"""
import sys
import logging
import zmq
from zmq.eventloop.zmqstream import ZMQStream
from zmq.eventloop.ioloop import IOLoop, PeriodicCallback
from cps2zmq.gather import mdp, log
HB_INTERVAL = 1000
HB_LIVENESS = 3
class Bro... | mit |
blakfeld/ansible | v1/ansible/cache/memcached.py | 132 | 5890 | # (c) 2014, Brian Coca, Josh Drake, et al
#
# 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 later version.
... | gpl-3.0 |
hasecbinusr/pysal | pysal/contrib/handler/tests/test_diagnostics.py | 7 | 4557 | import unittest
import numpy as np
import pysal
from pysal.spreg import diagnostics
from pysal.spreg.ols import OLS
import pysal.contrib.handler as h
from pysal.contrib.pdutilities.dbf_utilities import dbf2df
# create regression object used by all the tests below
db = pysal.open(pysal.examples.get_path("columbus.dbf")... | bsd-3-clause |
jortel/gofer | src/gofer/messaging/adapter/reliability.py | 3 | 1289 | #
# Copyright (c) 2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU Lesser General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (LGPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# includin... | lgpl-2.1 |
soulmachine/scikit-learn | examples/cluster/plot_dbscan.py | 346 | 2479 | # -*- coding: utf-8 -*-
"""
===================================
Demo of DBSCAN clustering algorithm
===================================
Finds core samples of high density and expands clusters from them.
"""
print(__doc__)
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn... | bsd-3-clause |
Celedhrim/persomov | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/theplatform.py | 22 | 5289 | from __future__ import unicode_literals
import re
import json
from .subtitles import SubtitlesInfoExtractor
from ..compat import (
compat_str,
)
from ..utils import (
determine_ext,
ExtractorError,
xpath_with_ns,
)
_x = lambda p: xpath_with_ns(p, {'smil': 'http://www.w3.org/2005/SMIL21/Language'})
... | gpl-3.0 |
outboxafrica/pimaa | PiMaa/sensors/lib/GrovePi/test_script/multi_sensor.py | 2 | 2072 | #!/usr/bin/env python
#
# GrovePi Example for using the Grove Dust sensor(http://www.seeedstudio.com/depot/Grove-Dust-Sensor-p-1050.html) with the GrovePi
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question abo... | gpl-3.0 |
NicolasKiely/Ackermann | Ackermann.py | 1 | 3454 | ''' Evaluates Ackermann function
Adopted from here: http://www.eprg.org/computerphile/recursion.htm
Usage:
python Ackermann.py <brute|cache> <m> <n>
Where
<brute|cache> specifies whether to enable the cache
<m> is the first parameter of the Ackermann function
<n> is the second paramete... | mit |
Sorsly/subtle | google-cloud-sdk/lib/surface/meta/test.py | 6 | 1936 | # 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 ag... | mit |
tanglei528/nova | nova/tests/api/openstack/compute/plugins/v3/test_agents.py | 19 | 13966 | # Copyright 2012 IBM Corp.
#
# 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 t... | apache-2.0 |
scraplesh/delicious-alfredworkflow | requests/packages/chardet/escprober.py | 2936 | 3187 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | mit |
leliel12/scikit-criteria | skcriteria/tests/madm/test__dmaker.py | 1 | 3411 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Cabral, Juan; Luczywo, Nadia
# 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 retai... | bsd-3-clause |
ecolitan/fatics | venv/lib/python2.7/site-packages/twisted/words/im/baseaccount.py | 80 | 1808 | # -*- Python -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
class AccountManager:
"""I am responsible for managing a user's accounts.
That is, remembering what accounts are available, their settings,
adding and removal of accounts, etc.
@ivar accounts: A collection ... | agpl-3.0 |
mith1979/ansible_automation | applied_python/applied_python/lib/python2.7/site-packages/jnpr/junos/cfg/user_ssh_key.py | 9 | 3394 | # 3rd-party modules
from lxml.builder import E
# local module
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
class UserSSHKey(Resource):
"""
[edit system login user <name> authentication <key-type> <key-value> ]
Resource name: tuple(<key-type>, <key-value>)
<key-type> : [... | apache-2.0 |
OptiPop/external_chromium_org | build/android/pylib/junit/test_runner.py | 26 | 1258 | # Copyright 2014 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 os
from pylib import cmd_helper
from pylib import constants
class JavaTestRunner(object):
"""Runs java tests on the host."""
def __init__(self,... | bsd-3-clause |
openmv/micropython | tests/basics/try_else_finally.py | 17 | 1290 | # test try-else-finally statement
# base case
try:
print(1)
except:
print(2)
else:
print(3)
finally:
print(4)
# basic case that should skip else
try:
print(1)
raise Exception
except:
print(2)
else:
print(3)
finally:
print(4)
# uncaught exception should skip else
try:
try:
... | mit |
michelts/lettuce | tests/integration/lib/Django-1.3/tests/modeltests/transactions/tests.py | 51 | 6706 | import sys
from django.db import connection, transaction, IntegrityError, DEFAULT_DB_ALIAS
from django.conf import settings
from django.test import TransactionTestCase, skipUnlessDBFeature
from models import Reporter
if sys.version_info >= (2, 5):
from tests_25 import TransactionContextManagerTests
class Tran... | gpl-3.0 |
kuiwei/edx-platform | common/lib/supertrace.py | 74 | 1646 | """
A handy util to print a django-debug-screen-like stack trace with
values of local variables.
"""
import sys
import traceback
from django.utils.encoding import smart_unicode
def supertrace(max_len=160):
"""
Print the usual traceback information, followed by a listing of all the
local variables in each... | agpl-3.0 |
alberthdev/nclayer | nc_diag_attr/nc_diag_attr.py | 1 | 9821 | # nc_diag_attr
from netCDF4 import Dataset, getlibversion
import netCDF4
import argparse
import sys
import traceback
import numpy
try:
import ujson as json
except:
import json
# Version information
__version__ = "0.9b"
VERSION_STR = 'nc_diag_attr v' + __version__ + "\n\n" + \
"Using the following librar... | apache-2.0 |
infowantstobeseen/pyglet-darwincore | experimental/svg_test.py | 28 | 13565 | #!/usr/bin/env python
# -*- coding: latin-1 -*-
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import math
import random
import re
import os.path
import pyglet
from pyglet.gl import *
import xml.dom
import xml.dom.minidom
class SmoothLineGroup(pyglet.graphics.Group):
def set_state(self):
... | bsd-3-clause |
BitcoinUnlimited/BitcoinUnlimited | qa/rpc-tests/excessive.py | 1 | 14205 | #!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# 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.
import test_framework.loginit
# Test emergent c... | mit |
jhancock93/autorest | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths_operations.py | 14 | 3190 | # 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 ... | mit |
UCSD-E4E/radio_collar_tracker_drone | scripts/ground_control_software/heatMap.py | 1 | 1174 | #!/usr/bin/env python3
import generateKML
import pos_estimate
import numpy as np
import utm
def findMax( someList ):
tempMax = someList[0]
for i in someList:
if tempMax < i:
tempMax = i
return tempMax
def findMin( someList ):
tempMin = someList[0]
for i in someList:
if tempMin > i:
tempMin = i
return ... | gpl-3.0 |
markr622/moose | python/argparse/argparse.py | 490 | 87791 | # Author: Steven J. Bethard <steven.bethard@gmail.com>.
"""Command-line parsing library
This module is an optparse-inspired command-line parsing library that:
- handles both optional and positional arguments
- produces highly informative usage messages
- supports parsers that dispatch to sub-parsers
The... | lgpl-2.1 |
aveshagarwal/openshift-ansible | roles/lib_openshift/src/lib/rolebinding.py | 84 | 8108 | # pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-instance-attributes
class RoleBindingConfig(object):
''' Handle rolebinding config '''
# pylint: disable=too-many-arguments
def __init__(self,
name,
namespace,
kubeconfig,
group... | apache-2.0 |
aberle/recipeasy | lib/werkzeug/testsuite/test.py | 93 | 17413 | # -*- coding: utf-8 -*-
"""
werkzeug.testsuite.test
~~~~~~~~~~~~~~~~~~~~~~~
Tests the testing tools.
:copyright: (c) 2013 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import sys
import unittest
from io import BytesIO
from werkzeug._com... | mit |
kooksee/myblog | BAE.py | 1 | 11250 | # -*- coding=utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import tornado.wsgi
import tornado.options
import os.path,os,datetime,sys,time,codecs
import markdown
import tohtml
import db
import json
import tohtml
import base64
import uuid
def conf(): #全局设定信息
global NAME,Subtitle,description,key... | gpl-2.0 |
jackkiej/SickRage | lib/sqlalchemy/dialects/oracle/zxjdbc.py | 79 | 7744 | # oracle/zxjdbc.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: oracle+zxjdbc
:name: zxJDBC for Jython
:dbapi: zxjdbc
:c... | gpl-3.0 |
aequitas/home-assistant | homeassistant/components/vultr/switch.py | 7 | 3422 | """Support for interacting with Vultr subscriptions."""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
from . import (
ATTR_ALLOWED_BANDWIDTH, ATTR_AUT... | apache-2.0 |
pindexis/qfc | qfc/ansi.py | 6 | 1811 | import sys
BOLD = "\x1b[1m"
CLEAR_FORMATTING = "\x1b[0m"
ERASE_SCREEN = "\x1b[J"
ERASE_LINE = "\x1b[2K"
FOREGROUND_BLACK = "\x1b[30m"
BACKGROUND_WHITE = "\x1b[47m"
def _CURSOR_COLUMN(pos):
# ideally, CSI n G escape code is used to set the absolute horizental position
# Sadly, it's not an Ansi.sys escape code ... | mit |
tmetsch/pyssf | docs/source/conf.py | 1 | 8255 | # -*- coding: utf-8 -*-
#
# pyssf documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 25 10:29:07 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... | lgpl-3.0 |
PeterWangPo/Django-facebook | docs/docs_env/Lib/encodings/cp1251.py | 593 | 13617 | """ Python Character Mapping Codec cp1251 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,in... | bsd-3-clause |
reclosedev/mitm_relay | socket_relay.py | 1 | 6570 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import select
import logging
log = logging.getLogger(__name__)
class Server:
def __init__(self, relays, timeout=0.3):
self._relays = list(relays)
self.timeout = timeout
self.input_map = {}
self.links = {}
def main_... | mit |
tuxfux-hlp-notes/python-batches | batch-67/19-files/myenv/lib/python2.7/site-packages/wheel/util.py | 62 | 4732 | """Utility functions."""
import base64
import hashlib
import json
import os
import sys
from collections import OrderedDict
__all__ = ['urlsafe_b64encode', 'urlsafe_b64decode', 'utf8',
'to_json', 'from_json', 'matches_requirement']
# For encoding ascii back and forth between bytestrings, as is repeatedly
... | gpl-3.0 |
mogoweb/webkit_for_android5.1 | webkit/Tools/Scripts/webkitpy/layout_tests/port/config.py | 15 | 7123 | #!/usr/bin/env python
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | apache-2.0 |
ctesene/homepage | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/lexers/_phpbuiltins.py | 274 | 122046 | # -*- coding: utf-8 -*-
"""
pygments.lexers._phpbuiltins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This file loads the function names and their modules from the
php webpage and generates itself.
Do not alter the MODULES dict by hand!
WARNING: the generation transfers quite much data over your
... | mit |
erpletzerp/letzerpcore | frappe/core/doctype/user/user.py | 1 | 15029 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, now, get_gravatar
from frappe import throw, msgprint, _
from frappe.auth import _update_password
from frappe.desk.notifications imp... | mit |
edm1/error-aware-demultiplexer | src/demultiplexer.py | 1 | 16772 | # -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Edward Mountjoy
#
# 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 th... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.