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 |
|---|---|---|---|---|---|
qistoph/thug | samples/steps/exploits.py | 2 | 1116 | import sys
import os
from behave import *
from behave.log_capture import capture
THUG = os.path.dirname(os.path.abspath(__file__)).split("samples")[0]
EXPLOITS = os.path.join(THUG, 'samples', 'exploits')
sys.path.append(os.path.join(THUG, 'src'))
from ThugAPI import ThugAPI
class Exploits(object):
def __init... | gpl-2.0 |
PeterDaveHello/eden | static/scripts/tools/ADAT_CSV_generator.py | 41 | 18554 | #!/usr/bin/python
"""
Sahana-Eden ADAT helper script
==============================
Script to generate the import files for a new survey template.
The input is a "xls" spreadsheet with four sheets, namely:
* Template
* Sections
* Questions
* Layout
The output is two csv files o... | mit |
gexueyuan/WAT89EC-10-odroid | board/pxa255_idp/pxa_reg_calcs.py | 267 | 11108 | #!/usr/bin/python
# (C) Copyright 2004
# BEC Systems <http://bec-systems.com>
# Cliff Brake <cliff.brake@gmail.com>
# 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 Li... | gpl-2.0 |
jgronefe/AliPhysics | PWGJE/EMCALJetTasks/Tracks/analysis/base/MergeException.py | 41 | 1396 | #**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. *
#* Contributors ... | bsd-3-clause |
mxamin/youtube-dl | youtube_dl/extractor/digiteka.py | 29 | 3507 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import int_or_none
class DigitekaIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://(?:www\.)?(?:digiteka\.net|ultimedia\.com)/
(?:
deliver/
(?P<embed_type>
... | unlicense |
a-parhom/edx-platform | openedx/features/journals/tests/test_marketing_views.py | 4 | 5336 | """ Tests for journals marketing views. """
import uuid
import mock
from django.conf import settings
from django.core.urlresolvers import reverse
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from openedx.features... | agpl-3.0 |
aprovy/test-ng-pp | scripts/testngppgen/DataProviderParser.py | 2 | 4022 | #!/usr/bin/python
from Message import *
from Phase1Result import *
from DataProvider import DataProvider
import re
##########################################################
class DataProviderParser:
#######################################################
def __init__(self, provider, file, line_number):
s... | lgpl-3.0 |
matthewshoup/airflow | airflow/operators/sensors.py | 19 | 15625 | from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from datetime import datetime
import logging
from urllib.parse import urlparse
from time import sleep
from airflow import hooks, settings
from airflow.models import BaseOperator
from ai... | apache-2.0 |
golismero/golismero-devel | thirdparty_libs/django/db/backends/oracle/compiler.py | 112 | 2995 | from django.db.models.sql import compiler
# The izip_longest was renamed to zip_longest in py3
try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest
class SQLCompiler(compiler.SQLCompiler):
def resolve_columns(self, row, fields=()):
# If this ... | gpl-2.0 |
denisff/python-for-android | python3-alpha/python3-src/Lib/test/test_memoryview.py | 56 | 13054 | """Unit tests for the memoryview
XXX We need more tests! Some tests are in test_bytes
"""
import unittest
import test.support
import sys
import gc
import weakref
import array
import io
class AbstractMemoryTests:
source_bytes = b"abcdef"
@property
def _source(self):
return self.source_bytes
... | apache-2.0 |
guijomatos/SickRage | lib/ndg/httpsclient/ssl_context_util.py | 63 | 3357 | """ndg_httpsclient SSL Context utilities module containing convenience routines
for setting SSL context configuration.
"""
__author__ = "P J Kershaw (STFC)"
__date__ = "09/12/11"
__copyright__ = "(C) 2012 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact... | gpl-3.0 |
jaredkoontz/leetcode | Python/pascals-triangle-ii.py | 3 | 1608 | # Time: O(n^2)
# Space: O(1)
# Given an index k, return the kth row of the Pascal's triangle.
#
# For example, given k = 3,
# Return [1,3,3,1].
#
# Note:
# Could you optimize your algorithm to use only O(k) extra space?
#
class Solution:
# @return a list of integers
def getRow(self, rowIndex):
resu... | mit |
yjhjstz/gyp | test/cxxflags/gyptest-cxxflags.py | 128 | 1034 | #!/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.
"""
Verifies the use of the environment during regeneration when the gyp file
changes, specifically via build of an executable with C++ flag... | bsd-3-clause |
procangroup/edx-platform | lms/djangoapps/certificates/apis/v0/tests/test_views.py | 3 | 7233 | """
Tests for the Certificate REST APIs.
"""
from datetime import datetime, timedelta
from django.core.urlresolvers import reverse
from django.utils import timezone
from freezegun import freeze_time
from oauth2_provider import models as dot_models
from rest_framework import status
from rest_framework.test import APITe... | agpl-3.0 |
bgxavier/nova | nova/api/metadata/handler.py | 24 | 8773 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | apache-2.0 |
zhjunlang/kbengine | kbe/res/scripts/common/Lib/site-packages/pip/_vendor/html5lib/treeadapters/sax.py | 1835 | 1661 | from __future__ import absolute_import, division, unicode_literals
from xml.sax.xmlreader import AttributesNSImpl
from ..constants import adjustForeignAttributes, unadjustForeignAttributes
prefix_mapping = {}
for prefix, localName, namespace in adjustForeignAttributes.values():
if prefix is not None:
pre... | lgpl-3.0 |
jwenerd/SKTimeline | sktimeline/views/dashboard/twitter.py | 2 | 1613 | from sktimeline import *
from sktimeline.views import login_required, page_not_found
def hashtag_validator(form, field):
if field.data[0] != '#':
raise validators.ValidationError('Must start with #')
if len(field.data.split()) > 1:
raise validators.ValidationError('Enter only one hashtag')
... | mit |
garyp/sifter | sifter/comparator.py | 1 | 1168 | import sifter.handler
__all__ = ('register', 'get_match_fn',)
def register(comparator_name, comparator_cls):
sifter.handler.register('comparator', comparator_name, comparator_cls)
def get_match_fn(comparator, match_type):
# section 2.7.3: default comparator is 'i;ascii-casemap'
if comparator is None: com... | bsd-2-clause |
tcstewar/parser | fig1.py | 1 | 1991 | import pylab
pylab.figure(figsize=(6,4))
pylab.axes((0.1, 0.15, 0.85, 0.8))
xdata = [0, 0.05, 0.1, 0.15, 0.2, 0.25]
prob = [0.8460282942701628, 0.82180483919511071, 0.76707987722978233, 0.68378508230323654, 0.55306743181409768, 0.38986098204964698]
prob_ci = [[-0.014085009764384537, -0.018748421744134269, -0.02010080... | gpl-2.0 |
jendrikseipp/rednotebook | rednotebook/gui/customwidgets.py | 1 | 11381 | # -----------------------------------------------------------------------
# Copyright (c) 2009 Jendrik Seipp
#
# RedNotebook 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... | gpl-2.0 |
frohoff/Empire | lib/modules/powershell/privesc/getsystem.py | 2 | 4655 | from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-SiteListPassword',
'Author': ['@harmj0y', '@mattifestation'],
'Description': ("Gets SYSTEM privileges with one of two methods."),
'Background... | bsd-3-clause |
pombredanne/pyjs | tests/test-coverage.py | 6 | 3672 | #!/usr/bin/env python
import sys
class Coverage:
def __init__(self, testset_name):
self.testset_name = testset_name
self.lines = {}
def tracer(self, frame, event, arg):
lineno = frame.f_lineno
filename = frame.f_globals["__file__"]
if filename[-4:] in [".pyc", ".pyo"]... | apache-2.0 |
mzizzi/ansible | test/units/modules/system/test_known_hosts.py | 107 | 3840 | import os
import tempfile
from ansible.compat.tests import unittest
from ansible.module_utils._text import to_bytes
from ansible.modules.system.known_hosts import compute_diff
class KnownHostsDiffTestCase(unittest.TestCase):
def _create_file(self, content):
tmp_file = tempfile.NamedTemporaryFile(prefix... | gpl-3.0 |
tparks5/tor-stem | test/unit/descriptor/microdescriptor.py | 1 | 7493 | """
Unit tests for stem.descriptor.microdescriptor.
"""
import unittest
import stem.exit_policy
import stem.descriptor
from stem.util import str_type
from stem.descriptor.microdescriptor import Microdescriptor
from test.unit.descriptor import get_resource
FIRST_ONION_KEY = """\
-----BEGIN RSA PUBLIC KEY-----
MIGJ... | lgpl-3.0 |
kaoscoach/crits | crits/indicators/urls.py | 7 | 1184 | from django.conf.urls import patterns
urlpatterns = patterns('crits.indicators.views',
(r'^details/(?P<indicator_id>\w+)/$', 'indicator'),
(r'^search/$', 'indicator_search'),
(r'^upload/$', 'upload_indicator'),
(r'^add_action/$', 'new_indicator_action'),
(r'^remove/(?P<_id>[\S ]+)$', 'remove_indica... | mit |
stshine/servo | components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py | 241 | 1893 | def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface DuplicateQualifiers1 {
getter getter byte foo(unsigned long index);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have... | mpl-2.0 |
amaas-fintech/amaas-core-sdk-python | tests/unit/transactions/transaction.py | 3 | 8017 | from __future__ import absolute_import, division, print_function, unicode_literals
from amaasutils.random_utils import random_string
import copy
import json
import unittest
from amaascore.exceptions import TransactionNeedsSaving
from amaascore.transactions.children import Link, Party
from amaascore.transactions.trans... | apache-2.0 |
jagguli/flexmock | tests/flexmock_modern_test.py | 2 | 1451 | import flexmock
import sys
import unittest
class ModernClass(object):
"""Contains features only available in 2.6 and above."""
def test_context_manager_on_instance(self):
class CM(object):
def __enter__(self): pass
def __exit__(self, *_): pass
cm = CM()
flexmock(cm).should_call('__enter__')... | bsd-2-clause |
britcey/ansible | lib/ansible/modules/cloud/amazon/ecs_ecr.py | 51 | 11804 | #!/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 |
sgongar/Herschel-PACS-Toolbox-Red-Leak | massive/massive_aux.py | 1 | 2557 | from time import time
from datetime import datetime
from csv import reader
from string import uppercase
# coding = utf-8
#
# This file is part of Herschel Common Science System (HCSS).
# Copyright 2001-2013 Herschel Science Ground Segment Consortium
#
# HCSS is free software: you can redistribute it and/or modify
... | lgpl-3.0 |
sbtlaarzc/vispy | examples/benchmark/scene_test_2.py | 17 | 6029 | # -*- coding: utf-8 -*-
# vispy: testskip
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ----------------------------------------------------------------------------... | bsd-3-clause |
gsuresh92/mongo-connector | mongo_connector/command_helper.py | 33 | 2692 | # Copyright 2013-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | apache-2.0 |
jslvtr/FriendFinderBackend | src/db/database.py | 1 | 1287 | __author__ = 'jslvtr'
import pymongo
import pymongo.errors
class Database(object):
def __init__(self, uri):
client = pymongo.MongoClient(uri)
self.db = client.get_default_database()
self.collection = None
def insert(self, data):
if self.collection is not None:
sel... | mit |
hnakamur/django | tests/test_client_regress/urls.py | 352 | 2521 | from django.conf.urls import include, url
from django.views.generic import RedirectView
from . import views
urlpatterns = [
url(r'', include('test_client.urls')),
url(r'^no_template_view/$', views.no_template_view),
url(r'^staff_only/$', views.staff_only_view),
url(r'^get_view/$', views.get_view),
... | bsd-3-clause |
balloob/home-assistant | tests/components/homekit/test_type_cameras.py | 7 | 24940 | """Test different accessory types: Camera."""
from uuid import UUID
from pyhap.accessory_driver import AccessoryDriver
import pytest
from homeassistant.components import camera, ffmpeg
from homeassistant.components.homekit.accessories import HomeBridge
from homeassistant.components.homekit.const import (
AUDIO_C... | apache-2.0 |
etsinko/oerplib | tests/test_session.py | 2 | 3342 | # -*- coding: UTF-8 -*-
try:
import unittest2 as unittest
except:
import unittest
import tempfile
import os
from args import ARGS
import oerplib
class TestSession(unittest.TestCase):
def setUp(self):
self.oerp = oerplib.OERP(
ARGS.server, protocol=ARGS.protocol, port=ARGS.port,
... | lgpl-3.0 |
codeb2cc/tornado | tornado/test/asyncio_test.py | 107 | 2520 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | apache-2.0 |
PyORBIT-Collaboration/py-orbit | py/orbit/py_linac/lattice/LinacRfGapNodes.py | 2 | 33066 | """
This package is a collection of the RF gap node implementations.
The RF Cavities and gaps in them are different from the ring RF.
"""
import os
import math
import sys
#---- MPI module function and classes
import orbit_mpi
from orbit_mpi import mpi_comm
from orbit_mpi import mpi_datatype
from orbit_mpi import mpi_... | mit |
krvss/django-social-auth | social_auth/db/mongoengine_models.py | 2 | 3328 | """
MongoEngine models for Social Auth
Requires MongoEngine 0.6.10
"""
try:
from django.contrib.auth.hashers import UNUSABLE_PASSWORD
_ = UNUSABLE_PASSWORD # to quiet flake
except (ImportError, AttributeError):
UNUSABLE_PASSWORD = '!'
from django.db.models import get_model
from django.utils.importlib imp... | bsd-3-clause |
glibersat/firmware | platform/spark/firmware/user/tests/app/rsakeygen/verify_keys.py | 14 | 1408 | #!/usr/bin/env python
import sys
import os
import subprocess
def usage():
print '%s [input_file or tty]' % (sys.argv[0])
if len(sys.argv) != 2:
usage()
sys.exit(1)
f = open(sys.argv[1], 'r')
i = -1
def hex2bin(hex):
return hex.decode('hex')
def run(cmd, stdin):
p = subprocess.Popen(cmd, stdout=... | agpl-3.0 |
mancoast/CPythonPyc_test | cpython/276_test_univnewlines2k.py | 136 | 3848 | # Tests universal newline support for both reading and parsing files.
import unittest
import os
import sys
from test import test_support
if not hasattr(sys.stdin, 'newlines'):
raise unittest.SkipTest, \
"This Python does not have universal newline support"
FATX = 'x' * (2**14)
DATA_TEMPLATE = [
"line... | gpl-3.0 |
Shaps/ansible | test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/netconf.py | 47 | 13891 | # (c) 2016 Red Hat Inc.
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """author: Ansible Networking Team
connection: netconf
short_descriptio... | gpl-3.0 |
tqchen/tvm | tutorials/get_started/relay_quick_start.py | 1 | 5928 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
CheckYourScreen/Arsenic.Kernel_onyx-oos | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 12980 | 5411 | # SchedGui.py - Python extension for perf script, basic GUI code for
# traces drawing and overview.
#
# Copyright (C) 2010 by Frederic Weisbecker <fweisbec@gmail.com>
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
... | gpl-2.0 |
Greennut/ostproject | 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... | bsd-3-clause |
Lawrence-Liu/scikit-learn | sklearn/metrics/base.py | 231 | 4378 | """
Common code for all metrics
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Arnaud Joly <a.joly@ulg.ac.be>
# Jochen Wersdorfer <jochen@wersdoerfer.de>
# Lars Buitinck ... | bsd-3-clause |
oasiswork/odoo | addons/hr_payroll/hr_payroll.py | 144 | 49776 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... | agpl-3.0 |
laurentgo/pants | src/python/pants/base/build_file_aliases.py | 8 | 3196 | # 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 functools
fro... | apache-2.0 |
sublime1809/django | django/views/debug.py | 17 | 46756 | from __future__ import unicode_literals
import datetime
import os
import re
import sys
import types
from django.conf import settings
from django.core.urlresolvers import resolve, Resolver404
from django.http import (HttpResponse, HttpResponseNotFound, HttpRequest,
build_request_repr)
from django.template import T... | bsd-3-clause |
mxOBS/deb-pkg_trusty_chromium-browser | tools/telemetry/telemetry/decorators_unittest.py | 20 | 2837 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry import decorators
class FakePlatform(object):
def GetOSName(self):
return 'os_name'
def GetOSVersionName(self):
... | bsd-3-clause |
mxOBS/deb-pkg_trusty_chromium-browser | tools/site_compare/operators/equals_with_mask.py | 189 | 1589 | # Copyright (c) 2011 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.
"""Compare two images for equality, subject to a mask."""
from PIL import Image
from PIL import ImageChops
import os.path
def Compare(file1, file2, *... | bsd-3-clause |
jaceknl6666/arxiv-server | arxiv/oai.py | 1 | 3871 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["download", "xml_to_json"]
import re
import time
import logging
import requests
import xml.etree.cElementTree as ET
# Download constants
resume_re = re.compile(r".*<resumptionToken.*?>(.*?)</resumptionToken>.*")
url = "http://export.... | mit |
geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/tools/grit/grit/node/message_unittest.py | 7 | 4021 | #!/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.
'''Unit tests for grit.node.message'''
import os
import sys
import unittest
import StringIO
if __name__ == '__main__':
# When ... | gpl-3.0 |
darjus-amzn/boto | boto/vpc/vpc.py | 135 | 7868 | # Copyright (c) 2009-2010 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... | mit |
Shaswat27/scipy | scipy/weave/tests/test_blitz_tools.py | 91 | 7141 | from __future__ import absolute_import, print_function
import time
import parser
import warnings
from numpy import (float32, float64, complex64, complex128,
zeros, random, array)
from numpy.testing import (TestCase, assert_equal,
assert_allclose, run_module_suite)
from ... | bsd-3-clause |
SimVascular/VTK | ThirdParty/Twisted/twisted/protocols/ftp.py | 23 | 101280 | # -*- test-case-name: twisted.test.test_ftp -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An FTP protocol implementation
"""
# System Imports
import os
import time
import re
import operator
import stat
import errno
import fnmatch
try:
import pwd, grp
except ImportError:
pwd ... | bsd-3-clause |
MihaiMoldovanu/ansible | lib/ansible/modules/network/layer3/net_l3_interface.py | 96 | 2074 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
sarahfo/oppia | core/platform/transactions/gae_transaction_services.py | 33 | 1124 | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | apache-2.0 |
kkk669/mxnet | python/mxnet/monitor.py | 46 | 5239 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
rwillmer/django | tests/utils_tests/test_datetime_safe.py | 207 | 2371 | import unittest
from datetime import (
date as original_date, datetime as original_datetime,
time as original_time,
)
from django.utils.datetime_safe import date, datetime, time
class DatetimeTests(unittest.TestCase):
def setUp(self):
self.just_safe = (1900, 1, 1)
self.just_unsafe = (189... | bsd-3-clause |
dantagg/awsbackup | awsbackup/__main__.py | 1 | 4227 | from __future__ import absolute_import, division, print_function
import os
from jinja2 import Environment, PackageLoader
import click
import boto3
from botocore.client import ClientError
DEFAULT_AWS_PROFILE = 'default'
DEFAULT_BACKUP_CREDENTIAL_FILE = 'credentials'
env = Environment(loader=PackageLoader('awsbackup',... | mit |
Astroua/TurbuStat | turbustat/statistics/pdf/compare_pdf.py | 2 | 30563 | # Licensed under an MIT open source license - see LICENSE
from __future__ import print_function, absolute_import, division
import numpy as np
from scipy.stats import ks_2samp, lognorm # , anderson_ksamp
from statsmodels.distributions.empirical_distribution import ECDF
from statsmodels.base.model import GenericLikelih... | mit |
mijkenator/stellar | test/user.py | 1 | 2169 | #!/usr/bin/python3
import requests
s = requests.Session()
#url = "http://127.0.0.1:8080"
url = "http://52.76.131.184/_mijkweb/user"
#payload = {'request' : '{"type":"signup", "login":"mijkenator@gmail.com", "password":"test"}'}
#r = s.post(url, data=payload)
#print(r.text)
#exit(0)
#payload = {'request' : '{"type"... | bsd-3-clause |
hellckt/micblog | app/models.py | 1 | 14065 | # -*- coding:utf-8 -*-
from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from markdown import markdown
import bleach
from flask import current_app, request, url_for
from flask.ext... | mit |
rezib/cloubed-deb | cloubed/DomainNetif.py | 1 | 1927 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Rémi Palancher
#
# This file is part of Cloubed.
#
# Cloubed is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the L... | lgpl-3.0 |
scue/vim-ycm_win7 | third_party/ycmd/third_party/jedi/test/test_jedi_system.py | 30 | 1866 | """
Test the Jedi "System" which means for example to test if imports are
correctly used.
"""
import os
import inspect
import jedi
def test_settings_module():
"""
jedi.settings and jedi.cache.settings must be the same module.
"""
from jedi import cache
from jedi import settings
assert cache.... | gpl-3.0 |
blackzw/openwrt_sdk_dev1 | staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/python2.7/test/test_pkgutil.py | 112 | 4651 | from test.test_support import run_unittest
import unittest
import sys
import imp
import pkgutil
import os
import os.path
import tempfile
import shutil
import zipfile
class PkgutilTests(unittest.TestCase):
def setUp(self):
self.dirname = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, self.dirn... | gpl-2.0 |
simonwydooghe/ansible | lib/ansible/modules/cloud/vmware/vmware_host_ntp.py | 18 | 15765 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# Copyright: (c) 2018, Christian Kotte <christian.kotte@gmx.de>
# 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_f... | gpl-3.0 |
davelab6/nototools | nototools/chart/chart.py | 8 | 4094 | #!/usr/bin/python
import sys
import cairo
import pycairoft
from fontTools import ttLib
def clamp(x, Min, Max):
return max(Min, min(Max, x))
class Color:
def __init__(self, rgb):
self.rgb = rgb
def __repr__(self):
return 'Color(%g,%g,%g)' % self.rgb
def __str__(self):
return "#%02X%02X%02X" % tuple(int(2... | apache-2.0 |
CubicERP/geraldo | site/newsite/site-geraldo/django/core/management/commands/compilemessages.py | 25 | 2431 | import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
try:
set
except NameError:
from sets import Set as set # For Python 2.3
def compile_messages(locale=None):
basedirs = [os.path.join('conf', 'locale'), 'locale']
if os.environ.get... | lgpl-3.0 |
tetherless-world/graphene | whyis/autonomic/dataset_importer.py | 2 | 1223 | from builtins import str
import sadi
import rdflib
import setlr
from datetime import datetime
from .update_change_service import UpdateChangeService
from nanopub import Nanopublication
from datastore import create_id
import flask
from flask import render_template
from flask import render_template_string
import logging... | apache-2.0 |
cloudbase/nova | nova/db/sqlalchemy/migrate_repo/versions/346_remove_scheduled_at_column.py | 13 | 1120 | # Copyright 2016 Intel Corporation
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
yewang15215/django | tests/aggregation_regress/models.py | 282 | 3288 | # -*- coding: utf-8 -*-
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Author(models.Mode... | bsd-3-clause |
dahlstrom-g/intellij-community | plugins/hg4idea/testData/bin/mercurial/demandimport.py | 94 | 5252 | # demandimport.py - global demand-loading of modules for Mercurial
#
# Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''
demandimport - automatic demandloading of modules
To e... | apache-2.0 |
UdK-VPT/Open_eQuarter | mole3/extensions/eval_present_heritage/oeq_UPH_Roof.py | 2 | 2202 | # -*- coding: utf-8 -*-
import os,math
from qgis.core import NULL
from mole3 import oeq_global
from mole3.project import config
from mole3.extensions import OeQExtension
from mole3.stat_corr import rb_present_roof_uvalue_AVG_by_building_age_lookup, nrb_present_roof_uvalue_by_building_age_lookup, rb_contemporary_roof_u... | gpl-2.0 |
imiolek-ireneusz/pysiogame | i18n/custom/da.py | 1 | 11670 | # -*- coding: utf-8 -*-
# FAO Translators:
# First of all thank you for your interest in translating this game,
# I will be grateful if you could share it with the community -
# if possible please send it back to my email, and I'll add it to the next version.
# The translation does not have to be exact as long as it ... | gpl-3.0 |
airanmehr/bio | Scripts/Miscellaneous/Ali/run.py | 1 | 2293 |
plt.switch_backend('TkAgg')
mng = plt.get_current_fig_manager()
from matplotlib.backends.backend_pdf import PdfPages
if __name__ == '__main__':
with PdfPages('/home/arya/sim2.pdf') as pdf:
for iii in range(100):
fig=plt.figure(figsize=(20,20), dpi=100)
print iii
freq=0.... | mit |
szymonm/flask | tests/test_deprecations.py | 149 | 1278 | # -*- coding: utf-8 -*-
"""
tests.deprecations
~~~~~~~~~~~~~~~~~~
Tests deprecation support. Not used currently.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import flask
class TestRequestDeprecation(object):
def test_request_json(... | bsd-3-clause |
174high/bitcoin | contrib/seeds/generate-seeds.py | 55 | 4341 | #!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... | mit |
eleme/thriftpy | setup.py | 1 | 3334 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
import platform
from os.path import join, dirname
from setuptools import setup, find_packages
from setuptools.extension import Extension
with open(join(dirname(__file__), 'thriftpy', '__init__.py'), 'r') as f:
version = re.match(r".*__version__ ... | mit |
gramps-project/gramps | gramps/plugins/tool/eventcmp.py | 4 | 16453 | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | gpl-2.0 |
Sprytile/Sprytile | rx/linq/observable/catch.py | 2 | 3844 | from rx.core import Observable, AnonymousObservable, Disposable
from rx.disposables import SingleAssignmentDisposable, \
CompositeDisposable, SerialDisposable
from rx.concurrency import current_thread_scheduler
from rx.internal import Enumerable
from rx.internal import extensionmethod, extensionclassmethod
def ca... | mit |
Djlavoy/scrapy | scrapy/xlib/pydispatch/dispatcher.py | 23 | 16963 | """Multiple-producer-multiple-consumer signal-dispatching
dispatcher is the core of the PyDispatcher system,
providing the primary API and the core logic for the
system.
Module attributes of note:
Any -- Singleton used to signal either "Any Sender" or
"Any Signal". See documentation of the _Any class.
... | bsd-3-clause |
redhat-openstack/python-openstackclient | openstackclient/network/utils.py | 2 | 1562 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | apache-2.0 |
paweljasinski/ironpython3 | Src/StdLib/Lib/test/test_quopri.py | 171 | 7715 | from test import support
import unittest
import sys, os, io, subprocess
import quopri
ENCSAMPLE = b"""\
Here's a bunch of special=20
=A1=A2=A3=A4=A5=A6=A7=A8=A9
=AA=AB=AC=AD=AE=AF=B0=B1=B2=B3
=B4=B5=B6=B7=B8=B9=BA=BB=BC=BD=BE
=BF=C0=C1=C2=C3=C4=C5=C6
=C7=C8=C9=CA=CB=CC=CD=CE=CF
=D0=D1=D2=D3=D4=D5=D6=D7
=D8=D9=DA=D... | apache-2.0 |
cfehring/slack-onnow | requests/packages/chardet/latin1prober.py | 1778 | 5232 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | gpl-3.0 |
erigones/esdc-ce | api/mon/node/views.py | 1 | 5641 | from api.decorators import api_view, request_data_defaultdc, setting_required
from api.permissions import IsSuperAdmin
from api.mon.node.api_views import NodeSLAView, NodeHistoryView
__all__ = ('mon_node_sla', 'mon_node_history')
#: node_status: GET: Node.STATUS_AVAILABLE_MONITORING
@api_view(('GET',))
@request_da... | apache-2.0 |
o5k/openerp-oemedical-v0.1 | openerp/addons/account_check_writing/wizard/account_check_batch_printing.py | 54 | 3821 | # -*- 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 |
wa3l/mailr | mailr.py | 1 | 2140 | import os, flask
from helpers import *
from validation import Validator
from email_model import db, Email
from flask.ext.httpauth import HTTPBasicAuth
from sqlalchemy.exc import DatabaseError
from os import environ
app = flask.Flask(__name__)
auth = HTTPBasicAuth()
env = environ['MAILR_ENV'] if environ.has_key('MAIL... | mit |
benfinkelcbt/CPD200 | CPD200-Lab07-Python/googleapiclient/sample_tools.py | 89 | 4047 | # Copyright 2014 Google 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 required by applicable law or ... | gpl-3.0 |
archf/ansible | lib/ansible/modules/cloud/azure/azure.py | 8 | 24174 | #!/usr/bin/python
#
# Copyright (c) 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 |
zooko/egtp_new | egtp/EGTPConstants.py | 1 | 1283 | # Copyright (c) 2001 Autonomous Zone Industries
# Copyright (c) 2002 Bryce "Zooko" Wilcox-O'Hearn
# This file is licensed under the
# GNU Lesser General Public License v2.1.
# See the file COPYING or visit http://www.gnu.org/ for details.
__revision__ = "$Id: EGTPConstants.py,v 1.2 2002/12/02 19:58:47 myers_c... | lgpl-2.1 |
jounex/hue | desktop/core/ext-py/Django-1.6.10/tests/file_uploads/tests.py | 37 | 16007 | #! -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import base64
import errno
import hashlib
import json
import os
import shutil
import tempfile as sys_tempfile
from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http.... | apache-2.0 |
stefanbraun-private/pyVisiToolkit | src/misc/Visi_Snake.py | 1 | 4382 | #!/usr/bin/env python
# encoding: utf-8
"""
misc.Visi_Snake.py
"Snake"-game implemented in ProMos NT(c).
Based on code from https://gist.github.com/sanchitgangwar/2158089
with special thanks to Sanchit Gangwar | https://github.com/sanchitgangwar
notes:
-textfields in GE can simulate a character-based display:
-font... | gpl-3.0 |
vikatory/kbengine | kbe/src/lib/python/Lib/sysconfig.py | 84 | 24509 | """Access to Python's configuration information."""
import os
import sys
from os.path import pardir, realpath
__all__ = [
'get_config_h_filename',
'get_config_var',
'get_config_vars',
'get_makefile_filename',
'get_path',
'get_path_names',
'get_paths',
'get_platform',
'get_python_ve... | lgpl-3.0 |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/numpy/lib/tests/test_financial.py | 57 | 6779 | from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import (
run_module_suite, TestCase, assert_, assert_almost_equal,
assert_allclose, assert_equal
)
class TestFinancial(TestCase):
def test_rate(self):
assert_almost_equal(np.rate(10, 0, -350... | gpl-3.0 |
jeffmahoney/supybot | plugins/URL/config.py | 9 | 2464 | ###
# Copyright (c) 2005, Jeremiah Fincher
# 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 conditi... | bsd-3-clause |
kholidfu/django | tests/urlpatterns_reverse/namespace_urls.py | 109 | 2555 | from django.conf.urls import include, url
from . import views
from .tests import URLObject
testobj1 = URLObject('testapp', 'test-ns1')
testobj2 = URLObject('testapp', 'test-ns2')
default_testobj = URLObject('testapp', 'testapp')
otherobj1 = URLObject('nodefault', 'other-ns1')
otherobj2 = URLObject('nodefault', 'othe... | bsd-3-clause |
pcrews/kewpie | xtrabackup_disabled/bug810269_test.py | 24 | 6930 | #! /usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2011 Patrick Crews
#
#
# 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 Softwar... | apache-2.0 |
synologix/enigma2 | lib/python/Components/TunerInfo.py | 63 | 4265 | from GUIComponent import GUIComponent
from enigma import eLabel, eSlider, iFrontendInformation
from math import log
class TunerInfo(GUIComponent):
SNR = 0
SNR_DB = 1
AGC = 2
BER = 3
SNR_PERCENTAGE = 0
AGC_PERCENTAGE = 2
BER_VALUE = 3
SNR_BAR = 4
AGC_BAR = 5
BER_BAR = 6
LOCK_STATE = 7
SYNC_STATE = 8
LOCK... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.