code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from distutils.core import setup
from distutils.command.install_data import install_data
setup (name = "freeopcua",
version = "0.9.7",
description = "Pure Python OPC-UA client and server library",
author = "Olivier Roulet-Dubonnet",
author_email = "olivier.roulet@gmail.com",
u... | ya-mouse/python-opcua | setup.py | Python | lgpl-3.0 | 834 |
import numpy as np
import matplotlib as mpl
from distutils.version import LooseVersion
import nose
import matplotlib.pyplot as plt
import nose.tools as nt
import numpy.testing as npt
from . import PlotTestCase
from .. import rcmod
class RCParamTester(object):
def flatten_list(self, orig_list):
iter_lis... | ottermegazord/ottermegazord.github.io | sortify-master/seaborn/tests/test_rcmod.py | Python | mit | 7,513 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 주차 빌딩
# https://www.acmicpc.net/problem/3699
'''
2
1 5
-1 2 1 -1 3
3 6
-1 5 6 -1 -1 3
-1 -1 7 -1 2 9
-1 10 4 1 8 -1
'''
import collections
import sys
num = int(sys.stdin.readline().strip())
for n in range(num):
row_col = str(sys.stdin.readline().strip()).split('... | youngjun0528/moheeto | BaekjoonOnlineJudge/acmicpc_3699.py | Python | apache-2.0 | 1,217 |
from distutils.version import LooseVersion
import platform
import subprocess
import os
__author__ = 'Igor Seletskiy'
__copyright__ = "Cloud Linux Zug GmbH 2016, KernelCare Project"
__credits__ = 'Igor Seletskiy'
__license__ = 'Apache License v2.0'
__maintainer__ = 'Igor Seletskiy'
__email__ = 'i@kernelcare.com'
__stat... | iseletsk/kernelchecker | py/kernelchecker.py | Python | apache-2.0 | 8,982 |
import _plotly_utils.basevalidators
class ThicknessmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="thicknessmode",
parent_name="scatter.marker.colorbar",
**kwargs
):
super(ThicknessmodeValidator, self).__init__(
... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/marker/colorbar/_thicknessmode.py | Python | mit | 588 |
import sys
import unittest
import tkinter
from tkinter import ttk
from test.support import requires, run_unittest, swap_attr
from tkinter.test.support import AbstractTkTest, destroy_default_root
requires('gui')
class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
def tearDown(self):
sel... | Orav/kbengine | kbe/src/lib/python/Lib/tkinter/test/test_ttk/test_extensions.py | Python | lgpl-3.0 | 10,629 |
from pycp2k.inputsection import InputSection
from ._xc5 import _xc5
from ._zmp1 import _zmp1
from ._external_vxc2 import _external_vxc2
class _method1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Method_type = None
self.Relativistic = None
self.XC = _xc5()
... | SINGROUP/pycp2k | pycp2k/classes/_method1.py | Python | lgpl-3.0 | 596 |
#!/usr/bin/env python
import mirheo as mir
dt = 0.001
ranks = (1, 1, 1)
domain = (12, 8, 10)
vtarget = (1.0, 0, 0)
u = mir.Mirheo(ranks, domain, debug_level=3, log_filename='log', no_splash=True)
pv = mir.ParticleVectors.ParticleVector('pv', mass = 1)
ic = mir.InitialConditions.Uniform(number_density=2)
u.registe... | dimaleks/uDeviceX | tests/flow/uniform_vel.py | Python | gpl-3.0 | 1,069 |
from ztag.annotation import *
class RHELDefaultApache(Annotation):
protocol = protocols.HTTP
subprotocol = protocols.HTTP.GET
port = None
def process(self, obj, meta):
if obj["title"] == "Test Page for the Apache HTTP Server on Red Hat Enterprise Linux":
meta.global_metadata.os =... | zmap/ztag | ztag/annotations/rhel_apache.py | Python | apache-2.0 | 368 |
#
# 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 us... | xsm110/Apache-Beam | sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio.py | Python | apache-2.0 | 15,335 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... | stdweird/aquilon | lib/python2.6/aquilon/aqdb/model/machine_specs.py | Python | apache-2.0 | 3,485 |
# ============================================================================
# FILE: size.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
from defx.base.column import Base, Highlights
from defx.context im... | SpaceVim/SpaceVim | bundle/defx.nvim/rplugin/python3/defx/column/size.py | Python | gpl-3.0 | 1,686 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | fiete201/qutebrowser | qutebrowser/browser/commands.py | Python | gpl-3.0 | 74,181 |
#############################################################################
##
## Copyright (C) 2007 Trolltech ASA. All rights reserved.
##
## This file is part of the Qt Concurrent project on Trolltech Labs.
##
## This file may be used under the terms of the GNU General Public
## License version 2.0 as published by ... | echristophe/lic | src/modeltest.py | Python | gpl-3.0 | 20,854 |
import os
import shutil
from lutris import settings
from lutris.config import LutrisConfig
from lutris.gui.dialogs import QuestionDialog, FileDialog
from lutris.runners.runner import Runner
class hatari(Runner):
"""Atari ST computers"""
human_name = "Hatari"
platform = "Atari ST computers"
game_optio... | malkavi/lutris | lutris/runners/hatari.py | Python | gpl-3.0 | 5,745 |
#
#@BEGIN LICENSE
#
# PSI4: an ab initio quantum chemistry software package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later ver... | spring01/libPSI | lib/databases/RGC10.py | Python | gpl-2.0 | 81,827 |
# -*- coding: utf-8 -*-
"""
Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U
This file is part of fiware-pep-steelskin
fiware-pep-steelskin is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, eithe... | agroknow/fiware-pep-steelskin | test/acceptance/integration/urls_ko/terrain.py | Python | agpl-3.0 | 1,025 |
# -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
from hackathon.user.user_manager import UserManager
from hackathon.user.user_profile_manager import UserProfileManager
from hackathon.user.oauth_login import OAuthLoginManager
| msopentechcn/open-hackathon | open-hackathon-server/src/hackathon/user/__init__.py | Python | mit | 281 |
#! /usr/bin/python3
import struct
import decimal
D = decimal.Decimal
from fractions import Fraction
from . import (util, config, exceptions, tetcoin, util)
"""Burn {} to earn {} during a special period of time.""".format(config.TET, config.XTN)
ID = 60
def validate (db, source, destination, quantity, block_index,... | Tetchain/tetchaind | lib/burn.py | Python | mit | 3,720 |
from django.conf.urls.defaults import *
# Spenglr
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'profiles.views.profile', name='profile' ),
url(r'^edit/$', 'profiles.views.edit_profile', name='profile-edit' ),
... | mfitzp/smrtr | apps/profiles/urls.py | Python | bsd-3-clause | 483 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
##---------------------------------------------------------------------------##
##
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2009 Skomoroh
##
## This program is free ... | TrevorLowing/PyGames | pysollib/tk/selectcardset.py | Python | gpl-2.0 | 15,583 |
"""
xml.py -
Copyright (C) 2016 Tobias Helfenstein <tobias.helfenstein@mailbox.org>
Copyright (C) 2016 Anton Hammer <hammer.anton@gmail.com>
Copyright (C) 2016 Sebastian Hein <hein@hs-rottenburg.de>
Copyright (C) 2016 Hochschule für Forstwirtschaft Rottenburg <hfr@hs-rottenburg.de>
This file is part of Wuchshüllenre... | tobiashelfenstein/wuchshuellenrechner | wuchshuellenrechner/lib/xml.py | Python | gpl-3.0 | 6,767 |
# -*- coding: utf-8 -*-
"""
dtutils
---------
Contains various utitlity functions
some code from fTools plugin contained.
"""
"""
Part of DigitizingTools, a QGIS plugin that
subsumes different tools neded during digitizing sessions.
* begin : 2013-02-25
* copyright : (C) 2013 by Bernhard Ströb... | bstroebl/DigitizingTools | tools/dtutils.py | Python | gpl-2.0 | 10,465 |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
led_pin = 18
GPIO.setup(led_pin, GPIO.OUT)
try:
while True:
GPIO.output(led_pin, True) # LED on
time.sleep(1) # delay 1 second
GPIO.output(led_pin, False) # LED off
time.sleep(1) # d... | simonmonk/electronics_cookbook | pi/blink.py | Python | mit | 388 |
#!/usr/bin/python
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 o... | camradal/ansible-modules-extras | clustering/kubernetes.py | Python | gpl-3.0 | 14,678 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | essamjoubori/girder | girder/__init__.py | Python | apache-2.0 | 3,685 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | markmc/oslo.messaging | oslo/messaging/rpc/dispatcher.py | Python | apache-2.0 | 4,521 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
IOGeopaparazzi
A QGIS plugin
A plugin to import/export geodata from/to geopaparazzi
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
-------------------
begin :... | eachiaradia/IOGeopaparazzi | io_geopaparazzi_provider.py | Python | gpl-3.0 | 2,828 |
from .exceptions import QueryError
REPR_OUTPUT_SIZE = 20
def combine_list(a, b):
if isinstance(a, (set, tuple, list)):
a = list(a)
else:
a = [a]
if isinstance(b, (set, tuple, list)):
b = list(b)
else:
b = [b]
a.extend(b)
return a
def combine_dicts(a, b, op=co... | armicron/kev | kev/query.py | Python | gpl-3.0 | 3,301 |
# This file is part of Lithium-Projman.
#
# Lithium-Projman 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.
#
# Lithi... | GabMus/lithium-projman | server/projman/verifications.py | Python | gpl-3.0 | 1,831 |
# coding: utf-8
from datetime import date, datetime
from typing import List, Dict, Type
from openapi_server.models.base_model_ import Model
from openapi_server.models.link import Link
from openapi_server import util
class PipelineStepImpllinks(Model):
"""NOTE: This class is auto generated by OpenAPI Generator ... | cliffano/swaggy-jenkins | clients/python-aiohttp/generated/openapi_server/models/pipeline_step_impllinks.py | Python | mit | 2,769 |
from random import random
from pythonPWA.fileHandlers.gampReader import gampReader
from pythonPWA.model.intensity import intensity
class dataSimulator(object):
"""description of class"""
def __init__(self,
mass=1010.,
waves=[],
resonances=[],
... | bdell/pyPWA | pythonPWA/utilities/dataSimulator.py | Python | mit | 4,102 |
# -*- coding: utf-8 -*-
"""
IMU Plugin
Copyright (C) 2015 Olaf Lüke <olaf@tinkerforge.com>
Copyright (C) 2015 Matthias Bolte <matthias@tinkerforge.com>
Copyright (C) 2019 Erik Fleckstein <erik@tinkerforge.com>
imu_3d_widget.py: IMU OpenGL representation
This program is free software; you can redistribute it and/or
mo... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/imu/imu_3d_widget.py | Python | gpl-2.0 | 2,398 |
from mpi4py import MPI
from utils.mpi_helper import finalize
from utils.mpi_helper import init
init()
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
print "process [", rank, "] - running"
if rank == 0:
data = {'name': "PROCESS-" + str(rank), 'msg': "Hello"}
req = comm.isend(data, dest=... | balolam/university-mpi-python | practical_task_1/task2.py | Python | apache-2.0 | 516 |
from django.conf import settings
from django.conf.urls import include, url
from django.urls import path
from django.conf.urls.static import static
from django.contrib import admin
from osmaxx.excerptexport.urls import excerpt_export_urlpatterns
from osmaxx.core.urls import pages_patterns
from osmaxx.profile.urls impor... | geometalab/osmaxx | web_frontend/config/urls.py | Python | mit | 1,308 |
# -*- coding: utf-8 -*-
from nova import context
from nova.db.sqlalchemy import models
from nova.db.sqlalchemy import api as model_api
from sqlalchemy import func
PCI_ALIAS_NAME = 'CaveCreek'
class ComputeNodeSelection:
def __init__(self, weighed_hosts, pci_requests):
self.db_session = model_api.get_sess... | khandavally/devstack | EPAQA/compute_node_selection.py | Python | apache-2.0 | 3,142 |
#! /usr/bin/env python
import sys
import os
import subprocess
includeos_src = os.environ.get('INCLUDEOS_SRC',
os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0])
sys.path.insert(0,includeos_src)
from vmrunner import vmrunner
# Get an auto-created V... | ingve/IncludeOS | test/fs/integration/ide_write/test.py | Python | apache-2.0 | 663 |
# -*- coding: utf-8 -*-
# This file is part of OpenHatch.
# Copyright (C) 2011 Asheesh Laroia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at ... | mzdaniel/oh-mainline | mysite/base/depends.py | Python | agpl-3.0 | 2,409 |
import cStringIO
import itertools
def getattribute(obj, attrname):
return object.__getattribute__(obj, attrname)
class MapIOHybrid(object):
"""A hybrid of a dict-like type and a file-like type; whose APIs are
(fortunately) almost entirely disjoint.
This class has and proxies for two data objects; an... | mangpo/cacheall-proxy-server | httpmessage/_mapio.py | Python | bsd-2-clause | 2,986 |
#!/usr/bin/env python
class precedence(object):
def __init__(self):
p = {}
p['('] = 1000
p['*'] = 1
p['/'] = 2
p['+'] = 3
p['-'] = 4
p['='] = 5
p['<'] = 5
p['>'] = 5
self.p = p
self.ops_stack = []
self.output_queue =... | rumblesan/diddy-vm | puff/precedence.py | Python | mit | 1,647 |
from colors import Colors
class PlayListMember(object):
def __init__(self, movie, runMode):
self.movie = movie
self.runMode = runMode
class Score(object):
LOCK_ITEMS, UNLOCK_ITEMS, SKIP_LOCK = range(3)
FROM_CURRENT, FROM_START, NEW_ANIMATION_ONLY, ONLY_IF_VISIBLE = range(4)
... | cherry-wb/SideTools | examples/demos/qtdemo/score.py | Python | apache-2.0 | 2,679 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0002_auto_20150323_1827'),
]
operations = [
migrations.AlterField(
model_name='about',
name=... | marchchad/GatorApp | jobs/migrations/0003_auto_20150323_1831.py | Python | gpl-2.0 | 449 |
# 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 applica... | tensorflow/tensorflow | tensorflow/python/framework/auto_control_deps_test.py | Python | apache-2.0 | 31,227 |
import abc
import jsonschema
from functools import wraps
from flask import request, jsonify, abort
from flask.ext.restful import Resource
__author__ = 'Michal Kononenko'
class AbstractResource(Resource):
"""
Abstract class that defines an API view with a schema
built into it. This class is capable of ser... | MichalKononenko/OmicronAPI | omicron_server/views/abstract_resource.py | Python | gpl-2.0 | 3,563 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 The ProteinDF development team.
# see also AUTHORS and README if provided.
#
# This file is a part of the ProteinDF software package.
#
# The ProteinDF is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publ... | ProteinDF/ProteinDF_bridge | scripts/brd2pdb.py | Python | gpl-3.0 | 2,341 |
from optparse import make_option
from django.core.management.base import NoArgsCommand, BaseCommand
from django_pjm import models
class Command(BaseCommand):
help = "Imports PJM locational marginal pricing day-ahead data."
args = ''
option_list = BaseCommand.option_list + (
make_option('--start-y... | chrisspen/django-pjm | django_pjm/management/commands/import_pjm_prices.py | Python | mit | 798 |
from bottle import Bottle, template, static_file, request, response, redirect
from webargs import Arg
from webargs.bottleparser import use_args
from sapi import consultAPI
docHandlerApp = Bottle()
@docHandlerApp.route('/s/consult/cwf/<cref>/createPrescriptionURL', method='POST')
def create_upload_url(cref):
args = ... | prakma/hmp-web | server/handlers/documenthandler.py | Python | apache-2.0 | 5,294 |
import json
import logging
from datetime import datetime
import dateutil
import flask_restful
from flask import request
from common.common_consts.telem_categories import TelemCategoryEnum
from monkey_island.cc.database import mongo
from monkey_island.cc.models.monkey import Monkey
from monkey_island.cc.models.telemet... | guardicore/monkey | monkey/monkey_island/cc/resources/telemetry.py | Python | gpl-3.0 | 3,334 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import typing # NOQA: F401
import six
from nixnet import _funcs
class Databases(collections.Mapping):
"""Database aliases."""
def __init__(self, handle):
self._handle =... | epage/nixnet-python | nixnet/system/databases.py | Python | mit | 5,507 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opti... | Boussadia/weboob | modules/carrefourbanque/browser.py | Python | agpl-3.0 | 1,982 |
from django.conf.urls import patterns, url
from abads import views
urlpatterns = patterns('',
url(r'^get_ad/(?P<exp_id>\d+)','abads.views.get_ad'),
url(r'^click/(?P<exp_id>\d+)','abads.views.record_click'),
url(r'^test','abads.views.test'),
) | okaram/django | simpleab/abads/urls.py | Python | unlicense | 270 |
# -*- coding: utf-8 -*-
DOCUMENTATION = '''
module: mt_system.py
author:
- "Valentin Gurmeza"
version_added: "2.4"
short_description: Manage mikrotik system endpoints
requirements:
- mt_api
description:
- manage mikrotik system parameters
options:
hostname:
description:
- hotstname of mikrotik router
... | zahodi/ansible-mikrotik | library/mt_system.py | Python | apache-2.0 | 2,989 |
from constraint_solver import pywrapcp
def main():
solver = pywrapcp.Solver("time limit test")
n = 10
x = [solver.IntVar(1, n, "x[%i]" % i) for i in range(n)]
solver.Add(solver.AllDifferent(x, True))
solution = solver.Assignment()
solution.Add(x)
db = solver.Phase(x,
solver.CHOOSE_... | capturePointer/or-tools | examples/tests/issue4.py | Python | apache-2.0 | 1,031 |
# -*- coding: utf-8 -*-
#from pytest import raises
# The parametrize function is generated, so this doesn't work:
#
# from pytest.mark import parametrize
#
import pytest
parametrize = pytest.mark.parametrize
from bts.api import BTS
from bts.market import BTSMarket
from bts.misc import trim_float_precision
from bt... | pch957/python-bts-v0.9 | tests/test_main.py | Python | mit | 7,742 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | dayatz/taiga-back | taiga/timeline/management/commands/rebuild_timeline.py | Python | agpl-3.0 | 2,826 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from hub.formats import Format
from hub.formats.geobase import GenericOGRParser
from hub.utils import ogr2ogr
if 'WFS' in ogr2ogr.SUPPORTED_DRIVERS:
class WFS(Format):
label = 'WFS'
description = """
Web Feature Service ist ei... | hsr-ba-fs15-dat/opendatahub | src/main/python/hub/formats/wfs.py | Python | mit | 567 |
#
# The Python Imaging Library
# $Id$
#
# load a GIMP brush file
#
# History:
# 96-03-14 fl Created
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1996.
#
# See the README file for information on usage and redistribution.
#
import Image, ImageFile
def i32(c):
return ord(c[3]) + (o... | ppizarror/Hero-of-Antair | data/images/pil/GbrImagePlugin.py | Python | gpl-2.0 | 1,629 |
from __future__ import print_function
import debug
debug.debug = True
from django.core.urlresolvers import reverse
from tastypie.test import ResourceTestCase
from ietf.utils.test_data import make_test_data
class RestApi(ResourceTestCase):
def list_recursively(self, resource, format):
"""
Recurs... | wpjesus/codematch | ietf/utils/tests_restapi.py | Python | bsd-3-clause | 3,067 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest, frappe, json
from frappe.utils import flt
test_dependencies = ["Item"]
class TestPaymentTool(unittest.TestCase):
def test_make_jo... | suyashphadtare/test | erpnext/accounts/doctype/payment_tool/test_payment_tool.py | Python | agpl-3.0 | 6,947 |
##
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2016 Uni.Lu/LCSB, NTUA
# Authors:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste
# License:: MIT/GPL
# $Id$
#
# This work implements a part of the HPCBIOS project ... | ocaisa/easybuild-easyblocks | easybuild/easyblocks/s/samtools.py | Python | gpl-2.0 | 5,044 |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from UM.Math.Vector import Vector
from UM.Math.Float import Float
## Plane representation using normal and distance.
class Plane:
def __init__(self, normal = Vector(), distance = 0.0):
super().__init__... | onitake/Uranium | UM/Math/Plane.py | Python | agpl-3.0 | 972 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 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.apach... | cloudbau/nova | nova/tests/virt/xenapi/test_agent.py | Python | apache-2.0 | 12,596 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 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.... | ykaneko/neutron | neutron/agent/rpc.py | Python | apache-2.0 | 3,618 |
from django.db import models
from django_extensions.db.models import TimeStampedModel
class Check(TimeStampedModel):
url = models.URLField()
no_of_recommendations = models.IntegerField(default=0)
runs_debug = models.BooleanField()
supports_https = models.... | kevgathuku/ponycheckup | ponycheckup/check/models.py | Python | bsd-3-clause | 2,407 |
#!python
from mock import Mock
from snakeguice import config
#class __TestConfig(DingusTestCase(config.Config)):
class __TestConfig(object):
def setup(self):
super(TestConfig, self).setup()
self.s = 'some string value'
self.c = config.Config(self.s)
def test(self):
assert ... | dstanek/snake-guice | tests/test_config.py | Python | mit | 343 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | squirrelo/qiita | qiita_plugins/biom_type/biom_type_plugin/validate.py | Python | bsd-3-clause | 3,957 |
from django.conf import settings
from django.contrib.auth.models import User
class EmailOrUsernameModelBackend(object):
supports_anonymous_user = False
supports_object_permissions = False
def authenticate(self, username=None, password=None):
if '@' in username:
kwargs = {... | rossjones/ScraperWikiX | web/frontend/email_auth.py | Python | agpl-3.0 | 755 |
# Update this value to version up Rez. Do not place anything else in this file.
_rez_version = "2.0.rc1.38"
| mstreatfield/rez | src/rez/utils/_version.py | Python | gpl-3.0 | 110 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "seed_stage_based_messaging.settings"
)
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| praekelt/seed-stage-based-messaging | manage.py | Python | bsd-3-clause | 283 |
import csv
from connexion import *
#import markdown
import os.path
import re
import tornado.auth
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import unicodedata
from tornado.options import define, options
define("port", default=8888, help="run on the given port", type=in... | eldie1984/Scripts | pg/tornado_psa/dollaru.py | Python | gpl-2.0 | 3,086 |
#!/usr/bin/env python
#
# DocMaker (c) 2002, 2004 David Turner <david@freetype.org>
#
# This program is a re-write of the original DocMaker took used
# to generate the API Reference of the FreeType font engine
# by converting in-source comments into structured HTML.
#
# This new version is capable of outputting XML da... | sdbondi/afrika-burns-2014-ProjectM | src/WinLibs/freetype-2.3.5/src/tools/docmaker/docmaker.py | Python | lgpl-2.1 | 2,757 |
# -*- coding: cp1252 -*-
'''
Adivinhe.py
* Sorteie um número de 1 até 100
* e peça para o usuário adivinhar
* dando dicas se é > ou <
* Entrada: n (int)
* Saída: nada
*
* Autor: Fabrício Olivetti de França
* Disciplina Processamento da Informação
* Universidade Federal do ABC
'''
from random import randint... | folivetti/PI-UFABC | AULA_04/Python/Adivinhe.py | Python | mit | 528 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | awni/tensorflow | tensorflow/tools/docker/jupyter_notebook_config.py | Python | apache-2.0 | 815 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('flyerapp', '0007_auto_20150629_1135'),
]
operations = [
migrations.AddField(
model_name='schedul... | luzeduardo/antonov225 | flyer/flyerapp/migrations/0008_auto_20150630_1859.py | Python | gpl-2.0 | 924 |
from monkey_island.cc.database import mongo
from monkey_island.cc.models import Monkey
from monkey_island.cc.services.node import NodeService
from monkey_island.cc.services.telemetry.processing.utils import (
get_edge_by_scan_or_exploit_telemetry,
)
from monkey_island.cc.services.telemetry.zero_trust_checks.data_en... | guardicore/monkey | monkey/monkey_island/cc/services/telemetry/processing/scan.py | Python | gpl-3.0 | 1,646 |
# encoding: utf-8
"""
monitor.py
Created by Thomas Mangin on 2012-02-05.
Copyright (c) 2011-2013 Exa Networks. All rights reserved.
"""
from collections import deque
class _Container (object):
def __init__ (self,supervisor):
self.supervisor = supervisor
class Monitor (object):
nb_recorded = 60
def __init__(se... | jbfavre/exaproxy | lib/exaproxy/monitor.py | Python | bsd-2-clause | 5,775 |
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | zouyapeng/horizon-newtouch | openstack_dashboard/dashboards/project/volumes/snapshots/tests.py | Python | apache-2.0 | 9,164 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/1_5/collada/library_joints/joint/revolute/no_limit/no_limit.py | Python | mit | 4,082 |
# Copyright 2012 David Malcolm <dmalcolm@redhat.com>
# Copyright 2012 Red Hat, Inc.
#
# This 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) a... | davidmalcolm/gcc-python-plugin | configbuilder.py | Python | gpl-3.0 | 6,364 |
import sys
import logging
from chapman import model as M
from .t_base import Result
from .t_group import Group
log = logging.getLogger(__name__)
class Barrier(Group):
'''Just like a group, but doesn't care about the sub-results'''
def retire(self):
for st in self.subtask_iter():
if st.... | synappio/chapman | chapman/task/t_barrier.py | Python | mit | 634 |
#!/usr/bin/python
"""
Performs a statistical analysis of a pickled RDF.
arg1: the pickled RDF
arg2: the feature names numpy struct
arg3: the target csv file with feature names
arg4: the target csv file with the whole feature appearances
arg5: the target csv file with the sequence grouped feature appearances
arg6: the... | lfrdm/medpy | bin/others/analyzeforest.py | Python | gpl-3.0 | 6,943 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('popolo', '0002_update_models_from_upstream'),
('candidates', '0030_merge'),
]
operations = [
migrations.AddField(
... | mysociety/yournextrepresentative | candidates/migrations/0031_loggedaction_post.py | Python | agpl-3.0 | 477 |
##
# Copyright 2015-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | cfenoy/easybuild-easyblocks | easybuild/easyblocks/generic/rubygem.py | Python | gpl-2.0 | 3,976 |
### extends 'class_empty.py'
### block ClassImports
# NOTICE: Do not edit anything here, it is generated code
from . import gxapi_cy
from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref
### endblock ClassImports
### block Header
# NOTICE: The code generator will not replace the code in this block
### end... | GeosoftInc/gxpy | geosoft/gxapi/GXHGD.py | Python | bsd-2-clause | 4,280 |
#!/usr/bin/env python2
# coding=utf-8
from setuptools import setup, find_packages
from distutils.command.build_py import build_py as _build_py
import os
import versioneer
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "src"))
import octoprint_setuptools
#---------------------... | Salandora/OctoPrint | setup.py | Python | agpl-3.0 | 6,112 |
__author__ = 'a_medelyan'
import rake
import test_data
import sys
# reading a directory with test documents
input_dir = sys.argv[1]
# number of top ranked keywords to evaluate
top = int(sys.argv[2])
test_set = test_data.read_data(input_dir)
# evaluating
rake_object = rake.Rake("SmartStoplist.txt", 5, 3, 4)
total_p... | azhar3339/RAKE-tutorial | evaluate_rake.py | Python | mit | 1,238 |
# -*- 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 'ProjectKey.user_added'
db.add_column('sentry_projectkey', 'user_added',
... | beni55/sentry | src/sentry/migrations/0068_auto__add_field_projectkey_user_added__add_field_projectkey_date_added.py | Python | bsd-3-clause | 20,383 |
from django.db import models
from django.conf import settings
class Food(models.Model):
"""A generic food"""
owner = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
name = models.CharField(max_length=50)
date_created = models.DateTimeField(auto_now_add=True)
date_mod... | palmerev/can-i-eat-this | ciet/api/models.py | Python | mit | 1,746 |
# Standard Library Imports
import re
import logging
import sys
import traceback
from collections import OrderedDict
# 3rd Party Imports
# Local Imports
log = logging.getLogger('Geofence')
# Load in a geofence file
def load_geofence_file(file_path):
try:
geofences = OrderedDict()
name_pattern = r... | blsmit5728/PokeAlarm | PokeAlarm/Geofence.py | Python | agpl-3.0 | 3,535 |
# Generated by Django 2.2.8 on 2019-12-20 10:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("models", "5608_adds_map_card_configs"),
]
operations = [
migrations.AddField(
model_name="searchexporthistory",
name... | archesproject/arches | arches/app/models/migrations/5605_searchexporthistory_downloadfile.py | Python | agpl-3.0 | 446 |
from django.conf import settings
from nose.tools import eq_
import amo
import amo.tests
from amo.urlresolvers import reverse
class TestPages(amo.tests.TestCase):
def _check(self, url, status):
resp = self.client.get(reverse(url))
eq_(resp.status_code, status)
def test_status(self):
... | mdaif/olympia | apps/pages/tests.py | Python | bsd-3-clause | 1,472 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import random
... | yeyanchao/calibre | src/calibre/ebooks/mobi/writer8/header.py | Python | gpl-3.0 | 2,582 |
#!/usr/bin/python3
#
# This file is part of Progesterone pipeline.
#
# Progesterone pipeline 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 v... | ivanamihalek/progesterone | 17_tfbs_from_local_bed.py | Python | gpl-2.0 | 7,325 |
# mock.py
# Test tools for mocking and patching.
# Copyright (C) 2007-2009 Michael Foord
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# mock 0.6.0
# http://www.voidspace.org.uk/python/mock/
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# 2009-11-25: Licence dow... | mogoweb/webkit_for_android5.1 | webkit/Tools/Scripts/webkitpy/thirdparty/mock.py | Python | apache-2.0 | 9,681 |
from .state import EOF
from .tokens import TokenEof
from .tokens_base import TOKEN_COMMAND_WRITE_AND_QUIT_COMMAND
from .tokens_base import TokenOfCommand
from Vintageous import ex
plus_plus_translations = {
'ff': 'fileformat',
'bin': 'binary',
'enc': 'fileencoding',
'nobin': 'nobinary',
}
@ex.comman... | denim2x/Vintageous | ex/parser/scanner_command_write_and_quit_command.py | Python | mit | 1,715 |
#!/usr/bin/python
import numpy as np
files = [
"lora-time_SF7_grad_idx_DECODE_HEADER", # Run 6 times (9856 samples)
"lora-time_SF7_grad_idx_DECODE_PAYLOAD",
"lora-time_SF7_grad_idx_DETECT",
"lora-time_SF7_grad_idx_PAUSE",
"lora-time_SF7_grad_idx_SYNC",
"lora-time_SF7_grad_idx_only", ... | rpp0/gr-lora | examples/lora-timings/avg_sd.py | Python | gpl-3.0 | 1,385 |
from nose.tools import *
import tagrefinery.helper as h
def test_dice_coefficient():
s1 = ["a","b"]
s2 = ["a","c"]
sim = h.StringSimilarity()
assert_equal(sim.dice_coefficient(s1,s1),1)
assert_equal(sim.dice_coefficient(s1,[]),0)
assert_equal(sim.dice_coefficient(s1,s2),0.5)
| Christoph/PythonTest | tests/tagrefinery_tests.py | Python | mit | 302 |
from unittest import TestCase
from sys import version_info
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback.
from django.http import HttpResponse, HttpRequest
from django.utils.functional import allow_lazy, lazy, memoize
from django.view... | t11e/django | tests/regressiontests/decorators/tests.py | Python | bsd-3-clause | 4,983 |
from database import db
from sqlalchemy.schema import ForeignKey
from sqlalchemy.ext.declarative import declared_attr
from models.thing import Thing, GUID
from models.geo_coords import PostalAddress
class OrgAreas(db.Model):
guid = db.Column('guid', GUID(), primary_key=True)
org_id = db.Column('org_id', db.S... | sellerlink/sellerlink | models/organization.py | Python | gpl-3.0 | 1,474 |
#!/usr/bin/python
## Download files from Amazon S3 (e.g. raw photos for 3D models)
## Andy Bevan 15-Jun-2014, updated 21-Nov-2014
## Daniel Pett updated 05-Jan-2016
__author__ = 'ahb108'
## Currently for Python 2.7.5 (tested on MacOSX 10.9.2) launched in a virtual environment:
from PIL import Image # Pillow with libj... | MicroPasts/MicroPasts-Scripts | photoMasking/photoMasking.py | Python | apache-2.0 | 4,679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.