text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-"
import sys
import threading
from celery.datastructures import ExceptionInfo
from celery.exceptions import MaxRetriesExceededError, RetryTaskError
from celery.execute.trace import TaskTrace
from celery.registry import tasks, _unpickle_task
from celery.result import EagerResult
from celery.utils... | WoLpH/celery | celery/app/task/__init__.py | Python | bsd-3-clause | 27,392 | 0.000548 |
# The content of this file was generated using the Python profile of libCellML 0.2.0.
from enum import Enum
from math import *
__version__ = "0.3.0"
LIBCELLML_VERSION = "0.2.0"
STATE_COUNT = 3
VARIABLE_COUNT = 19
class VariableType(Enum):
VARIABLE_OF_INTEGRATION = 1
STATE = 2
CONSTANT = 3
COMPUTED... | cellml/libcellml | tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py | Python | apache-2.0 | 5,138 | 0.00506 |
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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)
... | riveridea/gnuradio | gr-digital/python/digital/psk_constellations.py | Python | gpl-3.0 | 6,937 | 0.006631 |
from __future__ import print_function
import os
import sys
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from h2o.estimators.infogram import H2OInfogram
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
from tests import pyunit_utils
def test_infogram_personal_loan():
"""
Test to ... | h2oai/h2o-3 | h2o-py/tests/testdir_algos/infogram/pyunit_PUBDEV_8075_safe_infogram_personal_loan_x_att.py | Python | apache-2.0 | 1,365 | 0.01685 |
"""
Positional arguments:
1. INPUT - file path to FASTA file
2. OUTPUT - file path of output PIR file
"""
import sys
PIR = sys.argv[1]
FASTA = sys.argv[2]
from modeller import *
e = environ()
a = alignment(e, file = PIR, alignment_format = 'PIR')
a.write(file = FASTA, alignment_format = 'FASTA')
| meren/anvio | anvio/data/misc/MODELLER/scripts/pir_to_fasta.py | Python | gpl-3.0 | 298 | 0.030201 |
import sys
if sys.version_info < (3, 7):
from ._opacity import OpacityValidator
from ._color import ColorValidator
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._opacity.OpacityValidator", "._color.ColorValidator"]
... | plotly/python-api | packages/python/plotly/plotly/validators/histogram/unselected/marker/__init__.py | Python | mit | 325 | 0 |
#
# actions.py: routines that actually run the svn client.
#
# Subversion is a tool for revision control.
# See http://subversion.tigris.org for more information.
#
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more con... | centic9/subversion-ppa | subversion/tests/cmdline/svntest/actions.py | Python | apache-2.0 | 86,069 | 0.011468 |
#cash register
#Samuel Armstrong
| samuelarm/A-Level_2016-18 | general/cash register.py | Python | gpl-3.0 | 45 | 0.088889 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/models/notary_journal_list.py | Python | mit | 9,255 | 0.000108 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v10/enums/types/seasonality_event_status.py | Python | apache-2.0 | 1,255 | 0.000797 |
'''
Integration Test Teardown case
@author: Youyk
'''
import zstacklib.utils.linux as linux
import zstacklib.utils.http as http
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.clean_util as clean_util
import zstackwoodpecker.test_lib as te... | zstackio/zstack-woodpecker | integrationtest/vm/vpc_ha/suite_teardown.py | Python | apache-2.0 | 1,332 | 0.005255 |
# -*-mode: python; py-indent-offset: 4; tab-width: 8; coding: iso-8859-1 -*-
# DLLM (non-linear Differentiated Lifting Line Model, open source software)
#
# Copyright (C) 2013-2015 Airbus Group SAS
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Pub... | matthieu-meaux/DLLM | examples/broken_wing_validation/valid_dpR_dpiAoA.py | Python | gpl-2.0 | 2,233 | 0.012987 |
# Copyright 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | masayukig/tempest | tempest/api/compute/test_extensions.py | Python | apache-2.0 | 2,098 | 0 |
"""
odtreader.py
Contains class ODTFile for reading OOMMF ODT data into a Pandas dataframe
Author: Ryan Pepper (2016)
University of Southampton
"""
import pandas as pd
import tempfile
import re
class ODTFile(object):
def __init__(self, filename):
f = open(filename)
# Can't use 'w+b' for compatibility... | fangohr/oommf-python | joommf/odtreader.py | Python | bsd-2-clause | 1,380 | 0 |
# -*- 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):
# Changing field 'Screen.page_id'
db.alter_column(u'synch_screen', 'page_id', self.gf('django.db.models.fie... | ianfhunter/LoLss | secondscreen/synch/migrations/0002_auto__chg_field_screen_page_id.py | Python | gpl-2.0 | 3,281 | 0.007315 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | 99cloud/keystone_register | horizon/test/tests/tables.py | Python | apache-2.0 | 31,356 | 0.000128 |
class Solution(object):
def combinationSum3(self, k, n):
"""
:type k: int
:type n: int
:rtype: List[List[int]]
"""
def dfs(s, n):
if len(path) >= k:
if n == 0:
result.append(path[:])
return
fo... | zqfan/leetcode | algorithms/216. Combination Sum III/solution2.py | Python | gpl-3.0 | 557 | 0 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*
#The MIT License (MIT)
# Copyright (c) 2015 daite
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitat... | daite/JAVImageDownloader | jav_image_download.py | Python | mit | 3,951 | 0.026069 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-15 17:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0005_auto_20170915_1015'),
]
operations = [
migrations.AddFiel... | kennethlove/django_bookmarks | dj_bookmarks/bookmarks/migrations/0006_bookmark_collections.py | Python | bsd-3-clause | 476 | 0 |
from time import sleep
from icoin import app
from icoin.core.mail import mail, send
class TestMail:
def test_send_sync(self):
with app.app_context(), mail.record_messages() as outbox:
send("test@test.com", "subjectnow", "test", async=False)
assert len(outbox) == 1
... | loomchild/icoin | test/integration_test/test_mail.py | Python | agpl-3.0 | 727 | 0.009629 |
# ~*~ coding: utf-8 ~*~
from celery import shared_task
from django.utils.translation import ugettext as _, gettext_noop
from common.utils import get_logger
from orgs.utils import org_aware_func
from ..models import Connectivity
from . import const
from .utils import check_asset_can_run_ansible
logger = get_logger(_... | jumpserver/jumpserver | apps/assets/tasks/account_connectivity.py | Python | gpl-3.0 | 2,991 | 0.000335 |
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
{
'name': 'Account Alternate Invoice',
'version': '7.0.1.0.0',
'author': 'Elico Corp',
'website': 'https://www.elico-corp.com',
'description': """
Acco... | Elico-Corp/openerp-7.0 | account_alternate_invoice/__openerp__.py | Python | agpl-3.0 | 580 | 0.003454 |
import six
from unittest import TestCase
from dark.reads import Read
from dark.local_align import LocalAlignment
class TestLocalAlign(TestCase):
"""
Test the LocalAlignment class.
With match +1, mismatch -1, gap open -1, gap extend -1 and
gap extend decay 0.0.
"""
def testPositiveMismatch... | terrycojones/dark-matter | test/test_local_align.py | Python | mit | 11,532 | 0 |
# -*- coding: utf-8 -*-
from twisted.web.resource import Resource
from bouser.helpers.plugin_helpers import Dependency
__author__ = 'viruzzz-kun'
class SimarglResource(Resource):
web = Dependency('bouser.web')
es = Dependency('bouser.ezekiel.eventsource', optional=True)
rpc = Dependency('bouser.ezekiel.... | hitsl/bouser_simargl | bouser_simargl/web.py | Python | isc | 577 | 0 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = [
os.path.join(BASE_DIR, 'tests'),
os.path.join(BASE_DIR, 'tri_form/templates'),
]
TEMPLATE_DEBUG = True
# Django >=1.9
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': TEM... | TriOptima/tri.form | tests/settings.py | Python | bsd-3-clause | 710 | 0 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | jerome-jacob/selenium | py/test/selenium/webdriver/common/page_loading_tests.py | Python | apache-2.0 | 5,014 | 0.007579 |
import copy
import re
import sys
import tempfile
import unittest
from mock.tests.support import ALWAYS_EQ
from mock.tests.support import is_instance
from mock import (
call, DEFAULT, patch, sentinel,
MagicMock, Mock, NonCallableMock,
NonCallableMagicMock, AsyncMock,
create_autospec, mock
)
from mock.mo... | testing-cabal/mock | mock/tests/testmock.py | Python | bsd-2-clause | 72,280 | 0.002048 |
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated 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 option) any later version.
#
# Pixelated is distrib... | pixelated-project/pixelated-user-agent | service/test/unit/adapter/test_mailbox_indexer_listener.py | Python | agpl-3.0 | 2,690 | 0.003717 |
from django.db import models, migrations
import uuid
from django.contrib.auth.hashers import make_password
PUBLIC_ID = 1
def apply_migration(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
public_group = Group()
public_group.name = "public"
public_group.id = PUBLIC_ID
public_group.sav... | kartta-labs/noter-backend | noter_backend/main/migrations/0003_create_public_group.py | Python | apache-2.0 | 664 | 0.003012 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | sailfish-sdk/sailfish-qtcreator | scripts/common.py | Python | gpl-3.0 | 7,269 | 0.003027 |
"""
class to test test_simple_function.py
follows the standards in https://docs.python.org/2/library/unittest.html
"""
import unittest
from LOTlib.Examples.SymbolicRegression.old.test_simple_function import *
class test_simple_functionTest(unittest.TestCase):
# initialization that happens before each test is car... | ebigelow/LOTlib | LOTlib/Testing/old/Examples/SymbolicRegression/old/test_simple_functionTest.py | Python | gpl-3.0 | 522 | 0.007663 |
from django.core.management.base import BaseCommand, CommandError
try:
from django.contrib.auth import get_user_model # Django 1.5
except ImportError:
from django_extensions.future_1_5 import get_user_model
from django.contrib.sessions.models import Session
import re
SESSION_RE = re.compile("^[0-9a-f]{20,40}$... | shash/IconDB | django_extensions/management/commands/print_user_for_session.py | Python | agpl-3.0 | 1,826 | 0 |
from django import forms
from django.contrib.auth.models import User
from .models import Perfil,SolicitudColaboracion
class SolicitudColaboracionForm(forms.ModelForm):
class Meta:
model = SolicitudColaboracion
fields = ('name','licenciatura_leyes','telefono','fecha_nacimiento')
| SurielRuano/Orientador-Legal | colaboradores/forms.py | Python | mit | 287 | 0.031359 |
#!/usr/bin/env python
import glob
import copy
import cv2
import cv_bridge
import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import Int32, Float32, String
import rospkg
class Hear_orders:
def __init__(self):
self.speech_subscriber = rospy.Subscriber("/speech_recognition", String, self.publi... | UCRoboticsLab/BaxterTictactoe | src/baxter_face_animation/src/baxter_face_animation/hear_words.py | Python | apache-2.0 | 926 | 0.009719 |
__author__ = 'rcj1492'
__created__ = '2016.10'
__license__ = 'MIT'
def retrieve_service_name(service_root):
service_name = ''
# construct registry client
from os import path
from pocketlab import __module__
from labpack.storage.appdata import appdataClient
registry_client = appdataCli... | collectiveacuity/pocketLab | pocketlab/methods/service.py | Python | mit | 8,378 | 0.005132 |
from __future__ import division
import numpy as np
# Non-monotonic Sobol G Function (8 parameters)
# First-order indices:
# x1: 0.7165
# x2: 0.1791
# x3: 0.0237
# x4: 0.0072
# x5-x8: 0.0001
def evaluate(values, a=None):
if type(values) != np.ndarray:
raise TypeError("The argument `values` m... | willu47/SALib | src/SALib/test_functions/Sobol_G.py | Python | mit | 1,685 | 0.003561 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2019, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 t... | Ginfung/FSSE | Algorithms/WORTHY.py | Python | mit | 7,356 | 0.000952 |
import unittest
from numpy import arange, linspace
from numpy.random import seed
from src.bases.root import Root
from src.examples.example_setups import setup_stat_scm
from src.utils.sem_utils.toy_sems import StationaryDependentSEM as StatSEM
from src.utils.sequential_intervention_functions import get_interventional_g... | neildhir/DCBO | tests/test_root.py | Python | mit | 5,136 | 0.003118 |
from ..config import GlobalConfig, LocalConfig
from kao_command.args import FlagArg
class ProjectArg(FlagArg):
""" Represents an CLI Argument that specifies a Project """
def __init__(self, *, help):
""" Initialize the Arg """
FlagArg.__init__(self, '-p', '--project', action="store... | cloew/TogglDriver | toggl_driver/args/project_arg.py | Python | mit | 547 | 0.007313 |
# -*- coding: utf-8 -*-
#=======================================================================
#
# Python Lexical Analyser
#
# Converting NFA to DFA
#
#=======================================================================
import Machines
from Machines import LOWEST_PRIORITY
from Transitions import TransitionMa... | unioslo/cerebrum | Cerebrum/extlib/Plex/DFA.py | Python | gpl-2.0 | 5,539 | 0.015165 |
#!/usr/bin/env python3
# Copyright (C) 2016 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import sys
def testfunc(child):
child.expect(r"TRACE_SIZE: (\d+... | MichelRottleuthner/RIOT | tests/trace/tests/01-run.py | Python | lgpl-2.1 | 676 | 0 |
#!/usr/bin/env python
import os
from pyaxo import Axolotl
# start with a fresh database
try:
os.remove('./alice.db')
os.remove('./bob.db')
except OSError:
pass
# unencrypted databases
a = Axolotl('alice', dbname='alice.db', dbpassphrase=None)
b = Axolotl('bob', dbname='bob.db', dbpassphrase=None)
a.in... | ghtdak/pyaxo | examples/create_states.py | Python | gpl-3.0 | 539 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-04-22 07:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('voting', '0004_winner_annoucement'),
]
operations = [
migrations.AddField(
... | SAlkhairy/trabd | voting/migrations/0005_add_is_city_results_due_for_SACYear.py | Python | agpl-3.0 | 1,341 | 0.002237 |
from __future__ import division
import numpy as np
import pytest
from pandas import Interval, Timedelta, Timestamp
import pandas.core.common as com
@pytest.fixture
def interval():
return Interval(0, 1)
class TestInterval(object):
def test_properties(self, interval):
assert interval.closed == 'rig... | GuessWhoSamFoo/pandas | pandas/tests/scalar/interval/test_interval.py | Python | bsd-3-clause | 7,179 | 0 |
#!/usr/bin/env python
import sys,logging,optparse
from AlpgenArgoJob import AlpgenArgoJob
sys.path.append('/users/hpcusers/balsam/argo_deploy/argo_core')
from MessageInterface import MessageInterface
def main():
parser = optparse.OptionParser(description='submit alpgen job to ARGO')
parser.add_option('-e','--ev... | hep-cce/hpc-edge-service | argo/test_jobs/test_submit_alpgen.py | Python | bsd-3-clause | 2,987 | 0.035152 |
#
# Copyright 2016 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | oVirt/vdsm | tests/throttledlog_test.py | Python | gpl-2.0 | 3,280 | 0 |
import logging
from django.http import HttpResponseBadRequest, HttpResponseForbidden
from functools import wraps
import groupbank_crypto.ec_secp256k1 as crypto
logger = logging.getLogger(__name__)
# decorator for verifying the payload is signed by the author of the request
def verify_author(view):
@wraps(view... | GroupBank/global-server | rest_app/decorators.py | Python | agpl-3.0 | 1,619 | 0.001853 |
# -*- coding: utf-8 -*-
"""
morphsnakes
===========
This is a Python implementation of the algorithms introduced in the paper
Márquez-Neila, P., Baumela, L., Álvarez, L., "A morphological approach
to curvature-based evolution of curves and surfaces". IEEE Transactions
on Pattern Analysis and Machine Intelligence... | braysia/CellTK | celltk/utils/morphsnakes.py | Python | mit | 11,905 | 0.011937 |
# -*- coding: utf-8 -*-
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.MessageBox import MessageBox
from Components.ActionMap import NumberActionMap
from Components.Pixmap import Pixmap
from Components.Sources.StaticText import StaticText
from Components.MenuList import MenuL... | XTAv2/Enigma2 | lib/python/Screens/SkinSelector.py | Python | gpl-2.0 | 5,279 | 0.028793 |
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from __future__ import print_function, unicode_literals
import logging
from django.http import HttpResponse, HttpResponseServerError, HttpResponseBadRequest
from django.conf import settings
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.ht... | eHealthAfrica/rapidsms_textit | rapidsms_textit/views.py | Python | bsd-3-clause | 3,591 | 0.004456 |
# Copyright (c) <2015> <Sergi Delgado Segura>
# Distributed under the BSD software license, see the accompanying file LICENSE
import pycurl
import stem.process
from stem.control import Controller
from stem.util import term
from StringIO import StringIO
__author__ = 'sdelgado'
SOCKS_PORT = 9050
CONTROL_PORT = 9051
... | sr-gi/paysense | utils/tor/tools.py | Python | bsd-3-clause | 2,930 | 0.001706 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Litecoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
in... | SpoonITCurrency/SpoonITCoin | spoonitcoin/share/qt/clean_mac_info_plist.py | Python | mit | 897 | 0.016722 |
#!/usr/bin/env python3
# dirtool.py - diff tool for directories
# Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.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 3 of the Li... | Grumbel/dirtool | experiments/qnotify/qnotify.py | Python | gpl-3.0 | 1,673 | 0 |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from django.test import RequestFactory
from exam import fixture
from sentry.middleware.user import UserActiveMiddleware
from sentry.testutils import TestCase
class UserActiveMiddlewareTest(TestCase):
middlewa... | ifduyue/sentry | tests/sentry/middleware/test_useractive.py | Python | bsd-3-clause | 912 | 0 |
# 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... | Acehaidrey/incubator-airflow | airflow/providers/google/suite/transfers/sql_to_sheets.py | Python | apache-2.0 | 5,101 | 0.00196 |
#!/usr/bin/env python
import sys
import glob
import hdfs3
from hdfs3 import HDFileSystem
hdfs_nn = '192.168.33.10'
hdfs = HDFileSystem(host=hdfs_nn, port=8020)
class TransparentFileSystem:
def __init__(self):
self.hdfs_flag = False
return
def set_hdfs_flag(self, flag=True):
self.hd... | hirolovesbeer/tfs | tfs.py | Python | apache-2.0 | 1,111 | 0.0027 |
from nose.tools import eq_, ok_, raises
import wtforms
from flask import Flask
from mongoengine import *
from flask_superadmin import Admin
from flask_superadmin.model.backends.mongoengine.view import ModelAdmin
class CustomModelView(ModelAdmin):
def __init__(self, model, name=None, category=None, endpoint=Non... | syrusakbary/Flask-SuperAdmin | flask_superadmin/tests/test_mongoengine.py | Python | bsd-3-clause | 9,707 | 0.001751 |
#!/usr/bin/python
#
# Simple indication receiver using Twisted Python. HTTP post requests
# are listened for on port 5988 and port 5899 using SSL.
#
# Requires Twisted Python and
#
import sys
import optparse
import pywbem
from twisted.internet import reactor
from twisted.web import server, resource
global conn
conn=... | zenoss/pywbem | attic/irecv/pycimlistener.py | Python | lgpl-2.1 | 6,068 | 0.012525 |
import pytest
import responses
from urlobject import URLObject
from flask import Flask
from flask_dance.contrib.github import make_github_blueprint, github
from flask_dance.consumer import OAuth2ConsumerBlueprint
from flask_dance.consumer.storage import MemoryStorage
@pytest.fixture
def make_app():
"A callable to... | singingwolfboy/flask-dance | tests/contrib/test_github.py | Python | mit | 2,744 | 0.001093 |
"""
Created on 1 May 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
https://www.sensirion.com/en/environmental-sensors/particulate-matter-sensors-pm25/
https://bytes.com/topic/python/answers/171354-struct-ieee-754-internal-representation
Firmware report:
89667EE8A8B34BC0
"""
import time
from scs_c... | south-coast-science/scs_dfe_eng | src/scs_dfe/particulate/sps_30/sps_30.py | Python | mit | 8,991 | 0.008008 |
#!/usr/bin/env python
"""
Display the planar concentration and velocity fields of a RMPCDMD simulation.
"""
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('file', help="H5MD file")
parser.add_argument('--species', type=int, default=0)
args = parser.parse_args()
import h5py
i... | pdebuyl-lab/RMPCDMD | experiments/03-single-janus/plot_planar.py | Python | bsd-3-clause | 1,110 | 0.00991 |
#!/usr/bin/env python
"""
A basic demo of pandas
"""
from pandas import DataFrame
df = DataFrame(["a", "b", "c"], index=[("0", "1"), ("1", "2"), ("2", "3")])
print(df.get_values())
try:
print(df.ix[("0", "1")])
except:
print("yes, accessing .ix with tuple does not work")
print(df.xs(("0", "1")))
| veltzer/demos-python | src/examples/short/pandas/tuples_as_indices.py | Python | gpl-3.0 | 308 | 0.003247 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2017 Red Hat, 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 applica... | sileht/pastamaker | pastamaker/gh_pr_fullifier.py | Python | apache-2.0 | 9,306 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import uuid
class Migration(migrations.Migration):
dependencies = [
('ISS', '0011_poster_timezone'),
]
operations = [
mi... | RyanJenkins/ISS | ISS/migrations/0012_privatemessage.py | Python | gpl-3.0 | 1,032 | 0.004845 |
"""fix stock again (17.03.16)
Revision ID: 3b3de4db8006
Revises: 1b434f6a7b5
Create Date: 2016-03-17 22:02:55.090285
"""
# revision identifiers, used by Alembic.
revision = '3b3de4db8006'
down_revision = '1b434f6a7b5'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrad... | atlefren/beerdatabase | alembic/versions/3b3de4db8006_fix_stock_again_17_03_16.py | Python | mit | 642 | 0.004673 |
import xmltodict
def parseData(data):
try:
return xmltodict.parse(data)
except:
if len(data.split()) is 0:
return None
else:
raise Exception('Invalid XML data', data)
| ColinKeigher/McAfeeWebGateway | mwg/parse.py | Python | gpl-2.0 | 236 | 0.012712 |
import os
import shutil
import subprocess
import sys
import tempfile
import threading
_g_failed = []
def this_location():
return os.path.abspath(os.path.dirname(__file__))
def checkenv(sd_license, release, ssh_key_path):
required_vars = ['AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY',... | stardog-union/stardog-graviton | release/release.py | Python | apache-2.0 | 8,041 | 0.000871 |
# Sends GET to local server
# Author: schdub
#!/usr/bin/python
import socket
import sys
def GET(host, path, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(0.30)
s.connect((host, port))
s.send("GET %s HTTP/1.0\r\n" % (path))
total_data = []
while True:
data = s... | MrOnlineCoder/shockd | scripts/get.py | Python | mit | 523 | 0.00956 |
#! /usr/bin/env python3
#
# importing_modules.py
#
# Author: Billy Wilson Arante
# Created: 2/24/2016 PHT
#
import fibo
def test():
"""Test cases."""
print('Example 1:')
fibo.fib(1000)
print('Example 2:')
print(fibo.fib1(1000))
print('Example 3:')
print(fibo.__name__)
# Assign... | arantebillywilson/python-snippets | py3/py344-tutor/ch06-modules/importing_modules.py | Python | mit | 444 | 0.004505 |
#!/usr/bin/env python3
#
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2020 Damien P. George
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... | kerneltask/micropython | tools/metrics.py | Python | mit | 7,086 | 0.001129 |
import asyncio
from aiohttp.web import Application
from Todos import handlers
def create_server(loop, handler, host, port):
srv = loop.create_server(handler, host, port)
return loop.run_until_complete(srv)
def create_app(loop):
app = Application(loop=loop)
handler = app.make_handler()
return app... | alexeyraspopov/aiohttp-mongodb-example | server.py | Python | mit | 1,357 | 0 |
# This was pulled from one of the python/opencv sites appearing
# in a Google search. Need to find site and add attribution!
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# USAGE: You need to specify a filter and "only one" image source
#
# (python) range-detector --filter RGB --image /path/to/image.png
# or
# (pytho... | jgerschler/ESL-Games | Camera Pistol/range-detector.py | Python | mit | 1,679 | 0.004169 |
#!/usr/bin/env python2.6
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import cgi
import SocketServer
import ssl
import re
import setproctitle
import others.dict2xml as dict2xml
import sober.config
import sober.settings
import sober.rule
__version__ = 'Sober HTTP/1.0'
_... | theflockers/sober-filter | programs/webservice/__init__.py | Python | gpl-2.0 | 9,399 | 0.005001 |
#!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: PDF-related tables, utility functions etc.
# © Copyright 2015 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU A... | nikitos/npui | netprofile/netprofile/pdf/__init__.py | Python | agpl-3.0 | 10,229 | 0.03257 |
# Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | kocicjelena/python-docs-samples | tests/__init__.py | Python | apache-2.0 | 3,946 | 0 |
"""The tests for the Sonarr platform."""
import unittest
import time
from datetime import datetime
import pytest
from homeassistant.components.sensor import sonarr
from tests.common import get_test_home_assistant
def mocked_exception(*args, **kwargs):
"""Mock exception thrown by requests.get."""
raise OSEr... | LinuxChristian/home-assistant | tests/components/sensor/test_sonarr.py | Python | apache-2.0 | 34,600 | 0 |
#!/usr/bin/env python3
# encoding: utf-8
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Philip Müller <philm@manjaro.org>
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the G... | maui-packages/calamares | src/modules/displaymanager/main.py | Python | gpl-3.0 | 17,415 | 0.002871 |
# Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import os
import errno
import shutil
import platform
import stat
def mkDirP(path):
try:
os.makedirs(path)
except OSError as exception:
if exception.er... | bridadan/yotta | yotta/lib/fsutils.py | Python | apache-2.0 | 2,102 | 0.004757 |
# -*- coding: utf-8 -*-
""" This is the pytest configuration file """
import colorama
import pytest
import sys
from seleniumbase import config as sb_config
from seleniumbase.core import log_helper
from seleniumbase.core import proxy_helper
from seleniumbase.fixtures import constants
def pytest_addoption(parser):
... | mdmintz/SeleniumBase | seleniumbase/plugins/pytest_plugin.py | Python | mit | 34,757 | 0 |
"""Get ride details and liveboard details for NMBS (Belgian railway)."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_LATITUDE,
ATTR_LONGITUDE,
CONF_NAME,
CONF_SHOW_ON_MAP,
)
import home... | joopert/home-assistant | homeassistant/components/nmbs/sensor.py | Python | apache-2.0 | 8,620 | 0.000232 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ordenes', '0008_tecnico_orden'),
]
operations = [
migrations.AlterField(
model_name='concepto',
name... | zaresdelweb/tecnoservicio | tecnoservicio/ordenes/migrations/0009_auto_20150513_1841.py | Python | bsd-3-clause | 449 | 0.002227 |
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Keith Dart
# Contact: email-sig@python.org
"""Class representing application/* type MIME documents."""
__all__ = ["MIMEApplication"]
from email import encoders
from email.mime.nonmultipart import MIMENonMultipart
class MIMEApplication(MIMENonMultipart)... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/email/mime/application.py | Python | gpl-2.0 | 1,256 | 0 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# repolist.py file is part of slpkg.
# Copyright 2014-2021 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redis... | dslackw/slpkg | slpkg/repolist.py | Python | gpl-3.0 | 2,957 | 0 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | snyderr/robotframework | src/robot/reporting/stringcache.py | Python | apache-2.0 | 1,574 | 0 |
# -*- coding: utf-8 -*-
__author__ = 'LIWEI240'
"""
Constants definition
"""
class Const(object):
class RetCode(object):
OK = 0
InvalidParam = -1
NotExist = -2
ParseError = -3 | lwldcr/keyboardman | common/const.py | Python | gpl-3.0 | 214 | 0.009346 |
from mist.mist_job import *
class SimpleStreaming(MistJob, WithStreamingContext, WithPublisher):
def execute(self, parameters):
import time
def takeAndPublish(time, rdd):
taken = rdd.take(11)
self.publisher.publish("-------------------------------------------")
... | KineticCookie/mist | examples-python/simple_streaming.py | Python | apache-2.0 | 1,188 | 0.004209 |
"""
Rotate an array of n elements to the right by k steps.
For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to
[5,6,7,1,2,3,4].
Note:
Try to come up as many solutions as you can, there are at least 3 different
ways to solve this problem.
Hint:
Could you do it in-place with O(1) ext... | ufjfeng/leetcode-jf-soln | python/189_rotate_array.py | Python | mit | 1,252 | 0.003994 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cstr
import mimetypes, json
from werkzeug.wrappers import Response
from frappe.website.context import get_context
f... | gangadharkadam/johnfrappe | frappe/website/render.py | Python | mit | 4,424 | 0.028707 |
# 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.
#---------------------------------------------------------------------... | lmazuel/azure-sdk-for-python | azure-mgmt-servicebus/tests/test_azure_mgmt_servicebus_check_name_availability.py | Python | mit | 1,330 | 0.003765 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.abstract_variables.abstract_travel_time_variable import abstract_travel_time_variable
class travel_time_hbw_am_drive_alone_from_home_to_work_alt(abstract_travel_time_variable):
... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/psrc/household_x_zone/travel_time_hbw_am_drive_alone_from_home_to_work_alt.py | Python | gpl-2.0 | 2,397 | 0.01627 |
from pymongo import MongoClient
import json
import requests
import time
from datetime import datetime
def subredditInfo(sr, limit=100, sorting="top", period="day",
user_agent="ChicagoSchool's scraper", **kwargs):
"""retrieves X (max 100) amount of stories in a subreddit
'sorting' is whether ... | lbybee/reddit_spelling_index | reddit_db_scraper.py | Python | gpl-2.0 | 2,876 | 0.004868 |
#
# ElementTree
# $Id: ElementInclude.py 3225 2007-08-27 21:32:08Z fredrik $
#
# limited xinclude support for element trees
#
# history:
# 2003-08-15 fl created
# 2003-11-14 fl fixed default loader
#
# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved.
#
# fredrik@pythonware.com
# http://www.pythonware... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/script.module.elementtree/lib/elementtree/ElementInclude.py | Python | gpl-2.0 | 5,051 | 0.00099 |
# =============================================================================
# 2013+ Copyright (c) Alexey Ivanov <rbtz@ph34r.me>
# All rights reserved.
#
# 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 F... | reverbrain/elliptics | recovery/elliptics_recovery/types/__init__.py | Python | lgpl-3.0 | 769 | 0 |
import click
from arrow.commands.remote.add_organism import cli as add_organism
from arrow.commands.remote.add_track import cli as add_track
from arrow.commands.remote.delete_organism import cli as delete_organism
from arrow.commands.remote.delete_track import cli as delete_track
from arrow.commands.remote.update_organ... | galaxy-genome-annotation/python-apollo | arrow/commands/cmd_remote.py | Python | mit | 643 | 0 |
import numpy as np
from ase import Atoms
from gpaw import GPAW, FermiDirac
from gpaw.response.df import DielectricFunction
from gpaw.test import equal, findpeak
GS = 1
ABS = 1
if GS:
cluster = Atoms('Au2', [(0, 0, 0), (0, 0, 2.564)])
cluster.set_cell((6, 6, 6), scale_atoms=False)
cluster.center()
calc ... | robwarm/gpaw-symm | gpaw/test/au02_absorption.py | Python | gpl-3.0 | 2,114 | 0.003784 |
from pyrs import schema
import six
from . import lib
from . import response
class Error(Exception):
"""
This is the base exception of this framework.
The response based on this exception will be a JSON data
"""
#: HTTP status code (default=500)
status = 500
#: HTTP Response headers, (de... | palankai/pyrs-resource | pyrs/resource/errors.py | Python | lgpl-3.0 | 5,253 | 0 |
#
# network.py - network configuration install data
#
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
# 2008, 2009
#
# 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 Fou... | akozumpl/anaconda | pyanaconda/network.py | Python | gpl-2.0 | 48,413 | 0.002417 |
from decimal import *
class PI:
#Sets decimal to 25 digits of precision
getcontext().prec = 1000
@staticmethod
def factorial(n):
# if n<1:
# return 1
# else:
# return n * PI.factorial(n-1)
result = 1
for i in xrange(2, n+1):
result *=... | susemeee/Chunsabot-framework | chunsabot/pi.py | Python | mit | 1,587 | 0.009452 |
#!/usr/bin/env python3
"""
Generate a set of agent demonstrations.
The agent can either be a trained model or the heuristic expert (bot).
Demonstration generation can take a long time, but it can be parallelized
if you have a cluster at your disposal. Provide a script that launches
make_agent_demos.py at your cluste... | mila-iqia/babyai | scripts/make_agent_demos.py | Python | bsd-3-clause | 8,078 | 0.0026 |
from edges import EdgeExtractor
from extractor import Extractor
from parambfs import ParamExtractor | daajoe/trellis | trellis/extractor/__init__.py | Python | gpl-3.0 | 99 | 0.010101 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.