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 |
|---|---|---|---|---|---|
kant/inasafe | safe/metadata/test/test_hazard_metadata.py | 8 | 1391 | # coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**Exception Classes.**
Custom exception classes for the IS application.
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Publi... | gpl-3.0 |
Moriadry/tensorflow | tensorflow/contrib/metrics/python/metrics/classification_test.py | 125 | 4623 | # 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 |
Distrotech/clamav | contrib/phishing/regex_opt.py | 14 | 1170 | #!/usr/bin/env python
def strlen(a,b):
if len(a)<len(b):
return -1;
elif len(a)>len(b):
return 1;
else:
return 0;
def getcommon_prefix(a,b):
if a==b:
return b;
if a[:-1]==b[:-1]:
return a[:-1];
else:
return ""
fil = file("iana_tld.h")
left = fil.read().split("(")
out=[]
for i in range(1,len(left)):
... | gpl-2.0 |
shakamunyi/tensorflow | tensorflow/python/ops/tensor_array_grad.py | 71 | 9083 | # 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 |
latenitefilms/hammerspoon | scripts/docs/bin/build_docs.py | 2 | 29809 | #!/usr/bin/env -S -P/usr/bin:${PATH} python3
# -*- coding: utf-8 -*-
"""Hammerspoon API Documentation Builder"""
import argparse
import json
import os
import pprint
import sqlite3
import sys
import re
DEBUG = False
FAIL_ON_WARN = True
HAS_WARNED = False
LINT_MODE = False
LINTS = []
CHUNK_FILE = 0
CHUNK_LINE = 1
CH... | mit |
TeachAtTUM/edx-platform | common/djangoapps/track/backends/logger.py | 26 | 1508 | """Event tracker backend that saves events to a python logger."""
from __future__ import absolute_import
import json
import logging
from django.conf import settings
from track.backends import BaseBackend
from track.utils import DateTimeJSONEncoder
log = logging.getLogger('track.backends.logger')
application_log = ... | agpl-3.0 |
morlandi/django-permissions | permissions/models.py | 1 | 6596 | # django imports
from django.db import models
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
# permissions i... | bsd-3-clause |
seberg/numpy | benchmarks/benchmarks/bench_reduce.py | 11 | 1723 | from .common import Benchmark, TYPES1, get_squares
import numpy as np
class AddReduce(Benchmark):
def setup(self):
self.squares = get_squares().values()
def time_axis_0(self):
[np.add.reduce(a, axis=0) for a in self.squares]
def time_axis_1(self):
[np.add.reduce(a, axis=1) for a... | bsd-3-clause |
hopeall/odoo | openerp/tools/mail.py | 125 | 29474 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2012-TODAY OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
brkrishna/freelance | univs/archives/snc_edu.py | 1 | 3105 | # -- coding: utf-8 --
#-------------------------------------------------------------------------------
# Name: snc_edu
# Purpose: St. Norbert College
#
# Author: Ramakrishna
#
# Dated: 07/Apr/2016
# Copyright: (c) Ramakrishna 2016
# Licence: <your licence>
#----------------------------... | gpl-2.0 |
Bforartists/scons | scons-local/SCons/Tool/BitKeeper.py | 7 | 2433 | """SCons.Tool.BitKeeper.py
Tool-specific initialization for the BitKeeper source code control
system.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Pe... | mit |
stanta/darfchain | darfchain_docker/tests/web/test_blocks.py | 3 | 5828 | import pytest
from bigchaindb.models import Transaction
BLOCKS_ENDPOINT = '/api/v1/blocks/'
@pytest.mark.bdb
@pytest.mark.usefixtures('inputs')
def test_get_block_endpoint(b, client):
tx = Transaction.create([b.me], [([b.me], 1)])
tx = tx.sign([b.me_private])
block = b.create_block([tx])
b.write_bl... | gpl-3.0 |
javilonas/NCam | cross/android-toolchain/lib/python2.7/hmac.py | 253 | 4531 | """HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
"""
import warnings as _warnings
trans_5C = "".join ([chr (x ^ 0x5C) for x in xrange(256)])
trans_36 = "".join ([chr (x ^ 0x36) for x in xrange(256)])
# The size of the digests returned by HMAC ... | gpl-3.0 |
shawnadelic/shuup | shuup/customer_group_pricing/admin_form_part.py | 2 | 4175 | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django import forms
from djang... | agpl-3.0 |
tejasnikumbh/ThesisCode | lib/python2.7/site-packages/numpy/core/tests/test_arrayprint.py | 69 | 6858 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy.testing import *
from numpy.compat import sixu
class TestArrayRepr(object):
def test_nan_inf(self):
x = np.array([np.nan, np.inf])
assert_equal(repr(x... | mit |
jyr/opentumblr | simplejson/decoder.py | 317 | 12404 | """Implementation of JSONDecoder
"""
import re
import sys
import struct
from simplejson.scanner import make_scanner
try:
from simplejson._speedups import scanstring as c_scanstring
except ImportError:
c_scanstring = None
__all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconst... | mit |
metacloud/python-keystoneclient | keystoneclient/tests/v3/test_projects.py | 3 | 2261 | # 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 t... | apache-2.0 |
aYukiSekiguchi/ACCESS-Chromium | tools/valgrind/asan/chrome_tests.py | 1 | 17088 | #!/usr/bin/env python
# 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.
''' Runs various chrome tests through asan_test.py.
Most of this code is copied from ../valgrind/chrome_tests.py.
TODO(glider): pu... | bsd-3-clause |
tangjonathan/HKQuiz | node_modules/pryjs/node_modules/pygmentize-bundled/vendor/pygments/build-3.3/pygments/filters/__init__.py | 59 | 11588 | # -*- coding: utf-8 -*-
"""
pygments.filters
~~~~~~~~~~~~~~~~
Module containing filter lookup functions and default
filters.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.token import String, Comment, Ke... | mit |
marc-sensenich/ansible | lib/ansible/modules/network/fortios/fortios_firewall_vip46.py | 7 | 15899 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2018 Fortinet, Inc.
#
# 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 Lic... | gpl-3.0 |
naousse/odoo | openerp/report/int_to_text.py | 442 | 2641 | # -*- 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 |
tboyce021/home-assistant | tests/components/calendar/test_init.py | 21 | 1455 | """The tests for the calendar component."""
from datetime import timedelta
from homeassistant.bootstrap import async_setup_component
import homeassistant.util.dt as dt_util
async def test_events_http_api(hass, hass_client):
"""Test the calendar demo view."""
await async_setup_component(hass, "calendar", {"ca... | apache-2.0 |
nuclear-wizard/moose | python/mooseutils/VectorPostprocessorReader.py | 6 | 5970 | #* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
import os
i... | lgpl-2.1 |
Russell-IO/ansible | test/units/modules/network/f5/test_bigip_pool_member.py | 17 | 11584 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip imp... | gpl-3.0 |
eckardm/archivematica | src/MCPClient/lib/clientScripts/generateDIPFromAIPGenerateDIP.py | 1 | 2639 | #!/usr/bin/env python2
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica 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, ... | agpl-3.0 |
angyukai/boulderactive2016-landing-page | node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py | 1509 | 17165 | # Copyright (c) 2013 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.
"""Handle version information related to Visual Stuio."""
import errno
import os
import re
import subprocess
import sys
import gyp
import glob
class VisualStudi... | mit |
razor-x/scipy-data_fitting | scipy_data_fitting/model.py | 1 | 7085 | import functools
import sympy
class Model:
"""
A model organizes symbols, expressions and replacements rules by name.
Example:
#!python
>>> model = Model()
>>> model.add_symbols('y', 'x', 'm', 'b')
>>> y, m, x, b = model.get_symbols('y', 'x', 'm', 'b')
>>> model.ex... | mit |
simonkuang/grpc | tools/run_tests/performance/massage_qps_stats.py | 25 | 28679 | # Copyright 2017 gRPC authors.
#
# 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 |
adrienbrault/home-assistant | tests/components/netatmo/test_media_source.py | 13 | 2552 | """Test Local Media Source."""
import ast
import pytest
from homeassistant.components import media_source
from homeassistant.components.media_source import const
from homeassistant.components.media_source.models import PlayMedia
from homeassistant.components.netatmo import DATA_CAMERAS, DATA_EVENTS, DOMAIN
from homea... | mit |
Zhongqilong/mykbengineer | kbe/src/lib/python/PCbuild/build_ssl.py | 30 | 9208 | # Script for building the _ssl and _hashlib modules for Windows.
# Uses Perl to setup the OpenSSL environment correctly
# and build OpenSSL, then invokes a simple nmake session
# for the actual _ssl.pyd and _hashlib.pyd DLLs.
# THEORETICALLY, you can:
# * Unpack the latest SSL release one level above your main Python ... | lgpl-3.0 |
hehongliang/tensorflow | tensorflow/python/distribute/shared_variable_creator.py | 45 | 3938 | # Copyright 2018 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 |
pleaseproject/python-for-android | python-modules/twisted/twisted/conch/test/test_openssh_compat.py | 60 | 3381 | # Copyright (c) 2001-2008 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.conch.openssh_compat}.
"""
import os
from twisted.trial.unittest import TestCase
from twisted.python.filepath import FilePath
from twisted.python.compat import set
try:
import Crypto.Cipher.DES3
import ... | apache-2.0 |
photoninger/ansible | lib/ansible/modules/monitoring/circonus_annotation.py | 89 | 7162 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2014-2015, 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
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
jlowin/airflow | scripts/perf/scheduler_ops_metrics.py | 30 | 6536 | # -*- coding: utf-8 -*-
#
# 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, softw... | apache-2.0 |
eminence/Minecraft-Overviewer | overviewer_core/cache.py | 6 | 5470 | # This file is part of the Minecraft Overviewer.
#
# Minecraft Overviewer is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version... | gpl-3.0 |
vladimir-ipatov/ganeti | lib/workerpool.py | 7 | 18694 | #
#
# Copyright (C) 2008, 2009, 2010 Google Inc.
#
# 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 your option) any later version.
#
# This program is ... | gpl-2.0 |
thiagomg/experiments | math/question.py | 4 | 2911 | import sys
#compatibility
try: input = raw_input
except NameError: pass
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
colors = {
'GREEN': bcolors.OKGRE... | mit |
info-labs/owlbot | owlbot/tests/test_secrets.py | 1 | 4149 | """Test the secrets module.
As most of the functions in secrets are thin wrappers around functions
defined elsewhere, we don't need to test them exhaustively.
"""
from ..pep506 import secrets
import unittest
import string
# For Python 2/3 compatibility.
try:
unicode
except NameError:
# Python 3.
unicode... | gpl-3.0 |
vijaylbais/boto | boto/rds/statusinfo.py | 180 | 2011 | # Copyright (c) 2013 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... | mit |
nE0sIghT/pcsx2 | 3rdparty/wxwidgets3.0/src/msw/wince/clean_vcp.py | 45 | 1324 | '''
This script will delete dependences from *.vcp files.
After using this script, next time when you will try to save project,
you will have wait until 'Visual Tools' will rebuild all dependencies
and this process might take HUGE amount of time
Author : Viktor Voroshylo
'''
__version__='$Revision$'[11:-2]
import sys... | gpl-2.0 |
alaski/nova | nova/tests/unit/objects/test_hv_spec.py | 46 | 2308 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | apache-2.0 |
snbueno/blivet | blivet/devices/disk.py | 2 | 21440 | # devices/disk.py
# Classes to represent various types of disk-like devices.
#
# Copyright (C) 2009-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your op... | gpl-2.0 |
WQuanfeng/wagtail | wagtail/contrib/wagtailapi/utils.py | 13 | 1299 | from django.conf import settings
from django.utils.six.moves.urllib.parse import urlparse
from wagtail.wagtailcore.models import Page
class BadRequestError(Exception):
pass
class URLPath(object):
"""
This class represents a URL path that should be converted to a full URL.
It is used when the domai... | bsd-3-clause |
ruiting/opencog | opencog/python/pln_old/examples/deduction/deduction_example.py | 32 | 2889 | """
PLN Deduction Example
Demonstrates how to run the example in deduction_agent.py when
when interacting with PLN from a standalone Python environment
for development or testing purposes. The normal use case is to
run the example from the CogServer, for which you should use
deduction_agent.py instead.
"""
from __fut... | agpl-3.0 |
kohnle-lernmodule/exeLearningPlus1_04 | twisted/pb/test/test_pb.py | 14 | 42742 |
import gc
import sys, re
from twisted.python import log
#log.startLogging(sys.stderr)
from zope.interface import implements, implementsOnly, implementedBy
from twisted.python import components, failure, reflect
from twisted.internet import reactor, defer
from twisted.trial import unittest
from twisted.internet.main ... | gpl-2.0 |
vimeworks/ImpaQto | coworkersimpaqto/models.py | 1 | 4211 | from django.db import models
from django.template.defaultfilters import default
# Create your models here.
class Membresia(models.Model):
MODALIDAD_CHOICES=(
#('D','Diario'),
('M','Mensual'),
#('S','Semestral'),
#('A','Anual'),
)
STATE_CHOICES=(
('A','Activo'),
... | mit |
cloudbase/nova | nova/tests/unit/api_samples_test_base/test_compare_result.py | 10 | 16266 | # Copyright 2015 HPE, 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 t... | apache-2.0 |
akiss77/servo | etc/ci/performance/test_differ.py | 77 | 1744 | #!/usr/bin/env python3
# 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 argparse
import json
parser = argparse.ArgumentParser(description="Diff between two run... | mpl-2.0 |
legendtang/mitmproxy | libmproxy/main.py | 11 | 3548 | from __future__ import print_function, absolute_import
import os
import signal
import sys
import netlib.version
import netlib.version_check
from . import version, cmdline
from .proxy import process_proxy_options, ProxyServerError
from .proxy.server import DummyServer, ProxyServer
def assert_utf8_env():
spec = ""
... | mit |
chugunovyar/factoryForBuild | env/lib/python2.7/site-packages/rest_framework/serializers.py | 3 | 60354 | """
Serializers and ModelSerializers are similar to Forms and ModelForms.
Unlike forms, they are not constrained to dealing with HTML output, and
form encoded input.
Serialization in REST framework is a two-phase process:
1. Serializers marshal between complex types like model instances, and
python primitives.
2. The... | gpl-3.0 |
LTD-Beget/sprutio-rpc | lib/FileManager/workers/webdav/moveFromWebDav.py | 1 | 7786 | import os
import shutil
import threading
import time
import traceback
from lib.FileManager.FM import REQUEST_DELAY
from lib.FileManager.WebDavConnection import WebDavConnection
from lib.FileManager.workers.baseWorkerCustomer import BaseWorkerCustomer
class MoveFromWebDav(BaseWorkerCustomer):
def __init__(self, s... | gpl-3.0 |
tszym/ansible | lib/ansible/module_utils/cloud.py | 3 | 8468 | #
# (c) 2016 Allen Sanabria, <asanabria@linuxdynasty.org>
#
# 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... | gpl-3.0 |
demarle/VTK | ThirdParty/Twisted/twisted/trial/__init__.py | 60 | 2053 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
# Maintainer: Jonathan Lange
"""
Asynchronous unit testing framework.
Trial extends Python's builtin C{unittest} to provide support for asynchronous
tests.
Maintainer: Jonathan Lange
Trial strives to be compatible with other Python xUnit test... | bsd-3-clause |
mrshelly/openerp71313 | openerp/addons/purchase_analytic_plans/__init__.py | 441 | 1220 | # -*- 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... | agpl-3.0 |
rlindner81/pyload | module/plugins/crypter/RelinkUs.py | 1 | 11552 | # -*- coding: utf-8 -*-
from __future__ import with_statement
import binascii
import re
import Crypto.Cipher.AES
from module.plugins.captcha.SolveMedia import SolveMedia
from module.plugins.internal.Captcha import Captcha
from module.plugins.internal.Crypter import Crypter
from module.plugins.internal.misc import fs... | gpl-3.0 |
uw-it-aca/canvas-analytics | data_aggregator/tests/test_cache.py | 1 | 1187 | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import unittest
from django.test import TestCase
from data_aggregator.cache import DataAggregatorGCSCache
class TestDataAggregatorGCSCache(TestCase):
def test_get_cache_expiration_time(self):
cache = DataAggregatorGCS... | apache-2.0 |
benob/icsisumm | icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk_contrib/stringcomp.py | 9 | 4452 | # Natural Language Toolkit
# String Comparison Module
# Author: Tiago Tresoldi <tresoldi@users.sf.net>
"""
String Comparison Module.
Author: Tiago Tresoldi <tresoldi@users.sf.net>
Based on previous work by Qi Xiao Yang, Sung Sam Yuan, Li Zhao, Lu Chun,
and Sung Peng.
"""
def stringcomp (fx, fy):
"""
Return a... | gpl-3.0 |
hkawasaki/kawasaki-aio8-1 | common/djangoapps/util/views.py | 3 | 8888 | import json
import logging
import sys
from django.conf import settings
from django.core.validators import ValidationError, validate_email
from django.views.decorators.csrf import requires_csrf_token
from django.views.defaults import server_error
from django.http import (Http404, HttpResponse, HttpResponseNotAllowed,
... | agpl-3.0 |
bleib1dj/boto | boto/provider.py | 102 | 20925 | # Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
# Copyright 2010 Google Inc.
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# Copyright (c) 2011, Nexenta Systems Inc.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated document... | mit |
oliciv/youtube-dl | youtube_dl/extractor/soundcloud.py | 17 | 17239 | # encoding: utf-8
from __future__ import unicode_literals
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
compat_urllib_parse,
)
from ..utils import (
ExtractorError,
int_or_none,
unified_strdate,
)
class SoundcloudIE(InfoExtra... | unlicense |
junmin-zhu/chromium-rivertrail | chrome/test/functional/stress.py | 3 | 29618 | #!/usr/bin/env python
# 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.
"""
Stess Tests for Google Chrome.
This script runs 4 different stress tests:
1. Plugin stress.
2. Back and forward stress.
3. Do... | bsd-3-clause |
ghedsouza/django | django/utils/http.py | 9 | 14635 | import base64
import calendar
import datetime
import re
import unicodedata
import warnings
from binascii import Error as BinasciiError
from email.utils import formatdate
from urllib.parse import (
ParseResult, SplitResult, _coerce_args, _splitnetloc, _splitparams, quote,
quote_plus, scheme_chars, unquote, unquo... | bsd-3-clause |
indevgr/django | django/contrib/gis/db/backends/postgis/pgraster.py | 491 | 5071 | import binascii
import struct
from django.forms import ValidationError
from .const import (
GDAL_TO_POSTGIS, GDAL_TO_STRUCT, POSTGIS_HEADER_STRUCTURE, POSTGIS_TO_GDAL,
STRUCT_SIZE,
)
def pack(structure, data):
"""
Pack data into hex string with little endian format.
"""
return binascii.hexli... | bsd-3-clause |
alisw/alibuild | tests/test_init.py | 1 | 5571 | from __future__ import print_function
# Assuming you are using the mock library to ... mock things
try:
from unittest import mock
from unittest.mock import call, MagicMock # In Python 3, mock is built-in
from io import StringIO
except ImportError:
import mock
from mock import call, MagicMock # Pyt... | gpl-3.0 |
rossburton/yocto-autobuilder | lib/python2.7/site-packages/SQLAlchemy-0.8.0b2-py2.7-linux-x86_64.egg/sqlalchemy/testing/schema.py | 8 | 2933 |
from . import exclusions
from .. import schema, event
from . import config
__all__ = 'Table', 'Column',
table_options = {}
def Table(*args, **kw):
"""A schema.Table wrapper/hook for dialect-specific tweaks."""
test_opts = dict([(k, kw.pop(k)) for k in kw.keys()
if k.startswith('test_... | gpl-2.0 |
onoga/toolib | toolib/wx/util/ControlHost.py | 2 | 1928 | # -*- coding: Cp1251 -*-
###############################################################################
#
'''
'''
__author__ = "Oleg Noga"
__date__ = "$Date: 2005/12/07 19:53:53 $"
__version__ = "$Revision: 1.2 $"
# $Source: D:/HOME/cvs/toolib/wx/util/ControlHost.py,v $
###############################################... | gpl-2.0 |
sqlobject/sqlobject | sqlobject/boundattributes.py | 2 | 4191 | """
Bound attributes are attributes that are bound to a specific class and
a specific name. In SQLObject a typical example is a column object,
which knows its name and class.
A bound attribute should define a method ``__addtoclass__(added_class,
name)`` (attributes without this method will simply be treated as
normal... | lgpl-2.1 |
Tiger66639/ansible-modules-core | windows/win_get_url.py | 13 | 1921 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Paul Durivage <paul.durivage@rackspace.com>, and others
#
# 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, eithe... | gpl-3.0 |
bema-ligo/pycbc | pycbc/types/array_cpu.py | 1 | 5898 | # Copyright (C) 2012 Alex Nitz
# 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 program is distributed in the h... | gpl-3.0 |
magenta/magenta | magenta/models/nsynth/baseline/models/ae.py | 1 | 7401 | # Copyright 2021 The Magenta Authors.
#
# 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 ... | apache-2.0 |
jamesls/boto | boto/elastictranscoder/layer1.py | 4 | 34890 | # Copyright (c) 2013 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 ... | mit |
tseaver/gcloud-python | monitoring/google/cloud/monitoring_v3/__init__.py | 3 | 2208 | # -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 |
abusse/cinder | cinder/volume/drivers/ibm/storwize_svc/__init__.py | 2 | 51024 | # Copyright 2013 IBM Corp.
# Copyright 2012 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/LIC... | apache-2.0 |
akaihola/bitcoin-price | old_versions/fast_dump_v11.py | 4 | 1386 | #!/usr/bin/env python3
import requests
import sys
def get_all():
page_num = 1
price_data = ''
while True:
req = requests.get("http://coinbase.com/api/v1/prices/historical?page="+str(page_num))
if req.status_code == 200:
price_data += '\n' + req.text
else:
pr... | mit |
johankaito/fufuka | microblog/flask/venv/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py | 427 | 38314 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""Implementation of the Metadata for Python packages PEPs.
Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental).
"""
from __future__ import unicode_literals
import codecs
from email... | apache-2.0 |
henriquefacioli/gd-ae- | gda/admin.py | 1 | 1632 | from django.contrib import admin
from import_export import resources
from import_export.admin import ImportExportModelAdmin
from import_export.admin import ImportExportActionModelAdmin
from gda.models import Questionnaire, Question, Choice, Answer
## Questionnaires
# Class to import and export Questionnaire
class Qu... | gpl-3.0 |
hutchison/bp_mgmt | bp_cupid/tests/test_login.py | 1 | 1795 | from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
from django.contrib.auth.models import User
class TestLogin(StaticLiveServerTestCase):
def setUp(self):
self.username = 'alice'
self.email = 'alice@example.org'
self.password = 'test'
... | agpl-3.0 |
bbannier/ROOT | interpreter/llvm/src/tools/clang/bindings/python/tests/cindex/util.py | 12 | 2609 | # This file provides common utility functions for the test suite.
from clang.cindex import Cursor
from clang.cindex import TranslationUnit
def get_tu(source, lang='c', all_warnings=False, flags=[]):
"""Obtain a translation unit from source and language.
By default, the translation unit is created from source... | lgpl-2.1 |
StephaneP/volatility | volatility/conf.py | 57 | 15263 | ## This file was taken from PyFlag http://www.pyflag.net/
# Michael Cohen <scudette@users.sourceforge.net>
# David Collett <daveco@users.sourceforge.net>
#
# ******************************************************
# Version: FLAG $Version: 0.87-pre1 Date: Thu Jun 12 00:48:38 EST 2008$
# ********************************... | gpl-2.0 |
lewislone/kernel_reading | tools/perf/scripts/python/failed-syscalls-by-pid.py | 11180 | 2058 | # failed system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide failed system call totals, broken down by pid.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.pa... | gpl-2.0 |
pincopallino93/rdfendpoints | lib/rdflib/plugins/parsers/pyRdfa/rdfs/__init__.py | 25 | 1729 | # -*- coding: utf-8 -*-
"""
Separate module to handle vocabulary expansions. The L{cache} module takes care of caching vocabulary graphs; the L{process}
module takes care of the expansion itself.
@organization: U{World Wide Web Consortium<http://www.w3.org>}
@author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan... | apache-2.0 |
chispita/epiwork | apps/survey/migrations/0005_verify_single_user_assumption.py | 4 | 12061 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for survey_user in orm['survey.SurveyUser'].objects.all():
assert survey_user.user.count() <= 1, survey_user.global... | agpl-3.0 |
harmy/kbengine | kbe/src/lib/python/Lib/test/test_plistlib.py | 55 | 7809 | # Copyright (C) 2003 Python Software Foundation
import unittest
import plistlib
import os
import datetime
from test import support
# This test data was generated through Cocoa's NSDictionary class
TESTDATA = b"""<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" \
"http://www... | lgpl-3.0 |
srm912/servo | tests/wpt/harness/wptrunner/metadata.py | 78 | 12836 | # 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 shutil
import sys
import tempfile
import types
import uuid
from collections import defaultdict
from mo... | mpl-2.0 |
therewillbecode/ichnaea | ichnaea/data/monitor.py | 1 | 3667 | from collections import defaultdict
from datetime import timedelta
from sqlalchemy import func
from sqlalchemy.orm import load_only
from ichnaea.models import (
ApiKey,
OCIDCell,
)
from ichnaea import util
class ApiKeyLimits(object):
def __init__(self, task, session):
self.task = task
s... | apache-2.0 |
audunv/andp | python/andp/view/web/widgets.py | 1 | 10766 | # -*- coding: utf-8; -*-
# Copyright (C) 2009 Østfold University College
#
# This file is part of ANDP.
#
# ANDP 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 you... | gpl-2.0 |
s0enke/boto | tests/integration/cloudformation/test_cert_verification.py | 126 | 1588 | # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# 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 withou... | mit |
GDGND/evm | allauth/account/auth_backends.py | 57 | 2101 | from django.contrib.auth.backends import ModelBackend
from ..utils import get_user_model
from .utils import filter_users_by_email
from .app_settings import AuthenticationMethod
from . import app_settings
class AuthenticationBackend(ModelBackend):
def authenticate(self, **credentials):
ret = None
... | mit |
ftomassetti/intellij-community | python/lib/Lib/site-packages/django/conf/locale/no/formats.py | 685 | 1657 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# 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'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FOR... | apache-2.0 |
SebastianLloret/CSCI-1310 | Assignments/Assignment8_Lloret/Assignment8_Lloret.py | 1 | 1401 | '''
Name: Sebastian Lloret
Recitation TA: Brennan Mcconnell
Assignment #: 8
'''
# Used to properly break the file into rows
import csv
def CreateDictionary(fileName):
slangDictionary = {}
# With just ensures a resource is cleaned even if exceptions are thrown.
# I had to use "rU" for universal n... | gpl-3.0 |
ewindisch/nova | nova/api/openstack/compute/contrib/console_output.py | 5 | 3746 | # Copyright 2011 OpenStack Foundation
# Copyright 2011 Grid Dynamics
# Copyright 2011 Eldar Nugaev, Kirill Shileev, Ilya Alekseyev
#
# 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
#
#... | apache-2.0 |
eahneahn/free | djangoproject/core/urls/__init__.py | 1 | 4601 | from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView, RedirectView
from django.conf import settings
#from django.views.generic.simple import redirect_to, direct_to_template
from django.shortcuts import render,redirect
urlpatterns = patterns('core.views.main_views',
url(... | agpl-3.0 |
godiard/speak | aiml/DefaultSubs.py | 9 | 3590 | """This file contains the default (English) substitutions for the
PyAIML kernel. These substitutions may be overridden by using the
Kernel.loadSubs(filename) method. The filename specified should refer
to a Windows-style INI file with the following format:
# lines that start with '#' are comments
# The 'gen... | gpl-3.0 |
sanyaade-g2g-repos/key-mon | src/keymon/shaped_window.py | 15 | 3172 | #!/usr/bin/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 or a... | apache-2.0 |
4eek/edx-platform | lms/djangoapps/certificates/views/support.py | 52 | 5649 | """
Certificate end-points used by the student support UI.
See lms/djangoapps/support for more details.
"""
import logging
from functools import wraps
from django.http import (
HttpResponse,
HttpResponseBadRequest,
HttpResponseForbidden,
HttpResponseServerError
)
from django.views.decorators.http imp... | agpl-3.0 |
realms-team/solmanager | libs/smartmeshsdk-REL-1.3.0.1/libs/VManagerSDK/vmanager/configuration.py | 3 | 7415 | # coding: utf-8
"""
Copyright 2015 SmartBear Software
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 l... | bsd-3-clause |
111pontes/ydk-py | cisco-ios-xe/ydk/models/cisco_ios_xe/_meta/_Cisco_IOS_XE_bgp_oper.py | 1 | 48604 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | apache-2.0 |
tcmitchell/geni-tools | src/gcf/geni/am/aggregate.py | 3 | 3386 | #----------------------------------------------------------------------
# Copyright (c) 2011-2016 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | mit |
nicememory/pie | pyglet/pyglet/gl/glxext_mesa.py | 46 | 2050 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | apache-2.0 |
jpmpentwater/cvxpy | examples/extensions/ncvx/branch_and_bound.py | 12 | 3946 | import cvxopt
import cvxpy.problems.problem as problem
import cvxpy.settings as s
from boolean import Boolean
def branch(booleans):
bool_vals = (b for b in booleans if not b.fix_values)
# pick *a* boolean variable to branch on
# choose the most ambivalent one (smallest distance to 0.5)
# NOTE: if there... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.