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 |
|---|---|---|---|---|---|
mahendra-r/edx-platform | common/lib/capa/capa/safe_exec/tests/test_safe_exec.py | 190 | 9817 | """Test safe_exec.py"""
import hashlib
import os
import os.path
import random
import textwrap
import unittest
from nose.plugins.skip import SkipTest
from capa.safe_exec import safe_exec, update_hash
from codejail.safe_exec import SafeExecException
from codejail.jail_code import is_configured
class TestSafeExec(uni... | agpl-3.0 |
ChameleonCloud/horizon | openstack_dashboard/dashboards/identity/application_credentials/views.py | 1 | 8569 | # Copyright 2018 SUSE Linux GmbH
#
# 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 |
icclab/disco | sm/managers/Component.py | 1 | 17794 | # Copyright (c) 2017. Zuercher Hochschule fuer Angewandte Wissenschaften
# 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 |
lumig242/Hue-Integration-with-CDAP | desktop/core/ext-py/boto-2.38.0/boto/datapipeline/exceptions.py | 235 | 1471 | # 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 ... | apache-2.0 |
jcftang/ansible | lib/ansible/plugins/lookup/mongodb.py | 48 | 6127 | # (c) 2016, Marcos Diez <marcos@unitron.com.br>
# https://github.com/marcosdiez/
#
# 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 |
GioneeDevTeam/android_kernel_gionee_msm8974 | 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 |
GitAngel/django | django/contrib/auth/views.py | 74 | 12178 | import warnings
from django.conf import settings
# Avoid shadowing the login() and logout() views below.
from django.contrib.auth import (
REDIRECT_FIELD_NAME, get_user_model, login as auth_login,
logout as auth_logout, update_session_auth_hash,
)
from django.contrib.auth.decorators import login_required
from ... | bsd-3-clause |
Gregory-Howard/spaCy | spacy/tests/matcher/test_matcher.py | 4 | 3865 | # coding: utf-8
from __future__ import unicode_literals
from ...matcher import Matcher, PhraseMatcher
from ..util import get_doc
import pytest
@pytest.fixture
def matcher(en_vocab):
patterns = {
'JS': ['PRODUCT', {}, [[{'ORTH': 'JavaScript'}]]],
'GoogleNow': ['PRODUCT', {}, [[{'ORTH': 'Go... | mit |
treeio/treeio | treeio/core/middleware/modules.py | 3 | 3339 | # encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Modules middleware: handles modular behavior of the system
"""
from treeio.core.conf import settings
from treeio.core.models import Module
# This must be fired after Django processes request
# i.e. aft... | mit |
alcemirfernandes/pynguin | lib/pynguin/bidict.py | 3 | 19113 | #!/usr/bin/env python
# Copyright (c) 2009 Josh Bronson and contributors
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to ... | gpl-3.0 |
kbrebanov/ansible-modules-extras | packaging/os/homebrew_cask.py | 2 | 18391 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
# (c) 2016, Indrajit Raychaudhuri <irc+code@indrajit.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... | gpl-3.0 |
FBSLikan/Cetico-TCC | data/libs/reportlab/graphics/samples/line_chart.py | 42 | 4275 | #Autogenerated by ReportLab guiedit do not edit
from reportlab.graphics.charts.legends import Legend
from reportlab.graphics.charts.lineplots import LinePlot
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
from reportlab.graphics.charts.textlabels import Label
from reportlab.graphics.samples.... | gpl-3.0 |
mhils/mitmproxy | test/mitmproxy/test_connections.py | 1 | 7483 | import socket
import threading
import ssl
import OpenSSL
import pytest
from unittest import mock
from mitmproxy import connections
from mitmproxy import exceptions
from mitmproxy.net import tcp
from mitmproxy.net.http import http1
from mitmproxy.test import tflow
from .net import tservers
from pathod import test
from ... | mit |
RazerM/pg_grant | docs/conf.py | 1 | 9177 | #!/usr/bin/env python3
#
# pg_grant documentation build configuration file.
#
# 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 configuration values have a default; values that are comm... | mit |
EMcCormack/TAMU-Seat-Checker | main.py | 1 | 1307 | #!/usr/bin/env python3
from seat_checker import seat_checker
from file_to_list import file_to_list
from time import sleep
def main():
"""Check each crn course in CRN_file and if a spot is open, print a message
CRN containing file should have the form:
11111
24871
35192
"""
# --------Ins... | mit |
AntSharesSDK/antshares-python | sdk/AntShares/Network/Inventory.py | 2 | 1038 | # -*- coding:utf-8 -*-
"""
Description:
Inventory Class
Usage:
from AntShares.Network.Inventory import Inventory
"""
from AntShares.IO.MemoryStream import MemoryStream
from AntShares.IO.BinaryWriter import BinaryWriter
from AntShares.Cryptography.Helper import *
from AntShares.Helper import *
import binascii... | apache-2.0 |
bright-sparks/chromium-spacewalk | chrome/test/chromedriver/embed_js_in_cpp.py | 165 | 1485 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Embeds standalone JavaScript snippets in C++ code.
Each argument to the script must be a file containing an associated JavaScri... | bsd-3-clause |
ammiranda/python_koans | python3/koans/about_regex.py | 34 | 4795 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
import re
class AboutRegex(Koan):
"""
These koans are based on the Ben's book: Regular Expressions in 10 minutes.
I found this books very useful so I decided to write a koans in order to practice everything I had learned from i... | mit |
niboshi/chainer | tests/chainer_tests/functions_tests/math_tests/test_floor.py | 8 | 1223 | import numpy
from chainer import functions
from chainer import testing
@testing.parameterize(*testing.product({
'shape': [(3, 2), ()],
'dtype': [numpy.float16, numpy.float32, numpy.float64],
}))
@testing.fix_random()
@testing.inject_backend_tests(
None,
# CPU tests
[
{},
]
# GPU t... | mit |
potpath/django-angular | djangular/views/mixins.py | 16 | 5168 | # -*- coding: utf-8 -*-
import json
import warnings
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden
def allow_remote_invocation(func, method='auto'):
"""
All methods which shall be callable through a given Ajax 'act... | mit |
warner83/micropython | tests/bytecode/unpyc.py | 22 | 4126 | import argparse, dis, marshal, struct, sys, time, types
def show_file(fname):
f = open(fname, "rb")
magic = f.read(4)
moddate = f.read(4)
modtime = time.asctime(time.localtime(struct.unpack('I', moddate)[0]))
f.read(4) # don't know what these 4 bytes are
#print("magic %s" % (bytes_to_hex(magic)... | mit |
SamYaple/neutron | neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py | 15 | 12687 | # Copyright 2014 Mellanox Technologies, 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 applicable law or agreed t... | apache-2.0 |
kid551/shadowsocks | tests/coverage_server.py | 1072 | 1655 | #!/usr/bin/env python
#
# Copyright 2015 clowwindy
#
# 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 |
retrography/scancode-toolkit | tests/textcode/test_pdf.py | 4 | 2545 | #
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | apache-2.0 |
qizenguf/MLC-STT | src/arch/x86/isa/insts/simd64/integer/logical/por.py | 91 | 2395 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | bsd-3-clause |
handroissuazo/tensorflow | venv/lib/python2.7/site-packages/setuptools/glob.py | 130 | 5189 | """
Filename globbing utility. Mostly a copy of `glob` from Python 3.5.
Changes include:
* `yield from` and PEP3102 `*` removed.
* `bytes` changed to `six.binary_type`.
* Hidden files are not ignored.
"""
import os
import re
import fnmatch
from six import binary_type
__all__ = ["glob", "iglob", "escape"]
def gl... | apache-2.0 |
FlaskGuys/Flask-Imagine | tests/filters/test_rotate.py | 2 | 2698 | import os
import unittest
from copy import copy
from PIL import Image
from flask.ext.imagine.filters.rotate import RotateFilter
class TestRotateFilter(unittest.TestCase):
image_png = None
image_jpg = None
image_tif = None
image_bmp = None
def setUp(self):
assets_path = os.path.abspath(os.... | mit |
shakamunyi/ansible | plugins/inventory/zabbix.py | 119 | 3956 | #!/usr/bin/env python
# (c) 2013, Greg Buehler
#
# 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 ve... | gpl-3.0 |
skippbox/kmachine | Godeps/_workspace/src/k8s.io/kubernetes/vendor/github.com/hashicorp/go-msgpack/codec/msgpack_test.py | 1232 | 3478 | #!/usr/bin/env python
# This will create golden files in a directory passed to it.
# A Test calls this internally to create the golden files
# So it can process them (so we don't have to checkin the files).
import msgpack, msgpackrpc, sys, os, threading
def get_test_data_list():
# get list with all primitive typ... | apache-2.0 |
lintzc/gpdb | gpMgmt/sbin/gpoperation.py | 30 | 2114 | #!/usr/bin/env python
import sys
import pickle
import traceback
class NullDevice():
def write(self, s):
pass
# Prevent use of stdout, as it disrupts pickling mechanism
old_stdout = sys.stdout
sys.stdout = NullDevice()
# log initialization must be done only AFTER rerouting stdout
from gppylib import gplo... | apache-2.0 |
umitanuki/chainer | chainer/optimizers/ada_delta.py | 13 | 1326 | import numpy
from chainer import cuda
from chainer import optimizer
class AdaDelta(optimizer.Optimizer):
"""Zeiler's ADADELTA.
See: http://www.matthewzeiler.com/pubs/googleTR2012/googleTR2012.pdf
"""
def __init__(self, rho=0.95, eps=1e-6):
self.rho = rho
self.eps = eps
def in... | mit |
bloem-project/bloem-server | files/migrations/0001_initial.py | 1 | 3900 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-27 12:27
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | gpl-3.0 |
zafar-hussain/or-tools | examples/python/magic_square_and_cards.py | 32 | 2950 | # Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# 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 ... | apache-2.0 |
lexus24/40223224final | static/Brython3.1.1-20150328-091302/Lib/sre_compile.py | 630 | 16898 | #
# Secret Labs' Regular Expression Engine
#
# convert template to internal format
#
# Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
import sys
import _sre
import sre_parse
from sre_constan... | gpl-3.0 |
tunneln/CarnotKE | jyhton/lib-python/2.7/idlelib/PyParse.py | 185 | 19510 | import re
import sys
# Reason last stmt is continued (or C_NONE if it's not).
(C_NONE, C_BACKSLASH, C_STRING_FIRST_LINE,
C_STRING_NEXT_LINES, C_BRACKET) = range(5)
if 0: # for throwaway debugging output
def dump(*stuff):
sys.__stdout__.write(" ".join(map(str, stuff)) + "\n")
# Find what looks like the... | apache-2.0 |
Davidjohnwilson/sympy | sympy/stats/crv.py | 38 | 15024 | """
Continuous Random Variables Module
See Also
========
sympy.stats.crv_types
sympy.stats.rv
sympy.stats.frv
"""
from __future__ import print_function, division
from sympy.stats.rv import (RandomDomain, SingleDomain, ConditionalDomain,
ProductDomain, PSpace, SinglePSpace, random_symbols, ProductPSpace,
... | bsd-3-clause |
kho0810/flaskr | lib/alembic/config.py | 18 | 11052 | from argparse import ArgumentParser
from .compat import SafeConfigParser
import inspect
import os
import sys
from . import command, util, package_dir, compat
class Config(object):
"""Represent an Alembic configuration.
Within an ``env.py`` script, this is available
via the :attr:`.EnvironmentContext.conf... | apache-2.0 |
sk7/django-social-auth | social_auth/backends/browserid.py | 5 | 2541 | """
BrowserID support
"""
from urllib import urlencode
from django.contrib.auth import authenticate
from django.utils import simplejson
from social_auth.backends import SocialAuthBackend, BaseAuth
from social_auth.utils import log, dsa_urlopen
from social_auth.exceptions import AuthFailed, AuthMissingParameter
# Br... | bsd-3-clause |
Tim1928/DBK-3.0-4.2 | tools/perf/python/twatch.py | 3213 | 1338 | #! /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 |
cjhak/b2share | invenio/modules/previewer/previewerext/csv_recline.py | 19 | 1149 | # This file is part of Invenio.
# Copyright (C) 2013, 2014, 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# ... | gpl-2.0 |
Don42/youtube-dl | devscripts/buildserver.py | 124 | 13186 | #!/usr/bin/python3
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import argparse
import ctypes
import functools
import sys
import threading
import traceback
import os.path
class BuildHTTPServer(ThreadingMixIn, HTTPServer):
allow_reuse_address = True
advapi32... | unlicense |
btabibian/scikit-learn | sklearn/cluster/birch.py | 11 | 23640 | # Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Joel Nothman <joel.nothman@gmail.com>
# License: BSD 3 clause
from __future__ import division
import warnings
import numpy as np
from scipy import sparse
from math import sqrt
fro... | bsd-3-clause |
xhair/TopOdoo_Addons | ToproERP_Wechat_Enterprises/wechat_sdk/reply.py | 24 | 7030 | # -*- coding: utf-8 -*-
import time
from .messages import WechatMessage
class WechatReply(object):
def __init__(self, message=None, **kwargs):
if 'source' not in kwargs and isinstance(message, WechatMessage):
kwargs['source'] = message.target
if 'target' not in kwargs and isinstance(... | agpl-3.0 |
illfelder/libcloud | libcloud/test/compute/test_dimensiondata_v2_3.py | 1 | 158393 | # 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 use ... | apache-2.0 |
helldorado/ansible | lib/ansible/modules/database/mongodb/mongodb_user.py | 24 | 15538 | #!/usr/bin/python
# (c) 2012, Elliott Foster <elliott@fourkitchens.com>
# Sponsored by Four Kitchens http://fourkitchens.com.
# (c) 2014, Epic Games, 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
__m... | gpl-3.0 |
justincassidy/scikit-learn | examples/linear_model/plot_lasso_model_selection.py | 311 | 5431 | """
===================================================
Lasso model selection: Cross-Validation / AIC / BIC
===================================================
Use the Akaike information criterion (AIC), the Bayes Information
criterion (BIC) and cross-validation to select an optimal value
of the regularization paramet... | bsd-3-clause |
eventql/eventql | deps/3rdparty/spidermonkey/mozjs/python/mozboot/mozboot/centos.py | 2 | 1879 | # 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/.
import os
import platform
from mozboot.base import BaseBootstrapper
class CentOSBootstrapper(BaseBootstrapper):
de... | agpl-3.0 |
graingert/ansible | lib/ansible/cli/__init__.py | 14 | 22110 | # (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 |
hjjeon0608/mbed_for_W7500P | workspace_tools/build.py | 18 | 10265 | #! /usr/bin/env python2
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 applicabl... | apache-2.0 |
technologiescollege/Blockly-rduino-communication | scripts_XP/Lib/sqlite3/test/regression.py | 79 | 12920 | #-*- coding: iso-8859-1 -*-
# pysqlite2/test/regression.py: pysqlite regression tests
#
# Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any dama... | gpl-3.0 |
gholms/euca2ools | euca2ools/commands/ec2/describeavailabilityzones.py | 6 | 2406 | # Copyright 2009-2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 ... | bsd-2-clause |
neoareslinux/neutron | neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py | 4 | 7250 | # Copyright (c) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 |
kaichogami/sympy | sympy/tensor/array/tests/test_immutable_ndim_array.py | 19 | 9544 | from copy import copy
from sympy.tensor.array.dense_ndim_array import ImmutableDenseNDimArray
from sympy import Symbol, Rational, SparseMatrix, Dict, diff
from sympy.matrices import Matrix
from sympy.tensor.array.sparse_ndim_array import ImmutableSparseNDimArray
from sympy.utilities.pytest import raises
def test_ndi... | bsd-3-clause |
icereval/osf-sync | osfoffline/tasks/queue.py | 1 | 1615 | import logging
import queue
import threading
from osfoffline import settings
from osfoffline.exceptions import NodeNotFound
from osfoffline.tasks.notifications import Notification
from osfoffline.utils import Singleton
logger = logging.getLogger(__name__)
class OperationWorker(threading.Thread, metaclass=Singleton)... | lgpl-3.0 |
larsbutler/oq-hazardlib | openquake/hazardlib/tests/gsim/fukushima_tanaka_1990_test.py | 4 | 1592 | # The Hazard Library
# Copyright (C) 2013-2014, GEM Foundation
#
# 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.
... | agpl-3.0 |
odahoda/noisicaa | noisicaa/builtin_nodes/instrument/model_test.py | 1 | 2362 | #!/usr/bin/python3
# @begin:license
#
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
#
# 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 2 of the License, or
# (at y... | gpl-2.0 |
cdgallahue/atomic-turbine | web/lib/python2.7/site-packages/jinja2/meta.py | 222 | 4340 | # -*- coding: utf-8 -*-
"""
jinja2.meta
~~~~~~~~~~~
This module implements various functions that exposes information about
templates that might be interesting for various kinds of applications.
:copyright: (c) 2017 by the Jinja Team, see AUTHORS for more details.
:license: BSD, see LICENSE fo... | mit |
dcroc16/skunk_works | google_appengine/lib/django-1.4/django/dispatch/saferef.py | 86 | 10503 | """
"Safe weakrefs", originally from pyDispatcher.
Provides a way to safely weakref any function, including bound methods (which
aren't handled by the core weakref module).
"""
import traceback
import weakref
def safeRef(target, onDelete = None):
"""Return a *safe* weak reference to a callable target
target... | mit |
popazerty/e2-dmm | tests/test_timer.py | 31 | 2600 | import enigma
import sys
import time
import tests
#enigma.reset()
def test_timer(repeat = 0, timer_start = 3600, timer_length = 1000, sim_length = 86400 * 7):
import NavigationInstance
at = time.time()
t = NavigationInstance.instance.RecordTimer
print t
print "old mwt:", t.MaxWaitTime
t.MaxWaitTime = 86400... | gpl-2.0 |
StackStorm/st2 | st2actions/setup.py | 3 | 1772 | # -*- coding: utf-8 -*-
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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... | apache-2.0 |
JalexChang/appinventor-sources | appinventor/misc/emulator-support/bottle.py | 158 | 115722 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | apache-2.0 |
Sarah-Alsinan/muypicky | lib/python3.6/site-packages/django/conf/locale/sr/formats.py | 1008 | 2011 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y.'
TIME_FORMAT = 'H:i'
DATE... | mit |
mairsbw/mavlink | pymavlink/tools/magfit_rotation_gyro.py | 43 | 7236 | #!/usr/bin/env python
'''
fit best estimate of magnetometer rotation to gyro data
'''
import sys, time, os, math
from argparse import ArgumentParser
parser = ArgumentParser(description=__doc__)
parser.add_argument("--no-timestamps", dest="notimestamps", action='store_true', help="Log doesn't have timestamps")
parser... | lgpl-3.0 |
yk0242/incubation | incubation-python/logging/logbase.py | 1 | 3578 | # -*- coding: utf-8 -*-
# MAIN for test logging to file and to HTTPS テスト
# usage : run normally to see WARNING messages and above to file and https
# run command-line with flag -v for --verbose mode (INFO and above to file)
# run command-line with flag -d for --debug mode (DEBUG and above to file... | mit |
joaoRossiFilho/AudioLib | portaudio/doc/utils/checkfiledocs.py | 58 | 2492 | import os
import os.path
import string
paRootDirectory = '../../'
paHtmlDocDirectory = os.path.join( paRootDirectory, "doc", "html" )
## Script to check documentation status
## this script assumes that html doxygen documentation has been generated
##
## it then walks the entire portaudio source tree and che... | bsd-3-clause |
Kazade/NeHe-Website | google_appengine/lib/django-1.4/tests/regressiontests/utils/checksums.py | 246 | 1098 | import unittest
from django.utils import checksums
class TestUtilsChecksums(unittest.TestCase):
def check_output(self, function, value, output=None):
"""
Check that function(value) equals output. If output is None,
check that function(value) equals value.
"""
if output is... | bsd-3-clause |
tecan/xchat-rt | plugins/scripts/encryption/gnupg.py | 1 | 44583 | """ A wrapper for the 'gpg' command::
Portions of this module are derived from A.M. Kuchling's well-designed
GPG.py, using Richard Jones' updated version 1.3, which can be found
in the pycrypto CVS repository on Sourceforge:
http://pycrypto.cvs.sourceforge.net/viewvc/pycrypto/gpg/GPG.py
This module is *not* forward-... | gpl-2.0 |
mapfau/xbmc | addons/metadata.demo.movies/demo.py | 5 | 5794 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import xbmcplugin,xbmcgui,xbmc,xbmcaddon
import os,sys,urllib
def get_params():
param=[]
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]
cleanedparams=params.replace('?','')
if (par... | gpl-2.0 |
aperigault/ansible | lib/ansible/modules/monitoring/bigpanda.py | 92 | 5714 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# 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',
... | gpl-3.0 |
tsirolnik/AffiliTest-Python | examples/example.appinfo.py | 1 | 1132 | from affilitest import api as affapi
def main():
# Create a new instance of the API
# Pass your API Key if you have one
api = affapi.AffiliTest()
# Use login the acquire session and relevant permissions
# Not needed if the API Key was supplied
api.login('example@mail.com', 'password')
# ... | mit |
UrusTeam/android_ndk_toolchain_cross | lib/python2.7/cProfile.py | 169 | 6515 | #! /usr/bin/env python
"""Python interface for the 'lsprof' profiler.
Compatible with the 'profile' module.
"""
__all__ = ["run", "runctx", "help", "Profile"]
import _lsprof
# ____________________________________________________________
# Simple interface
def run(statement, filename=None, sort=-1):
"""Run s... | gpl-2.0 |
sammyshj/gci | tests/unit_tests/modules/s3/s3gis/GoogleLayer.py | 43 | 2623 |
s3gis_tests = load_module("tests.unit_tests.modules.s3.s3gis")
test_utils = local_import("test_utils")
google_layer = dict(
name = "Test Google Layer",
description = "Test Google layer",
enabled = True,
created_on = datetime.datetime.now(),
modified_on = datetime.datetime.now(),
satellite_enab... | mit |
baltcoinh/eternity | qa/rpc-tests/netutil.py | 328 | 4562 | #!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Linux network utilities
import sys
import socket
import fcntl
import struct
import array
import os
import bi... | mit |
craigtracey/nova-docker | novadocker/tests/virt/docker/test_network.py | 3 | 3612 | # Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 |
rbruyere/appengine-mapreduce | python/test/mapreduce gcs/mapreduce/third_party/pipeline/pipeline.py | 3 | 121879 | #!/usr/bin/env python
#
# Copyright 2010 Google 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 o... | apache-2.0 |
alexandrinno/android_device_sony_D2403 | tools/perf/util/setup.py | 4998 | 1330 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... | gpl-2.0 |
Gehn/JustAChatBot | sleekxmpp/stanza/iq.py | 11 | 10331 | """
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.stanza.rootstanza import RootStanza
from sleekxmpp.xmlstream import StanzaBase, ET
from sleekxmpp.xmlstream.handler import Waiter... | mit |
googlefonts/fontdiffenator | Lib/diffenator/__init__.py | 1 | 16145 | __version__ = "0.9.11"
import io
import sys
if sys.version_info[0] < 3 and sys.version_info[1] < 6:
raise ImportError("Visualize module requires Python3.6+!")
from array import array
from PIL import Image
from cairo import Context, ImageSurface, FORMAT_A8, FORMAT_ARGB32
from diffenator.constants import FTHintMode
... | apache-2.0 |
kagayakidan/scikit-learn | examples/model_selection/plot_underfitting_overfitting.py | 230 | 2649 | """
============================
Underfitting vs. Overfitting
============================
This example demonstrates the problems of underfitting and overfitting and
how we can use linear regression with polynomial features to approximate
nonlinear functions. The plot shows the function that we want to approximate,
wh... | bsd-3-clause |
andreimarcu/pyaib | pyaib/components.py | 2 | 14983 | #!/usr/bin/env python
#
# Copyright 2013 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 agree... | apache-2.0 |
hanxianzhai/DHcoin3 | contrib/spendfrom/spendfrom.py | 1 | 10053 | #!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | mit |
jonathf/chaospy | chaospy/descriptives/sensitivity/total.py | 1 | 1512 | """Total Sobol sensitivity index."""
import numpy
import numpoly
from ..conditional import E_cond
from ..variance import Var
def Sens_t(poly, dist, **kws):
"""
Variance-based decomposition
AKA Sobol' indices
Total effect sensitivity index
Args:
poly (numpoly.ndpoly):
Polynom... | mit |
RedHatInsights/insights-core | insights/parsers/rsyslog_conf.py | 1 | 3019 | """
RsyslogConf - file ``/etc/rsyslog.conf``
========================================
The rsyslog configuration files can include statements with two different
line based formats along with snippets of 'RainerScript' that can span
multiple lines.
See http://www.rsyslog.com/doc/master/configuration/basic_structure.htm... | apache-2.0 |
fernandoacorreia/DjangoWAWSLogging | DjangoWAWSLogging/env/Lib/site-packages/pywin32-218-py2.7-win32.egg/win32com/test/testStreams.py | 21 | 4390 | import pythoncom
import win32com.server.util
import win32com.test.util
import unittest
from pywin32_testutil import str2bytes
class Persists:
_public_methods_ = [ 'GetClassID', 'IsDirty', 'Load', 'Save',
'GetSizeMax', 'InitNew' ]
_com_interfaces_ = [ pythoncom.IID_IPersistStreamInit ]... | mit |
rasata/ansible | lib/ansible/plugins/shell/powershell.py | 72 | 6663 | # (c) 2014, Chris Church <chris@ninemoreminutes.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 lat... | gpl-3.0 |
chanceraine/nupic.research | projects/drive/drive/game.py | 16 | 2963 | import sys
class Game(object):
def __init__(self, field, vehicle, scorer, model, goal=None,
logs=None, plots=None, graphics=None,
runSpeed=1.0,
plotEvery=25, plotsEnabled=True,
manualRun=False):
self.field = field
self.vehicle = vehicle
self.... | agpl-3.0 |
mortonjt/scipy | scipy/setup.py | 7 | 1144 | from __future__ import division, print_function, absolute_import
import sys
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('scipy',parent_package,top_path)
config.add_subpackage('cluster')
config.add_subpackage('constants... | bsd-3-clause |
ryfeus/lambda-packs | Sklearn_scipy_numpy/source/scipy/constants/codata.py | 54 | 115203 | # Compiled by Charles Harris, dated October 3, 2002
# updated to 2002 values by BasSw, 2006
# Updated to 2006 values by Vincent Davis June 2010
# Updated to 2014 values by Joseph Booker, 2015
"""
Fundamental Physical Constants
------------------------------
These constants are taken from CODATA Recommended Values of ... | mit |
tiborsimko/invenio-ext | invenio_ext/session/backends/sqlalchemy.py | 6 | 4098 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012, 2013, 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (a... | gpl-2.0 |
googleapis/googleapis-gen | google/cloud/gkehub/v1alpha2/gkehub-v1alpha2-py/google/cloud/gkehub_v1alpha2/services/gke_hub/transports/grpc.py | 1 | 19604 | # -*- 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 |
MizukiSonoko/py4slide | demo/adf2015.py | 1 | 2283 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from py4slide import Slide, Page, SlideStyle
s = Slide.Slide()
s.setStyle(Slide.SlideStyle.NATURAL)
p0 = Page.Page(
title="Setting",
contents=["This is setting"])
p1 = Page.Page(
title="Introduction",
contents=["by @Mizuki_Sonoko"])
p2 ... | bsd-3-clause |
daljeetv/infodiscovery | infodiscovery/website.py | 1 | 2304 | #/usr/bin/env python
# coding=utf-8
import urllib
from lxml import etree
from pyquery import PyQuery as pq
from bs4 import BeautifulSoup
import urllib
import socket
from urlparse import urlparse
class Website:
def __init__(self, website, listOfWebsites):
self.website = website
#listOfRootWebsite... | bsd-2-clause |
Slater-Victoroff/scrapy | scrapy/selector/lxmlsel.py | 175 | 1340 | """
XPath selectors based on lxml
"""
from scrapy.utils.deprecate import create_deprecated_class
from .unified import Selector, SelectorList
__all__ = ['HtmlXPathSelector', 'XmlXPathSelector', 'XPathSelector',
'XPathSelectorList']
def _xpathselector_css(self, *a, **kw):
raise RuntimeError('.css() meth... | bsd-3-clause |
shenhzou654321/protobuf-ios | compiler/gtest/test/gtest_list_tests_unittest.py | 1068 | 5415 | #!/usr/bin/env python
#
# Copyright 2006, 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... | mit |
Cisco-Talos/pyrebox | volatility/volatility/plugins/mac/mount.py | 12 | 2374 | # Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# 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, or
# (at your o... | gpl-2.0 |
tinker20/tinker-society | venv/lib/python2.7/site-packages/setuptools/svn_utils.py | 98 | 18879 | import os
import re
import sys
from distutils import log
import xml.dom.pulldom
import shlex
import locale
import codecs
import unicodedata
import warnings
from setuptools.compat import unicode
from setuptools.py31compat import TemporaryDirectory
from xml.sax.saxutils import unescape
try:
import url... | cc0-1.0 |
ytjiang/django | django/contrib/gis/geos/prototypes/predicates.py | 103 | 1794 | """
This module houses the GEOS ctypes prototype functions for the
unary and binary predicate operations on geometries.
"""
from ctypes import c_char, c_char_p, c_double
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.contrib.gi... | bsd-3-clause |
erikdejonge/youtube-dl | youtube_dl/extractor/rentv.py | 23 | 4156 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
determine_ext,
int_or_none,
url_or_none,
)
class RENTVIE(InfoExtractor):
_VALID_URL = r'(?:rentv:|https?://(?:www\.)?ren\.tv/(?:player|video/epizod)/)(?P<id>... | unlicense |
michivo/buergerchain | dev_support/local_handysig_proxy/urllib3/util/retry.py | 137 | 14601 | from __future__ import absolute_import
import time
import logging
from collections import namedtuple
from itertools import takewhile
import email
import re
from ..exceptions import (
ConnectTimeoutError,
MaxRetryError,
ProtocolError,
ReadTimeoutError,
ResponseError,
InvalidHeader,
)
from ..pack... | mit |
osstech-jp/samba | buildtools/wafsamba/samba_version.py | 11 | 9127 | import os
import Utils
import samba_utils
from samba_git import find_git
def git_version_summary(path, env=None):
git = find_git(env)
if git is None:
return ("GIT-UNKNOWN", {})
env.GIT = git
environ = dict(os.environ)
environ["GIT_DIR"] = '%s/.git' % path
environ["GIT_WORK_TREE"] = p... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.