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 |
|---|---|---|---|---|---|
was4444/chromium.src | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/_stream_hybi.py | 628 | 31933 | # Copyright 2012, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | bsd-3-clause |
bgris/ODL_bgris | lib/python3.5/site-packages/future/backports/email/_parseaddr.py | 82 | 17389 | # Copyright (C) 2002-2007 Python Software Foundation
# Contact: email-sig@python.org
"""Email address parsing code.
Lifted directly from rfc822.py. This should eventually be rewritten.
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ i... | gpl-3.0 |
sikmir/QGIS | tests/src/python/test_qgslocator.py | 3 | 16200 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLocator.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__auth... | gpl-2.0 |
helixyte/everest | everest/repositories/filesystem/repository.py | 1 | 3673 | """
File system repository.
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Jan 7, 2013.
"""
from everest.mime import CsvMime
from everest.repositories.memory.repository import MemoryRepository
from everest.repositories.memory.repositor... | mit |
hzlf/openbroadcast | website/apps/__rework_in_progress/importer/migrations/0003_auto__add_importfile.py | 2 | 7260 | # -*- 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 model 'ImportFile'
db.create_table('importer_importfile', (
('id', self.gf('django.db.m... | gpl-3.0 |
mancoast/CPythonPyc_test | cpython/211_test_fork1.py | 15 | 1688 | """This test checks for correct fork() behavior.
We want fork1() semantics -- only the forking thread survives in the
child after a fork().
On some systems (e.g. Solaris without posix threads) we find that all
active threads survive in the child after a fork(); this is an error.
While BeOS doesn't officially support... | gpl-3.0 |
llooker/python_sdk | test/test_render_task_api.py | 1 | 3241 | # coding: utf-8
"""
Looker API 3.0 Reference
### Authorization The Looker API uses Looker **API3** credentials for authorization and access control. Looker admins can create API3 credentials on Looker's **Admin/Users** page. Pass API3 credentials to the **/login** endpoint to obtain a temporary access_token.... | mit |
AndrewSallans/osf.io | framework/mongo/handlers.py | 1 | 2660 | # -*- coding: utf-8 -*-
import logging
from flask import g
from pymongo import MongoClient
from werkzeug.local import LocalProxy
from website import settings
logger = logging.getLogger(__name__)
def get_mongo_client():
"""Create MongoDB client and authenticate database.
"""
mongo_uri = 'mongodb://loca... | apache-2.0 |
js0701/chromium-crosswalk | tools/cr/cr/commands/shell.py | 103 | 1724 | # 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.
"""A module for the shell command."""
import os
import tempfile
import cr
class ShellCommand(cr.Command):
"""The implementation of the shell command.
... | bsd-3-clause |
emergebtc/muddery | templates/example/server/conf/connection_screens.py | 1 | 1277 | # -*- coding: utf-8 -*-
"""
Connection screen
Texts in this module will be shown to the user at login-time.
Muddery will look at global string variables (variables defined
at the "outermost" scope of this module and use it as the
connection screen. If there are more than one, Muddery will
randomize which one it displ... | bsd-3-clause |
blueboxgroup/nova | nova/api/openstack/compute/plugins/v3/pause_server.py | 12 | 3487 | # Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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 |
lupyuen/RaspberryPiImage | home/pi/GrovePi/Software/Python/others/temboo/Library/Amazon/IAM/PutUserPolicy.py | 5 | 4374 | # -*- coding: utf-8 -*-
###############################################################################
#
# PutUserPolicy
# Adds or updates a policy document associated with a specified user.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Lice... | apache-2.0 |
jcpowermac/ansible | lib/ansible/plugins/callback/dense.py | 38 | 17316 | # (c) 2016, Dag Wieers <dag@wieers.com>
# (c) 2017 Ansible Project
# 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 = '''
callback: dense
type: stdout
short_des... | gpl-3.0 |
arael120/App-Beicor | node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py | 1382 | 30567 | # Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This script is intended for use as a GYP_GENERATOR. It takes as input (by way of
the generator flag config_path) the path of a json file that dictates the file... | gpl-3.0 |
xubenben/scikit-learn | sklearn/cluster/affinity_propagation_.py | 224 | 10733 | """ Algorithms for clustering : Meanshift, Affinity propagation and spectral
clustering.
"""
# Author: Alexandre Gramfort alexandre.gramfort@inria.fr
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import a... | bsd-3-clause |
KurtDeGreeff/infernal-twin | build/pip/build/lib.linux-i686-2.7/pip/_vendor/html5lib/treewalkers/dom.py | 505 | 1421 | from __future__ import absolute_import, division, unicode_literals
from xml.dom import Node
from . import _base
class TreeWalker(_base.NonRecursiveTreeWalker):
def getNodeDetails(self, node):
if node.nodeType == Node.DOCUMENT_TYPE_NODE:
return _base.DOCTYPE, node.name, node.publicId, node.sy... | gpl-3.0 |
annarev/tensorflow | tensorflow/python/debug/wrappers/local_cli_wrapper.py | 14 | 24606 | # 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 |
miselin/grpc | src/python/grpcio/tests/_result.py | 20 | 16552 | # Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | bsd-3-clause |
pudo-attic/voteit-server | voteit/manage.py | 2 | 1824 | import json
from flask.ext.script import Manager
from voteit.core import db, issues
from voteit.web import app
from voteit.loader import load_motions
from voteit.loader import load_parties, load_people
manager = Manager(app)
@manager.command
def loadfile(file_name):
""" Load motions from a JSON file. """
... | mit |
toshywoshy/ansible | lib/ansible/modules/network/fortios/fortios_router_bfd.py | 7 | 8944 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | gpl-3.0 |
bcharlas/mytrunk | py/ymport.py | 2 | 17854 | """
Import geometry from various formats ('import' is python keyword, hence the name 'ymport').
"""
from yade.wrapper import *
from yade import utils
from minieigen import *
def textExt(fileName,format='x_y_z_r',shift=Vector3.Zero,scale=1.0,attrs=[],**kw):
"""Load sphere coordinates from file in specific format, r... | gpl-2.0 |
John-Hart/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/operations/byte.py | 2 | 8615 | # 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 |
stgraber/snapcraft | snapcraft/plugins/make.py | 2 | 3995 | # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015, 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in... | gpl-3.0 |
Jgarcia-IAS/localizacion | openerp/addons/stock/report/__init__.py | 376 | 1088 | # -*- 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 |
CallaJun/hackprince | bp_includes/forms.py | 20 | 5263 | """
Created on June 10, 2012
@author: peta15
"""
from wtforms import fields
from wtforms import Form
from wtforms import validators
from bp_includes.lib import utils
from webapp2_extras.i18n import lazy_gettext as _
from webapp2_extras.i18n import ngettext, gettext
FIELD_MAXLENGTH = 50 # intended to stop maliciously ... | lgpl-3.0 |
elboby/flask-config-override | flask_config_override/__init__.py | 1 | 1884 | from flask import request
import logging
from .proxy_config import ProxyConfig
from .cookie_utils import cookie_to_json
from .blueprint import blueprint as config_override_bp
logger = logging.getLogger(__name__)
class ConfigOverride(object):
"""
Flask extension used to control the config override mechanism... | bsd-3-clause |
mapennell/ansible | lib/ansible/utils/color.py | 167 | 3134 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | gpl-3.0 |
ProjectSWGCore/NGECore2 | scripts/mobiles/corellia/selonian_separatist_general.py | 2 | 3086 | 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... | lgpl-3.0 |
Pointedstick/ReplicatorG | skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/analyze_plugins/export_canvas_plugins/scalable_vector_graphics.py | 6 | 6965 | """
This page is in the table of contents.
Scalable vector graphics is an export canvas plugin to export the canvas to a scalable vector graphics (.svg) file.
When the export menu item in the file menu in an analyze viewer tool, like skeinlayer or skeiniso is clicked, the postscript dialog will be displayed. When the... | gpl-2.0 |
SucharithaPrabhakar/leosatellite | utils/tests/test-test.py | 77 | 4843 | #! /usr/bin/env python
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2014 Siddharth Santurkar
#
# 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 Softw... | gpl-2.0 |
abhinavdangeti/ep-engine | management/mc_bin_server.py | 11 | 13932 | #!/usr/bin/env python
"""
A memcached test server.
Copyright (c) 2007 Dustin Sallings <dustin@spy.net>
"""
import asyncore
import random
import string
import socket
import struct
import time
import hmac
import heapq
import memcacheConstants
from memcacheConstants import MIN_RECV_PACKET, REQ_PKT_FMT, RES_PKT_FMT
fr... | apache-2.0 |
lukauskas/means | src/means/tests/test_eq_mixed_moments.py | 2 | 1938 | import unittest
import sympy
from means.approximation.mea.eq_mixed_moments import DBetaOverDtCalculator
from means.core import Moment
from means.util.sympyhelpers import to_sympy_matrix, assert_sympy_expressions_equal
class TestEqMixedMoments(unittest.TestCase):
def test_for_p53(self):
"""
Give... | mit |
mnick/10c | tenc/__init__.py | 1 | 1626 | from _tenc import TZArchive
from _tenc import MAP_ORDER as MAP
available_parsers = dict()
available_serializers = dict()
# -- Convenience Functions --
def entities_index(archive_path, prefix=None, fprune=None):
elements = __extract_index(archive_path, TZArchive.ENTITIES_FOUT, prefix)
return __prune_elements(e... | gpl-3.0 |
nischal2002/m-quiz-2016 | classFour.py | 1 | 2882 | import random # This allows you to generate random numbers
import os # This module is used to check if we are running on pi
import quizEngine
if (os.uname().nodename == 'raspberrypi'):
from ledControl import greenLedOn
from ledControl import redLedOn
from ledControl import redLedBuzzerOn
else:
from le... | mit |
stuart-knock/tvb-framework | tvb/core/removers_factory.py | 2 | 2172 | # -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... | gpl-2.0 |
Jgarcia-IAS/localizacion | openerp/addons/crm_claim/report/__init__.py | 446 | 1080 | # -*- 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 |
TeamHG-Memex/frontera | frontera/tests/test_revisiting_backend.py | 1 | 1723 | # -*- coding: utf-8 -*-
from frontera.tests.backends import BackendSequenceTest, TEST_SITES
from frontera.utils.tester import FrontierTester
from datetime import timedelta
import pytest
from time import sleep
class RevisitingFrontierTester(FrontierTester):
def run(self, add_all_pages=False):
if not self.... | bsd-3-clause |
lnielsen/invenio | invenio/legacy/bibsword/client_templates.py | 37 | 41746 | # -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your optio... | gpl-2.0 |
cernops/nova | nova/tests/functional/api_sample_tests/test_admin_actions.py | 26 | 2398 | # Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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 |
pfctdayelise/pytest | src/_pytest/mark/__init__.py | 2 | 5320 | """ generic mechanism for marking and selecting python functions. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .legacy import matchkeyword
from .legacy import matchmark
from .structures import EMPTY_PARAMETERSET_OPTION
from .structures import get... | mit |
js0701/chromium-crosswalk | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/diff_parser_unittest.py | 28 | 8092 | # Copyright (C) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | bsd-3-clause |
benjaoming/lcrs | lcrs/master/plugins/__init__.py | 2 | 1972 | #
# LCRS Copyright (C) 2009-2012
# - Benjamin Bach
#
# LCRS 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.
#
# LCRS is distributed in ... | gpl-3.0 |
rshum19/crazyflie-clients-python-matlab | lib/cfclient/utils/config.py | 5 | 3404 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | gpl-2.0 |
minhphung171093/GreenERP | openerp/service/report.py | 56 | 5118 | # -*- coding: utf-8 -*-
import base64
import logging
import sys
import threading
import openerp
import openerp.report
from openerp import tools
from openerp.exceptions import UserError
import security
_logger = logging.getLogger(__name__)
# TODO: set a maximum report number per user to avoid DOS attacks
#
# Report... | gpl-3.0 |
weihautin/anki | anki/utils.py | 20 | 11729 | # -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from __future__ import division
import re
import os
import random
import time
import math
import htmlentitydefs
import subprocess
import tempfile
import shutil
import string... | agpl-3.0 |
afloren/nipype | nipype/interfaces/fsl/preprocess.py | 2 | 75800 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The fsl module provides classes for interfacing with the `FSL
<http://www.fmrib.ox.ac.uk/fsl/index.html>`_ command line tools. This
was written to work with FSL version 4.1.4.
Change directory to p... | bsd-3-clause |
lovewinds/story-project | external/scripts/packages/pugixml/ios.py | 1 | 3515 | #!/usr/bin/env python3
import os
from shutil import copytree, copy2
from pathlib import Path
from scripts.build_env import BuildEnv, Platform
from scripts.platform_builder import PlatformBuilder
class pugixmliOSBuilder(PlatformBuilder):
def __init__(self,
config_package: dict=None,
... | gpl-2.0 |
zp312/gmmreg | Python/_plotting.py | 14 | 2435 | #!/usr/bin/env python
#coding=utf-8
##====================================================
## $Author$
## $Date$
## $Revision$
##====================================================
from pylab import *
from configobj import ConfigObj
import matplotlib.pyplot as plt
def display2Dpointset(A):
fig = plt.figure()
... | gpl-3.0 |
aduggan/rpi-linux | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 12980 | 5411 | # SchedGui.py - Python extension for perf script, basic GUI code for
# traces drawing and overview.
#
# Copyright (C) 2010 by Frederic Weisbecker <fweisbec@gmail.com>
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
... | gpl-2.0 |
MobileWebApps/backend-python-rest-gae | lib/markdown/extensions/meta.py | 19 | 2761 | """
Meta Data Extension for Python-Markdown
=======================================
This extension adds Meta Data handling to markdown.
Basic Usage:
>>> import markdown
>>> text = '''Title: A Test Doc.
... Author: Waylan Limberg
... John Doe
... Blank_Data:
...
... The body. This ... | bsd-3-clause |
dchaplinsky/pep.org.ua | pepdb/tasks/management/commands/apply_adhoc_corrupt.py | 1 | 2423 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from time import sleep
from django.core.management.base import BaseCommand
from django.conf import settings
from django.utils.translation import activate
from dateutil.parser import parse as dt_parse
import tqdm
from elasticsearch_dsl import Q
from core.... | mit |
rizumu/django | tests/postgres_tests/models.py | 231 | 3562 | from django.db import connection, models
from .fields import (
ArrayField, BigIntegerRangeField, DateRangeField, DateTimeRangeField,
FloatRangeField, HStoreField, IntegerRangeField, JSONField,
)
class PostgreSQLModel(models.Model):
class Meta:
abstract = True
required_db_vendor = 'postgre... | bsd-3-clause |
enddo/smod | System/Lib/scapy/contrib/skinny.py | 10 | 18357 | #! /usr/bin/env python
# scapy.contrib.description = Skinny Call Control Protocol (SCCP)
# scapy.contrib.status = loads
#############################################################################
## ##
## scapy-skinny.py --- Skinny Call Contro... | gpl-2.0 |
bakhtout/odoo-educ | addons/base_setup/base_setup.py | 382 | 5430 | # -*- 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 |
yk5/incubator-airflow | tests/utils.py | 15 | 3597 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
neno1978/pelisalacarta | python/main-classic/servers/decrypters/linkbucks.py | 2 | 1911 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para linkbucks
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# ------------------------------------------------------------
import urllib
from core import logger
from core import ... | gpl-3.0 |
datagovuk/ckanext-issues | ckanext/issues/tests/controllers/test_search.py | 2 | 6940 | from ckan.plugins import toolkit
try:
from ckan.tests import helpers
from ckan.tests import factories
except ImportError:
from ckan.new_tests import helpers
from ckan.new_tests import factories
from ckanext.issues.tests import factories as issue_factories
from ckanext.issues import model as issue_model... | mit |
Dunkas12/BeepBoopBot | lib/youtube_dl/extractor/clipfish.py | 17 | 2371 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
unified_strdate,
)
class ClipfishIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?clipfish\.de/(?:[^/]+/)+video/(?P<id>[0-9]+)'
_TEST = {
'url': 'http://www.clipfis... | gpl-3.0 |
lorehov/mongolock | src/test_mongolock.py | 1 | 3268 | from datetime import datetime, timedelta
import pytest
from pymongo import MongoClient
from mongolock import MongoLock, MongoLockLocked, MongoLockException
connection = MongoClient()
db_name = 'mongolock_test'
col_name = 'locks'
@pytest.fixture()
def lock():
connection[db_name][col_name].remove()
return M... | bsd-2-clause |
choderalab/density | src/density_sim.py | 1 | 8797 | import simtk.openmm.app as app
import simtk.openmm as mm
import simtk.unit as u
from sys import stdout
import sys
import gaff2xml
from gaff2xml.utils import run_antechamber
from gaff2xml.utils import create_ffxml_file
from gaff2xml.utils import convert_molecule
import mdtraj as md
import numpy as np
import simtk.openmm... | gpl-2.0 |
cuongnv23/ansible | lib/ansible/module_utils/bigswitch_utils.py | 187 | 3354 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
gannetson/django | tests/postgres_tests/test_array.py | 6 | 17940 | import decimal
import json
import unittest
import uuid
from django import forms
from django.core import exceptions, serializers, validators
from django.core.management import call_command
from django.db import IntegrityError, connection, models
from django.test import TransactionTestCase, override_settings
from django... | bsd-3-clause |
hellfish2/collective.generic.webbuilder | bootstrap.py | 38 | 10649 | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | bsd-3-clause |
t123/ReadingTool.Python | lib/models/model.py | 1 | 11459 | import bz2, re
from lib.stringutil import StringUtil
class TermState:
Invalid, Known, Unknown, Ignored, NotSeen = range(5)
@staticmethod
def ToString(state):
if state==0:
return "Invalid"
elif state==1:
return "Known"
elif state==2:
return "U... | agpl-3.0 |
paweljasinski/ironpython3 | Src/StdLib/Lib/encodings/iso8859_11.py | 272 | 12335 | """ Python Character Mapping Codec iso8859_11 generated from 'MAPPINGS/ISO8859/8859-11.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,input,errors... | apache-2.0 |
caalle/Python-koans | python 2/koans/about_monkey_patching.py | 6 | 1383 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Related to AboutOpenClasses in the Ruby Koans
#
from runner.koan import *
class AboutMonkeyPatching(Koan):
class Dog(object):
def bark(self):
return "WOOF"
def test_as_defined_dogs_do_bark(self):
fido = self.Dog()
self... | mit |
rowinggolfer/openmolar2 | src/lib_openmolar/admin/db_orm/admin_address_link.py | 1 | 3669 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
## ##
## Copyright 2010-2012, Neil Wallace <neil@openmolar.com> ##
## ... | gpl-3.0 |
p0cisk/Quantum-GIS | python/plugins/processing/algs/lidar/lastools/lassort.py | 5 | 2699 | # -*- coding: utf-8 -*-
"""
***************************************************************************
lassort.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
*****************... | gpl-2.0 |
gurneyalex/odoo | addons/stock_account/models/stock_valuation_layer.py | 3 | 2175 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, tools
class StockValuationLayer(models.Model):
"""Stock Valuation Layer"""
_name = 'stock.valuation.layer'
_description = 'Stock Valuation Layer'
_order = 'create_date,... | agpl-3.0 |
kevinsawicki/node-gyp | gyp/test/gyp-defines/gyptest-regyp.py | 73 | 1284 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that when the same value is repeated for a gyp define, duplicates are
stripped from the regeneration rule.
"""
import os
impor... | mit |
dob71/x2swn | skeinforge/fabmetheus_utilities/geometry/geometry_utilities/evaluate_elements/setting.py | 8 | 6751 | """
Boolean geometry utilities.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from skeinforge_application.skeinforge_utilities import skeinforge_c... | gpl-3.0 |
drakuna/odoo | addons/lunch/__openerp__.py | 27 | 1507 | # -*- coding: utf-8 -*-
{
'name': 'Lunch',
'sequence': 120,
'version': '1.0',
'depends': ['base', 'web', 'decimal_precision'],
'category': 'Tools',
'summary': 'Lunch Order, Meal, Food',
'description': """
The base module to manage lunch.
================================
Many companies orde... | gpl-3.0 |
mheap/ansible | lib/ansible/modules/cloud/misc/virt_pool.py | 43 | 21722 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Maciej Delmanowski <drybjed@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 |
coinkeeper/2015-06-22_18-31_bitcoin | qa/rpc-tests/test_framework/util.py | 77 | 13035 | # Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#
# Add python-bitcoinrpc to module search path:
import os
import sys
from decimal impor... | mit |
eviljeff/olympia | src/olympia/amo/tests/test_readonly.py | 7 | 1617 | from django.db import models
import MySQLdb as mysql
import pytest
from pyquery import PyQuery as pq
from olympia.addons.models import Addon
from olympia.amo.tests import reverse_ns
@pytest.yield_fixture
def read_only_mode(client, settings, db):
def _db_error(*args, **kwargs):
raise mysql.OperationalEr... | bsd-3-clause |
arbrandes/edx-platform | common/djangoapps/student/tests/test_receivers.py | 3 | 1701 | """ Tests for student signal receivers. """
from edx_toggles.toggles.testutils import override_waffle_flag
from lms.djangoapps.courseware.toggles import COURSEWARE_MICROFRONTEND_PROGRESS_MILESTONES
from common.djangoapps.student.models import CourseEnrollmentCelebration
from common.djangoapps.student.tests.factories i... | agpl-3.0 |
aveshagarwal/cluster-capacity | vendor/k8s.io/kubernetes/examples/cluster-dns/images/backend/server.py | 504 | 1293 | #!/usr/bin/env python
# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 |
c22n/ion-channel-ABC | docs/examples/human-atrial/data/ito/Shibata1989/data_Shibata1989.py | 1 | 1285 | ### Digitised data from [Shibata1989]
import numpy as np
# IV Curves
# Steady State Activation
def Act_Shibata():
"""
Steady-State activation curve [Shibata1989]
cf Fig 3a
"""
x = np.arange(-30, 70, 10).tolist() + [80,]
y = np.asarray([0.05186808768647655,
0.126760198043557... | gpl-3.0 |
EvanK/ansible | lib/ansible/modules/network/fortios/fortios_firewall_multicast_address6.py | 24 | 10083 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | gpl-3.0 |
mozilla/stoneridge | python/src/Lib/distutils/command/install_egg_info.py | 438 | 2587 | """distutils.command.install_egg_info
Implements the Distutils 'install_egg_info' command, for installing
a package's PKG-INFO metadata."""
from distutils.cmd import Command
from distutils import log, dir_util
import os, sys, re
class install_egg_info(Command):
"""Install an .egg-info file for the package"""
... | mpl-2.0 |
dcosentino/edx-platform | lms/djangoapps/lms_xblock/runtime.py | 7 | 7991 | """
Module implementing `xblock.runtime.Runtime` functionality for the LMS
"""
import re
import xblock.reference.plugins
from django.core.urlresolvers import reverse
from django.conf import settings
from lms.djangoapps.lms_xblock.models import XBlockAsidesConfig
from openedx.core.djangoapps.user_api.api import course... | agpl-3.0 |
tejasnikumbh/AllSAT | lib/python2.7/site-packages/numpy/distutils/command/build_src.py | 141 | 32258 | """ Build swig, f2py, pyrex sources.
"""
from __future__ import division, absolute_import, print_function
import os
import re
import sys
import shlex
import copy
from distutils.command import build_ext
from distutils.dep_util import newer_group, newer
from distutils.util import get_platform
from distutils.errors impo... | mit |
pxzhenren/flask | tests/test_user_error_handler.py | 150 | 3483 | # -*- coding: utf-8 -*-
from werkzeug.exceptions import Forbidden, InternalServerError
import flask
def test_error_handler_no_match():
app = flask.Flask(__name__)
class CustomException(Exception):
pass
@app.errorhandler(CustomException)
def custom_exception_handler(e):
assert isinsta... | bsd-3-clause |
EdPassos/fofix | src/core/Task.py | 7 | 1642 | #####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä ... | gpl-2.0 |
daviddoria/PointGraphsPhase1 | Examples/Rendering/Python/rainbow.py | 15 | 3096 | #!/usr/bin/env python
# This example demonstrates the use and manipulation of lookup tables.
import vtk
from vtk.util.colors import *
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# First create pipeline a simple pipeline that reads a structure grid
# and then extracts a plane from the gr... | bsd-3-clause |
gsehub/edx-platform | lms/djangoapps/instructor_task/subtasks.py | 21 | 27437 | """
This module contains celery task functions for handling the management of subtasks.
"""
import json
import logging
from contextlib import contextmanager
from time import time
from uuid import uuid4
import psutil
from celery.states import READY_STATES, RETRY, SUCCESS
from django.core.cache import cache
from django.... | agpl-3.0 |
cleinias/Homeo | src/Webots/Homeo-experiments/controllers/Type-2b-Orthodox-Braitenberg/Type-2b-Orthodox-Braitenberg.py | 1 | 2330 | #################################################################
# First test controlling a khepera robot in a simple Webots world
# simulating a straightforward Braitenberg-like type-2b vehicle:
#
# 2 sensors and 2 motors, with crossed connections
#
# Stefano Franchi 2014
#############################################... | gpl-3.0 |
rosenvladimirov/addons | l10n_bg/__openerp__.py | 1 | 2431 | # -*- coding: utf-8 -*-
##############################################################################
#
# Odoo Bulgaria Accounting, Open Source Accounting and Invoiceing Module
# Copyright (C) 2016 Rosen Vladimirov, Prodax LTD
# (vladimirov.rosen@gmail.com, http://www.prodax.bg)
#
# This program is free so... | agpl-3.0 |
CaliOpen/CaliOpen | src/backend/components/py.data/caliopen_data/provider.py | 1 | 2237 | """Data provider class for dataset processing."""
from __future__ import absolute_import, print_function, unicode_literals
import os
from io import open
import zope.interface
from elasticsearch import Elasticsearch
from .interface import IDataProvider
class DataProvider(object):
"""Class to interact with a dat... | gpl-3.0 |
Bysmyyr/chromium-crosswalk | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py | 8 | 5815 | # Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | bsd-3-clause |
eric-haibin-lin/mxnet | python/mxnet/context.py | 4 | 9716 | # 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 |
jirikuncar/Flask-Collect | flask_collect/storage/base.py | 1 | 1374 | """ Abstract Storage. """
from __future__ import print_function
from os import path as op, walk
class BaseStorage():
""" Base class for storages. """
def __init__(self, collect, verbose=False):
self.verbose = verbose
self.collect = collect
def __iter__(self):
""" Seek static fi... | bsd-3-clause |
flazzarini/flask-jwt | docs/conf.py | 5 | 6665 | # -*- coding: utf-8 -*-
#
# flask-jwt documentation build configuration file, created by
# sphinx-quickstart on Fri May 28 11:39:14 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | mit |
wsmith323/django | django/db/backends/sqlite3/operations.py | 106 | 10799 | from __future__ import unicode_literals
import datetime
import uuid
from django.conf import settings
from django.core.exceptions import FieldError, ImproperlyConfigured
from django.db import utils
from django.db.backends import utils as backend_utils
from django.db.backends.base.operations import BaseDatabaseOperatio... | bsd-3-clause |
Mazecreator/tensorflow | tensorflow/contrib/learn/python/learn/estimators/composable_model_test.py | 77 | 6392 | # 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 |
dnozay/lettuce | tests/integration/lib/Django-1.3/django/conf/locale/ru/formats.py | 232 | 1323 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j E Y г.'
TIME_FORMAT = 'G:i:s'
DATETIME_FORMAT = 'j E Y г. G:i:s'
YEAR_M... | gpl-3.0 |
derDavidT/sympy | sympy/liealgebras/tests/test_type_F.py | 80 | 1222 | from __future__ import division
from sympy.liealgebras.cartan_type import CartanType
from sympy.core.compatibility import range
from sympy.matrices import Matrix
def test_type_F():
c = CartanType("F4")
m = Matrix(4, 4, [2, -1, 0, 0, -1, 2, -2, 0, 0, -1, 2, -1, 0, 0, -1, 2])
assert c.cartan_matrix() == m
... | bsd-3-clause |
ReactiveX/RxPY | tests/test_observable/test_filter.py | 1 | 14035 | import unittest
from rx.testing import TestScheduler, ReactiveTest, is_prime
from rx.disposable import SerialDisposable
from rx.operators import filter, filter_indexed
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribe... | mit |
oxc/Flexget | flexget/plugins/filter/private_torrents.py | 4 | 1333 | from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('priv_torrents')
class FilterPrivateTorrents(object):
"""How to handle ... | mit |
lubkoll/friendly-type-erasure | type_erasure/cpp_file_parser.py | 1 | 16956 | import clang_util
import cpp
import file_parser
import re
import util
import parser_addition
from clang.cindex import TypeKind
def sequence_from_text(text):
return [cpp.SimpleToken(entry) for entry in text.split(' ')]
def get_alias_from_text(name, text):
return cpp.Alias(name, [cpp.SimpleToken(spelling) for... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.