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 |
|---|---|---|---|---|---|
quantumlib/OpenFermion | src/openfermion/transforms/repconversions/operator_tapering_test.py | 1 | 1640 | # 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
# distribu... | apache-2.0 |
gooftroop/Zeus | contrib/tornado/test/tcpserver_test.py | 105 | 1278 | import socket
from tornado import gen
from tornado.iostream import IOStream
from tornado.log import app_log
from tornado.stack_context import NullContext
from tornado.tcpserver import TCPServer
from tornado.testing import AsyncTestCase, ExpectLog, bind_unused_port, gen_test
class TCPServerTest(AsyncTestCase):
@g... | mit |
yqm/sl4a | python/src/Lib/commands.py | 58 | 2540 | """Execute shell commands via os.popen() and return status, output.
Interface summary:
import commands
outtext = commands.getoutput(cmd)
(exitstatus, outtext) = commands.getstatusoutput(cmd)
outtext = commands.getstatus(file) # returns output of "ls -ld file"
A trailing newline is remov... | apache-2.0 |
scipsycho/mlpack | linear_regression.py | 1 | 8215 | import numpy as np
class linear_regression:
def __init__(self,batch_size=0,epochs=100,learning_rate=0.001,tolerance=0.00001,show_progress=True):
"""
The function initiaizes the class
Parameters
----------
batch_size: int
It defines the number of data se... | mit |
rabernat/mitgcm-xray | _xgcm/mdsxray.py | 2 | 23927 | import operator
from glob import glob
import os
import re
import warnings
import numpy as np
import dask.array as da
import xray
from xray import Variable
from xray.backends.common import AbstractDataStore
from xray.core.utils import NDArrayMixin
from xray.core.pycompat import OrderedDict
from xray.core.indexing impo... | mit |
LxMLS/lxmls-toolkit | lxmls/deep_learning/numpy_models/log_linear.py | 1 | 1802 | import numpy as np
from lxmls.deep_learning.utils import (
Model,
glorot_weight_init,
index2onehot,
logsumexp
)
class NumpyLogLinear(Model):
def __init__(self, **config):
# Initialize parameters
weight_shape = (config['input_size'], config['num_classes'])
# after Xavier G... | mit |
PierreFaniel/openerp-7.0 | stock_landed_costs/__init__.py | 2 | 1191 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2014 Elico Corp (<http://www.elico-corp.com>)
# Alex Duan <alex.duan@elico-corp.com>
#
# This program is free software: you can redistribut... | agpl-3.0 |
vwarg/ubuntutouch-kernel-jfltexx | tools/perf/scripts/python/sched-migration.py | 11215 | 11670 | #!/usr/bin/python
#
# Cpu task migration overview toy
#
# Copyright (C) 2010 Frederic Weisbecker <fweisbec@gmail.com>
#
# perf script event handlers have been generated by perf script -g python
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Fre... | gpl-2.0 |
amjad-twalo/icsisumm | icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk/corpus/reader/xmldocs.py | 9 | 1313 | # Natural Language Toolkit: XML Corpus Reader
#
# Copyright (C) 2001-2008 University of Pennsylvania
# Author: Steven Bird <sb@csse.unimelb.edu.au>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
"""
Corpus reader for corpora whose documents are xml files.
(note -- not named 'xml' to avoid conf... | gpl-3.0 |
bigzz/ZenKernel_Shamu | Documentation/target/tcm_mod_builder.py | 2358 | 40707 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | gpl-2.0 |
Brunux/shityjobs | shityjobs/users/migrations/0001_initial.py | 1 | 2931 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-21 00:17
from __future__ import unicode_literals
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... | mit |
starrybeam/samba | source4/scripting/bin/gen_hresult.py | 19 | 9170 | #!/usr/bin/env python
#
# Unix SMB/CIFS implementation.
#
# HRESULT Error definitions
#
# Copyright (C) Noel Power <noel.power@suse.com> 2014
#
# 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; e... | gpl-3.0 |
pkoutsias/SickRage | lib/guessit/language.py | 3 | 11578 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2013 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | gpl-3.0 |
azumimuo/family-xbmc-addon | script.module.livestreamer/lib/livestreamer/packages/flashmedia/types.py | 42 | 45802 | from .compat import OrderedDict, is_py2, str, bytes, integer_types, string_types
from .util import pack_bytes_into
from collections import namedtuple
from struct import Struct, error as struct_error
from inspect import getargspec
(SCRIPT_DATA_TYPE_NUMBER, SCRIPT_DATA_TYPE_BOOLEAN,
SCRIPT_DATA_TYPE_STRING, SCRIPT_DAT... | gpl-2.0 |
40223240/cadb_g3_0420 | static/Brython3.1.1-20150328-091302/Lib/unittest/test/test_break.py | 785 | 8138 | import gc
import io
import os
import sys
import signal
import weakref
import unittest
@unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill")
@unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows")
@unittest.skipIf(sys.platform == 'freebsd6', "Test kills regrtest on freebsd6 "
"if threa... | gpl-3.0 |
halberom/ansible | lib/ansible/plugins/shell/fish.py | 45 | 4770 | # (c) 2014, Chris Church <chris@ninemoreminutes.com>
#
# 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 lat... | gpl-3.0 |
rbunge/CI-ArduPlane | Tools/autotest/dump_logs.py | 229 | 1762 | #!/usr/bin/env python
# dump flash logs from SITL
# Andrew Tridgell, April 2013
import pexpect, os, sys, shutil, atexit
import optparse, fnmatch, time, glob, traceback, signal
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pysim'))
import util
############## main program #############
... | gpl-3.0 |
MERegistro/meregistro | meregistro/apps/titulos/models/CohorteExtensionAulicaSeguimiento.py | 1 | 1280 | # -*- coding: utf-8 -*-
from django.db import models
from apps.titulos.models.CohorteExtensionAulica import CohorteExtensionAulica
import datetime
"Seguimiento de cada cohorte de la extensión áulica"
class CohorteExtensionAulicaSeguimiento(models.Model):
cohorte_extension_aulica = models.ForeignKey(CohorteExtensio... | bsd-3-clause |
Manexware/medical | oemedical/oemedical_invoice/wizard/wizard_appointment_invoice.py | 1 | 5003 |
import logging
from openerp.osv import osv,fields
from openerp import _
#import pooler
logging.basicConfig(level=logging.DEBUG)
class make_medical_appointment_invoice(osv.osv_memory):
_name="oemedical.appointment.invoice"
def create_invoice(self, cr, uid, ids, context={}):
invoice_obj = self.poo... | gpl-2.0 |
jadbin/xpaw | tests/test_commands.py | 1 | 1655 | # coding=utf-8
import pytest
from os.path import join
from xpaw.cmdline import main
from xpaw import __version__
def test_print_help(capsys):
with pytest.raises(SystemExit) as excinfo:
main(argv=['xpaw'])
assert excinfo.value.code == 0
out, _ = capsys.readouterr()
assert out.startswith('usag... | apache-2.0 |
pschella/scipy | scipy/special/tests/test_spherical_bessel.py | 44 | 13962 | #
# Tests of spherical Bessel functions.
#
import numpy as np
from numpy.testing import (assert_almost_equal, assert_allclose, dec,
assert_array_almost_equal)
from numpy import sin, cos, sinh, cosh, exp, inf, nan, r_, pi
from scipy.special import spherical_jn, spherical_yn, spherical_in, sp... | bsd-3-clause |
thinkopensolutions/geraldo | site/newsite/site-geraldo/django/core/serializers/python.py | 14 | 3883 | """
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models
from django.utils.encodin... | lgpl-3.0 |
kutenai/django | tests/admin_views/models.py | 13 | 25314 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import os
import tempfile
import uuid
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from d... | bsd-3-clause |
SoftwareKing/zstack-woodpecker | integrationtest/vm/multihosts/volumes/test_volumes_robot_2h_wfairly.py | 4 | 2395 | '''
Robot testing for test volume operations for 2 hours. Will use weight fairly
strategy.
@author: Youyk
'''
import zstackwoodpecker.action_select as action_select
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
... | apache-2.0 |
poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/ipython-2.2.0-py2.7.egg/IPython/qt/rich_text.py | 12 | 8785 | """ Defines classes and functions for working with Qt's rich text system.
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
import io
import os
import re
# System librar... | apache-2.0 |
ryfeus/lambda-packs | Lxml_requests/source/google/protobuf/internal/symbol_database_test.py | 43 | 5386 | #! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... | mit |
jgcaaprom/android_external_chromium_org | tools/telemetry/telemetry/page/actions/scroll.py | 45 | 3747 | # Copyright 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.
import os
from telemetry.page.actions import page_action
class ScrollAction(page_action.PageAction):
# TODO(chrishenry): Ignore attributes, to be deleted... | bsd-3-clause |
mclaughlin6464/pylearn2 | pylearn2/sandbox/rnn/utils/iteration.py | 34 | 5669 | """
Iterator for RNN data
"""
from functools import wraps
import numpy as np
from theano import config
from pylearn2.sandbox.rnn.space import SequenceDataSpace
from pylearn2.sandbox.rnn.space import SequenceMaskSpace
from pylearn2.space import CompositeSpace
from pylearn2.utils import safe_izip
from pylearn2.utils.it... | bsd-3-clause |
susansalkeld/discsongs | discsongs/lib/python2.7/site-packages/setuptools/package_index.py | 258 | 38941 | """PyPI and direct package downloading"""
import sys
import os
import re
import shutil
import socket
import base64
import hashlib
from functools import wraps
from pkg_resources import (
CHECKOUT_DIST, Distribution, BINARY_DIST, normalize_path, SOURCE_DIST,
require, Environment, find_distributions, safe_name, s... | mit |
ndingwall/scikit-learn | sklearn/tests/test_build.py | 17 | 1175 | import os
import pytest
import textwrap
from sklearn import __version__
from sklearn.utils._openmp_helpers import _openmp_parallelism_enabled
def test_openmp_parallelism_enabled():
# Check that sklearn is built with OpenMP-based parallelism enabled.
# This test can be skipped by setting the environment varia... | bsd-3-clause |
anilpai/leetcode | BalancedBT/LCA_BT.py | 1 | 3404 | from TreeSerialize.TreeSerialize import deserialize, drawtree
'''
Needs Python 3+
'''
class Solution_old(object):
'''
Lowest Common Ancestor (LCA) in a Binary Tree (BT) : Takes additional space, not space optimized.
'''
def findPath(self, root, path, k):
'''
A Helper function to ma... | mit |
mpvismer/pyqtgraph | pyqtgraph/widgets/FeedbackButton.py | 52 | 6429 | # -*- coding: utf-8 -*-
from ..Qt import QtCore, QtGui
__all__ = ['FeedbackButton']
class FeedbackButton(QtGui.QPushButton):
"""
QPushButton which flashes success/failure indication for slow or asynchronous procedures.
"""
### For thread-safetyness
sigCallSuccess = QtCore.Signal(object, ... | mit |
claneys/shinken | test/shinken_modules.py | 13 | 9693 | #!/usr/bin/env python
import os
import re
import copy
import time
import subprocess
import shutil
import datetime # not used but "sub-"imported by livestatus test.. (to be corrected..)
import sys # not here used but "sub-"imported by livestatus test.. (to be corrected..)
#
from shinken.modulesctx import modulesctx
fr... | agpl-3.0 |
nexusz99/boto | tests/integration/s3/test_mfa.py | 136 | 3629 | # Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restrict... | mit |
fedorpatlin/ansible | lib/ansible/plugins/lookup/credstash.py | 131 | 1891 | # (c) 2015, Ensighten <infra@ensighten.com>
#
# 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 |
snikch/sot-symfony | vendor/doctrine/orm/docs/en/conf.py | 2448 | 6497 | # -*- coding: utf-8 -*-
#
# Doctrine 2 ORM documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 3 18:10:24 2010.
#
# 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.
... | mit |
arthaud/git-dumper | git_dumper.py | 1 | 21245 | #!/usr/bin/env python3
from contextlib import closing
import argparse
import multiprocessing
import os
import os.path
import re
import socket
import subprocess
import sys
import traceback
import urllib.parse
import urllib3
import bs4
import dulwich.index
import dulwich.objects
import dulwich.pack
import requests
impor... | mit |
gudcjfdldu/volatility | volatility/plugins/netscan.py | 44 | 9924 | # Volatility
#
# Authors:
# Michael Hale Ligh <michael.hale@gmail.com>
#
# This file is part of Volatility.
#
# Volatility 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 |
Slezhuk/ansible | lib/ansible/module_utils/k8s_common.py | 62 | 12599 | #
# Copyright 2017 Red Hat | Ansible
#
# 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 |
alanch-ms/PTVS | Python/Tests/TestData/VirtualEnv/env/Lib/UserDict.py | 358 | 5811 | """A more or less complete user-defined wrapper around dictionary objects."""
class UserDict:
def __init__(self, dict=None, **kwargs):
self.data = {}
if dict is not None:
self.update(dict)
if len(kwargs):
self.update(kwargs)
def __repr__(self): return repr(self.d... | apache-2.0 |
jonparrott/gcloud-python | securitycenter/google/cloud/securitycenter_v1beta1/proto/securitycenter_service_pb2_grpc.py | 2 | 21413 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.securitycenter_v1beta1.proto import finding_pb2 as google_dot_cloud_dot_securitycenter__v1beta1_dot_proto_dot_finding__pb2
from google.cloud.securitycenter_v1beta1.proto import organization_settings_pb2 as google_dot_cl... | apache-2.0 |
naucoin/VTKSlicerWidgets | Utilities/mrmpi/examples/rmat.py | 11 | 4924 | #!/usr/local/bin/python
# ----------------------------------------------------------------------
# MR-MPI = MapReduce-MPI library
# http://www.cs.sandia.gov/~sjplimp/mapreduce.html
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
#
# Copyright (2009) Sandia Corporation. Under the terms of Co... | bsd-3-clause |
nuncjo/odoo | addons/account_payment/__init__.py | 436 | 1279 | # -*- 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 |
xsixing/blaze | samples/basics/array_evaluation.py | 10 | 1121 | """
Sample script showing the way to perform computations in blaze
This should be executable and result in an out of core execution to
generate the result of the expression
This illustrates the idea of:
- Using large in-disk arrays as operands
- Building expressions to evaluate in blaze
- Evaluate those expr... | bsd-3-clause |
chenc10/Spark-PAF | dist/ec2/lib/boto-2.34.0/boto/ecs/__init__.py | 153 | 4177 | # Copyright (c) 2010 Chris Moyer http://coredumped.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, ... | apache-2.0 |
mrkulk/text-world | evennia/server/oob_cmds.py | 2 | 14608 | """
Out-of-band default plugin commands available for OOB handler.
This module implements commands as defined by the MSDP standard
(http://tintin.sourceforge.net/msdp/), but is independent of the
actual transfer protocol (webclient, MSDP, GMCP etc). It also
implements several OOB commands unique to Evennia (both some
... | bsd-3-clause |
betoesquivel/fil2014 | filenv/lib/python2.7/site-packages/setuptools/tests/test_find_packages.py | 109 | 5619 | """Tests for setuptools.find_packages()."""
import os
import sys
import shutil
import tempfile
import unittest
import platform
import setuptools
from setuptools import find_packages
from setuptools.tests.py26compat import skipIf
find_420_packages = setuptools.PEP420PackageFinder.find
def has_symlink():
bad_symli... | mit |
margguo/python-ivi | ivi/agilent/agilentDSA91204A.py | 7 | 1632 | """
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2014 Alex Forencich
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 |
qwhelan/asv | asv/results.py | 1 | 33074 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import sys
import base64
import os
import re
import zlib
import itertools
import hashlib
import datetime
import collectio... | bsd-3-clause |
killbill/killbill-client-python | killbill/api/credit_api.py | 1 | 10462 | # coding: utf-8
#
# Copyright 2010-2014 Ning, Inc.
# Copyright 2014-2020 Groupon, Inc
# Copyright 2020-2021 Equinix, Inc
# Copyright 2014-2021 The Billing Project, LLC
#
# The Billing Project, LLC licenses this file to you under the Apache License, version 2.0
# (the "License"); you may not use this file except in com... | apache-2.0 |
guewen/OpenUpgrade | addons/mass_mailing/models/mass_mailing_stats.py | 61 | 4455 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
JeffRoy/mi-dataset | mi/dataset/driver/wc_sbe/cspp/wc_sbe_cspp_recovered_driver.py | 1 | 2044 | #!/usr/bin/env python
"""
@package mi.dataset.driver.wc_sbe.cspp
@file mi/dataset/driver/wc_sbe/cspp/wc_sbe_cspp_recovered_driver.py
@author Jeff Roy
@brief Driver for the wc_sbe_cspp instrument
Release notes:
Initial Release
"""
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.dataset_... | bsd-2-clause |
m11s/MissionPlanner | Lib/rlcompleter.py | 61 | 6036 | """Word completion for GNU readline 2.0.
This requires the latest extension to the readline module. The completer
completes keywords, built-ins and globals in a selectable namespace (which
defaults to __main__); when completing NAME.NAME..., it evaluates (!) the
expression up to the last dot and completes its att... | gpl-3.0 |
caperren/Archives | OSU Robotics Club/Mars Rover 2017-2018/software/ros_packages/ground_station/src/Framework/MapSystems/RoverMapHelper.py | 1 | 1189 | import PIL.Image
import math
class MapHelper(object):
@staticmethod
def new_image(width, height, alpha=False):
"""
Generates a new image using PIL.Image module
returns PIL.IMAGE OBJECT
"""
if alpha is True:
return PIL.Image.new('RGBA', (width, height), (0,... | gpl-3.0 |
ctmarinas/stgit | stgit/lib/git/objects.py | 1 | 10634 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import re
from stgit.compat import text
from stgit.config import config
from .base import Immutable
from .person import Person
class GitObject(Immutable):
"""Base class for all git objects. One git object... | gpl-2.0 |
j00bar/ansible | lib/ansible/modules/storage/netapp/na_cdot_lun.py | 69 | 12603 | #!/usr/bin/python
# (c) 2017, NetApp, Inc
#
# 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 |
AdiPat/android_kernel_htc_pico | tools/perf/scripts/python/failed-syscalls-by-pid.py | 11180 | 2058 | # failed system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide failed system call totals, broken down by pid.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.pa... | gpl-2.0 |
0jpq0/kbengine | kbe/res/scripts/common/Lib/test/test_peepholer.py | 84 | 13107 | import dis
import re
import sys
from io import StringIO
import unittest
from math import copysign
from test.bytecode_helper import BytecodeTestCase
class TestTranforms(BytecodeTestCase):
def test_unot(self):
# UNARY_NOT POP_JUMP_IF_FALSE --> POP_JUMP_IF_TRUE'
def unot(x):
if not x =... | lgpl-3.0 |
xHeliotrope/injustice_dropper | env/lib/python3.4/site-packages/six.py | 878 | 29664 | """Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2015 Benjamin Peterson
#
# 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 with... | mit |
AlphaSmartDog/DeepLearningNotes | Note-6 A3CNet/Note 6 simple ACNet/sonnet/python/modules/nets/mlp.py | 10 | 8926 | # Copyright 2017 The Sonnet 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 applicable l... | mit |
disqus/django-old | tests/modeltests/test_client/views.py | 1 | 7992 | from xml.dom.minidom import parseString
from django.core import mail
from django.template import Context, Template
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.contrib.auth.decorators import login_required, permission_required
from django.forms.forms import Form
from dja... | bsd-3-clause |
django-nonrel/django | docs/_ext/literals_to_xrefs.py | 92 | 4869 | """
Runs through a reST file looking for old-style literals, and helps replace them
with new-style references.
"""
import re
import sys
import shelve
refre = re.compile(r'``([^`\s]+?)``')
ROLES = (
'attr',
'class',
"djadmin",
'data',
'exc',
'file',
'func',
'lookup',
'meth',
'm... | bsd-3-clause |
e-dorigatti/pyspider | pyspider/database/mysql/mysqlbase.py | 75 | 1880 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-11-05 10:42:24
import time
import mysql.connector
class MySQLMixin(object):
@property
def dbcur(self):
try:
if self.con... | apache-2.0 |
doismellburning/edx-platform | lms/djangoapps/lms_xblock/test/test_runtime.py | 92 | 6099 | """
Tests of the LMS XBlock Runtime and associated utilities
"""
from django.contrib.auth.models import User
from django.conf import settings
from ddt import ddt, data
from mock import Mock
from unittest import TestCase
from urlparse import urlparse
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from lm... | agpl-3.0 |
sorenk/ansible | lib/ansible/modules/crypto/openssl_certificate.py | 15 | 36712 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016-2017, Yanis Guenane <yanis+ansible@guenane.org>
# (c) 2017, Markus Teufelberger <mteufelberger+ansible@mgit.at>
# 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_func... | gpl-3.0 |
tomka/rednotebook | rednotebook/gui/options.py | 1 | 13404 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
# Copyright (c) 2009 Jendrik Seipp
#
# RedNotebook is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either ver... | gpl-2.0 |
20tab/django-filer | filer/admin/folderadmin.py | 2 | 52396 | #-*- coding: utf-8 -*-
from django import forms
from django import template
from django.core.exceptions import ValidationError
from django.contrib.admin import helpers
from django.contrib.admin.util import quote, unquote, capfirst
from django.contrib import messages
from django.template.defaultfilters import urlencode
... | bsd-3-clause |
hyrole/scrapy | scrapy/settings/deprecated.py | 160 | 1383 | import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
DEPRECATED_SETTINGS = [
('TRACK_REFS', 'no longer needed (trackref is always enabled)'),
('RESPONSE_CLASSES', 'no longer supported'),
('DEFAULT_RESPONSE_ENCODING', 'no longer supported'),
('BOT_VERSION', 'no longer used (user agent ... | bsd-3-clause |
rschnapka/odoo | addons/document_webdav/__init__.py | 58 | 1119 | # -*- 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 |
aayushidwivedi01/spark-tk | python/sparktk/frame/ops/quantiles.py | 12 | 2626 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
Instagram/django | tests/regressiontests/comment_tests/tests/__init__.py | 88 | 3272 | from django.contrib.auth.models import User
from django.contrib.comments.forms import CommentForm
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.test import TestCase
from regressiontests.comment_tests... | bsd-3-clause |
bbozhev/flask-test | flask/lib/python2.7/site-packages/werkzeug/testsuite/datastructures.py | 145 | 28212 | # -*- coding: utf-8 -*-
"""
werkzeug.testsuite.datastructures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests the functionality of the provided Werkzeug
datastructures.
TODO:
- FileMultiDict
- Immutable types undertested
- Split up dict tests
:copyright: (c) 2014 by Armin Ronacher.... | mit |
mgit-at/ansible | lib/ansible/modules/net_tools/nios/nios_dns_view.py | 68 | 4192 | #!/usr/bin/python
# Copyright (c) 2018 Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview... | gpl-3.0 |
tareqalayan/ansible | lib/ansible/modules/network/f5/bigip_monitor_tcp.py | 17 | 17981 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
erikdejonge/youtube-dl | youtube_dl/extractor/ccma.py | 19 | 3704 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
parse_duration,
parse_iso8601,
parse_resolution,
url_or_none,
)
class CCMAIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ccma\.cat/(?:[... | unlicense |
openstack/heat | heat/tests/convergence/scenarios/update_replace.py | 2 | 2098 | #
# 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 |
tal-nino/shinken | shinken/objects/brokerlink.py | 13 | 1701 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can re... | agpl-3.0 |
fangxingli/hue | desktop/core/ext-py/Django-1.6.10/django/views/decorators/cache.py | 129 | 2286 | from functools import wraps
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cache import CacheMiddleware
def cache_page(*args, **kwargs):
"""
Decorator for views that tri... | apache-2.0 |
commial/miasm | miasm/arch/mep/arch.py | 3 | 66072 | # Toshiba MeP-c4 - miasm architecture definition
# Guillaume Valadon <guillaume@valadon.net>
from builtins import range
from miasm.core.cpu import *
from miasm.core.utils import Disasm_Exception
from miasm.expression.expression import ExprId, ExprInt, ExprLoc, \
ExprMem, ExprOp, is_expr
from miasm.core.asm_ast imp... | gpl-2.0 |
CodigoSur/cyclope | cyclope/apps/social/frontend_views.py | 2 | 1653 | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.loader import render_to_string
from django.core.paginator import Paginator
from actstream.models import Action, target_stream, user_stream
from cyclope.core import frontend
import cyclope.... | gpl-3.0 |
ahamilton55/ansible | lib/ansible/module_utils/facts/system/selinux.py | 52 | 3061 | # Collect facts related to selinux
#
# 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.
#
# Ans... | gpl-3.0 |
Feverup/ansible-modules-extras | cloud/vmware/vmware_target_canonical_facts.py | 16 | 3194 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.com>
#
# 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 Li... | gpl-3.0 |
cstipkovic/spidermonkey-research | testing/mozbase/moznetwork/moznetwork/moznetwork.py | 1 | 5591 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import array
import re
import socket
import struct
import subprocess
import sys
import mozinfo
import m... | mpl-2.0 |
hamzehd/edx-platform | lms/djangoapps/mobile_api/video_outlines/views.py | 121 | 4888 | """
Video Outlines
We only provide the listing view for a video outline, and video outlines are
only displayed at the course level. This is because it makes it a lot easier to
optimize and reason about, and it avoids having to tackle the bigger problem of
general XBlock representation in this rather specialized format... | agpl-3.0 |
ingokegel/intellij-community | python/testData/inspections/PyTypeCheckerInspection/Generator.py | 30 | 3112 | def test():
def gen(n):
for x in xrange(n):
yield str(x)
def f_1(xs):
"""
:type xs: list of int
"""
return xs
def f_2(xs):
"""
:type xs: collections.Sequence of int
"""
return xs
def f_3(xs):
"""
:type xs... | apache-2.0 |
xzregg/yunwei | yw/core/bf.py | 2 | 3673 | #!/usr/bin/env python
# coding:utf-8
# 并发进程的类 by xzr
import multiprocessing
import time
import subprocess
import os
import sys
import traceback
import threading
#import Queue
def get_now():
tf = '%Y-%m-%d %H:%M:%S'
return time.strftime(tf, time.localtime())
_Cpus = multiprocessing.cpu_count()
class xBF:
... | lgpl-3.0 |
cloudbase/maas | src/maasserver/tests/test_messages.py | 1 | 6341 | # Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test maasserver messages."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__ = []
... | agpl-3.0 |
poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/scipy/linalg/basic.py | 9 | 39330 | #
# Author: Pearu Peterson, March 2002
#
# w/ additions by Travis Oliphant, March 2002
# and Jake Vanderplas, August 2012
from __future__ import division, print_function, absolute_import
__all__ = ['solve', 'solve_triangular', 'solveh_banded', 'solve_banded',
'solve_toeplitz', 'solve_circulant... | apache-2.0 |
askulkarni2/ansible-modules-core | cloud/amazon/ec2_scaling_policy.py | 37 | 6191 | #!/usr/bin/python
DOCUMENTATION = """
module: ec2_scaling_policy
short_description: Create or delete AWS scaling policies for Autoscaling groups
description:
- Can create or delete scaling policies for autoscaling groups
- Referenced autoscaling groups must already exist
version_added: "1.6"
author: "Zacharie Eaki... | gpl-3.0 |
jontrulson/upm | examples/python/ms5803.py | 7 | 2129 | #!/usr/bin/python
# Author: Jon Trulson <jtrulson@ics.com>
# Copyright (c) 2016 Intel Corporation.
#
# 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 l... | mit |
rubyu/anki | aqt/addons.py | 2 | 5205 | # Copyright: Damien Elmes <anki@ichi2.net>
# -*- coding: utf-8 -*-
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sys, os, traceback
from cStringIO import StringIO
from aqt.qt import *
from aqt.utils import showInfo, openFolder, isWin, openLink, \
askUser
from zipfile import ... | agpl-3.0 |
carl-mastrangelo/grpc | tools/profiling/microbenchmarks/bm_json.py | 18 | 6459 | # Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | apache-2.0 |
edx/edx-platform | lms/djangoapps/lti_provider/tests/test_views.py | 5 | 9132 | """
Tests for the LTI provider views
"""
from unittest.mock import MagicMock, patch
from django.test import TestCase
from django.test.client import RequestFactory
from django.urls import reverse
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from common.djangoapps.student.tests.factories impor... | agpl-3.0 |
udayinfy/openerp-7.0 | wms/__openerp__.py | 3 | 2789 | # -*- coding: utf-8 -*-
##############################################################################
#
# wms module for OpenERP, This module allows to manage crossdocking in warehouses
# Copyright (C) 2011 SYLEAM Info Services (<http://www.Syleam.fr/>)
# Sylvain Garancher <sylvain.garancher@syleam.... | agpl-3.0 |
MMaus/mutils | models/threeSeg.py | 1 | 3984 | # -*- coding : utf8 -*-
"""
.. module:: 3seg
:synopsis: Equations and solutions for the three-segment model
.. moduleauthor:: Moritz Maus <mmaus@sport.tu-darmstadt.de>
"""
# format: l1, l2, l3, c1, c2]
from pylab import (array, arccos, linspace, vstack, figure, clf, plot, xlabel,
ylabel, show, savefig, ... | gpl-2.0 |
leilihh/novaha | nova/tests/virt/baremetal/db/test_bm_node.py | 29 | 6886 | # Copyright (c) 2012 NTT DOCOMO, 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 requ... | apache-2.0 |
mSenyor/kivy | examples/animation/animate.py | 40 | 1338 | '''
Widget animation
================
This example demonstrates creating and applying a multi-part animation to
a button widget. You should see a button labelled 'plop' that will move with
an animation when clicked.
'''
import kivy
kivy.require('1.0.7')
from kivy.animation import Animation
from kivy.app import App
f... | mit |
99cloud/keystone_register | horizon/management/commands/startdash.py | 16 | 2450 | import glob
from optparse import make_option
import os
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.utils.importlib import import_module
import horizon
class Command(TemplateCommand):
template = os.path.join(horizon.__path__[0], "c... | apache-2.0 |
fuhongliang/odoo | addons/edi/models/res_currency.py | 437 | 2892 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011-2012 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | agpl-3.0 |
suyashphadtare/sajil-final-frappe | frappe/widgets/form/save.py | 32 | 1739 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.widgets.form.load import run_onload
@frappe.whitelist()
def savedocs():
"""save / submit / update doclist"""
try:
doc = frappe.get_doc(json... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.