repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
kl4us/kgb | parser/parser.py | 1 | 9468 | import os
import re
import time
import datetime
from kgb import settings as settings
from quake3 import rcon
from database import api
from random import choice
class Parser:
def __init__(self, log_file):
self.full_file_name = log_file
self.file_dimension = os.path.getsize(self.full_file_name)
... | mit |
S01780/python-social-auth | examples/pyramid_example/example/settings.py | 51 | 2415 | SOCIAL_AUTH_SETTINGS = {
'SOCIAL_AUTH_LOGIN_URL': '/',
'SOCIAL_AUTH_LOGIN_REDIRECT_URL': '/done',
'SOCIAL_AUTH_USER_MODEL': 'example.models.User',
'SOCIAL_AUTH_LOGIN_FUNCTION': 'example.auth.login_user',
'SOCIAL_AUTH_LOGGEDIN_FUNCTION': 'example.auth.login_required',
'SOCIAL_AUTH_AUTHENTICATION_... | bsd-3-clause |
windedge/odoo | addons/stock_account/product.py | 166 | 11361 | # -*- 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 |
VoiDeD/Sick-Beard | cherrypy/_cpthreadinglocal.py | 36 | 6855 | # This is a backport of Python-2.4's threading.local() implementation
"""Thread-local objects
(Note that this module provides a Python version of thread
threading.local class. Depending on the version of Python you're
using, there may be a faster one available. You should always import
the local class fro... | gpl-3.0 |
Haifen/android_kernel_google_msm | tools/perf/scripts/python/net_dropmonitor.py | 4235 | 1554 | # Monitor the system for dropped packets and proudce a report of drop locations and counts
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import *
drop_log = {}
kallsyms = []
def... | gpl-2.0 |
hopkinsth/s3cmd | S3/ExitCodes.py | 8 | 1413 | # -*- coding: utf-8 -*-
# patterned on /usr/include/sysexits.h
EX_OK = 0
EX_GENERAL = 1
EX_PARTIAL = 2 # some parts of the command succeeded, while others failed
EX_SERVERMOVED = 10 # 301: Moved permanantly & 307: Moved temp
EX_SERVERERROR = 11 # 400, 405, 411, 416, 50... | gpl-2.0 |
otherness-space/myProject003 | my_project_003/lib/python2.7/site-packages/django/db/models/fields/subclassing.py | 227 | 1815 | """
Convenience routines for creating non-trivial Field subclasses, as well as
backwards compatibility utilities.
Add SubfieldBase as the metaclass for your Field subclass, implement
to_python() and the other necessary methods and everything will work
seamlessly.
"""
class SubfieldBase(type):
"""
A metaclass ... | mit |
BehavioralInsightsTeam/edx-platform | lms/djangoapps/courseware/views/views.py | 2 | 70618 | """
Courseware views functions
"""
import json
import logging
import urllib
from collections import OrderedDict, namedtuple
from datetime import datetime
import analytics
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import AnonymousUser, Use... | agpl-3.0 |
ClinicalGraphics/scikit-image | skimage/feature/tests/test_corner.py | 20 | 13002 | import numpy as np
from numpy.testing import (assert_array_equal, assert_raises,
assert_almost_equal)
from skimage import data
from skimage import img_as_float
from skimage.color import rgb2gray
from skimage.morphology import octagon
from skimage._shared.testing import test_parallel
from sk... | bsd-3-clause |
frederick-masterton/django | django/db/models/query.py | 4 | 77548 | """
The main QuerySet implementation. This provides the public API for the ORM.
"""
import copy
import itertools
import sys
from django.conf import settings
from django.core import exceptions
from django.db import connections, router, transaction, IntegrityError
from django.db.models.constants import LOOKUP_SEP
from ... | bsd-3-clause |
punchagan/zulip | zerver/webhooks/slack/tests.py | 4 | 2501 | from zerver.lib.test_classes import WebhookTestCase
class SlackWebhookTests(WebhookTestCase):
STREAM_NAME = "slack"
URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = "slack"
def test_slack_channel_to_topic(self) -> None:
expected_topic = "channel: g... | apache-2.0 |
nangia/django-allauth | allauth/socialaccount/south_migrations/0006_auto__del_field_socialapp_site.py | 80 | 6229 | # -*- coding: 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):
# Deleting field 'SocialApp.site'
db.delete_column('socialaccount_socialapp', 'site_id')
def backwards... | mit |
abenzbiria/clients_odoo | addons/account_check_writing/account.py | 379 | 2032 | # -*- 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 |
ga7g08/sympy | sympy/plotting/pygletplot/tests/test_plotting.py | 109 | 2653 | from sympy.external.importtools import import_module
disabled = False
# if pyglet.gl fails to import, e.g. opengl is missing, we disable the tests
pyglet_gl = import_module("pyglet.gl", catch=(OSError,))
pyglet_window = import_module("pyglet.window", catch=(OSError,))
if not pyglet_gl or not pyglet_window:
disabl... | bsd-3-clause |
langholz/draw | draw/prob_layers.py | 5 | 8754 |
from __future__ import division, print_function
import logging
import numpy
import theano
from theano import tensor
from blocks.bricks.base import application, lazy
from blocks.roles import add_role, WEIGHT, BIAS
from blocks.bricks import Random, Initializable, Linear
from blocks.utils import shared_floatx_zeros
... | mit |
smlng/RIOT | dist/tools/compile_test/compile_test.py | 21 | 8589 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 René Kijewski <rene.kijewski@fu-berlin.de>
# Copyright (C) 2015 Philipp Rosenkranz <philipp.rosenkranz@fu-berlin.de>
# Copyright (C) 2016 Eistec AB
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of th... | lgpl-2.1 |
SebastianMerz/calalert | Server/venv/lib/python2.7/site-packages/openid/server/trustroot.py | 143 | 14388 | # -*- test-case-name: openid.test.test_rpverify -*-
"""
This module contains the C{L{TrustRoot}} class, which helps handle
trust root checking. This module is used by the
C{L{openid.server.server}} module, but it is also available to server
implementers who wish to use it for additional trust root checking.
It also i... | gpl-2.0 |
sourcepole/qgis-wps-client | apicompat/sipv1/compat.py | 1 | 2442 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
ApiCompat
A QGIS plugin
API compatibility layer
-------------------
begin : 2013-07-02
copyright : (C) 2013 ... | gpl-2.0 |
xunmengfeng/engine | build/android/pylib/utils/reraiser_thread_unittest.py | 99 | 2368 | # Copyright 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.
"""Unittests for reraiser_thread.py."""
import threading
import unittest
from pylib.utils import reraiser_thread
from pylib.utils import watchdog_timer
c... | bsd-3-clause |
goldeneye-source/ges-python | lib/contextlib.py | 83 | 11648 | """Utilities for with-statement contexts. See PEP 343."""
import sys
from collections import deque
from functools import wraps
__all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack",
"redirect_stdout", "suppress"]
class ContextDecorator(object):
"A base class or mixin that enables c... | gpl-3.0 |
pietroquaglio/elephant | elephant/current_source_density.py | 1 | 13443 | # -*- coding: utf-8 -*-
"""'Current Source Density analysis (CSD) is a class of methods of analysis of
extracellular electric potentials recorded at multiple sites leading to
estimates of current sources generating the measured potentials. It is usually
applied to low-frequency part of the potential (called the Local F... | bsd-3-clause |
py-geek/City-Air | venv/lib/python2.7/site-packages/allauth/socialaccount/providers/openid/utils.py | 73 | 5352 | import base64
try:
from UserDict import UserDict
except ImportError:
from collections import UserDict
import pickle
from openid.store.interface import OpenIDStore as OIDStore
from openid.association import Association as OIDAssociation
from openid.extensions.sreg import SRegResponse
from openid.extensions.ax i... | mit |
leohmoraes/tablib | tablib/packages/xlwt3/Workbook.py | 46 | 21132 | '''
Record Order in BIFF8
Workbook Globals Substream
BOF Type = workbook globals
Interface Header
MMS
Interface End
WRITEACCESS
CODEPAGE
DSF
TABID
FNGROUPCOUNT
Workbook Protection Block
WINDOWPROTECT
PROTECT
... | mit |
twc-openstack/jenkins-job-builder | tests/cmd/subcommands/test_update.py | 6 | 5554 | # Joint copyright:
# - Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 |
acq4/acq4 | setup.py | 3 | 7580 | from __future__ import print_function
DESCRIPTION = """\
ACQ4 is a python-based platform for experimental neurophysiology.
It includes support for standard electrophysiology, multiphoton imaging,
scanning laser photostimulation, and many other experimental techniques. ACQ4 is
highly modular and extensible, allowing ... | mit |
Edraak/edx-platform | common/djangoapps/terrain/stubs/comments.py | 85 | 5565 | """
Stub implementation of cs_comments_service for acceptance tests
"""
import re
import urlparse
from .http import StubHttpRequestHandler, StubHttpService
class StubCommentsServiceHandler(StubHttpRequestHandler):
@property
def _params(self):
return urlparse.parse_qs(urlparse.urlparse(self.path).que... | agpl-3.0 |
MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.3.0/Lib/email/quoprimime.py | 54 | 10726 | # Copyright (C) 2001-2006 Python Software Foundation
# Author: Ben Gertzfield
# Contact: email-sig@python.org
"""Quoted-printable content transfer encoding per RFCs 2045-2047.
This module handles the content transfer encoding method defined in RFC 2045
to encode US ASCII-like 8-bit data called `quoted-printable'. It... | mit |
BeATz-UnKNoWN/python-for-android | python3-alpha/python3-src/Lib/xml/sax/expatreader.py | 870 | 14659 | """
SAX driver for the pyexpat C module. This driver works with
pyexpat.__version__ == '2.22'.
"""
version = "0.20"
from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_... | apache-2.0 |
mattseymour/django | tests/template_tests/syntax_tests/test_url.py | 71 | 11755 | from django.template import RequestContext, TemplateSyntaxError
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.urls import NoReverseMatch, resolve
from ..utils import setup
@override_settings(ROOT_URLCONF='template_tests.urls')
class UrlTagTests(SimpleTestCase):
# Successe... | bsd-3-clause |
rootulp/exercism | python/palindrome-products/palindrome.py | 1 | 1285 | from operator import mul
from functools import reduce
class Palindromes:
@classmethod
def smallest_palindrome(cls, max_factor, min_factor=0):
return min(cls.palindromes(max_factor, min_factor), key=lambda
item: item[0])
@classmethod
def largest_palindrome(cls, max_factor, m... | mit |
blighj/django | django/utils/datetime_safe.py | 100 | 2837 | # 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... | bsd-3-clause |
mSenyor/sl4a | python/src/Demo/parser/unparse.py | 35 | 13878 | "Usage: unparse.py <path to source file>"
import sys
import _ast
import cStringIO
import os
def interleave(inter, f, seq):
"""Call f on each item in seq, calling inter() in between.
"""
seq = iter(seq)
try:
f(seq.next())
except StopIteration:
pass
else:
for x in seq:
... | apache-2.0 |
gomyhr/elveg2osm | elveg_all.py | 1 | 1670 | #! /usr/bin/env python2
'''elveg_all Elveg_archive.zip [XXXX [YYYY [...]]]'''
import sys
import os
filename = sys.argv[1]
# Unzip archive if necessary
if filename[-4:] == '.zip':
# Assume that it is a zip file
dirname = filename[:-4]
if not os.path.isdir(dirname):
os.mkdir(dirname)
os.sy... | mit |
thekingofkings/chicago-crime | python/multi_view_learning/nn_leaveOneOut.py | 2 | 2401 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Tensor flow NN model for leave-one-out evaluation.
Created on Fri Apr 7 14:25:01 2017
@author: hxw186
"""
import tensorflow as tf
import numpy as np
import sys
sys.path.append("../")
from feature_evaluation import build_features
def leaveOneOut_error(Y, D, P,... | mit |
SofiaReis/django-cms | cms/models/placeholdermodel.py | 29 | 11215 | # -*- coding: utf-8 -*-
from cms.utils.compat import DJANGO_1_7
from django.contrib import admin
from django.contrib.auth import get_permission_codename
from django.db import models
from django.template.defaultfilters import title
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translati... | bsd-3-clause |
ian-garrett/meetMe | env/lib/python3.4/site-packages/flask/testing.py | 783 | 5003 | # -*- coding: utf-8 -*-
"""
flask.testing
~~~~~~~~~~~~~
Implements test support helpers. This module is lazily imported
and usually not used in production environments.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from contextlib import contextmana... | artistic-2.0 |
hujiajie/chromium-crosswalk | build/android/devil/android/device_utils_device_test.py | 10 | 7962 | #!/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.
"""
Unit tests for the contents of device_utils.py (mostly DeviceUtils).
The test will invoke real devices
"""
import os
import tempfi... | bsd-3-clause |
sonnyhu/scikit-learn | examples/ensemble/plot_gradient_boosting_quantile.py | 392 | 2114 | """
=====================================================
Prediction Intervals for Gradient Boosting Regression
=====================================================
This example shows how quantile regression can be used
to create prediction intervals.
"""
import numpy as np
import matplotlib.pyplot as plt
from skle... | bsd-3-clause |
KoertJanssens/MasterBall.be | pogom/altitude.py | 20 | 2596 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
import requests
import random
from .models import LocationAltitude
log = logging.getLogger(__name__)
# Altitude used when use_altitude_cache is enabled.
fallback_altitude = None
def get_gmaps_altitude(lat, lng, gmaps_key):
try:
r_session = reques... | agpl-3.0 |
Cojacfar/Maker | comm/lib/python2.7/site-packages/pip/_vendor/html5lib/trie/datrie.py | 1301 | 1178 | from __future__ import absolute_import, division, unicode_literals
from datrie import Trie as DATrie
from pip._vendor.six import text_type
from ._base import Trie as ABCTrie
class Trie(ABCTrie):
def __init__(self, data):
chars = set()
for key in data.keys():
if not isinstance(key, te... | gpl-2.0 |
rdipietro/tensorflow | tensorflow/python/kernel_tests/scan_ops_test.py | 21 | 9061 | # 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 |
erral/eitbapi | eitbapi/utils.py | 1 | 10106 | # -*- coding: utf8 -*-
from __future__ import unicode_literals
from bs4 import BeautifulSoup
import requests
import sys
import xml.etree.ElementTree as ET
import os
import json
import datetime
import pytz
if sys.version_info >= (3, 0, 0):
# for Python 3
PYTHON3 = True
else:
PYTHON3 = False
EITB_PLAYLIS... | gpl-2.0 |
loicsander/Robofont-scripts | ScaleFast/ScaleFast.roboFontExt/lib/mutatorScale/objects/scaler.py | 4 | 20742 | #coding=utf-8
from __future__ import division
from robofab.world import RGlyph
from mutatorMath.objects.location import Location
from mutatorMath.objects.mutator import buildMutator
from mutatorScale.objects.fonts import MutatorScaleFont
from mutatorScale.objects.errorGlyph import ErrorGlyph
from mutatorScale.utiliti... | mit |
adviti/melange | thirdparty/google_appengine/lib/django_1_2/django/contrib/gis/geos/geometry.py | 68 | 23445 | """
This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
inherit from this object.
"""
# Python, ctypes and types dependencies.
import re
from ctypes import addressof, byref, c_double, c_size_t
# super-class for mutable list behavior
from django.contrib.gis.geos.mutable_list import ListMixin
#... | apache-2.0 |
patricklodder/dogecoin | qa/rpc-tests/test_framework/comptool.py | 49 | 18852 | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from .mininode import *
from .blockstore import BlockStore, TxStore
from .util import p2p_port
'''
This ... | mit |
pllim/ginga | ginga/gtk3w/Widgets.py | 3 | 75769 | #
# Widgets.py -- wrapped Gtk widgets and convenience functions
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import os.path
from ginga.gtk3w import GtkHelp
import ginga.icons
from ginga.misc import Callback, Bunch, Settings, LineHistory
from functool... | bsd-3-clause |
dragorosson/heat | heat/tests/openstack/nova/test_keypair.py | 5 | 8720 | #
# 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 |
nvoron23/avos | openstack_dashboard/management/commands/make_web_conf.py | 8 | 9452 | # -*- 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, softwa... | apache-2.0 |
mozillazg/phrase-pinyin-data | merge.py | 1 | 1227 | # -*- coding: utf-8 -*-
import sys
import codecs
def parse(lines):
"""
:yield: hanzi, others
"""
for line in lines:
line = line.strip()
if line.startswith('#') or not line:
continue
hanzi, others = line.split(':', 1)
yield hanzi.strip(), others.strip()
de... | mit |
hchen1202/django-react | virtualenv/lib/python3.6/site-packages/whitenoise/media_types.py | 4 | 4800 | import os
class MediaTypes(object):
def __init__(self, default='application/octet-stream', extra_types=None):
self.types_map = default_types()
self.default = default
if extra_types:
self.types_map.update(extra_types)
def get_type(self, path):
name = os.path.basena... | mit |
simonmeister/UnFlow | src/e2eflow/test/test_losses.py | 1 | 6535 | import numpy as np
import tensorflow as tf
from ..core.losses import _smoothness_deltas, create_outgoing_mask, \
gradient_loss, compute_losses, ternary_loss
from ..core.input import read_png_image
class LossesTest(tf.test.TestCase):
def test_smoothness_deltas(self):
flow = np.ones([1,3,3,2], np.floa... | mit |
brettminnie/closure-linter | closure_linter/errorrecord.py | 126 | 2039 | #!/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
#
#... | apache-2.0 |
pymedusa/Medusa | ext/tornado/routing.py | 5 | 25082 | # Copyright 2015 The Tornado 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 applicable law or agreed to in w... | gpl-3.0 |
shikhardb/scikit-learn | examples/linear_model/plot_sgd_iris.py | 286 | 2202 | """
========================================
Plot multi-class SGD on the iris dataset
========================================
Plot decision surface of multi-class SGD on iris dataset.
The hyperplanes corresponding to the three one-versus-all (OVA) classifiers
are represented by the dashed lines.
"""
print(__doc__)
... | bsd-3-clause |
sujithvm/red-alert | src/aminer.py | 3 | 1748 | import pymongo
client = pymongo.MongoClient("localhost", 27017)
# db name - aminer
db = client.aminer
# collection
db.publications
print "DB name: ", db.name
print "DB collection: ", db.publications
print "[INFO] Processing papers"
file = open("../data/aminer_publications.txt")
lines = file.readlines()
papers = ... | mit |
zhaochengw/android_kernel_ef51lsk | tools/perf/scripts/python/futex-contention.py | 11261 | 1486 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
malelew/UCLA_Dining_Web_App | ENV/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/url.py | 553 | 5836 | from collections import namedtuple
from ..exceptions import LocationParseError
url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
class Url(namedtuple('Url', url_attrs)):
"""
Datastructure for representing an HTTP URL. Used as a return value for
:func:`parse_url`.
"""
s... | mit |
hansey/youtube-dl | youtube_dl/extractor/planetaplay.py | 113 | 1921 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import ExtractorError
class PlanetaPlayIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?planetaplay\.com/\?sng=(?P<id>[0-9]+)'
_API_URL = 'http://planetaplay.com/action/playlist/?sng={0:}'
... | unlicense |
PongPi/isl-odoo | addons/hr_payroll/wizard/__init__.py | 442 | 1159 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... | agpl-3.0 |
josauder/procedural_city_generation | procedural_city_generation/additional_stuff/Singleton.py | 2 | 1569 | class Singleton:
"""
Singleton Object which can only have one instance.
Is instanciated with a modulename, e.g. "roadmap", and reads the
corresponding "roadmap.conf" in procedural_city_generation/inputs.
All attributes are mutable, however this class should mainly be used for
immutable numeric v... | mpl-2.0 |
timm/timmnix | pypy3-v5.5.0-linux64/lib-python/3/tkinter/__init__.py | 2 | 163238 | """Wrapper functions for Tcl/Tk.
Tkinter provides classes which allow the display, positioning and
control of widgets. Toplevel widgets are Tk and Toplevel. Other
widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
LabelFrame and PanedWindow.
... | mit |
wuzheng-sjtu/FastFPN | libs/boxes/anchor.py | 2 | 4237 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from libs.boxes import cython_anchor
def anchors(scales=[2, 4, 8, 16, 32], ratios=[0.5, 1, 2.0], base=16):
"""Get a set of anchors at one position """
return generate_anchors(base_size=b... | apache-2.0 |
ahmed-mahran/hue | desktop/core/ext-py/pysaml2-2.4.0/src/saml2/extension/pefim.py | 33 | 1972 | #!/usr/bin/env python
import saml2
from saml2 import SamlBase
from xmldsig import X509Data
NAMESPACE = 'urn:net:eustix:names:tc:PEFIM:0.0:assertion'
class SPCertEncType_(SamlBase):
"""The urn:net:eustix:names:tc:PEFIM:0.0:assertion:SPCertEncType element """
c_tag = 'SPCertEncType'
c_namespace = NAMESPA... | apache-2.0 |
MediaSapiens/autonormix | django/contrib/gis/tests/geoapp/test_feeds.py | 16 | 3851 | from xml.dom import minidom
from django.test import Client
from django.utils import unittest
from models import City
class GeoFeedTest(unittest.TestCase):
client = Client()
def assertChildNodes(self, elem, expected):
"Taken from regressiontests/syndication/tests.py."
actual = set([n.nodeNam... | bsd-3-clause |
Sbalbp/DIRAC | ResourceStatusSystem/Command/GGUSTicketsCommand.py | 7 | 5609 | # $HeadURL: $
''' GGUSTicketsCommand
The GGUSTickets_Command class is a command class to know about
the number of active present opened tickets.
'''
import urllib2
from DIRAC import gLogger, S_ERROR, S_OK
from DIRAC.Core.LCG.GGUSTicketsClient ... | gpl-3.0 |
Split-Screen/android_kernel_semc_msm7x30 | tools/perf/scripts/python/futex-contention.py | 11261 | 1486 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
aferr/TemporalPartitioningMemCtl | src/arch/x86/isa/insts/simd64/floating_point/arithmetic/subtraction.py | 91 | 2766 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | bsd-3-clause |
himmih/cluedo | venv/lib/python2.7/site-packages/jinja2/environment.py | 332 | 48120 | # -*- coding: utf-8 -*-
"""
jinja2.environment
~~~~~~~~~~~~~~~~~~
Provides a class that holds runtime and parsing time options.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from jinja2 import nodes
from jinja2.defaults import BLOCK_S... | apache-2.0 |
magical/jwt-python | jwt.py | 1 | 6231 | u"""JSON Web Token"""
import base64
import json
import re
import M2Crypto
import hashlib
import hmac
from struct import pack
from itertools import izip
JWT_TYPS = (u"JWT", u"http://openid.net/specs/jwt/1.0")
# XXX Should this be a subclass of ValueError?
class Invalid(Exception):
"""The JWT is invalid."""
cla... | mit |
gangadhar-kadam/hrshop | shopping_cart/hooks.py | 1 | 1079 | app_name = "shopping_cart"
app_title = "Shopping Cart"
app_publisher = "Web Notes Technologies"
app_description = "Online Shopping Cart integrated with ERPNext"
app_icon = "icon-shopping-cart"
app_color = "#B7E090"
app_email = "info@erpnext.com"
app_url = "https://erpnext.com"
app_version = "0.0.1"
web_include_js = "a... | agpl-3.0 |
Joel-U/sparkle | sparkle/gui/plotting/protocoldisplay.py | 2 | 10507 | import numpy as np
from sparkle.QtWrapper import QtCore, QtGui
from sparkle.gui.plotting.pyqtgraph_widgets import FFTWidget, SpecWidget, \
TraceWidget
class ProtocolDisplay(QtGui.QWidget):
"""Data display intended for use during brain recording"""
thresholdUpdated = QtCore.Signal(float, str)
polarity... | gpl-3.0 |
anthonydillon/horizon | openstack_dashboard/dashboards/project/images/images/tabs.py | 89 | 1576 | # Copyright 2012 Nebula, 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 agree... | apache-2.0 |
ludmilamarian/invenio | invenio/modules/jsonalchemy/parser.py | 17 | 37499 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014, 2015 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 optio... | gpl-2.0 |
xbmc/xbmc-antiquated | xbmc/lib/libPython/Python/Lib/test/test_sys.py | 24 | 8698 | # -*- coding: iso-8859-1 -*-
import unittest, test.test_support
import sys, cStringIO
class SysModuleTest(unittest.TestCase):
def test_original_displayhook(self):
import __builtin__
savestdout = sys.stdout
out = cStringIO.StringIO()
sys.stdout = out
dh = sys.__displayhook_... | gpl-2.0 |
servo/servo | tests/wpt/web-platform-tests/webdriver/tests/support/fixtures.py | 3 | 11504 | import copy
import json
import os
import asyncio
import pytest
import webdriver
from six import string_types
from six.moves.urllib.parse import urlunsplit
from tests.support import defaults
from tests.support.helpers import cleanup_session, deep_update
from tests.support.inline import build_inline
from tests.suppor... | mpl-2.0 |
mojoboss/scikit-learn | sklearn/utils/tests/test_random.py | 230 | 7344 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.misc import comb as combinations
from numpy.testing import assert_array_almost_equal
from sklearn.utils.random import sample_without_replacement
from sklearn.utils.random import random_choice_csc
from sklearn.utils.testing import ... | bsd-3-clause |
tarzan0820/addons-yelizariev | crm_phonecall_notification/models.py | 17 | 2078 | # -*- coding: utf-8 -*-
from openerp.osv import osv,fields
from openerp import SUPERUSER_ID
class crm_phonecall(osv.Model):
_inherit = 'crm.phonecall'
_track = {
'partner_id': {
'crm_phonecall_notification.mt_phonecall_new': lambda self, cr, uid, obj, ctx=None: obj.partner_id
}
... | lgpl-3.0 |
KSchopmeyer/smipyping | tools/click_help_capture.py | 1 | 8399 | #!/usr/bin/env python
"""
This tool can capture the help outputs from a click application and output
the result either as text or in restructured text format.
It executes the click script --help and recursively scrapes all of the
subcommands from the output, generating an output that is the help text for
every groupt... | mit |
dga4654dan/UTM-Demo | V_1_0_2_1/UtmDemo_Sfs_2.9.0/UtmDemo_Sfs_2.9.0_Server/lib/Lib/test/test_userdict.py | 10 | 2034 | # Check every path through every method of UserDict
from test_support import verify, verbose
from UserDict import UserDict, IterableUserDict
d0 = {}
d1 = {"one": 1}
d2 = {"one": 1, "two": 2}
# Test constructors
u = UserDict()
u0 = UserDict(d0)
u1 = UserDict(d1)
u2 = IterableUserDict(d2)
uu = UserDict(u)
uu0 = User... | gpl-2.0 |
motion2015/edx-platform | cms/djangoapps/contentstore/tests/test_crud.py | 74 | 12414 | import unittest
from opaque_keys.edx.locator import LocalId
from xmodule import templates
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests import persistent_factories
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.django import modulestore, clear_existing_mod... | agpl-3.0 |
aroche/django | django/core/management/commands/flush.py | 181 | 3879 | from __future__ import unicode_literals
import sys
from importlib import import_module
from django.apps import apps
from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import no_style
from django.core.management.sql import emit_post_migrate_signal, sql_flush
from django... | bsd-3-clause |
itsjeyd/edx-platform | lms/djangoapps/grades/context.py | 7 | 2823 | """
Grading Context
"""
from collections import defaultdict
from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache
from .scores import possibly_scored
def grading_context_for_course(course):
"""
Same as grading_context, but takes in a course object.
"""
course_structure =... | agpl-3.0 |
Odingod/mne-python | mne/simulation/evoked.py | 7 | 3964 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import copy
import numpy as np
from ..io.pick import pick_channels_cov
from ..forward import apply_f... | bsd-3-clause |
davidovich/pip | tests/lib/venv.py | 30 | 2577 | from __future__ import absolute_import
import os
import sys
import subprocess
import virtualenv as _virtualenv
from .path import Path
# On Python < 3.3 we don't have subprocess.DEVNULL
try:
DEVNULL = subprocess.DEVNULL
except AttributeError:
DEVNULL = open(os.devnull, "wb")
class VirtualEnvironment(objec... | mit |
institution/mpskit | charmap.py | 1 | 2324 | import sys
import os.path
import json
from record import Record
from conf import conf
from fail import fail,warning,printf
# NOTE: charmap will not be applied to "[]" characters and everything inside them
# NOTE: charmap: keep lower and upper case characters separated by 32
# NOTE: charmap: keep digits at their defaul... | agpl-3.0 |
ajdawson/numpy | numpy/ma/__init__.py | 76 | 1576 | """
=============
Masked Arrays
=============
Arrays sometimes contain invalid or missing data. When doing operations
on such arrays, we wish to suppress invalid values, which is the purpose masked
arrays fulfill (an example of typical use is given below).
For example, examine the following array:
>>> x = np.array(... | bsd-3-clause |
eharney/cinder | cinder/tests/unit/attachments/test_attachments_api.py | 1 | 11677 | # 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 |
tejassp/asadmn-web | webapp/lib/terminal.py | 1 | 5712 | # Copyright 2013-2014 Aerospike, 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 writi... | unlicense |
translate/pootle | tests/models/unit.py | 5 | 13351 | # -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import os
import pytest
from translate.sto... | gpl-3.0 |
cjds/cron | lib/werkzeug/contrib/fixers.py | 148 | 10197 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.fixers
~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.5
This module includes various helpers that fix bugs in web servers. They may
be necessary for some versions of a buggy web server but not others. We try
to stay updated with the status of the bug... | apache-2.0 |
buildhappy/ice | cpp/test/Ice/operations/run.py | 3 | 1111 | #!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | gpl-2.0 |
ed-/solum | solum/tests/api/handlers/test_component.py | 2 | 3212 | # -*- 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, soft... | apache-2.0 |
sadanandb/pmt | src/pyasm/application/maya/maya_builder.py | 6 | 5093 | ###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | epl-1.0 |
lucashmorais/x-Bench | mozmill-env/python/Lib/encodings/utf_8_sig.py | 412 | 3685 | """ Python 'utf-8-sig' Codec
This work similar to UTF-8 with the following changes:
* On encoding/writing a UTF-8 encoded BOM will be prepended/written as the
first three bytes.
* On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these
bytes will be skipped.
"""
import codecs
### Codec APIs
... | mit |
ty707/airflow | tests/contrib/operators/hipchat_operator.py | 9 | 2204 | # -*- 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 |
taedori81/e-commerce-template | saleor/core/utils/__init__.py | 12 | 2520 | # coding: utf-8
from __future__ import unicode_literals
import re
from django import forms
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.template.response import TemplateResponse
from django.utils.encoding import iri_to_uri, smart_text
from satchless.process impor... | bsd-3-clause |
dbflute-test/dbflute-test-option-compatible10x | mydbflute/dbflute-1.x/ant/bin/runant.py | 126 | 3285 | #!/usr/bin/python
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Licen... | apache-2.0 |
muraliselva10/cloudkitty | cloudkitty/api/v1/types.py | 1 | 1852 | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | apache-2.0 |
SCOAP3/invenio | invenio/modules/uploader/manage.py | 13 | 1461 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014 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 |
florian-dacosta/OCB | addons/warning/warning.py | 73 | 11827 | # -*- 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.