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
petercable/mi-dataset
mi/dataset/parser/test/test_vel3d_k_wfp_stc.py
2
14573
#!/usr/bin/env python """ @package mi.dataset.parser.test @file marine-integrations/mi/dataset/parser/test/test_vel3d_k_wfp_stc.py @author Steve Myerson (Raytheon) @brief Test code for a vel3d_k_wfp_stc data parser """ import os from StringIO import StringIO import ntplib from nose.plugins.attrib import attr from m...
bsd-2-clause
RondaStrauch/landlab
landlab/plot/drainage_plot.py
4
3499
"""Plot drainage network. """ # KRB, FEB 2017. import six from landlab import CORE_NODE, FIXED_VALUE_BOUNDARY, FIXED_GRADIENT_BOUNDARY, CLOSED_BOUNDARY import matplotlib.pylab as plt from landlab.plot.imshow import imshow_node_grid import numpy as np def drainage_plot(mg, surface='topographic__elev...
mit
malkavi/Flexget
flexget/components/sites/sites/horriblesubs.py
3
3802
import re from loguru import logger from flexget import plugin from flexget.entry import Entry from flexget.event import event from flexget.utils.cached_input import cached from flexget.utils.requests import RequestException from flexget.utils.soup import get_soup logger = logger.bind(name='horriblesubs') class Ho...
mit
ntuecon/server
pyenv/Lib/site-packages/twisted/internet/selectreactor.py
50
6215
# -*- test-case-name: twisted.test.test_internet -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Select reactor """ from __future__ import division, absolute_import from time import sleep import sys, select, socket from errno import EINTR, EBADF from zope.interface import implementer...
bsd-3-clause
mosf1k/cocktail
bar/models.py
1
1433
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User from pyuploadcare.dj import ImageField class Category(models.model): """Model for ingredient's category""" name = models.CharField(max_length=100) def __unicode__(self): return self.name class Ingre...
mpl-2.0
Domotina/domotina
map/views.py
1
6638
from datetime import datetime, time from django.shortcuts import render, get_object_or_404, redirect from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.contrib.auth.decorators import user_passes_test from django.contrib.auth.de...
gpl-2.0
cliu-aa/flask
tests/test_basic.py
134
43285
# -*- coding: utf-8 -*- """ tests.basic ~~~~~~~~~~~~~~~~~~~~~ The basic functionality. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import pytest import re import uuid import time import flask import pickle from datetime import datetime from threading ...
bsd-3-clause
ticosax/django
tests/model_meta/test_legacy.py
32
7541
import warnings from django import test from django.contrib.contenttypes.fields import GenericRelation from django.core.exceptions import FieldDoesNotExist from django.db.models.fields import CharField, related from django.utils.deprecation import RemovedInDjango20Warning from .models import BasePerson, Person from ....
bsd-3-clause
rpm-software-management/ci-dnf-stack
dnf-behave-tests/fixtures/rpm2spec/dnf_wrapper.py
4
1600
import os import shutil import tempfile import dnf class DnfBaseWrapper(object): def __init__(self, arch=None, cache_dir=None): # prepopulate dict, everything else is redirected to the base object self.__dict__["tmp_dir"] = None self.__dict__["base"] = None self.__dict__["conf"] =...
gpl-3.0
lurenlym/BPnetwork_smartcar
computer/computer_training_date_collect.py
1
6846
__author__ = 'Ming' import numpy as np import cv2 import serial import pygame from pygame.locals import * import socket class TextPrint: def __init__(self): self.reset() self.font = pygame.font.Font(None, 20) self.x = 10 self.y = 10 self.line_height = 15 self.black ...
apache-2.0
yaroslavvb/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/transforms/hashes.py
112
2126
# 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
emmericp/dpdk
app/test-cmdline/cmdline_test_data.py
7
8965
# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2010-2014 Intel Corporation # collection of static data # keycode constants CTRL_A = chr(1) CTRL_B = chr(2) CTRL_C = chr(3) CTRL_D = chr(4) CTRL_E = chr(5) CTRL_F = chr(6) CTRL_K = chr(11) CTRL_L = chr(12) CTRL_N = chr(14) CTRL_P = chr(16) CTRL_W = chr(23) CTRL_Y...
gpl-2.0
robinro/ansible
lib/ansible/modules/cloud/ovirt/ovirt_storage_domains_facts.py
45
3673
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, 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 #...
gpl-3.0
soldag/home-assistant
homeassistant/helpers/device_registry.py
5
22501
"""Provide a way to connect entities belonging to one device.""" from collections import OrderedDict import logging from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Union import attr from homeassistant.const import EVENT_HOMEASSISTANT_STARTED from homeassistant.core import Event, callback impo...
apache-2.0
Work4Labs/lettuce
tests/integration/lib/Django-1.3/tests/regressiontests/queryset_pickle/tests.py
102
1210
import pickle import datetime from django.test import TestCase from models import Group, Event, Happening class PickleabilityTestCase(TestCase): def assert_pickles(self, qs): self.assertEqual(list(pickle.loads(pickle.dumps(qs))), list(qs)) def test_related_field(self): g = Group.objects.cre...
gpl-3.0
AOSPU/external_chromium_org
content/test/gpu/page_sets/memory_tests.py
8
1037
# 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. # pylint: disable=W0401,W0614 from telemetry.page.actions.all_page_actions import * from telemetry.page import page as page_module from telemetry.page import ...
bsd-3-clause
timabbott/zulip
zerver/lib/bot_config.py
4
3062
import configparser import importlib import os from collections import defaultdict from typing import Dict, List, Optional from django.conf import settings from django.db.models import Sum from django.db.models.functions import Length from django.db.models.query import F from zerver.models import BotConfigData, UserP...
apache-2.0
ecatmur/avro
lang/py/lib/simplejson/encoder.py
343
16033
"""Implementation of JSONEncoder """ import re try: from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ...
apache-2.0
unaizalakain/django
django/core/management/commands/startapp.py
513
1040
from importlib import import_module from django.core.management.base import CommandError from django.core.management.templates import TemplateCommand class Command(TemplateCommand): help = ("Creates a Django app directory structure for the given app " "name in the current directory or optionally in t...
bsd-3-clause
jacobwegner/phileo
phileo/models.py
2
1431
from __future__ import unicode_literals from django.conf import settings from django.db import models from django.utils import timezone from django.utils.encoding import python_2_unicode_compatible from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic # Compatibi...
mit
westinedu/wrgroups
dbindexer/backends.py
74
18859
from django.db import models from django.db.models.fields import FieldDoesNotExist from django.db.models.sql.constants import JOIN_TYPE, LHS_ALIAS, LHS_JOIN_COL, \ TABLE_NAME, RHS_JOIN_COL from django.utils.tree import Node from djangotoolbox.fields import ListField from .lookups import StandardLookup OR = 'OR' #...
bsd-3-clause
savoirfairelinux/django
tests/serializers/models/base.py
78
3864
""" Serialization ``django.core.serializers`` provides interfaces to converting Django ``QuerySet`` objects to and from "flat" data (i.e. strings). """ from decimal import Decimal from django.db import models class CategoryMetaDataManager(models.Manager): def get_by_natural_key(self, kind, name): retur...
bsd-3-clause
ajayuranakar/django-blog
lib/python2.7/site-packages/pip/commands/bundle.py
80
2156
import textwrap from pip.locations import build_prefix, src_prefix from pip.util import display_path, backup_dir from pip.log import logger from pip.exceptions import InstallationError from pip.commands.install import InstallCommand class BundleCommand(InstallCommand): """Create pybundles (archives containing mul...
gpl-3.0
paulmadore/Eric-IDE
6-6.0.9/eric/Network/IRC/IrcWidget.py
2
38744
# -*- coding: utf-8 -*- # Copyright (c) 2012 - 2015 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing the IRC window. """ from __future__ import unicode_literals try: str = unicode except NameError: pass import re import logging from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QByteAr...
gpl-3.0
cancan101/tensorflow
tensorflow/contrib/seq2seq/python/kernel_tests/decoder_test.py
6
7087
# 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
Yong-Lee/decode-Django
Django-1.5.1/django/contrib/localflavor/cn/cn_provinces.py
110
1378
# -*- coding: utf-8 -*- """ An alphabetical list of provinces for use as `choices` in a formfield. Reference: http://en.wikipedia.org/wiki/ISO_3166-2:CN http://en.wikipedia.org/wiki/Province_%28China%29 http://en.wikipedia.org/wiki/Direct-controlled_municipality http://en.wikipedia.org/wiki/Autonomous_regions_of_Chin...
gpl-2.0
RandomKori/Forex
ForexNN1/ForexNN1/ForexNN1.py
1
3249
from __future__ import print_function import numpy as np import cntk from cntk.ops.functions import load_model def LoadData(fn,is_training): n=".\\Data\\"+fn datainp=cntk.io.StreamDef("features",45) dataout=cntk.io.StreamDef("labels",3,is_sparse=True) dataall=cntk.io.StreamDefs(features=datainp,labels=...
gpl-3.0
xz/cyber-security
api/run.py
10
1269
#!/usr/bin/python3 """ picoCTF API Startup script """ import api from argparse import ArgumentParser from api.app import app def main(): """ Runtime management of the picoCTF API """ parser = ArgumentParser(description="picoCTF API configuration") parser.add_argument("-v", "--verbose", action="...
mit
napkindrawing/ansible
lib/ansible/modules/cloud/cloudstack/cs_domain.py
21
7641
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2015, René Moser <mail@renemoser.net> # # 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 Lice...
gpl-3.0
lucernae/geonode
geonode/api/tests.py
2
12577
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2016 OSGeo # # 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 ...
gpl-3.0
EduPepperPD/pepper2013
common/djangoapps/student/migrations/0006_expand_meta_field.py
188
9246
# 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): # Changing field 'UserProfile.meta' db.alter_column('auth_userprofile', 'meta', self.gf('django.db.models.fields....
agpl-3.0
cchurch/ansible
lib/ansible/modules/network/illumos/dladm_vlan.py
52
5406
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2016, Adam Števko <adam.stevko@gmail.com> # 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
ljhljh235/AutoRest
src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/Lro/fixtures/acceptancetestslro/operations/lr_os_custom_header_operations.py
14
15784
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
mit
J861449197/edx-platform
lms/djangoapps/ccx/tests/test_overrides.py
33
5679
# coding=UTF-8 """ tests for overrides """ import datetime import mock import pytz from nose.plugins.attrib import attr from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error from django.test.utils import override_settings from request_cache.middleware import RequestCache from student...
agpl-3.0
nzavagli/UnrealPy
UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/Python-2.7.10/Lib/test/test_descr.py
11
160976
import __builtin__ import gc import sys import types import unittest import weakref from copy import deepcopy from test import test_support class OperatorsTest(unittest.TestCase): def __init__(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) self.binops = { '...
mit
JoKaWare/GViews
tools/grit/grit/tool/build.py
7
12155
#!/usr/bin/env python # 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. '''The 'grit build' tool along with integration for this tool with the SCons build system. ''' import filecmp import getopt import...
bsd-3-clause
XefPatterson/INF8225_Project
Data/Messenger/parse_messenger_chat.py
1
6613
""" Prerequis --------- Discussion facebook dans le folder: messages.htm To run ------ git clone https://github.com/ownaginatious/fbchat-archive-parser.git cd fbchat-archive-parser python setup.py install fbcap messages.htm -r -f json > file.json -r: utile pour remplacer les ids par les vrais noms. Vu que c'est ...
mit
apixandru/intellij-community
python/lib/Lib/site-packages/django/contrib/admin/templatetags/admin_list.py
73
13206
import datetime from django.conf import settings from django.contrib.admin.util import lookup_field, display_for_field, label_for_field from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR from django.cor...
apache-2.0
minimumcut/UnnamedEngine
UnnamedEngine/Vendor/assimp/test/other/streamload.py
37
1838
#!/usr/bin/env python3 """Read all test files for a particular file format using a single importer instance. Read them again in reversed order. This is used to verify that a loader does proper cleanup and can be called repeatedly.""" import sys import os import subprocess # hack-load utils.py and settings.py from .....
mit
shoopio/shoop
shuup_tests/discounts/test_discount_admin.py
2
13485
# This file is part of Shuup. # # Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import datetime import json import pytest from django.http.response import Http404 from d...
agpl-3.0
facelessuser/ThemeTweaker
tests/test_json.py
4
1094
"""Test JSON.""" import unittest from . import validate_json_format import os import fnmatch class TestSettings(unittest.TestCase): """Test JSON settings.""" def _get_json_files(self, pattern, folder='.'): """Get JSON files.""" for root, dirnames, filenames in os.walk(folder): fo...
mit
hellodata/hellodate
2/site-packages/django/contrib/gis/tests/geoapp/models.py
75
1559
from django.contrib.gis.db import models from django.contrib.gis.tests.utils import mysql, spatialite from django.utils.encoding import python_2_unicode_compatible # MySQL spatial indices can't handle NULL geometries. null_flag = not mysql @python_2_unicode_compatible class NamedModel(models.Model): name = model...
lgpl-3.0
JeyZeta/Dangerous
Dangerous/Golismero/thirdparty_libs/requests/packages/charade/euckrprober.py
2931
1675
######################## 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
Gabrielcarvfer/NS3
bindings/python/ns3modulescan-modular.py
2
11968
#! /usr/bin/env python3 import sys import os.path import pybindgen.settings from pybindgen.castxmlparser import ModuleParser, PygenClassifier, PygenSection, WrapperWarning, find_declaration_from_name from pybindgen.typehandlers.codesink import FileCodeSink from pygccxml.declarations import templates from pygccxml.dec...
gpl-2.0
mrquim/mrquimrepo
script.module.youtube.dl/lib/youtube_dl/YoutubeDL.py
7
106570
#!/usr/bin/env python # coding: utf-8 from __future__ import absolute_import, unicode_literals import collections import contextlib import copy import datetime import errno import fileinput import io import itertools import json import locale import operator import os import platform import re import shutil import su...
gpl-2.0
dessn/sn-bhm
dessn/configurations/lock.py
1
3531
import os import logging import socket from dessn.framework.fitter import Fitter from dessn.framework.models.approx_model import ApproximateModelW, ApproximateModel, ApproximateModelWSimplified from dessn.framework.simulations.snana import SNANASimulation if __name__ == "__main__": logging.basicConfig(level=log...
mit
DevinGeo/moviepy
examples/example_with_sound.py
14
1695
""" Description of the video: The screen is split in two parts showing Carry and Audrey at the phone, talking at the same time, because it is actually two scenes of a same movie put together. """ from moviepy.editor import * from moviepy.video.tools.drawing import color_split duration = 6 # duration of the final cli...
mit
itkinside/ari
ari/util/array.py
1
1635
#! /usr/bin/env python # # Copyright (C) 2007 Stein Magnus Jodal # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 # as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, #...
gpl-2.0
mancoast/CPythonPyc_test
fail/334_test_relative_imports.py
33
8883
"""Test relative imports (PEP 328).""" from .. import util from . import util as import_util import sys import unittest class RelativeImports(unittest.TestCase): """PEP 328 introduced relative imports. This allows for imports to occur from within a package without having to specify the actual package name. ...
gpl-3.0
ProjectSWGCore/NGECore2
scripts/mobiles/dantooine/dark_side_savage.py
2
1226
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from java.util import Vector def addTemplate(core): mobileTemplate = MobileTemplate() mobi...
lgpl-3.0
GoogleCloudPlatform/python-compat-runtime
appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/http_runtime_constants.py
6
2562
#!/usr/bin/env python # # 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 # # Unless required by applicable law o...
apache-2.0
johan--/django-leaflet
leaflet/tests/tests.py
4
7597
# -*- coding: utf-8 -*- from __future__ import unicode_literals import django from django.test import SimpleTestCase from django.contrib.gis.db import models as gismodels from .. import PLUGINS, PLUGIN_FORMS, _normalize_plugins_config from ..templatetags import leaflet_tags from ..admin import LeafletGeoAdmin from .....
lgpl-3.0
olivernina/ocropy
ocrolib/common.py
2
35991
# -*- coding: utf-8 -*- ################################################################ ### common functions for data structures, file name manipulation, etc. ################################################################ import os,os.path import re import numpy import unicodedata import sys import warnings import ...
apache-2.0
ipselium/cpyvke
cpyvke/objects/pad.py
1
3763
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright © 2016-2018 Cyril Desjouy <ipselium@free.fr> # # This file is part of cpyvke # # cpyvke 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 vers...
gpl-3.0
ashhher3/scikit-learn
examples/decomposition/plot_pca_vs_fa_model_selection.py
30
4516
#!/usr/bin/python # -*- coding: utf-8 -*- """ ================================================================= Model selection with Probabilistic (PCA) and Factor Analysis (FA) ================================================================= Probabilistic PCA and Factor Analysis are probabilistic models. The conseq...
bsd-3-clause
pepetreshere/odoo
addons/event/models/event_stage.py
4
1440
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import _, fields, models class EventStage(models.Model): _name = 'event.stage' _description = 'Event Stage' _order = 'sequence, name' name = fields.Char(string='Stage Name', required=True, tr...
agpl-3.0
glennq/scikit-learn
examples/linear_model/plot_lasso_lars.py
363
1080
#!/usr/bin/env python """ ===================== Lasso path using LARS ===================== Computes Lasso Path along the regularization parameter using the LARS algorithm on the diabetes dataset. Each color represents a different feature of the coefficient vector, and this is displayed as a function of the regulariza...
bsd-3-clause
ryfeus/lambda-packs
HDF4_H5_NETCDF/source2.7/h5py/tests/old/test_attrs.py
1
4695
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Attributes testing module Covers all op...
mit
nanditav/15712-TensorFlow
tensorflow/examples/tutorials/mnist/mnist_softmax.py
6
2721
# 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
oasiswork/odoo
openerp/addons/base/tests/test_api.py
182
17429
from openerp import models from openerp.tools import mute_logger from openerp.osv.orm import except_orm from openerp.tests import common class TestAPI(common.TransactionCase): """ test the new API of the ORM """ def assertIsRecordset(self, value, model): self.assertIsInstance(value, models.BaseModel...
agpl-3.0
jamesqo/coreclr
extract-from-json.py
6
1425
#!/usr/bin/python import argparse import json import sys def parse_args(): parser = argparse.ArgumentParser( description="""Extracts information from a json file by navigating the JSON object using a sequence of property accessors and returning the JSON subtree, or the raw data, found ...
mit
BillBillBillBill/Tickeys-linux
tickeys/kivy_32/kivy/factory_registers.py
8
8491
# Auto-generated file by setup.py build_factory from kivy.factory import Factory r = Factory.register r('Adapter', module='kivy.adapters.adapter') r('ListAdapter', module='kivy.adapters.listadapter') r('SimpleListAdapter', module='kivy.adapters.simplelistadapter') r('DictAdapter', module='kivy.adapters.dictadapter') ...
mit
Og192/Python
machine-learning-algorithms/mlalg/decisionTree/trees.py
2
1562
from math import log def calcShannonEnt(dataSet): numEntries = len(dataSet) labelCounts = {} for featVec in dataSet: currentLabel = featVec[-1] if currentLabel not in labelCounts.keys(): labelCounts[currentLabel] = 0 labelCounts[currentLabel] += 1 shannonEnt = 0....
gpl-2.0
trnewman/VT-USRP-daughterboard-drivers
usrp/host/lib/gen_usrp_dbid.py
9
3859
#!/usr/bin/env python import sys import os import os.path import re from optparse import OptionParser def write_header(f, comment_char): f.write(comment_char); f.write('\n') f.write(comment_char); f.write(' Machine generated by gen_usrp_dbid.py from usrp_dbid.dat\n') f.write(comment_char); f.write(' Do no...
gpl-3.0
hargup/sympy
sympy/printing/tests/test_theanocode.py
26
9802
from sympy.external import import_module from sympy.utilities.pytest import raises, SKIP from sympy.core.compatibility import range theano = import_module('theano') if theano: import numpy as np ts = theano.scalar tt = theano.tensor xt, yt, zt = [tt.scalar(name, 'floatX') for name in 'xyz'] else: #...
bsd-3-clause
abartlet/samba-old
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
wuhengzhi/chromium-crosswalk
chrome/common/extensions/docs/server2/render_servlet_test.py
44
6233
#!/usr/bin/env python # Copyright 2013 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 unittest from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS from local_file_system import LocalFileSystem fro...
bsd-3-clause
z-fork/scrapy
scrapy/linkextractors/htmlparser.py
90
2883
""" HTMLParser-based link extractor """ import warnings from six.moves.html_parser import HTMLParser from six.moves.urllib.parse import urljoin from w3lib.url import safe_url_string from scrapy.link import Link from scrapy.utils.python import unique as unique_list from scrapy.exceptions import ScrapyDeprecationWarni...
bsd-3-clause
phord/git-submod-enhancements
contrib/p4import/git-p4import.py
47
10722
#!/usr/bin/env python # # This tool is copyright (c) 2006, Sean Estabrooks. # It is released under the Gnu Public License, version 2. # # Import Perforce branches into Git repositories. # Checking out the files is done by calling the standard p4 # client which you must have properly configured yourself # import marsha...
gpl-2.0
defzzd/UserDataBase-Heroku
venv/Lib/encodings/utf_8_sig.py
266
4133
""" Python 'utf-8-sig' Codec This work similar to UTF-8 with the following changes: * On encoding/writing a UTF-8 encoded BOM will be prepended/written as the first three bytes. * On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these bytes will be skipped. """ import codecs ### Codec APIs ...
mit
jblackburne/scikit-learn
sklearn/datasets/samples_generator.py
26
56554
""" Generate samples of synthetic data sets. """ # Authors: B. Thirion, G. Varoquaux, A. Gramfort, V. Michel, O. Grisel, # G. Louppe, J. Nothman # License: BSD 3 clause import numbers import array import numpy as np from scipy import linalg import scipy.sparse as sp from ..preprocessing import MultiLabelBin...
bsd-3-clause
renatofb/weblate
weblate/trans/models/dictionary.py
4
6908
# -*- coding: utf-8 -*- # # Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com> # # This file is part of Weblate <http://weblate.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, eithe...
gpl-3.0
iosdevzone/bitcoin
qa/rpc-tests/proxy_test.py
93
7769
#!/usr/bin/env python2 # Copyright (c) 2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import socket import traceback, sys from binascii import hexlify import time, os from test_framework.socks5 im...
mit
spcui/virt-test
qemu/tests/nmi_bsod_catch.py
3
3763
import time import logging from autotest.client.shared import error @error.context_aware def run_nmi_bsod_catch(test, params, env): """ Generate a dump on NMI, then analyse the dump file: 1) Boot a windows guest. 2) Edit the guest's system registry if need. 3) Reboot the guest. 4) Send inject-...
gpl-2.0
rven/odoo
addons/hw_escpos/escpos/escpos.py
20
32683
# -*- coding: utf-8 -*- from __future__ import print_function import base64 import copy import io import math import re import traceback import codecs from hashlib import md5 from PIL import Image from xml.etree import ElementTree as ET try: import jcconv except ImportError: jcconv = None try: import ...
agpl-3.0
minhphung171093/GreenERP_V7
openerp/addons/purchase/tests/__init__.py
18
1050
# -*- 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
jonasjberg/autonameow
autonameow/vendor/prompt_toolkit/terminal/vt100_output.py
9
19851
""" Output for vt100 terminals. A lot of thanks, regarding outputting of colors, goes to the Pygments project: (We don't rely on Pygments anymore, because many things are very custom, and everything has been highly optimized.) http://pygments.org/ """ from __future__ import unicode_literals from prompt_toolkit.filter...
gpl-2.0
svennam92/php-buildpack
lib/build_pack_utils/downloads.py
15
4029
import os import urllib2 import re import logging from subprocess import Popen from subprocess import PIPE class Downloader(object): def __init__(self, config): self._ctx = config self._log = logging.getLogger('downloads') self._init_proxy() def _init_proxy(self): handlers = ...
apache-2.0
krytarowski/coreclr
tests/scripts/optdata/bootstrap.py
4
3054
#!/usr/bin/env python """ This script prepares the local source tree to be built with custom optdata. Simply run this script and follow the instructions to inject manually created optdata into the build. """ import argparse import os from os import path import shutil import subprocess import sys import xm...
mit
camptocamp/mapproxy
mapproxy/test/system/test_wmsc.py
6
4173
# This file is part of the MapProxy project. # Copyright (C) 2010 Omniscale <http://omniscale.de> # # 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...
apache-2.0
mcanthony/oiio
testsuite/runtest.py
3
10003
#!/usr/bin/env python import os import glob import sys import platform import subprocess import difflib import filecmp from optparse import OptionParser # # Get standard testsuite test arguments: srcdir exepath # srcdir = "." tmpdir = "." path = "../.." # Options for the command line parser = OptionParser() parse...
bsd-3-clause
oubiwann/txjsonrpc
txjsonrpc/web/test/test_jsonrpc.py
4
8818
# Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. """ Test JSON-RPC support. """ from twisted.internet import reactor, defer from twisted.trial import unittest from twisted.web import server, static from txjsonrpc import jsonrpclib from txjsonrpc.jsonrpc import addIntrospection from txj...
mit
neoareslinux/neutron
neutron/plugins/opencontrail/common/exceptions.py
62
1127
# Copyright 2014 Juniper Networks. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
apache-2.0
amandalund/openmc
openmc/data/product.py
8
5848
from collections.abc import Iterable from numbers import Real import numpy as np import openmc.checkvalue as cv from openmc.mixin import EqualityMixin from .angle_energy import AngleEnergy from .function import Tabulated1D, Polynomial, Function1D class Product(EqualityMixin): """Secondary particle emitted in a ...
mit
Balannen/LSMASOMM
atom3/Kernel/classDiagram/MyClass0.py
1
1511
# __MyClass0.py_____________________________________________________ from ASGNode import * from ATOM3Type import * from ATOM3Integer import * from ATOM3Boolean import * from graph_MyClass0 import * class MyClass0(ASGNode, ATOM3Type): def __init__(self, parent = None): ASGNode.__init__(self) ...
gpl-3.0
CiscoSystems/neutron
neutron/tests/unit/cisco/cfg_agent/test_csr1kv_routing_driver.py
17
12132
# Copyright 2014 Cisco Systems, 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 requir...
apache-2.0
blackball/an-test6
util/sdss_cutout.py
1
1935
#! /usr/bin/env python import os import sys import pyfits from astrometry.util.util import * import pyfits from astrometry.util.sdss_noise import * from astrometry.util.sdss_psfield import * def main(): from optparse import OptionParser parser = OptionParser(usage='%prog [options] <ra> <dec> <fpC> <cutout> [<fpM> ...
gpl-2.0
andreparrish/python-for-android
python3-alpha/python3-src/Lib/test/test_with.py
83
26527
#!/usr/bin/env python3 """Unit tests for the with statement specified in PEP 343.""" __author__ = "Mike Bland" __email__ = "mbland at acm dot org" import sys import unittest from collections import deque from contextlib import _GeneratorContextManager, contextmanager from test.support import run_unittest class Mo...
apache-2.0
jimcunderwood/MissionPlanner
Lib/encodings/iso8859_13.py
93
13834
""" Python Character Mapping Codec iso8859_13 generated from 'MAPPINGS/ISO8859/8859-13.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self...
gpl-3.0
janocat/odoo
addons/membership/wizard/__init__.py
432
1071
# -*- 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
techtonik/pip
src/pip/_internal/req/req_file.py
8
11940
""" Requirements file parsing """ from __future__ import absolute_import import optparse import os import re import shlex import sys from pip._vendor.six.moves import filterfalse from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._internal.cli import cmdoptions from pip._internal.download impor...
mit
Nexenta/cinder
cinder/api/v3/group_snapshots.py
5
5378
# Copyright (C) 2016 EMC Corporation. # 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
m3wolf/orgwolf
orgwolf/wsgi.py
1
1872
####################################################################### # Copyright 2012 Mark Wolf # # This file is part of OrgWolf. # # OrgWolf 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...
gpl-3.0
Darkmoth/python-django-4
Thing/env/Lib/site-packages/django/core/exceptions.py
486
5276
""" Global Django exception and warning classes. """ from django.utils import six from django.utils.encoding import force_text class FieldDoesNotExist(Exception): """The requested model field does not exist""" pass class DjangoRuntimeWarning(RuntimeWarning): pass class AppRegistryNotReady(Exception): ...
gpl-2.0
XiaosongWei/chromium-crosswalk
tools/perf/benchmarks/text_selection.py
9
2027
# 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. from core import perf_benchmark from telemetry import benchmark from telemetry.timeline import tracing_category_filter from telemetry.web_perf import timeli...
bsd-3-clause
T3h-N1k0/LAC
lac/engine.py
1
57871
# coding: utf-8 import os import re import hashlib import time from string import strip from datetime import datetime, timedelta, date from dateutil.relativedelta import relativedelta from flask import current_app, request, flash, render_template, session, redirect, url_for from lac.data_modelz import * from lac.helper...
gpl-3.0
ericzhou2008/zulip
zerver/lib/bugdown/testing_mocks.py
124
8065
from __future__ import absolute_import import ujson NORMAL_TWEET = """{ "coordinates": null, "created_at": "Sat Sep 10 22:23:38 +0000 2011", "truncated": false, "favorited": false, "id_str": "112652479837110273", "in_reply_to_user_id_str": "783214", "text": "@twitter meets @seepicturely at #tcdisrupt c...
apache-2.0
mganeva/mantid
Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLPolarizationCorTest.py
1
1444
# -*- coding: utf-8 -*- # Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + from __future__ impo...
gpl-3.0
makhan/spaghetti-basic
expression_parser.py
1
4524
#! /usr/bin/python LOGICAL=["AND","OR","XOR"] RELATIONAL=["<",">","=",'<=','>=','<>'] ADD_SUB=['+','-'] MULT=['*','/','%'] def list_statement(source): (tokens,pos)=source if pos>=len(tokens) or tokens[pos]=='\n': return None else: ret=expression(source) if len(source[0])>source[-1] and expect(source,','): ...
mit
jusdng/odoo
addons/hr_timesheet_sheet/hr_timesheet_sheet.py
107
35585
# -*- 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