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 |
|---|---|---|---|---|---|
batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/test/mapping_tests.py | 4 | 22268 | # tests common to dict and UserDict
import unittest
import collections
import sys
class BasicTestMappingProtocol(unittest.TestCase):
# This base class can be used to check that an object conforms to the
# mapping protocol
# Functions that can be useful to override to adapt to dictionary
# semantics
... | apache-2.0 |
Taapat/enigma2-openpli-fulan | lib/python/Components/HdmiCec.py | 1 | 14921 | import struct, os, time
from config import config, ConfigSelection, ConfigYesNo, ConfigSubsection, ConfigText
from enigma import eHdmiCEC, eActionMap
from Components.VolumeControl import VolumeControl
from Tools.StbHardware import getFPWasTimerWakeup
from enigma import eTimer
from Screens import Standby
from Tools impo... | gpl-2.0 |
mercycorps/TolaActivity | workflow/migrations/0026_auto_20190116_1357.py | 1 | 1071 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2019-01-16 21:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workflow', '0025_merge_20190116_1357'),
]
operations = [
migrations.AddFiel... | apache-2.0 |
heldergg/dre | lib/djapian/database.py | 5 | 1773 | import os
import xapian
from djapian.utils.decorators import reopen_if_modified
class Database(object):
def __init__(self, path):
self._path = path
def open(self, write=False):
"""
Opens database for manipulations
"""
if not os.path.exists(self._path):
os.m... | gpl-3.0 |
mrjacobagilbert/gnuradio | gr-utils/modtool/core/info.py | 6 | 5693 | #
# Copyright 2013, 2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
""" Returns information about a module """
import os
from ..tools import get_modname
from .base import ModTool, ModToolException
class ModToolInfo(ModTool):
""" Return in... | gpl-3.0 |
shrimpboyho/git.js | emscript/python/2.7.5.1_32bit/Lib/site-packages/win32/test/test_pywintypes.py | 15 | 3756 | import sys
import unittest
import pywintypes
import time
from pywin32_testutil import str2bytes, ob2memory
import datetime
import operator
class TestCase(unittest.TestCase):
def testPyTimeFormat(self):
struct_current = time.localtime()
pytime_current = pywintypes.Time(struct_current)
# try ... | gpl-2.0 |
bwrsandman/OpenUpgrade | addons/l10n_in_hr_payroll/wizard/__init__.py | 430 | 1110 | # -*- 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 |
zhuyue1314/CodeXt-ugly | LoadingBinaries/simplessl.py | 2 | 2342 | #!/usr/bin/env python
#https://docs.python.org/dev/library/ssl.html
import socket, ssl
def server():
bindsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
bindsocket.bind(('127.0.0.1', 10000))
bindsocket.listen(5)
print "Listening for a connection"
tls_serv = ssl.wrap_socket(bindsocket, ... | gpl-2.0 |
bbbenja/SickRage | lib/imdb/linguistics.py | 76 | 9353 | """
linguistics module (imdb package).
This module provides functions and data to handle in a smart way
languages and articles (in various languages) at the beginning of movie titles.
Copyright 2009-2012 Davide Alberani <da@erlug.linux.it>
2012 Alberto Malagoli <albemala AT gmail.com>
2009 H. Turg... | gpl-3.0 |
huzq/scikit-learn | sklearn/impute/tests/test_knn.py | 15 | 17366 | import numpy as np
import pytest
from sklearn import config_context
from sklearn.impute import KNNImputer
from sklearn.metrics.pairwise import nan_euclidean_distances
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.neighbors import KNeighborsRegressor
from sklearn.utils._testing import assert_allc... | bsd-3-clause |
bobeirasa/virtualenvs | pygeckozabbix/lib/python2.7/site-packages/setuptools/command/build_ext.py | 286 | 11854 | from distutils.command.build_ext import build_ext as _du_build_ext
try:
# Attempt to use Pyrex for building extensions, if available
from Pyrex.Distutils.build_ext import build_ext as _build_ext
except ImportError:
_build_ext = _du_build_ext
import os, sys
from distutils.file_util import copy_file
from set... | mit |
tinfoil/phantomjs | src/qt/qtbase/util/local_database/cldr2qlocalexml.py | 102 | 42691 | #!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of the test suite of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial License... | bsd-3-clause |
habeanf/Open-Knesset | agendas/listeners.py | 14 | 4868 | #encoding: utf-8
import datetime
from django.db.models.signals import post_save, pre_delete, post_delete
from django.contrib.contenttypes.models import ContentType
from planet.models import Feed, Post
from actstream import action
from actstream.models import Follow
from knesset.utils import cannonize, disable_for_loadd... | bsd-3-clause |
Chipe1/aima-python | tests/test_probabilistic_learning.py | 2 | 1122 | import random
import pytest
from learning import DataSet
from probabilistic_learning import *
random.seed("aima-python")
def test_naive_bayes():
iris = DataSet(name='iris')
# discrete
nbd = NaiveBayesLearner(iris, continuous=False)
assert nbd([5, 3, 1, 0.1]) == 'setosa'
assert nbd([6, 3, 4, 1.1... | mit |
yamahata/neutron | neutron/services/loadbalancer/agent_scheduler.py | 13 | 5191 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 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-2.0 |
mxOBS/deb-pkg_trusty_chromium-browser | ppapi/native_client/tools/browser_tester/browsertester/browserprocess.py | 126 | 2032 | #!/usr/bin/python
# 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.
import os
import signal
import subprocess
import time
class BrowserProcessBase(object):
def __init__(self, handle):
self.handle... | bsd-3-clause |
houssine78/vertical-travel-porting-v8-wip | __unported__/travel_passport/travel_passenger.py | 2 | 1291 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or m... | agpl-3.0 |
mckinsel/FastxIO | tests/test_fastq.py | 1 | 2141 | import os
import unittest
from . import TEST_DATA_DIR
from FastxIO import fastx
class TestFastq(unittest.TestCase):
def setUp(self):
self.fastq_file = os.path.join(TEST_DATA_DIR, "test.fastq")
self.gz_fastq_file = os.path.join(TEST_DATA_DIR, "test.fastq.gz")
self.windows_fastq_file = os.p... | mit |
galaxy001/libtorrent | BitTorrent-4.4.0/khashmir/util.py | 11 | 2217 | # The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software di... | mit |
ita1024/samba | third_party/waf/wafadmin/3rdparty/batched_cc.py | 32 | 4653 | #!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006 (ita)
"""
Batched builds - compile faster
instead of compiling object files one by one, c/c++ compilers are often able to compile at once:
cc -c ../file1.c ../file2.c ../file3.c
Files are output on the directory where the compiler is called, and dependencies... | gpl-3.0 |
TalShafir/ansible | lib/ansible/modules/cloud/google/gcp_container_node_pool.py | 8 | 32420 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | gpl-3.0 |
remidechazelles/mycroft-core | mycroft/tts/fa_tts.py | 7 | 2194 | # Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | gpl-3.0 |
smallyear/linuxLearn | salt/salt/modules/pecl.py | 1 | 3969 | # -*- coding: utf-8 -*-
'''
Manage PHP pecl extensions.
'''
from __future__ import absolute_import
# Import python libs
import re
import logging
try:
from shlex import quote as _cmd_quote # pylint: disable=E0611
except ImportError:
from pipes import quote as _cmd_quote
# Import salt libs
import salt.utils
... | apache-2.0 |
fzimmermann89/pyload | module/lib/beaker/crypto/pbkdf2.py | 43 | 11924 | #!/usr/bin/python
# -*- coding: ascii -*-
###########################################################################
# PBKDF2.py - PKCS#5 v2.0 Password-Based Key Derivation
#
# Copyright (C) 2007 Dwayne C. Litzenberger <dlitz@dlitz.net>
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this s... | gpl-3.0 |
angelapper/odoo | addons/survey/survey.py | 8 | 58353 | # -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp import SUPERUSER_ID
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT as DF
from openerp.addons.website.models.website impor... | agpl-3.0 |
erdincay/pyload | module/plugins/accounts/FileserveCom.py | 6 | 1743 | # -*- coding: utf-8 -*-
import time
from module.plugins.internal.Account import Account
from module.common.json_layer import json_loads
class FileserveCom(Account):
__name__ = "FileserveCom"
__type__ = "account"
__version__ = "0.22"
__status__ = "testing"
__description__ = """Fileserve.c... | gpl-3.0 |
nishad89/newfies-dialer | newfies/appointment/admin_filters.py | 4 | 1585 | #
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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/.
#
# Copyright (C) 2011-2014 Star2Billing S.L.
#
# The Initia... | mpl-2.0 |
nedn/pybitcoin | third_party/python-ecdsa/src/ecdsa/ellipticcurve.py | 1 | 5095 | #! /usr/bin/env python
#
# Implementation of elliptic curves, for cryptographic applications.
#
# This module doesn't provide any way to choose a random elliptic
# curve, nor to verify that an elliptic curve was chosen randomly,
# because one can simply use NIST's standard curves.
#
# Notes from X9.62-1998 (draft):
# ... | mit |
huchoi/edx-platform | cms/djangoapps/course_creators/tests/test_admin.py | 82 | 8130 | """
Tests course_creators.admin.py.
"""
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.admin.sites import AdminSite
from django.http import HttpRequest
import mock
from course_creators.admin import CourseCreatorAdmin
from course_creators.models import CourseCreator
fr... | agpl-3.0 |
klunwebale/odoo | addons/auth_openid/controllers/main.py | 382 | 10399 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2012 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 |
drwyrm/Flexget | flexget/plugins/sites/archetorrent.py | 1 | 1084 | from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger("archetorrent")
class UrlRewriteArchetorrent(object):
"""Archetorr... | mit |
cloud9ers/gurumate | environment/lib/python2.7/site-packages/nose/suite.py | 23 | 22234 | """
Test Suites
-----------
Provides a LazySuite, which is a suite whose test list is a generator
function, and ContextSuite,which can run fixtures (setup/teardown
functions or methods) for the context that contains its tests.
"""
from __future__ import generators
import logging
import sys
import unittest
from nose.... | lgpl-3.0 |
xlsdg/phantomjs-linux-armv7l | src/breakpad/src/tools/gyp/test/library/gyptest-shared.py | 430 | 2230 | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies simple build of a "Hello, world!" program with shared libraries,
including verifying that libraries are rebuilt correctly when ... | bsd-3-clause |
swdream/neutron | neutron/db/migration/alembic_migrations/versions/35a0f3365720_add_port_security_in_ml2.py | 47 | 2014 | # Copyright 2015 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 ... | apache-2.0 |
havt/odoo | addons/share/wizard/share_wizard.py | 182 | 51223 | # -*- 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 |
EnviroCentre/jython-upgrade | jython/lib/test/test_subprocess_jy.py | 2 | 4882 | """Misc subprocess tests"""
import unittest
import os
import sys
import signal
import time
from test import test_support
from subprocess import PIPE, Popen, _cmdline2list
class TerminationAndSignalTest(unittest.TestCase):
def setUp(self):
program = '''
import signal, sys
def print_signal(signum, frame):... | mit |
open-synergy/server-tools | auth_brute_force/models/res_banned_remote.py | 16 | 2544 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Tracks Authentication Attempts and Prevents Brute-force Attacks module
# Copyright (C) 2015-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This prog... | agpl-3.0 |
farhaanbukhsh/sympy | sympy/core/tests/test_containers.py | 49 | 5736 | from sympy import Matrix, Tuple, symbols, sympify, Basic, Dict, S, FiniteSet, Integer
from sympy.core.containers import tuple_wrapper
from sympy.utilities.pytest import raises
from sympy.core.compatibility import is_sequence, iterable, u, range
def test_Tuple():
t = (1, 2, 3, 4)
st = Tuple(*t)
assert set(... | bsd-3-clause |
neuromancer/ocean | src/Run.py | 1 | 2933 | # -- coding: utf-8 --
#from ptrace.debugger.child import createChild
from os import system, dup2, close, open as fopen, O_RDONLY
from sys import stdin
from os import (
fork, execv, execve, getpid,
close, dup2, devnull, O_RDONLY)
from ptrace.binding import ptrace_traceme
from ptrace import PtraceError
from re... | gpl-3.0 |
orekyuu/intellij-community | python/helpers/profiler/thrift/transport/TSSLSocket.py | 121 | 7717 | #
# 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 |
ericls/niji | niji/urls.py | 1 | 1889 | # -*- coding: utf-8 -*-
from django.conf.urls import url, include
from django.views.decorators.csrf import csrf_exempt
from rest_framework import routers
from . import api
from . import views
api_router = routers.DefaultRouter()
api_router.register(r'topics', api.TopicApiView)
api_router.register(r'post', api.PostApiV... | mit |
adityacs/ansible | lib/ansible/modules/network/avi/avi_sslkeyandcertificate.py | 8 | 5589 | #!/usr/bin/python
#
# Created on Aug 25, 2016
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 16.3.8
#
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the te... | gpl-3.0 |
spektom/incubator-airflow | tests/providers/amazon/aws/operators/test_sqs.py | 4 | 2353 | #
# 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... | apache-2.0 |
anaselli/dnfdragora | dnfdragora/compsicons.py | 1 | 3731 | import os.path
class CompsIcons:
'''
This class manages the access to group name and icons
'''
def __init__(self, rpm_groups, icon_path=None):
if icon_path:
self.icon_path = icon_path if icon_path.endswith("/") else icon_path + "/"
else:
self.icon_path = "/usr/s... | gpl-3.0 |
ubc/edx-ora2 | openassessment/assessment/models/ai.py | 5 | 30773 | """
Database models for AI assessment.
"""
from uuid import uuid4
import json
import logging
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.cache import cache, get_cache
from django.db import models, transaction, DatabaseError
from django.utils.timezone import now
from ... | agpl-3.0 |
TribeMedia/sky_engine | build/gyp_helper.py | 77 | 2220 | # 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.
# This file helps gyp_chromium and landmines correctly set up the gyp
# environment from chromium.gyp_env on disk
import os
SCRIPT_DIR = os.path.dirnam... | bsd-3-clause |
olivierdalang/QGIS | python/core/additions/validitycheck.py | 51 | 3120 | # -*- coding: utf-8 -*-
"""
***************************************************************************
validitycheck.py
---------------------
Date : January 2019
Copyright : (C) 2019 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
***************... | gpl-2.0 |
googleapis/python-asset | scripts/fixup_asset_v1p5beta1_keywords.py | 2 | 6005 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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 requi... | apache-2.0 |
sgerhart/ansible | lib/ansible/modules/network/nxos/nxos_ntp_auth.py | 61 | 9574 | #!/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 distribut... | mit |
pyblish/pyblish-endpoint | pyblish_endpoint/vendor/werkzeug/contrib/cache.py | 146 | 23519 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.cache
~~~~~~~~~~~~~~~~~~~~~~
The main problem with dynamic Web sites is, well, they're dynamic. Each
time a user requests a page, the webserver executes a lot of code, queries
the database, renders templates until the visitor gets the page he sees.
... | lgpl-3.0 |
lzw120/django | django/contrib/sessions/backends/cache.py | 89 | 2261 | from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import cache
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
def __init__(self, session_key=None):
self._cache = cache
s... | bsd-3-clause |
hetland/xray | xray/test/test_utils.py | 2 | 4438 | import numpy as np
import pandas as pd
from xray.core import ops, utils
from xray.core.pycompat import OrderedDict
from . import TestCase
class TestSafeCastToIndex(TestCase):
def test(self):
dates = pd.date_range('2000-01-01', periods=10)
x = np.arange(5)
td = x * np.timedelta64(1, 'D')
... | apache-2.0 |
varunarya10/nova_test_latest | nova/api/openstack/compute/schemas/v3/volumes.py | 51 | 2842 | # Copyright 2014 IBM 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 required ... | apache-2.0 |
DavidGuben/rcbplayspokemon | app/pywin32-220/com/win32com/storagecon.py | 25 | 3082 | """Constants related to IStorage and related interfaces
This file was generated by h2py from d:\msdev\include\objbase.h
then hand edited, a few extra constants added, etc.
"""
STGC_DEFAULT = 0
STGC_OVERWRITE = 1
STGC_ONLYIFCURRENT = 2
STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4
STGC_CONSOLIDATE = 8
S... | mit |
gangadharkadam/letzerp | erpnext/hr/doctype/salary_slip/test_salary_slip.py | 3 | 3968 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import unittest
import frappe
from frappe.utils import today
from erpnext.hr.doctype.employee.employee import make_salary_structure
from erpnext.hr.doctype.salary_structure.salary_structure... | agpl-3.0 |
BorisJeremic/Real-ESSI-Examples | analytic_solution/test_cases/4NodeANDES/cantilever_irregular_element_with_divisions/shape3/NumberOfDivision4/horizontal_load/compare_txt.py | 637 | 2094 | #!/usr/bin/python
import h5py
import sys
import numpy as np
import os
import re
import random
# find the path to my own python function:
cur_dir=os.getcwd()
sep='test_cases'
test_DIR=cur_dir.split(sep,1)[0]
scriptDIR=test_DIR+'compare_function'
sys.path.append(scriptDIR)
# import my own function for color and comparat... | cc0-1.0 |
docker-infra/ansible-modules-core | files/template.py | 8 | 2670 | # this is a virtual module that is entirely implemented server side
DOCUMENTATION = '''
---
module: template
version_added: historical
short_description: Templates a file out to a remote server.
description:
- Templates are processed by the Jinja2 templating language
(U(http://jinja.pocoo.org/docs/)) - doc... | gpl-3.0 |
kamyu104/django | tests/m2m_signals/tests.py | 271 | 15982 | """
Testing signals emitted on changing m2m relations.
"""
from django.db import models
from django.test import TestCase
from .models import Car, Part, Person, SportsCar
class ManyToManySignalsTest(TestCase):
def m2m_changed_signal_receiver(self, signal, sender, **kwargs):
message = {
'insta... | bsd-3-clause |
cobrab11/blacksmith-2 | expansions/muc/code.py | 3 | 11539 | # coding: utf-8
# BlackSmith mark.2
# exp_name = "muc" # /code.py v.x9
# Id: 05~5c
# Code © (2009-2012) by WitcherGeralt [alkorgun@gmail.com]
class expansion_temp(expansion):
def __init__(self, name):
expansion.__init__(self, name)
def command_subject(self, stype, source, body, disp):
if Chats.has_key(sour... | apache-2.0 |
nhtera/github.io | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-3.3/pygments/lexers/_scilab_builtins.py | 364 | 31261 | # -*- coding: utf-8 -*-
"""
pygments.lexers._scilab_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Builtin list for the ScilabLexer.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# These lists are generated automatically.
# Run the follo... | mit |
DreamLiMu/ML_Python | les5/logRegres.py | 1 | 4070 | #-*-coding:utf-8-*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from numpy import *
def loadDataSet():
dataMat = []; labelMat = []
fr = open('testSet.txt')
for line in fr.readlines():
lineArr = line.strip().split()
dataMat.append([1.0,float(lineArr[0]),float(lineArr[1])])
... | gpl-2.0 |
patrikpettersson/rest-engine | lib/werkzeug/contrib/fixers.py | 87 | 9071 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.fixers
~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.5
This module includes various helpers that fix bugs in web servers. They may
be necessary for some versions of a buggy web server but not others. We try
to stay updated with the status of the bug... | mit |
sobercoder/gem5 | util/style/verifiers.py | 10 | 16542 | #!/usr/bin/env python2
#
# Copyright (c) 2014, 2016 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implem... | bsd-3-clause |
glmcdona/meddle | examples/base/Lib/email/mime/message.py | 573 | 1286 | # Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Class representing message/* MIME documents."""
__all__ = ['MIMEMessage']
from email import message
from email.mime.nonmultipart import MIMENonMultipart
class MIMEMessage(MIMENonMultipart):
"""Class... | mit |
davits/ycmd | ycmd/tests/go/diagnostics_test.py | 4 | 4392 | # Copyright (C) 2020 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd... | gpl-3.0 |
ravencoin/raven | contrib/testgen/gen_base58_test_vectors.py | 1064 | 4344 | #!/usr/bin/env python
'''
Generate valid and invalid base58 address and private key test vectors.
Usage:
gen_base58_test_vectors.py valid 50 > ../../src/test/data/base58_keys_valid.json
gen_base58_test_vectors.py invalid 50 > ../../src/test/data/base58_keys_invalid.json
'''
# 2012 Wladimir J. van der Laan
# R... | mit |
mheap/ansible | lib/ansible/modules/network/meraki/meraki_organization.py | 3 | 7828 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Kevin Breit (@kbreit) <kevin.breit@kevinbreit.net>
# 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 = {
... | gpl-3.0 |
LyonsLab/coge | bin/last_wrapper/Bio/SeqUtils/__init__.py | 3 | 11238 | #!/usr/bin/env python
# Created: Wed May 29 08:07:18 2002
# thomas@cbs.dtu.dk, Cecilia.Alsmark@ebc.uu.se
# Copyright 2001 by Thomas Sicheritz-Ponten and Cecilia Alsmark.
# All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have ... | bsd-2-clause |
polaris-gslb/polaris-core | polaris_common/topology.py | 2 | 2452 | # -*- coding: utf-8 -*-
import ipaddress
__all__ = [
'config_to_map',
'get_region'
]
def config_to_map(topology_config):
"""
args:
topology_config: dict
{
'region1': [
'10.1.1.0/24',
'10.1.10.0/24',
'172.1... | bsd-3-clause |
40223102/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/site-packages/pygame/constants.py | 603 | 15297 | #!/usr/bin/env python
'''Constants defined by SDL, and needed in pygame.
Note that many of the flags for SDL are not needed in pygame, and are not
included here. These constants are generally accessed from the
`pygame.locals` module. This module is automatically placed in the pygame
namespace, but you will usually ... | gpl-3.0 |
DengueTim/linux-rockchip | tools/perf/scripts/python/futex-contention.py | 1997 | 1508 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
fhe-odoo/odoo | addons/l10n_multilang/l10n_multilang.py | 378 | 8428 | # -*- 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 |
mitmproxy/mitmproxy | test/mitmproxy/proxy/layers/http/test_http_version_interop.py | 2 | 4584 | from typing import Tuple
import h2.config
import h2.connection
import h2.events
from mitmproxy.http import HTTPFlow
from mitmproxy.proxy.context import Context
from mitmproxy.proxy.layers.http import HTTPMode
from mitmproxy.proxy.commands import CloseConnection, OpenConnection, SendData
from mitmproxy.connection impo... | mit |
boudewijnrempt/breakpad | src/tools/gyp/pylib/gyp/sun_tool.py | 314 | 1569 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""These functions are executed via gyp-sun-tool when using the Makefile
generator."""
import fcntl
import os
import struct
import subproces... | bsd-3-clause |
hbrunn/OCB | addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py | 337 | 3000 | # -*- 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 |
wrouesnel/ansible | test/integration/targets/module_precedence/multiple_roles/bar/library/ping.py | 160 | 2146 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.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... | gpl-3.0 |
poldrack/myconnectome | myconnectome/openfmri/washu_fieldmap.py | 2 | 1085 | import json,glob,os
import dicom
outdir='/scratch/01329/poldrack/selftracking/ds031/sub00001/ses105/fieldmap'
washubase='/scratch/01329/poldrack/selftracking/washu'
basedirs=['vc39556','vc39556_2']
fmseries=[[5,10,21],[5,17]]
ctr=1
for i in range(2):
basedir=os.path.join(washubase,basedirs[i])
for j in range(... | mit |
GenericMappingTools/gmt-python | pygmt/tests/test_rose.py | 1 | 5398 | """
Tests for rose.
"""
import numpy as np
import pytest
from pygmt import Figure
from pygmt.datasets import load_fractures_compilation
@pytest.fixture(scope="module", name="data")
def fixture_data():
"""
Load the sample numpy array data.
"""
return np.array(
[[40, 60], [60, 300], [20, 180], [... | bsd-3-clause |
SomethingExplosive/android_external_chromium_org | media/tools/layout_tests/layouttests.py | 144 | 8952 | # 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.
"""Layout tests module that is necessary for the layout analyzer.
Layout tests are stored in an SVN repository and LayoutTestCaseManager collects
these ... | bsd-3-clause |
ibmsoe/tensorflow | tensorflow/python/saved_model/signature_constants.py | 119 | 2635 | # 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 |
ennoborg/gramps | gramps/gui/views/treemodels/peoplemodel.py | 1 | 23073 | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2009-2010 Nick Hall
# Copyright (C) 2009 Benny Malengier
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the G... | gpl-2.0 |
idlead/scikit-learn | sklearn/decomposition/fastica_.py | 54 | 18240 | """
Python implementation of the fast ICA algorithms.
Reference: Tables 8.3 and 8.4 page 196 in the book:
Independent Component Analysis, by Hyvarinen et al.
"""
# Authors: Pierre Lafaye de Micheaux, Stefan van der Walt, Gael Varoquaux,
# Bertrand Thirion, Alexandre Gramfort, Denis A. Engemann
# License: BS... | bsd-3-clause |
prune998/ansible | lib/ansible/modules/cloud/softlayer/sl_vm.py | 27 | 12051 | #!/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 |
petewarden/tensorflow | tensorflow/python/tf_program/mlir_gen.py | 9 | 17226 | # Copyright 2020 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 |
dgarnier/pyms | Utils/__init__.py | 7 | 1571 | """
Utility functions for PyMS wide use
"""
#############################################################################
# #
# PyMS software for processing of metabolomic mass-spectrometry data #
# Copyright (C) 2005-2012 V... | gpl-2.0 |
Salat-Cx65/python-for-android | python3-alpha/python3-src/Lib/test/test_tempfile.py | 46 | 35200 | # tempfile.py unit tests.
import tempfile
import os
import sys
import re
import warnings
import unittest
from test import support
if hasattr(os, 'stat'):
import stat
has_stat = 1
else:
has_stat = 0
has_textmode = (tempfile._text_openflags != tempfile._bin_openflags)
has_spawnl = hasattr(os, 'spawnl')
#... | apache-2.0 |
guewen/odoo | addons/l10n_gt/__init__.py | 411 | 1113 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2009-2010 Soluciones Tecnologócias Prisma S.A. All Rights Reserved.
# José Rodrigo Fernández Menegazzo, Soluciones Tecnologócias Prisma S.A.
# (http://www.solucionesprisma.com)
#
# This prog... | agpl-3.0 |
jenalgit/django | tests/foreign_object/models.py | 73 | 5770 | import datetime
from django.db import models
from django.db.models.fields.related import \
ReverseSingleRelatedObjectDescriptor
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import get_language
@python_2_unicode_compatible
class Country(models.Model):
# Table Col... | bsd-3-clause |
Lekanich/intellij-community | python/helpers/docutils/parsers/rst/languages/fr.py | 57 | 3577 | # $Id: fr.py 4564 2006-05-21 20:44:42Z wiemann $
# Authors: David Goodger <goodger@python.org>; William Dode
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must ... | apache-2.0 |
ddrmanxbxfr/servo | tests/wpt/css-tests/tools/manifest/utils.py | 115 | 1374 | import platform
import os
from six import BytesIO
def rel_path_to_url(rel_path, url_base="/"):
assert not os.path.isabs(rel_path)
if url_base[0] != "/":
url_base = "/" + url_base
if url_base[-1] != "/":
url_base += "/"
return url_base + rel_path.replace(os.sep, "/")
def from_os_path(... | mpl-2.0 |
atruberg/django-custom | setup.py | 48 | 4563 | import os
import sys
from distutils.core import setup
from distutils.sysconfig import get_python_lib
# Warn if we are installing over top of an existing installation. This can
# cause issues where files that were deleted from a more recent Django are
# still present in site-packages. See #18115.
overlay_warning = Fal... | bsd-3-clause |
ecular/qemu_seamless | scripts/tracetool/backend/simple.py | 57 | 3099 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple built-in backend.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
__em... | gpl-2.0 |
JTCCOIN/jtccoin | share/qt/make_spinner.py | 4415 | 1035 | #!/usr/bin/env python
# W.J. van der Laan, 2011
# Make spinning .mng animation from a .png
# Requires imagemagick 6.7+
from __future__ import division
from os import path
from PIL import Image
from subprocess import Popen
SRC='img/reload_scaled.png'
DST='../../src/qt/res/movies/update_spinner.mng'
TMPDIR='/tmp'
TMPNAM... | mit |
jopham/gothub | web/main.py | 2 | 5461 | import web
import logging
#import model
#import markdown
import pymongo
from pymongo.code import Code
import re
from pymongo.objectid import ObjectId
import json
from datetime import datetime
from sets import Set
from collections import defaultdict
logging.basicConfig(level=logging.INFO)
conn = pymongo.Connection()
db... | mit |
mgyenik/micropython | tests/misc/features.py | 87 | 1952 | # mad.py
# Alf Clement 27-Mar-2014
#
zero=0
three=3
print("1")
print("2")
print(three)
print("{}".format(4))
five=25//5
print(int(five))
j=0
for i in range(4):
j += i
print(j)
print(3+4)
try:
a=4//zero
except:
print(8)
print("xxxxxxxxx".count("x"))
def ten():
return 10
print(ten())
a=[]
for i in range(13):
a.appen... | mit |
modulexcite/letsencrypt | acme/acme/crypto_util.py | 27 | 7056 | """Crypto utilities."""
import contextlib
import logging
import socket
import sys
from six.moves import range # pylint: disable=import-error,redefined-builtin
import OpenSSL
from acme import errors
logger = logging.getLogger(__name__)
# DVSNI certificate serving and probing is not affected by SSL
# vulnerabiliti... | apache-2.0 |
CiscoSystems/neutron | neutron/tests/unit/testlib_plugin.py | 8 | 2641 | # Copyright 2014 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | apache-2.0 |
vnsofthe/odoo-dev | openerp/addons/base/tests/test_orm.py | 149 | 18110 | from collections import defaultdict
from openerp.tools import mute_logger
from openerp.tests import common
UID = common.ADMIN_USER_ID
class TestORM(common.TransactionCase):
""" test special behaviors of ORM CRUD functions
TODO: use real Exceptions types instead of Exception """
def setUp(self):... | agpl-3.0 |
calvingit21/h2o-2 | py/testdir_single_jvm/notest_exec2_empty_result.py | 9 | 1382 | import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_browse as h2b, h2o_exec as h2e, h2o_import as h2i, h2o_cmd
initList = [
('r', 'r=i.hex'),
]
exprList = [
"a=c(1,2,3); a = r[r[,1]>2,]",
"a=c(1,2,3); a = r[r[,1]>10,]",
]
class Basic(unittest.TestCa... | apache-2.0 |
ltilve/ChromiumGStreamerBackend | chrome/tools/build/win/syzygy/instrument.py | 28 | 5680 | #!/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.
"""A utility script to help building Syzygy-instrumented Chrome binaries."""
import glob
import logging
import optparse
import os
... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.