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
jingwangian/tutorial
python/basic/basic_one.py
1
1061
#!/usr/bin/env python3 # Div/Divd/mod list1 = [(7, 4), (18, 3), (19, 2), (21, 8)] print([x / y for x, y in list1]) print([x // y for x, y in list1]) print([x % y for x, y in list1]) # Easy swap i = 10 k = 20 i, k = k, i print(i, k) # One line condition max_num = i if i > k else k # One line expression # [ express...
gpl-3.0
imsweb/django-bootstrap
docs/conf.py
1
9706
# -*- coding: utf-8 -*- # # ims-bootstrap documentation build configuration file, created by # sphinx-quickstart on Fri Feb 26 15:44:51 2016. # # 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 # autogenera...
bsd-2-clause
neuroidss/nupic.research
projects/capybara/sandbox/classification/generate_artificial_data.py
9
2855
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
m0re4u/LeRoT-SCLP
lerot/ranker/model/test.py
4
2702
# This file is part of Lerot. # # Lerot is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Lerot is distributed in the hope tha...
gpl-3.0
AdaptiveApplications/carnegie
tarc_bus_locator_client/numpy-1.8.1/numpy/lib/tests/test_stride_tricks.py
6
7769
from __future__ import division, absolute_import, print_function import numpy as np from numpy.testing import * from numpy.lib.stride_tricks import broadcast_arrays from numpy.lib.stride_tricks import as_strided def assert_shapes_correct(input_shapes, expected_shape): """ Broadcast a list of arrays with the give...
mit
silviocsg/ns-3-pcp
src/antenna/bindings/modulegen__gcc_LP64.py
50
90183
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers import pybindgen.settings import warnings class ErrorHandler(pybindgen.settings.ErrorHandler): def handle_error(self, wrapper, exception, traceback_): warnings.warn("exception %r in wrapper %s" % (exception, wrapper)) ...
gpl-2.0
hainm/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
244
9986
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
dongjiaqiang/kafka
tests/kafkatest/services/performance/consumer_performance.py
21
5552
# 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 use ...
apache-2.0
aYukiSekiguchi/ACCESS-Chromium
tools/site_compare/scrapers/chrome/chrome011010.py
189
1183
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Does scraping for versions of Chrome from 0.1.101.0 up.""" from drivers import windowing import chromebase # Default version version = "0.1.101.0" ...
bsd-3-clause
snakealpha/sazuki
support/protobuf.py
1
3305
""" Support for google proto buffers. """ from os import linesep from support import PrimitiveCollection, ValueType from support.MetaGenerator import * class CurrentPrimitiveCollection(PrimitiveCollection): type_names = [ "int32", "int64", "uint32", "uint64", "sint32", ...
mit
nhenezi/kuma
vendor/packages/html5lib/setup.py
5
1508
try: from setuptools import setup except ImportError: from distutils.core import setup import os long_description="""HTML parser designed to follow the HTML5 specification. The parser is designed to handle all flavours of HTML and parses invalid documents using well-defined error handling rules compatible wi...
mpl-2.0
fernandog/Sick-Beard
lib/hachoir_parser/video/asf.py
90
12897
""" Advanced Streaming Format (ASF) parser, format used by Windows Media Video (WMF) and Windows Media Audio (WMA). Informations: - http://www.microsoft.com/windows/windowsmedia/forpros/format/asfspec.aspx - http://swpat.ffii.org/pikta/xrani/asf/index.fr.html Author: Victor Stinner Creation: 5 august 2006 """ from l...
gpl-3.0
leighpauls/k2cro4
third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py
12
11698
# Copyright (c) 2010 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 of conditions and the ...
bsd-3-clause
cosmicAsymmetry/zulip
contrib_bots/lib/giphy.py
7
4964
# To use this plugin, you need to set up the Giphy API key for this bot in # ~/.giphy_config from __future__ import absolute_import from __future__ import print_function from six.moves.configparser import SafeConfigParser import requests import logging import sys import os import re GIPHY_TRANSLATE_API = 'http://api....
apache-2.0
belimawr/experiments
OpenCV-Python/camshift.py
1
1350
import numpy as np import cv2 cap = cv2.VideoCapture(0) # take first frame of the video ret,frame = cap.read() # setup initial location of window r,h,c,w = 250,90,400,125 # simply hardcoded the values track_window = (c,r,w,h) # set up the ROI for tracking roi = frame[r:r+h, c:c+w] hsv_roi = cv2.cvtColor(frame, cv...
gpl-3.0
keitaroyam/yamtbx
yamtbx/dataproc/myspotfinder/shikalog.py
1
2046
import time import sys import getpass import logging import os import platform # to prevent error logging.basicConfig() # Singleton object logger = logging.getLogger("shika") logger.setLevel(logging.DEBUG) debug = logger.debug info = logger.info warning = logger.warning error = logger.error critical = logger.critica...
bsd-3-clause
sergei-maertens/django
django/utils/functional.py
17
15505
import copy import operator import warnings from functools import total_ordering, wraps from django.utils import six from django.utils.deprecation import RemovedInDjango20Warning # You can't trivially replace this with `functools.partial` because this binds # to classes and returns bound instances, whereas functools...
bsd-3-clause
resmo/ansible
lib/ansible/plugins/doc_fragments/default_callback.py
45
2283
# -*- coding: utf-8 -*- # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) class ModuleDocFragment(object): DOCUMENTATION = r''' options: display_skipped_hosts: name: Show skipped hosts description: "Toggl...
gpl-3.0
crdoconnor/olympia
apps/pages/urls.py
15
1872
from django.conf import settings from django.conf.urls import patterns, url from django.http import HttpResponsePermanentRedirect as perma_redirect from django.views.generic.base import TemplateView from amo.urlresolvers import reverse from . import views urlpatterns = patterns( '', url('^about$', T...
bsd-3-clause
frreiss/tensorflow-fred
tensorflow/python/training/tracking/tracking_test.py
8
8079
# 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
firebitsbr/raspberry_pwn
src/pexpect-2.3/examples/ftp.py
17
1604
#!/usr/bin/env python """This demonstrates an FTP "bookmark". This connects to an ftp site; does a few ftp stuff; and then gives the user interactive control over the session. In this case the "bookmark" is to a directory on the OpenBSD ftp server. It puts you in the i386 packages directory. You can easily modify this...
gpl-3.0
DPaaS-Raksha/horizon
openstack_dashboard/dashboards/admin/routers/ports/tabs.py
15
1067
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012, Nachi Ueno, NTT MCL, 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...
apache-2.0
memo/tensorflow
tensorflow/python/training/saver_large_partitioned_variable_test.py
141
2261
# 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
lpltk/pydriver
pydriver/evaluation/evaluation.py
1
18304
# -*- coding: utf-8 -*- from __future__ import absolute_import, division import math, operator import numpy as np from ..common.constants import FLOAT_dtype class Evaluator(object): """Evaluation curve representation Average precision and orientation similarity measures will compute the area under the mon...
mit
yvaucher/account-closing
account_cutoff_accrual_base/__openerp__.py
4
1539
# -*- encoding: utf-8 -*- ############################################################################## # # Account Cutoff Accrual Base module for OpenERP # Copyright (C) 2013 Akretion (http://www.akretion.com) # @author Alexis de Lattre <alexis.delattre@akretion.com> # # This program is free software: you...
agpl-3.0
jasonabele/gr-burst
python/burst_scheduler.py
3
1610
#!/usr/bin/env python from gnuradio import gr import pmt import pdulib class burst_scheduler(gr.sync_block): def __init__(self): gr.sync_block.__init__( self, name="burst_scheduler", in_sig = None, out_sig = None) self.nproduced_val = 0; self....
gpl-3.0
nkalodimas/invenio
modules/bibdocfile/lib/bibdocfile_regression_tests.py
6
30574
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2009, 2010, 2011, 2012, 2013 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 ## Licens...
gpl-2.0
stdweird/aquilon
tests/broker/test_parameter_definition_feature.py
2
13002
#!/usr/bin/env python2.6 # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2012,2013 Contributor # # 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...
apache-2.0
aurelijusb/arangodb
3rdParty/V8-4.3.61/testing/gmock/scripts/generator/cpp/tokenize.py
679
9703
#!/usr/bin/env python # # Copyright 2007 Neal Norwitz # Portions Copyright 2007 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...
apache-2.0
jonnybazookatone/gut-service
biblib/app.py
1
2003
""" Application """ from flask import Flask from views import UserView, LibraryView from flask.ext.restful import Api from flask.ext.discoverer import Discoverer from models import db from utils import setup_logging_handler __author__ = 'J. Elliott' __maintainer__ = 'J. Elliott' __copyright__ = 'ADS Copyright 2015' _...
mit
chengsoonong/crowdastro
crowdastro/experiment/experiment_rgz_qbc.py
1
7491
"""Query by committee on the Radio Galaxy Zoo MV dataset. Matthew Alger The Australian National University 2016 """ import argparse import logging import os.path import h5py import matplotlib import matplotlib.pyplot as plt import numpy import sklearn.cross_validation import sklearn.linear_model from crowdastro.cro...
mit
elpaso/django-simplemenu
simplemenu/migrations/0002_auto__add_menu__add_field_menuitem_menu.py
1
2982
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Menu' db.create_table('simplemenu_menu', ( ('id', self.gf('django.db.models.fi...
bsd-3-clause
bdastur/pyvim
.vim/bundle/python-mode/pymode/libs/pylama/lint/pylama_pylint/pylint/__pkginfo__.py
17
3038
# pylint: disable=W0622,C0103 # Copyright (c) 2003-2014 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # # 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; eith...
apache-2.0
jhutar/spacewalk
backend/satellite_tools/rhn_satellite_activate.py
1
15833
# # Copyright (c) 2008--2014 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have received a c...
gpl-2.0
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/nbconvert/preprocessors/tests/test_csshtmlheader.py
27
1578
""" Module with tests for the csshtmlheader preprocessor """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with ...
gpl-3.0
Crevil/grpc
src/python/grpcio_tests/tests/interop/_insecure_intraop_test.py
16
1478
# Copyright 2015 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
zachcp/bioconda-recipes
recipes/biopet-sampleconfig/biopet-sampleconfig.py
53
3375
#!/usr/bin/env python # # Wrapper script for starting the biopet-sampleconfig JAR package # # This script is written for use with the Conda package manager and is copied # from the peptide-shaker wrapper. Only the parameters are changed. # (https://github.com/bioconda/bioconda-recipes/blob/master/recipes/peptide-shaker...
mit
40223247/2015cdb_0622
static/Brython3.1.1-20150328-091302/Lib/pydoc.py
637
102017
#!/usr/bin/env python3 """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide help. Calling help(thing) on a Python object documents the object. Or, at the shell command line outside of Python: Run "pydoc <name>" to show documentation ...
gpl-3.0
jbarentsen/drb
drbadmin/node_modules/bootstrap/node_modules/npm-shrinkwrap/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
295
17110
# Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Handle version information related to Visual Stuio.""" import errno import os import re import subprocess import sys import gyp import glob class VisualStudi...
bsd-3-clause
dalg24/Cap
python/source/__init__.py
3
1381
# Copyright (c) 2016, the Cap authors. # # This file is subject to the Modified BSD License and may not be distributed # without copyright and license information. Please refer to the file LICENSE # for the text and further information on this license. from .PyCap import * from .data_helpers import * from .time_evolut...
bsd-3-clause
liuliwork/django
django/utils/numberformat.py
431
1944
from __future__ import unicode_literals from decimal import Decimal from django.conf import settings from django.utils import six from django.utils.safestring import mark_safe def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False): """ Gets a number (...
bsd-3-clause
nharraud/invenio-demosite
invenio_demosite/base/recordext/functions/get_filetypes.py
7
1245
# -*- coding: utf-8 -*- # # This file is part of Invenio Demosite. # Copyright (C) 2014 CERN. # # Invenio Demosite 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...
gpl-2.0
chauhanhardik/populo_2
common/test/acceptance/tests/video/test_video_module.py
7
42687
# -*- coding: utf-8 -*- """ Acceptance tests for Video. """ from nose.plugins.attrib import attr from unittest import skipIf, skip from ..helpers import UniqueCourseTest, is_youtube_available, YouTubeStubConfig from ...pages.lms.video.video import VideoPage from ...pages.lms.tab_nav import TabNavPage from ...pages.lms...
agpl-3.0
cloudera/hue
desktop/core/ext-py/SQLAlchemy-1.3.17/examples/join_conditions/cast.py
7
2841
"""Illustrate a :func:`.relationship` that joins two columns where those columns are not of the same type, and a CAST must be used on the SQL side in order to match them. When complete, we'd like to see a load of the relationship to look like:: -- load the primary row, a_id is a string SELECT a.id AS a_id_1, ...
apache-2.0
DukeRobotics/training
scripts/ImageReflector/FileAccessor.py
1
1115
import os from copy import deepcopy class FileAccessor: def __init__(self, directoriesToRead, directoriesToWrite): assert len(directoriesToRead) == len(directoriesToWrite) self.readDirectories = directoriesToRead self.writeDirectories = directoriesToWrite self.directoryMap = get_dat...
mit
RedHatInsights/insights-core
insights/parsers/tests/test_networkmanager_dhclient.py
1
3130
import doctest import pytest from insights.parsers import networkmanager_dhclient, SkipException from insights.parsers.networkmanager_dhclient import NetworkManagerDhclient from insights.tests import context_wrap DHCLIENT_RHEL_6 = "/etc/NetworkManager/dispatcher.d/10-dhclient" DHCLIENT_RHEL_7 = "/etc/NetworkManager...
apache-2.0
Senseg/Py4A
python3-alpha/python3-src/Lib/pdb.py
47
56534
#! /usr/bin/env python3 """ The Python Debugger Pdb ======================= To use the debugger in its simplest form: >>> import pdb >>> pdb.run('<a statement>') The debugger's prompt is '(Pdb) '. This will stop in the first function call in <a statement>. Alternatively, if a statement terminated ...
apache-2.0
proofchains/python-proofchains
proofchains/core/bitcoin.py
1
4295
# Copyright (C) 2015 Peter Todd <pete@petertodd.org> # # This file is part of python-proofchains. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-proofchains, including this file, may be copied, modified, # propagated, or distribu...
gpl-3.0
lmprice/ansible
lib/ansible/modules/network/nxos/nxos_banner.py
16
5941
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Ansible by Red Hat, inc # # This file is part of Ansible by Red Hat # # 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
donSchoe/angelshares
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
iansprice/wagtail
wagtail/wagtailimages/__init__.py
5
1315
from __future__ import absolute_import, unicode_literals from django.conf import settings from django.core.exceptions import ImproperlyConfigured default_app_config = 'wagtail.wagtailimages.apps.WagtailImagesAppConfig' def get_image_model_string(): """ Get the dotted ``app.Model`` name for the image model ...
bsd-3-clause
Eric-Zhong/odoo
addons/hr_payroll/wizard/__init__.py
442
1159
#-*- coding:utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # d$ # # This program is free software: you can redistribute it and/or modify # it ...
agpl-3.0
amyshi188/osf.io
scripts/migrate_piwik/validate_after_transform_01.py
2
1871
import re import json from scripts.migrate_piwik import utils from scripts.migrate_piwik import settings def main(): input_filename = '/'.join([utils.get_dir_for('transform01'), settings.TRANSFORM01_FILE,]) input_file = open(input_filename, 'r') run_id = utils.get_history_run_id_for('transform01') ...
apache-2.0
tanglei528/nova
nova/image/glance.py
2
22840
# Copyright 2010 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 requ...
apache-2.0
aspyatkin/beakeredis
runtests.py
1
258480
#! /usr/bin/env python # Hi There! # You may be wondering what this giant blob of binary data here is, you might # even be worried that we're up to something nefarious (good for you for being # paranoid!). This is a base64 encoding of a zip file, this zip file contains # a fully functional basic pytest script. # # Pyt...
mit
wagnerand/zamboni
lib/pay_server/errors.py
3
1041
# If you get a PayPal error, you'll get a PayPal error code back. # This converts these into localisable strings we can give to the user. from tower import ugettext as _ # Codes: # - starting with 100000+ are solitude specific codes. # - starting with 500000+ are paypal specific codes. codes = { '0': _('There was ...
bsd-3-clause
BlueBrain/Poppler
regtest/backends/cairo.py
19
1442
# cairo.py # # Copyright (C) 2011 Carlos Garcia Campos <carlosgc@gnome.org> # # 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 ver...
gpl-2.0
GdZ/scriptfile
software/googleAppEngine/lib/django_1_4/django/core/management/commands/dbshell.py
329
1243
from optparse import make_option from django.core.management.base import BaseCommand, CommandError from django.db import connections, DEFAULT_DB_ALIAS class Command(BaseCommand): help = ("Runs the command-line client for specified database, or the " "default database if none is provided.") option_lis...
mit
BitCurator/bca-redtools
libredact/attic/iredact.py
2
14066
#!/usr/bin/python """Redact an image file using a ruleset... Image Redaction Project. This program redacts disk image files. inputs: * The disk image file * A set of rules that describe what to redact, and how to redact it. Rule File format: The readaction command file consists of commands. Each command has an "condi...
gpl-3.0
siutanwong/sina_weibo_crawler
mongodb.py
3
1385
__author__ = 'LiGe' #encoding:utf-8 import pymongo import os import csv class mongodb(object): def __init__(self, ip, port): self.ip=ip self.port=port self.conn=pymongo.MongoClient(ip,port) def close(self): return self.conn.disconnect() def get_conn(self): ...
apache-2.0
multidadosti-erp/multidadosti-addons
calendar_event_file_attachment/models/calendar_event.py
1
1955
from odoo import api, models, fields from odoo.tools.translate import _ class CalendarEvent(models.Model): _inherit = 'calendar.event' def _attachment_ids_domain(self): return [('res_model', '=', self._name)] attachment_ids = fields.One2many(comodel_name='ir.attachment', ...
agpl-3.0
themrmax/scikit-learn
sklearn/ensemble/voting_classifier.py
11
11341
""" Soft Voting/Majority Rule classifier. This module contains a Soft Voting/Majority Rule classifier for classification estimators. """ # Authors: Sebastian Raschka <se.raschka@gmail.com>, # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause import numpy as np from ..base import ClassifierMixin...
bsd-3-clause
kifcaliph/odoo
addons/mail/__init__.py
382
1357
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2009-Today OpenERP SA (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms ...
agpl-3.0
rbaumg/trac
trac/versioncontrol/tests/svn_authz.py
1
21744
# -*- coding: utf-8 -*- # # Copyright (C) 2005-2019 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software consi...
bsd-3-clause
liyitest/rr
openstack_dashboard/dashboards/admin/volumes/snapshots/forms.py
36
1919
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
apache-2.0
volcomism/blueprint
blueprint/frontend/puppet.py
4
23695
""" Puppet code generator. """ import base64 import codecs from collections import defaultdict import errno import logging import os import os.path import re import tarfile from blueprint import util from blueprint import walk def puppet(b, relaxed=False): """ Generate Puppet code. """ m = Manifest(...
bsd-2-clause
LIAMF-USP/word2vec-TF
src/utils.py
1
4515
import re import pickle import time import unittest timing = {} def get_time(f, args=[]): """ After using timeit we can get the duration of the function f when it was applied in parameters args. Normally it is expected that args is a list of parameters, but it can be also a single parameter. :ty...
mit
Rheinhart/Firefly
gfirefly/server/globalobject.py
8
2267
#coding:utf8 ''' Created on 2013-8-2 @author: lan (www.9miao.com) ''' from gfirefly.utils.singleton import Singleton class GlobalObject: """单例,存放了服务中的netfactory,root节点,所有的remote节点的句柄。 """ __metaclass__ = Singleton def __init__(self): self.netfactory = None#net前端 self.root = N...
mit
GcsSloop/PythonNote
PythonCode/Python进阶/定制类/@property.py
1
2492
#coding=utf-8 #author: sloop ''' ÈÎÎñ Èç¹ûûÓж¨Òåset·½·¨£¬¾Í²»Äܶԡ°ÊôÐÔ¡±¸³Öµ£¬Õâʱ£¬¾Í¿ÉÒÔ´´½¨Ò»¸öÖ»¶Á¡°ÊôÐÔ¡±¡£ Çë¸øStudentÀà¼ÓÒ»¸ögradeÊôÐÔ£¬¸ù¾Ý score ¼ÆËã A£¨>=80£©¡¢B¡¢C£¨<60£©¡£ ''' class Student(object): def __init__(self, name, score): self.name = name self.__score = score @proper...
apache-2.0
cdegroc/scikit-learn
sklearn/utils/graph.py
2
4799
""" Graph utilities and algorithms Graphs are represented with their adjacency matrices, preferably using sparse matrices. """ # Authors: Aric Hagberg <hagberg@lanl.gov> # Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD import numpy as np from scipy import sparse from .graph_shortest_path imp...
bsd-3-clause
shakamunyi/ansible
v1/ansible/runner/lookup_plugins/env.py
154
1282
# (c) 2012, Jan-Piet Mens <jpmens(at)gmail.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 ver...
gpl-3.0
maohongyuan/kbengine
kbe/src/lib/python/Lib/ctypes/test/test_init.py
169
1039
from ctypes import * import unittest class X(Structure): _fields_ = [("a", c_int), ("b", c_int)] new_was_called = False def __new__(cls): result = super().__new__(cls) result.new_was_called = True return result def __init__(self): self.a = 9 sel...
lgpl-3.0
avneesh91/django
tests/update/tests.py
27
7173
from django.core.exceptions import FieldError from django.db.models import Count, F, Max from django.test import TestCase from .models import A, B, Bar, D, DataPoint, Foo, RelatedPoint class SimpleTest(TestCase): def setUp(self): self.a1 = A.objects.create() self.a2 = A.objects.create() f...
bsd-3-clause
amenonsen/ansible
test/units/modules/network/fortios/test_fortios_ips_global.py
21
9032
# Copyright 2019 Fortinet, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the...
gpl-3.0
daniyalzade/polysh
polysh/buffered_dispatcher.py
3
3567
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # bu...
gpl-2.0
gunzy83/ansible-modules-extras
system/facter.py
72
1685
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2012, Michael DeHaan <michael.dehaan@gmail.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...
gpl-3.0
justathoughtor2/atomicApe
cygwin/lib/python2.7/site-packages/pip-8.0.2-py2.7.egg/pip/commands/wheel.py
170
7528
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import os import warnings from pip.basecommand import RequirementCommand from pip.exceptions import CommandError, PreviousBuildDirError from pip.req import RequirementSet from pip.utils import import_or_raise from pip.utils.build import Bui...
gpl-3.0
forge33/CouchPotatoServer
couchpotato/core/notifications/email_.py
21
4431
from email.mime.text import MIMEText from email.utils import formatdate, make_msgid import smtplib import traceback from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.helpers.variable import splitString from couchpotato.core.logger import CPLog from couchpotato.core.notifications.base import...
gpl-3.0
deeplook/bokeh
bokeh/server/serverbb.py
13
5191
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2015, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with this software. #----------------------------------------...
bsd-3-clause
zorg/zorg-emic
setup.py
2
1512
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages try: from pypandoc import convert readme = lambda f: convert(f, "rst") except ImportError: print("Module pypandoc not found, could not convert Markdown to RST") readme = lambda f: open(f, "r").read() req = open...
mit
omererdem/honeything
src/cwmp/tr/tr135_v1_2.py
1
19919
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # AUTO-GENERATED BY parse-schema.py # # DO NOT EDIT!! # #pylint: disable-msg=C6202 #pylint: disable-msg=C6409 #pylint: disable-msg=C6310 # These should not actually be necessary (bugs in gpylint?): #pylint: disable-msg=E1101 #pylint: disable-msg=W023...
gpl-3.0
hradec/gaffer
python/GafferUI/CompoundDataPlugValueWidget.py
7
9013
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
bsd-3-clause
koyuawsmbrtn/eclock
windows/kivy/kivy/uix/togglebutton.py
63
1050
''' Toggle button ============= The :class:`ToggleButton` widget acts like a checkbox. When you touch/click it, the state toggles between 'normal' and 'down' (as opposed to a :class:`Button` that is only 'down' as long as it is pressed). Toggle buttons can also be grouped to make radio buttons - only one button in a ...
gpl-2.0
fedux/linux
tools/perf/scripts/python/netdev-times.py
11271
15048
# Display a process of packets and processed time. # It helps us to investigate networking or network device. # # options # tx: show only tx chart # rx: show only rx chart # dev=: show only thing related to specified device # debug: work with debug mode. It shows buffer status. import os import sys sys.path.append(os...
gpl-2.0
lawsie/guizero
tests/test_textbox.py
1
3446
from guizero import App, TextBox from common_test import ( schedule_after_test, schedule_repeat_test, destroy_test, enable_test, display_test, text_test, color_test, size_text_test, size_fill_test, events_test, cascaded_properties_test, inherited_properties_test, grid...
bsd-3-clause
nikolas/mezzanine
mezzanine/project_template/fabfile.py
22
21868
from __future__ import print_function, unicode_literals from future.builtins import open import os import re import sys from contextlib import contextmanager from functools import wraps from getpass import getpass, getuser from glob import glob from importlib import import_module from posixpath import join from mezza...
bsd-2-clause
nuclearmistake/repo
git_command.py
3
7067
# # Copyright (C) 2008 The Android Open Source Project # # 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 la...
apache-2.0
n0ano/gantt
gantt/exception.py
1
42438
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
apache-2.0
normanmaurer/autobahntestsuite-maven-plugin
src/main/resources/twisted/internet/test/test_epollreactor.py
7
7400
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.internet.epollreactor}. """ from __future__ import division, absolute_import from twisted.trial.unittest import TestCase try: from twisted.internet.epollreactor import _ContinuousPolling except ImportError: _Conti...
apache-2.0
xyproto/duckling
duckling.py
1
23493
#!/usr/bin/python2 # -*- coding: utf-8 -*- #vim: set enc=utf8: # # The advantage of sending the entire buffer to each sprite, # instead of each sprite returning a small image, # is that a sprite may, for instance, blur the whole screen. # Or make fire-trails after oneself. Or shake the whole screen. # That's the reason...
mit
pedrobaeza/OpenUpgrade
addons/report/models/abstract_report.py
249
2981
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms ...
agpl-3.0
CapOM/ChromiumGStreamerBackend
tools/telemetry/third_party/gsutilz/third_party/pyasn1-modules/tools/pkcs10dump.py
26
1109
#!/usr/bin/python # # Read ASN.1/PEM X.509 certificate requests (PKCS#10 format) on stdin, # parse each into plain text, then build substrate from it # from pyasn1.codec.der import decoder, encoder from pyasn1_modules import rfc2314, pem import sys if len(sys.argv) != 1: print("""Usage: $ cat certificateRequest.p...
bsd-3-clause
XiaosongWei/chromium-crosswalk
PRESUBMIT_test_mocks.py
28
3773
# 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 json import os import re import subprocess import sys class MockInputApi(object): """Mock class for the InputApi class. This class can be used ...
bsd-3-clause
raccoongang/edx-platform
openedx/core/lib/api/fields.py
53
2163
"""Fields useful for edX API implementations.""" from rest_framework.serializers import Field, URLField class ExpandableField(Field): """Field that can dynamically use a more detailed serializer based on a user-provided "expand" parameter. Kwargs: collapsed_serializer (Serializer): the serializer to us...
agpl-3.0
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/build/android/play_services/update.py
2
20584
#!/usr/bin/env python # Copyright 2015 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. ''' Script to help uploading and downloading the Google Play services library to and from a Google Cloud storage. ''' import argparse ...
gpl-3.0
fedora-infra/fedbadges
fedbadges/commands.py
1
1028
# -*- coding; utf-8 -*- # Author: Ross Delinger # Description: A system to award Fedora Badges (open badges) # based on messages on the bu from fedmsg.commands import BaseCommand from fedbadges.consumers import FedoraBadgesConsumer class BadgesCommand(BaseCommand): """ Relay connections to the bus, and enabled t...
gpl-2.0
liangstein/ByteNet-Keras
ByteNet_train.py
1
11488
import os; import numpy as np; from keras.models import Model; from keras.layers.embeddings import Embedding; from keras.models import Sequential,load_model; from keras.optimizers import rmsprop,adam,adagrad,SGD; from keras.callbacks import EarlyStopping,ModelCheckpoint,ReduceLROnPlateau; from keras.preprocessing.text ...
apache-2.0
urbn/kombu
t/unit/transport/test_etcd.py
4
2221
from __future__ import absolute_import, unicode_literals import pytest from case import Mock, patch, skip from kombu.five import Empty from kombu.transport.etcd import Channel, Transport @skip.unless_module('etcd') class test_Etcd: def setup(self): self.connection = Mock() self.connection.cli...
bsd-3-clause
upshot-nutrition/upshot-nutrition.github.io
node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py
1407
47697
# 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. """ This module helps emulate Visual Studio 2008 behavior on top of other build systems, primarily ninja. """ import os import re import subprocess import sys fr...
mit
saimn/doit
tests/test_cmd_completion.py
1
4955
from io import StringIO import pytest from doit.exceptions import InvalidCommand from doit.cmdparse import CmdOption from doit.plugin import PluginDict from doit.task import Task from doit.cmd_base import Command, TaskLoader, DodoTaskLoader from doit.cmd_completion import TabCompletion from doit.cmd_help import Help f...
mit