repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringclasses 981
values | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
sidartaoliveira/ansible | lib/ansible/module_utils/openswitch.py | 87 | 7773 | #
# (c) 2015 Peter Sprygada, <psprygada@ansible.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) any late... | gpl-3.0 |
davgibbs/django | django/contrib/redirects/middleware.py | 383 | 1810 | from __future__ import unicode_literals
from django import http
from django.apps import apps
from django.conf import settings
from django.contrib.redirects.models import Redirect
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ImproperlyConfigured
class RedirectFallback... | bsd-3-clause |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/numpy/f2py/rules.py | 4 | 58707 | #!/usr/bin/env python
"""
Rules for building C/API module with f2py2e.
Here is a skeleton of a new wrapper function (13Dec2001):
wrapper_function(args)
declarations
get_python_arguments, say, `a' and `b'
get_a_from_python
if (successful) {
get_b_from_python
if (successful) {
callfortran
... | apache-2.0 |
pratikmallya/hue | desktop/core/ext-py/Django-1.6.10/tests/builtin_server/tests.py | 57 | 3508 | from __future__ import unicode_literals
from io import BytesIO
from django.core.servers.basehttp import ServerHandler, MAX_SOCKET_CHUNK_SIZE
from django.utils.unittest import TestCase
class DummyHandler(object):
def log_request(self, *args, **kwargs):
pass
class FileWrapperHandler(ServerHandler):
... | apache-2.0 |
gdestuynder/MozDef | alerts/cloudtrail_logging_disabled.py | 1 | 1132 | #!/usr/bin/env python
# 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/.
# Copyright (c) 2017 Mozilla Corporation
from lib.alerttask import AlertTask
from mozdef_util.que... | mpl-2.0 |
xvedejas/limbo4 | Lib/decimal.py | 2 | 235094 | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz <aahz at pobox.com>
# and Tim Peters
# This module should be kept in s... | gpl-3.0 |
Thortoise/Super-Snake | Blender/animation_nodes-master/operators/profiling.py | 1 | 2009 | import bpy
import cProfile
from bpy.props import *
from io import StringIO
from contextlib import redirect_stdout
class ProfileAnimationNodes(bpy.types.Operator):
bl_idname = "an.profile"
bl_label = "Profile"
function = StringProperty()
output = StringProperty()
sort = StringProperty()
def ex... | gpl-3.0 |
soldag/home-assistant | tests/components/homekit_controller/test_air_quality.py | 21 | 1783 | """Basic checks for HomeKit air quality sensor."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from tests.components.homekit_controller.common import setup_test_component
def create_air_quality_sensor_service(accessory):
"""Define temperat... | apache-2.0 |
MIPS/external-chromium_org | chrome/common/extensions/docs/server2/persistent_object_store_test.py | 117 | 1737 | #!/usr/bin/env python
# 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.
from persistent_object_store import PersistentObjectStore
import unittest
class PersistentObjectStoreTest(unittest.TestCase):
'''Tes... | bsd-3-clause |
bearstech/ansible | test/units/parsing/test_mod_args.py | 66 | 4729 | # (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 |
nazgee/igep-kernel | tools/perf/scripts/python/futex-contention.py | 11261 | 1486 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
vikas1885/test1 | common/lib/xmodule/xmodule/tests/test_annotator_token.py | 222 | 1060 | """
This test will run for annotator_token.py
"""
import unittest
from xmodule.annotator_token import retrieve_token
class TokenRetriever(unittest.TestCase):
"""
Tests to make sure that when passed in a username and secret token, that it will be encoded correctly
"""
def test_token(self):
"""... | agpl-3.0 |
jonashaag/django-nonrel-nohistory | django/contrib/auth/tests/basic.py | 154 | 3632 | from django.test import TestCase
from django.contrib.auth.models import User, AnonymousUser
from django.core.management import call_command
from StringIO import StringIO
class BasicTestCase(TestCase):
def test_user(self):
"Check that users can be created and can set their password"
u = User.objects... | bsd-3-clause |
dvl/pyclub | pyclub/content/tests.py | 1 | 1153 | # -*- coding: utf-8 -*-
from itertools import cycle
from django.test import TestCase
from model_mommy.recipe import Recipe
from .models import Post
class TestPostModel(TestCase):
def setUp(self):
self.recipe = Recipe(Post, slug=None)
def test_str(self):
post = self.recipe.make(title='foob... | mit |
theguardian/vanilla2tender | mako/ext/beaker_cache.py | 66 | 2380 | """Provide a :class:`.CacheImpl` for the Beaker caching system."""
from mako import exceptions
from mako.cache import CacheImpl
_beaker_cache = None
class BeakerCacheImpl(CacheImpl):
"""A :class:`.CacheImpl` provided for the Beaker caching system.
This plugin is used by default, based on the default
val... | gpl-2.0 |
benoitsteiner/tensorflow-opencl | tensorflow/contrib/bayesflow/python/ops/stochastic_variables.py | 103 | 6065 | # 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 |
hynekcer/django | django/core/serializers/pyyaml.py | 439 | 2843 | """
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
import collections
import decimal
import sys
from io import StringIO
import yaml
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
Deserializer as PythonDes... | bsd-3-clause |
realityone/Anti_teNelgniS | src/OpenShineto/LongBase64.py | 3 | 7996 | import time
import base64
class LongBase64(object):
"""
usage:
lb64 = LongBase64()
lb64.Long_EnCode(string)
lb64.Long_DeCode(encode_string)
"""
_encrypt_seed_1 = [
'salku!doew%oi3ry*khasl$kjf#gdksh',
'pjf/726;lsjfgo^s9234khsldfk:lkjl',
'klu\owe8*6>sjdhf8... | gpl-2.0 |
kswiat/django | django/db/migrations/loader.py | 24 | 12699 | from __future__ import unicode_literals
from importlib import import_module
import os
import sys
from django.apps import apps
from django.db.migrations.recorder import MigrationRecorder
from django.db.migrations.graph import MigrationGraph
from django.utils import six
from django.conf import settings
MIGRATIONS_MOD... | bsd-3-clause |
Manuel4131/youtube-dl | test/test_http.py | 115 | 4170 | #!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl import YoutubeDL
from youtube_dl.compat import compat_http_server, compat_urllib_request
import ss... | unlicense |
eepgwde/pyeg0 | eg/dispatch0.py | 1 | 1483 | ## @file dispatch0.py
# @author weaves
# @brief Demonstrate extrinisc visitor pattern.
#
# The visitor pattern (or double dispatch) is well-known. In languages
# that support reflection you can use a single dispatch like this
# method.
#
# You can test this package on the command-line with
# <code>python dispatch0.py</... | gpl-3.0 |
LoIdo/nparty-server | interface/technical/cache.py | 1 | 1049 | import zope.interface
class ICache(zope.interface.Interface):
"""
interface of cache center
wrapper of sth. like memcache and redis
"""
def set_value(key, value, expire):
"""
set key value pair to cache
"""
def get_value(key):
"""
get v... | gpl-2.0 |
stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/raw/GLE/constants.py | 8 | 2554 | """Constants for OpenGL.GLE
Automatically generated by the generateraw script, do not edit!
"""
from ctypes import *
from OpenGL import platform, arrays
from OpenGL.constant import Constant
from OpenGL.raw.GL import _types as GL_types
GLvoid = GL_types.GLvoid
GLE_TEXTURE_ENABLE = Constant( 'GLE_TEXTURE_ENABLE', 65... | lgpl-3.0 |
vrenaville/OCB | openerp/workflow/service.py | 378 | 4972 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... | agpl-3.0 |
googleapis/googleapis-gen | google/devtools/containeranalysis/v1/devtools-containeranalysis-v1-py/docs/conf.py | 1 | 12687 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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 |
withtone/depot_tools | third_party/boto/compat.py | 79 | 1335 | # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | bsd-3-clause |
Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/googleapiclient/mimeparse.py | 120 | 6552 | # Copyright 2014 Joe Gregorio
#
# Licensed under the MIT License
"""MIME-Type Parser
This module provides basic functions for handling mime-types. It can handle
matching mime-types against a list of media-ranges. See section 14.1 of the
HTTP specification [RFC 2616] for a complete explanation.
http://www.w3.org/P... | gpl-2.0 |
allenlavoie/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py | 1 | 11315 | # 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 |
ressu/SickGear | lib/chardet/euckrfreq.py | 3121 | 45978 | ######################## 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 |
jml/flocker | flocker/control/__init__.py | 6 | 1547 | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Control service for managing a Flocker cluster.
A Flocker cluster is composed of a number of nodes. The control service is
in charge of managing the desired configuration and exposes a public API
for modifying and retrieving the desired configuration. T... | apache-2.0 |
ibmsoe/tensorflow | tensorflow/contrib/framework/python/framework/__init__.py | 75 | 1419 | # Copyright 2015 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 |
codeforamerica/skillcamp | ENV/lib/python2.7/site-packages/jinja2/_stringdefs.py | 990 | 404291 | # -*- coding: utf-8 -*-
"""
jinja2._stringdefs
~~~~~~~~~~~~~~~~~~
Strings of all Unicode characters of a certain category.
Used for matching in Unicode-aware languages. Run to regenerate.
Inspired by chartypes_create.py from the MoinMoin project, original
implementation from Pygments.
:co... | mit |
Denisolt/Tensorflow_Chat_Bot | local/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py | 28 | 15703 | # Copyright 2015 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... | gpl-3.0 |
rabipanda/tensorflow | tensorflow/python/training/proximal_adagrad_test.py | 36 | 9246 | # Copyright 2015 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 |
aamirmajeedkhan/P4-conference-central | main.py | 1 | 2470 | #!/usr/bin/env python
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import mail,memcache
from conference import ConferenceApi,MEMCACHE_FEATURED_SPEAKER_KEY
from google.appengine.ext import ndb
from models import Session, Speaker
class SetAnnouncementHandler(webapp2.RequestHandl... | apache-2.0 |
dongritengfei/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/test/finder_unittest.py | 124 | 5471 | # Copyright (C) 2012 Google, Inc.
#
# 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 conditions and the following disclaimer... | bsd-3-clause |
pmarques/ansible | lib/ansible/module_utils/compat/version.py | 13 | 12756 | # Vendored copy of distutils/version.py from CPython 3.9.5
#
# Implements multiple version numbering conventions for the
# Python Module Distribution Utilities.
#
# PSF License (see licenses/PSF-license.txt or https://opensource.org/licenses/Python-2.0)
#
"""Provides classes to represent module version numbers (one cl... | gpl-3.0 |
xxdede/SoCo | soco/alarms.py | 2 | 11399 | # -*- coding: utf-8 -*-
"""Sonos Alarms."""
from __future__ import unicode_literals
import logging
from datetime import datetime
import re
import weakref
from .core import PLAY_MODES
from .discovery import discover
from .xml import XML
log = logging.getLogger(__name__) # pylint: disable=C0103
TIME_FORMAT = "%H:%M:... | mit |
RasaHQ/rasa_core | tests/core/test_channels.py | 1 | 29687 | import json
import logging
import mock
import pytest
import sanic
from aioresponses import aioresponses
from httpretty import httpretty
from sanic import Sanic
from rasa.core import utils
from rasa.core.agent import Agent
from rasa.core.interpreter import RegexInterpreter
from rasa.core.utils import EndpointConfig
fro... | apache-2.0 |
hkariti/ansible | lib/ansible/modules/cloud/amazon/route53_facts.py | 39 | 12906 | #!/usr/bin/python
# Copyright: 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',
'status': ['preview'],
... | gpl-3.0 |
Belgabor/django | tests/regressiontests/forms/regressions.py | 14 | 6566 | # -*- coding: utf-8 -*-
# Tests to prevent against recurrences of earlier bugs.
tests = r"""
It should be possible to re-use attribute dictionaries (#3810)
>>> from django.forms import *
>>> extra_attrs = {'class': 'special'}
>>> class TestForm(Form):
... f1 = CharField(max_length=10, widget=TextInput(attrs=extra_... | bsd-3-clause |
samabhi/pstHealth | venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/appengine.py | 195 | 7531 | from __future__ import absolute_import
import logging
import os
import warnings
from ..exceptions import (
HTTPError,
HTTPWarning,
MaxRetryError,
ProtocolError,
TimeoutError,
SSLError
)
from ..packages.six import BytesIO
from ..request import RequestMethods
from ..response import HTTPResponse
... | mit |
hehongliang/tensorflow | tensorflow/python/autograph/operators/py_builtins.py | 2 | 6914 | # 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 |
VishvajitP/django-tastypie | tastypie/fields.py | 12 | 28406 | import datetime
from dateutil.parser import parse
from decimal import Decimal
import re
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.utils import datetime_safe, importlib
from tastypie.bundle import Bundle
from tastypie.exceptions import ApiFieldError, NotFound
from tastypi... | bsd-3-clause |
dchaplinsky/badparking.in.ua | badparking/profiles/migrations/0001_initial.py | 2 | 3534 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-21 21:59
from __future__ import unicode_literals
import datetime
import django.contrib.auth.models
import django.core.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = T... | mit |
yuwen41200/biodiversity-analysis | utils/roadkill-packer/htmlGenerator.py | 1 | 4419 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
html_beginning = '''<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitt... | gpl-3.0 |
sametmax/Django--an-app-at-a-time | ignore_this_directory/django/views/decorators/vary.py | 134 | 1084 | from functools import wraps
from django.utils.cache import patch_vary_headers
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-language')
def index(request):
...
... | mit |
colinnewell/odoo | openerp/report/common.py | 457 | 3337 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | agpl-3.0 |
zlorb/mitmproxy | pathod/language/base.py | 4 | 13819 | import operator
import os
import abc
import functools
import pyparsing as pp
from mitmproxy.utils import strutils
from mitmproxy.utils import human
import typing # noqa
from . import generators
from . import exceptions
class Settings:
def __init__(
self,
is_client=False,
staticdir=None,
... | mit |
grupodyd/python-filapp | setup.py | 1 | 1785 | #!/usr/bin/env python
#
# Copyright 2015 DyD Dinámica y Desarrollo SAS
#
# 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 ap... | apache-2.0 |
obnoxxx/samba | third_party/waf/wafadmin/3rdparty/ParallelDebug.py | 32 | 8536 | #! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2007-2010 (ita)
"""
debugging helpers for parallel compilation, outputs
a svg file in the build directory
"""
import os, time, sys, threading
try: from Queue import Queue
except: from queue import Queue
import Runner, Options, Utils, Task, Logs
from Constants im... | gpl-3.0 |
openstack/nova | nova/virt/powervm/disk/driver.py | 3 | 11149 | # Copyright 2013 OpenStack Foundation
# Copyright 2015, 2018 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lice... | apache-2.0 |
wtsi-hgi/CoGS-Webapp | cogs/db/interface.py | 1 | 14479 | """
Copyright (c) 2017, 2018 Genome Research Ltd.
Authors:
* Christopher Harrison <ch12@sanger.ac.uk>
* Simon Beal <sb48@sanger.ac.uk>
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 v... | agpl-3.0 |
pgmillon/ansible | lib/ansible/modules/cloud/memset/memset_server_info.py | 25 | 8498 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, Simon Weald <ansible@simonweald.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... | gpl-3.0 |
havt/odoo | addons/crm_helpdesk/__init__.py | 442 | 1081 | # -*- 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 |
waltBB/neutron_read | neutron/plugins/brocade/db/models.py | 63 | 4551 | # Copyright 2013 Brocade Communications System, 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
#
#... | apache-2.0 |
golismero/golismero-devel | tools/sqlmap/lib/controller/checks.py | 7 | 52616 | #!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import copy
import httplib
import re
import socket
import time
from subprocess import Popen as execute
from extra.beep.beep import beep
from lib.core.agent import agent
from... | gpl-2.0 |
GladeRom/android_external_chromium_org | tools/perf/metrics/cpu.py | 45 | 3161 | # 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.
from metrics import Metric
from telemetry.value import scalar
class CpuMetric(Metric):
"""Calulates CPU load over a span of time."""
def __init__(self... | bsd-3-clause |
sloria/osf.io | api/nodes/permissions.py | 1 | 9092 | # -*- coding: utf-8 -*-
from rest_framework import permissions
from rest_framework import exceptions
from addons.base.models import BaseAddonSettings
from osf.models import (
AbstractNode,
Contributor,
DraftRegistration,
Institution,
Node,
NodeRelation,
OSFUser,
PreprintService,
Pri... | apache-2.0 |
lepricon49/headphones | lib/unidecode/x0bd.py | 253 | 4752 | data = (
'bols', # 0x00
'bolt', # 0x01
'bolp', # 0x02
'bolh', # 0x03
'bom', # 0x04
'bob', # 0x05
'bobs', # 0x06
'bos', # 0x07
'boss', # 0x08
'bong', # 0x09
'boj', # 0x0a
'boc', # 0x0b
'bok', # 0x0c
'bot', # 0x0d
'bop', # 0x0e
'boh', # 0x0f
'bwa', # 0x10
'bwag', # 0x... | gpl-3.0 |
rbn920/feebb | feebb/test.py | 1 | 1640 | from feebb import *
import matplotlib.pyplot as plt
pre = Preprocessor()
pre.load_json('ex_json/test2.json')
elems = [Element(elem) for elem in pre.elements]
print(pre.supports)
beam = Beam(elems, pre.supports)
post = Postprocessor(beam, 10)
print(max(post.interp('moment')))
print(min(post.interp('moment')))
plt.plot(... | mit |
dreilly369/MITMf | core/proxyplugins.py | 7 | 4397 | # Copyright (c) 2010-2011 Ben Schmidt, Marcello Salvati
#
# 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 of the
# License, or (at your option) any later version.
#
# This progr... | gpl-3.0 |
chouseknecht/ansible | test/units/modules/network/onyx/test_onyx_igmp_interface.py | 68 | 2704 | #
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | gpl-3.0 |
stanley-cheung/grpc | examples/python/multiplex/helloworld_pb2.py | 146 | 3912 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: helloworld.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _re... | apache-2.0 |
le9i0nx/ansible | lib/ansible/modules/network/aireos/aireos_config.py | 22 | 11193 | #!/usr/bin/python
#
# Copyright: Ansible Team
# 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 |
Cerfoglg/cattle | tests/integration/cattletest/core/test_healthcheck.py | 1 | 58694 | from common_fixtures import * # NOQA
from cattle import ApiError
import yaml
def _get_agent_for_container(context, container):
agent = None
for map in container.hosts()[0].instanceHostMaps():
try:
c = map.instance()
except Exception:
continue
if c.agentId is no... | apache-2.0 |
pwong-mapr/private-hue | desktop/core/ext-py/Django-1.4.5/django/contrib/sessions/middleware.py | 323 | 1888 | import time
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
from django.utils.importlib import import_module
class SessionMiddleware(object):
def process_request(self, request):
engine = import_module(settings.SESSION_ENGINE)
... | apache-2.0 |
jrg365/gpytorch | test/variational/test_independent_multitask_variational_strategy.py | 1 | 3533 | #!/usr/bin/env python3
import unittest
import torch
import gpytorch
from gpytorch.test.variational_test_case import VariationalTestCase
def likelihood_cls():
return gpytorch.likelihoods.MultitaskGaussianLikelihood(num_tasks=2)
def strategy_cls(model, inducing_points, variational_distribution, learn_inducing_... | mit |
sradanov/flyingpigeon | setup.py | 1 | 1385 | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = [
'cdo',
'bokeh',
'ocgis',
'pandas',
'nose',
]
classifiers=[
... | apache-2.0 |
Garrett-R/scikit-learn | examples/decomposition/plot_image_denoising.py | 84 | 5820 | """
=========================================
Image denoising using dictionary learning
=========================================
An example comparing the effect of reconstructing noisy fragments
of the Lena image using firstly online :ref:`DictionaryLearning` and
various transform methods.
The dictionary is fitted o... | bsd-3-clause |
hgl888/crosswalk-tizen | tools/gyp/pylib/gyp/generator/msvs.py | 20 | 116961 | # 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.
import copy
import ntpath
import os
import posixpath
import re
import subprocess
import sys
import gyp.common
import gyp.easy_xml as easy_xml
import gyp.MSVSNew a... | apache-2.0 |
Santinell/ansible-modules-core | cloud/google/gc_storage.py | 101 | 16678 | #!/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... | gpl-3.0 |
bit-trade-one/SoundModuleAP | lib-src/lv2/lv2/plugins/eg04-sampler.lv2/waflib/Tools/xlc.py | 9 | 1220 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
from waflib.Tools import ccroot,ar
from waflib.Configure import conf
@conf
def find_xlc(conf):
cc=conf.find_program(['xlc_r','xlc'],var='CC')
cc=conf.cmd_to_list(cc... | gpl-2.0 |
XBMC-Addons/script.module.myconnpy | lib/examples/client.py | 14 | 4220 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most... | gpl-2.0 |
P0cL4bs/3vilTwinAttacker | core/servers/dns/DNSBase.py | 2 | 3884 | import weakref
from core.config.globalimport import *
from core.widgets.default.uimodel import *
from core.widgets.docks.dock import *
from core.widgets.default.SessionConfig import SessionConfig
from core.utility.component import ComponentBlueprint
from core.utility.threads import (ProcessThread)
class DNSBase(QtGui... | gpl-3.0 |
brson/gyp | pylib/gyp/MSVSToolFile.py | 2736 | 1804 | # 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.
"""Visual Studio project reader/writer."""
import gyp.common
import gyp.easy_xml as easy_xml
class Writer(object):
"""Visual Studio XML tool file writer."""
... | bsd-3-clause |
tempbottle/restcommander | play-1.2.4/python/Lib/email/generator.py | 56 | 13142 | # Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Classes to generate plain text from a message object tree."""
__all__ = ['Generator', 'DecodedGenerator']
import re
import sys
import time
import random
import warnings
from cStringIO import StringIO
from ... | apache-2.0 |
apurtell/phoenix | bin/psql.py | 1 | 2718 | #!/usr/bin/env python
############################################################################
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The A... | apache-2.0 |
cxhernandez/msmbuilder | msmbuilder/tests/test_transition_counts.py | 10 | 2219 | import numpy as np
from six import PY3
from msmbuilder.msm import _transition_counts
def test_argument():
# test that first argument must be a list of sequences
with np.testing.assert_raises(ValueError):
_transition_counts([1, 2, 3])
def test_upper_triangular():
# test a simple example
c, m... | lgpl-2.1 |
varshadyavaiah/RED-with-In-and-Out-RIO-queue-discipline | src/aodv/bindings/modulegen__gcc_LP64.py | 14 | 532920 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | gpl-2.0 |
txemi/ansible | test/runner/lib/core_ci.py | 51 | 12754 | """Access Ansible Core CI remote services."""
from __future__ import absolute_import, print_function
import json
import os
import traceback
import uuid
import errno
import time
from lib.http import (
HttpClient,
HttpResponse,
HttpError,
)
from lib.util import (
ApplicationError,
run_command,
... | gpl-3.0 |
huiyiqun/check_mk | tests/unit/checks/test_ra32e_sensors_check.py | 1 | 4376 | # -*- coding: utf-8 -*-
import pytest
from checktestlib import BasicCheckResult
pytestmark = pytest.mark.checks
@pytest.mark.parametrize('info,discoveries_expected,checks_expected', [
( # internal temperature
[[[u'2070', u'', u'']], []],
[
('ra32e_sensors', [('Internal', {})]),
... | gpl-2.0 |
fabtools/fabtools | fabtools/system.py | 3 | 8076 | """
System settings
===============
"""
from fabric.api import hide, run, settings
from fabtools.files import is_file
from fabtools.utils import read_lines, run_as_root
class UnsupportedFamily(Exception):
"""
Operation not supported on this system family.
::
from fabtools.system import Unsuppo... | bsd-2-clause |
melbit-kevinwessel/ansible-modules-extras | messaging/rabbitmq_parameter.py | 104 | 4614 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Chatham Financial <oss@chathamfinancial.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... | gpl-3.0 |
PRIMEDesigner15/PRIMEDesigner15 | dependencies/Lib/test/unittests/test_set.py | 16 | 63774 | import unittest
from test import support
import gc
import weakref
import operator
import copy
import pickle
from random import randrange, shuffle
import sys
import warnings
import collections
import collections.abc
class PassThru(Exception):
pass
def check_pass_thru():
raise PassThru
yield 1
class BadCmp... | bsd-3-clause |
BenWiederhake/House-Of-Tweets | backend/vomit.py | 1 | 1212 | #!/usr/bin/env python3
import json
import mq
from sys import argv
from time import sleep
def pull(filename):
with open(filename, 'r') as fp:
return json.load(fp)
def check(tweets):
assert len(tweets) > 0
first_batch = tweets[0]
assert len(first_batch) > 0
first_tweet = first_batch[0]
... | gpl-3.0 |
sudheesh001/mediadrop | mediadrop/controllers/api/__init__.py | 7 | 1583 | # This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2015 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.txt in the main project ... | gpl-3.0 |
agriffis/django-allauth | allauth/socialaccount/providers/robinhood/views.py | 3 | 1133 | import requests
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from .provider import RobinhoodProvider
class RobinhoodOAuth2Adapter(OAuth2... | mit |
MaxQu/ardupilot-solo | mk/PX4/Tools/genmsg/src/genmsg/msg_loader.py | 215 | 20479 | # Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, 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... | gpl-3.0 |
tedi3231/openerp | openerp/addons/project_issue/res_config.py | 441 | 1492 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 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 |
zzqcn/wireshark | tools/make-plugin-reg.py | 1 | 5547 | #!/usr/bin/env python3
#
# Looks for registration routines in the plugins
# and assembles C code to call all the routines.
#
import os
import sys
import re
#
# The first argument is the directory in which the source files live.
#
srcdir = sys.argv[1]
#
# The second argument is either "plugin", "plugin_wtap" or "plugi... | gpl-2.0 |
tumist/p2pool-aur | nattraverso/utils.py | 288 | 1563 | """
Various utility functions used in the nattraverso package.
@author: Raphael Slinckx
@copyright: Copyright 2005
@license: LGPL
@contact: U{raphael@slinckx.net<mailto:raphael@slinckx.net>}
@version: 0.1.0
"""
__revision__ = "$id"
def is_rfc1918_ip(ip):
"""
Checks if the given ip address is a rfc1918 one.
... | gpl-3.0 |
alphagov/notifications-api | app/dao/api_key_dao.py | 1 | 1564 | import uuid
from datetime import datetime, timedelta
from sqlalchemy import func, or_
from app import db
from app.dao.dao_utils import autocommit, version_class
from app.models import ApiKey
@autocommit
@version_class(ApiKey)
def save_model_api_key(api_key):
if not api_key.id:
api_key.id = uuid.uuid4() ... | mit |
nirbheek/cerbero | cerbero/commands/shell.py | 20 | 1606 | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | lgpl-2.1 |
takuan-osho/yael | yael/parsing.py | 3 | 1598 | #!/usr/bin/env python
# coding=utf-8
"""
Parsing option constants.
"""
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2015, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
__version__ = "0.0.9"
__email__ = "alberto@albertopettarin.it"
__status__ = "Development"
class Parsing:
"""
E... | mit |
moreati/pydgin | scripts/build.py | 1 | 4989 | #!/usr/bin/env python
#=========================================================================
# build.py
#=========================================================================
# Builds pydgin.
import multiprocessing
import os
import shutil
import sys
import subprocess
import distutils.spawn
usage = """Usage:
... | bsd-3-clause |
qenter/vlc-android | toolchains/arm/lib/python2.7/wsgiref/util.py | 247 | 5576 | """Miscellaneous WSGI-related Utilities"""
import posixpath
__all__ = [
'FileWrapper', 'guess_scheme', 'application_uri', 'request_uri',
'shift_path_info', 'setup_testing_defaults',
]
class FileWrapper:
"""Wrapper to convert file-like objects to iterables"""
def __init__(self, filelike, blksize=819... | gpl-2.0 |
watspidererik/testenv | flask/lib/python2.7/site-packages/babel/messages/plurals.py | 151 | 6696 | # -*- coding: utf-8 -*-
"""
babel.messages.plurals
~~~~~~~~~~~~~~~~~~~~~~
Plural form definitions.
:copyright: (c) 2013 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
from babel.core import default_locale, Locale
from operator import itemgetter
# XXX: remove this file, dupl... | mit |
CMSS-BCRDB/RDSV1.0 | trove/guestagent/datastore/experimental/mongodb/service.py | 4 | 15279 | # Copyright (c) 2014 Mirantis, 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 re... | apache-2.0 |
sthirugn/robottelo | robottelo/ui/hostgroup.py | 2 | 2719 | # -*- encoding: utf-8 -*-
"""Implements Host Group UI."""
from robottelo.ui.base import Base
from robottelo.ui.locators import common_locators, locators, tab_locators
from robottelo.ui.navigator import Navigator
class Hostgroup(Base):
"""Manipulates hostgroup from UI."""
def create(self, name, parent=None, e... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.