repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
cpennington/edx-platform | cms/djangoapps/contentstore/views/tests/test_organizations.py | 3 | 1551 | """Tests covering the Organizations listing on the Studio home."""
import json
from django.test import TestCase
from django.urls import reverse
from mock import patch
from student.tests.factories import UserFactory
from util.organizations_helpers import add_organization
@patch.dict('django.conf.settings.FEATURES'... | agpl-3.0 |
JarbasAI/jarbas-core | mycroft/jarbas-skills/skill_roll_dice/__init__.py | 1 | 1300 | from os.path import dirname
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
from mycroft.util.log import getLogger
import random
__author__ = 'paul'
LOGGER = getLogger(__name__)
class RollDiceSkill(MycroftSkill):
def __init__(self):
super(RollDiceSkill, self).__init... | gpl-3.0 |
adamhaapala/pythoscope | pythoscope/compat.py | 2 | 2143 | """Portability code for different Python versions and platforms.
"""
import os
import warnings
try:
all = all
except NameError:
def all(iterable):
for element in iterable:
if not element:
return False
return True
try:
any = any
except NameError:
def any(it... | mit |
chongtianfeiyu/kbengine | kbe/src/lib/python/Lib/test/test_plistlib.py | 78 | 21012 | # Copyright (C) 2003-2013 Python Software Foundation
import unittest
import plistlib
import os
import datetime
import codecs
import binascii
import collections
import struct
from test import support
from io import BytesIO
ALL_FORMATS=(plistlib.FMT_XML, plistlib.FMT_BINARY)
# The testdata is generated using Mac/Tools... | lgpl-3.0 |
yezorat/redis-xslock | redis_xslock/scripts.py | 2 | 4987 | # coding: utf-8
__author__ = 'Junki Ishida'
from hashlib import sha1
from redis.exceptions import NoScriptError
class RedisScript:
def __init__(self, script, numkeys=1, usesha=True):
self.script = script.encode() if isinstance(script, str) else script
self.hash = sha1(self.script).hexdigest()
... | mit |
RiskSense-Ops/CVE-2016-6366 | extrabacon-2.0/versions/shellcode_asa843.py | 2 | 4530 | #
# this file autogenerated, do not touch
#
vers = "asa843"
my_ret_addr_len = 4
my_ret_addr_byte = "\xc8\x26\xa0\x09"
my_ret_addr_snmp = "200.38.160.9"
finder_len = 9
finder_byte = "\x8b\x7c\x24\x14\x8b\x07\xff\xe0\x90"
finder_snmp = "139.124.36.20.139.7.255.224.144"
preamble_len = 41
preamble_byte = "\xb8\... | mit |
av8ramit/tensorflow | tensorflow/python/kernel_tests/resource_variable_ops_test.py | 2 | 23511 | # 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 |
Stryn/citationhunt | scripts/assign_categories.py | 2 | 9758 | #!/usr/bin/env python
'''
Assign categories to the pages in the CitationHunt database.
Usage:
assign_categories.py [--mysql_config=<FILE>]
Options:
--mysql_config=<FILE> MySQL config file [default: ./ch.my.cnf].
'''
from __future__ import unicode_literals
import os
import sys
_upper_dir = os.path.abspath(... | mit |
vivekanand1101/neutron | neutron/tests/tempest/common/custom_matchers.py | 55 | 8859 | # Copyright 2013 NTT Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 |
mapr/hue | desktop/core/ext-py/pysaml2-2.4.0/src/saml2/attribute_resolver.py | 32 | 1673 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Contains classes and functions that a SAML2.0 Service Provider (SP) may use
to do attribute aggregation.
"""
import logging
#from saml2 import client
from saml2 import BINDING_SOAP
logger = logging.getLogger(__name__)
DEFAULT_BINDING = BINDING_SOAP
class Attribute... | apache-2.0 |
kidburglar/youtube-dl | youtube_dl/extractor/tv2hu.py | 56 | 2411 | # encoding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class TV2HuIE(InfoExtractor):
IE_NAME = 'tv2.hu'
_VALID_URL = r'https?://(?:www\.)?tv2\.hu/(?:[^/]+/)+(?P<id>\d+)_[^/?#]+?\.html'
_TESTS = [{
'url': 'http://tv2.hu/ezek_mego... | unlicense |
stutivarshney/Bal-Aveksha | WebServer/BalAvekshaEnv/lib/python3.5/site-packages/setuptools/command/easy_install.py | 49 | 85933 | #!/usr/bin/env python
"""
Easy Install
------------
A tool for doing automatic download/extract/build of distutils-based Python
packages. For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.
__ https://setuptools.readthedocs.io/en/latest/easy_install.html
""... | gpl-3.0 |
karimbahgat/PythonGis | pythongis/vector/saver.py | 1 | 6720 |
# import builtins
import itertools
import math
# import fileformats
import shapefile as pyshp
import pygeoj
# PY3 fix
try:
str = unicode # in py2, make str synonymous with str
zip = itertools.izip
except:
pass
NaN = float("nan")
def is_missing(value):
return value in (None,"") or (isinstance(val... | mit |
Ted1993/Flasky | venv/lib/python2.7/site-packages/sqlalchemy/util/compat.py | 70 | 6809 | # util/compat.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Handle Python version/platform incompatibilities."""
import sys
try:
import ... | mit |
skycucumber/xuemc | python/venv/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py | 484 | 10037 | from binascii import hexlify, unhexlify
from hashlib import md5, sha1, sha256
from ..exceptions import SSLError, InsecurePlatformWarning
SSLContext = None
HAS_SNI = False
create_default_context = None
import errno
import warnings
try: # Test for SSL features
import ssl
from ssl import wrap_socket, CERT_NO... | gpl-2.0 |
jmehnle/ansible | lib/ansible/modules/cloud/openstack/os_object.py | 49 | 4420 | #!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
#
# This module 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 vers... | gpl-3.0 |
shsingh/ansible | test/units/modules/network/f5/test_bigiq_application_http.py | 21 | 8222 | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2... | gpl-3.0 |
netsamir/dotfiles | files/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/python-future/src/libpasteurize/fixes/fix_metaclass.py | 61 | 3268 | u"""
Fixer for (metaclass=X) -> __metaclass__ = X
Some semantics (see PEP 3115) may be altered in the translation."""
from lib2to3 import fixer_base
from lib2to3.fixer_util import Name, syms, Node, Leaf, Newline, find_root
from lib2to3.pygram import token
from libfuturize.fixer_util import indentation, suitify
# from ... | unlicense |
HydrelioxGitHub/home-assistant | tests/components/sensor/test_geo_rss_events.py | 4 | 6774 | """The test for the geo rss events sensor platform."""
import unittest
from unittest import mock
from unittest.mock import MagicMock, patch
from homeassistant.components import sensor
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, ATTR_FRIENDLY_NAME, \
EVENT_HOMEASSISTANT_START, ATTR_ICON
from homeassis... | apache-2.0 |
ereOn/azmq | azmq/mechanisms/plain_server.py | 1 | 2073 | """
The PLAIN server mechanism.
"""
from ..log import logger
from .base import Mechanism
class PlainServer(object):
def __call__(self):
return PlainServerMechanism()
class PlainServerMechanism(Mechanism):
name = b'PLAIN'
as_server = True
@classmethod
async def _read_plain_hello(cls, r... | gpl-3.0 |
RasaHQ/rasa_nlu | rasa/nlu/featurizers/regex_featurizer.py | 1 | 5392 | import io
import logging
import numpy as np
import os
import re
import typing
from typing import Any, Dict, Optional, Text
from rasa.nlu import utils
from rasa.nlu.config import RasaNLUModelConfig
from rasa.nlu.featurizers import Featurizer
from rasa.nlu.training_data import Message, TrainingData
logger = logging.get... | apache-2.0 |
ZHAW-INES/rioxo-uClinux-dist | user/python/python-2.4.4/Lib/plat-unixware7/STROPTS.py | 78 | 6464 | # Generated by h2py from /usr/include/sys/stropts.h
# Included from sys/types.h
def quad_low(x): return x.val[0]
ADT_EMASKSIZE = 8
SHRT_MIN = -32768
SHRT_MAX = 32767
INT_MIN = (-2147483647-1)
INT_MAX = 2147483647
LONG_MIN = (-2147483647-1)
LONG_MAX = 2147483647
OFF32_MAX = LONG_MAX
ISTAT_ASSERTED = 0
ISTAT_ASSUMED = ... | gpl-2.0 |
xHeliotrope/injustice_dropper | env/lib/python3.4/site-packages/django/contrib/gis/geos/coordseq.py | 83 | 5462 | """
This module houses the GEOSCoordSeq object, which is used internally
by GEOSGeometry to house the actual coordinates of the Point,
LineString, and LinearRing geometries.
"""
from ctypes import byref, c_double, c_uint
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.base import... | mit |
mpare002/HackTech_2017 | env/Lib/site-packages/pip/utils/logging.py | 31 | 3359 | from __future__ import absolute_import
import contextlib
import logging
import logging.handlers
import os
try:
import threading
except ImportError:
import dummy_threading as threading
from pip.compat import WINDOWS
try:
from pip._vendor import colorama
# Lots of different errors can come from this, incl... | mit |
javierder/dogestart.me | core/migrations/0001_initial.py | 1 | 11514 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Tag'
db.create_table(u'core_tag', (
(u'id', s... | mit |
dannyboi104/SickRage | tornado/test/auth_test.py | 60 | 18885 | # These tests do not currently do much to verify the correct implementation
# of the openid/oauth protocols, they just exercise the major code paths
# and ensure that it doesn't blow up (e.g. with unicode/bytes issues in
# python 3)
from __future__ import absolute_import, division, print_function, with_statement
from... | gpl-3.0 |
rharshit/android_kernel_mediatek_sprout | 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 |
mrooney/wxbanker | wxbanker/tests/currconverttests.py | 1 | 1752 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# https://launchpad.net/wxbanker
# currconverttests.py: Copyright 2007-2010 Mike Rooney <mrooney@ubuntu.com>
#
# This file is part of wxBanker.
#
# wxBanker is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public... | gpl-3.0 |
trondhindenes/ansible | lib/ansible/modules/cloud/azure/azure_rm_autoscale_facts.py | 26 | 9326 | #!/usr/bin/python
#
# Copyright (c) 2017 Yuwei Zhou, <yuwzho@microsoft.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
ruijie/quantum | quantum/plugins/rgos/common/config.py | 1 | 2220 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Ruijie network, 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-... | apache-2.0 |
anditto/bitcoin | test/functional/wallet_watchonly.py | 11 | 4698 | #!/usr/bin/env python3
# Copyright (c) 2018-2019 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 createwallet watchonly arguments.
"""
from test_framework.test_framework import BitcoinTestFramew... | mit |
armab/st2 | st2common/st2common/transport/__init__.py | 10 | 1213 | # 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 |
looselycoupled/xbus-501-timing-demonstrations | 1-example.py | 1 | 1744 | #!/usr/bin/env python
# 1-example
# A simple demonstration script to find the largest prime number
# below a given limit.
#
# This file is intentionally inefficient in order to demonstrate
# various ways to time execution
#
# Usage:
# time python 1-example.py 10000
#
# Author: Allen Leis <al1075@georgetown.edu>
# C... | mit |
CloudBoltSoftware/cloudbolt-forge | actions/cloudbolt_plugins/skeleton_order_approval_action/order_approval_skeleton.py | 1 | 1792 | import sys
import time
from orders.models import Order
"""
Plug-in example for an Orchestration Action at the "Order Approval" trigger
point. May change CloudBolt's default approval behavior to implement custom
logic or integrate with an external change management system.
The context passed to the plug-in includes t... | apache-2.0 |
kkreis/espressopp | src/analysis/AllParticlePos.py | 7 | 1433 | # Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of the G... | gpl-3.0 |
waltervh/BornAgain-tutorial | old/bornagain-python/iff/Lattice1D_decay.py | 2 | 2688 | import math
import random
from scipy.stats import norm
class Lattice1D_decay:
"""A class that represents a disordered one dimensional lattice with a decay function"""
def __init__(self, mean_separation, decay_length):
self.mean_separation = mean_separation
self.decay_length = decay_length
... | gpl-3.0 |
mikewiebe-ansible/ansible | lib/ansible/modules/network/f5/bigip_device_group_member.py | 38 | 8383 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
oihane/odoo | addons/report_webkit/header.py | 342 | 4626 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Nicolas Bessi (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who... | agpl-3.0 |
JosmanPS/scikit-learn | sklearn/neighbors/tests/test_nearest_centroid.py | 305 | 4121 | """
Testing for the nearest centroid module.
"""
import numpy as np
from scipy import sparse as sp
from numpy.testing import assert_array_equal
from numpy.testing import assert_equal
from sklearn.neighbors import NearestCentroid
from sklearn import datasets
from sklearn.metrics.pairwise import pairwise_distances
# t... | bsd-3-clause |
medworx/MedUX | medux/plugins/core/icontext.py | 1 | 2440 | #
# Copyright (C) 2013 Christian A. Reiter
#
# This file is part of MedUX.
#
# MedUX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | gpl-3.0 |
jvanasco/beaker | tests/test_syncdict.py | 3 | 1951 | from beaker.util import SyncDict, WeakValuedRegistry
import random, time, weakref
import threading
class Value(object):
values = {}
def do_something(self, id):
Value.values[id] = self
def stop_doing_something(self, id):
del Value.values[id]
mutex = threading.Lock()
def create(id):
a... | bsd-3-clause |
stefanseefeld/synopsis | Synopsis/Formatters/HTML/Parts/Inheritance.py | 1 | 3851 | #
# Copyright (C) 2000 Stephen Davies
# Copyright (C) 2000 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
from Synopsis.Processor import Parameter
from Synopsis import ASG
from Synopsis.Formatters.HTML.Part import Part
from S... | lgpl-2.1 |
frreiss/tensorflow-fred | tensorflow/python/profiler/profiler.py | 38 | 2043 | # 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 |
danakj/chromium | tools/cr/cr/base/arch.py | 113 | 1544 | # 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.
"""A module for the basic architectures supported by cr."""
import cr
DEFAULT = cr.Config.From(
CR_ENVSETUP_ARCH='{CR_ARCH}',
)
class Arch(cr.Plugin,... | bsd-3-clause |
ASOdesk/selenium-pytest-fix | py/docs/source/conf.py | 2 | 9330 | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 |
openmotics/gateway | src/platform_utils.py | 1 | 15704 | # Copyright (C) 2018 OpenMotics BV
#
# 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 Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribu... | agpl-3.0 |
pferreir/indico-backup | indico/web/http_api/auth.py | 1 | 4009 | # -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... | gpl-3.0 |
ingadhoc/account-invoicing | account_invoice_partial/wizards/account_invoice_partial_wizard.py | 1 | 1689 | ##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields
from odoo.tools import float_round
clas... | agpl-3.0 |
erdincay/youtube-dl | youtube_dl/extractor/helsinki.py | 165 | 1360 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import js_to_json
class HelsinkiIE(InfoExtractor):
IE_DESC = 'helsinki.fi'
_VALID_URL = r'https?://video\.helsinki\.fi/Arkisto/flash\.php\?id=(?P<id>\d+)'
_TEST = {
'url': 'http://video... | unlicense |
woodem/woo | scripts/test-OLD/peri3dController_triaxialCompression.py | 1 | 3506 | # peri3dController_triaxialCompression.py
# script, that explains funcionality and input parameters of Peri3dController on the example of
# triaxial compression.
# Firstly, a hydrostatic preassure is applied, then a strain along z axis is increasing
# while x- and y- stress is constant
# The simulation is run on ro... | gpl-2.0 |
argilo/gr-osmosdr | docs/doxygen/doxyxml/generated/compoundsuper.py | 23 | 360037 | #!/usr/bin/env python
#
# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
#
from __future__ import print_function
from __future__ import unicode_literals
import sys
from xml.dom import minidom
from xml.dom import Node
import six
#
# User methods
#
# Calls to the methods in these classes are generated by gen... | gpl-3.0 |
knyghty/knyg.ht | pages/tests.py | 1 | 1192 | from django.core.urlresolvers import reverse
from django.test import TestCase
from .models import Page
class PageTests(TestCase):
def test_404(self):
response = self.client.get('/')
self.assertEqual(response.status_code, 404)
def test_home(self):
Page.objects.create(
url=... | bsd-2-clause |
israelbenatar/boto | tests/integration/mws/test.py | 114 | 4682 | #!/usr/bin/env python
from __future__ import print_function
import sys
import os
import os.path
from datetime import datetime, timedelta
simple = os.environ.get('MWS_MERCHANT', None)
if not simple:
print("""
Please set the MWS_MERCHANT environmental variable
to your Merchant or SellerId to enable ... | mit |
nmrugg/youtube-dl | youtube_dl/extractor/myvideo.py | 87 | 6273 | from __future__ import unicode_literals
import binascii
import base64
import hashlib
import re
import json
from .common import InfoExtractor
from ..compat import (
compat_ord,
compat_urllib_parse,
compat_urllib_parse_unquote,
compat_urllib_request,
)
from ..utils import (
ExtractorError,
)
class... | unlicense |
ryanahall/django | tests/gis_tests/layermap/models.py | 31 | 2314 | from django.contrib.gis.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=25)
objects = models.GeoManager()
class Meta:
abstract = True
def __str__(self):
ret... | bsd-3-clause |
kartoza/geonode | geonode/contrib/api_basemaps/thunderforest.py | 8 | 2781 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | gpl-3.0 |
jhawkesworth/ansible | lib/ansible/modules/network/cloudengine/ce_mlag_config.py | 27 | 33394 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | gpl-3.0 |
opsdisk/pyrax | samples/cloud_databases/delete_instance.py | 13 | 1697 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c)2012 Rackspace US, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.ap... | apache-2.0 |
SysTheron/adhocracy | src/adhocracy/lib/treatment.py | 5 | 2007 | import itertools
import random
def _iter_assignments_by_source_badge(treatment):
assigned_ids = [set(u.id for u in aul)
for aul in treatment.get_assigned_users()]
for b in treatment.source_badges:
current_assignment = [[] for i in range(len(assigned_ids))]
unassigned = []
... | agpl-3.0 |
thaim/ansible | lib/ansible/modules/cloud/amazon/iam_group.py | 5 | 15613 | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | mit |
Itxaka/st2 | contrib/packs/actions/pack_mgmt/virtualenv_setup_prerun.py | 6 | 1231 | # 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 |
archf/ansible | lib/ansible/modules/cloud/ovirt/ovirt_hosts.py | 22 | 21713 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (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
#... | gpl-3.0 |
egyp7/barf-project | barf/barf/core/smt/smttranslator.py | 5 | 25855 | # Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... | bsd-2-clause |
jose36/jmdl3 | servers/jumbofiles.py | 44 | 2439 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para jumbofiles
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core i... | gpl-2.0 |
TAMU-CPT/galaxy-tools | tools/gff3/gff3.py | 1 | 11156 | import copy
import logging
log = logging.getLogger()
log.setLevel(logging.WARN)
def feature_lambda(
feature_list,
test,
test_kwargs,
subfeatures=True,
parent=None,
invert=False,
recurse=True,
):
"""Recursively search through features, testing each with a test function, yielding matche... | gpl-3.0 |
omazapa/root | tutorials/pyroot/fit1.py | 10 | 1272 | #
# To see the output of this macro, click begin_html <a href="gif/fit1.gif">here</a>. end_html
#
from os import path
from ROOT import TCanvas, TFile, TPaveText
from ROOT import gROOT, gBenchmark
c1 = TCanvas( 'c1', 'The Fit Canvas', 200, 10, 700, 500 )
c1.SetGridx()
c1.SetGridy()
c1.GetFrame().SetFillColor( 21 )
c1.G... | lgpl-2.1 |
barrysteyn/pelican-plugins | related_posts/related_posts.py | 38 | 1929 | """
Related posts plugin for Pelican
================================
Adds related_posts variable to article's context
"""
from pelican import signals
from collections import Counter
from itertools import chain
def add_related_posts(generator):
# get the max number of entries from settings
# or fall back to... | agpl-3.0 |
tntnatbry/tensorflow | tensorflow/contrib/learn/python/learn/dataframe/transforms/in_memory_source.py | 82 | 6157 | # 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 |
jjkoletar/panda3d | direct/src/plugin_installer/make_xpi.py | 12 | 7307 | #! /usr/bin/env python
import os
import sys
import shutil
import platform
import tempfile
import zipfile
from optparse import OptionParser
import subprocess
try:
from hashlib import sha1 as sha
except ImportError:
from sha import sha
usage = """
This command creates a Firefox XPI installer for the Panda3D Fi... | bsd-3-clause |
bodzie/talentum | external/gtest/test/gtest_filter_unittest.py | 2826 | 21261 | #!/usr/bin/env python
#
# Copyright 2005 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... | lgpl-3.0 |
iphoting/healthchecks | hc/front/tests/test_add_sms.py | 1 | 3660 | from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(TWILIO_ACCOUNT="foo", TWILIO_AUTH="foo", TWILIO_FROM="123")
class AddSmsTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.url = "/projects/%s/add_sms/" ... | bsd-3-clause |
kevinbenton/stackalytics | dashboard/vault.py | 2 | 6263 | # Copyright (c) 2013 Mirantis 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... | apache-2.0 |
sosguns2002/interactive-mining | interactive-mining-3rdparty-madis/madis/src/lib/fastavro/__main__.py | 5 | 1943 | import fastavro as avro
from fastavro.six import json_dump
from sys import stdout
encoding = stdout.encoding or "UTF-8"
def main(argv=None):
import sys
from argparse import ArgumentParser
argv = argv or sys.argv
parser = ArgumentParser(
description='iter over avro file, emit records as JSON... | gpl-3.0 |
julian-seward1/servo | tests/wpt/css-tests/tools/serve/serve.py | 60 | 23188 | # -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import json
import os
import re
import socket
import sys
import threading
import time
import traceback
import urllib2
import uuid
from collections import defaultdict, OrderedDict
from multiprocessing import Process, Event
from ..localpaths... | mpl-2.0 |
irwinlove/scrapy | tests/test_downloadermiddleware_downloadtimeout.py | 136 | 1706 | import unittest
from scrapy.downloadermiddlewares.downloadtimeout import DownloadTimeoutMiddleware
from scrapy.spiders import Spider
from scrapy.http import Request
from scrapy.utils.test import get_crawler
class DownloadTimeoutMiddlewareTest(unittest.TestCase):
def get_request_spider_mw(self, settings=None):
... | bsd-3-clause |
alzamer2/crunchy-xml-decoder | crunchy-xml-decoder-old/crunchy-xml-decoder/requests/packages/urllib3/contrib/pyopenssl.py | 65 | 9289 | '''SSL with SNI_-support for Python 2. Follow these instructions if you would
like to verify SSL certificates in Python 2. Note, the default libraries do
*not* do certificate checking; you need to do additional work to validate
certificates yourself.
This needs the following packages installed:
* pyOpenSSL (tested wi... | gpl-2.0 |
kr41/ggrc-core | test/selenium/src/tests/test_object_mapping.py | 6 | 2482 | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Tests relevant to object mapping"""
# pylint: disable=no-self-use
# pylint: disable=invalid-name
# pylint: disable=too-few-public-methods
# pylint: disable=unused-argument
import pytest # pylint: disa... | apache-2.0 |
yatmingyatming/LogisticRegressionSGDMapReduce | model_encoder.py | 1 | 1040 | #!/usr/bin/env python
import sys, json, datetime, uuid, os
def main(separator='\t'):
id = str(uuid.uuid1())
date_created = datetime.datetime.utcnow().isoformat() + 'Z'
mu = float(os.environ['MU']) if os.environ.has_key('MU') else 0.002
eta = float(os.environ['ETA']) if os.environ.has_key('ETA') else... | mit |
ksmit799/Toontown-Source | toontown/coghq/LawbotOfficeBoilerRoom_Security00.py | 6 | 17432 | from toontown.coghq.SpecImports import *
GlobalEntities = {1000: {'type': 'levelMgr',
'name': 'LevelMgr',
'comment': '',
'parentEntId': 0,
'cogLevel': 0,
'farPlaneDistance': 1500,
'modelFilename': 'phase_11/models/lawbotHQ/LB_Zone08a',
'wantDoors': 1},
1001: {'ty... | mit |
ds-hwang/chromium-crosswalk | tools/findit/findit_for_crash.py | 48 | 24500 | # Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from threading import Lock
import blame
from common import utils
import component_dictionary
import crash_utils
import git_repository_parser
i... | bsd-3-clause |
shakamunyi/sahara | sahara/conductor/manager.py | 1 | 32113 | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 |
delinhabit/django | tests/template_tests/syntax_tests/test_i18n.py | 68 | 22883 | # coding: utf-8
from __future__ import unicode_literals
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from django.utils import translation
from django.utils.safestring import mark_safe
from ..utils import setup
class I18nTagTests(SimpleTestCase):
libraries = {
'c... | bsd-3-clause |
DNFcode/edx-platform | common/djangoapps/enrollment/serializers.py | 4 | 2833 | """
Serializers for all Course Enrollment related return objects.
"""
from rest_framework import serializers
from student.models import CourseEnrollment
from course_modes.models import CourseMode
class StringListField(serializers.CharField):
"""Custom Serializer for turning a comma delimited string into a list.
... | agpl-3.0 |
MSeifert04/astropy | astropy/utils/exceptions.py | 3 | 2543 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains errors/exceptions and warnings of general use for
astropy. Exceptions that are specific to a given subpackage should *not* be
here, but rather in the particular subpackage. Exception is the _erfa module
as we rather have the users ... | bsd-3-clause |
gillett-hernandez/project-euler | Python/problem_192.py | 1 | 9573 | # -*- coding: utf-8 -*-
# @Author: Gillett Hernandez
# @Date: 2017-12-11 19:30:19
# @Last Modified by: Gillett Hernandez
# @Last Modified time: 2017-12-16 17:49:47
from euler_funcs import ContinuedFraction, solve_pell, analyze_triplets, sconvergents, lag, is_square, timed
from euler_funcs import timed, construct, ... | mit |
vokimon/menjobe | menjobe/models.py | 1 | 1180 | from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
class Product(MPTTModel) :
name = models.CharField(
max_length=200,
default=None,
unique=True,
)
group = TreeForeignKey('self',
null=True,
blank=True,
related_name='subgroups',
default=None,
)
class MPTTMeta:
pare... | agpl-3.0 |
rue89-tech/edx-platform | cms/djangoapps/contentstore/features/problem-editor.py | 116 | 12757 | # disable missing docstring
# pylint: disable=missing-docstring
import json
from lettuce import world, step
from nose.tools import assert_equal, assert_true # pylint: disable=no-name-in-module
from common import type_in_codemirror, open_new_course
from advanced_settings import change_value, ADVANCED_MODULES_KEY
from ... | agpl-3.0 |
jlegendary/nupic | tests/integration/nupic/opf/opf_checkpoint_test/experiments/temporal_multi_step/a/description.py | 12 | 2103 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2011-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | gpl-3.0 |
alexanderdreyer/polybori-debian | pyroot/polybori/gbcore.py | 1 | 19759 | from polybori.nf import *
from polybori.PyPolyBoRi import *
from polybori.ll import eliminate, ll_encode
from time import time
from copy import copy
from itertools import chain
from inspect import getargspec
from polybori.statistics import used_vars, used_vars_set
from polybori.heuristics import dense_system,gauss_on_... | gpl-2.0 |
Tatsh/youtube-dl | youtube_dl/extractor/toypics.py | 50 | 2746 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
import re
class ToypicsIE(InfoExtractor):
IE_DESC = 'Toypics video'
_VALID_URL = r'https?://videos\.toypics\.net/view/(?P<id>[0-9]+)'
_TEST = {
'url': 'http://videos.toypics.net/view/514/chancebulged,-2-1/',... | unlicense |
cloud9ers/gurumate | environment/lib/python2.7/site-packages/IPython/utils/tests/test_traitlets.py | 3 | 24538 | # encoding: utf-8
"""
Tests for IPython.utils.traitlets.
Authors:
* Brian Granger
* Enthought, Inc. Some of the code in this file comes from enthought.traits
and is licensed under the BSD license. Also, many of the ideas also come
from enthought.traits even though our implementation is very different.
"""
#---... | lgpl-3.0 |
NAMD/mediacloud | justice/lib/test_helpers.py | 2 | 9636 | '''
Common helper utilities for testing.
'''
import webapp2
import re
from webapp2_extras import auth
from justice import models
class HandlerHelpers():
def get(self, *args, **kwargs):
"""Wrap webtest get with nicer defaults"""
if 'headers' not in kwargs:
kwargs['headers'] = self.hea... | lgpl-3.0 |
actuaryzhang/spark | python/pyspark/ml/fpm.py | 12 | 12971 | #
# 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 us... | apache-2.0 |
teltek/edx-platform | lms/djangoapps/courseware/tests/test_microsites.py | 4 | 14566 | """
Tests related to the Site Configuration feature
"""
from bs4 import BeautifulSoup
from contextlib import contextmanager
from django.conf import settings
from django.urls import reverse
from django.test.utils import override_settings
from mock import patch
from six import text_type
from course_modes.models import ... | agpl-3.0 |
LIKAIMO/MissionPlanner | Lib/encodings/mac_roman.py | 93 | 14043 | """ Python Character Mapping Codec mac_roman generated from 'MAPPINGS/VENDORS/APPLE/ROMAN.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(s... | gpl-3.0 |
fast90/youtube-dl | setup.py | 11 | 4030 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os.path
import warnings
import sys
try:
from setuptools import setup, Command
setuptools_available = True
except ImportError:
from distutils.core import setup, Command
setuptools_available = False
from distutil... | unlicense |
hilaskis/ardupilot_GVSU | Tools/autotest/param_metadata/param_parse.py | 126 | 5555 | #!/usr/bin/env python
import os, glob, re, sys
from param import *
from wikiemit import WikiEmit
from xmlemit import XmlEmit
from htmlemit import HtmlEmit
from optparse import OptionParser
parser = OptionParser("param_parse.py [options]")
parser.add_option("-v", "--verbose", dest='verbose', action='store_true', defa... | gpl-3.0 |
carlos4/android_kernel_samsung_d2spr | tools/perf/scripts/python/netdev-times.py | 11271 | 15048 | # Display a process of packets and processed time.
# It helps us to investigate networking or network device.
#
# options
# tx: show only tx chart
# rx: show only rx chart
# dev=: show only thing related to specified device
# debug: work with debug mode. It shows buffer status.
import os
import sys
sys.path.append(os... | gpl-2.0 |
TRox1972/youtube-dl | youtube_dl/extractor/lifenews.py | 7 | 9620 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
determine_ext,
ExtractorError,
int_or_none,
parse_iso8601,
remove_end,
)
class LifeNewsIE(InfoExtractor):
IE... | unlicense |
jspargo/AneMo | thermo/flask/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/optionaltags.py | 1727 | 10500 | from __future__ import absolute_import, division, unicode_literals
from . import _base
class Filter(_base.Filter):
def slider(self):
previous1 = previous2 = None
for token in self.source:
if previous1 is not None:
yield previous2, previous1, token
previous2... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.