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 |
|---|---|---|---|---|---|
mitocw/edx-platform | common/lib/xmodule/xmodule/tests/test_library_root.py | 4 | 3363 | # -*- coding: utf-8 -*-
"""
Basic unit tests for LibraryRoot
"""
from mock import patch
from six.moves import range
from web_fragments.fragment import Fragment
from xblock.runtime import Runtime as VanillaRuntime
from xmodule.modulestore.tests.factories import ItemFactory, LibraryFactory
from xmodule.modulestore.tes... | agpl-3.0 |
jinxiaoye1987/RyzomCore | nel/tools/build_gamedata/processes/zone_light/1_export.py | 3 | 1955 | #!/usr/bin/python
#
# \file 1_export.py
# \brief Export zone_light
# \date 2009-03-11-13-45-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Export zone_light
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2010 Winch Gate Property Limited
#
# This program... | agpl-3.0 |
mikica1986vee/Godot_android_tegra_fallback | platform/haiku/detect.py | 13 | 1652 | import os
import sys
def is_active():
return True
def get_name():
return "Haiku"
def can_build():
if (os.name != "posix"):
return False
if (sys.platform == "darwin"):
return False
return True
def get_opts():
return [
('debug_release', 'Add debug symbols to release version','no')
]
def get_flags():
... | mit |
emineKoc/WiseWit | wisewit_front_end/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/scanner.py | 135 | 3114 | # -*- coding: utf-8 -*-
"""
pygments.scanner
~~~~~~~~~~~~~~~~
This library implements a regex based scanner. Some languages
like Pascal are easy to parse but have some keywords that
depend on the context. Because of this it's impossible to lex
that just by using a regular expression lexer like ... | gpl-3.0 |
Lujeni/ansible | lib/ansible/modules/cloud/vultr/_vultr_plan_facts.py | 21 | 3981 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
# 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':... | gpl-3.0 |
runekaagaard/django-contrib-locking | tests/view_tests/tests/test_csrf.py | 47 | 2663 | from django.test import TestCase, override_settings, Client
from django.utils.translation import override
@override_settings(ROOT_URLCONF="view_tests.urls")
class CsrfViewTests(TestCase):
def setUp(self):
super(CsrfViewTests, self).setUp()
self.client = Client(enforce_csrf_checks=True)
@over... | bsd-3-clause |
st135yle/django-site | dbenv/lib/python3.4/site-packages/django/contrib/sessions/backends/cache.py | 117 | 2766 | from django.conf import settings
from django.contrib.sessions.backends.base import (
CreateError, SessionBase, UpdateError,
)
from django.core.cache import caches
from django.utils.six.moves import range
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based sessi... | mit |
damonkohler/sl4a | python/src/Lib/plat-irix5/FILE.py | 66 | 4038 | # Generated by h2py from /usr/include/sys/file.h
from warnings import warnpy3k
warnpy3k("the FILE module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
# Included from sys/types.h
# Included from sgidefs.h
_MIPS_ISA_MIPS1 = 1
_MIPS_ISA_MIPS2 = 2
_MIPS_ISA_MIPS3 = 3
_MIPS_ISA_MIPS4 = 4
_MIPS_SIM_ABI32 = 1... | apache-2.0 |
zonesan/shadowsocks-android | gfwlist/gen.py | 304 | 1535 | #!/usr/bin/python
# -*- encoding: utf8 -*-
import itertools
import math
import sys
import IPy
def main():
china_list_set = IPy.IPSet()
for line in sys.stdin:
line_params = line.split("|")
if len(line_params) < 5 or line_params[2] != "ipv4" or line_params[1] != "CN":
continue
... | gpl-3.0 |
jounex/hue | desktop/core/ext-py/thrift-0.9.1/src/transport/THttpClient.py | 157 | 4221 | #
# 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 |
sivareddyg/UDepLambda | scripts/graphquestions/split_data.py | 1 | 1167 | import sys
import json
import random
if len(sys.argv) > 2:
dev_split_size = int(sys.argv[2])
else:
dev_split_size = 30
training_file = open(sys.argv[1] + ".%d" %(100 - dev_split_size), "w")
dev_file = open(sys.argv[1] + ".%d" %(dev_split_size), "w")
sys.stderr.write("Creating training and dev splits\n");
sp... | apache-2.0 |
luiscarlosgph/nas | env/lib/python2.7/site-packages/django/contrib/gis/db/models/lookups.py | 48 | 1423 | from django.db.models.lookups import Lookup
from django.db.models.sql.expressions import SQLEvaluator
class GISLookup(Lookup):
def as_sql(self, qn, connection):
from django.contrib.gis.db.models.sql import GeoWhereNode
# We use the same approach as was used by GeoWhereNode. It would
# be a... | mit |
Benocs/core | src/daemon/core/session.py | 1 | 45796 | #
# CORE
# Copyright (c)2010-2013 the Boeing Company.
# See the LICENSE file included in this distribution.
#
# authors: Tom Goff <thomas.goff@boeing.com>
# Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
#
# Copyright (c) 2014 Benocs GmbH
#
# author: Robert Wuttke <robert@benocs.com>
#
# See the LICENSE file ... | bsd-3-clause |
davruet/shenanigans.io | experiments/zmq_server/client.py | 1 | 1866 | #!/opt/local/bin/python3.4
#
# Lazy Pirate client
# Use zmq_poll to do a safe request-reply
# To run, start lpserver and then randomly kill/restart it
#
# Author: Daniel Lundin <dln(at)eintr(dot)org>
#
import sys
import zmq
REQUEST_TIMEOUT = 2500
REQUEST_RETRIES = 3
SERVER_ENDPOINT = "tcp://localhost:5555"
con... | agpl-3.0 |
s2hc-johan/nikola | scripts/import_po.py | 8 | 1061 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Download translations from transifex and regenerate files."""
from __future__ import unicode_literals, print_function
import io
from glob import glob
import os
import sys
import polib
if 'nopull' not in sys.argv:
os.system("tx pull -a")
trans_files = glob(os.path.... | mit |
RiccardoPecora/MP | Lib/xdrlib.py | 55 | 5794 | """Implements (a subset of) Sun XDR -- eXternal Data Representation.
See: RFC 1014
"""
import struct
try:
from cStringIO import StringIO as _StringIO
except ImportError:
from StringIO import StringIO as _StringIO
__all__ = ["Error", "Packer", "Unpacker", "ConversionError"]
# exceptions
class... | gpl-3.0 |
WeirdCoder/rss-2014-team-3 | src/robotbrain/src/motionplanner.py | 1 | 19846 | import rospy
import math
import time
from gc_msgs.msg import ConveyorMsg
from gc_msgs.msg import HamperMsg
from gc_msgs.msg import EncoderMsg
from gc_msgs.msg import MotionMsg
from gc_msgs.msg import WheelErrorMsg
from gc_msgs.msg import MotionDistMsg
from gc_msgs.msg import StateMsg
#
# This class is used by the Robot... | mit |
joisig/grit-i18n | grit/format/c_format_unittest.py | 61 | 1968 | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Unittest for c_format.py.
"""
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__... | bsd-2-clause |
deandunbar/html2bwml | venv/lib/python2.7/site-packages/django/contrib/admin/filters.py | 70 | 16602 | """
This encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
import datetime
from django.db import models... | mit |
bwbeach/ansible | lib/ansible/plugins/action/fetch.py | 18 | 7436 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | gpl-3.0 |
axinging/sky_engine | build/android/pylib/remote/device/appurify_constants.py | 36 | 1614 | # 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.
"""Defines a set of constants specific to appurify."""
# Appurify network config constants.
class NETWORK(object):
WIFI_1_BAR = 1
SPRINT_4G_LTE_4_BARS =... | bsd-3-clause |
t794104/ansible | lib/ansible/modules/database/proxysql/proxysql_replication_hostgroups.py | 52 | 13353 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# 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
DOCUMENTATION = '''
---
module: proxysql_replication_hostg... | gpl-3.0 |
jannon/django-haystack | haystack/management/commands/update_index.py | 11 | 11888 | # encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
import sys
import warnings
from datetime import timedelta
from optparse import make_option
try:
from django.db import close_old_connections
except ImportError:
# This can be removed wh... | bsd-3-clause |
jtux270/translate | ovirt/packaging/setup/plugins/ovirt-engine-common/base/core/offlinepackager.py | 3 | 2433 | #
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013 Red Hat, 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 r... | gpl-3.0 |
mattvonrocketstein/smash | smashlib/ipy3x/nbconvert/filters/datatypefilter.py | 1 | 1220 | """Filter used to select the first preferred output format available.
The filter contained in the file allows the converter templates to select
the output format that is most valuable to the active export format. The
value of the different formats is set via
NbConvertBase.display_data_priority
"""
#-----------------... | mit |
sbidoul/buildbot | master/buildbot/test/unit/test_worker_manager.py | 10 | 4219 | # This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | gpl-2.0 |
blaze33/django | django/views/decorators/vary.py | 329 | 1197 | from functools import wraps
from django.utils.cache import patch_vary_headers
from django.utils.decorators import available_attrs
def vary_on_headers(*headers):
"""
A view decorator that adds the specified headers to the Vary header of the
response. Usage:
@vary_on_headers('Cookie', 'Accept-languag... | bsd-3-clause |
catapult-project/catapult | systrace/profile_chrome/chrome_startup_tracing_agent_unittest.py | 6 | 1066 | # 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.
import json
from profile_chrome import chrome_startup_tracing_agent
from systrace import decorators
from systrace.tracing_agents import agents_unittest
cl... | bsd-3-clause |
sapics/letsencrypt | letsencrypt-nginx/letsencrypt_nginx/parser.py | 26 | 16596 | """NginxParser is a member object of the NginxConfigurator class."""
import glob
import logging
import os
import pyparsing
import re
from letsencrypt import errors
from letsencrypt_nginx import obj
from letsencrypt_nginx import nginxparser
logger = logging.getLogger(__name__)
class NginxParser(object):
"""Cla... | apache-2.0 |
geometalab/osmaxx-frontend | osmaxx/excerptexport/migrations/0033_add_countries_as_public_excerpts_20160518_1401.py | 2 | 2038 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-18 12:01
from __future__ import unicode_literals
import os
from django.db import migrations
def get_polyfile_name_to_file_mapping():
from osmaxx.excerptexport._settings import POLYFILE_LOCATION
from osmaxx.utils.polyfile_helpers import _is_polyf... | mit |
meithan/tictactoe | SwarmTrainer.py | 1 | 5058 | # Trains a neural network to play tic-tac-toe using Particle
# Swarm Optimization
import random
import numpy as np
from NeuralNetwork import NeuralNetwork
from NNPlayer import NNPlayer
from trials import evaluate_player
# ==================================
# PSO global constants
xi = 0.72984
c1 = 2.05
c2 = 2.05
# Th... | gpl-3.0 |
akaariai/django | tests/model_options/test_default_related_name.py | 308 | 1645 | from django.test import TestCase
from .models.default_related_name import Author, Book, Editor
class DefaultRelatedNameTests(TestCase):
def setUp(self):
self.author = Author.objects.create(first_name="Dave", last_name="Loper")
self.editor = Editor.objects.create(name="Test Editions",
... | bsd-3-clause |
shedskin/shedskin | examples/adatron.py | 6 | 6315 | #!/usr/bin/env python
# Adatron SVM with polynomial kernel
# placed in the public domain by Stavros Korokithakis
import sys
from math import exp
CYTOSOLIC = 0
EXTRACELLULAR = 1
NUCLEAR = 2
MITOCHONDRIAL = 3
BLIND = 4
D = 5.0
LENGTH = 50
PROTEINS = []
AMINOACIDS = "ACDEFGHIKLMNPQRSTVWY"
class Protein:
def __... | gpl-3.0 |
vdt/SimpleCV | SimpleCV/examples/manipulation/mustachinator.py | 13 | 1439 | #!/usr/bin/python
from operator import add
from SimpleCV import *
cam = Camera()
display = Display((800,600))
counter = 0
# load the cascades
face_cascade = HaarCascade("face")
nose_cascade = HaarCascade("nose")
stache = Image("stache.png", sample=True) # load the stache
mask = stache.createAlphaMask() # load the st... | bsd-3-clause |
ArneBab/pypyjs | website/demo/home/rfk/repos/pypy/lib-python/2.7/email/parser.py | 392 | 3300 | # Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw, Thomas Wouters, Anthony Baxter
# Contact: email-sig@python.org
"""A parser of RFC 2822 and MIME email messages."""
__all__ = ['Parser', 'HeaderParser']
import warnings
from cStringIO import StringIO
from email.feedparser import FeedParser
... | mit |
RAMSProject/rams | uber/tests/test_api.py | 1 | 16626 | import pytest
from cherrypy import HTTPError
from uber.common import *
from uber.tests.conftest import csrf_token, cp_session
from uber.api import auth_by_token, auth_by_session, api_auth, all_api_auth
VALID_API_TOKEN = '39074db3-9295-447a-b831-8cbaa93a0522'
@pytest.fixture()
def session():
with Session() as ... | agpl-3.0 |
cledio66/pyglet | pyglet/clock.py | 21 | 34511 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause |
maciekcc/tensorflow | tensorflow/contrib/learn/python/learn/estimators/estimators_test.py | 23 | 5276 | # 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 |
austin987/tails | wiki/src/blueprint/greeter_revamp_UI/mockups/mockup.py | 14 | 7062 | #!/usr/bin/python
#*-* coding=utf-8
import sys
import optparse
from gi.repository import Gtk, Gdk, GObject, GdkPixbuf
class GreeterMockup:
def __init__(self, version="5", persistence=False):
uifilename = "tails-greeter" + version + ".ui"
ui = Gtk.Builder()
ui.add_from_file(uifilename)
... | gpl-3.0 |
repotvsupertuga/tvsupertuga.repository | script.premium.TVsupertuga/resources/lib/external/jsbeautifier/unpackers/javascriptobfuscator.py | 220 | 1790 | #
# simple unpacker/deobfuscator for scripts messed up with
# javascriptobfuscator.com
#
# written by Einar Lielmanis <einar@jsbeautifier.org>
# rewritten in Python by Stefano Sanfilippo <a.little.coder@gmail.com>
#
# Will always return valid javascript: if `detect()` is false, `code` is
# returned, unmodified.... | gpl-2.0 |
atomic83/youtube-dl | youtube_dl/extractor/worldstarhiphop.py | 114 | 2323 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
class WorldStarHipHopIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|m)\.worldstar(?:candy|hiphop)\.com/(?:videos|android)/video\.php\?v=(?P<id>.*)'
_TESTS = [{
"url": "http://www.worldstarhiphop.com/videos/video.p... | unlicense |
kwlzn/pants | tests/python/pants_test/option/test_arg_splitter.py | 19 | 11254 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import shlex
import ... | apache-2.0 |
MadeiraCloud/opsagent | libs/jinja2/nodes.py | 623 | 28875 | # -*- coding: utf-8 -*-
"""
jinja2.nodes
~~~~~~~~~~~~
This module implements additional nodes derived from the ast base node.
It also provides some node tree helper functions like `in_lineno` and
`get_nodes` used by the parser and translator in order to normalize
python and jinja nodes.
:... | apache-2.0 |
gminds/rapidnewsng | django/template/defaultfilters.py | 105 | 28133 | """Default variable filters."""
from __future__ import unicode_literals
import re
import random as random_module
import unicodedata
from decimal import Decimal, InvalidOperation, Context, ROUND_HALF_UP
from functools import wraps
from pprint import pformat
from django.template.base import Variable, Library, VariableD... | bsd-3-clause |
TeamTwisted/kernel_lge_hammerhead | tools/perf/scripts/python/syscall-counts-by-pid.py | 11180 | 1927 | # system call counts, by pid
# (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, sys
sys.path.append(os.env... | gpl-2.0 |
jmighion/ansible | test/units/modules/network/f5/test_bigip_irule.py | 51 | 8741 | # -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks 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) a... | gpl-3.0 |
hyqneuron/pylearn2-maxsom | pylearn2/scripts/dbm/show_reconstructions.py | 7 | 4853 | #!/usr/bin/env python
from __future__ import print_function
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
"""
Usage: python show_reconstructions <path_to_a_saved_DBM.pkl>
Displays a batc... | bsd-3-clause |
eshasharma/mase | python101/code/birthday.py | 14 | 1302 | """This module contains code from
Think Python by Allen B. Downey
http://thinkpython.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import random
def has_duplicates(t):
"""Returns True if any element appears more than once in (t),
False otherwise."""
s = t... | unlicense |
zaitcev/swift-lfs | test/__init__.py | 6 | 1475 | # See http://code.google.com/p/python-nose/issues/detail?id=373
# The code below enables nosetests to work with i18n _() blocks
import __builtin__
import sys
import os
from swift.common.utils import readconf
setattr(__builtin__, '_', lambda x: x)
# Work around what seems to be a Python bug.
# c.f. https://bugs.lau... | apache-2.0 |
mlds-lab/egk | demo.py | 1 | 1643 | import numpy as np
import cPickle as pickle
from sklearn.svm import LinearSVC
import gp
from full_marginal import compute_means_covs
from fastfood import FastfoodEGK
def main():
np.random.seed(111)
with open('data/ECG200-50.pkl', 'rb') as f:
ts_train, ts_test, l_train, l_test = pickle.load(f)
# E... | mit |
helldorado/ansible | lib/ansible/modules/cloud/kubevirt/kubevirt_template.py | 16 | 14883 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Ansible Project
# 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 |
YinongLong/scikit-learn | sklearn/covariance/graph_lasso_.py | 51 | 26432 | """GraphLasso: sparse inverse covariance estimation with an l1-penalized
estimator.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
# Copyright: INRIA
import warnings
import operator
import sys
import time
import numpy as np
from scipy import linalg
from .empirical_covariance_ im... | bsd-3-clause |
teonlamont/mne-python | mne/io/nicolet/nicolet.py | 2 | 7703 | # Author: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
#
# License: BSD (3-clause)
import numpy as np
from os import path
import datetime
import calendar
from ...utils import logger
from ..utils import _read_segments_file, _find_channels, _create_chs
from ..base import BaseRaw, _check_update_montage
from ..meas_info ... | bsd-3-clause |
w1ll1am23/home-assistant | tests/components/zwave/test_switch.py | 11 | 2347 | """Test Z-Wave switches."""
from unittest.mock import patch
from homeassistant.components.zwave import switch
from tests.mock.zwave import MockEntityValues, MockNode, MockValue, value_changed
def test_get_device_detects_switch(mock_openzwave):
"""Test get_device returns a Z-Wave switch."""
node = MockNode()... | apache-2.0 |
kuri65536/python-for-android | python-build/python-libs/gdata/build/lib/gdata/tlslite/utils/hmac.py | 403 | 3286 | """HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
(This file is modified from the standard library version to do faster
copying)
"""
def _strxor(s1, s2):
"""Utility method. XOR the two strings s1 and s2 (must have same length).
"""
r... | apache-2.0 |
quantopian/ta-lib | talib/test_data.py | 5 | 16297 |
from __future__ import print_function
import numpy as np
from nose.tools import assert_equal, assert_not_equal, assert_true
ford_2012_dates = np.asarray([ 20120103, 20120104, 20120105, 20120106, 20120109,
20120110, 20120111, 20120112, 20120113, 20120117, 20120118, 20120119,
20120120, 20120123, 20120124, 201... | bsd-2-clause |
docmeth02/CouchPotatoServer | libs/html5lib/treewalkers/genshistream.py | 1730 | 2278 | from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName
from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT
from genshi.core import START_NS, END_NS, START_CDATA, END_CDATA, PI, COMMENT
from . import _base
from ..constants import voidElements, namespaces
class ... | gpl-3.0 |
brunogamacatao/portalsaladeaula | mediagenerator/filters/i18n.py | 2 | 2150 | from django.conf import settings
from django.http import HttpRequest
from django.utils.encoding import smart_str
from django.views.i18n import javascript_catalog
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
if settings.USE_I18N:
LANGUAGES = [code for code, _ in setting... | bsd-3-clause |
LIMXTEC/BitSend | contrib/linearize/linearize-hashes.py | 3 | 3974 | #!/usr/bin/env python3
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2016 The Bitsend Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ impo... | mit |
WhySoGeeky/DroidPot | venv/lib/python2.7/site-packages/sphinx/builders/devhelp.py | 4 | 4119 | # -*- coding: utf-8 -*-
"""
sphinx.builders.devhelp
~~~~~~~~~~~~~~~~~~~~~~~
Build HTML documentation and Devhelp_ support files.
.. _Devhelp: http://live.gnome.org/devhelp
:copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __futur... | mit |
pv/scikit-learn | sklearn/svm/base.py | 156 | 36018 | from __future__ import print_function
import numpy as np
import scipy.sparse as sp
import warnings
from abc import ABCMeta, abstractmethod
from . import libsvm, liblinear
from . import libsvm_sparse
from ..base import BaseEstimator, ClassifierMixin, ChangedBehaviorWarning
from ..preprocessing import LabelEncoder
from... | bsd-3-clause |
rogerhu/django | django/contrib/admin/validation.py | 3 | 23723 | from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.forms.models import BaseModelForm, BaseModelFormSet, _get_foreign_key
from django.contrib.admin.utils import get_fields_from_path, NotRelationField
"""
Does basic Model... | bsd-3-clause |
damdam-s/account-invoicing | __unported__/account_invoice_customer_ref_unique/__openerp__.py | 30 | 1749 | # -*- encoding: utf-8 -*-
# #############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it ... | agpl-3.0 |
mancoast/CPythonPyc_test | cpython/270_script_helper.py | 3 | 4045 | # Common utility functions used by various script execution tests
# e.g. test_cmd_line, test_cmd_line_script and test_runpy
import sys
import os
import os.path
import tempfile
import subprocess
import py_compile
import contextlib
import shutil
import zipfile
# Executing the interpreter in a subprocess
def python_exi... | gpl-3.0 |
jorik041/Veil-Evasion | modules/payloads/ruby/meterpreter/rev_tcp.py | 4 | 2456 | """
Custom-written pure ruby meterpreter/reverse_tcp stager.
TODO: better randomization
Module built by @harmj0y
"""
from modules.common import shellcode
from modules.common import helpers
class Payload:
def __init__(self):
# required options
self.description = "pure windows/meterpreter/... | gpl-3.0 |
ThomasMcVay/MediaApp | MediaAppKnobs/IntKnob.py | 1 | 1958 | #===============================================================================
# @Author: Madison Aster
# @ModuleDescription:
# @License:
# MediaApp Library - Python Package framework for developing robust Media
# Applications with Qt Library
# Copyright (C) 2013 Madison Aster
# ... | lgpl-2.1 |
josepht/snapcraft | snapcraft/tests/states/test_pull.py | 7 | 3875 | # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 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 h... | gpl-3.0 |
ownport/ansiblite | src/jinja2/constants.py | 220 | 1626 | # -*- coding: utf-8 -*-
"""
jinja.constants
~~~~~~~~~~~~~~~
Various constants.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
#: list of lorem ipsum words used by the lipsum() helper function
LOREM_IPSUM_WORDS = u'''\
a ac accumsan ad adipiscing aenean a... | gpl-3.0 |
2014c2g12/c2g12 | wsgi/w2/static/Brython2.0.0-20140209-164925/Lib/ui/slider.py | 111 | 2275 | import widget
from browser import doc,html
class Slider(widget.Widget):
def __init__(self, id=None, label=False):
self._div_shell=html.DIV(Class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all")
widget.Widget.__init__(self, self._div_shell, 'slider', id)
self._handle=h... | gpl-2.0 |
leeping/mdtraj | mdtraj/utils/unit/__init__.py | 12 | 6902 | ##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# Authors: Robert McGibbon
# Contributors:
#
# MDTraj is free software: y... | lgpl-2.1 |
virtualopensystems/neutron | neutron/tests/unit/nec/test_agent_scheduler.py | 5 | 4501 | # Copyright 2013 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 |
Suninus/portia | slyd/tests/test_repoman.py | 14 | 9855 | import unittest
from tempfile import mkdtemp
from os.path import join
from shutil import rmtree
from json import dumps, loads
import copy
from .settings import SPEC_DATA_DIR
from slyd.gitstorage.repoman import Repoman
def j(json):
return dumps(json, sort_keys=True, indent=4)
class RepomanTest(unittest.TestCas... | bsd-3-clause |
lmajewski/linux-samsung-thermal | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
GNS3/gns3-legacy | src/GNS3/Ui/ConfigurationPages/Form_PIXPage.py | 3 | 8636 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './ConfigurationPages/Form_PIXPage.ui'
#
# Created: Mon Sep 9 21:29:23 2013
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QStri... | gpl-2.0 |
isaac-philip/loolu | common/django/utils/html.py | 116 | 7418 | """HTML utilities suitable for global use."""
import re
import string
from django.utils.safestring import SafeData, mark_safe
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.http import urlquote
# Configuration for urlize() function.
LEADING_PUNCTUATIO... | mit |
mdornseif/huTools | huTools/http/poster_encode.py | 1 | 11992 | """multipart/form-data encoding module
This module provides functions that faciliate encoding name/value pairs
as multipart/form-data suitable for a HTTP POST or PUT request.
multipart/form-data is the standard way to upload files over HTTP"""
__all__ = ['gen_boundary', 'encode_and_quote', 'MultipartParam',
... | bsd-3-clause |
alexgorban/models | research/object_detection/predictors/rfcn_box_predictor_test.py | 3 | 2917 | # 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 |
dims/neutron | neutron/tests/api/admin/test_shared_network_extension.py | 1 | 19631 | # Copyright 2015 Hewlett-Packard Development Company, L.P.dsvsv
# Copyright 2015 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | apache-2.0 |
piotrgiedziun/university | advanced_databases/lab2/populate.py | 1 | 2042 | #!/usr/bin/python
import MySQLdb
import random
from datetime import datetime as dt, timedelta
# MySQL format
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="sakila")
cur = db.cursor()
print "connected"
# truncate old data
cur.execute("SET FOREIGN_KEY_CHECKS = 0... | mit |
cdepman/falcon_api | site-packages/pip/compat/ordereddict.py | 141 | 4110 | # Copyright (c) 2009 Raymond Hettinger
#
# 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, merge,
# publish,... | mit |
lancezlin/ml_template_py | lib/python2.7/site-packages/jupyter_client/manager.py | 6 | 15569 | """Base class to manage a running kernel"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import absolute_import
from contextlib import contextmanager
import os
import re
import signal
import sys
import time
import warnings
try:
from queue im... | mit |
rschnapka/odoo | addons/l10n_th/__init__.py | 893 | 1045 | # -*- 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 |
FNST-OpenStack/horizon | openstack_dashboard/test/integration_tests/basewebobject.py | 15 | 3946 | # 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 |
galgeek/firefox-ui-tests | firefox_puppeteer/api/places.py | 3 | 5870 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from collections import namedtuple
from marionette_driver.errors import MarionetteException, TimeoutException
from ..b... | mpl-2.0 |
lucafavatella/intellij-community | python/helpers/profiler/thrift/transport/TSSLSocket.py | 9 | 7756 | #
# 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 |
iut-ibk/DynaMind-UrbanSim | 3rdparty/opus/src/urbansim/configs/hlcm_estimation_config.py | 2 | 1304 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.configs.estimation_base_config import run_configuration as config
from urbansim.configs.base_configuration import AbstractUrbansimConfiguration
from urbansim.configs.estimation_base... | gpl-2.0 |
EricNeedham/assignment-1 | venv/lib/python2.7/site-packages/setuptools/tests/environment.py | 359 | 4658 | import os
import zipfile
import sys
import tempfile
import unittest
import shutil
import stat
import unicodedata
from subprocess import Popen as _Popen, PIPE as _PIPE
def _extract(self, member, path=None, pwd=None):
"""for zipfile py2.5 borrowed from cpython"""
if not isinstance(member, zipfile.ZipInfo):
... | mit |
fisadev/chivalry-server-tools | server_runner.py | 1 | 3556 | # coding: utf-8
from datetime import datetime
from os import popen, system, startfile
from time import sleep
import requests
from pyquery import PyQuery
# web listing active servers
SERVER_STATUS_URL = 'http://refactor.jp/chivalry/?country=AR'
# if this text is present, the server is up
SERVER_NAME = 'Argentina | Ro... | mit |
mathi123/vertical-construction | base_construction_architect/__openerp__.py | 1 | 1348 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Mathias Colpaert
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Found... | agpl-3.0 |
BBN-Q/PyQLab | ExpSettingsVal.py | 3 | 13830 | '''
ExpSettingsVal -
Validates Experimental Settings against a set of rules known to cause
the Compiler (Compiler.py) to fail if they are not followed
Created on April 17, 2015
Original Author: Brian Donovan
Copyright 2015 Raytheon BBN Technologies
Licensed under the Apache License, Version 2.0 (the "License");
you... | apache-2.0 |
xpansa/pmis | project_time_schedule/models/dijkstra.py | 1 | 3303 | # Dijkstra's algorithm for shortest paths
# David Eppstein, UC Irvine, 4 April 2002
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117228
from priodict import priorityDictionary
def Dijkstra(G, start, end=None):
"""
Find shortest paths from the start vertex to all
vertices nearer than or equal... | agpl-3.0 |
zorojean/scikit-learn | examples/svm/plot_oneclass.py | 249 | 2302 | """
==========================================
One-class SVM with non-linear kernel (RBF)
==========================================
An example using a one-class SVM for novelty detection.
:ref:`One-class SVM <svm_outlier_detection>` is an unsupervised
algorithm that learns a decision function for novelty detection:
... | bsd-3-clause |
ofermend/medicare-demo | socialite/jython/Lib/colorsys.py | 92 | 3449 | """Conversion functions between RGB and other color systems.
This modules provides two functions for each color system ABC:
rgb_to_abc(r, g, b) --> a, b, c
abc_to_rgb(a, b, c) --> r, g, b
All inputs and outputs are triples of floats in the range [0.0...1.0]
(with the exception of I and Q, which covers a slightly... | apache-2.0 |
dan1/horizon-x509 | openstack_dashboard/dashboards/project/overview/tests.py | 8 | 15122 | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# 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... | apache-2.0 |
benschmaus/catapult | third_party/google-endpoints/Crypto/SelfTest/Random/OSRNG/test_posix.py | 131 | 1777 | # -*- coding: utf-8 -*-
#
# SelfTest/Util/test_posix.py: Self-test for the OSRNG.posix.new() function
#
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent ... | bsd-3-clause |
fesh0r/pjp | pjp/attribute/attrib_annotations.py | 1 | 7969 | from .attrib_base import AttributeBase, AttributeLengthError
from ..constantpool import ConstantType
__all__ = ['AttributeRuntimeVisibleAnnotations', 'AttributeRuntimeInvisibleAnnotations',
'AttributeRuntimeVisibleParameterAnnotations', 'AttributeRuntimeInvisibleParameterAnnotations',
'Attribute... | mit |
josiasjuniorx/consulta-dominio | dominio/views.py | 1 | 1320 | from .whois import *
import verifica_site
from django.shortcuts import render
import os
import logging
from django.http import HttpResponse, HttpRequest, HttpResponseRedirect
from django.urls import reverse
logger = logging.getLogger("CONSULTAS")
logger.setLevel(logging.INFO)
handler = logging.FileHandler('static/log... | gpl-3.0 |
dpinney/omf | omf/scratch/Neural_Net_Experimentation/deleted models/forecastStoragePeakShave.py | 1 | 7466 | ''' Apply PNNL VirtualBatteries (VBAT) load model to day ahead forecast.'''
import pandas as pd
import numpy as np
from sklearn import linear_model
import pulp
from os.path import isdir, join as pJoin
import __neoMetaModel__
from __neoMetaModel__ import *
from omf import forecast as fc
# Model metadata:
modelName, tem... | gpl-2.0 |
GitHublong/hue | desktop/core/ext-py/boto-2.38.0/boto/rds/vpcsecuritygroupmembership.py | 177 | 3131 | # Copyright (c) 2013 Anthony Tonns http://www.corsis.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... | apache-2.0 |
Menooker/gem5_pcm | src/python/m5/util/orderdict.py | 88 | 2718 | # Copyright (c) 2005 The Regents of The University of Michigan
# 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 ... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.