repo_name
stringlengths
5
100
path
stringlengths
4
375
copies
stringclasses
991 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
EzeAlbornoz5/TP-Ingenieria-web
doyourfreight/forums/migrations/0004_auto_20170514_2328.py
1
2152
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-15 02:28 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('forums', '0003_auto_20170514_2127'), ] operations = [ migrations.RenameField( ...
gpl-3.0
maxdeliso/elevatorSim
Lib/idlelib/ObjectBrowser.py
67
3749
# XXX TO DO: # - popup menu # - support partial or total redisplay # - more doc strings # - tooltips # object browser # XXX TO DO: # - for classes/modules, add "open source" to object browser from idlelib.TreeWidget import TreeItem, TreeNode, ScrolledCanvas from reprlib import Repr myrepr = Repr() myrepr.maxstring...
bsd-2-clause
her0e1c1/pystock
crawler/crawler/spiders/yahoo_japan.py
1
2762
import re import urllib import datetime import scrapy import scrapy_splash from dateutil import relativedelta import stock URL = ("http://info.finance.yahoo.co.jp/history/?code={code}.T&" "sy={sy}&sm={sm}&sd={sd}&ey={ey}&em={em}&ed={ed}&tm=d") REG_SPLIT_STOCK_DATE = re.compile(r"分割\W+(?P<from_number>\d+)株.*?(?...
gpl-3.0
scotthartbti/android_external_chromium_org
build/config/win/get_msvc_config.py
53
9188
# Copyright (c) 2013 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. # This file returns the MSVC config used by the Windows build. # It's a bit hardcoded right now. I suspect we want to build this functionality # into GN ...
bsd-3-clause
jeremiahmarks/sl4a
python/src/Lib/bsddb/dbobj.py
39
11719
#------------------------------------------------------------------------- # This file contains real Python object wrappers for DB and DBEnv # C "objects" that can be usefully subclassed. The previous SWIG # based interface allowed this thanks to SWIG's shadow classes. # -- Gregory P. Smith #--------------------...
apache-2.0
santisiri/popego
envs/ALPHA-POPEGO/lib/python2.5/site-packages/SQLAlchemy-0.4.3-py2.5.egg/sqlalchemy/sql/functions.py
1
2720
from sqlalchemy import types as sqltypes from sqlalchemy.sql.expression import _Function, _literal_as_binds, ClauseList, _FigureVisitName from sqlalchemy.sql import operators class _GenericMeta(_FigureVisitName): def __init__(cls, clsname, bases, dict): cls.__visit_name__ = 'function' type.__init__...
bsd-3-clause
sarahdunbar/Conway-Life
conway.py
1
28959
""" conway.py Author: <your name here> Credit: <list sources used, if any> Assignment: Write and submit a program that plays Conway's Game of Life, per https://github.com/HHS-IntroProgramming/Conway-Life from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame class Cubey(Sprite): def ...
mit
fillycheezstake/MissionPlanner
Lib/site-packages/scipy/special/basic.py
55
26575
# # Author: Travis Oliphant, 2002 # from numpy import pi, asarray, floor, isscalar, iscomplex, real, imag, sqrt, \ where, mgrid, cos, sin, exp, place, seterr, issubdtype, extract, \ complexfloating, less, vectorize, inexact, nan, zeros, sometrue from _cephes import ellipk, mathieu_a, mathieu_b, iv, jv...
gpl-3.0
tod31/pyload
module/plugins/hooks/ExtractArchive.py
2
20542
# -*- coding: utf-8 -*- from __future__ import with_statement import os import sys # monkey patch bug in python 2.6 and lower # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 if sys.version_info < (2, 7) and os.name != "nt": import errno import subpr...
gpl-3.0
digwanderlust/pants
src/python/pants/base/addressable.py
7
1849
# 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) from pants.base.addr...
apache-2.0
aidan-/ansible-modules-extras
network/f5/bigip_node.py
32
16217
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2013, Matt Hite <mhite@hotmail.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 the Licens...
gpl-3.0
marcelovilaca/DIRAC
FrameworkSystem/Client/ProxyUpload.py
3
5693
######################################################################## # $HeadURL$ # File : dirac-proxy-init.py # Author : Adrian Casajus ###########################################################from DIRAC.Core.Base import Script############# __RCSID__ = "$Id$" import sys import getpass import DIRAC from DIRAC...
gpl-3.0
cybojenix/SlimBot
plugins/roulette.py
1
2463
# russian roulette import random from util import hook import os import json import time @hook.command(autohelp=False) def load(inp, message=None, action=None, chan=None): "load [<number of barrels>] [<number of bullets>] - " \ " load the gun up" dir = "plugins/data/rr/" if not os.path.exists(dir): os.makedirs(d...
gpl-3.0
JakeBrand/CMPUT410-E6
v1/lib/python2.7/site-packages/django/contrib/gis/tests/geoapp/test_sitemaps.py
60
4956
from __future__ import unicode_literals from io import BytesIO from unittest import skipUnless from xml.dom import minidom import os import zipfile from django.conf import settings from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.sites.models i...
apache-2.0
dennybaa/st2
st2common/tests/unit/test_keyvalue_lookup.py
7
2788
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th...
apache-2.0
Marketing1by1/petl
petl/transform/maps.py
2
12598
from __future__ import absolute_import, print_function, division import operator from collections import OrderedDict from petl.compat import next, string_types, text_type from petl.errors import ArgumentError from petl.util.base import Table, expr, rowgroupby, Record from petl.transform.sorts import sort def fiel...
mit
hachreak/invenio-previewer
invenio_previewer/utils.py
2
1963
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2016 CERN. # # Invenio 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 (at your option) any later...
gpl-2.0
maheshp/novatest
nova/virt/hyperv/pathutils.py
7
4794
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 Cloudbase Solutions Srl # 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.a...
apache-2.0
vovanbo/django-oscar
tests/unit/wishlist_tests.py
69
1388
from django.test import TestCase from oscar.apps.wishlists.models import WishList from oscar.core.compat import get_user_model User = get_user_model() class TestAWishlist(TestCase): def test_can_generate_a_random_key(self): key = WishList.random_key(6) self.assertTrue(len(key) == 6) class Tes...
bsd-3-clause
Milad1993/linux
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
12527
1935
# Util.py - Python extension for perf script, miscellaneous utility code # # 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. import errno, os FUTEX_WAIT = 0...
gpl-2.0
rafiqsaleh/VERCE
verce-hpc-pe/src/networkx/readwrite/json_graph/tests/test_serialize.py
35
1329
import json from nose.tools import assert_equal, assert_raises, assert_not_equal,assert_true import networkx as nx from networkx.readwrite.json_graph import * class TestAdjacency: def test_graph(self): G = nx.path_graph(4) H = loads(dumps(G)) nx.is_isomorphic(G,H) def test_graph_attri...
mit
fieldOfView/Cura
plugins/USBPrinting/avr_isp/stk500v2.py
7
8325
""" STK500v2 protocol implementation for programming AVR chips. The STK500v2 protocol is used by the ArduinoMega2560 and a few other Arduino platforms to load firmware. This is a python 3 conversion of the code created by David Braam for the Cura project. """ import struct import sys import time from serial import Ser...
agpl-3.0
hoatle/odoo
addons/l10n_co/wizard/__init__.py
313
1165
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) David Arnold (devCO). # Author David Arnold (devCO), dar@devco.co # Co-Authors Juan Pablo Aries (devCO), jpa@devco.co # Hector Iva...
agpl-3.0
crawford/kubernetes
cluster/juju/layers/kubernetes-worker/reactive/kubernetes_worker.py
62
29611
#!/usr/bin/env python # Copyright 2015 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
apache-2.0
kxepal/couchdb-python
couchdb/tools/load.py
6
3225
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2007-2009 Christopher Lenz # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. """Utility for loading a snapshot of a CouchDB database from a multipart MIME ...
bsd-3-clause
westinedu/wrgroups
django/middleware/http.py
154
1696
from django.core.exceptions import MiddlewareNotUsed from django.utils.http import http_date, parse_http_date_safe class ConditionalGetMiddleware(object): """ Handles conditional GET operations. If the response has a ETag or Last-Modified header, and the request has If-None-Match or If-Modified-Since, ...
bsd-3-clause
da1z/intellij-community
plugins/hg4idea/testData/bin/mercurial/lock.py
92
4921
# lock.py - simple advisory locking scheme for mercurial # # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. import util, error import errno, os, socket, time import warnings cl...
apache-2.0
ronfung/incubator-airflow
tests/contrib/hooks/test_gcp_dataflow_hook.py
34
1812
# -*- coding: utf-8 -*- # # 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 ...
apache-2.0
vwvww/servo
tests/wpt/web-platform-tests/tools/pywebsocket/src/test/testdata/handlers/sub/plain_wsh.py
499
1789
# Copyright 2009, 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 of conditions and the f...
mpl-2.0
rh-s/heat
contrib/rackspace/rackspace/tests/test_cloudnetworks.py
3
5895
# # 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 # ...
apache-2.0
calfonso/ansible
lib/ansible/plugins/action/bigip.py
16
6756
# # (c) 2016 Red Hat Inc. # # 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 d...
gpl-3.0
reaganhenke/8Bit-Campus
fightModule.py
1
14568
import pygame, random WHITE = (255,255,255) BLACK = (35,35,35) BLUE = (50,50,255) GREEN = (0,255,0) GRAY = (200,200,200) FPS = 60 PLAYERX = 100 PLAYERY= 250 ENEMYX= 250 ENEMYY= 100 class GuitarHero(): def __init__(self,screen): HALF_WIDTH = screen.get_width()/2 lineDist = (HALF_WIDTH / 5) ...
mit
eltonkevani/tempest_el_env
tempest/api/compute/volumes/test_attach_volume.py
3
4471
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 IBM Corp. # 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/licen...
apache-2.0
theanalyst/cinder
cinder/db/migration.py
11
1271
# 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 compliance with the License. You may obtain # a ...
apache-2.0
sensysnetworks/uClinux
user/python/Lib/plat-freebsd4/SOCKET.py
8
2557
# Generated by h2py from /usr/include/sys/socket.h SOCK_STREAM = 1 SOCK_DGRAM = 2 SOCK_RAW = 3 SOCK_RDM = 4 SOCK_SEQPACKET = 5 SO_DEBUG = 0x0001 SO_ACCEPTCONN = 0x0002 SO_REUSEADDR = 0x0004 SO_KEEPALIVE = 0x0008 SO_DONTROUTE = 0x0010 SO_BROADCAST = 0x0020 SO_USELOOPBACK = 0x0040 SO_LINGER = 0x0080 SO_OOBINLINE = 0x0100...
gpl-2.0
dendisuhubdy/tensorflow
tensorflow/python/ops/losses/losses.py
61
1102
# 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
cristian69/KernotekV3
venv/lib/python2.7/site-packages/flask/testsuite/ext.py
563
5156
# -*- coding: utf-8 -*- """ flask.testsuite.ext ~~~~~~~~~~~~~~~~~~~ Tests the extension import thing. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import sys import unittest try: from imp import reload as reload_module except ImportError: reload...
gpl-3.0
wujuguang/mako
test/test_cache.py
5
18997
import time from mako import lookup from mako.cache import CacheImpl from mako.cache import register_plugin from mako.compat import py27 from mako.ext import beaker_cache from mako.lookup import TemplateLookup from mako.template import Template from test import eq_ from test import module_base from test import SkipTes...
mit
HybridF5/tempest
tempest/api/orchestration/base.py
3
6372
# 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...
apache-2.0
egenerat/flight-manager
app/common/colorer.py
2
3749
# -*- coding: utf-8 -*- import logging import platform # now we patch Python code to add color support to logging.StreamHandler def add_coloring_to_emit_windows(fn): # add methods we need to the class def _out_handle(self): import ctypes return ctypes.windll.kernel32.GetStdHandle(self.STD_OUT...
mit
enriquesanchezb/practica_utad_2016
venv/lib/python2.7/site-packages/pip/_vendor/requests/compat.py
1039
1469
# -*- coding: utf-8 -*- """ pythoncompat """ from .packages import chardet import sys # ------- # Pythons # ------- # Syntax sugar. _ver = sys.version_info #: Python 2.x? is_py2 = (_ver[0] == 2) #: Python 3.x? is_py3 = (_ver[0] == 3) try: import simplejson as json except (ImportError, SyntaxError): # si...
apache-2.0
henridwyer/scikit-learn
examples/cluster/plot_dict_face_patches.py
337
2747
""" Online learning of a dictionary of parts of faces ================================================== This example uses a large dataset of faces to learn a set of 20 x 20 images patches that constitute faces. From the programming standpoint, it is interesting because it shows how to use the online API of the sciki...
bsd-3-clause
xcoder123/KodiLatviesiem
plugin.video.dzivaistv/js2py/translators/__init__.py
44
1757
# The MIT License # # Copyright 2014, 2015 Piotr Dabkowski # # 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, modif...
gpl-3.0
jakevdp/megaman
megaman/geometry/tests/test_affinity.py
4
3661
# LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE from __future__ import division ## removes integer division import os import numpy as np from numpy.testing import assert_allclose, assert_equal, assert_raises from scipy.spatial.distance import cdist, pdist, squareform from scipy.sparse ...
bsd-2-clause
alon/servo
components/script/dom/bindings/codegen/ply/ply/lex.py
344
40739
# ----------------------------------------------------------------------------- # ply: lex.py # # Copyright (C) 2001-2009, # David M. Beazley (Dabeaz LLC) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions ar...
mpl-2.0
tomjelinek/pcs
pcs_test/tier0/lib/test_stonith_agent.py
3
7009
from unittest import mock, TestCase from lxml import etree from pcs_test.tools.assertions import assert_report_item_list_equal from pcs.common.reports import ReportItemSeverity as severity from pcs.common.reports import codes as report_codes from pcs.lib import resource_agent as lib_ra from pcs.lib.external import Co...
gpl-2.0
tjth/lotterycoin
qa/rpc-tests/replace-by-fee.py
24
22010
#!/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 replace by fee code # from test_framework.test_framework import BitcoinTestFramework from test_...
mit
ThreatConnect-Inc/tcex
tcex/sessions/external_session.py
2
12578
"""ThreatConnect Requests Session""" # standard library import logging import time from typing import Callable, Optional # third-party import urllib3 from requests import Response, Session, adapters, exceptions from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE, DEFAULT_RETRIES from urllib3.util.retry i...
apache-2.0
weimingtom/python-for-android
python3-alpha/python3-src/Lib/encodings/cp1252.py
272
13511
""" Python Character Mapping Codec cp1252 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.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...
apache-2.0
GraemeFulton/job-search
docutils-0.12/docutils/writers/latex2e/__init__.py
84
124479
# .. coding: utf-8 # $Id: __init__.py 7745 2014-02-28 14:15:59Z milde $ # Author: Engelbert Gruber, Günter Milde # Maintainer: docutils-develop@lists.sourceforge.net # Copyright: This module has been placed in the public domain. """LaTeX2e document tree Writer.""" __docformat__ = 'reStructuredText' # code contributi...
gpl-2.0
40023154/final0627
static/Brython3.1.1-20150328-091302/Lib/xml/dom/minicompat.py
781
3228
"""Python version compatibility support for minidom.""" # This module should only be imported using "import *". # # The following names are defined: # # NodeList -- lightest possible NodeList implementation # # EmptyNodeList -- lightest possible NodeList that is guaranteed to # remain empty...
gpl-3.0
nielsbuwen/ilastik
tests/nanshe/testOpMaxProjection.py
3
3034
############################################################################### # lazyflow: data flow based lazy parallel computation framework # # Copyright (C) 2011-2014, the ilastik developers # <team@ilastik.org> # # This program is free software; you can redistribute it and/o...
gpl-3.0
yexihu/volatility
volatility/plugins/mac/session_hash_table.py
45
2308
# Volatility # Copyright (C) 2007-2013 Volatility Foundation # # This file is part of Volatility. # # Volatility 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 # (at your o...
gpl-2.0
jalexvig/tensorflow
tensorflow/contrib/factorization/python/ops/clustering_ops.py
30
35921
# 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
AtonLerin/pymel
pymel/core/datatypes.py
5
155210
"""Data classes that are returned by functions within ``pymel.core`` A wrap of Maya's Vector, Point, Color, Matrix, TransformationMatrix, Quaternion, EulerRotation types """ import sys import math import copy import operator import colorsys import pymel.util as util import pymel.api as _api from pymel.util.arrays im...
bsd-3-clause
sunqm/pyscf
examples/ao2mo/10-diff_orbs_for_ijkl.py
2
2084
#!/usr/bin/env python # # Author: Qiming Sun <osirpt.sun@gmail.com> # import tempfile import numpy import h5py from pyscf import gto, scf, ao2mo ''' Integral transformation for four different orbitals ''' mol = gto.Mole() mol.build( atom = [ ["C", (-0.65830719, 0.61123287, -0.00800148)], ["C", ( 0.73685...
apache-2.0
akaminsky/ghost_blog
node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/pygments/formatters/other.py
363
3811
# -*- coding: utf-8 -*- """ pygments.formatters.other ~~~~~~~~~~~~~~~~~~~~~~~~~ Other formatters: NullFormatter, RawTokenFormatter. :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.formatter import Formatter from pygments...
mit
Mixser/django
django/conf/locale/en_AU/formats.py
504
2117
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j M Y' # '25 Oc...
bsd-3-clause
jordan-developer/pyOCNI
pyocni/TDD/Tests/queryInterface_Tests.py
2
5753
# Copyright 2010-2012 Institut Mines-Telecom # # 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 agre...
apache-2.0
rmackay9/rmackay9-ardupilot
libraries/SITL/examples/Morse/rover.py
22
1997
''' This is an example builder script that sets up a rover in Morse to be driven by ArduPilot. The rover has the basic set of sensors that ArduPilot needs To start the simulation use this: morse run rover.py Then connect with ArduPilot like this: sim_vehicle.py --model morse --console --map This model assumes...
gpl-3.0
petebachant/scipy
scipy/weave/examples/dict_sort.py
100
3235
# Borrowed from Alex Martelli's sort from Python cookbook using inlines # 2x over fastest Python version -- again, maybe not worth the effort... # Then again, 2x is 2x... # # C:\home\eric\wrk\scipy\weave\examples>python dict_sort.py # Dict sort of 1000 items for 300 iterations: # speed in python: 0.2509999275...
bsd-3-clause
denisbalyko/checkio-solution
network-attack.py
1
1278
from operator import itemgetter def capture(matrix): queue, watched = [[0, 0]], [0] while len(queue): min_point = min(queue, key = itemgetter(1)) queue.pop(queue.index(min_point)) point, old_value = min_point for i, value in enumerate(matrix[point]): if value and not...
mit
Distrotech/intellij-community
python/lib/Lib/site-packages/django/contrib/gis/tests/__init__.py
229
4968
from django.conf import settings from django.test.simple import build_suite, DjangoTestSuiteRunner from django.utils import unittest def run_tests(*args, **kwargs): from django.test.simple import run_tests as base_run_tests return base_run_tests(*args, **kwargs) def run_gis_tests(test_labels, verbosity=1, in...
apache-2.0
k3nnyfr/s2a_fr-nsis
s2a/Python/Lib/ctypes/wintypes.py
265
5349
###################################################################### # This file should be kept compatible with Python 2.3, see PEP 291. # ###################################################################### # The most useful windows datatypes from ctypes import * BYTE = c_byte WORD = c_ushort DWORD = c_ulong W...
gpl-3.0
cleophasmashiri/oppia
core/controllers/base_test.py
6
8539
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
apache-2.0
heracek/django-nonrel
django/db/backends/postgresql/operations.py
229
9420
import re from django.db.backends import BaseDatabaseOperations # This DatabaseOperations class lives in here instead of base.py because it's # used by both the 'postgresql' and 'postgresql_psycopg2' backends. class DatabaseOperations(BaseDatabaseOperations): def __init__(self, connection): super(Databas...
bsd-3-clause
andrefreitas/schwa
schwa/extraction/abstract_extractor.py
1
2040
# Copyright (c) 2015 Faculty of Engineering of the University of Porto # # 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,...
mit
sauloal/cufflinksviewer
venvlin/lib/python2.7/site-packages/simplejson/tests/test_unicode.py
71
4687
from unittest import TestCase import simplejson as json class TestUnicode(TestCase): def test_encoding1(self): encoder = json.JSONEncoder(encoding='utf-8') u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' s = u.encode('utf-8') ju = encoder.encode(u) js = en...
mit
provaleks/o8
addons/website_forum_doc/__openerp__.py
322
1508
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms ...
agpl-3.0
cloudtools/troposphere
tests/test_logs.py
1
1243
import unittest from troposphere import Retain from troposphere.logs import Destination, LogGroup class TestLogs(unittest.TestCase): def test_loggroup_deletionpolicy_is_preserved(self): log_group = LogGroup("LogGroupWithDeletionPolicy", DeletionPolicy=Retain) self.assertIn("DeletionPolicy", log_g...
bsd-2-clause
atruberg/django-custom
django/middleware/locale.py
98
2970
"This is the locale selecting middleware that will look at accept headers" from django.conf import settings from django.core.urlresolvers import (is_valid_path, get_resolver, LocaleRegexURLResolver) from django.http import HttpResponseRedirect from django.utils.cache import patch_...
bsd-3-clause
ben-ng/swift
utils/swift_build_support/swift_build_support/products/ninja.py
1
1932
# swift_build_support/products/ninja.py -------------------------*- python -*- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.tx...
apache-2.0
PhilHarnish/forge
spec/puzzle/examples/mim/p10_1_spec.py
1
1173
import astor from data import warehouse from puzzle.examples.mim import p10_1 from puzzle.problems import logic_problem from puzzle.puzzlepedia import prod_config from spec.mamba import * with _description('p10_1'): with before.all: warehouse.save() prod_config.init() self.puzzle = p10_1.get() with a...
mit
letama/android_kernel_nozomi
tools/perf/scripts/python/syscall-counts.py
11181
1522
# system call counts # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. import os import sys sys.path.append(os.envir...
gpl-2.0
anchore/anchore-engine
anchore_engine/db/db_subscriptions.py
1
6807
import hashlib import time from anchore_engine import db from anchore_engine.db import Subscription def _compute_subscription_id(userId, subscription_key, subscription_type): return hashlib.md5( "+".join([userId, subscription_key, subscription_type]).encode("utf-8") ).hexdigest() def _prep_payload(...
apache-2.0
cuit-zhaxin/quick-ng
tools/cocos2d-console/plugins/project_new/project_new.py
6
26531
#!/usr/bin/python # ---------------------------------------------------------------------------- # cocos "new" plugin # # Copyright 2013 (C) cocos2d-x.org # # License: MIT # ---------------------------------------------------------------------------- ''' "new" plugin for cocos command line tool ''' __docformat__ = 're...
mit
steventimberman/masterDebater
venv/lib/python2.7/site-packages/chardet/utf8prober.py
290
2766
######################## 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
naresh21/synergetics-edx-platform
openedx/core/djangoapps/theming/tests/test_commands.py
47
2114
""" Tests for Management commands of comprehensive theming. """ from django.test import TestCase from django.core.management import call_command, CommandError from openedx.core.djangoapps.theming.helpers import get_themes from openedx.core.djangoapps.theming.management.commands.compile_sass import Command class Test...
agpl-3.0
HyperBaton/ansible
lib/ansible/modules/cloud/azure/azure_rm_devtestlabarmtemplate_info.py
20
7086
#!/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', ...
gpl-3.0
pychess/pychess
lib/pychess/Players/PyChessCECP.py
1
19627
import re import signal import sys from threading import Thread import pychess from pychess.Players.PyChess import PyChess from pychess.System import conf, fident from pychess.Utils.book import getOpenings from pychess.Utils.const import NORMALCHESS, FEN_START, BLACK, FISCHERRANDOMCHESS, \ CRAZYHOUSECHESS, WILDCA...
gpl-3.0
jordanemedlock/psychtruths
temboo/core/Library/Amazon/SQS/SendMessage.py
4
5370
# -*- coding: utf-8 -*- ############################################################################### # # SendMessage # Sends up to ten messages to the specified queue. # # Python versions 2.6, 2.7, 3.x # # Copyright 2014, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not ...
apache-2.0
G33KS44n/mysql-5.6
xtrabackup/test/python/testtools/tests/test_distutilscmd.py
42
2635
# Copyright (c) 2010-2011 Testtools authors. See LICENSE for details. """Tests for the distutils test command logic.""" from distutils.dist import Distribution from testtools.helpers import try_import, try_imports fixtures = try_import('fixtures') StringIO = try_imports(['StringIO.StringIO', 'io.StringIO']) import ...
gpl-2.0
hsuantien/scikit-learn
sklearn/feature_selection/univariate_selection.py
95
23709
"""Univariate features selection.""" # Authors: V. Michel, B. Thirion, G. Varoquaux, A. Gramfort, E. Duchesnay. # L. Buitinck, A. Joly # License: BSD 3 clause import numpy as np import warnings from scipy import special, stats from scipy.sparse import issparse from ..base import BaseEstimator from ..prepr...
bsd-3-clause
mpvillafranca/hearcloud
applications/box/forms.py
2
2475
from django import forms from django.core.exceptions import ValidationError from .models import Song, Playlist class CreatePlaylistForm(forms.ModelForm): """ Form class to create playlists """ class Meta: model = Playlist fields = [ 'name', ] widgets = { ...
agpl-3.0
eMerzh/Diamond-1
src/collectors/sidekiqweb/test/testsidekiqweb.py
35
2061
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch from diamond.collector import Collector from sidekiqweb impo...
mit
wilkerwma/codeschool
src/codeschool/models/wagtail.py
2
11441
from markdown import markdown from django.db import models, transaction from django.utils.translation import ugettext_lazy as _ from django.utils.text import slugify from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.fields import RichTextField from wagtail.wagtailadmin.edit_handlers import FieldPanel...
gpl-3.0
bureau14/qdb-benchmark
thirdparty/boost/libs/python/test/test_pointer_adoption.py
46
1708
# Copyright David Abrahams 2004. Distributed under the Boost # Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) """ >>> from test_pointer_adoption_ext import * >>> num_a_instances() 0 >>> a = create('dynamically allocated') >>> num_a_instances() ...
bsd-2-clause
adamtiger/tensorflow
tensorflow/contrib/distributions/python/ops/bijectors/weibull.py
18
1141
# 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
tlatzko/spmcluster
.tox/2.7-cover/lib/python2.7/site-packages/pip/_vendor/html5lib/ihatexml.py
1727
16581
from __future__ import absolute_import, division, unicode_literals import re import warnings from .constants import DataLossWarning baseChar = """ [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-...
bsd-2-clause
tuxfux-hlp-notes/python-batches
archieves/batch-64/09-modules/myenv/lib/python2.7/site-packages/django/apps/config.py
121
8077
import os from importlib import import_module from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured from django.utils._os import upath from django.utils.module_loading import module_has_submodule MODELS_MODULE_NAME = 'models' class AppConfig(object): """ Class representing a Django ap...
gpl-3.0
FICTURE7/youtube-dl
youtube_dl/extractor/tvigle.py
117
3921
# encoding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_age_limit, ) class TvigleIE(InfoExtractor): IE_NAME = 'tvigle' IE_DESC = 'Интернет-телевидение Tvigle.ru' _VALID_U...
unlicense
bsmurphy/PyKrige
pykrige/core.py
1
30314
# coding: utf-8 """ PyKrige ======= Code by Benjamin S. Murphy and the PyKrige Developers bscott.murphy@gmail.com Summary ------- Methods used by multiple classes. References ---------- [1] P.K. Kitanidis, Introduction to Geostatistcs: Applications in Hydrogeology, (Cambridge University Press, 1997) 272 p. [2] ...
bsd-3-clause
getredash/redash
redash/utils/__init__.py
1
7622
import codecs import io import csv import datetime import decimal import hashlib import os import random import re import uuid import binascii import pystache import pytz import simplejson import sqlparse from flask import current_app from funcy import select_values from redash import settings from sqlalchemy.orm.quer...
bsd-2-clause
jianglu/mojo
gpu/gles2_conform_support/generate_gles2_conform_tests.py
139
1430
#!/usr/bin/env python # Copyright (c) 2013 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. """code generator for OpenGL ES 2.0 conformance tests.""" import os import re import sys def ReadFileAsLines(filename): """Read...
bsd-3-clause
thepaul/uftrace
tests/t128_arg_module2.py
1
1586
#!/usr/bin/env python from runtest import TestBase class TestCase(TestBase): def __init__(self): TestBase.__init__(self, 'allocfree', """ # DURATION TID FUNCTION 3.937 us [ 447] | __monstartup(); 1.909 us [ 447] | __cxa_atexit(); [ 447] | main() { [ 447] | alloc1...
gpl-2.0
pyconca/2013-web
symposion/sponsorship/templatetags/sponsorship_tags.py
7
2239
from django import template from symposion.conference.models import current_conference from symposion.sponsorship.models import Sponsor, SponsorLevel register = template.Library() class SponsorsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents(...
bsd-3-clause
rjschwei/azure-sdk-for-python
azure-batch/azure/batch/models/job_terminate_options.py
3
3082
# 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
sshnaidm/ru
plugin.video.serialu.net.plus/resources/lib/Auth.py
2
3779
import xbmc, xbmcgui, xbmcaddon, xbmcplugin import urllib, urllib2, json, sys, os, cookielib import urlparse import gzip, StringIO, zlib from BeautifulSoup import BeautifulSoup from PlayerSelect import PlayerDialog from Main import MainScreen from Data import Data class Auth(object): def __i...
gpl-2.0
parapente/beets
beetsplug/lyrics.py
1
21671
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2016, Adrian Sampson. # # 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 t...
mit
meganbkratz/acq4
acq4/util/imaging/record_thread.py
3
7494
import time from acq4.util.Mutex import Mutex from acq4.util.Thread import Thread from PyQt4 import QtGui, QtCore import acq4.util.debug as debug from acq4.util.metaarray import MetaArray import numpy as np import acq4.util.ptime as ptime import acq4.Manager from acq4.util.DataManager import FileHandle, DirHandle try: ...
mit