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 |
|---|---|---|---|---|---|
danguria/linux-kernel-study | tools/perf/scripts/python/sctop.py | 895 | 1936 | # system call top
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Periodically displays system-wide system call totals, broken down by
# syscall. If a [comm] arg is specified, only syscalls called by
# [comm] are displayed. If an [interval] arg is specified,... | gpl-2.0 |
okuta/chainer | chainer/types.py | 4 | 2270 | import numbers
import typing as tp # NOQA
import typing_extensions as tpe # NOQA
try:
from typing import TYPE_CHECKING # NOQA
except ImportError:
# typing.TYPE_CHECKING doesn't exist before Python 3.5.2
TYPE_CHECKING = False
# import chainer modules only for type checkers to avoid circular import
if TY... | mit |
bhansa/fireball | pyvenv/Lib/site-packages/pip/_vendor/requests/packages/chardet/charsetprober.py | 3127 | 1902 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | gpl-3.0 |
jlmadurga/django-oscar | src/oscar/apps/dashboard/users/views.py | 19 | 8320 | from django.conf import settings
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic import (
DeleteView, DetailView, FormView, ListView... | bsd-3-clause |
sfstpala/Victory-Chat | cherrypy/test/test_auth_digest.py | 42 | 4553 | # This file is part of CherryPy <http://www.cherrypy.org/>
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab:fileencoding=utf-8
import cherrypy
from cherrypy.lib import auth_digest
from cherrypy.test import helper
class DigestAuthTest(helper.CPWebCase):
def setup_server():
class Root:
def i... | isc |
yafeunteun/wikipedia-spam-classifier | revscoring/revscoring/features/wikibase/util.py | 3 | 1550 | class DictDiff:
"""
Represents the difference between two dictionaries
"""
__slots__ = ('added', 'removed', 'intersection', 'changed', 'unchanged')
def __init__(self, added, removed, intersection, changed, unchanged):
self.added = added
"""
`set` ( `mixed` ) : Keys that were... | mit |
dibenede/NFD-ICN2014 | ICN2014-apps/consumer.py | 2 | 4500 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
# Copyright (c) 2013-2014 Regents of the University of California.
# Copyright (c) 2014 Susmit Shannigrahi, Steve DiBenedetto
#
# This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
#
# ndn-cxx library is free software... | gpl-3.0 |
Eric89GXL/scipy | scipy/optimize/tests/test_lsq_common.py | 11 | 8749 | from __future__ import division, absolute_import, print_function
from numpy.testing import assert_, assert_allclose, assert_equal
from pytest import raises as assert_raises
import numpy as np
from scipy.sparse.linalg import LinearOperator
from scipy.optimize._lsq.common import (
step_size_to_bound, find_active_co... | bsd-3-clause |
sumedh123/debatify | venv/lib/python2.7/site-packages/pip/utils/build.py | 899 | 1312 | from __future__ import absolute_import
import os.path
import tempfile
from pip.utils import rmtree
class BuildDirectory(object):
def __init__(self, name=None, delete=None):
# If we were not given an explicit directory, and we were not given an
# explicit delete option, then we'll default to del... | mit |
joshuaspence/ThesisCode | MATLAB/Lib/matlab_bgl-4.0.1/libmbgl/boost1.36/libs/python/pyste/src/Pyste/exporterutils.py | 54 | 3331 | # Copyright Bruno da Silva de Oliveira 2003. Use, modification and
# distribution is subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
'''
Various helpers for interface files.
'''
from settings import *
from policies impor... | gpl-3.0 |
houlixin/BBB-TISDK | linux-devkit/sysroots/i686-arago-linux/usr/lib/python2.7/encodings/hex_codec.py | 528 | 2309 | """ Python 'hex_codec' Codec - 2-digit hex content transfer encoding
Unlike most of the other codecs which target Unicode, this codec
will return Python string objects for both encode and decode.
Written by Marc-Andre Lemburg (mal@lemburg.com).
"""
import codecs, binascii
### Codec APIs
def hex_encode(... | gpl-2.0 |
V11/volcano | server/sqlmap/thirdparty/chardet/euckrprober.py | 236 | 1672 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org 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 Reserved.
#
# Con... | mit |
coffenbacher/askbot-devel | askbot/importers/stackexchange/models.py | 21 | 14019 | from django.db import models
class Badge(models.Model):
id = models.IntegerField(primary_key=True)
class_type = models.IntegerField(null=True)
name = models.CharField(max_length=50, null=True)
description = models.TextField(null=True)
single = models.NullBooleanField(null=True)
secret = models.N... | gpl-3.0 |
davidwaroquiers/abiflows | abiflows/fireworks/utils/custodian_utils.py | 2 | 3730 | import abc
from custodian.custodian import ErrorHandler, Validator
#TODO: do we stick to custodian's ErrorHandler/Validator inheritance ??
class SRCErrorHandler(ErrorHandler):
HANDLER_PRIORITIES = {'PRIORITY_FIRST': 0,
'PRIORITY_VERY_HIGH': 1,
'PRIORITY_HIGH':... | gpl-2.0 |
oinopion/django | tests/utils_tests/test_module_loading.py | 281 | 9516 | import imp
import os
import sys
import unittest
from importlib import import_module
from zipimport import zipimporter
from django.test import SimpleTestCase, modify_settings
from django.test.utils import extend_sys_path
from django.utils import six
from django.utils._os import upath
from django.utils.module_loading im... | bsd-3-clause |
brian-l/django-1.4.10 | tests/regressiontests/admin_views/admin.py | 18 | 19542 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import tempfile
import os
from django import forms
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.core.files.storage import FileSystemStorage
from django.core.mail import EmailMessage
from django.conf.u... | bsd-3-clause |
yannrouillard/weboob | modules/arte/video.py | 2 | 1250 | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | agpl-3.0 |
bakkou-badri/dataminingproject | env/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/big5prober.py | 2931 | 1684 | ######################## 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 |
ncoghlan/prototype | integration-tests/features/steps/cockpit_demo.py | 2 | 14754 | """Steps to test the demonstration Cockpit plugin"""
from behave import given, when, then
from hamcrest import (
assert_that, equal_to, greater_than, greater_than_or_equal_to
)
@given("Cockpit is installed on the testing host")
def check_cockpit_is_installed(context):
"""Checks for the `cockpit-bridge` command... | lgpl-2.1 |
ulikoehler/UliEngineering | UliEngineering/Electronics/MOSFET.py | 1 | 1960 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Utility to calculate MOSFETs
"""
import numpy as np
from UliEngineering.EngineerIO import normalize_numeric
from UliEngineering.Units import Unit
__all__ = ["mosfet_gate_charge_losses", "mosfet_gate_charge_loss_per_cycle"]
def mosfet_gate_charge_losses(total_gate_cha... | apache-2.0 |
yuchangfu/pythonfun | flaskenv/Lib/site-packages/pip/commands/show.py | 344 | 2767 | import os
from pip.basecommand import Command
from pip.log import logger
from pip._vendor import pkg_resources
class ShowCommand(Command):
"""Show information about one or more installed packages."""
name = 'show'
usage = """
%prog [options] <package> ..."""
summary = 'Show information about in... | gpl-3.0 |
zpincus/celltool | celltool/utility/image.py | 1 | 1424 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
"""Tools to read and write numpy arrays from and to image files.
"""
... | gpl-2.0 |
40223222/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/opcode.py | 714 | 5442 |
"""
opcode module - potentially shared between dis and other modules which
operate on bytecodes (e.g. peephole optimizers).
"""
__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs",
"haslocal", "hascompare", "hasfree", "opname", "opmap",
"HAVE_ARGUMENT", "EXTENDED_ARG", "hasnargs"]
... | gpl-3.0 |
AlphaStaxLLC/tornado | tornado/test/testing_test.py | 144 | 7361 | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
from tornado import gen, ioloop
from tornado.log import app_log
from tornado.testing import AsyncTestCase, gen_test, ExpectLog
from tornado.test.util import unittest
import contextlib
import os
import traceback
@... | apache-2.0 |
AlperSaltabas/OR_Tools_Google_API | examples/python/alldifferent_except_0.py | 32 | 3637 | # Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | apache-2.0 |
cschnei3/forseti-security | tests/inventory/pipelines/test_data/fake_buckets.py | 3 | 4791 | # Copyright 2017 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 agreed to in writing, s... | apache-2.0 |
junhuac/MQUIC | src/testing/gtest/test/gtest_help_test.py | 2968 | 5856 | #!/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... | mit |
alexgibson/bedrock | lib/fluent_migrations/firefox/set-as-default/landing.py | 6 | 6217 | from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import transforms_from
from fluent.migrate.helpers import VARIABLE_REFERENCE, TERM_REFERENCE
from fluent.migrate import REPLACE, COPY
whatsnew_73 = "firefox/whatsnew_73.lang"
def migrate(ctx):
"""Migrate bedrock/fir... | mpl-2.0 |
PriceChild/ansible | contrib/inventory/zone.py | 57 | 1489 | #!/usr/bin/env python
# (c) 2015, Dagobert Michelsen <dam@baltic-online.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
# ... | gpl-3.0 |
FujitsuEnablingSoftwareTechnologyGmbH/tempest | tempest/api/orchestration/stacks/test_templates.py | 4 | 2155 | # 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 |
Mirantis/tempest | tempest/openstack/common/fixture/lockutils.py | 15 | 1890 | # Copyright 2011 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 req... | apache-2.0 |
SKA-ScienceDataProcessor/algorithm-reference-library | workflows/serial/imaging/imaging_serial.py | 1 | 21976 | """Manages the imaging context. This take a string and returns a dictionary containing:
* Predict function
* Invert function
* image_iterator function
* vis_iterator function
"""
__all__ = ['predict_list_serial_workflow', 'invert_list_serial_workflow', 'residual_list_serial_workflow',
'restore_list_ser... | apache-2.0 |
anthill-platform/anthill-exec | anthill/exec/options.py | 1 | 1753 |
from anthill.common.options import define
# Main
define("host",
default="http://localhost:9507",
help="Public hostname of this service",
type=str)
define("listen",
default="port:9507",
help="Socket to listen. Could be a port number (port:N), or a unix domain socket (unix:PATH)",
... | mit |
afloren/nipype | nipype/interfaces/slicer/filtering/tests/test_auto_MultiplyScalarVolumes.py | 9 | 1237 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.slicer.filtering.arithmetic import MultiplyScalarVolumes
def test_MultiplyScalarVolumes_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
... | bsd-3-clause |
TeslaProject/external_chromium_org | build/android/pylib/instrumentation/test_result.py | 110 | 1183 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from pylib.base import base_test_result
class InstrumentationTestResult(base_test_result.BaseTestResult):
"""Result information for a single instrume... | bsd-3-clause |
domijin/Pset | assignment1/q2_sigmoid.py | 1 | 1346 | import numpy as np
def sigmoid(x):
"""
Compute the sigmoid function for the input here.
"""
x = 1./(1 + np.exp(-x))
return x
def sigmoid_grad(f):
"""
Compute the gradient for the sigmoid function here. Note that
for this implementation, the input f should be the sigmoid
f... | mit |
google/llvm-propeller | lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py | 4 | 3374 | """
Test watchpoint condition API.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class WatchpointConditionAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_... | apache-2.0 |
jfantom/incubator-airflow | tests/contrib/hooks/test_spark_sql_hook.py | 16 | 3922 | # -*- 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, software
... | apache-2.0 |
newemailjdm/scipy | scipy/integrate/tests/test_quadpack.py | 19 | 12363 | from __future__ import division, print_function, absolute_import
import sys
import math
import numpy as np
from numpy import sqrt, cos, sin, arctan, exp, log, pi, Inf
from numpy.testing import (assert_, TestCase, run_module_suite, dec,
assert_allclose, assert_array_less, assert_almost_equal)
from scipy.integra... | bsd-3-clause |
blueskycoco/rt-thread | bsp/stm32/stm32f103-onenet-nbiot/rtconfig.py | 14 | 4024 | import os
# toolchains options
ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute... | gpl-2.0 |
CodeRiderz/rojak | rojak-analyzer/show_data_stats.py | 4 | 2488 | import csv
from collections import Counter
import re
from bs4 import BeautifulSoup
csv_file = open('data_detikcom_labelled_740.csv')
csv_reader = csv.DictReader(csv_file)
words = []
docs = []
label_counter = {}
unique_label_counter = {}
for row in csv_reader:
title = row['title'].strip().lower()
raw_content ... | bsd-3-clause |
Arakmar/Sick-Beard | lib/imdb/linguistics.py | 50 | 9220 | """
linguistics module (imdb package).
This module provides functions and data to handle in a smart way
languages and articles (in various languages) at the beginning of movie titles.
Copyright 2009-2012 Davide Alberani <da@erlug.linux.it>
2012 Alberto Malagoli <albemala AT gmail.com>
2009 H. Turg... | gpl-3.0 |
rwl/PyCIM | CIM15/CDPSM/Geographical/IEC61970/Wires/PowerTransformer.py | 1 | 5736 | # 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 |
cpe/VAMDC-VALD | nodes/tipbase/node/queryfunc.py | 2 | 9280 | # -*- coding: utf-8 -*-
#
# This module (which must have the name queryfunc.py) is responsible
# for converting incoming queries to a database query understood by
# this particular node's database schema.
#
# This module must contain a function setupResults, taking a sql object
# as its only argument.
#
# library im... | gpl-3.0 |
JamesClough/networkx | examples/drawing/giant_component.py | 15 | 2287 | #!/usr/bin/env python
"""
This example illustrates the sudden appearance of a
giant connected component in a binomial random graph.
Requires pygraphviz and matplotlib to draw.
"""
# Copyright (C) 2006-2016
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>... | bsd-3-clause |
yamahata/neutron | neutron/plugins/vmware/api_client/request.py | 7 | 12120 | # Copyright 2012 VMware, Inc.
#
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/django/utils/translation/trans_null.py | 467 | 1408 | # These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
from django.conf import settings
from django.utils.encoding import force_text
def ngettext... | bsd-3-clause |
pombreda/syzygy | third_party/numpy/files/numpy/distutils/fcompiler/g95.py | 94 | 1313 | # http://g95.sourceforge.net/
from numpy.distutils.fcompiler import FCompiler
compilers = ['G95FCompiler']
class G95FCompiler(FCompiler):
compiler_type = 'g95'
description = 'G95 Fortran Compiler'
# version_pattern = r'G95 \((GCC (?P<gccversion>[\d.]+)|.*?) \(g95!\) (?P<version>.*)\).*'
# $ g95 --ver... | apache-2.0 |
centricular/cerbero | cerbero/commands/build.py | 1 | 3560 | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | lgpl-2.1 |
alangwansui/mtl_ordercenter | openerp/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ModifyExistingReport.py | 384 | 8450 | #########################################################################
#
# 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 |
agile-geoscience/seisplot | notice.py | 1 | 1873 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Notices during runtime.
:copyright: 2015 Agile Geoscience
:license: Apache 2.0
"""
class Notice(object):
"""
Helper class to make printout more readable.
"""
styles = {'HEADER': '\033[95m',
'INFO': '\033[94m', # blue
'... | apache-2.0 |
ptdtan/Ragout | lib/networkx/exception.py | 41 | 1660 | # -*- coding: utf-8 -*-
"""
**********
Exceptions
**********
Base exceptions and errors for NetworkX.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)\nPieter Swart (swart@lanl.gov)\nDan Schult(dschult@colgate.edu)\nLoïc Séguin-C. <loicseguin@gmail.com>"""
# Copyright (C) 2004-2011 by
# Aric Hagberg <hagberg... | gpl-3.0 |
IRI-Research/django | django/core/management/commands/inspectdb.py | 6 | 11091 | from __future__ import unicode_literals
from collections import OrderedDict
import keyword
import re
from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
class Command(NoArgsCommand):
help = "Introspects the data... | bsd-3-clause |
virtualelephant/openstack-heat-bde-plugin | scripts/createRestAPI.py | 1 | 2262 | #!/usr/bin/python
# Testing module for REST API code in BDE
#
# Chris Mutchler - chris@virtualelephant.com
# http://www.VirtualElephant.com
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of... | apache-2.0 |
jcfr/girder | tests/cases/access_test.py | 1 | 5001 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2014 Kitware 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 cop... | apache-2.0 |
jimsimon/sky_engine | third_party/jinja2/tests.py | 638 | 3444 | # -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
from jinja2.runtime import Undefined
from jinja2._compat import text_type, string_types, mappi... | bsd-3-clause |
chirilo/kitsune | kitsune/upload/tests/test_models.py | 17 | 1259 | from django.contrib.contenttypes.models import ContentType
from django.core.files import File
from nose.tools import eq_
from kitsune.questions.tests import question
from kitsune.sumo.tests import TestCase
from kitsune.upload.models import ImageAttachment
from kitsune.upload.tasks import generate_thumbnail
from kitsu... | bsd-3-clause |
darisandi/geonode | geonode/social/signals.py | 2 | 9849 | #########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... | gpl-3.0 |
0x0all/scikit-learn | sklearn/manifold/tests/test_t_sne.py | 10 | 9541 | import sys
from sklearn.externals.six.moves import cStringIO as StringIO
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_raises_regexp
... | bsd-3-clause |
Johnetordoff/osf.io | osf_tests/test_search_views.py | 6 | 15204 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from nose.tools import * # noqa: F403
from osf_tests import factories
from tests.base import OsfTestCase
from website.util import api_url_for
from website.views import find_bookmark_collection
@... | apache-2.0 |
colonelnugget/pychess | testing/eval.py | 21 | 2202 | import unittest
from pychess.Utils.const import *
from pychess.Utils.lutils.LBoard import LBoard
from pychess.Utils.lutils.leval import evaluateComplete
from pychess.Utils.lutils import leval
class EvalTestCase(unittest.TestCase):
def setUp (self):
self.board = LBoard(NORMALCHESS)
self.boar... | gpl-3.0 |
Farkal/kivy | kivy/core/image/img_tex.py | 54 | 1548 | '''
Tex: Compressed texture
'''
__all__ = ('ImageLoaderTex', )
import json
from struct import unpack
from kivy.logger import Logger
from kivy.core.image import ImageLoaderBase, ImageData, ImageLoader
class ImageLoaderTex(ImageLoaderBase):
@staticmethod
def extensions():
return ('tex', )
def lo... | mit |
axbaretto/beam | sdks/python/.tox/docs/lib/python2.7/site-packages/requests/packages/chardet/universaldetector.py | 1776 | 6840 | ######################## 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... | apache-2.0 |
saisai/phantomjs | src/breakpad/src/tools/gyp/pylib/gyp/generator/xcode.py | 137 | 50429 | #!/usr/bin/python
# Copyright (c) 2009 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 errno
import os
import posixpath
import re
import shutil
import subprocess
imp... | bsd-3-clause |
tcoxon/association | google.py | 1 | 1780 |
import json, time
from math import log
from urllib import quote_plus
import urllib2
_COUNT_URL = 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q='
_AUTOCOMPLETE_URL = 'http://suggestqueries.google.com/complete/search?client=chrome&q='
_GOOGLE_ENCODING = 'latin-1'
_last_query_time = 0.0
_QUERY_DELAY =... | bsd-3-clause |
dellax/django-files-widget | topnotchdev/files_widget/settings.py | 1 | 1103 | from django.conf import settings
FILES_DIR = getattr(settings, 'FILES_WIDGET_FILES_DIR', 'uploads/files_widget/')
OLD_VALUE_STR = getattr(settings, 'FILES_WIDGET_OLD_VALUE_STR', 'old_%s_value')
DELETED_VALUE_STR = getattr(settings, 'FILES_WIDGET_DELETED_VALUE_STR', 'deleted_%s_value')
MOVED_VALUE_STR = getattr(setting... | mit |
ladybug-analysis-tools/honeybee | honeybee/radiance/command/gendaymtx.py | 1 | 4200 | # coding=utf-8
from _commandbase import RadianceCommand
from ..parameters.gendaymtx import GendaymtxParameters
import os
class Gendaymtx(RadianceCommand):
u"""
gendaymtx - Generate an annual Perez sky matrix from a weather tape.
Attributes:
output_name: An optional name for output file name. If ... | gpl-3.0 |
postlund/home-assistant | homeassistant/components/cloudflare/__init__.py | 13 | 2256 | """Update the IP addresses of your Cloudflare DNS records."""
from datetime import timedelta
import logging
from pycfdns import CloudflareUpdater
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_EMAIL, CONF_ZONE
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers... | apache-2.0 |
PGower/Unsync | unsync_timetabler/unsync_timetabler/ptf9/student_timetable_import.py | 1 | 1359 | """Timetabler PTF9 import functions."""
import unsync
import petl
@unsync.command()
@unsync.option('--input-file', '-i', type=unsync.Path(exists=True, dir_okay=False, readable=True, resolve_path=True), help='Timetabler PTF9 file to extract data from.', required=True)
@unsync.option('--destination', '-d', required=Tru... | apache-2.0 |
shacker/django | tests/m2o_recursive/tests.py | 71 | 1678 | from django.test import TestCase
from .models import Category, Person
class ManyToOneRecursiveTests(TestCase):
def setUp(self):
self.r = Category(id=None, name='Root category', parent=None)
self.r.save()
self.c = Category(id=None, name='Child category', parent=self.r)
self.c.save... | bsd-3-clause |
sadleader/odoo | addons/stock_account/wizard/__init__.py | 351 | 1105 | # -*- 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 |
Mistobaan/tensorflow | tensorflow/python/util/compat.py | 58 | 3499 | # 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 |
leppa/home-assistant | homeassistant/components/sql/sensor.py | 5 | 4817 | """Sensor from an SQL Query."""
import datetime
import decimal
import logging
import sqlalchemy
from sqlalchemy.orm import scoped_session, sessionmaker
import voluptuous as vol
from homeassistant.components.recorder import CONF_DB_URL, DEFAULT_DB_FILE, DEFAULT_URL
from homeassistant.components.sensor import PLATFORM_... | apache-2.0 |
huggingface/transformers | src/transformers/models/vit/convert_vit_timm_to_pytorch.py | 2 | 9959 | # coding=utf-8
# Copyright 2021 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 |
loco-odoo/localizacion_co | openerp/addons-extra/odoo-pruebas/odoo-server/addons/lunch/tests/test_lunch.py | 345 | 5045 | # -*- 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 of ... | agpl-3.0 |
rwl/muntjac | muntjac/data/validatable.py | 1 | 2850 | # @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
"""Interface for validatable objects."""
class IValidatable(object):
"""Interface for validatable objects. Defines methods to verify if the
object's value is valid or not, and to add, remove and list registered
validators of the object.
@author: Vaadin Ltd.
... | apache-2.0 |
gkumar7/AlGDock | AlGDock/BindingPMF.py | 2 | 149901 | #!/usr/bin/env python
import os # Miscellaneous operating system interfaces
from os.path import join
import cPickle as pickle
import gzip
import copy
import time
import numpy as np
import MMTK
import MMTK.Units
from MMTK.ParticleProperties import Configuration
from MMTK.ForceFields import ForceField
import Scientif... | mit |
imsuwj/noambox | model.py | 1 | 1420 | '''
Provide the Data Model
'''
import time
class Config(object):
def __init__(self):
self.play = Playing()
self.use_netease_source = False
self.scroll_lryic = False
self.enable_rpc = False
class Playing(object):
def __init__(self):
self.title = ''
self.singer... | mit |
GageGaskins/osf.io | website/exceptions.py | 7 | 1484 | from website.tokens.exceptions import TokenError
class OSFError(Exception):
"""Base class for exceptions raised by the Osf application"""
pass
class NodeError(OSFError):
"""Raised when an action cannot be performed on a Node model"""
pass
class NodeStateError(NodeError):
"""Raised when the Node... | apache-2.0 |
pinpong/android_kernel_htc_m7-gpe | tools/perf/util/setup.py | 4998 | 1330 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... | gpl-2.0 |
bitifirefly/edx-platform | lms/djangoapps/instructor/management/tests/test_openended_commands.py | 106 | 8584 | """Test the openended_post management command."""
from datetime import datetime
import json
from mock import patch
from pytz import UTC
from django.conf import settings
from opaque_keys.edx.locations import Location
import capa.xqueue_interface as xqueue_interface
from courseware.courses import get_course_with_acces... | agpl-3.0 |
LifeDJIK/S.H.I.V.A. | containers/shiva/hazelcast/protocol/codec/client_add_membership_listener_codec.py | 2 | 2425 | from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.client_message_type import *
from hazelcast.protocol.event_response_const import *
REQUEST_... | mit |
olatoft/reverse-hangman | lib/python3.5/site-packages/pip/req/req_uninstall.py | 510 | 6897 | from __future__ import absolute_import
import logging
import os
import tempfile
from pip.compat import uses_pycache, WINDOWS, cache_from_source
from pip.exceptions import UninstallationError
from pip.utils import rmtree, ask, is_local, renames, normalize_path
from pip.utils.logging import indent_log
logger = loggin... | gpl-3.0 |
waytai/django | tests/template_tests/syntax_tests/test_with.py | 391 | 2245 | from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class WithTagTests(SimpleTestCase):
@setup({'with01': '{% with key=dict.key %}{{ key }}{% endwith %}'})
def test_with01(self):
output = self.engine.render_to_string('with01', {'dict': {'k... | bsd-3-clause |
sysadmin75/ansible | test/support/integration/plugins/modules/postgresql_user.py | 51 | 34084 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': [... | gpl-3.0 |
turian/batchtrain | hyperparameters.py | 1 | 5497 | from locals import *
from collections import OrderedDict
import itertools
import sklearn.linear_model
import sklearn.svm
import sklearn.ensemble
import sklearn.neighbors
import sklearn.semi_supervised
import sklearn.naive_bayes
# Code from http://rosettacode.org/wiki/Power_set#Python
def list_powerset2(lst):
ret... | bsd-3-clause |
GeotrekCE/Geotrek-admin | mapentity/decorators.py | 2 | 5841 | from functools import wraps
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_control
from django.views.decorators.http import last_modified as cache_last_modified
from django.utils.translation import gettext_lazy as _
from django.core.exceptions import PermissionDeni... | bsd-2-clause |
ybellavance/python-for-android | python3-alpha/python3-src/Lib/test/test_keywordonlyarg.py | 49 | 6367 | #!/usr/bin/env python3
"""Unit tests for the keyword only argument specified in PEP 3102."""
__author__ = "Jiwon Seo"
__email__ = "seojiwon at gmail dot com"
import unittest
from test.support import run_unittest
def posonly_sum(pos_arg1, *arg, **kwarg):
return pos_arg1 + sum(arg) + sum(kwarg.values())
def keywo... | apache-2.0 |
joelpinheiro/safebox-smartcard-auth | Server/veserver/lib/python2.7/site-packages/cherrypy/lib/covercp.py | 58 | 11592 | """Code-coverage tools for CherryPy.
To use this module, or the coverage tools in the test suite,
you need to download 'coverage.py', either Gareth Rees' `original
implementation <http://www.garethrees.org/2001/12/04/python-coverage/>`_
or Ned Batchelder's `enhanced version:
<http://www.nedbatchelder.com/code/modules/... | gpl-2.0 |
evandavid/dodolipet | yowsup/layers/axolotl/store/sqlite/litesessionstore.py | 53 | 2155 | from axolotl.state.sessionstore import SessionStore
from axolotl.state.sessionrecord import SessionRecord
class LiteSessionStore(SessionStore):
def __init__(self, dbConn):
"""
:type dbConn: Connection
"""
self.dbConn = dbConn
dbConn.execute("CREATE TABLE IF NOT EXISTS session... | gpl-3.0 |
thelastpickle/python-driver | tests/integration/cqlengine/columns/test_static_column.py | 3 | 3323 | # Copyright DataStax, 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, softwa... | apache-2.0 |
lifemapper/core | LmCompute/plugins/multi/calculate/calculate.py | 1 | 9421 | """Module containing functions to calculate PAM statistics
Todo:
Convert to use Matrix instead of numpy matrices
"""
import numpy as np
from LmCommon.common.lmconstants import PamStatKeys, PhyloTreeKeys
from LmCompute.plugins.multi.calculate import ot_phylo
from lmpy import Matrix
# ............................... | gpl-3.0 |
awamper/draobpilc | draobpilc/widgets/items_view.py | 1 | 13650 | #!/usr/bin/env python3
# Copyright 2015 Ivan awamper@gmail.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# Th... | gpl-3.0 |
gseismic/vnpy | vn.ctp/vnctptd/test/tdtest.py | 96 | 4886 | # encoding: UTF-8
import sys
from time import sleep
from PyQt4 import QtGui
from vnctptd import *
#----------------------------------------------------------------------
def print_dict(d):
"""按照键值打印一个字典"""
for key,value in d.items():
print key + ':' + str(value)
#------------------... | mit |
blckshrk/Weboob | modules/gazelle/backend.py | 1 | 2167 | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | agpl-3.0 |
wowadrien/SFGP | node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py | 2710 | 5094 | # 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.
"""Visual Studio user preferences file writer."""
import os
import re
import socket # for gethostname
import gyp.common
import gyp.easy_xml as easy_xml
#------... | apache-2.0 |
rcfduarte/nmsat | projects/examples/scripts/single_neuron_dcinput.py | 1 | 7658 | __author__ = 'duarte'
from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict
from modules.input_architect import EncodingLayer
from modules.net_architect import Network
from modules.io import set_storage_locations
from modules.signals import iterate_obj_list
from modules.analysis import sin... | gpl-2.0 |
huguesv/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/pip/_internal/utils/glibc.py | 5 | 3282 | from __future__ import absolute_import
import ctypes
import re
import warnings
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Optional, Tuple
def glibc_version_string():
# type: () -> Optional[str]
"Returns glibc version string, or None if not using ... | apache-2.0 |
tiborsimko/zenodo | zenodo/modules/search_ui/__init__.py | 8 | 1063 | # -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2015 CERN.
#
# Zenodo 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 v... | gpl-2.0 |
nttks/edx-platform | common/test/utils.py | 61 | 3533 | """
General testing utilities.
"""
import sys
from contextlib import contextmanager
from django.dispatch import Signal
from markupsafe import escape
from mock import Mock, patch
@contextmanager
def nostderr():
"""
ContextManager to suppress stderr messages
http://stackoverflow.com/a/1810086/882918
"""... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.