repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
st135yle/django-site | dbenv/lib/python3.4/site-packages/django/utils/functional.py | 23 | 14822 | import copy
import operator
import warnings
from functools import total_ordering, wraps
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
# You can't trivially replace this with `functools.partial` because this binds
# to classes and returns bound instances, whereas functools... | mit |
jmunsch/vr_crash_course | kinect/calibkinect.py | 2 | 3942 | """
These are some functions to help work with kinect camera calibration and projective
geometry.
Tasks:
- Convert the kinect depth image to a metric 3D point cloud
- Convert the 3D point cloud to texture coordinates in the RGB image
Notes about the coordinate systems:
There are three coordinate systems to worry ab... | gpl-3.0 |
mrrrgn/olympia | apps/editors/decorators.py | 14 | 2475 | import functools
from django.core.exceptions import PermissionDenied
from access import acl
from amo.decorators import login_required
def _view_on_get(request):
"""Return True if the user can access this page.
If the user is in a group with rule 'ReviewerTools:View' and the request is
a GET request, th... | bsd-3-clause |
vikatory/kbengine | kbe/src/lib/python/Lib/turtledemo/round_dance.py | 164 | 1804 | """ turtle-example-suite:
tdemo_round_dance.py
(Needs version 1.1 of the turtle module that
comes with Python 3.1)
Dancing turtles have a compound shape
consisting of a series of triangles of
decreasing size.
Turtles march along a circle while rotating
pairwise in opposite direction, with one
exceptio... | lgpl-3.0 |
tangfeixiong/nova | nova/tests/unit/virt/ironic/test_driver.py | 14 | 72227 | # Copyright 2015 Red Hat, Inc.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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/L... | apache-2.0 |
Intel-Corporation/tensorflow | tensorflow/python/autograph/converters/logical_expressions_test.py | 20 | 3189 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
dlazz/ansible | contrib/inventory/lxd.py | 15 | 3752 | #!/usr/bin/env python
# (c) 2013, Michael Scherer <misc@zarb.org>
# (c) 2014, Hiroaki Nakamura <hnakamur@gmail.com>
# (c) 2016, Andew Clarke <andrew@oscailte.org>
#
# This file is based on https://github.com/ansible/ansible/blob/devel/plugins/inventory/libvirt_lxc.py which is part of Ansible,
# and https://github.com/... | gpl-3.0 |
codemac/servo | python/mozlog/mozlog/structured/logtypes.py | 43 | 5500 | # 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/.
convertor_registry = {}
missing = object()
no_default = object()
class log_action(object):
def __init__(self, *args... | mpl-2.0 |
jpanganiban/simplestruct | test_simplestruct.py | 1 | 4368 | # -*- coding: utf-8 -*-
import unittest
import simplestruct as structs
class StructTestCase(unittest.TestCase):
def test_class(self):
class Type(structs.Struct):
pass
self.assertIsNotNone(Type)
self.assertIsNotNone(Type())
def test_instantiation_correct_value_type(self):... | mit |
ganemone/SublimeBart | lib/requests/requests/packages/chardet/mbcsgroupprober.py | 2769 | 1967 | ######################## 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... | mit |
rwl/PyCIM | CIM14/IEC61970/Dynamics/BlockUsageOutputReference.py | 1 | 4616 | # Copyright (C) 2010-2011 Richard Lincoln
#
# 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, modify, merge, publish... | mit |
Distrotech/PyQt-x11 | examples/ipc/localfortuneclient.py | 5 | 5564 | #!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2010 Hans-Peter Jansen <hpj@urpla.net>.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_... | gpl-2.0 |
dydek/django | django/contrib/admin/views/main.py | 12 | 16406 | import sys
from collections import OrderedDict
from django.contrib.admin import FieldListFilter
from django.contrib.admin.exceptions import (
DisallowedModelAdminLookup, DisallowedModelAdminToField,
)
from django.contrib.admin.options import (
IS_POPUP_VAR, TO_FIELD_VAR, IncorrectLookupParameters,
)
from djang... | bsd-3-clause |
tjsavage/djangononrel-starter | django/contrib/gis/geos/prototypes/misc.py | 334 | 1438 | """
This module is for the miscellaneous GEOS routines, particularly the
ones that return the area, distance, and length.
"""
from ctypes import c_int, c_double, POINTER
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.prototypes.errcheck import check_dbl, check_string
f... | bsd-3-clause |
O-T-L/PyOptimization | parameters/indicator/pf.py | 1 | 3441 | """
Copyright (C) 2014, 申瑞珉 (Ruimin Shen)
This program 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 License, or
(at your option) any later version.
This program is distributed i... | lgpl-3.0 |
FroggedTV/grenouillebot | bot/module/irc/irc_bot.py | 1 | 4075 | import logging, traceback
from time import sleep
from datetime import datetime, timedelta
import threading
from irc.bot import SingleServerIRCBot
class IrcBot(SingleServerIRCBot):
"""The module of the bot responsible for the Twitch (IRC) chat.
Listen to all pub messages and forward to the command... | mit |
for811/Ubuntu_kernel_golfu | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 11088 | 3246 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
Tudorvr/metagoofil | hachoir_metadata/image.py | 73 | 10800 | from hachoir_metadata.metadata import (registerExtractor,
Metadata, RootMetadata, MultipleMetadata)
from hachoir_parser.image import (
BmpFile, IcoFile, PcxFile, GifFile, PngFile, TiffFile,
XcfFile, TargaFile, WMF_File, PsdFile)
from hachoir_parser.image.png import getBitsPerPixel as pngBitsPerPixel
from ha... | gpl-2.0 |
photoninger/ansible | lib/ansible/modules/windows/win_file.py | 47 | 2797 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
#
# 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, eith... | gpl-3.0 |
aajanki/youtube-dl | youtube_dl/extractor/sportdeutschland.py | 63 | 3680 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_request,
)
from ..utils import (
parse_iso8601,
)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://sportdeutschland\.tv/(?P<sport>[^/?#]+)/(?P<id>[^?#/... | unlicense |
deepsrijit1105/edx-platform | cms/djangoapps/contentstore/views/assets.py | 13 | 14970 | import logging
from functools import partial
import math
import json
from django.http import HttpResponseBadRequest
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_http_methods, require_POST
from djan... | agpl-3.0 |
amragaey/CodesnapFrontend | node_modules/node-gyp/gyp/tools/pretty_sln.py | 1831 | 5099 | #!/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.
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependenci... | mit |
mitchrule/Miscellaneous | Django_Project/django/Lib/site-packages/django/db/backends/postgresql_psycopg2/version.py | 632 | 1517 | """
Extracts the version of the PostgreSQL server.
"""
import re
# This reg-exp is intentionally fairly flexible here.
# Needs to be able to handle stuff like:
# PostgreSQL #.#.#
# EnterpriseDB #.#
# PostgreSQL #.# beta#
# PostgreSQL #.#beta#
VERSION_RE = re.compile(r'\S+ (\d+)\.(\d+)\.?(\d+)?')
def _parse_... | mit |
tbombach/autorest | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/custom_domain.py | 8 | 1198 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit |
YeEmrick/learning | stanford-tensorflow/assignments/01/q1_sol.py | 1 | 5009 | """
Solution to simple exercises to get used to TensorFlow API
You should thoroughly test your code.
TensorFlow's official documentation should be your best friend here
CS20: "TensorFlow for Deep Learning Research"
cs20.stanford.edu
Created by Chip Huyen (chiphuyen@cs.stanford.edu)
"""
import os
os.environ['TF_CPP_MIN_... | apache-2.0 |
ZENGXH/scikit-learn | sklearn/metrics/tests/test_classification.py | 42 | 52642 | from __future__ import division, print_function
import numpy as np
from scipy import linalg
from functools import partial
from itertools import product
import warnings
from sklearn import datasets
from sklearn import svm
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import La... | bsd-3-clause |
Noirello/bonsai | .ci/delay.py | 1 | 5135 | import os
import subprocess
import xmlrpc.server as rpc
import time
import sys
import multiprocessing as mp
try:
import pydivert
except ImportError:
pass
class LinuxDelayHandler:
@staticmethod
def get_interface_name():
""" Get the first interface name that is not the localhost. """
ne... | mit |
victor-prado/broker-manager | environment/lib/python3.5/site-packages/pandas/util/terminal.py | 9 | 3537 | """
get_terminal_size() -- return width and height of terminal as a tuple
code from:
http://stackoverflow.com/questions/566746/how-to-get-console- window-width-in-
python
written by
Harco Kuppens (http://stackoverflow.com/users/825214/harco-kuppens)
It is mentioned in the stackoverflow response that this code works
... | mit |
KaranToor/MA450 | google-cloud-sdk/lib/third_party/yaml/tokens.py | 985 | 2573 |
class Token(object):
def __init__(self, start_mark, end_mark):
self.start_mark = start_mark
self.end_mark = end_mark
def __repr__(self):
attributes = [key for key in self.__dict__
if not key.endswith('_mark')]
attributes.sort()
arguments = ', '.join(['%s=... | apache-2.0 |
Titulacion-Sistemas/PythonTitulacion-EV | Lib/site-packages/logilab/common/test/unittest_deprecation.py | 9 | 4817 | # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | mit |
Karspexet/Karspexet | karspexet/ticket/tasks.py | 1 | 1458 | import logging
from django.conf import settings
from django.core.mail import send_mail
from django.contrib.sites.models import Site
from django.template.loader import render_to_string
logger = logging.getLogger(__file__)
def send_ticket_email_to_customer(reservation, email, name=None):
'''Send an email to the cu... | mit |
jonparrott/nox | nox/command.py | 1 | 3925 | # Copyright 2016 Alethea Katherine Flowers
#
# 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... | apache-2.0 |
DamianPilot382/Rubiks-Cube-Solver | opencv/sources/modules/core/src/opencl/runtime/generator/parser_cl.py | 6 | 4173 | #!/bin/python
# usage:
# cat opencl11/cl.h | $0 cl_runtime_opencl11
# cat opencl12/cl.h | $0 cl_runtime_opencl12
import sys, re;
from common import remove_comments, getTokens, getParameters, postProcessParameters
try:
if len(sys.argv) > 1:
module_name = sys.argv[1]
outfile = open('../../..... | apache-2.0 |
akshatharaj/django | django/contrib/admindocs/views.py | 146 | 15441 | import inspect
import os
import re
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.admindocs import utils
from django.core import urlresolvers
f... | bsd-3-clause |
MarkTseng/django-farmersale | farmersale-env/lib/python2.7/site-packages/setuptools/command/egg_info.py | 115 | 14336 | """setuptools.command.egg_info
Create a distribution's .egg-info directory and contents"""
import os
import re
import sys
from setuptools import Command
import distutils.errors
from distutils import log
from setuptools.command.sdist import sdist
from setuptools.compat import basestring
from setuptools import svn_uti... | mit |
Kazade/NeHe-Website | google_appengine/lib/django-1.3/tests/modeltests/transactions/tests.py | 51 | 6706 | import sys
from django.db import connection, transaction, IntegrityError, DEFAULT_DB_ALIAS
from django.conf import settings
from django.test import TransactionTestCase, skipUnlessDBFeature
from models import Reporter
if sys.version_info >= (2, 5):
from tests_25 import TransactionContextManagerTests
class Tran... | bsd-3-clause |
pombredanne/discern | tastypie/resources.py | 1 | 94958 | from __future__ import with_statement
import sys
import logging
import warnings
import django
from django.conf import settings
try:
from django.conf.urls import patterns, url
except ImportError: # Django < 1.4
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotEx... | agpl-3.0 |
centaurialpha/ninja-ide | ninja_ide/dependencies/pyflakes_mod/old/reporter.py | 52 | 2666 | """
Provide the Reporter class.
"""
import re
import sys
class Reporter(object):
"""
Formats the results of pyflakes checks to users.
"""
def __init__(self, warningStream, errorStream):
"""
Construct a L{Reporter}.
@param warningStream: A file-like object where warnings will... | gpl-3.0 |
chongtianfeiyu/kbengine | kbe/src/lib/python/Lib/test/test_urllib.py | 60 | 60637 | """Regresssion tests for urllib"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
import sys
import tempfile
from nturl2path import url2pathname, pathname2url
from base64... | lgpl-3.0 |
MuffinMedic/CloudBot | cloudbot/hook.py | 1 | 14146 | import collections
import inspect
import re
from enum import Enum, unique, IntEnum
from cloudbot.event import EventType
valid_command_re = re.compile(r"^\w+$")
@unique
class Priority(IntEnum):
# Reversed to maintain compatibility with sieve hooks numeric priority
LOWEST = 127
LOW = 63
NORMAL = 0
... | gpl-3.0 |
mrquim/mrquimrepo | script.module.youtube.dl/lib/youtube_dl/extractor/vuclip.py | 76 | 2254 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_urlparse,
)
from ..utils import (
ExtractorError,
parse_duration,
remove_end,
)
class VuClipIE(InfoExtractor):
_VALID_URL = r'https?://(?:m\.)?vuclip\.com/w\?.*?cid=(?P<... | gpl-2.0 |
collinstocks/eventlet | eventlet/greenio/base.py | 1 | 17181 | import errno
import os
import socket
import sys
import time
import warnings
import eventlet
from eventlet.hubs import trampoline, notify_opened, IOClosed
from eventlet.support import get_errno, six
__all__ = [
'GreenSocket', '_GLOBAL_DEFAULT_TIMEOUT', 'set_nonblocking',
'SOCKET_BLOCKING', 'SOCKET_CLOSED', 'CO... | mit |
sunqb/oa_qian | flask/Lib/site-packages/sqlalchemy/orm/properties.py | 32 | 9557 | # orm/properties.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""MapperProperty implementations.
This is a private module which defines the beh... | apache-2.0 |
mgrygoriev/CloudFerry | cloudferrylib/os/estimation/procedures.py | 1 | 6018 | # Copyright (c) 2016 Mirantis 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 writing, so... | apache-2.0 |
rksaxena/crawler_templates | crawler_type2/crawler_type2/spiders/type_two.py | 1 | 1779 | # -*- coding: utf-8 -*-
import scrapy
import crawler_type2.config as config
from crawler_type2.items import CrawlerType2Item
import urlparse
class TypeTwo(scrapy.Spider):
name = 'crawler_type2'
def start_requests(self):
source = getattr(self, 'source', None)
if source is None or source not in... | mit |
duducosmos/pgs4a | python-install/lib/python2.7/encodings/iso2022_jp_ext.py | 816 | 1069 | #
# iso2022_jp_ext.py: Python Unicode Codec for ISO2022_JP_EXT
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_ext')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class Incr... | lgpl-2.1 |
fantasycheng/udacity-deep-learning-project | face-generation/helper.py | 160 | 8114 | import math
import os
import hashlib
from urllib.request import urlretrieve
import zipfile
import gzip
import shutil
import numpy as np
from PIL import Image
from tqdm import tqdm
def _read32(bytestream):
"""
Read 32-bit integer from bytesteam
:param bytestream: A bytestream
:return: 32-bit integer
... | mit |
leppa/home-assistant | homeassistant/components/light/device_condition.py | 1 | 1206 | """Provides device conditions for lights."""
from typing import Dict, List
import voluptuous as vol
from homeassistant.components.device_automation import toggle_entity
from homeassistant.const import CONF_DOMAIN
from homeassistant.core import HomeAssistant
from homeassistant.helpers.condition import ConditionChecker... | apache-2.0 |
gkotton/neutron | neutron/tests/unit/brocade/test_brocade_plugin.py | 8 | 2419 | # Copyright (c) 2012 OpenStack Foundation.
#
# 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... | apache-2.0 |
piaoyaoshi/inf1340_2015_asst1 | exercise3.py | 1 | 3174 | #!/usr/bin/env python
""" Assignment 1, Exercise 3, INF1340, Fall, 2015. Troubleshooting Car Issues.
This module contains one function diagnose_car(). It is an expert system to
interactive diagnose car issues.
"""
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__... | mit |
timoschwarzer/blendworks | BlendWorks Server/python/Lib/test/test_raise.py | 118 | 11344 | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Tests for the raise statement."""
from test import support
import re
import sys
import types
import unittest
def get_tb():
try:
raise OSError()
except:
return sys.exc_info()[2]
class Cont... | gpl-2.0 |
mollstam/UnrealPy | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/pycrypto-2.6.1/lib/Crypto/SelfTest/Hash/test_SHA224.py | 116 | 2581 | # -*- coding: utf-8 -*-
#
# SelfTest/Hash/test_SHA224.py: Self-test for the SHA-224 hash function
#
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that... | mit |
beagles/neutron_hacking | neutron/agent/ovs_cleanup_util.py | 11 | 3885 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 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-2.0 |
amyvmiwei/chromium | third_party/scons/scons-local/SCons/Tool/sunc++.py | 3 | 3346 | """SCons.Tool.sunc++
Tool-specific initialization for C++ on SunOS / Solaris.
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, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons ... | bsd-3-clause |
cnddu/cactusblog | form/post.py | 1 | 1329 | #!/usr/bin/env python
# coding=utf-8
#
# Copyright 2013 meiritugua.com
from wtforms import TextField, HiddenField, validators
from lib.forms import Form
class NewForm(Form):
title = TextField('Title', [
validators.Required(message = "请填写帖子标题"),
validators.Length(min = 3, message = "帖子标题长度过短(3-... | gpl-3.0 |
kartoza/jakarta-flood-maps | django_project/core/wsgi.py | 1 | 1458 | # -*- coding: utf-8 -*-
"""
WSGI config for flood_mapper project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application ... | bsd-2-clause |
karwa/swift | utils/android/adb_test_runner/main.py | 65 | 2277 | # main.py - Push executables and run them on an Android device -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt... | apache-2.0 |
zsdonghao/tensorlayer | tests/test_layers_merge.py | 1 | 6058 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import tensorlayer as tl
from tests.utils import CustomTestCase
class Layer_Merge_Test(CustomTestCase):
@classmethod
def setUpClass(cls):
cls.data = dict()
... | apache-2.0 |
MobiusL/p2pool | wstools/TimeoutSocket.py | 293 | 5293 | """Based on code from timeout_socket.py, with some tweaks for compatibility.
These tweaks should really be rolled back into timeout_socket, but it's
not totally clear who is maintaining it at this point. In the meantime,
we'll use a different module name for our tweaked version to avoid any
confusion.
T... | gpl-3.0 |
SickGear/SickGear | lib/apprise/AppriseAsset.py | 2 | 8403 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Chris Caron <lead2gold@gmail.com>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 th... | gpl-3.0 |
rahuldan/sympy | sympy/calculus/tests/test_euler.py | 37 | 2238 | from sympy import Symbol, Function, Derivative as D, Eq, cos, sin
from sympy.utilities.pytest import raises
from sympy.calculus.euler import euler_equations as euler
def test_euler_interface():
x = Function('x')
y = Symbol('y')
t = Symbol('t')
raises(TypeError, lambda: euler())
raises(TypeError, l... | bsd-3-clause |
mxOBS/deb-pkg_trusty_chromium-browser | third_party/WebKit/Source/devtools/scripts/optimize_png_images.py | 28 | 4309 | #!/usr/bin/env python
# Copyright (c) 2014 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 ... | bsd-3-clause |
openweave/openweave-core | src/test-apps/happy/test-templates/WeaveSWU.py | 1 | 12087 | #!/usr/bin/env python3
#
# Copyright (c) 2015-2017 Nest Labs, 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/lic... | apache-2.0 |
tersmitten/ansible | lib/ansible/modules/cloud/amazon/elb_target_group.py | 15 | 31800 | #!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
GuillaumeSeren/alot | alot/helper.py | 1 | 20203 | # -*- coding: utf-8 -*-
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# Copyright © 2017-2018 Dylan Baker
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
from datetime import timedelta
from datetime import datetime
from collectio... | gpl-3.0 |
pdellaert/ansible | lib/ansible/modules/cloud/ovirt/ovirt_datacenter_info.py | 20 | 3592 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUME... | gpl-3.0 |
pdellaert/ansible | test/units/modules/network/fortios/test_fortios_vpn_certificate_local.py | 21 | 16809 | # Copyright 2019 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 License, or
# (at your option) any later version.
#
# This program is distributed in the... | gpl-3.0 |
czhengsci/pymatgen | pymatgen/analysis/tests/test_quasiharmonic_debye_approx.py | 7 | 5823 | from __future__ import absolute_import
import unittest
import numpy as np
from pymatgen import Structure
from pymatgen.analysis.eos import EOS
from pymatgen.analysis.quasiharmonic import QuasiharmonicDebyeApprox
__author__ = 'Kiran Mathew'
class TestQuasiharmociDebyeApprox(unittest.TestCase):
def setUp(self):... | mit |
commonwealth-of-puerto-rico/lean | paart/apps/telecomm/migrations/0001_initial.py | 2 | 4478 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Provider'
db.create_table('telecomm_provider', (
('id', self.gf('django.db.model... | gpl-3.0 |
AenBleidd/man2wiki | man2wiki.py | 1 | 2114 | import sys
import re
from os import listdir, linesep
from os.path import isfile, join, splitext
def clearLine(line):
return line.strip().replace(r'\&', '').replace(r'\fB', '').replace(r'\fC', '').replace(r'\fP', '').replace(r'\-', '-').replace(r'#', '<nowiki>#</nowiki>')
def convert(in_filename, out_filename):
f = ... | gpl-3.0 |
quequino/Revolution | script.module.requests2/lib/requests2/packages/charade/langhungarianmodel.py | 168 | 12561 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... | gpl-2.0 |
ericzundel/pants | tests/python/pants_test/pantsd/test_pants_daemon.py | 9 | 3561 | # coding=utf-8
# Copyright 2015 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 logging
impo... | apache-2.0 |
xxsergzzxx/python-for-android | python3-alpha/python3-src/Lib/distutils/tests/test_log.py | 138 | 1232 | """Tests for distutils.log"""
import sys
import unittest
from tempfile import NamedTemporaryFile
from test.support import run_unittest
from distutils import log
class TestLog(unittest.TestCase):
def test_non_ascii(self):
# Issue #8663: test that non-ASCII text is escaped with
# backslashreplace e... | apache-2.0 |
manishpatell/erpcustomizationssaiimpex123qwe | addons/project/res_config.py | 86 | 4486 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
magne-max/zipline-ja | zipline/pipeline/loaders/utils.py | 1 | 9840 | import datetime
import numpy as np
import pandas as pd
from zipline.utils.pandas_utils import mask_between_time
def is_sorted_ascending(a):
"""Check if a numpy array is sorted."""
return (np.fmax.accumulate(a) <= a).all()
def validate_event_metadata(event_dates,
event_timestamps... | apache-2.0 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/django/core/serializers/pyyaml.py | 51 | 2844 | """
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
import collections
import decimal
import sys
from io import StringIO
import yaml
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
Deserializer as PythonDes... | mit |
napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/neighbors/neighbor/afi_safis/afi_safi/graceful_restart/config/__init__.py | 1 | 11849 | # -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | apache-2.0 |
xavfernandez/pip | src/pip/_internal/network/xmlrpc.py | 12 | 1597 | """xmlrpclib.Transport implementation
"""
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False
import logging
from pip._vendor import requests
# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
# why we ignore the type on this imp... | mit |
signed/intellij-community | plugins/hg4idea/testData/bin/mercurial/tags.py | 91 | 11494 | # tags.py - read tag info from local repository
#
# Copyright 2009 Matt Mackall <mpm@selenic.com>
# Copyright 2009 Greg Ward <greg@gerg.ca>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
# Currently this module only deals with re... | apache-2.0 |
dstndstn/astrometry.net | catalogs/brightstars-to-fits.py | 2 | 1281 | # This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
import simplejson
import re
lines = open('brightstars-data.c').readlines()
l = ''.join(lines[3:-2]).replace('{','[').replace('}',']')
def replace_unicode(match):
c1 = ... | bsd-3-clause |
mrrrgn/build-relengapi | relengapi/lib/auth/ldap_group_authz.py | 1 | 2918 | # 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 itertools
import ldap
import logging
from relengapi import p
from relengapi.lib.auth import permissions_stale
... | mpl-2.0 |
nsol-nmsu/ns3-smartgrid | src/wave/bindings/callbacks_list.py | 40 | 2339 | callback_classes = [
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::WifiMacHeader const*', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::em... | gpl-2.0 |
fast90/youtube-dl | youtube_dl/extractor/npo.py | 19 | 18401 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
fix_xml_ampersands,
parse_duration,
qualities,
strip_jsonp,
unified_strdate,
)
class NPOBaseIE(InfoExtractor):
def _get_token(self, video_id):
token_page = self._download_webpage... | unlicense |
jbrudvik/yahooscraper | tests.py | 1 | 3744 | import unittest
from yahooscraper import *
class YahooScraperImportTests(unittest.TestCase):
def test_import(self):
import yahooscraper
self.assertIsNotNone(yahooscraper)
self.assertIsNotNone(yahooscraper.login)
self.assertIsNotNone(yahooscraper.fantasy)
self.assertIsNotN... | mit |
metapolator/mutatormathtools | python_modules/lib/python/defcon/tools/notifications.py | 2 | 31666 | """
A flexible and relatively robust implementation
of the Observer Pattern.
"""
import weakref
"""
----------------------
Internal Documentation
----------------------
Storage Structures:
registry : {
(notification, observable) : ObserverDict(
observer : method name
)
}
holds : {
... | apache-2.0 |
andrey-malets/web-page-replay | third_party/dns/rdtypes/ANY/X25.py | 248 | 2123 | # Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED ... | apache-2.0 |
legalsylvain/OpenUpgrade | addons/purchase_double_validation/purchase_double_validation_installer.py | 432 | 2315 | # -*- 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 |
swatlab/uplift-analysis | src_code_metrics.py | 1 | 4848 | import re, csv, pytz, json, subprocess
from dateutil import parser
import pandas as pd
import get_bugs
from libmozdata import patchanalysis
# Execute a shell command
def shellCommand(command_str):
cmd =subprocess.Popen(command_str.split(' '), stdout=subprocess.PIPE)
cmd_out, cmd_err = cmd.communicate()
ret... | mpl-2.0 |
hwanju/demand-cosched | tools/perf/scripts/python/syscall-counts-by-pid.py | 11180 | 1927 | # 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 system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os, sys
sys.path.append(os.env... | gpl-2.0 |
Danisan/odoo-1 | addons/base_report_designer/plugin/openerp_report_designer/bin/script/SendToServer.py | 293 | 10562 | #########################################################################
#
# Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gene... | agpl-3.0 |
cecep-edu/edx-platform | lms/djangoapps/certificates/management/commands/cert_whitelist.py | 73 | 4092 | """
Management command which sets or gets the certificate whitelist for a given
user/course
"""
from __future__ import print_function
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from... | agpl-3.0 |
VapourApps/va_master | va_master/utils/old_to_new_store.py | 1 | 3048 | import requests, json, functools
import base64
import os
path = 'http://127.0.0.1:8500'
from va_master.handlers.datastore_handler import DatastoreHandler
from va_master.consul_kv.datastore import ConsulStore
import tornado.ioloop
folder_pwd = os.path.join(os.path.dirname(os.path.realpath(__file__)), '')
datastore = ... | gpl-3.0 |
rdipietro/tensorflow | tensorflow/contrib/learn/python/learn/estimators/classifier_test.py | 16 | 5175 | # 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 |
pombredanne/VirtualBox-OSE | src/VBox/Additions/common/crOpenGL/windows_exports.py | 22 | 2387 | # Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import sys
import apiutil
def GenerateEntrypoints():
apiutil.CopyrightC()
print '#include "chromium.h"'
print '#include "stub.h"'
print ''
print '#define NAKED __dec... | gpl-2.0 |
rs2/pandas | pandas/tests/indexing/multiindex/test_xs.py | 1 | 9100 | import numpy as np
import pytest
from pandas import DataFrame, Index, IndexSlice, MultiIndex, Series, concat, date_range
import pandas._testing as tm
import pandas.core.common as com
@pytest.fixture
def four_level_index_dataframe():
arr = np.array(
[
[-0.5109, -2.3358, -0.4645, 0.05076, 0.364... | bsd-3-clause |
Event38/MissionPlanner | Lib/site-packages/numpy/random/setup.py | 54 | 1523 | from os.path import join
from numpy.distutils.system_info import get_info
def testcode_wincrypt():
return """\
/* check to see if _WIN32 is defined */
int main(int argc, char *argv[])
{
#ifdef _WIN32
return 0;
#else
return 1;
#endif
}
"""
def configuration(parent_package='',top_path=None):
from nu... | gpl-3.0 |
AparatTechnologies/django-connectwise | djconnectwise/api.py | 1 | 16448 | import logging
from django.conf import settings
from djconnectwise.utils import RequestSettings
import re
import requests
from retrying import retry
class ConnectWiseAPIError(Exception):
"""Raise this, not request exceptions."""
pass
class ConnectWiseRecordNotFoundError(ConnectWiseAPIError):
"""The rec... | mit |
cyberark-bizdev/ansible | test/units/cli/test_console.py | 194 | 1803 | # (c) 2016, Thilo Uttendorfer <tlo@sengaya.de>
#
# 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 vers... | gpl-3.0 |
Manishearth/servo | tests/wpt/css-tests/tools/wptserve/wptserve/response.py | 158 | 14749 | from collections import OrderedDict
from datetime import datetime, timedelta
import Cookie
import json
import types
import uuid
import socket
from constants import response_codes
from logger import get_logger
missing = object()
class Response(object):
"""Object representing the response to a HTTP request
:p... | mpl-2.0 |
samthor/intellij-community | plugins/hg4idea/testData/bin/mercurial/config.py | 93 | 6729 | # config.py - configuration parsing for Mercurial
#
# Copyright 2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from i18n import _
import error, util
import os, errno
class sortdict... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.