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 |
|---|---|---|---|---|---|
ixcoinofficialpage/master | qa/rpc-tests/walletbackup.py | 85 | 7304 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Exercise the wallet backup code. Ported from walletbackup.sh.
Test case is:
4 nodes. 1 2 and 3 send... | mit |
grhawk/ASE | ase/utils/eos.py | 8 | 2203 | # -*- coding: utf-8 -*-
import numpy as np
from ase.utils.sjeos import EquationOfStateSJEOS
try:
# ase.utils.eosase2 requires scipy
import scipy
from ase.utils.eosase2 import EquationOfStateASE2
class EquationOfState(EquationOfStateSJEOS, EquationOfStateASE2):
"""Fit equation of state for b... | gpl-2.0 |
thehyve/variant | eggs/django-1.3.1-py2.7.egg/django/test/simple.py | 150 | 15012 | import unittest as real_unittest
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models import get_app, get_apps
from django.test import _doctest as doctest
from django.test.utils import setup_test_environment, teardown_test_environment
from django.test.testcases ... | apache-2.0 |
mine-pool/secondscoin | contrib/bitrpc/bitrpc.py | 2348 | 7835 | from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8332")
else:
access = Ser... | mit |
demisto/content | Packs/PolySwarm/Integrations/PolySwarm/PolySwarm.py | 1 | 19454 | import demistomock as demisto
from CommonServerPython import *
import requests
import socket
import json
import logging
# CONST
POLYSWARM_DEMISTO_VERSION = '0.1.1'
POLYSWARM_URL_RESULTS = 'https://polyswarm.network/scan/results'
ERROR_ENDPOINT = 'Error with endpoint: '
# Set Debug level
logging.basicConfig(level=log... | mit |
digistam/recon-ng | libs/dns/rdtypes/ANY/__init__.py | 50 | 1169 | # Copyright (C) 2003-2007, 2009-2011 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 "... | gpl-3.0 |
petewarden/tensorflow | tensorflow/python/estimator/canned/boosted_trees.py | 41 | 1319 | # 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 |
dwillis/fumblerooski | blog/templatetags/blog_utils.py | 3 | 1929 | from django.template import Library
from django.utils.safestring import mark_safe
from docutils import nodes
from docutils.writers import html4css1
from docutils.core import publish_parts
from docutils.parsers.rst import directives
from pygments import highlight
from pygments.formatters import HtmlFormatter
from py... | bsd-3-clause |
timabbott/zulip | zerver/tests/test_home.py | 1 | 41086 | import calendar
import urllib
from datetime import timedelta
from typing import Any, Dict
from unittest.mock import patch
import lxml.html
import ujson
from django.conf import settings
from django.http import HttpResponse
from django.utils.timezone import now as timezone_now
from corporate.models import Customer, Cus... | apache-2.0 |
EUDAT-B2SHARE/invenio-old | modules/bibformat/lib/elements/bfe_server_info.py | 16 | 2950 | ## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option... | gpl-2.0 |
stinebuu/nest-simulator | pynest/examples/spatial/grid_iaf_oc.py | 12 | 1781 | # -*- coding: utf-8 -*-
#
# grid_iaf_oc.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 |
Azulinho/ansible | lib/ansible/modules/cloud/openstack/os_server_group.py | 25 | 4875 | #!/usr/bin/python
# Copyright (c) 2016 Catalyst IT Limited
# 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': [... | gpl-3.0 |
amolkahat/pandas | doc/source/conf.py | 5 | 21946 | # -*- coding: utf-8 -*-
#
# pandas documentation build configuration file, created by
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values tha... | bsd-3-clause |
OpenDrift/opendrift | opendrift/models/pelagicegg.py | 1 | 7468 | # This file is part of OpenDrift.
#
# OpenDrift 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, version 2
#
# OpenDrift is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without ev... | gpl-2.0 |
IllusionRom-deprecated/android_platform_external_chromium | testing/gtest/scripts/upload_gtest.py | 1963 | 2851 | #!/usr/bin/env python
#
# Copyright 2009, 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 |
matthijsvk/multimodalSR | code/Experiments/neon-master/examples/imagenet/data.py | 1 | 3895 | # ----------------------------------------------------------------------------
# Copyright 2016 Nervana Systems 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.o... | mit |
chromium2014/src | tools/telemetry/telemetry/core/platform/mac_platform_backend_unittest.py | 2 | 1298 | # 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 os
import unittest
from telemetry import benchmark
from telemetry.core.platform import factory
from telemetry.core.platform import platform_backend
... | bsd-3-clause |
niceban/django-command-extensions | django_extensions/templatetags/syntax_color.py | 17 | 2309 | r"""
Template filter for rendering a string with syntax highlighting.
It relies on Pygments to accomplish this.
Some standard usage examples (from within Django templates).
Coloring a string with the Python lexer:
{% load syntax_color %}
{{ code_string|colorize:"python" }}
You may use any lexer in Pygments. ... | mit |
BT-csanchez/account-financial-reporting | account_financial_report_webkit/wizard/open_invoices_wizard.py | 30 | 6110 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright Camptocamp SA 2012
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | agpl-3.0 |
tardis-sn/tardis | tardis/plasma/properties/ion_population.py | 1 | 19794 | import logging
import warnings
import sys
import numpy as np
import pandas as pd
import numexpr as ne
from scipy import interpolate
from tardis.plasma.properties.base import ProcessingPlasmaProperty
from tardis.plasma.properties.continuum_processes import get_ion_multi_index
from tardis.plasma.exceptions import Plas... | bsd-3-clause |
jaharkes/home-assistant | homeassistant/components/media_player/philips_js.py | 5 | 5010 | """
Media Player component to integrate TVs exposing the Joint Space API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.philips_js/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.m... | mit |
pablohoffman/scrapy | scrapy/tests/test_utils_misc/__init__.py | 3 | 3071 | import sys
import os
import unittest
from cStringIO import StringIO
from scrapy.item import Item, Field
from scrapy.utils.misc import load_object, arg_to_iter, walk_modules
__doctests__ = ['scrapy.utils.misc']
class UtilsMiscTestCase(unittest.TestCase):
def test_load_object(self):
obj = load_object('scr... | bsd-3-clause |
luzheqi1987/nova-annotation | nova/tests/unit/fake_hosts.py | 11 | 1319 | # 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.org/licenses/LICENSE-2.0
#
# Unless ... | apache-2.0 |
bascht/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Sig.py | 61 | 2358 | #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# 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 li... | apache-2.0 |
hassoon3/odoo | addons/gamification_sale_crm/__openerp__.py | 320 | 1426 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
40223226/2015cdb_g8 | static/Brython3.1.1-20150328-091302/Lib/codecs.py | 739 | 35436 | """ codecs -- Python Codec Registry, API and helpers.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import builtins, sys
### Registry and builtin stateless codec functions
try:
from _codecs import *
except ImportError as why:
raise SystemErro... | gpl-3.0 |
mrkarthik07/libforensics | code/lf/fs/ntfs/structs.py | 13 | 6708 | # Copyright 2009 Michael Murr
#
# This file is part of LibForensics.
#
# LibForensics 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 ver... | gpl-3.0 |
rootAir/rootAir | static/crispy_forms/layout_slice.py | 29 | 6173 | # -*- coding: utf-8 -*-
from crispy_forms.compatibility import integer_types, string_types
from crispy_forms.exceptions import DynamicError
from crispy_forms.layout import Fieldset, MultiField
from crispy_forms.bootstrap import Container
class LayoutSlice(object):
# List of layout objects that need args passed fi... | gpl-2.0 |
kitsook/newssum | sources/canada.py | 1 | 22346 | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Clarence Ho (clarenceho at gmail dot com)
#
# 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... | mit |
turbomanage/training-data-analyst | courses/machine_learning/asl/open_project/time_series_anomaly_detection/tf_anomaly_detection_model_selection/anomaly_detection_module/trainer/tune_anomaly_threshold_vars.py | 2 | 5497 | import tensorflow as tf
def create_confusion_matrix_thresh_vars(scope, var_name, size):
"""Creates confusion matrix threshold variables.
Given variable scope, name, and size, create and return confusion matrix
threshold variables for true positives, false negatives, false positives,
true negatives.
Args:
... | apache-2.0 |
mlcommons/inference | vision/medical_imaging/3d-unet-brats19/tf_SUT.py | 1 | 2766 | # coding=utf-8
# Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | apache-2.0 |
cmelange/ansible | lib/ansible/modules/monitoring/stackdriver.py | 77 | 7327 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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.
... | gpl-3.0 |
OSU-Net/cyder | cyder/cydns/ip/utils.py | 5 | 2712 | import ipaddr
from django.core.exceptions import ValidationError
from cyder.cydns.validation import validate_ip_type
from cyder.cydns.domain.utils import name_to_domain
def _labels_to_reverse_name(labels, ip_type):
"""
Convert a list of octets (IPv4) or nibbles (IPv6) to a reverse domain name
"""
name... | bsd-3-clause |
eneldoserrata/marcos_openerp | addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/rpc.py | 381 | 5849 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | agpl-3.0 |
interlegis/sapl | sapl/audiencia/migrations/0012_auto_20191001_1115.py | 1 | 1711 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-10-01 14:15
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.audiencia.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('audiencia', '0011_auto_20190712_1053'),
... | gpl-3.0 |
AccelAI/accel.ai | flask-aws/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/langbulgarianmodel.py | 2965 | 12784 | ######################## 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... | mit |
benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/vpn/vpnvserver_authenticationwebauthpolicy_binding.py | 3 | 14592 | #
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | apache-2.0 |
pwhelan/djshouts | django/conf/locale/nl/formats.py | 329 | 3056 | # -*- 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' # '20 januari 2009'
TIME_FORMAT = 'H:i' ... | bsd-3-clause |
azumimuo/family-xbmc-addon | plugin.video.bubbles/resources/lib/externals/pyperclip/windows.py | 110 | 5405 | """
This module implements clipboard handling on Windows using ctypes.
"""
import time
import contextlib
import ctypes
from ctypes import c_size_t, sizeof, c_wchar_p, get_errno, c_wchar
from .exceptions import PyperclipWindowsException
class CheckedCall(object):
def __init__(self, f):
super(CheckedCall, s... | gpl-2.0 |
alexeyum/scikit-learn | examples/ensemble/plot_feature_transformation.py | 115 | 4327 | """
===============================================
Feature transformations with ensembles of trees
===============================================
Transform your features into a higher dimensional, sparse space. Then
train a linear model on these features.
First fit an ensemble of trees (totally random trees, a rand... | bsd-3-clause |
dufferzafar/mitmproxy | test/netlib/test_certutils.py | 9 | 5109 | import os
from netlib import certutils, tutils
# class TestDNTree:
# def test_simple(self):
# d = certutils.DNTree()
# d.add("foo.com", "foo")
# d.add("bar.com", "bar")
# assert d.get("foo.com") == "foo"
# assert d.get("bar.com") == "bar"
# assert not d.get("oink.com... | mit |
Pajinek/spacewalk | client/rhel/rhn-client-tools/test/testSSLSocketTimeout.py | 9 | 1223 | #!/usr/bin/python
import sys
import unittest
#Import the modules you need to test...
try: # python2
import httplib
except ImportError: # python3
import http.client as httplib
def write(blip):
sys.stdout.write("\n|%s|\n" % blip)
class TestSomething(unittest.TestCase):
def setUp(self):
self.... | gpl-2.0 |
mozilla/make.mozilla.org | vendor-local/lib/python/celery/tests/test_task/test_states.py | 16 | 1318 | from __future__ import absolute_import
from celery.states import state
from celery import states
from celery.tests.utils import Case
class test_state_precedence(Case):
def test_gt(self):
self.assertGreater(state(states.SUCCESS),
state(states.PENDING))
self.assertGreate... | bsd-3-clause |
loretoparisi/nupic | setup.py | 7 | 12879 | import glob
import numpy
import os
import re
import setuptools
import shutil
import sys
import tarfile
import urllib2
from setuptools import setup, find_packages, Extension
"""
This file builds and installs the NuPIC binaries.
"""
NUPIC_CORE_BUCKET = (
"https://s3-us-west-2.amazonaws.com/artifacts.numenta.org/nume... | agpl-3.0 |
arun6582/django | tests/utils_tests/test_feedgenerator.py | 20 | 4940 | import datetime
import unittest
from django.test import TestCase
from django.utils import feedgenerator
from django.utils.timezone import get_fixed_timezone, utc
class FeedgeneratorTest(unittest.TestCase):
"""
Tests for the low-level syndication feed framework.
"""
def test_get_tag_uri(self):
... | bsd-3-clause |
0jpq0/kbengine | kbe/src/lib/python/Lib/test/ssl_servers.py | 84 | 7044 | import os
import sys
import ssl
import pprint
import socket
import urllib.parse
# Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer.
from http.server import (HTTPServer as _HTTPServer,
SimpleHTTPRequestHandler, BaseHTTPRequestHandler)
from test import support
threading = support.import_mod... | lgpl-3.0 |
x303597316/hue | desktop/core/ext-py/kazoo-2.0/kazoo/tests/test_partitioner.py | 38 | 3179 | import uuid
import time
from nose.tools import eq_
from kazoo.testing import KazooTestCase
from kazoo.recipe.partitioner import PartitionState
class KazooPartitionerTests(KazooTestCase):
def setUp(self):
super(KazooPartitionerTests, self).setUp()
self.path = "/" + uuid.uuid4().hex
def test_... | apache-2.0 |
tannoa2/RackHD | test/benchmark/manipulator.py | 10 | 1059 | from benchmark.utils.ansible_control import ansibleControl
from benchmark.utils.case_recorder import caseRecorder
from benchmark.utils import parser
class manipulator(object):
"""
Class for controlling benchmark data collection process independently
without running any benchmark test cases
"""
def ... | apache-2.0 |
sadaf2605/django | tests/template_tests/test_engine.py | 116 | 1925 | import os
from django.template import Context
from django.template.engine import Engine
from django.test import SimpleTestCase
from .utils import ROOT, TEMPLATE_DIR
OTHER_DIR = os.path.join(ROOT, 'other_templates')
class RenderToStringTest(SimpleTestCase):
def setUp(self):
self.engine = Engine(dirs=[T... | bsd-3-clause |
Ylannl/masb2d | shp_reader.py | 1 | 2999 | import fiona
import numpy as np
from numpy.linalg import norm
def compute_normals_2d(datadict):
"""compute vertex normals by averaging incident edge normals"""
def orthogonal(vec):
v = np.array([-vec[1], vec[0]])
return v/norm(v)
def normal(p,q):
"""returns unit vector orthogo... | gpl-3.0 |
arju88nair/projectCulminate | venv/lib/python3.5/site-packages/aiohttp/test_utils.py | 2 | 16905 | """Utilities shared by tests."""
import asyncio
import contextlib
import functools
import gc
import socket
import unittest
from abc import ABC, abstractmethod
from contextlib import contextmanager
from unittest import mock
from multidict import CIMultiDict
from yarl import URL
import aiohttp
from aiohttp.client impo... | apache-2.0 |
palmerjh/iEBE | EBE-Node/iS/extractThermal/dirR.py | 34 | 12013 | ################### Last edited on Sep 24, 2009 (8:58 pm) ####################
# version 22 --- Zhi Qiu
# level 1
"""
A collection of functions helping finding or testing directories under variece condition.
Any function that modifies the file structure is in fileR modu... | gpl-3.0 |
HybridF5/hybrid-jacket | wormhole/exception.py | 1 | 4549 | import sys
from oslo.config import cfg
import webob.exc
from .i18n import _
from .common import excutils
from .common import log as logging
LOG = logging.getLogger(__name__)
exc_log_opts = [
cfg.BoolOpt('fatal_exception_format_errors',
default=False,
help='Make exception message ... | apache-2.0 |
sandeepgupta2k4/tensorflow | tensorflow/contrib/linear_optimizer/__init__.py | 158 | 1308 | # 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 |
tjsavage/rototutor_djangononrel | django/contrib/gis/geos/mutable_list.py | 405 | 10386 | # Copyright (c) 2008-2009 Aryeh Leib Taurog, all rights reserved.
# Released under the New BSD license.
"""
This module contains a base type which provides list-style mutations
without specific data storage methods.
See also http://www.aryehleib.com/MutableLists.html
Author: Aryeh Leib Taurog.
"""
class ListMixin(obj... | bsd-3-clause |
YoQuieroSaber/yournextrepresentative | results/admin.py | 2 | 1478 | from django.contrib import admin
from django.core.urlresolvers import reverse
from django.utils.text import slugify
from .models import ResultEvent
class ResultEventAdmin(admin.ModelAdmin):
list_display = (
'user',
'created',
'winner_popit_person_id',
'person_link',
'winner_... | agpl-3.0 |
todaychi/hue | desktop/core/ext-py/Django-1.6.10/tests/model_inheritance/models.py | 49 | 4260 | """
XX. Model inheritance
Model inheritance exists in two varieties:
- abstract base classes which are a way of specifying common
information inherited by the subclasses. They don't exist as a separate
model.
- non-abstract base classes (the default), which are models in their own
right with ... | apache-2.0 |
openstack/swift | test/unit/__init__.py | 1 | 46115 | # Copyright (c) 2010-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 agree... | apache-2.0 |
aureooms/networkx | networkx/algorithms/simple_paths.py | 17 | 20122 | # -*- coding: utf-8 -*-
# Copyright (C) 2012 by
# Sergio Nery Simoes <sergionery@gmail.com>
# All rights reserved.
# BSD license.
from heapq import heappush, heappop
from itertools import count
import networkx as nx
from networkx.utils import not_implemented_for
__author__ = """\n""".join(['Sérgio Nery Si... | bsd-3-clause |
littlstar/chromium.src | third_party/bintrees/bintrees/avltree.py | 156 | 10803 | #!/usr/bin/env python
#coding:utf-8
# Author: mozman (python version)
# Purpose: avl tree module (Julienne Walker's unbounded none recursive algorithm)
# source: http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx
# Created: 01.05.2010
# Copyright (c) 2010-2013 by Manfred Moitzi
# License: MIT License
... | bsd-3-clause |
kiyukuta/chainer | tests/chainer_tests/training_tests/triggers_tests/test_interval_trigger.py | 6 | 2319 | from __future__ import division
import unittest
from chainer import testing
from chainer import training
class DummyUpdater(training.Updater):
def __init__(self, iters_per_epoch):
self.iteration = 0
self.iters_per_epoch = iters_per_epoch
def finalize(self):
pass
def get_all_op... | mit |
ZhangXinNan/tensorflow | tensorflow/contrib/nn/python/ops/sampling_ops.py | 27 | 14994 | # 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 |
algorhythms/LeetCode | 043 Wildcard Matching.py | 3 | 3437 | """
Implement wildcard pattern matching with support for '?' and '*'.
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const ... | mit |
CraigHarris/gpdb | src/test/tinc/ext/simplejson/tests/test_recursion.py | 41 | 1425 | import simplejson
def test_listrecursion():
x = []
x.append(x)
try:
simplejson.dumps(x)
except ValueError:
pass
else:
assert False, "didn't raise ValueError on list recursion"
x = []
y = [x]
x.append(y)
try:
simplejson.dumps(x)
except ValueError:
... | apache-2.0 |
SixGodHuang/containerops | pilotage/examples/python/Reliability/checkCode.py | 49 | 8078 | #encoding=utf-8
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import io,shutil
import urllib,time
import getopt,string
import threading
import logging
import Queue
import urllib2
import json
import os,time
import shutil
import subprocess
import time,signal
import threading
import logging... | apache-2.0 |
c-wilson/klustaviewa | klustaviewa/views/tests/utils.py | 2 | 5162 | """Utils for unit tests for views package."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import os
import threading
import time
from qtools import QtGui, QtCore
from qtools import show_window... | bsd-3-clause |
tomchristie/django | tests/handlers/test_exception.py | 117 | 1070 | from django.core.handlers.wsgi import WSGIHandler
from django.test import SimpleTestCase, override_settings
from django.test.client import FakePayload
class ExceptionHandlerTests(SimpleTestCase):
def get_suspicious_environ(self):
payload = FakePayload('a=1&a=2;a=3\r\n')
return {
'REQU... | bsd-3-clause |
BeegorMif/HTPC-Manager | sickbeard/webserve.py | 1 | 85950 | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | gpl-3.0 |
mvesper/invenio | modules/bibrank/lib/bibrank_citation_searcher.py | 2 | 13141 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# Li... | gpl-2.0 |
isyippee/nova | nova/api/openstack/compute/networks_associate.py | 33 | 3317 | # 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
# d... | apache-2.0 |
ArabellaTech/aa-stripe | aa_stripe/migrations/0001_initial.py | 1 | 2537 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-01 14:35
from __future__ import unicode_literals
import django.db.models.deletion
import django_extensions.db.fields.json
from django.conf import settings
from django.db import migrations, models
USER_MODEL = getattr(settings, "STRIPE_USER_MODEL", settin... | mit |
Kazade/NeHe-Website | google_appengine/lib/django-1.3/tests/regressiontests/forms/tests/input_formats.py | 100 | 38975 | from datetime import time, date, datetime
from django import forms
from django.conf import settings
from django.utils.translation import activate, deactivate
from django.utils.unittest import TestCase
class LocalizedTimeTests(TestCase):
def setUp(self):
self.old_TIME_INPUT_FORMATS = settings.TIME_INPUT_F... | bsd-3-clause |
dmrub/X3DSpecificationTools | src/make_node_diagrams.py | 1 | 4142 | #!/usr/bin/env python
# make_node_diagrams.py -- Convert each node in X3D Type Hierarchy to Graphviz'
# dot format and create output image with the dot tool
#
# Author: Dmitri Rubinstein <rubinstein@cs.uni-saarland.de>
#
# Copyright (C) 2008 Saarland University
# Copyright (C) 2009, 2010, 2011... | gpl-2.0 |
eduNEXT/edx-platform | openedx/tests/xblock_integration/xblock_testcase.py | 4 | 20184 | """This file defines a testing framework for XBlocks. This framework
is designed to be independent of the edx-platform, to allow:
1. The tests to move into the XBlock repositories.
2. The tests to work in xblock-sdk and other runtimes.
This is a prototype. We reserve the right to change the APIs at any
point, and exp... | agpl-3.0 |
txm/potato | django/templatetags/i18n.py | 154 | 13327 | import re
from django.template import Node, Variable, VariableNode
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.template.base import _render_value_in_context
from django.utils import translation
from django.utils.encoding import for... | bsd-3-clause |
nubark/odoo | openerp/addons/base/res/res_currency.py | 17 | 14178 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
import time
import math
from openerp import api, fields as fields2
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools import float_round, float_is_zero, float_compare
import json
... | gpl-3.0 |
mickele77/FreeCAD | src/Mod/Fem/_ResultControlTaskPanel.py | 1 | 11088 | #***************************************************************************
#* *
#* Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
#* *
#* This pr... | lgpl-2.1 |
jzoldak/edx-platform | openedx/core/lib/block_structure/transformers.py | 21 | 6043 | """
Module for a collection of BlockStructureTransformers.
"""
import functools
from logging import getLogger
from .exceptions import TransformerException
from .transformer import FilteringTransformerMixin
from .transformer_registry import TransformerRegistry
logger = getLogger(__name__) # pylint: disable=C0103
c... | agpl-3.0 |
SmithsonianEnterprises/django-cms | cms/management/commands/subcommands/copy_site.py | 39 | 1281 | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.contrib.sites.models import Site
from django.db import transaction
from cms.models import Page
class CopySiteCommand(BaseCommand):
help = 'Copy the CMS pagetree from a specific SITE_ID.'
args = '<site_from s... | bsd-3-clause |
samdowd/drumm-farm | drumm_env/lib/python2.7/site-packages/wheel/test/test_tagopt.py | 326 | 5927 | """
Tests for the bdist_wheel tag options (--python-tag, --universal, and
--plat-name)
"""
import sys
import shutil
import pytest
import py.path
import tempfile
import subprocess
SETUP_PY = """\
from setuptools import setup, Extension
setup(
name="Test",
version="1.0",
author_email="author@example.com",
... | mit |
highfei2011/spark | python/pyspark/ml/image.py | 10 | 9695 | #
# 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 us... | apache-2.0 |
nemesisdesign/django | django/template/engine.py | 59 | 7687 | from django.core.exceptions import ImproperlyConfigured
from django.utils import lru_cache, six
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
from .base import Context, Template
from .context import _builtin_context_processors
from .exceptions import Template... | bsd-3-clause |
pkuyym/Paddle | python/paddle/fluid/tests/unittests/test_elementwise_add_op.py | 3 | 8339 | # Copyright (c) 2018 PaddlePaddle 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 appli... | apache-2.0 |
kev169/metagoofil | hachoir_core/field/link.py | 95 | 3176 | from hachoir_core.field import Field, FieldSet, ParserError, Bytes, MissingField
from hachoir_core.stream import FragmentedStream
class Link(Field):
def __init__(self, parent, name, *args, **kw):
Field.__init__(self, parent, name, 0, *args, **kw)
def hasValue(self):
return True
def creat... | gpl-2.0 |
Savaged-Zen/GNexus-Kernel-SZ | tools/perf/scripts/python/check-perf-trace.py | 11214 | 2503 | # perf script event handlers, generated by perf script -g python
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# This script tests basic functionality such as flag and symbol
# strings, common_xxx() calls back into perf, begin, end, unhandled
# events, etc. ... | gpl-2.0 |
auntieNeo/asterisk-testsuite | tests/funcs/func_talkdetect/talk_detect.py | 5 | 3440 | """Test drivers for the func_talkdetect test
Copyright (C) 2014, Digium, Inc.
Matt Jordan <mjordan@digium.com>
This program is free software, distributed under the terms of
the GNU General Public License Version 2.
"""
import logging
import json
LOGGER = logging.getLogger(__name__)
PLAYBACK_CHAN = None
TEST_CHAN =... | gpl-2.0 |
laperry1/android_external_chromium_org | third_party/cython/src/Cython/Build/BuildExecutable.py | 98 | 4286 | """
Compile a Python script into an executable that embeds CPython and run it.
Requires CPython to be built as a shared library ('libpythonX.Y').
Basic usage:
python cythonrun somefile.py [ARGS]
"""
DEBUG = True
import sys
import os
from distutils import sysconfig
def get_config_var(name, default=''):
retu... | bsd-3-clause |
felixjimenez/django | django/contrib/auth/hashers.py | 95 | 17370 | from __future__ import unicode_literals
import base64
import binascii
import hashlib
from django.dispatch import receiver
from django.conf import settings
from django.test.signals import setting_changed
from django.utils import importlib
from django.utils.datastructures import SortedDict
from django.utils.encoding im... | bsd-3-clause |
sephii/django-cms | cms/utils/mail.py | 61 | 1495 | # -*- coding: utf-8 -*-
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from django.contrib.sites.models import Site
from cms.utils.urlutils import urljoin, admin_reverse
def send_mail(subject, txt_templat... | bsd-3-clause |
jendap/tensorflow | tensorflow/contrib/proto/python/ops/decode_proto_op.py | 37 | 1155 | # =============================================================================
# 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
#... | apache-2.0 |
sunjincheng121/flink | tools/list_deps.py | 31 | 2350 | #!/usr/bin/env python
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The... | apache-2.0 |
azatoth/scons | test/dependency-cycle.py | 2 | 1992 | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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 |
GiladE/birde | venv/lib/python2.7/site-packages/setuptools/tests/test_develop.py | 286 | 3605 | """develop tests
"""
import sys
import os, shutil, tempfile, unittest
import tempfile
import site
from distutils.errors import DistutilsError
from setuptools.command.develop import develop
from setuptools.command import easy_install as easy_install_pkg
from setuptools.compat import StringIO
from setuptools.dist import... | mit |
OAButton/tricorder | plugins/python/html2text.py | 2 | 10187 | #!/usr/bin/env python
"""html2text: Turn HTML into equivalent Markdown-structured text."""
__version__ = "2.292"
__author__ = "Aaron Swartz (me@aaronsw.com)"
__copyright__ = "(C) 2004-2008 Aaron Swartz. GNU GPL 3."
__contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes"]
# TODO:
# Support decoded entities with ... | bsd-3-clause |
vmthunder/nova | nova/tests/integrated/integrated_helpers.py | 15 | 5340 | # Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 |
WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/django/utils/version.py | 104 | 2459 | from __future__ import unicode_literals
import datetime
import os
import subprocess
from django.utils.lru_cache import lru_cache
def get_version(version=None):
"Returns a PEP 386-compliant version number from VERSION."
version = get_complete_version(version)
# Now build the two parts of the version num... | bsd-3-clause |
marcydoty/geraldo | site/newsite/site-geraldo/django/contrib/localflavor/us/models.py | 21 | 1097 | from django.conf import settings
from django.db.models.fields import Field
class USStateField(Field):
def get_internal_type(self):
return "USStateField"
def db_type(self):
if settings.DATABASE_ENGINE == 'oracle':
return 'CHAR(2)'
else:
return 'varchar... | lgpl-3.0 |
tangrams/earcut.hpp | deps/gyp/pylib/gyp/generator/xcode.py | 6 | 55782 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import filecmp
import gyp.common
import gyp.xcodeproj_file
import gyp.xcode_ninja
import errno
import os
import sys
import posixpath
import re
import shutil
import... | isc |
hashems/Mobile-Cloud-Development-Projects | monitoring/api/v2/lightweight_custom_metric.py | 2 | 4100 | #!/usr/bin/env python
# Copyright 2015 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... | apache-2.0 |
pauleveritt/pyramid_sqltraversal | docs/parents/mysite/views.py | 1 | 1982 | from random import randint
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config
from .models.folder import RootFolder, Folder
from .models.document import Document
class RootViews:
def __init__(self, context, request):
self.context = context
self.request = request
... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.