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 |
|---|---|---|---|---|---|
svn2github/gyp | pylib/gyp/generator/ninja_test.py | 1843 | 1786 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Unit tests for the ninja.py file. """
import gyp.generator.ninja as ninja
import unittest
import StringIO
import sys
import TestCommon
... | bsd-3-clause |
stuntman723/rap-analyzer | rap_analyzer/lib/python2.7/site-packages/django/contrib/gis/db/models/sql/conversion.py | 308 | 2015 | """
This module holds simple classes to convert geospatial values from the
database.
"""
from django.contrib.gis.db.models.fields import GeoSelectFormatMixin
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Area, Distance
class BaseField(object):
empty_strings_allow... | mit |
Tojaj/createrepo_c | tests/python/tests/test_updatecollection.py | 2 | 3059 | import unittest
import shutil
import tempfile
import os.path
import createrepo_c as cr
from .fixtures import *
class TestCaseUpdateCollection(unittest.TestCase):
def test_updatecollection_setters(self):
col = cr.UpdateCollection()
self.assertTrue(col)
self.assertEqual(col.shortname, None... | gpl-2.0 |
ymyzk/python-gyazo | tests/test_api.py | 1 | 2037 | import pytest
from requests.structures import CaseInsensitiveDict
from gyazo.api import Api
from gyazo.error import GyazoError
@pytest.fixture
def api():
return Api()
def test_parse_and_check_success(api, mocker):
mock_response = mocker.MagicMock()
headers = CaseInsensitiveDict()
headers["X-Runtime... | mit |
fulmicoton/pylearn2 | pylearn2/training_algorithms/learning_rule.py | 32 | 17648 | """
A module containing different learning rules for use with the SGD training
algorithm.
"""
import numpy as np
import warnings
from theano.compat import six
from theano import config
from theano import tensor as T
from pylearn2.compat import OrderedDict
from pylearn2.space import NullSpace
from pylearn2.train_exten... | bsd-3-clause |
kmihelich/linux-espressobin | tools/perf/scripts/python/net_dropmonitor.py | 1812 | 1749 | # 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 |
partofthething/home-assistant | homeassistant/components/scene/__init__.py | 9 | 3176 | """Allow users to set and activate scenes."""
import functools as ft
import importlib
import logging
from typing import Any, Optional
import voluptuous as vol
from homeassistant.components.light import ATTR_TRANSITION
from homeassistant.const import CONF_PLATFORM, SERVICE_TURN_ON
from homeassistant.core import DOMAIN... | mit |
jvrsantacruz/XlsxWriter | xlsxwriter/test/styles/test_styles02.py | 8 | 4288 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...styles import Styles
from ...workbook impo... | bsd-2-clause |
nsharma283/php-buildpack | tests/test_rewrite.py | 15 | 5017 | import os
import os.path
import tempfile
import shutil
import subprocess
import imp
from nose.tools import eq_
class BaseRewriteScript(object):
def __init__(self):
info = imp.find_module('runner', ['lib/build_pack_utils'])
self.run = imp.load_module('runner', *info)
def setUp(self):
s... | apache-2.0 |
kslundberg/pants | src/python/pants/goal/products.py | 1 | 11915 | # 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 os
from colle... | apache-2.0 |
srossross/oclpb | opencl/__init__.py | 1 | 1595 |
from .copencl import Platform, get_platforms, Device
from .program import Program
from .event import UserEvent, Event
from .context import Context, ContextProperties
from .kernel import contextual_memory, global_memory, local_memory, constant_memory, Kernel
from .queue import Queue
from .cl_mem import MemoryObject
fr... | bsd-3-clause |
rzr/synapse | synapse/storage/media_repository.py | 4 | 5191 | # -*- coding: utf-8 -*-
# Copyright 2014, 2015 OpenMarket Ltd
#
# 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 |
iver333/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/commands/queues.py | 116 | 21137 | # Copyright (c) 2009 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple 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... | bsd-3-clause |
hantek/pylearn2 | pylearn2/datasets/iris.py | 37 | 5565 | """
.. todo::
WRITEME
"""
__author__ = "Ian Goodfellow"
# TODO: add citation
import numpy as np
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
class Iris(DenseDesignMatrix):
"""
.. todo::
WRITEME
"""
def __init__(self, preprocessor=None):
"""
.. ... | bsd-3-clause |
tommyip/zulip | zilencer/management/commands/add_new_user.py | 4 | 1388 | from typing import Any
from django.core.management.base import CommandParser
from zerver.lib.actions import do_create_user
from zerver.lib.management import ZulipBaseCommand
from zerver.models import Realm, UserProfile
class Command(ZulipBaseCommand):
help = """Add a new user for manual testing of the onboarding... | apache-2.0 |
petrjasek/superdesk-server | superdesk/io/afp.py | 1 | 2797 | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import os
i... | agpl-3.0 |
iwinoto/v4l-media_build | media/tools/perf/python/twatch.py | 1565 | 1316 | #! /usr/bin/python
# -*- python -*-
# -*- coding: utf-8 -*-
# twatch - Experimental use of the perf python interface
# Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com>
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License... | gpl-2.0 |
HerlanAssis/Django-AulaOsvandoSantana | lib/python2.7/site-packages/django/contrib/admin/sites.py | 77 | 22052 | from functools import update_wrapper
from django.apps import apps
from django.conf import settings
from django.contrib.admin import ModelAdmin, actions
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.core.urlresolvers import NoRe... | mit |
afmurillo/ICS-SDN | nids/enipcip/plc.py | 3 | 10554 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Nicolas Iooss, SUTD
#
# 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... | apache-2.0 |
rabimba/p2pScrapper | BitTorrent-5.2.2/BitTorrent/RateMeasure.py | 6 | 2230 | # The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software di... | mit |
qskycolor/viewfinder | marketing/tornado/test/runtests.py | 24 | 4881 | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import gc
import locale # system locale module, not tornado.locale
import logging
import operator
import textwrap
import sys
from tornado.httpclient import AsyncHTTPClient
from tornado.ioloop import IOLoop
from torn... | apache-2.0 |
esatterwhite/django-tastypie | tests/namespaced/tests.py | 19 | 1260 | from django.conf import settings
from django.core.urlresolvers import reverse, NoReverseMatch
from django.http import HttpRequest
import json
from testcases import TestCaseWithFixture
class NamespacedViewsTestCase(TestCaseWithFixture):
urls = 'namespaced.api.urls'
def test_urls(self):
from namespaced... | bsd-3-clause |
TNT-Samuel/Coding-Projects | DNS Server/Source - Copy/Lib/site-packages/pip/_vendor/chardet/big5freq.py | 342 | 31254 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... | gpl-3.0 |
RuudBurger/CouchPotatoServer | libs/tornado/platform/posix.py | 352 | 1859 | #!/usr/bin/env python
#
# Copyright 2011 Facebook
#
# 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 a... | gpl-3.0 |
ingadhoc/odoo-infrastructure | infrastructure/models/repository.py | 1 | 2149 | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api
import os
... | agpl-3.0 |
frippe12573/geonode | geonode/base/enumerations.py | 2 | 12884 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | gpl-3.0 |
subramani95/neutron | neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py | 7 | 3377 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013, Nachi Ueno, NTT I3, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www... | apache-2.0 |
kmike/gensim | docs/src/conf.py | 25 | 7178 | # -*- coding: utf-8 -*-
#
# gensim documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 17 13:42:21 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | gpl-3.0 |
sourabhv/python-koans-solutions | python3/koans/about_monkey_patching.py | 1 | 1401 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Related to AboutOpenClasses in the Ruby Koans
#
from runner.koan import *
class AboutMonkeyPatching(Koan):
class Dog:
def bark(self):
return "WOOF"
def test_as_defined_dogs_do_bark(self):
fido = self.Dog()
self.assertEqual... | mit |
w495/python-video-shot-detector | shot_detector/charts/event/base/base_event_chart.py | 1 | 6299 | # -*- coding: utf8 -*-
"""
...
"""
from __future__ import (absolute_import,
division,
print_function,
unicode_literals)
import itertools
import logging
# PY2 & PY3 — compatibility
from builtins import map, zip
from shot_detector.handlers imp... | bsd-3-clause |
ppwwyyxx/wechat-dump | wechat/avatar.py | 1 | 4245 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from PIL import Image
import io
import glob
import os
import numpy as np
import logging
import sqlite3
logger = logging.getLogger(__name__)
from .common.textutil import ensure_unicode, md5
def _filename_priority(s):
if "_hd" in s and s.endswith(".png"):
ret... | gpl-3.0 |
probablytom/tomwallis.net | venv/lib/python2.7/site-packages/django/apps/config.py | 75 | 8224 | from importlib import import_module
import os
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.utils.module_loading import module_has_submodule
from django.utils._os import upath
MODELS_MODULE_NAME = 'models'
class AppConfig(object):
"""
Class representing a Django a... | artistic-2.0 |
vrenaville/OCB | openerp/addons/base/workflow/workflow.py | 74 | 9947 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
bgaultier/laboitepro | laboite/apps/likes/migrations/0001_initial.py | 1 | 1477 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-03-10 07:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('boites', '0002_auto_20161224_1104'),
... | agpl-3.0 |
kepstin/picard | test/test_compatid3.py | 4 | 2120 | # -*- coding: utf-8 -*-
import unittest
from mutagen import id3
from picard.formats.mutagenext import compatid3
class UpdateToV23Test(unittest.TestCase):
def test_multiple_text_values(self):
tags = compatid3.CompatID3()
tags.add(id3.TALB(encoding=0, text=["123", "abc"]))
tags.update_to_v... | gpl-2.0 |
indirectlylit/kolibri | build_tools/customize_requirements.py | 4 | 1440 | """
This module defines a function for customizing the requirements used at Kolibri build time
and hence bundled into the dist folder.
For more detail see the documentation in __init__.py
"""
import os
import tempfile
import requests
def add_requirements_to_base():
if "EXTRA_REQUIREMENTS" in os.environ and os.e... | mit |
cfig/linux_tools | scripts/tools.py | 2 | 1714 | #!/usr/bin/env python3
import subprocess
import os.path
import platform
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def disable(self):
self.HEADER = ''
self.OKBLUE = ''
self.OKGRE... | gpl-2.0 |
tiborsimko/invenio-knowledge | tests/test_knowledge.py | 3 | 1140 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2009, 2010, 2011, 2013, 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 (a... | gpl-2.0 |
aioue/ansible | lib/ansible/modules/system/ufw.py | 16 | 12151 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Ahti Kitsik <ak@ahtik.com>
# (c) 2014, Jarno Keskikangas <jarno.keskikangas@gmail.com>
# (c) 2013, Aleksey Ovcharenko <aleksey.ovcharenko@gmail.com>
# (c) 2013, James Martin <jmartin@basho.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can ... | gpl-3.0 |
utecuy/edx-platform | lms/envs/devstack_optimized.py | 44 | 1493 | """
Settings to run LMS in devstack using optimized static assets.
This configuration changes LMS to use the optimized static assets generated for testing,
rather than picking up the files directly from the source tree.
The following Paver command can be used to run LMS in optimized mode:
paver devstack lms --opti... | agpl-3.0 |
iABC2XYZ/abc | Epics/BPM2.py | 1 | 1739 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 31 15:00:15 2017
@author: p
"""
import numpy as np
from epics import caget, caput
import time
now = int(time.time())
timeArray = time.localtime(now)
nowClock= time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
nameNowClock=nowClock[5:7]+nowClock[8:1... | gpl-3.0 |
hufei/qqweibo | qqweibo/api.py | 4 | 33648 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011 andelf <andelf@gmail.com>
# See LICENSE for details.
# Time-stamp: <2011-11-09 10:18:18 wangshuyu>
import os
import mimetypes
from qqweibo.binder import bind_api
from qqweibo.error import QWeiboError
from qqweibo.parsers import ModelParser
from qqweibo.ut... | mit |
mccdaq/mcculw | examples/console/temperature.py | 1 | 2614 | """
File: temperature.py
Library Call Demonstrated: mcculw.ul.t_in()
Purpose: Reads a temperature input channel.
Demonstration: Displays the temperature input.
Other Library Calls: mcculw.ul.release_daq_device()
Special Requirements: Unless the bo... | mit |
toshywoshy/ansible | test/units/modules/network/frr/test_frr_facts.py | 43 | 4772 | # (c) 2019, Ansible by Red Hat, 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
from units.compat.mock import patch
from ansible.modules.network.frr import frr_facts
from units.modu... | gpl-3.0 |
MakeHer/edx-platform | cms/djangoapps/contentstore/courseware_index.py | 52 | 27599 | """ Code to allow module store to interface with courseware index """
from __future__ import absolute_import
from abc import ABCMeta, abstractmethod
from datetime import timedelta
import logging
import re
from six import add_metaclass
from django.conf import settings
from django.utils.translation import ugettext_lazy,... | agpl-3.0 |
FlorentChamault/My_sickbeard | lib/guessit/transfo/guess_release_group.py | 40 | 2962 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | gpl-3.0 |
lesserwhirls/scipy-cwt | scipy/stats/rv.py | 58 | 1481 |
from numpy import vectorize
from numpy.random import random_sample
__all__ = ['randwppf', 'randwcdf']
# XXX: Are these needed anymore?
#####################################
# General purpose continuous
######################################
def randwppf(ppf, args=(), size=None):
"""returns an array of randomly... | bsd-3-clause |
SaltyCatFish/email-scrape | email_scrape/email_scrape.py | 1 | 4887 | #!/usr/bin/env python
"""
This module is used to recursively extract email addressed from
a url.
Example:
Todo:
"""
from __future__ import print_function
import re
import sys
import urllib
import urlparse
import warnings
import bs4
import mechanize
class EmailScraper(object):
""" Scrape emails from URL """... | mit |
hgl888/blink-crosswalk-efl | LayoutTests/http/tests/websocket/echo_wsh.py | 53 | 2032 | # Copyright 2009, 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and... | bsd-3-clause |
openstack/networking-sfc | networking_sfc/tests/unit/extensions/test_tap.py | 1 | 5202 | # Copyright (c) 2017 One Convergence Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | apache-2.0 |
facebook/buck | scripts/migrations/build_file.py | 5 | 6446 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... | apache-2.0 |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/idlelib/idle_test/test_textview.py | 7 | 2802 | '''Test the functions and main class method of textView.py.'''
import unittest
import os
from test.test_support import requires
from Tkinter import Tk
from idlelib import textView as tv
from idlelib.idle_test.mock_idle import Func
from idlelib.idle_test.mock_tk import Mbox
class TV(tv.TextViewer): # Use in TextView... | gpl-3.0 |
yongshengwang/hue | build/env/lib/python2.7/site-packages/ipython-0.10-py2.7.egg/IPython/deep_reload.py | 7 | 5710 | # -*- coding: utf-8 -*-
"""
A module to change reload() so that it acts recursively.
To enable it type:
>>> import __builtin__, deep_reload
>>> __builtin__.reload = deep_reload.reload
You can then disable it with:
>>> __builtin__.reload = deep_reload.original_reload
Alternatively, you can add a dreloa... | apache-2.0 |
sbusso/rethinkdb | external/v8_3.30.33.16/tools/run-deopt-fuzzer.py | 36 | 16911 | #!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. 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
# noti... | agpl-3.0 |
mcking49/apache-flask | Python/Lib/site-packages/markupsafe/__init__.py | 701 | 10338 | # -*- coding: utf-8 -*-
"""
markupsafe
~~~~~~~~~~
Implements a Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
import string
from collections import Mapping
from markupsafe._compat import text_type, string_types, int_types, \
u... | mit |
jkshaver/virtualenv-1.8.2 | env/lib/python2.7/site-packages/django/middleware/gzip.py | 98 | 1747 | import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, so that cac... | mit |
eXistenZNL/SickRage | lib/hachoir_parser/misc/file_3do.py | 95 | 7431 | # -*- coding: utf-8 -*-
"""
3do model parser.
Author: Cyril Zorin
Creation date: 28 september 2006
"""
from hachoir_parser import Parser
from hachoir_core.field import (FieldSet,
UInt32, Int32, String, Float32,
RawBytes, PaddingBytes)
from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN
from hachoir_par... | gpl-3.0 |
ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/pygments/lexers/oberon.py | 23 | 3741 | # -*- coding: utf-8 -*-
"""
pygments.lexers.oberon
~~~~~~~~~~~~~~~~~~~~~~
Lexers for Oberon family languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, words
from pygmen... | mit |
mluke93/osf.io | scripts/register_oauth_scopes.py | 33 | 2812 | """
Register the list of OAuth2 scopes that can be requested by third parties. This populates the Mongo collection
referenced by CAS when responding to authorization grant requests.
The database class is minimal; the exact specification for what a scope contains lives in the
python module from which this colle... | apache-2.0 |
simsong/grr-insider | lib/flows/general/discovery.py | 1 | 9606 | #!/usr/bin/env python
"""These are flows designed to discover information about the host."""
from grr.lib import aff4
from grr.lib import artifact
from grr.lib import flow
from grr.lib import rdfvalue
from grr.lib import worker
from grr.proto import flows_pb2
class EnrolmentInterrogateEvent(flow.EventListener):
"... | apache-2.0 |
moijes12/oh-mainline | vendor/packages/docutils/docutils/parsers/rst/languages/es.py | 128 | 4261 | # -*- coding: utf-8 -*-
# $Id: es.py 7119 2011-09-02 13:00:23Z milde $
# Author: Marcelo Huerta San Martín <richieadler@users.sourceforge.net>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/... | agpl-3.0 |
rachitrawat/taoshan | 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 |
acesonl/remotecare | remotecare/apps/utils/docxhelper.py | 1 | 5516 | # -*- coding: utf-8 -*-
"""
This module contains classes and functions for generating
DocX documents from HTML used for exporting reports.
:subtitle:`Function definitions:`
"""
from datetime import datetime
import cStringIO
from django.http import HttpResponse
from docx import paragraph, relationshiplist, nsprefixes, ... | gpl-3.0 |
beheh/fireplace | fireplace/cards/league/adventure.py | 2 | 11241 | from ..utils import *
##
# Zinaar
RandomWish = RandomID("LOEA02_03", "LOEA02_04", "LOEA02_05", "LOEA02_06", "LOEA02_10")
class LOEA02_02:
"Djinn’s Intuition"
activate = Draw(CONTROLLER), Give(OPPONENT, RandomWish)
class LOEA02_02h:
activate = Draw(CONTROLLER), GainMana(CONTROLLER, 1), Give(OPPONENT, RandomWish)... | agpl-3.0 |
wscullin/spack | lib/spack/spack/platforms/test.py | 3 | 1930 | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 |
Dandandan/wikiprogramming | jsrepl/extern/python/closured/lib/python2.7/encodings/cp866.py | 593 | 34652 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP866.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_map)
def decode(self,input,errors='strict'):
... | mit |
kmike/scikit-learn | sklearn/linear_model/tests/test_ridge.py | 5 | 12759 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.u... | bsd-3-clause |
owlabs/incubator-airflow | tests/contrib/hooks/test_gcp_video_intelligence_hook.py | 1 | 3290 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
aie108/python-instagram | tests.py | 31 | 8182 | #!/usr/bin/env python
import types
import six
try:
import simplejson as json
except ImportError:
import json
import getpass
import unittest
from six.moves.urllib.parse import urlparse, parse_qs
from instagram import client, oauth2, InstagramAPIError
TEST_AUTH = False
client_id = "DEBUG"
client_secret = "DEBUG... | bsd-3-clause |
sensysnetworks/uClinux | user/python/Demo/parser/example.py | 54 | 5722 | """Simple code to extract class & function docstrings from a module.
This code is used as an example in the library reference manual in the
section on using the parser module. Refer to the manual for a thorough
discussion of the operation of this code.
"""
import os
import parser
import symbol
import token
import ty... | gpl-2.0 |
denisenkom/django | django/views/csrf.py | 235 | 3802 | from django.http import HttpResponseForbidden
from django.template import Context, Template
from django.conf import settings
# We include the template inline since we need to be able to reliably display
# this error message, especially for the sake of developers, and there isn't any
# other way of making it available ... | bsd-3-clause |
jfillmore/hoops | tests/api_tests/test_oauth.py | 1 | 19616 | # -*- coding: utf-8 -*-
from flask import g
import json
import restkit.oauth2 as oauth
import time
from formencode.validators import String, UnicodeString, Int, StringBool
from tests.api_tests import APITestBase, app_config, db_config
from test_models.core import Partner, Language, Customer, PartnerAPIKey, User
from t... | mit |
russellb/powerline | powerline/segments/common/players.py | 10 | 13926 | # vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
from powerline.lib.shell import asrun, run_cmd
from powerline.lib.unicode import out_u
from powerline.segments import Segment, with_docstring
STATE_SYMBOLS = {
'fallback': '',
'play': '>',... | mit |
shaunvxc/laboratory | test_experiment.py | 1 | 2068 | import mock
import pytest
import laboratory
def raise_exception():
return {'a': 'b'}['c']
def test_control_raising_exception():
experiment = laboratory.Experiment()
with pytest.raises(KeyError):
with experiment.control() as e:
e.record(raise_exception())
assert experiment._cont... | mit |
defionscode/RHEL6-STIG | library/grub_crypt.py | 5 | 1308 | #!/usr/bin/python
import random, string, crypt
def gen_pass(size=16, chars=string.ascii_letters + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def gen_salt(salt):
'''Generate a random salt.'''
ret = ''
if not salt:
with open('/dev/urandom', 'rb') as urandom:
... | mit |
anksp21/Community-Zenpacks | ZenPacks.Nova.UCDFileSystemMap/setup.py | 2 | 2606 | ################################
# These variables are overwritten by Zenoss when the ZenPack is exported
# or saved. Do not modify them directly here.
NAME = "ZenPacks.Nova.UCDFileSystemMap"
VERSION = "1.2"
AUTHOR = "Ryan Matte"
LICENSE = "LGPL"
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.Nova']
PACKAGES = ['ZenPacks... | gpl-2.0 |
laydros/commission | sale_commission/models/sale_commission.py | 8 | 2576 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Pexego Sistemas Informáticos (<http://www.pexego.es>).
# Copyright (C) 2015 Avanzosc (<http://www.avanzosc.es>)
# Copyright (C) 2015 Pedro ... | agpl-3.0 |
entropy1337/infernal-twin | Modules/build/pip/pip/_vendor/requests/compat.py | 1039 | 1469 | # -*- coding: utf-8 -*-
"""
pythoncompat
"""
from .packages import chardet
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
try:
import simplejson as json
except (ImportError, SyntaxError):
# si... | gpl-3.0 |
flyballlabs/threatdetectionservice | api/venv/lib/python2.7/site-packages/pip/_vendor/html5lib/utils.py | 436 | 3267 | from __future__ import absolute_import, division, unicode_literals
from types import ModuleType
from pip._vendor.six import text_type
try:
import xml.etree.cElementTree as default_etree
except ImportError:
import xml.etree.ElementTree as default_etree
__all__ = ["default_etree", "MethodDispatcher", "isSurr... | apache-2.0 |
davidbkemp/node-gyp | gyp/pylib/gyp/SCons.py | 253 | 5848 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
SCons generator.
This contains class definitions and supporting functions for generating
pieces of SCons files for the different types of GYP targets.
"""
im... | mit |
cloudera/hue | desktop/core/ext-py/celery-4.2.1/examples/next-steps/setup.py | 2 | 1285 | """
Example setup file for a project using Celery.
This can be used to distribute your tasks and worker
as a Python package, on PyPI or on your own private package index.
"""
from __future__ import absolute_import, unicode_literals
from setuptools import setup, find_packages
setup(
name='example-tasks',
url=... | apache-2.0 |
lttviet/udacity-final | basehandler.py | 1 | 1305 | # -*- conding: utf-8 -*-
import os
import jinja2
import webapp2
import utils
JINJA_ENV = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
autoescape=True)
class BaseHandler(webapp2.RequestHandler):
def render(self, template, **kw):
"""Method render t... | mit |
ppanczyk/ansible | lib/ansible/modules/network/aci/aci_intf_policy_lldp.py | 22 | 3973 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
Sylrob434/CouchPotatoServer | couchpotato/core/notifications/trakt.py | 16 | 2839 | from couchpotato.core.helpers.variable import getTitle
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
log = CPLog(__name__)
autoload = 'Trakt'
class Trakt(Notification):
urls = {
'base': 'http://api.trakt.tv/%s',
'library': 'movie/library/... | gpl-3.0 |
b1naryth1ef/py-junos-eznc | lib/jnpr/junos/cfg/resource.py | 8 | 26830 | # stdlib
import warnings
from pprint import pformat
from copy import deepcopy
# 3rd-party
from lxml.builder import E
# package modules
from jnpr.junos import jxml as JXML
P_JUNOS_EXISTS = '_exists'
P_JUNOS_ACTIVE = '_active'
class Resource(object):
PROPERTIES = [
P_JUNOS_EXISTS,
P_JUNOS_ACTIVE... | apache-2.0 |
whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/twisted/internet/iocpreactor/reactor.py | 13 | 9190 | # -*- test-case-name: twisted.internet.test.test_iocp -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Reactor that uses IO completion ports
"""
import warnings, socket, sys
from zope.interface import implementer
from twisted.internet import base, interfaces, main, error
from twisted.... | mit |
kisna72/django | django/contrib/gis/geos/prepared.py | 328 | 2445 | from .base import GEOSBase
from .error import GEOSException
from .libgeos import geos_version_info
from .prototypes import prepared as capi
class PreparedGeometry(GEOSBase):
"""
A geometry that is prepared for performing certain operations.
At the moment this includes the contains covers, and intersects
... | bsd-3-clause |
enthought/Meta | meta/decompiler/tests/test_logical_expr.py | 2 | 1323 | '''
Created on Nov 24, 2012
@author: sean
'''
from meta.testing import py2only
from meta.decompiler.tests import Base
import unittest
class Test(Base):
def test_simple(self):
self.statement('a == b')
def test_chain1(self):
self.statement('a == b > f')
def test_chain2(self):
sel... | bsd-3-clause |
evanbiederstedt/RRBSfun | trees/chrom_scripts/normal_chr16.py | 1 | 25844 | import glob
import pandas as pd
import numpy as np
pd.set_option('display.max_columns', 50) # print all rows
import os
os.chdir("/gpfs/commons/home/biederstedte-934/evan_projects/correct_phylo_files")
normalB = glob.glob("binary_position_RRBS_normal_B_cell*")
mcell = glob.glob("binary_position_RRBS_NormalBCD19pCD27... | mit |
saikanth88/femus | applications/OptimalControl/boundary_control_inequality/dirichlet/dirichlet_lifting_external/input/ext_box_parametric.py | 3 | 9282 | #!/usr/bin/env python
###
### This file is generated automatically by SALOME v9.2.1 with dump python functionality
###
import sys
import salome
salome.salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()
sys.path.insert(0, r'/home/gbornia/software/femus/applications/OptimalControl/boundary_cont... | lgpl-2.1 |
MaayanLab/clustergrammer | make_clustergrammer.py | 2 | 1453 | '''
Python 2.7
The clustergrammer python module can be installed using pip:
pip install clustergrammer
or by getting the code from the repo:
https://github.com/MaayanLab/clustergrammer-py
'''
from clustergrammer import Network
net = Network()
# load matrix tsv file
net.load_file('txt/rc_two_cats.txt')
# net.load_fil... | mit |
gf712/AbPyTools | abpytools/core/chain_collection.py | 1 | 27705 | from .chain import Chain
import numpy as np
import logging
from abpytools.utils import PythonConfig, Download
import json
import os
import pandas as pd
from .helper_functions import numbering_table_sequences, numbering_table_region, numbering_table_multiindex
from operator import itemgetter
from urllib import parse
fro... | mit |
lumig242/Hue-Integration-with-CDAP | apps/useradmin/src/useradmin/migrations/0002_add_ldap_support.py | 36 | 6948 | # encoding: utf-8
from south.db import db
from south.v2 import DataMigration
from django.contrib.auth.models import User
from django.db import connection
from useradmin.models import create_profile_for_user
from useradmin.models import UserProfile
class Migration(DataMigration):
def forwards(self, orm):
... | apache-2.0 |
JackBDu/mandarinizer | player.py | 1 | 2611 | #!/usr/bin/env python
# encoding=utf-8
import time # sleep
import sys # exit
import argparse # argparse
__author__ = 'Jack B. Du'
__copyright__ = 'Copyright (c) 2017, Jack B. Du'
__license__ = 'MIT'
__email__ = 'jackbdu@nyu.edu'
# parsing arguments
parser = argparse.ArgumentParser()
parser.add_argument('fil... | mit |
lowitty/server | libsDarwin/pyasn1/codec/cer/decoder.py | 261 | 1230 | # CER decoder
from pyasn1.type import univ
from pyasn1.codec.ber import decoder
from pyasn1.compat.octets import oct2int
from pyasn1 import error
class BooleanDecoder(decoder.AbstractSimpleDecoder):
protoComponent = univ.Boolean(0)
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet, length,
... | mit |
stitzelj/Ficlatte | castle/models.py | 1 | 17360 |
#coding: utf-8
#This file is part of Ficlatté.
#Copyright (C) 2015-2017 Paul Robertson, Jim Stitzel, & Shu Sam Chen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of version 3 of the GNU Affero General Public
# License as published by the Free Software Foundation... | agpl-3.0 |
twrightsman/advent-of-code-2015 | advent_day21_pt1.py | 1 | 2547 | # 1.) Calculate lowest stats needed to win
# -Cheapest gear correlates to least stat bonuses
# a.) Most possible rounds is min(playerHP, bossHP)
# b.) # of rounds is min(boss_HP / (player_DMG - boss_AMR), player_HP / (boss_DMG - player_AMR))
# c.) Player wins if rounds * (player_DMG - boss_AMR) >= boss... | unlicense |
Mad31/ISN | testrobot.py | 1 | 2008 | #! /usr/bin/env Python
import nxt.locator
from nxt.motor import *
import sys
from time import *
def rechercher_brique(nom_brick) :
""" cherche la brique"""
try :
brick=nxt.locator.find_one_brick(name=nom_brick)
""" tourve la brique"""
except nxt.locator.BrickNotFoundError, cause :
... | gpl-3.0 |
grilo/ansible-1 | lib/ansible/plugins/cliconf/nxos.py | 58 | 2052 | #
# (c) 2017 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | gpl-3.0 |
ohio813/volatility | volatility/plugins/common.py | 44 | 3871 | # Volatility
#
# Authors:
# Michael Cohen <scudette@users.sourceforge.net>
#
# This file is part of Volatility.
#
# Volatility is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, o... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.