repo_name
stringlengths
5
100
path
stringlengths
4
294
copies
stringclasses
990 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
mbalasso/mynumpy
doc/numpybook/comparison/weave/inline.py
20
1191
from scipy import weave from numpy import rand, zeros_like def example1(a): if not isinstance(a, list): raise ValueError, "argument must be a list" code = r""" int i; py::tuple results(2); for (i=0; i<a.length(); i++) { a[i] = i; } ...
bsd-3-clause
Antergos/antergos-welcome
src/client.py
1
9962
#!/usr/bin/env python # -*- coding: utf-8 -*- # # client.py # # Copyright © 2015-2017 Antergos # # This file is part of antergos-welcome # # Antergos-welcome is free software: you can redistribute it and/or modify # it under the temms of the GNU General Public License as published by # the Free Software Foundatio...
gpl-2.0
grap/OpenUpgrade
addons/document/content_index.py
430
6619
# -*- 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
mdavid/pledgeservice
testlib/mox.py
13
56547
#!/usr/bin/python2.4 # # Copyright 2008 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...
agpl-3.0
datasciencedev/locality-sensitive-hashing
lsh_matrix.py
2
11266
import sys, struct, os, time, types, re, math, random, operator, hashlib, pdb import logging, settings logging.basicConfig(filename=settings.LOG_FILENAME, level=logging.DEBUG) from lsh.shingles.shingles import _get_list_of_shingles from lsh.utils.similarity import compute_positive_hash DbType = settings.DATABASES['de...
apache-2.0
NaturalGIS/naturalgis_qgis
tests/src/python/test_qgspointclusterrenderer.py
43
8110
# -*- coding: utf-8 -*- """ *************************************************************************** test_qgspointclusterrenderer.py ----------------------------- Date : September 2016 Copyright : (C) 2016 by Nyall Dawson Email : nyall dot dawson at gmai...
gpl-2.0
kernevil/samba
third_party/waf/waflib/extras/swig.py
39
6252
#! /usr/bin/env python # encoding: UTF-8 # Petar Forai # Thomas Nagy 2008-2010 (ita) import re from waflib import Task, Logs from waflib.TaskGen import extension, feature, after_method from waflib.Configure import conf from waflib.Tools import c_preproc """ tasks have to be added dynamically: - swig interface files m...
gpl-3.0
askeing/servo
tests/wpt/web-platform-tests/webvtt/parsing/file-parsing/tools/build.py
89
3474
import os import glob import shutil from os import path TEST_FILE_PATTERN = "support/**.test" TEST_OUTPUT_PATH = "tests" TEMPLATE = """\ <!doctype html> <!-- DO NOT EDIT! This file and %vtt_file_rel_path are generated. --> <!-- See /webvtt/parsing/file-parsing/README.md --> <meta charset=utf-8> <title>WebVTT parser ...
mpl-2.0
jrrembert/django
django/utils/deconstruct.py
502
2047
from importlib import import_module from django.utils.version import get_docs_version def deconstructible(*args, **kwargs): """ Class decorator that allow the decorated class to be serialized by the migrations subsystem. Accepts an optional kwarg `path` to specify the import path. """ path =...
bsd-3-clause
iShoto/testpy
codes/20200112_pytorch_cifar10/src/models/googlenet.py
4
3221
'''GoogLeNet with PyTorch.''' import torch import torch.nn as nn import torch.nn.functional as F class Inception(nn.Module): def __init__(self, in_planes, n1x1, n3x3red, n3x3, n5x5red, n5x5, pool_planes): super(Inception, self).__init__() # 1x1 conv branch self.b1 = nn.Sequential( ...
mit
ABaldwinHunter/django-clone
tests/builtin_server/tests.py
368
5230
from __future__ import unicode_literals import sys import traceback from io import BytesIO from unittest import TestCase from wsgiref import simple_server # If data is too large, socket will choke, so write chunks no larger than 32MB # at a time. The rationale behind the 32MB can be found on Django's Trac: # https://...
bsd-3-clause
dlazz/ansible
lib/ansible/plugins/inventory/vultr.py
39
5042
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> # 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 DOCUMENTATION = r''' name: vultr plugin_type: inventory author: ...
gpl-3.0
Morgan-Stanley/treadmill
lib/python/treadmill/cli/admin/diag/psmem.py
2
4422
"""Reports memory utilization details for given container.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import click from treadmill import psmem from treadmill import cgroups from treadmill import cgu...
apache-2.0
polyrabbit/polyglot
polyglot/cli.py
1
2433
#!/usr/bin/env python #coding: utf-8 import os import sys import logging import click from .model import LanguageModel from .classifier import Classifier logging.basicConfig(format='%(asctime)s -- %(message)s') @click.group() def run(): """I am a computer language savant""" @run.command() @click.option('-c', '-...
bsd-3-clause
shangvven/Wox
PythonHome/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py
1005
92627
#------------------------------------------------------------------- # tarfile.py #------------------------------------------------------------------- # Copyright (C) 2002 Lars Gustaebel <lars@gustaebel.de> # All rights reserved. # # Permission is hereby granted, free of charge, to any person # obtaining a copy ...
mit
uglyboxer/linear_neuron
net-p3/lib/python3.5/site-packages/pip/download.py
279
31936
from __future__ import absolute_import import cgi import email.utils import hashlib import getpass import json import logging import mimetypes import os import platform import re import shutil import sys import tempfile try: import ssl # noqa HAS_TLS = True except ImportError: HAS_TLS = False from pip._...
mit
Jajcus/pyxmpp
tests/vcard.py
1
5613
#!/usr/bin/python import unittest import libxml2 from pyxmpp.jabber import vcard def vcard2txt(vcard): """Extract data from VCard object for text comparision. Separate function defined here to test the API (attribute access).""" ret="Full name: %r\n" % (vcard.fn.value,) ret+="Structural name:\n" ...
lgpl-2.1
yajiedesign/mxnet
tests/nightly/common.py
5
4064
# 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 u...
apache-2.0
Ssawa/Diamond
src/collectors/ping/test/testping.py
26
6033
#!/usr/bin/python # coding=utf-8 ########################################################################## from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch from diamond.collector import Collector from ping import PingColle...
mit
Grirrane/odoo
openerp/addons/base/ir/ir_values.py
5
26147
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 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
kittiu/odoo
openerp/addons/base/tests/test_view_validation.py
396
3427
# This test can be run stand-alone with something like: # > PYTHONPATH=. python2 openerp/tests/test_view_validation.py from lxml import etree from StringIO import StringIO import unittest2 from openerp.tools.view_validation import (valid_page_in_book, valid_att_in_form, valid_type_in_colspan, ...
agpl-3.0
beniwohli/apm-agent-python
tests/instrumentation/urllib3_tests.py
1
12732
# BSD 3-Clause License # # Copyright (c) 2019, Elasticsearch BV # 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, t...
bsd-3-clause
MrLoick/python-for-android
python-modules/twisted/twisted/persisted/aot.py
60
17451
# -*- test-case-name: twisted.test.test_persisted -*- # Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. """ AOT: Abstract Object Trees The source-code-marshallin'est abstract-object-serializin'est persister this side of Marmalade! """ import types, new, string, copy_reg, tokenize, r...
apache-2.0
XXMrHyde/android_external_chromium_org
chrome/test/functional/chromeos_onc.py
35
4836
#!/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. import os import pyauto_functional # must come before pyauto. import policy_base import pyauto class ChromeosONC(policy_base.Po...
bsd-3-clause
mhdella/scikit-learn
sklearn/utils/class_weight.py
140
7206
# Authors: Andreas Mueller # Manoj Kumar # License: BSD 3 clause import warnings import numpy as np from ..externals import six from ..utils.fixes import in1d from .fixes import bincount def compute_class_weight(class_weight, classes, y): """Estimate class weights for unbalanced datasets. Paramete...
bsd-3-clause
smalls257/VRvisu
Library/External.LCA_RESTRICTED/Languages/CPython/27/Lib/idlelib/FileList.py
123
3656
import os from Tkinter import * import tkMessageBox class FileList: # N.B. this import overridden in PyShellFileList. from idlelib.EditorWindow import EditorWindow def __init__(self, root): self.root = root self.dict = {} self.inversedict = {} self.vars = {} # For EditorW...
gpl-3.0
DeltaEpsilon-HackFMI2/FMICalendar-REST
venv/lib/python2.7/site-packages/django/utils/unittest/result.py
570
6105
"""Test result object""" import sys import traceback import unittest from StringIO import StringIO from django.utils.unittest import util from django.utils.unittest.compatibility import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'fail...
mit
demisto/content
Packs/Netcraft/Integrations/Netcraft/Netcraft.py
1
20261
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import requests from requests.auth import HTTPBasicAuth # Disable insecure warnings requests.packages.urllib3.disable_warnings() ''' GLOBALS/PARAMS ''' USERNAME = demisto.params()['credentials']['ide...
mit
pratikmallya/heat
heat/tests/engine/service/test_stack_snapshot.py
7
11653
# 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 unde...
apache-2.0
byt3bl33d3r/mitmproxy
libmproxy/console/__init__.py
11
21599
from __future__ import absolute_import import mailcap import mimetypes import tempfile import os import os.path import shlex import signal import stat import subprocess import sys import traceback import urwid import weakref from .. import controller, flow, script from . import flowlist, flowview, help, window, signa...
mit
jiangzhuo/kbengine
kbe/src/lib/python/Lib/tkinter/ttk.py
61
55714
"""Ttk wrapper. This module provides classes to allow using Tk themed widget set. Ttk is based on a revised and enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style engine. Its basic idea is to separate, to the extent possible, the code implementing a widget's behavior from the code implementing its ap...
lgpl-3.0
philsch/ansible
lib/ansible/modules/network/lenovo/cnos_reload.py
59
4933
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2017 Lenovo, 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
fyfcauc/android_external_chromium-org
remoting/tools/build/remoting_localize.py
48
26864
#!/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. """ localize.py -- Generates an output file from the given template replacing variables and localizing strings. The script uses Jinja2...
bsd-3-clause
mrquim/mrquimrepo
plugin.video.salts/scrapers/streamdor_scraper.py
5
3428
""" SALTS XBMC Addon Copyright (C) 2014 tknorris 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. T...
gpl-2.0
LPM-HMS/COSMOS-2.0
cosmos/models/Workflow.py
2
33046
""" Tools for defining, running and terminating Cosmos workflows. """ import atexit import datetime import getpass import os import re import signal import sys import time import warnings import funcsigs import networkx as nx from flask import url_for from networkx.algorithms.dag import descendants, topological_so...
gpl-3.0
eXistenZNL/SickRage
autoProcessTV/lib/requests/packages/urllib3/packages/six.py
2375
11628
"""Utilities for writing code that runs on Python 2 and 3""" #Copyright (c) 2010-2011 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 without l...
gpl-3.0
arguman/arguman.org
web/blog/views.py
8
1267
from django.conf import settings from django.contrib.syndication.views import Feed from django.utils.feedgenerator import Atom1Feed from django.views.generic import ListView from django.views.generic.detail import DetailView from blog.models import Post class BlogIndexView(ListView): template_name = "blog/index....
agpl-3.0
HLFH/CouchPotatoServer
libs/requests/packages/charade/gb2312prober.py
2994
1681
######################## 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...
gpl-3.0
f0rki/cb-multios
original-challenges/CGC_Video_Format_Parser_and_Viewer/support/pollerGen.py
1
14513
''' Copyright (c) 2014 Cromulence LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
mit
helldorado/ansible
test/units/modules/network/onyx/test_onyx_pfc_interface.py
68
4284
# # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type from units.compat.mock import patch from ansible.modules.network.onyx impor...
gpl-3.0
hunch/hunch-sample-app
django/template/debug.py
9
3894
from django.conf import settings from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError from django.utils.encoding import force_unicode from django.utils.html import escape from django.utils.safestring import SafeData, EscapeData from django.utils.formats import localize ...
mit
oposs/check_mk_mirror
web/htdocs/main.py
1
2879
#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ /...
gpl-2.0
FCH808/FCH808.github.io
Intro to Machine Learning/ud120-projects/feature_selection/find_signature.py
2
1243
#!/usr/bin/python import pickle import numpy numpy.random.seed(42) ### the words (features) and authors (labels), already largely processed words_file = "word_data_overfit.pkl" ### like the file you made in the last mini-project authors_file = "email_authors_overfit.pkl" ### this too word_data = pickle.load( open(...
mit
nju520/django
tests/indexes/tests.py
321
3037
from unittest import skipUnless from django.db import connection from django.test import TestCase from .models import Article, ArticleTranslation, IndexTogetherSingleList class SchemaIndexesTests(TestCase): """ Test index handling by the db.backends.schema infrastructure. """ def test_index_name_ha...
bsd-3-clause
EventBuck/EventBuck
conf.py
1
5585
#!/usr/bin/env python # -*- coding:utf-8 -*- # Canvas Page name. FACEBOOK_CANVAS_NAME = 'ojo-ticket' # A random token for use with the Real-time API. FACEBOOK_REALTIME_VERIFY_TOKEN = 'RANDOM TOKEN' # The external URL this application is available at where the Real-time API will # send it's pings. EXTERNAL_HREF = ...
mit
mlaidouni/Artistfunds
venv/lib/python2.7/site-packages/pip/req/req_set.py
25
32236
from __future__ import absolute_import from collections import defaultdict from itertools import chain import logging import os from pip._vendor import pkg_resources from pip._vendor import requests from pip.compat import expanduser from pip.download import (is_file_url, is_dir_url, is_vcs_url, url_to_path, ...
mit
ssanderson/numpy
numpy/core/defchararray.py
21
67393
""" This module contains a set of functions for vectorized string operations and methods. .. note:: The `chararray` class exists for backwards compatibility with Numarray, it is not recommended for new development. Starting from numpy 1.4, if one needs arrays of strings, it is recommended to use arrays of ...
bsd-3-clause
tangfeixiong/nova
nova/api/openstack/compute/plugins/v3/cloudpipe.py
25
7410
# Copyright 2011 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
apache-2.0
microwaveabletoaster/STEPlang
step.py
1
4577
#!/usr/bin/env python # -*- coding: utf-8 -*- from argparse import ArgumentParser import sys, copy, os, glob, time reserved_methods = ['pause','output', 'input', 'finput', 'sto', 'dupe' ,'+', '-', '/', '*', '%', '?', 'goto', 'end', 'rand', '>', '<', '==', "!="] parser = ArgumentParser() parser.add_argument('file',he...
unlicense
elky/django
tests/db_utils/tests.py
17
2050
"""Tests for django.db.utils.""" import unittest from django.core.exceptions import ImproperlyConfigured from django.db import DEFAULT_DB_ALIAS, connection from django.db.utils import ConnectionHandler, ProgrammingError, load_backend from django.test import SimpleTestCase, TestCase class ConnectionHandlerTests(Simpl...
bsd-3-clause
trezorg/django
tests/regressiontests/queries/models.py
51
8305
""" Various complex queries that have been problematic in the past. """ import threading from django.db import models class DumbCategory(models.Model): pass class NamedCategory(DumbCategory): name = models.CharField(max_length=10) class Tag(models.Model): name = models.CharField(max_length=10) pare...
bsd-3-clause
scottdangelo/RemoveVolumeMangerLocks
cinder/tests/unit/test_quobyte.py
11
38899
# Copyright (c) 2014 Quobyte Inc. # Copyright (c) 2013 Red Hat, 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...
apache-2.0
salamer/django
django/contrib/gis/db/backends/base/operations.py
263
4865
class BaseSpatialOperations(object): """ This module holds the base `BaseSpatialBackend` object, which is instantiated by each spatial database backend with the features it has. """ truncate_params = {} # Quick booleans for the type of this spatial backend, and # an attribute for the sp...
bsd-3-clause
sljeff/JBlog
db.py
1
10515
# coding: utf-8 import sqlite3 import datetime from functools import lru_cache class DB: def __init__(self, dbpath='blog.db'): """ :param str dbpath: database path """ self._dbpath = dbpath @staticmethod def _prepare_conditions(conditions): """ example: ...
mit
moylop260/odoo-dev
addons/hw_scale/__init__.py
1894
1075
# -*- 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...
agpl-3.0
twiest/openshift-tools
openshift/installer/vendored/openshift-ansible-3.8.36-1/roles/lib_openshift/src/class/oc_env.py
66
4765
# pylint: skip-file # flake8: noqa # pylint: disable=too-many-instance-attributes class OCEnv(OpenShiftCLI): ''' Class to wrap the oc command line tools ''' container_path = {"pod": "spec.containers[0].env", "dc": "spec.template.spec.containers[0].env", "rc": "sp...
apache-2.0
yongshengwang/hue
desktop/core/ext-py/Django-1.6.10/tests/forms_tests/tests/__init__.py
56
1155
from __future__ import absolute_import from .test_error_messages import (FormsErrorMessagesTestCase, ModelChoiceFieldErrorMessagesTestCase) from .test_extra import FormsExtraTestCase, FormsExtraL10NTestCase from .test_fields import FieldsTests from .test_forms import FormsTestCase from .test_formsets import (Forms...
apache-2.0
dataxu/ansible
lib/ansible/modules/cloud/amazon/ec2_eni.py
8
23900
#!/usr/bin/python # # This is a 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 Ansible library is distributed in the hope that i...
gpl-3.0
diagramsoftware/account-financial-tools
currency_rate_update/model/company.py
29
2418
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2009 CamptoCamp. All rights reserved. # @author Nicolas Bessi # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Publi...
agpl-3.0
safwanrahman/mozillians
vendor-local/lib/python/markdown/extensions/toc.py
11
9491
""" Table of Contents Extension for Python-Markdown * * * (c) 2008 [Jack Miller](http://codezen.org) Dependencies: * [Markdown 2.1+](http://packages.python.org/Markdown/) """ from __future__ import absolute_import from __future__ import unicode_literals from . import Extension from ..treeprocessors im...
bsd-3-clause
ZG-Tennis/django-cropduster
cropduster/utils.py
2
2261
from PIL import Image from decimal import Decimal def aspect_ratio(width, height): """ Defines aspect ratio from two sizes with consistent rounding method """ if not height or not width: return 1 else: return Decimal(str(round(float(width)/float(height), 2))) def rescale(img, width=0, height=0, auto_crop=Tr...
bsd-2-clause
bsmr-ansible/ansible-modules-core
cloud/amazon/ec2_metric_alarm.py
53
10776
#!/usr/bin/python # 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. # # Ansible is distributed...
gpl-3.0
hsuchie4/TACTIC
3rd_party/CherryPy/cherrypy/lib/sessions.py
6
25932
"""Session implementation for CherryPy. We use cherrypy.request to store some convenient variables as well as data about the session for the current request. Instead of polluting cherrypy.request we use a Session object bound to cherrypy.session to store these variables. """ import datetime import os try: import ...
epl-1.0
Axam/nsx-web
fuel_agent/fuel_agent/tests/test_utils.py
2
6073
# Copyright 2011 Justin Santa Barbara # Copyright 2012 Hewlett-Packard Development Company, L.P. # # 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/lic...
apache-2.0
ryfeus/lambda-packs
Tensorflow/source/tensorflow/contrib/memory_stats/__init__.py
16
1114
# 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...
mit
DeBortoliWines/Bika-LIMS
bika/lims/content/artemplate.py
2
8365
""" AnalysisRequests often use the same configurations. ARTemplate includes all AR fields, including preset AnalysisProfile """ from AccessControl import ClassSecurityInfo from Products.Archetypes.public import * from Products.Archetypes.references import HoldingReference from Products.CMFCore.permissions impo...
agpl-3.0
appliedx/edx-platform
lms/djangoapps/verify_student/migrations/0003_auto__add_field_softwaresecurephotoverification_display.py
114
6778
# -*- coding: 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 field 'SoftwareSecurePhotoVerification.display' db.add_column('verify_student_softwaresecurephotove...
agpl-3.0
bspink/django
tests/transactions/tests.py
239
19163
from __future__ import unicode_literals import sys import threading import time from unittest import skipIf, skipUnless from django.db import ( DatabaseError, Error, IntegrityError, OperationalError, connection, transaction, ) from django.test import ( TransactionTestCase, skipIfDBFeature, skipUnlessDBFea...
bsd-3-clause
achiku/jungle
jungle/ec2.py
1
8325
# -*- coding: utf-8 -*- import subprocess import sys import botocore import click from jungle.session import create_session def format_output(instances, flag): """return formatted string for instance""" out = [] line_format = '{0}\t{1}\t{2}\t{3}\t{4}' name_len = _get_max_name_len(instances) + 3 i...
mit
shabab12/edx-platform
openedx/core/djangoapps/programs/migrations/0001_initial.py
86
1453
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operati...
agpl-3.0
dingocuster/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
355
3576
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference in performance between the discrete SAMME [2] boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate...
bsd-3-clause
devs1991/test_edx_docmode
openedx/core/djangoapps/course_groups/management/commands/tests/test_post_cohort_membership_fix.py
14
4245
""" Test for the post-migration fix commands that are included with this djangoapp """ from django.core.management import call_command from django.test.client import RequestFactory from nose.plugins.attrib import attr from openedx.core.djangoapps.course_groups.views import cohort_handler from openedx.core.djangoapps.c...
agpl-3.0
beni55/viewfinder
backend/op/register_user_op.py
13
5924
# Copyright 2013 Viewfinder Inc. All Rights Reserved. """Viewfinder RegisterUserOperation. This operation registers an existing user by adding the REGISTERED label to it. It also can register a new mobile device. """ __authors__ = ['andy@emailscrubbed.com (Andy Kimball)'] import json from tornado import gen from v...
apache-2.0
dcosson/parallel-ci-runner
parallel_ci_runner/docker_commands.py
1
4006
from functools import partial import random import string class DockerBuildCommand(object): """ Generates a `docker build` command to run in a subprocess. """ def __init__(self, docker_repo, tag, dockerfile='Dockerfile', build_args=None): self.docker_repo = docker_repo self.tag = tag ...
mit
fbagirov/scikit-learn
doc/tutorial/machine_learning_map/pyparsing.py
258
137838
# module pyparsing.py # # Copyright (c) 2003-2008 Paul T. McGuire # # 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 u...
bsd-3-clause
macks22/gensim
gensim/test/test_keras_integration.py
1
6627
import unittest import os import numpy as np from gensim.models import word2vec try: from sklearn.datasets import fetch_20newsgroups except ImportError: raise unittest.SkipTest("Test requires sklearn to be installed, which is not available") try: import keras from keras.engine import Input from ke...
lgpl-2.1
hfp/tensorflow-xsmm
tensorflow/contrib/ignite/python/ops/igfs_ops.py
15
1920
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
apache-2.0
Innovahn/odoo.old
addons/mail/mail_group.py
247
12877
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2010-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
paran0ids0ul/infernal-twin
build/reportlab/src/reportlab/rl_config.py
31
4186
'''module that aggregates config information''' __all__=('_reset','register_reset') def _defaults_init(): ''' create & return defaults for all reportlab settings from reportlab.rl_settings.py reportlab.local_rl_settings.py reportlab_settings.py or ~/.reportlab_settings latter values override e...
gpl-3.0
mhils/mitmproxy
mitmproxy/proxy/config.py
1
3378
import os import re import typing from OpenSSL import crypto from mitmproxy import certs from mitmproxy import exceptions from mitmproxy import options as moptions from mitmproxy.net import server_spec class HostMatcher: def __init__(self, handle, patterns=tuple()): self.handle = handle self.pat...
mit
lucafavatella/intellij-community
python/testData/MockSdk3.4/python_stubs/sys.py
24
18084
# encoding: utf-8 # module sys # from (built-in) # by generator 1.138 """ This module provides access to some objects used or maintained by the interpreter and to functions that interact strongly with the interpreter. Dynamic objects: argv -- command line arguments; argv[0] is the script pathname if known path -- mod...
apache-2.0
nikhilprathapani/python-for-android
python3-alpha/python3-src/Lib/test/test_capi.py
47
7438
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from __future__ import with_statement import os import random import subprocess import sys import time import unittest from test import support try: import threading ...
apache-2.0
marcvinyals/cnfgen
cnfformula/cmdline.py
1
29676
#!/usr/bin/env python # -*- coding:utf-8 -*- """Components for command line interface CNFgen has many command line entry points to its functionality, and some of them expose the same functionality over and over. This module contains useful common components. Copyright (C) 2012, 2013, 2014, 2015, 2016 Massimo Lauria ...
gpl-3.0
BackupGGCode/python-for-android
python3-alpha/python3-src/Lib/lib2to3/fixes/fix_except.py
203
3344
"""Fixer for except statements with named exceptions. The following cases will be converted: - "except E, T:" where T is a name: except E as T: - "except E, T:" where T is not a name, tuple or list: except E as t: T = t This is done because the target of an "except" clause must be a ...
apache-2.0
jt6562/XX-Net
python27/1.0/lib/dummy_thread.py
73
4563
"""Drop-in replacement for the thread module. Meant to be used as a brain-dead substitute so that threaded code does not need to be rewritten for when the thread module is not present. Suggested usage is:: try: import thread except ImportError: import dummy_thread as thread """ ...
bsd-2-clause
gengue/django
tests/queries/models.py
33
16621
""" Various complex queries that have been problematic in the past. """ from __future__ import unicode_literals import threading from django.db import models from django.utils import six from django.utils.encoding import python_2_unicode_compatible class DumbCategory(models.Model): pass class ProxyCategory(Du...
bsd-3-clause
nerzhul/ansible
contrib/inventory/cobbler.py
93
10625
#!/usr/bin/env python """ Cobbler external inventory script ================================= Ansible has a feature where instead of reading from /etc/ansible/hosts as a text file, it can query external programs to obtain the list of hosts, groups the hosts are in, and even variables to assign to each host. To use t...
gpl-3.0
yufengg/tensorflow
tensorflow/compiler/tests/adagrad_test.py
27
5263
# 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
inovtec-solutions/OpenERP
openerp/addons/account/report/account_report.py
54
13022
# -*- 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
chainer/chainer
tests/chainer_tests/backends_tests/test_cpu.py
6
2524
import unittest import numpy from chainer import backend from chainer import testing class TestCpuDevice(unittest.TestCase): def test_hashable(self): assert isinstance(hash(backend.CpuDevice()), int) class TestCpuDeviceFromArray(unittest.TestCase): def check_device(self, device): assert ...
mit
atilag/hammerhead-nexus5-kernel
tools/perf/util/setup.py
4998
1330
#!/usr/bin/python2 from distutils.core import setup, Extension from os import getenv from distutils.command.build_ext import build_ext as _build_ext from distutils.command.install_lib import install_lib as _install_lib class build_ext(_build_ext): def finalize_options(self): _build_ext.finalize_optio...
gpl-2.0
KellyChan/python-examples
python/django/elf/elf/src/elf/urls.py
3
3517
from django.conf.urls import patterns, include, url from django.contrib import admin urlpatterns = patterns('', # Master: Index url(r'^$', 'master.views.IndexView', name='index'), url(r'^signup$', 'master.views.SignUpView', name='signup'), url(r'^login$', 'master.views.LoginView', name='login'),...
mit
rahushen/ansible
lib/ansible/modules/network/avi/avi_wafpolicy.py
26
5675
#!/usr/bin/python # # @author: Gaurav Rastogi (grastogi@avinetworks.com) # Eric Anderson (eanderson@avinetworks.com) # module_check: supported # # Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # ANSIB...
gpl-3.0
propublica/facebook-political-ads
backend/classifier/classifier/commands/entities.py
1
2373
""" Extract entities """ import json from bs4 import BeautifulSoup import click import spacy import en_core_web_sm from classifier.utilities import DB, entities_confs # from LAWhttps://spacy.io/usage/linguistic-features#section-named-entities LABELS = { 'PERSON': 'Person', 'NORP': 'Group', 'ORG': 'Organiz...
mit
davidwilson826/empty-app
HeadSoccer.py
1
14692
''' Head Soccer Author: David Wilson Credit: http://stackoverflow.com/questions/7370801/measure-time-elapsed-in-python, https://www.mathsisfun.com/hexadecimal-decimal-colors.html, http://brythonserver.github.io/ggame/ ''' from ggame import App, Sprite, CircleAsset, RectangleAsset, Color, LineStyle, TextAsset from tim...
mit
ssgeejr/mitropm
browser-ext/third_party/firefox-addon-sdk/python-lib/cuddlefish/tests/test_version.py
37
1044
# 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 os import unittest import shutil from cuddlefish._version import get_versions class Version(unittest.TestCase):...
gpl-3.0
celiafish/VisTrails
vistrails/gui/extras/core/__init__.py
58
1885
############################################################################### ## ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary for...
bsd-3-clause
tedsunnyday/SE-Server
server/lib/mongoengine/base/datastructures.py
9
5007
import weakref from mongoengine.common import _import_class __all__ = ("BaseDict", "BaseList") class BaseDict(dict): """A special dict so we can watch any changes """ _dereferenced = False _instance = None _name = None def __init__(self, dict_items, instance, name): Document = _impo...
apache-2.0
hundeboll/core
lib/oelite/arch.py
2
22674
import oebakery from oebakery import die, err, warn, info, debug import os import operator import bb # Handle all the arhicture related variables. # To be able to reuse definitions for both build, machine and sdk # architectures, the usual bitbake variables are not used, but a more # hierarchical setup using a number...
mit
gsbullmer/restaurant-menu-directory
menus/final_project.py
1
16044
from flask import Flask, render_template, url_for, request, redirect, flash, jsonify from sqlalchemy.sql import func app = Flask(__name__) # imports for CRUD Operations from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from database_setup import Restaurant, Base, MenuItem, User # imports f...
mit