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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | Tagar/incubator-airflow | airflow/migrations/versions/13eb55f81627_for_compatibility.py | Python | apache-2.0 | 1,162 |
from typing import List
from treehopper.libraries.flushable import Flushable
from treehopper.libraries.displays import Led, LedDriver
from treehopper.utils.utils import byte_to_bit_list
from typing import List
from treehopper.libraries.displays.character_display import CharacterDisplay
from treehopper.libraries.display... | treehopper-electronics/treehopper-sdk | Python/treehopper/libraries/displays/seven_segment.py | Python | mit | 3,976 |
import time
from collections import defaultdict
class KarmaRateLimiter(object):
def __init__(self, timeout=60, penalty=3):
"""timeout in seconds - default 1 min"""
self.timeout = timeout
self.penalty = penalty
# http://goo.gl/ZFmFX
# http://stackoverflow.com/a/5900628
... | zencoders/pyircbot | plugins/karma_rate.py | Python | gpl-2.0 | 1,474 |
from numpy import mgrid, zeros, where, maximum
from scipy.stats import beta
prior_params = [ (1, 1), (1,1) ]
def bayesian_expected_error(N,s, xgrid_size=1024):
degrees_of_freedom = len(prior_params)
posteriors = []
for i in range(degrees_of_freedom):
posteriors.append(beta(prior_params[i][0] + s[i... | gostevehoward/absimulation | stucchio.py | Python | mit | 695 |
from django.conf import settings
NOTIFICATION_CACHE_TIMEOUT = getattr(settings, 'NOTIFICATION_CACHE_TIMEOUT', 0)
| madflow/seahub | seahub/notifications/settings.py | Python | apache-2.0 | 114 |
#!/usr/bin/python
#
# Copyright 2012 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 b... | caioserra/apiAdwords | examples/adspygoogle/dfa/v1_19/get_dfa_site.py | Python | apache-2.0 | 1,745 |
# -*- coding: utf-8 -*-
'''DelogX.utils.plugin
Base class of any plugin and a plugin manager.
'''
import errno
import importlib
import os
import re
import sys
from DelogX.utils.config import Config
class Plugin(object):
'''Base class and interface of any DelogX plugin.
Attributes:
... | deluxghost/DelogX | DelogX/utils/plugin.py | Python | lgpl-3.0 | 7,315 |
from doajtest.helpers import DoajTestCase
from portality import models
from portality.forms.application_forms import JournalFormFactory
from portality.forms.application_processors import EditorJournalReview
from portality import lcc
from doajtest.fixtures import JournalFixtureFactory
###############################... | DOAJ/doaj | doajtest/unit/application_processors/test_editor_journal_review.py | Python | apache-2.0 | 4,410 |
# Copyright (C) 2004-2006 Python Software Foundation
# Authors: Baxter, Wouters and Warsaw
# Contact: email-sig@python.org
"""FeedParser - An email feed parser.
The feed parser implements an interface for incrementally parsing an email
message, line by line. This has advantages for certain applications, such as
thos... | michalliu/OpenWrt-Firefly-Libraries | staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python3.4/email/feedparser.py | Python | gpl-2.0 | 22,893 |
# 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... | Juniper/tempest | tempest/api/object_storage/test_container_services.py | Python | apache-2.0 | 17,724 |
'''
Test one outbound start and two outbound close
'''
# 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 ... | chitianhao/trafficserver | tests/gold_tests/tls_hooks/tls_hooks13.test.py | Python | apache-2.0 | 3,295 |
#!/usr/bin/python3
from pyrob.api import *
@task
def task_8_2():
while not wall_is_on_the_right():
if wall_is_above() and (not wall_is_beneath()) or wall_is_beneath() and (not wall_is_above()):
fill_cell()
move_right()
if wall_is_above() and (not wall_is_beneath()) or wall_is_beneath() and (n... | Senbjorn/mipt_lab_2016 | lab4/robot-tasks/task_9.py | Python | gpl-3.0 | 404 |
# -*- coding: utf-8 -*-
"""
Celery tasks
"""
import os
from rapydo.utils.logs import get_logger
from celery import Celery
from rapydo.services.detect import detector
log = get_logger(__name__)
log.critical("This code should not be called anymore!")
if detector.check_availability('celery'):
HOST = os.environ.... | EUDAT-B2STAGE/http-api-base | old_stuff/rapydo/services/celery/celery.py | Python | mit | 1,285 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import re
import subprocess
from pants.backend.codegen.thrift.lib.thrift import Thrift
from pants.base.build_environment import get_buildroot
from pants.base.exceptions import T... | wisechengyi/pants | contrib/go/src/python/pants/contrib/go/tasks/go_thrift_gen.py | Python | apache-2.0 | 7,552 |
"""
Implementation of the ANDROMEDA algorithm from [MUG09]_ / [CAN15]_.
Based on ANDROMEDA v3.1 from 28/06/2018.
.. [MUG09]
| Mugnier et al, 2009
| **Optimal method for exoplanet detection by angular differential imaging**
| *J. Opt. Soc. Am. A, 26(6), 1326-1334*
| `doi:10.1364/JOSAA.26.001326 <http://doi... | vortex-exoplanet/VIP | vip_hci/invprob/andromeda.py | Python | mit | 46,715 |
from __future__ import print_function
import os
# Tell gevent not to patch os.waitpid() since it is susceptible to race
# conditions. See:
# http://www.gevent.org/gevent.monkey.html#gevent.monkey.patch_os
os.environ['GEVENT_NOWAITPID'] = 'true'
# Use manhole to give us a way to debug hung processes
# https://pypi.pyt... | SUSE/teuthology | teuthology/__init__.py | Python | mit | 3,990 |
from bottle import route, request, get, post
from index import header0, account_mgmt, list_tags, footer
def get_bmarklet():
"""Returns bookmarklet page/index content."""
return_data = ''
top = '''<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>T... | netllama/tastipy | bmarklet.py | Python | gpl-3.0 | 999 |
from Tools.Profile import profile
from enigma import eServiceReference
# workaround for required config entry dependencies.
import Screens.MovieSelection
from Screen import Screen
from Screens.MessageBox import MessageBox
profile("LOAD:enigma")
import enigma
profile("LOAD:InfoBarGenerics")
from Screens.InfoBarGener... | openmips/stbgui | lib/python/Screens/InfoBar.py | Python | gpl-2.0 | 20,557 |
# Copyright (C) 2018 Philipp Hörist <philipp AT hoerist.com>
#
# This file is part of nbxmpp.
#
# 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 License, or (at your opt... | gajim/python-nbxmpp | nbxmpp/modules/chat_markers.py | Python | gpl-3.0 | 1,984 |
#!/usr/bin/env python3
# This source file is part of Obozrenie
# Copyright 2015 Artem Vorotnikov
# For more information, see https://github.com/obozrenie/obozrenie
# Obozrenie is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by th... | skybon/obozrenie | obozrenie/proxies/__init__.py | Python | gpl-3.0 | 1,163 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... | StefanoRaggi/Lean | Algorithm.Python/TrainingInitializeRegressionAlgorithm.py | Python | apache-2.0 | 2,369 |
# Copyright (C) 2016 Siavoosh Payandeh Azad
from CB_functions import rxy_rst_calculator, cx_rst_calculator
import math
def instantiate_routers(noc_file, network_dime, add_parity, add_packet_drop, add_FC, add_SHMU,
healthy_counter_threshold, faulty_counter_threshold, counter_depth):
"""
... | siavooshpayandehazad/NoC_Router | Scripts/credit_based/Instantiate_components.py | Python | gpl-3.0 | 8,645 |
def plus_one(number):
return number + 1
| jhpyle/docassemble | docassemble_base/docassemble/base/test.py | Python | mit | 42 |
from hypothesis.utils.conventions import not_set
def accept(f):
def integers(min_value=not_set, max_value=not_set):
return f(min_value, max_value)
return integers
| keybar/keybar | .hypothesis/eval_source/hypothesis_temporary_module_575c46161da71f5baee220ccac6c2069d30f4506.py | Python | bsd-3-clause | 180 |
from .stdlocaldb import StandardLocalDatabase
class LocalDatabaseFactory(object):
@staticmethod
def build(institution):
"""Build a local database view for the given
institution
"""
return StandardLocalDatabase(institution)
| rosshamish/classtime | classtime/brain/local_db/localdb_factory.py | Python | mit | 265 |
"""
Provides a binary sensor which is a collection of ffmpeg tools.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.ffmpeg_motion/
"""
import logging
import voluptuous as vol
from homeassistant.core import callback
import homeassistant.hel... | jamespcole/home-assistant | homeassistant/components/ffmpeg_motion/binary_sensor.py | Python | apache-2.0 | 3,805 |
from oauth2_provider.decorators import protected_resource
from rest_framework.decorators import api_view
from rest_framework.response import Response
from api.decorators import embed_driver
from api.errors_helper import error_response
from api.navigator import NFeNavigator
application_webdrivers = {}
@api_view(['G... | gbazilio/nfebrasil | api/views.py | Python | mit | 1,068 |
"""Tests for student member register task"""
import ddt
import json
from mock import patch
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.test.utils import override_settings
from bulk_email.models import Optout
from xmodule.modulestore.tests.d... | nttks/edx-platform | biz/djangoapps/ga_contract_operation/tests/test_student_member_register.py | Python | agpl-3.0 | 99,384 |
from django.dispatch import Signal
password_set = Signal(providing_args=["request", "user", "password"])
| citizenline/citizenline | email_registration/signals.py | Python | mit | 107 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
__author__ = 'Yuta Hayashibe'
__version__ = ""
__copyright__ = ""
__license__ = "GPL v3"
import random
import unittest
import slex.corpus.corpus
import slex.corpus.document
class Test(unittest.TestCase):
def setUp(self):
self.metadata = {u"ID": u"T... | shirayu/slex | slex/test/test__corpus.py | Python | gpl-3.0 | 1,331 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import signal
import subprocess
import sys
import tempfile
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.internal.pla... | Chilledheart/chromium | tools/telemetry/telemetry/internal/platform/profiler/sample_profiler.py | Python | bsd-3-clause | 2,883 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import SUPERUSER_ID
from openerp import api, fields, models, _
from openerp.exceptions import AccessError
class SaleConfiguration(models.TransientModel):
_inherit = 'sale.config.settings'
module_de... | zbqf109/goodo | openerp/addons/sale_stock/res_config.py | Python | gpl-3.0 | 2,059 |
from spacewiki.test import create_test_app
from spacewiki import model
import unittest
import tempfile
import hashlib
from StringIO import StringIO
import os
from playhouse.test_utils import test_database
from peewee import SqliteDatabase
test_db = SqliteDatabase(':memory:')
class UploadTestCase(unittest.TestCase):
... | tdfischer/spacewiki | spacewiki/test/upload_test.py | Python | agpl-3.0 | 2,696 |
#
# mainwindow.py
#
# Copyright 2010 Brett Mravec <brett.mravec@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 2 of the License, or
# ... | bmravec/DownMan | downman/gui/qt/mainwindow.py | Python | gpl-2.0 | 2,243 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_v2_generated_knowledge_bases_create_knowledge_base_async.py | Python | apache-2.0 | 1,668 |
# MIT License
#
# Copyright (c) 2020-2022 CNRS
#
# 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 limitation the rights
# to use, copy, modify, merge, pu... | pyannote/pyannote-audio | pyannote/audio/pipelines/__init__.py | Python | mit | 1,527 |
# -*- coding: utf-8 -*-
"""
Simple processing for russian strings
"""
VERSION = '0.3.1dev'
from pytils import numeral, dt, translit, typo
| j2a/pytils | pytils/__init__.py | Python | mit | 139 |
# -*- coding: utf-8 -*-
from Products.CMFCore.utils import getToolByName
import datetime
import DateTime
from plone.app.textfield.value import RichTextValue
vet = [
{ "id": "03-02-17-a-voz.mp3"},
]
app.radio
for item in vet:
id = item['id']
result = app.radio.portal_catalog(Type="File", id=id)
... | lflrocha/lflrocha.scripts | ploneScripts/setDate.py | Python | unlicense | 712 |
import datetime
import glob
import itertools
import os
import shutil
import subprocess
import debug # pyflakes:ignore
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from ... | wpjesus/codematch | ietf/secr/proceedings/views.py | Python | bsd-3-clause | 40,516 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyDate/setup.py | Python | mit | 1,097 |
# 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 agreed to in... | quantumlib/OpenFermion-FQE | tests/fci_graph_test.py | Python | apache-2.0 | 11,186 |
import asterix
import unittest
class AsterixParseTest(unittest.TestCase):
def test_ParseCAT048(self):
sample_filename = asterix.get_sample_file('cat048.raw')
with open(sample_filename, "rb") as f:
data = f.read()
packet = asterix.parse(data)
self.maxDiff = None
... | nabilbendafi/asterix | asterix/test/test_parse.py | Python | gpl-3.0 | 30,268 |
import time
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, WebDriverException
from selenium.webdriver.common.by import By
from .decorator import SupportedBy
from .enumeration import WebDriverPlatform
from .exceptions import TimeoutException, ElementTimeoutException, Web... | KarlGong/easyium-python | easyium/waiter.py | Python | apache-2.0 | 13,978 |
#!/usr/local/bin/python2.7
# encoding: utf-8
'''
rnaseq.singe_RPKM -- shortdesc
rnaseq.singe_RPKM is a description
It defines classes_and_methods
@author: user_name
@copyright: 2013 organization_name. All rights reserved.
@license: license
@contact: user_email
@deffield updated: Upda... | YeoLab/gscripts | gscripts/rnaseq/single_RPKM.py | Python | mit | 2,174 |
# Copyright 2014 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... | benschmaus/catapult | third_party/gsutil/gslib/third_party/storage_apitools/storage_v1_client.py | Python | bsd-3-clause | 44,222 |
#
# Copyright (C) 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 applicable law or agreed to in writin... | redhat-cip/dci-control-server | dci/alembic/versions/19dd8a44afdf_add_fingerprint_table.py | Python | apache-2.0 | 2,476 |
import re
from mitmproxy.coretypes import basethread
def test_basethread():
t = basethread.BaseThread('foobar')
assert re.match('foobar - age: \d+s', t._threadinfo())
| ujjwal96/mitmproxy | test/mitmproxy/coretypes/test_basethread.py | Python | mit | 177 |
import re, sys, types
from sakura.hub import conf
from sakura.hub.db.schema import define_schema
from pony.orm import Database as PonyDatabase, \
commit as pony_commit, \
sql_debug, \
db_session as pony_db_session, \
... | eduble/panteda | sakura/hub/db/hubdb.py | Python | gpl-3.0 | 2,557 |
# Copyright (c) 2018 PaddlePaddle 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 app... | jacquesqiao/Paddle | python/paddle/fluid/tests/unittests/test_squeeze_op.py | Python | apache-2.0 | 3,182 |
# This file is part of pybliographer
#
# Copyright (C) 1998-2004 Frederic GOBRY
# Email : gobry@pybliographer.org
#
# 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 t... | matthew-brett/pyblio | Pyblio/Base.py | Python | gpl-2.0 | 7,923 |
class Solution(object):
def countSubstrings(self, s):
"""
:type s: str
:rtype: int
"""
count = 0
for i in range(len(s)):
count += self.countPalindrome(s, i, i) + self.countPalindrome(s, i, i + 1)
return count
def countPalindrome(self, ... | Mlieou/oj_solutions | leetcode/python/ex_647.py | Python | mit | 547 |
# The MIT License (MIT)
#
# Copyright (c) 2014 Richard Moore
#
# 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 limitation the rights
# to use, copy, mod... | ricmoo/pycoind | pycoind/node/node.py | Python | mit | 12,573 |
#_PYTHON_INSERT_SAO_COPYRIGHT_HERE_(2007)_
#_PYTHON_INSERT_GPL_LICENSE_HERE_
import logging
import numpy
from sherpa.utils import SherpaFloat, NoNewAttributesAfterInit
from sherpa.utils.err import ParameterErr
warning = logging.getLogger(__name__).warning
__all__ = ('Parameter', 'CompositeParameter', 'ConstantParame... | brefsdal/sherpa | sherpa/models/parameter.py | Python | gpl-2.0 | 12,718 |
import sys
from twisted.python import log
from twisted.internet import reactor
from twisted.words.protocols.jabber.jid import JID
from wokkel.client import XMPPClient
from wokkel.xmppim import RosterClientProtocol
class RosterHandler(RosterClientProtocol):
def gotRoster(self, roster):
print 'Got roster:'
... | ralphm/wokkel | doc/listings/xmppim/roster_client_push.py | Python | mit | 1,070 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2011
# Pexego Sistemas Informáticos. (http://pexego.es) All Rights Reserved
#
# Migración OpenERP 7.0. Top Consultant Software Creations S.L. (http://www.topconsultant.es/) 2013
# ... | jmesteve/saas3 | openerp/addons_extra/l10n_es_aeat_mod349/__openerp__.py | Python | agpl-3.0 | 4,866 |
import math
import numpy as np
from scipy import stats
def fix_geometry(incl, pa, vc):
incl = wrapAngle(incl)
incl, vc = foldIncl(incl, vc)
pa = wrapAngle(pa)
pa, vc = foldPa(pa, vc)
pa_std = np.std(pa)
circularMeanPA = getCircularMean(pa)
circularMeanIncl = getCircularMean(incl)
if np.mean(vc) >=0:
folded_... | astrolitterbox/SAMI | geom.py | Python | gpl-2.0 | 3,107 |
from panda3d.core import CardMaker, MovieTexture, NodePath, TextureStage, TransparencyAttrib
from panda3d.core import AmbientLight, Vec3, Vec4, Point3, LineSegs
from direct.interval.LerpInterval import LerpColorInterval, LerpScaleInterval, LerpHprInterval, LerpPosInterval
from direct.interval.IntervalGlobal import Sequ... | faruk/opticfoo | visuals/spaceships.py | Python | gpl-3.0 | 998 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = '7sDream'
import time
import json
import requests
import importlib
from .common import *
class ZhihuClient:
"""知乎客户端类,内部维护了自己专用的网络会话,可用cookies或账号密码登录."""
def __init__(self, cookies=None):
"""创建客户端类实例.
:param str cookies: 见 :meth... | hunzhishang85/zhihu-py3 | zhihu/client.py | Python | mit | 6,255 |
""" Provide MQTT support. """
import gc # pylint: disable=import-error
from umqtt.simple import MQTTClient # pylint: disable=import-error
from umqtt.simple import MQTTException # pylint: disable=import-error
__author__ = "Alexander Sowitzki"
# pylint: disable=too-many-instance-attributes,no-member
class Client:
... | eqrx/mauzr | mauzr/platform/upy/mqtt.py | Python | agpl-3.0 | 5,498 |
"""
Collections-related functions and classes.
"""
from __future__ import absolute_import # for importing built-in `collections`
import collections
__all__ = [
'is_countable', 'is_iterable', 'is_mapping', 'is_ordered_mapping',
'is_sequence', 'is_set', 'is_sized',
'ensure_countable', 'ensure_iterable', '... | Xion/taipan | taipan/collections/__init__.py | Python | bsd-2-clause | 4,110 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | StackStorm/st2 | contrib/runners/orquesta_runner/tests/unit/test_functions_st2kv.py | Python | apache-2.0 | 7,645 |
import os
import platform
import re
import shutil
def get_tree_size(path='.'):
"""
get_tree_size will return the total size of a directory tree
"""
if not os.path.exists(path):
raise OSError("Path " + str(path) + " does not exist!")
total_size = 0
for dirpath, dirnames, filenames in o... | Signiant/MaestroOps | maestro/tools/path.py | Python | mit | 3,425 |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.compat import long
from numpy.core import (array, arange, atleast_1d, atleast_2d, atleast_3d,
vstack, hstack, newaxis, concatenate, stack)
from numpy.testing import (TestCase, assert_, assert_raises, ... | behzadnouri/numpy | numpy/core/tests/test_shape_base.py | Python | bsd-3-clause | 11,890 |
import colander
from pyramid import testing
from pytest import fixture
from pytest import raises
class TestValidateLinearHistoryNoMerge:
@fixture
def last_version(self):
return testing.DummyResource()
@fixture
def node(self):
return testing.DummyResource()
def call_fut(self, nod... | fhartwig/adhocracy3.mercator | src/adhocracy_core/adhocracy_core/sheets/test_versions.py | Python | agpl-3.0 | 7,841 |
from django.shortcuts import render
from django.urls import resolve
def just_redirect_by_name(request):
url_name = resolve(request.path_info).url_name
return render(request, f"{url_name}.html", {})
| hakancelik96/coogger | coogger/utils.py | Python | mit | 208 |
"""
Test problems in nested calls.
Usually due to invalid type conversion between function boundaries.
"""
from __future__ import print_function, division, absolute_import
from numba import njit
from numba import unittest_support as unittest
from .support import TestCase
@njit
def f_inner(a, b, c):
return a, b,... | ssarangi/numba | numba/tests/test_nested_calls.py | Python | bsd-2-clause | 2,150 |
# Copyright 2016 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... | AlexEKoren/grumpy | lib/types_test.py | Python | apache-2.0 | 1,101 |
# yalec - Yet Another Let's Encrypt Client
# Copyright (C) 2016 Falk Garbsch
#
# This library 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 2.1 of the License, or (at your option) any... | nexus511/yalec | yalec.py | Python | lgpl-2.1 | 1,886 |
# -*- coding: utf -8 -*-
import logging
from sklearn.cross_validation import StratifiedKFold, StratifiedShuffleSplit
from .base import Experiment, TRAIN_RATIO
from ..utils.setup_logging import setup_logging
setup_logging()
logger = logging.getLogger(__name__)
class SupervisedExperiment(Experiment):
def __init... | crscardellino/dnnwsd | dnnwsd/experiment/supervised.py | Python | bsd-3-clause | 1,926 |
from django.db import migrations
INFINIBAND_SLUGS = (
('inifiband-sdr', 'infiniband-sdr'),
('inifiband-ddr', 'infiniband-ddr'),
('inifiband-qdr', 'infiniband-qdr'),
('inifiband-fdr10', 'infiniband-fdr10'),
('inifiband-fdr', 'infiniband-fdr'),
('inifiband-edr', 'infiniband-edr'),
('inifiban... | digitalocean/netbox | netbox/dcim/migrations/0104_correct_infiniband_types.py | Python | apache-2.0 | 914 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 - 2013 Therp BV (<http://therp.nl>).
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pub... | rschnapka/bank-payment | account_bank_statement_tax/__openerp__.py | Python | agpl-3.0 | 1,536 |
# -*- coding: utf-8 -*-
import unittest
from src.table import TableEffect
from src.hand import Hand
from src.cards import TableCards
from src.strategy import StrategyFactory, ExchangeStrategy, ForwardStrategy, ReverseStrategy
class StrategyFactoryTest(unittest.TestCase):
def setUp(self):
"""
場の状態... | Hironsan/uecda-pyclient | tests/test_strategy.py | Python | mit | 1,525 |
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/pipeline/plot/models/icfactor_model.py | Python | apache-2.0 | 1,436 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... | electrolinux/weblate | weblate/trans/aresource.py | Python | gpl-3.0 | 1,424 |
# 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... | caio2k/RIDE | src/robotide/lib/robot/libraries/dialogs_jy.py | Python | apache-2.0 | 3,458 |
# Copyright (C) 2007, One Laptop Per Child
# Copyright (C) 2009, Tomeu Vizoso, Lucian Branescu
#
# 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 op... | samdroid-apps/browse-activity | downloadmanager.py | Python | gpl-2.0 | 14,504 |
import json
from django.contrib.auth.models import User
from django.contrib.gis.db import models
from geojson import Feature
class Marker(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
location = models.PointField()
user = models.Forei... | bobvoorneveld/spindlechannels | map/models.py | Python | mit | 817 |
# -*- coding: utf-8 -*-
#
# Elasticsearch documentation build configuration file, created by
# sphinx-quickstart on Mon May 6 15:38:41 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... | f-santos/elasticsearch-dsl-py | docs/conf.py | Python | apache-2.0 | 8,367 |
import dj_database_url
from ..settings import *
DATABASES = {'default': dj_database_url.config()}
ALLOWED_HOSTS = ['*']
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'
MIDDLEWARE += (
'whitenoise.middleware.WhiteNoiseMiddle... | dgk/django-business-logic | sites/dev/heroku/settings.py | Python | mit | 329 |
# EXAMPLE 3 (Example 4.2.2 of [1]) - UNSAT
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
# uses dolev_yao_sym theory
from theories.dolev_yao_sym import *
Psi = ["""'Forall[{k1:Constant@symkey}]"""]
Sigma = []
Pi = ["""eq[(1)Pr[{k:Constant=k1:Constant}]+(-0.4)Pr[{k1:... | fcasal/satdeqprl | examples/ex3.py | Python | gpl-3.0 | 580 |
"""Predicate: output token."""
from gtd.utils import ComparableMixin
class Predicate(ComparableMixin):
"""Represents a step in the logical form (i.e., an output token)."""
__slots__ = ['_name', '_original_string', '_types']
def __init__(self, name, original_string=None, types=None):
"""Create Pr... | kelvinguu/lang2program | strongsup/predicate.py | Python | apache-2.0 | 1,835 |
# -*- coding: utf-8 -*-
#
# sample documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 16 21:22:43 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | igorgue/zeromqlogs | docs/conf.py | Python | mit | 7,723 |
#!/usr/bin/env python
import pytest
import sys
from os import path
test_dir = path.dirname(path.abspath(__file__))
sys.path.insert(0, path.dirname(test_dir))
if __name__ == '__main__':
pytest.main()
| gerlachry/testing.elasticsearch | src/tests/runtests.py | Python | mit | 206 |
import pprint
def create_connection(sqlite, db_file, row_factory=None):
""" create a database connection to the SQLite database
specified by the db_file
:param sqlite: sqlite object (e.g. sqlite3)
:param db_file: database file
:param row_factory: row making function (e.g. sqlite3.Row)
:retu... | gri-is/lodjob | utils/sqlite/helpers.py | Python | agpl-3.0 | 2,140 |
"""The Nightscout integration."""
import asyncio
from asyncio import TimeoutError as AsyncIOTimeoutError
from aiohttp import ClientError
from py_nightscout import Api as NightscoutAPI
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_URL
from homeassistant.core im... | tboyce021/home-assistant | homeassistant/components/nightscout/__init__.py | Python | apache-2.0 | 2,276 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import fasta
import strings
def main(argv):
s, t = fasta.read(argv[0]).values()
print strings.longest_common_subsequence(s, t)
if __name__ == "__main__":
main(sys.argv[1:])
| cowboysmall/rosalind | src/stronghold/rosalind_lcsq.py | Python | mit | 281 |
n = int(raw_input())
arr = (raw_input()).split()
#print arr
sum=0
for x in arr:
sum+=int(x)
print sum | dusadpiyush96/Competetive | HackerRank/Algorithm/warmup/SimpleArraySum.py | Python | mit | 106 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
def forwards(apps, schema_editor):
Salida = apps.get_model('tickets', 'Salida')
for s in Salida.objects.all():
days = int(s.minutos / (24 * 60))
seconds = int(s.minutos * ... | amd77/parker | tickets/migrations/0008_salida_duracion.py | Python | gpl-2.0 | 872 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-22 16:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaires', '0014_api_additional_fields'),
]
operations = [
migrations... | Cadasta/cadasta-platform | cadasta/questionnaires/migrations/0015_add_question_index_field.py | Python | agpl-3.0 | 942 |
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from .fields import Orde... | EssaAlshammri/django-by-example | e-learning/educa/courses/models.py | Python | mit | 2,631 |
__author__ = 'stephen'
# ===============================================================================
# GLOBAL IMPORTS:
import os,sys
import numpy as np
import argparse
# ===============================================================================
# LOCAL IMPORTS:
#HK_DataMiner_Path = os.path.relpath(os.pardir)
... | stephenliu1989/HK_DataMiner | hkdataminer/scripts/test_mrdbscan (stephen-desktop-linux's conflicted copy 2019-08-24).py | Python | apache-2.0 | 11,328 |
from django.conf.urls import url
from . import views
app_name = 'blog'
urlpatterns = [
# /blog/
url(r'^$', views.IndexView.as_view(), name='index'),
# /blog/5/
url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
] | pattu777/LearningDjango | apps/blog/urls.py | Python | mit | 255 |
import os, sys
parent_dir = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
if parent_dir not in sys.path:
sys.path.insert(0, parent_dir)
# Initialize Django
from djangoappengine.main import main as gaemain
# Import and run the actual handler
from google.appengine.ext.defer... | rimbalinux/LMD3 | djangoappengine/deferred/handler.py | Python | bsd-3-clause | 385 |
from unittest import TestCase
from django.db import models
from django import forms
from stateflow import stateclass, statefields
class Article(object):
state = None
def __init__(self):
self.state = New
#States
class New(stateclass.DjangoState):
pass
class Submitted(stateclass.DjangoState):
... | jellycrystal/django-stateflow | stateflow/tests.py | Python | bsd-3-clause | 3,354 |
# Copyright 2009 Jean-Francois Houzard, Olivier Roger
#
# This file is part of pypassport.
#
# pypassport 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 o... | tonikelope/python-passport-trace-attack | pypassport/hexfunctions.py | Python | gpl-2.0 | 2,938 |
# -*- coding: utf-8 -*-
"""
setup script (largely inspired on scikit-learn's)
"""
__author__ = "Begon Jean-Michel <jm.begon@gmail.com>"
__copyright__ = "3-clause BSD License"
__version__ = 'dev'
import os
import shutil
from distutils.command.clean import clean as Clean
def main_dir():
return "pythonsetup"
class... | jm-begon/pythonsetup | setup.py | Python | bsd-3-clause | 2,380 |
from django import forms
#from .models import Message
# 2 sposób:
#class MessageForm(forms.ModelForm):
# class Meta:
# model= Message
# fields = ('name','email','message')
class ContactForm(forms.Form):
name = forms.CharField()
email = forms.EmailField()
message = forms.CharField(widget=... | lukasz880525/oki | contact/forms.py | Python | mit | 565 |
# From https://github.com/rocky/python-uncompyle6/issues/350
# This is RUNNABLE!
a = (lambda x: x)(abs)
assert a(-3) == 3
| rocky/python-uncompyle6 | test/simple_source/bug22/01_lambda_call.py | Python | gpl-3.0 | 122 |
import argparse
import sys
from vcstool.streams import set_streams
from .command import Command
from .command import simple_main
class LogCommand(Command):
command = 'log'
help = 'Show commit logs'
def __init__(self, args):
super(LogCommand, self).__init__(args)
self.limit = args.limit... | dirk-thomas/vcstool | vcstool/commands/log.py | Python | apache-2.0 | 1,650 |
#!/usr/bin/env python
#
# Copyright 2015 Airbus
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# 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
#
# ... | ipa-led/airbus_coop | airbus_cobot_gui/src/airbus_cobot_gui/account/accounts.py | Python | apache-2.0 | 9,925 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.