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 |
|---|---|---|---|---|---|
"""Base quality score recalibration."""
import os
import shutil
from resolwe.process import (
BooleanField,
Cmd,
DataField,
FileField,
GroupField,
IntegerField,
ListField,
Process,
SchedulingClass,
StringField,
)
class BQSR(Process):
"""A two pass process of BaseRecalibrat... | genialis/resolwe-bio | resolwe_bio/processes/reads_processing/bqsr.py | Python | apache-2.0 | 10,334 |
# encoding: utf-8
from yast import import_module
import_module('UI')
from yast import *
class Heading2Client:
def main(self):
UI.OpenDialog(
VBox(
Heading("This Is a Heading."),
Label("This is a Label."),
PushButton("&OK")
)
)
UI.UserInput()
UI.... | yast/yast-python-bindings | examples/Heading2.py | Python | gpl-2.0 | 361 |
from unittest import TestCase
from six.moves import range
from .symmath_check import symmath_check
class SymmathCheckTest(TestCase):
def test_symmath_check_integers(self):
number_list = [i for i in range(-100, 100)]
self._symmath_check_numbers(number_list)
def test_symmath_check_floats(sel... | msegado/edx-platform | common/lib/symmath/symmath/test_symmath_check.py | Python | agpl-3.0 | 2,677 |
"""
Interface for an output.
"""
from abc import ABCMeta, abstractmethod
from typing import Optional, TextIO
from prompt_toolkit.data_structures import Size
from prompt_toolkit.styles import Attrs
from .color_depth import ColorDepth
__all__ = [
"Output",
"DummyOutput",
]
class Output(metaclass=ABCMeta):
... | jonathanslenders/python-prompt-toolkit | prompt_toolkit/output/base.py | Python | bsd-3-clause | 7,955 |
#!/usr/bin/env python
import errno
import json
import os
import re
import shutil
import sys
from getmoduleversion import get_version
# set at init time
node_prefix = '/usr/local' # PREFIX variable from Makefile
install_path = None # base target directory (DESTDIR + PREFIX from Makefile)
target_defaults = None
variabl... | hoho/dosido | nodejs/tools/install.py | Python | mit | 6,853 |
from __future__ import division
from builtins import range
from distutils.version import LooseVersion
import numpy as np
from scipy import ndimage
from scipy.ndimage import measurements
from skimage.filter import threshold_otsu
try:
import cv2
except ImportError:
cv2_available = False
else:
cv2_available =... | llerussell/sima | sima/segment/ca1pc.py | Python | gpl-2.0 | 10,288 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gconf
import gtk
import logging
import subprocess
from pango import FontDescription
from xml.sax.saxutils import escape as xml_escape
import guake.notifier
from guake.common import _
from guake.commo... | tirkarthi/guake | src/guake/gconfhandler.py | Python | gpl-2.0 | 25,365 |
"""
General tests for all estimators in sklearn.
"""
import os
import warnings
import sys
import traceback
import numpy as np
from scipy import sparse
from nose.tools import assert_raises, assert_equal, assert_true
from numpy.testing import assert_array_equal, \
assert_array_almost_equal
import sklearn
from s... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/sklearn/tests/test_common.py | Python | agpl-3.0 | 18,746 |
# Copyright (c) 2016, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''Class for handling environment configuration and defaults.'''
import re
import resource
from collections import namedtuple
from ipaddress import ip_addre... | shsmith/electrumx | server/env.py | Python | mit | 6,927 |
#!/usr/bin/env python
# coding: utf-8
from capytaine.ui.vtk.mesh_viewer import MeshViewer
from capytaine.ui.vtk.body_viewer import FloatingBodyViewer
from capytaine.ui.vtk.animation import Animation
| mancellin/capytaine | capytaine/ui/vtk/__init__.py | Python | gpl-3.0 | 200 |
from common_fixtures import * # NOQA
def test_link_instance_stop_start(super_client, client, context):
target1 = context.create_container(ports=['180', '122/udp'])
target2 = context.create_container(ports=['280', '222/udp'])
c = context.create_container(instanceLinks={
'target1_link': target1.id... | jimengliu/cattle | tests/integration/cattletest/core/test_link.py | Python | apache-2.0 | 7,262 |
# Author: Patrick Ohly <patrick.ohly@intel.com>
# Copyright: Copyright (C) 2015 Intel Corporation
#
# This file is licensed under the MIT license, see COPYING.MIT in
# this source distribution for the terms.
# A custom scheduler for bitbake which runs rm_work tasks more
# aggressively than the default schedul... | acornea/meta-intel-iot-security | scripts/rmwork.py | Python | mit | 8,723 |
import time
import pytest
from kervi.application import Application
import kervi.utility.nethelper as nethelper
APP_READY = False
MODULE_LOADED = None
def app_ready(module_name):
global APP_READY
APP_READY = True
def module_loaded(value):
global MODULE_LOADED
MODULE_LOADED = value
@pytest.mark.slow
... | kervi/kervi | kervi/tests/test_application.py | Python | mit | 1,175 |
"""
Copyright 2017 Peter Urda
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | urda/mr.butler | web/api/django_discord/views/user_view_set.py | Python | apache-2.0 | 1,436 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | RackSec/ansible | lib/ansible/modules/cloud/ovirt/ovirt_templates.py | Python | gpl-3.0 | 11,527 |
#
# Copyright 2016-2018 Universidad Complutense de Madrid
#
# This file is part of PyEmir
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
"""
Spectroscopy mode, Stare Spectra
"""
from numina.core import Result
from numina.array.combine import median
from numina.processing.combine import basi... | nicocardiel/pyemir | emirdrp/recipes/spec/sky.py | Python | gpl-3.0 | 2,588 |
#!/usr/bin/env python
import binascii
from collections import OrderedDict
import unittest
import argparse
import re
import subprocess
import sys
import os.path
import vecparser
cli_binary = ""
SUPPORTED_ALGORITHMS = [
'AES-128/CFB',
'AES-192/CFB',
'AES-256/CFB',
'AES-128/GCM',
'AES-192/GCM',
... | Rohde-Schwarz-Cybersecurity/botan | src/scripts/cli_tests.py | Python | bsd-2-clause | 5,200 |
#!/usr/bin/python
import json
import re
import sys
def Feature(name2, id2, **kwargs):
kwargs.update({'name2': name2, 'id2': id2})
return {'type': 'Feature',
'properties': kwargs,
'geometry': {'type': 'MultiPolygon', 'coordinates': []}}
FeatureFlag_SetBounds = 0x0001 # has partial subunits; set/extend item.bou... | nightjuggler/peaks | format_gis_data.py | Python | mit | 27,823 |
import numpy as np
from mushroom_rl.algorithms.policy_search.policy_gradient import PolicyGradient
class GPOMDP(PolicyGradient):
"""
GPOMDP algorithm.
"Infinite-Horizon Policy-Gradient Estimation". Baxter J. and Bartlett P. L..
2001.
"""
def __init__(self, mdp_info, policy, optimizer, featur... | carloderamo/mushroom | mushroom_rl/algorithms/policy_search/policy_gradient/gpomdp.py | Python | mit | 3,178 |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | sassoftware/mint | mint/django_rest/rbuilder/platforms/image_type_descriptors/rawFsImage.py | Python | apache-2.0 | 3,614 |
#!/usr/bin/env python
from threading import Thread
import docker
import json
import logging
logging.basicConfig(level=logging.ERROR,
format='[%(levelname)s] (%(threadName)-10s) %(message)s',
)
global client
client = docker.from_env()
# /etc/hosts 127.0.0.1 localhost
class ... | jorgeacf/dockerfiles | ci/portainer/scripts/docker-events.py | Python | gpl-3.0 | 3,868 |
import os
from queue import Queue
from bears.python.requirements.PySafetyBear import PySafetyBear
from coalib.settings.Section import Section
from coalib.settings.Setting import Setting
from coalib.testing.LocalBearTestHelper import LocalBearTestHelper
from coalib.results.Result import Result
from coalib.results.RESUL... | coala/coala-bears | tests/python/requirements/PySafetyBearWithoutMockTest.py | Python | agpl-3.0 | 5,749 |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... | edespino/gpdb | src/test/tinc/tinctest/suite.py | Python | apache-2.0 | 6,748 |
# Generated by Django 1.11.9 on 2018-02-01 15:00
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('linked_domain', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='domainlink',
... | dimagi/commcare-hq | corehq/apps/linked_domain/migrations/0002_migrate_linked_apps.py | Python | bsd-3-clause | 409 |
# Used to configure CxxTest
import csnBuild
cxxTest = csnBuild.Project("CxxTest", "library")
| msteghofer/CSnake | tests/data/thirdParty/CxxTest/csnCxxTest.py | Python | bsd-3-clause | 94 |
from django import forms
from fields import Html5CaptchaField
from html5input import Html5EmailInput
class ContactForm(forms.Form):
email = forms.EmailField(required=True, widget=Html5EmailInput(attrs={'required': None}))
message = forms.CharField(widget=forms.Textarea(attrs={'required': None}))
captcha =... | upTee/upTee | uptee/messaging/forms.py | Python | bsd-3-clause | 354 |
import builtins
import gc
import sys
import types
import math
import unittest
import weakref
from copy import deepcopy
from test import support
class OperatorsTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
self.binops = {
... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.3.0/Lib/test/test_descr.py | Python | mit | 159,901 |
## Copyright 2011, IOActive, Inc. All rights reserved.
##
## AndBug is free software: you can redistribute it and/or modify it under
## the terms of version 3 of the GNU Lesser General Public License as
## published by the Free Software Foundation.
##
## AndBug is distributed in the hope that it will be useful, but W... | eight-pack-abdominals/andbug | lib/andbug/log.py | Python | gpl-3.0 | 3,953 |
"""Tests for the microsoft_face component."""
| fbradyirl/home-assistant | tests/components/microsoft_face/__init__.py | Python | apache-2.0 | 46 |
import array
import math
from collections import defaultdict
class Graph(object):
def __init__(self, size):
self.inEdges = [[] for _ in range(size)]
self.outDegree = [0] * size
self.emptyNodes = []
self.nNode = size
def pagerank(graph, d, eps):
glen = graph.nNode
pg1, pg... | shaform/pagerank | python3/pagerank.py | Python | mit | 1,170 |
import csv
import sys
import logging
import os
import uuid
import psycopg2
import psycopg2.extras
if __name__ == '__main__':
arch = sys.argv[1]
salida = '{}_proceso.csv'.format(arch.replace('.','_'))
host = os.environ['HOST']
user = os.environ['USER']
passwd = os.environ['PASS']
base = os.envi... | pablodanielrey/scripts | docker/src/scripts/model/scripts/ingreso2018/importar.py | Python | gpl-3.0 | 2,028 |
#
# statusbar.py
#
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
#
# Deluge is free software.
#
# You may 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 lat... | voltaicsca/deluge | deluge/ui/gtkui/statusbar.py | Python | gpl-3.0 | 17,379 |
import numpy
import chainer
from chainer import backend
from chainer import function_node
from chainer.utils import type_check
class MeanAbsoluteError(function_node.FunctionNode):
"""Mean absolute error function."""
def check_type_forward(self, in_types):
type_check._argname(in_types, ('x0', 'x1'))... | tkerola/chainer | chainer/functions/loss/mean_absolute_error.py | Python | mit | 3,041 |
import io
from pdfminer.converter import TextConverter
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfpage import PDFPage
def extract_text_from_pdf(/Users/hmw/PycharmProjects/test/landrover.pdf):
resource_manager = PDFResourceManager()
fak... | BIMobject-Ben/test | pdf.py | Python | bsd-3-clause | 1,001 |
from alabtools.utils import Genome, Index
import h5py
import os
def test_genome_io():
g = Genome('hg38')
with h5py.File('./teststr.h5', 'w') as f:
g.save(f)
with h5py.File('./teststr.h5', 'r') as f:
g2 = Genome(f)
os.remove('./teststr.h5')
assert g == g2
def test_index_io():
... | alberlab/alabtools | test/test_utils.py | Python | gpl-3.0 | 974 |
# Create your views here.
from django.contrib.auth.models import Group
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestConte... | Ecotrust/PEW-EFH | mp/visualize/views.py | Python | apache-2.0 | 11,227 |
#!/usr/bin/python
# -*- coding: utf8 -*-
# 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, or (at your option) any later
# version.
#
# This program is distributed in the hope th... | reingart/pyafipws | padron.py | Python | gpl-3.0 | 25,098 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2017 GEM Foundation
#
# OpenQuake 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 Licen... | gem/oq-hazardlib | openquake/hazardlib/tests/gsim/garcia_2005_test.py | Python | agpl-3.0 | 2,163 |
a = {}
i = 0
while True :
a[i] = '1' * 100
i = i + 1
| watashi/zoj | judge_client/client/testdata/mle.py | Python | gpl-3.0 | 61 |
from google.appengine.ext import db
from google.appengine.api import memcache
class Stats(db.Model):
reviewTimeUnit = db.IntegerProperty(required=True) #milliseconds
reviewTimeUnitWeight = db.IntegerProperty(default=1)
def setDefaultStats():
stats = getStats()
stats.reviewTimeUnit = 30 * 24... | wighawag/ubh | app/stats/model.py | Python | agpl-3.0 | 1,324 |
import os
import re
import random
import datetime
class AlphaSubstBaseMLBootstrap:
"This package will perform bootstrap acoording to its parameters, and encapsulate the baseML functionality"
def __init__(self, ResultsFolder):
"Doc Holder"
self.ResultsFolder = ResultsFolder
self.BaseMLB... | jmchilton/galaxy-central | tools/mdea/AlphaSubstBaseMLBootstrap.py | Python | mit | 11,958 |
#!/usr/bin/python
import subprocess
import os
import shutil
import pty
master, slave = pty.openpty()
args = ('stdin1.py')
# popen = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd='.')
# http://stackoverflow.com/questions/5411780/python-run-a-daemon-sub-process-read-s... | jtraver/dev | python/subprocess/write2.py | Python | mit | 1,052 |
# -*- 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 'HoverImagePlugin'
db.create_table('cmsplugin_hoverimageplugin', (
('cmsplugin_pt... | CodeMill/cmsplugin-hoverimage | cmsplugin_hoverimage/migrations/0001_initial.py | Python | mit | 7,784 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mips.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| aniafijarczyk/django-mips | manage.py | Python | mit | 247 |
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-datacatalog | samples/snippets/data_catalog_ptm_create_taxonomy_test.py | Python | apache-2.0 | 992 |
import json
import datetime
from flask import Flask, render_template, request, redirect, url_for, session
from stock_tracer.common import MQClient
app = Flask(__name__)
app.secret_key = '\x14o\x93\xa5\xfe\xc1\xa8\xd2\x1b\xd1H\xd1\xfb=\xfd\x02\xff\x01\xa6 \x14g\xebr'
@app.route("/")
def home():
request_body = {}
... | ning-yang/stock_tracer | UI/home.py | Python | gpl-3.0 | 3,670 |
"""Weight Boosting
This module contains weight boosting estimators for both classification and
regression.
The module structure is the following:
- The ``BaseWeightBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regression and classification
only differ from each ot... | jmetzen/scikit-learn | sklearn/ensemble/weight_boosting.py | Python | bsd-3-clause | 40,739 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from .caffe_train import CaffeTrainTask,CaffeTrainSanityCheckError
from google.protobuf import text_format
from digits.config import config_value
# Must import after importing digit.config
import caffe
import ... | dongjoon-hyun/DIGITS | digits/model/tasks/test_caffe_sanity_checks.py | Python | bsd-3-clause | 5,932 |
#!/usr/bin/env python
import os, sys, json, copy
import multiprocessing
from HapMixWorkflow import *
class SimParams:
"""Object to store all the parameters of the simulation workflow"""
pass
def get_HapMix_params():
"""Get simulation parameters from command line and configuration file into a SimPa... | Illumina/HapMix | bin/submitHapMix.py | Python | gpl-3.0 | 7,446 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:6452")
else:
access = Ser... | ikarutoko/Tradercoin | Contrib/Bitrpc/bitrpc.py | Python | mit | 7,842 |
import unittest
from pbxproj.pbxsections.PBXFileReference import PBXFileReference
class PBXFileReferenceTest(unittest.TestCase):
def testPrintOnSingleLine(self):
obj = {"isa": "PBXFileReference", "name": "something"}
dobj = PBXFileReference().parse(obj)
self.assertEqual(dobj.__repr__(), "... | dayongxie/mod-pbxproj | tests/pbxsections/TestPBXFileReference.py | Python | bsd-3-clause | 1,491 |
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.Standby import getReasons
from Components.Sources.StaticText import StaticText
from Components.ChoiceList import ChoiceList, ChoiceEntryComponent
from Components.config import config, configfile
from Components.ActionMap import Act... | openNSS/enigma2 | lib/python/Screens/FlashImage.py | Python | gpl-2.0 | 22,428 |
from glanerbeard.web import app
from glanerbeard.default_settings import DEV_LISTEN_HOST, DEV_LISTEN_PORT
if __name__ == '__main__':
app.debug = True
app.run(DEV_LISTEN_HOST, DEV_LISTEN_PORT)
| daenney/glanerbeard | dev.py | Python | apache-2.0 | 195 |
#!/usr/bin/env python
# coding: utf-8
l = [9,8,7,6,5,4,3,2,1]
for x in range(len(l)-1,0,-1):
for y in range(0,x):
print l[y], l[y+1]
if l[y] > l[y+1]:
l[y], l[y+1] = l[y+1], l[y]
print l
raw_input("")
| 51reboot/actual_13_homework | 03/peter/paixu.py | Python | mit | 251 |
#!/usr/bin/env python
# This illustrates how to use SoCo plugins
# an example plugin is provided in soco.plugins.example.ExamplePlugin
import time
from soco import SoCo
from soco.plugins import SoCoPlugin
def main():
speakers = [speaker.ip_address for speaker in SoCo.discover()]
if not speakers:
p... | petteraas/SoCo | examples/plugins/socoplugins.py | Python | mit | 1,032 |
"""empty message
Revision ID: 251447ab2060
Revises: 53ac0b4e8891
Create Date: 2018-09-19 09:49:05.552597
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '251447ab2060'
down_revision = '53ac0b4e8891'
branch_labels = None
depends_on = None
def upgrade():
# ... | gems-uff/labsys | migrations/versions/2018-09-19_09:49:05__251447ab2060.py | Python | mit | 680 |
#
# Copyright (C) 2011 Red Hat, Inc.
#
# Author: Steven Dake <sdake@redhat.com>
# Angus Salkeld <asalkeld@redhat.com>
#
# 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
#... | sdake/pacemaker-cloud | src/pcloudsh/libvirt_deployable.py | Python | gpl-2.0 | 2,138 |
"""
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | pmutale/landing-page | mysite/wsgi.py | Python | gpl-3.0 | 383 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | scripnichenko/nova | nova/api/openstack/compute/legacy_v2/contrib/flavormanage.py | Python | apache-2.0 | 4,241 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... | FederatedAI/FATE | python/fate_client/pipeline/param/encrypt_param.py | Python | apache-2.0 | 1,481 |
###############################################################################
# Copyright 2016 - Climate Research Division
# Environment and Climate Change Canada
#
# This file is part of the "EC-CAS diags" package.
#
# "EC-CAS diags" is free software: you can redistribute it and/or modify
# it under... | neishm/EC-CAS-diags | eccas_diags/interfaces/eccas_dry.py | Python | lgpl-3.0 | 5,553 |
# -*- coding: utf-8 -*-
#
# This file is part of Lumberjack.
# Copyright 2014 CERN.
#
# Lumberjack is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) an... | egabancho/lumberjack | lumberjack/api.py | Python | gpl-3.0 | 4,727 |
# Always prefer setuptools over distutils
from os import path
try:
from setuptools import setup
except ImportError:
print("warning: you do not have setuptools installed - cannot use \"develop\" option")
from distutils.core import setup
here = path.abspath(path.dirname(__file__))
# Get the long description... | olliemath/Python-TinyEvolver | setup.py | Python | gpl-2.0 | 1,555 |
#!/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... | kustodian/ansible | lib/ansible/modules/network/fortios/fortios_system_replacemsg_alertmail.py | Python | gpl-3.0 | 10,160 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import shutil
import threading
from pyload.manager.Event import AccountUpdateEvent
from pyload.utils import lock
ACC_VERSION = 1
class AccountManager(object):
"""Manages all accounts"""
def __init__(self, core):
"""Construct... | ardi69/pyload-0.4.10 | pyload/manager/Account.py | Python | gpl-3.0 | 5,902 |
from .buffer import TextModification, Buffer
from .buffer_history import BufferHistory
from .buffer_manipulator import BufferManipulator
from .cursor import Cursor, ModifiedCursor
from .span import Span, Region
from .selection import Selection
| sam-roth/Keypad | keypad/buffers/__init__.py | Python | gpl-3.0 | 247 |
# ----------------------------------------------------------------------------
# pymunk
# Copyright (c) 2007-2011 Victor Blomqvist
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without re... | saintdragon2/python-3-lecture-2015 | civil_mid_mid/pymunk-4.0.0/pymunk/vec2d.py | Python | mit | 16,281 |
# -*- 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 'Sewer.the_geom_length'
db.add_column('lizard_riool_sewer', 'the_geom_length',
... | lizardsystem/lizard-riool | lizard_riool/migrations/0016_auto__add_field_sewer_the_geom_length.py | Python | gpl-3.0 | 8,963 |
from datetime import timedelta
from flask import current_app
from app import performance_platform_client
from app.dao.notifications_dao import (
dao_get_total_notifications_sent_per_day_for_performance_platform,
)
from app.utils import get_london_midnight_in_utc
def send_processing_time_to_performance_platform(... | alphagov/notifications-api | app/performance_platform/processing_time.py | Python | mit | 1,472 |
import unittest
import Queue
import time
from walky.worker import *
from _common import *
class MyWorkerRequest(WorkerRequest):
def __init__(self):
self.q = []
def execute(self):
self.q.append("TEST")
class Test(unittest.TestCase):
def test_execute(self):
# Execute our test ob... | amimoto/walky | tests/067-workers.py | Python | mit | 1,412 |
from functools import wraps
from flask import request
from flask_login import current_user
from app.api.errors import forbidden, unauthorized
EXEMPT_METHODS = set(['OPTIONS'])
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
... | mapan1984/Hidden-Island | app/api/decorators.py | Python | mit | 973 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import HTMLParser
import urllib
from frappe import msgprint, throw, _
from frappe.email.smtp import SMTPServer, get_outgoing_email_account
from frappe.email.email... | gangadharkadam/letzfrappe | frappe/email/bulk.py | Python | mit | 5,170 |
"""Determine the layer plane angle of all the elements in a grid.
Author: Perry Roth-Johnson
Last modified: April 30, 2014
Usage:
1. Look through the mesh_stnXX.abq file and find all the element set names.
(Find all the lines that start with "*ELSET".)
2. Enter each of the element set names in one of the f... | perryjohnson/biplaneblade | biplane_blade_lib/layer_plane_angles_stn22.py | Python | gpl-3.0 | 9,221 |
"""
raven.transport.threaded
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import atexit
import logging
import time
import threading
import os
from Queue import Queue
from raven.transport.base import HTTPTransport... | mozilla/verbatim | vendor/lib/python/raven/transport/threaded.py | Python | gpl-2.0 | 3,097 |
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the useful functions provided by this module:... | PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/inspect.py | Python | gpl-2.0 | 103,929 |
#!/sw/bin/python2.7
import sys
sys.path.append("..")
from ucnacore.PyxUtils import *
from math import *
from ucnacore.LinFitter import *
#from UCNAUtils import *
from bisect import bisect
from calib.FieldMapGen import *
def clip_function(y,rho,h,R):
sqd = sqrt(rho**2-y**2)
if sqd==0:
sqd = 1e-10
return h*rho**2... | UCNA/main | Scripts/plotters/LarmorClipping.py | Python | gpl-3.0 | 8,636 |
#!/usr/bin/env python
# snakeoil.py
# Chris X Edwards <snakeoil@xed.ch>
# Snake Oil is a Python library for interfacing with a TORCS
# race car simulator which has been patched with the server
# extentions used in the Simulated Car Racing competitions.
# http://scr.geccocompetitions.com/
#
# To use it, you must import ... | sneharavi12/DeepLearningFinals | SelfDrivingRL/snakeoil3_gym.py | Python | mit | 24,145 |
from keras import backend as K
from keras import initializations
from keras.backend.common import _EPSILON
from keras.engine.topology import Layer
from keras.engine import InputSpec
from theano.tensor.nnet import h_softmax
import theano.tensor as T
class HierarchicalSoftmax(Layer):
def __init__(self, output... | jstarc/nli_generation | hierarchical_softmax.py | Python | mit | 2,566 |
# coding: utf-8
# This file is part of https://github.com/marcus67/rechtschreibung
import os
import io
import re
import pickle
import six
import log
import util
import spelling_mode
import predefined_modes
if six.PY3:
from importlib import reload
reload(log)
reload(util)
reload(spelling_mode)
reload(predefined_mo... | marcus67/rechtschreibung | mode_manager.py | Python | gpl-2.0 | 2,386 |
# coding=UTF-8
# Author: Dennis Lutter <lad1337@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 ... | rleadbetter/Sick-Beard | tests/pp_tests.py | Python | gpl-3.0 | 5,084 |
# -*- coding: utf-8 -*-
import os
import shutil
import exodus
from sets import Set
import numpy as np
DEFAULT_BLOCK = 1
TIMESTEP_ZERO = 1
def getElemsAndNodes(input_file):
"Gets the number of elements and nodes per elements in `input_file`"
exo_from = exodus.exodus(input_file,"r",array_type='ctype')
B... | SalvusHub/salvus | src/py/pysalvus/model_handling/model.py | Python | mit | 3,058 |
from __future__ import absolute_import
import os
import time
INTEGRATION_TESTS = os.environ.get('INTEGRATION_TESTS', False)
if INTEGRATION_TESTS:
from compose.cli.command import get_project
from compose.service import BuildAction
class ComposeMixin(object):
"""
Manage docker-compose to ensure that... | roncohen/apm-server | _beats/libbeat/tests/system/beat/compose.py | Python | apache-2.0 | 2,043 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('post', '0006_auto_20150713_1356'),
]
operations = [
migrations.AlterField(
model_name='post',
name='... | 28harishkumar/Social-website-django | post/migrations/0007_auto_20150713_1410.py | Python | mit | 517 |
import clr, sys
clr.AddReference('ZyGames.Framework.Common');
clr.AddReference('ZyGames.Framework');
clr.AddReference('ZyGames.Framework.Game');
clr.AddReference('ZyGames.Tianjiexing.Model');
clr.AddReference('ZyGames.Tianjiexing.BLL');
clr.AddReference('ZyGames.Tianjiexing.Lang');
clr.AddReference('ZyGames.Tia... | wenhulove333/ScutServer | Sample/Koudai/Server/src/ZyGames.Tianjiexing.Server/Script/PyScript/Action/action12102.py | Python | mit | 7,626 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | nsnam/ns-3-dev-git | src/antenna/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 124,960 |
# -*- coding: utf-8 -*-
# config.py
from authomatic.providers import oauth2, oauth1, openid, gaeopenid
CONFIG = {
'tw': { # Your internal provider name
# Provider class
'class_': oauth1.Twitter,
# Twitter is an AuthorizationProvider so we need to set several
# other properties ... | jasco/authomatic | examples/gae/extras/config-template.py | Python | mit | 1,223 |
# Generated by Django 3.2.4 on 2021-08-12 12:36
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('course', '0051_auto_20210812_1536'),
('news', '0003_alter_news_audience'),
]
o... | teemulehtinen/a-plus | news/migrations/0004_auto_20210812_1536.py | Python | gpl-3.0 | 1,831 |
# coding: utf-8
"""
Constants used across the app.
"""
from __future__ import absolute_import, print_function, unicode_literals
from enum import Enum
# Some backends give more infos than others. Here is the precedence we want to
# use. First is most important one, last is the one that will always be
# considered as l... | Phyks/Flatisfy | flatisfy/constants.py | Python | mit | 599 |
import os.path
import yaml
default_configuration = {
'solder': {
'database': {
'host': 'localhost',
'user': '',
'password': '',
'db': '',
'port': 3306
},
'directories': {
'sol... | DocHoncho/solder-cli | solder/config.py | Python | gpl-2.0 | 1,672 |
import pygame
from event_manager import Listener
from entity import Entity
import sprites
import models
import events
import time
class Pygame(Listener):
"""
Pygame is a Listener class that handles all
graphics updates with the PyGame library.
"""
WHITE = (255, 255, 255)
FONT_NO_ANTIALIASING... | viswimmer1/PythonGenerator | data/python_files/29417298/views.py | Python | gpl-2.0 | 6,599 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack, LLC
# 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/... | SUSE-Cloud/glance | glance/store/scrubber.py | Python | apache-2.0 | 20,254 |
class GCodeLayerMixer(object):
def __init__(self, source):
self.lines = self._generate(source)
self.buffer = [ ]
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
if len(self.buffer) == 0:
self._populate_buffe... | PeachyPrinter/peachytoolchain | src/util/gcode_layer_mixer.py | Python | gpl-3.0 | 1,641 |
# -*- coding: utf-8 -*-
from rest_framework_extensions.test import APITestCase
from rest_framework_extensions.settings import extensions_api_settings
from rest_framework_extensions import utils
from .urls import urlpatterns
from .models import CommentForListDestroyModelMixin as Comment
from tests_app.testutils import ... | ticosax/drf-extensions | tests_app/tests/functional/mixins/list_destroy_model_mixin/tests.py | Python | mit | 3,257 |
import os
from abc import ABCMeta
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import tensorlight as light
import base
class MNISTBaseDataset(base.AbstractDataset):
"""MNIST base dataset wrapping the functions provided by tensorflow."""
__metaclass__ ... | bsautermeister/tensorlight | tensorlight/datasets/mnist.py | Python | mit | 4,084 |
"""
Django settings for avalon project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Bu... | dperelman/avalon-django | avalon/avalon/settings.py | Python | agpl-3.0 | 3,366 |
class Movement:
def __init__(self):
self.motions = list()
def append_motion(self, motion=None):
self.motions.append(motion)
def get_maximum_duration(self) -> int:
"""
>>> from Watchdog import Main
>>> main = Main()
>>> from MessageReader import MessageReader... | idobrusin/RocLang | RocDemo/roc_node/scripts/models/Movement.py | Python | mit | 742 |
import unittest
# http://blog.csdn.net/pointbreak1/article/details/48780345
def groupStrings(strings):
groups = {}
for s in strings:
s_hash = hashStr(s)
if s_hash not in groups:
groups[s_hash] = [s]
else:
groups[s_hash].append(s)
result = []
for key, val... | LeonardCohen/coding | py/group_shifted_strings.py | Python | gpl-2.0 | 947 |
from flask import Flask
def create_app(config_filename):
app = Flask(__name__)
app.config.from_object(config_filename)
from models import db
db.init_app(app)
from views import api_bp
app.register_blueprint(api_bp, url_prefix='/api')
return app
| abacuspix/NFV_project | Build_Flask_API/restful_python_section_07/api/app.py | Python | mit | 277 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import datetime
import asyncio
import aiohttp
import numpy as np
from ... import core
from ... import util
class Flukso(core.plugin.Plugin):
"""
Retrieve data from a Fluksometer
"""
def initialize(self):
... | BrechtBa/homeconn | homecon/plugins/flukso/__init__.py | Python | gpl-3.0 | 2,862 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Copyright 2012-2015 OpenBroadcaster, Inc.
This file is part of OpenBroadcaster Player.
OpenBroadcaster Player 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... | openbroadcaster/obplayer | obplayer/offair_audiolog/__init__.py | Python | agpl-3.0 | 1,098 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.