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
__author__ = 'had'
# The MIT License (MIT)
# Copyright (c) [2015] [Houtmann Hadrien]
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the Aidez-moi), to deal
# in the Software without restriction, including without limi... | hadmagic/Aidez-moi | ticket/templatetags/__init__.py | Python | mit | 1,150 |
# Copyright (C) 2016-2019 Virgil Security Inc.
#
# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistribution... | VirgilSecurity/virgil-sdk-python | virgil_sdk/tests/jwt/jwt_generator_test.py | Python | bsd-3-clause | 2,715 |
import math
import wx
import eos.db
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.calc.cargo.changeAmount import CalcChangeCargoAmountCommand
from gui.fitCommands.calc.cargo.remove import CalcRemoveCargoCommand
from gui.fitCommands.helpers import CargoInfo, InternalCommandHistory
clas... | pyfa-org/Pyfa | gui/fitCommands/gui/cargo/changeAmount.py | Python | gpl-3.0 | 1,541 |
from .ranking import CreditRanking
from .interleaving_method import InterleavingMethod
import numpy as np
from scipy.optimize import linprog
class Optimized(InterleavingMethod):
'''
Optimized Interleaving
Args:
lists: lists of document IDs
max_length: the maximum length of resultant inter... | mpkato/interleaving | interleaving/optimized.py | Python | mit | 7,584 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import combinatorics
def main(argv):
lines = files.read_lines(argv[0])
n = int(lines[0])
print combinatorics.combinations(n, 4) % 1000000
if __name__ == "__main__":
main(sys.argv[1:])
| cowboysmall/rosalind | src/stronghold/rosalind_cntq.py | Python | mit | 313 |
# -*- coding: utf-8 -*-
# Copyright 2016-2021 The pyXem developers
#
# This file is part of pyXem.
#
# pyXem 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 optio... | pycrystem/pycrystem | pyxem/tests/utils/test_dpc_signal_tools.py | Python | gpl-3.0 | 10,600 |
# annotation parser that processes our hashtags
import re
def get_abstracts(filename):
output = []
abstract_buffer = []
notes_buffer = []
last_abstract_no = 0
last_pmid = 0
last_biviewid = 0
with open(filename, 'rb') as f:
for line in f: # fast forward to abstract 1
... | ijmarshall/cochrane-nlp | parse_annotations.py | Python | gpl-3.0 | 1,910 |
#!/usr/bin/python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012 Sigurd Gartmann sigurdga-ubuntu@sigurdga.no
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as pub... | sigurdga/maps | tests/test_example.py | Python | gpl-3.0 | 1,448 |
from xbmcswift2 import Plugin, xbmcgui
plugin = Plugin()
@plugin.route('/')
def main_menu():
items = [
{'label': plugin.get_string(30000), 'path': "http://www.abc.net.au/res/streaming/audio/mp3/radio_national.pls",
'is_playable': True},
{'label': plugin.get_string(30001), 'path': "htt... | techyteach-s/plugin.audio.abcradioaustralia | addon.py | Python | mit | 3,454 |
"""
CADD Stat views
"""
from django.core.mail import send_mail
from django.shortcuts import render
from django.template import loader
from .forms import FeedbackForm, OneColumnForm, TwoColumnForm, ThreeColumnForm
import settings as caddstat_settings
from .tasks import (task_mad, task_tau, task_pearson, task_cohen,
... | oess/django-caddstat | caddstat/views.py | Python | bsd-3-clause | 6,323 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#=========================================================================
#
# FILE: get.py
#
# USAGE: ./get.py
#
# DESCRIPTION: Get current values
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: SHIE, Li-Yi... | lyshie/sync-test | sqlite3/get.py | Python | gpl-2.0 | 1,209 |
# -*- coding: utf-8 -*-
# 2018.07.26 --- use DictComparison instead of GcpRequest
#
# (c) 2016, Tom Melendez <tom@supertom.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | pilou-/ansible | test/units/module_utils/hwc/test_dict_comparison.py | Python | gpl-3.0 | 4,706 |
"""Tools for working with iterators"""
# future/compat
from builtins import next
from builtins import object
from builtins import range
from builtins import zip
# stdlib
from inspect import getmembers
from generic_utils import loggingtools
from generic_utils.exceptions import GenUtilsTypeError
LOG = loggingtools.get... | kevinseelbach/generic_utils | src/generic_utils/itertools_ex.py | Python | bsd-3-clause | 7,800 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
from odoo.tools import mute_logger
from odoo.tests import common
from odoo.exceptions import AccessError
class TestAPI(common.TransactionCase):
""" test the new API of the ORM """
def a... | ayepezv/GAD_ERP | openerp/addons/base/tests/test_api.py | Python | gpl-3.0 | 21,388 |
"""Constants for the Vizio integration tests."""
from homeassistant.components import zeroconf
from homeassistant.components.media_player import (
DEVICE_CLASS_SPEAKER,
DEVICE_CLASS_TV,
DOMAIN as MP_DOMAIN,
)
from homeassistant.components.vizio.const import (
CONF_ADDITIONAL_CONFIGS,
CONF_APP_ID,
... | mezz64/home-assistant | tests/components/vizio/const.py | Python | apache-2.0 | 5,053 |
import unittest
from robotide.controller import Project
from robot.utils.asserts import assert_equals, assert_true, assert_false
from resources import FakeSettings
from robot.parsing.model import TestCaseFile
from robotide.controller.macrocontrollers import KEYWORD_NAME_FIELD
from robotide.controller.commands import U... | caio2k/RIDE | utest/controller/test_occurrences.py | Python | apache-2.0 | 24,428 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014 Brian Schmidt
# Licensed under the terms of the MIT License
"""Create a stand-alone executable"""
try:
from guidata.disthelpers import Distribution
except ImportError:
raise ImportError, "This script requires guidata 1.4+"
import spyderlib
import git as git
impor... | bps10/LM-Ratio | setup.py | Python | mit | 1,081 |
# -*- coding: UTF-8 -*-
# Copyright 2013-2018 Rumma & Ko Ltd.
# License: BSD (see file COPYING for details)
"""
Examples how to run these tests::
$ python setup.py test
$ python setup.py test -s tests.test_docs
"""
from unipath import Path
# import os
# os.environ['DJANGO_SETTINGS_MODULE'] = "lino_welfare.setting... | khchine5/lino-welfare | tests/__init__.py | Python | agpl-3.0 | 1,380 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="font", parent_name="histogram2d.legendgrouptitle", **kwargs
):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/legendgrouptitle/_font.py | Python | mit | 1,541 |
import sys
from time import sleep
from cachey import Cache, Scorer, nbytes
def test_cache():
c = Cache(available_bytes=nbytes(1) * 3)
c.put('x', 1, 10)
assert c.get('x') == 1
assert 'x' in c
c.put('a', 1, 10)
c.put('b', 1, 10)
c.put('c', 1, 10)
assert set(c.data) == set('xbc')
c... | Winterflower/cachey | cachey/tests/test_cache.py | Python | bsd-3-clause | 1,608 |
# Copyright (C) 2011 Synapse Wireless, Inc.
# Subject to your agreement of the disclaimer set forth below, permission is given by Synapse Wireless, Inc. ("Synapse") to you to freely modify, redistribute or include this SNAPpy code in any program. The purpose of this code is to help you understand and learn about SNAPpy... | synapse-wireless/bulk-reprogramming | snappyImages/synapse/LTC2412.py | Python | apache-2.0 | 6,013 |
__author__ = 'huqinghua'
# coding=gbk
import string, os, commands, time
from PyUI import *
from MsgBox import *
from PyFrameBase import *
def ShowMessageBox(hwnd, title, caption):
mbox1 = PyFrameCreator()
obj = mbox1.CreateForm(hwnd, 'MsgBox', 'MsgBox')
obj.SetText("LblCaption", title)
o... | est/py-ui4win | bin/UICommon.py | Python | bsd-2-clause | 376 |
"""
This page is in the table of contents.
Zoom out is a mouse tool to zoom out the display at the point where the mouse was clicked, decreasing the scale by a factor of two.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative impor... | nophead/Skeinforge50plus | skeinforge_application/skeinforge_plugins/analyze_plugins/analyze_utilities/zoom_out.py | Python | agpl-3.0 | 911 |
# -*- coding: utf-8 -*-
"""
"""
from __future__ import absolute_import
from ctypes import c_float
import datetime
from functools import partial
from shutil import copyfileobj
import tempfile
from pkg_resources import resource_filename
import os
import pytest
from six import binary_type, integer_types
from libtcd.com... | dairiki/python-libtcd | libtcd/tests/test_api.py | Python | bsd-3-clause | 22,812 |
import logging
from .user import User
class ApplianceUser(User):
super_user = "admin@local" # Use name that will work regardless of Management Authentication setting
def __init__(self, password, username=None):
self.logger = logging.getLogger(__name__)
self.logger.debug('Creating a user')
... | IBM-Security/ibmsecurity | ibmsecurity/user/applianceuser.py | Python | apache-2.0 | 528 |
##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstrasse 6, CH... | kishoredbn/barrelfish | tools/harness/checkout.py | Python | mit | 3,557 |
# Copyright (c) 2019 J. Alvarez-Jarreta and C.J. Brasher
#
# This file is part of the LipidFinder software tool and governed by the
# 'MIT License'. Please see the LICENSE file that should have been
# included as part of this software.
"""Filter contaminants and redundant artifacts from a LC/MS data
pre-processed by XC... | cjbrasher/LipidFinder | LipidFinder/PeakFilter/__init__.py | Python | mit | 11,413 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
'''Test that the POST payload is sucessfully created.'''
import requests
... | webcompat/issue-importer | test/test_payload.py | Python | mpl-2.0 | 1,137 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# This program is... | hmpf/nav | python/nav/mibs/itw_mibv4.py | Python | gpl-3.0 | 4,140 |
"""
tests.utils
~~~~~~~~~~~
Unit tests for the viewer.utils module.
:copyright: © 2014 by Petr Zemek <s3rvac@gmail.com> and contributors
:license: BSD, see LICENSE for more details
"""
import os
import unittest
from unittest import mock
from viewer.utils import chdir
from viewer.utils import non... | s3rvac/git-branch-viewer | tests/utils_tests.py | Python | bsd-3-clause | 1,835 |
# -*- coding: utf-8 -*-
import sys
import yaml
from collections import OrderedDict
from pyramid.paster import (
get_appsettings,
setup_logging,
)
import json
import os
from prettytable import PrettyTable
from pysite.rc import Rc
import pysite.models
# Init YAML to dump an OrderedDict like a regular dict... | dmdm/PySite | pysite/cli.py | Python | agpl-3.0 | 6,804 |
from application_base import *
from basinhopping_app import * | js850/PyGMIN | pygmin/application/__init__.py | Python | gpl-3.0 | 61 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license__", "__copyright__",
]
__title__ = "pyramid_swagger"
__summary__ = "Swag... | brianthelion/pyramid_swagger | pyramid_swagger/__about__.py | Python | bsd-3-clause | 582 |
from time import sleep
import fudge
from tests.local.base import StatsTest
class TimerTestCase(StatsTest):
@fudge.patch('tapes.local.meter.time')
def test_timer_has_meter(self, meter_time):
(meter_time
# initialize Meter
.expects_call().returns(1.0)
# mark()
.next... | emilssolmanis/tapes | tests/local/test_timer.py | Python | apache-2.0 | 1,979 |
import numpy as np
def donut(shape, radius, width, distribution='gaussian'):
'''Generate a 2D Gaussian window of the given shape. width specifies the
size of the Gaussian. radius specifies the distance to origo such that
the window becomes a ring.'''
if not distribution in ['gaussian', 'lognormal']:
... | andersbll/ipcv | ipcv/misc/donuts.py | Python | mit | 1,393 |
#!/usr/bin/env python
import tempfile
import webbrowser
import requests
import sys
import os
s = os.environ.get('DOT_FILE_VIZ_SERVER', 'http://127.0.0.1:6543')
url = s + '/dot'
fn = sys.argv[1]
resp = requests.post(url, files={'dot': open(fn, 'rb')})
t = resp.text
try:
resp.raise_for_status()
except:
sys.stderr... | mtholder/jds | example/view_dot.py | Python | bsd-2-clause | 613 |
#!/usr/bin/env python
"""
Count numbers of transitions and transversions
Usage: ts_tv.py [OPTIONS] homedir
"""
from __future__ import print_function
from __future__ import division
import sys
from itertools import permutations
import wormtable as wt
def count_Ts_Tv(homedir):
"""
Count number of of transit... | wormtable/wormtable | examples/tutorial/count-ts-tv.py | Python | lgpl-3.0 | 924 |
# -*- Mode: Python; test-case-name: flumotion.test.test_worker_feed -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Pub... | ylatuya/Flumotion | flumotion/component/feed.py | Python | gpl-2.0 | 11,518 |
import unittest
class InitializationTests(unittest.TestCase):
#def setUp(self):
# print "setting up"
#def tearDown(self):
# raise Exception("tearing down!")
def test_sanity(self):
"""Check that the world is sane and 2+2=4"""
self.assertEquals(2+2, 4)
def test_import(self):
""" We're able to impor... | meaton00/class_project | tests/__init__.py | Python | mit | 437 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most... | rcosnita/fantastico | virtual_env/libs/mysql-connector/python2/examples/microseconds.py | Python | mit | 3,325 |
#!/usr/bin/python
import re,logging
from sys import exit,version_info as ver
from optparse import OptionParser
from stat import S_ISREG,S_ISFIFO,S_ISLNK,S_ISSOCK
from os import path,uname,stat
try:
if ver[0] == 3:
from configparser import ConfigParser
else:
from ConfigParser import ConfigParser
except Exception... | skabople/spido | spido.py | Python | mit | 2,288 |
# Copyright 2008 German Aerospace Center (DLR)
#
# 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 agre... | jjdmol/LOFAR | LTA/LTAIngest/dav/webdav/acp/AceHandler.py | Python | gpl-3.0 | 6,562 |
import scipy.sparse
import numpy as np
from tectosaur.util.cpp import imp
fast_sparse = imp("tectosaur.util.fast_sparse")
def get_mv_fnc(base_name, dtype, blocksize):
fnc_name = base_name + str(blocksize)
if dtype == np.float32:
return getattr(fast_sparse, 's' + fnc_name)
else:
return geta... | tbenthompson/tectosaur | tectosaur/util/sparse.py | Python | mit | 2,061 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from time import sleep
msg = [u'あ', u'り', u'が', u'う']
wait = 0.7
for m in msg:
print(m, end="", flush=True)
sleep(wait)
print('\b', end="", flush=True)
sleep(wait)
print(u'と', end="", flush=True)
sleep(wait)
print(u'う', end="", flush=True)
sleep(wait)
print("""
Q.「I... | yutakakn/MyScript | Python/thanks.py | Python | bsd-3-clause | 534 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import subprocess
import pprint
import os
class WorkNotFound( Exception ):
"""
Error of No Work Defines
"""
pass
class State( object ):
def __init__( self ,args=None ):
if not args:
pass #添加默认参数信息
else:
... | hackshel/metaCollecter | src/meta/modules/mod_freebsd_route.py | Python | bsd-3-clause | 3,881 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | jakereps/q2-diversity | q2_diversity/tests/test_procrustes.py | Python | bsd-3-clause | 7,970 |
#! /usr/bin/env python
"""
Module difflib -- helpers for computing deltas between objects.
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best "good enough" matches.
Function context_diff(a, b):
For two lists of strings, return a delta in ... | deanhiller/databus | webapp/play1.3.x/python/Lib/difflib.py | Python | mpl-2.0 | 83,066 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... | repotvsupertuga/tvsupertuga.repository | script.module.streamtvsupertuga/lib/resources/lib/sources/de/__init__.py | Python | gpl-2.0 | 851 |
from __future__ import unicode_literals
from datetime import timedelta
from uuid import uuid4
from django.conf import settings
from django.utils.six import python_2_unicode_compatible, text_type
from django.utils.translation import ugettext_lazy as _
from .exceptions import TokenBackendError, TokenError
from .settin... | cloudera/hue | desktop/core/ext-py/djangorestframework_simplejwt-3.3/rest_framework_simplejwt/tokens.py | Python | apache-2.0 | 9,584 |
import os.path as op
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
import pytest
from itertools import compress
from mne import io, pick_types, pick_channels, read_events, Epochs
from mne.channels.interpolation import _make_interpolation_matrix
from mne.datasets import testing
from ... | drammock/mne-python | mne/channels/tests/test_interpolation.py | Python | bsd-3-clause | 12,456 |
#!/usr/bin/python
# URL that generated this code:
# http://txt2re.com/index-python.php3?s=postgres%20%20%20645%20%200.0%20%200.5%20226688%2021460%20?%20%20%20%20%20%20%20%20S%20%20%20%2008:48%20%20%200:00%20/usr/lib/postgresql/9.4/bin/postgres%20-D%20/var/lib/postgresql/9.4/main%20-c%20config_file=/etc/postgresql/9.4/... | PolymorhicCode/system_status | test.py | Python | gpl-3.0 | 1,422 |
"""The base implementation for a collection of images.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class ImageRepository(object):
"""A repository fo... | captiosus/treadmill | treadmill/runtime/linux/image/_repository_base.py | Python | apache-2.0 | 754 |
import threading
import time
import uuid
import escp.messaging.coders as coders
import escp.messaging.rpc as rpc
import escp.messaging.session as session
import escp.tools.reactor as reactor
import escp.tools.records as records
_instance_count = 8
_call_count = 64
def _server_handler (_request) :
if _request[0]... | cipriancraciun/extremely-simple-cluster-platform | components/py-messaging/examples/rpc_sync.py | Python | gpl-3.0 | 1,836 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... | capoe/espressopp.soap | src/tools/povwrite.py | Python | gpl-3.0 | 9,460 |
import os, random, struct, hashlib
from Cryptodome.Cipher import AES
#requires pycryptodomex on linux
def encrypt_file(key, in_filename, out_filename=None, chunksize=64*1024):
key = hashlib.sha256(key).digest()
if not out_filename:
out_filename = in_filename + '.enc'
iv = ''.join(chr(random.rand... | djames1987/DracoSoft | dev/scripts/python/encryption/new_aes_test.py | Python | gpl-3.0 | 1,595 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from projects.models import Project
LEVEL_CHOICES = (
('v1-org-5', '$5/mo'),
('v1-org-10', '$10/mo'),
('v1-org-15', '$15/mo'),
('v1-org-20', '$20/mo'),
('v1-org-50', '$50/mo'),
('v1-org-100', '$100/mo'),
)
c... | d0ugal/readthedocs.org | readthedocs/gold/models.py | Python | mit | 1,088 |
# unit tests for ansible fact collectors
# -*- coding: utf-8 -*-
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansibl... | mattclay/ansible | test/units/module_utils/facts/test_collectors.py | Python | gpl-3.0 | 21,703 |
VERSION='0.4.10'
| RemoteConnectionManager/RCM_spack_deploy | lib/utils/external/hiyapyco/version.py | Python | lgpl-3.0 | 17 |
#!/usr/bin/env python
import sys
from setuptools import setup, find_packages
if not sys.version_info[0] == 3:
print('only python3 supported!')
sys.exit(1)
if not sys.version_info[1] > 5:
print('only python > 3.5 supported, got: {}.{}'.format(sys.version_info[0], sys.version_info[1]))
sys.exit(1)
set... | smartshark/labelSHARK | setup.py | Python | apache-2.0 | 1,394 |
#
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests.mock import patch
from ansible.modules.network.ml... | le9i0nx/ansible | test/units/modules/network/mlnxos/test_mlnxos_linkagg.py | Python | gpl-3.0 | 4,577 |
# This is a patch of Django's jinja2 backend that allows Jinja2 templates to
# use context_processors
# Since this package contains a "django" module, this is required on Python 2.
from __future__ import absolute_import
import sys
import jinja2
from django.utils import six
from django.template.backends import jinja2... | patrickspencer/compass-python | webapp/apps/core/jinja2/Jinja2Backend.py | Python | apache-2.0 | 2,175 |
#!/usr/bin/env python
from mpi4py import MPI
from baselines.common import set_global_seeds
import os.path as osp
import gym, logging
from baselines import logger
from baselines import bench
import sys
def wrap_train(env):
from baselines.common.atari_wrappers import (wrap_deepmind, FrameStack)
env = wrap_deepmi... | pcchenxi/baseline | baselines/trpo_mpi/run_atari.py | Python | mit | 1,925 |
import inspect
import re
#
# Reuseable IShards
#
def ShutdownHandler(self):
while self.dataReady("control"):
cmsg = self.recv("control")
if isinstance(cmsg, Axon.Ipc.producerFinished) or \
isinstance(cmsg, Axon.Ipc.shutdownMicroprocess):
self.send(cmsg, "signal")
... | sparkslabs/kamaelia_ | Sketches/MPS/Experiments/Shard/InlineShards.py | Python | apache-2.0 | 1,011 |
#
# Copyright (C) 2013-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | psci2195/espresso-ffans | testsuite/python/hat.py | Python | gpl-3.0 | 2,119 |
# -*- coding: utf-8 -*-
import json
from ..base.multi_account import MultiAccount
class HighWayMe(MultiAccount):
__name__ = "HighWayMe.py"
__type__ = "account"
__version__ = "0.10"
__status__ = "testing"
__config__ = [
("mh_mode", "all;listed;unlisted", "Filter hosters to use", "all"),
... | vuolter/pyload | src/pyload/plugins/accounts/HighWayMe.py | Python | agpl-3.0 | 2,022 |
# -*- coding: utf-8 -*-
import os
import argparse
from lxml import etree
import fnmatch
import time
from langdetect import detect_langs
from langdetect.lang_detect_exception import LangDetectException
from langid.langid import LanguageIdentifier, model
def timeit(method):
"""Time methods."""
def timed(*args,... | chozelinek/europarl | langid_filter.py | Python | mit | 6,257 |
from aospy.constants import c_p, L_v
from aospy_user.calcs.universal.dynamics import gz
from aospy.utils import to_pascal
from aospy import PFULL_STR
def dse(temp, sphum, dp, p):
""" Returns the dry static energy at each gridbox.
.. math::
s = c_p T + gz
Parameters
----------
temp : Data... | spencerkclark/aospy-obj-lib | aospy_user/calcs/universal/thermo.py | Python | gpl-3.0 | 3,230 |
import sys, os
import inspect
import fnmatch
from pymake import Model, Corpus
from pymake.core.types import resolve_model_name
from pymake.core.logformatter import logger
class FrontendManager(object):
""" Utility Class who aims at mananing/Getting the datastructure at the higher level.
Parameters
... | dtrckd/pymake | pymake/frontend/manager.py | Python | gpl-3.0 | 7,343 |
#!/usr/bin/env python3
class Solution(object):
def removeComments(self, source):
"""
:type source: List[str]
:rtype: List[str]
"""
length, i, ret = len(source), 0, []
while i < length:
index1 = source[i].find('//')
index2 = source[i].find('/*'... | eroicaleo/LearningPython | interview/leet/722_Remove_Comments.py | Python | mit | 1,310 |
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2009, 2010, 2011, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option... | Panos512/invenio | modules/webstat/lib/webstat_webinterface.py | Python | gpl-2.0 | 53,883 |
SBINDIR="/usr/sbin"
BINDIR="/usr/bin"
LIBEXEC="/usr/lib/xen/bin"
LIBDIR="/usr/lib64"
SHAREDIR="/usr/share"
PRIVATE_BINDIR="/usr/lib64/xen/bin"
XENFIRMWAREDIR="/usr/lib/xen/boot"
XEN_CONFIG_DIR="/etc/xen"
XEN_SCRIPT_DIR="/etc/xen/scripts"
XEN_LOCK_DIR="/var/lock"
XEN_RUN_DIR="/var/run/xen"
XEN_PAGING_DIR="/var/lib/xen/x... | Hearen/OnceServer | pool_management/bn-xend-core/util/path.py | Python | mit | 330 |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from quoteline import views
urlpatterns = patterns('',
url(r'^index/$', views.GreetingView.as_view(), name="greeting"),
url(r'^showquote/$', views.ShowQuote.as_view(), name="display"),
) | GitSomeCode/Random-Quote | quoteline/urls.py | Python | mit | 291 |
# -*- coding: utf-8 -*-
from django.db import models
from django.db.models import Q
from datetime import timedelta
from django.utils import timezone
from contest_app.models.contest_types import Contest_Type
from contest_app.models.metrics import Metric
from beauty_and_pics.consts import project_constants
from website.... | entpy/beauty-and-pics | beauty_and_pics/django_messages/models.py | Python | mit | 2,267 |
from django.contrib.auth.models import User
from django.db import models
from django.utils.html import escape
from django.utils.translation import ugettext_lazy as _
import bleach
from aefat.activities.models import Activity
class Feed(models.Model):
user = models.ForeignKey(User)
date = models.DateTimeFiel... | ouedraog/aefat | aefat/feeds/models.py | Python | mit | 2,143 |
# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
"""Test for the smooth solvers."""
from __f... | kohr-h/odl | odl/test/solvers/smooth/smooth_test.py | Python | mpl-2.0 | 5,137 |
import abc
import collections
__all__ = ['DuckType', 'DuckMeta']
def _hasattr(C, attr):
try:
return any(attr in B.__dict__ for B in C.__mro__)
except AttributeError:
# Old-style class
return hasattr(C, attr)
def _hasall(C, attrs):
return all(
_hasattr(C, name) for name in a... | OaklandPeters/abf | abf/ducktype.py | Python | mit | 3,148 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | CubicERP/odoo | addons/product/product.py | Python | agpl-3.0 | 67,910 |
__author__ = 'brad'
import os
import src.engine as engine
import pygame
RESOURCE_DIR = os.path.join(os.path.dirname(__file__),'../../resources/') + '/'
FONT_DIR = RESOURCE_DIR + 'font/'
class HUD(engine.CoordinateSurface):
def __init__(self, screen_size):
engine.CoordinateSurface.__init__(self, pygame.R... | branderson/PyZelda | src/game/gui.py | Python | mit | 5,763 |
"""The tests for the Template automation."""
from datetime import timedelta
from unittest import mock
from unittest.mock import patch
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.template import trigger as template_trigger
from homeassistant.const import ATTR_EN... | jawilson/home-assistant | tests/components/template/test_trigger.py | Python | apache-2.0 | 27,446 |
"""
===========================
Color cycle from a colormap
===========================
``cycle_cmap`` provides a simple way to set the color cycle to evenly-spaced
intervals of a given colormap. By default, it alters the default color cycle,
but if you pass it a plot axes, only the color cycle for the axes is altered... | matteoicardi/mpltools | doc/examples/color/plot_cycle_cmap.py | Python | bsd-3-clause | 895 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of casiopeia.
#
# Copyright 2014-2016 Adrian Bürger, Moritz Diehl
#
# casiopeia 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... | adbuerger/casiopeia | casiopeia/system.py | Python | lgpl-3.0 | 6,254 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
#
# Freeciv - Copyright (C) 2003 - Raimar Falke
# 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, or (at your option)
# a... | andreasrosdal/freeciv-web | scripts/generate_js_hand/generate_packets.py | Python | agpl-3.0 | 48,852 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | creativewild/ansible | lib/ansible/plugins/action/fetch.py | Python | gpl-3.0 | 7,207 |
"""propalyzer_site URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
... | toms3t/Propalyzer | propalyzer_site/propalyzer_site/urls.py | Python | mit | 1,067 |
#!/usr/bin/python3
# -----------------------------------------------------------------------------
# grlora_analyze.py
# A Python tool capable of performing a real-time analysis of signals passed
# by GNU Radio.
#
# Author: Pieter Robyns
# -----------------------------------------------------------------------------
... | rpp0/gr-lora | apps/grlora_analyze.py | Python | gpl-3.0 | 5,375 |
import os
import sys
from raygun4py.middleware import flask as flask_raygun
PYTHON_VERSION = sys.version_info[0]
if PYTHON_VERSION == 3:
import urllib.parse
else:
import urlparse
basedir = os.path.abspath(os.path.dirname(__file__))
if os.path.exists('config.env'):
print('Importing environment from .env f... | hack4impact/next-gen-scholars | config.py | Python | mit | 3,920 |
#!/usr/bin/env python
#
# Copyright 2008 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 o... | aykuttasil/google-appengine-wx-launcher | launcher/settings_controller_unittest.py | Python | apache-2.0 | 3,696 |
# -*- 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 'Feed.disabled'
db.add_column('rainman_feed', 'disabled',
self.gf('djan... | smurfix/HomEvenT | irrigation/rainman/migrations/0051_auto__add_field_feed_disabled.py | Python | gpl-3.0 | 22,162 |
#
# BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2005 Michael "ThorN" Thornton
#
# 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 opti... | AusTac/parma | b3/parsers/frostbite/punkbuster.py | Python | gpl-2.0 | 1,743 |
import unittest
from numba import njit
class TestModule(unittest.TestCase):
def test_module_not_in_namespace(self):
""" Test of trying to run a compiled function
where the module from which the function is being compiled
doesn't exist in the namespace.
"""
filename = 'test... | cpcloud/numba | numba/tests/test_funcdesc.py | Python | bsd-2-clause | 826 |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 4 14:51:19 2015
@author: rfeather
"""
import parsimony
import os
class MockCache(parsimony.persistence.MemCache):
pass
class MockStore(parsimony.persistence.PickleStore):
pass
def setup_function(function):
parsimony.configuration.reset()
def teardown_fu... | ryanfeather/parsimony | test/test_configuration.py | Python | mit | 1,318 |
import allure
from allure_commons_test.report import has_test_case
from allure_commons_test.result import with_status, with_message_contains, has_status_details
from hamcrest import assert_that
@allure.issue("376")
@allure.feature("Integration")
def test_pytest_check(allured_testdir):
"""
>>> import pytest_c... | allure-framework/allure-python | allure-pytest/test/integration/pytest_check/pytest_check_test.py | Python | apache-2.0 | 961 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Yahoo! 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... | JioCloud/taskflow | taskflow/engines/__init__.py | Python | apache-2.0 | 1,082 |
from django.contrib import admin
from priorityDB.models import *
# Register your models here
# For more information on this file, see
# https://docs.djangoproject.com/en/dev/intro/tutorial02/
class TaskHistoryInline(admin.StackedInline):
model = TaskHistory
extra = 0
class EventAdmin(admin.ModelAdmin):
... | lowellbander/ngVote | priorityDB/priorityDB/admin.py | Python | gpl-2.0 | 418 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Copyright (c) 2016 Cédric Clerget - HPC Center of Franche-Comté University
#
# This file is part of Janua-SMS
#
# http://github.com/mesocentrefc/Janua-SMS
#
# This program is free software: you can redistribute it and/or modify
# it under th... | mesocentrefc/Janua-SMS | janua/activity/send_sms.py | Python | gpl-2.0 | 6,330 |
# -*- coding: utf-8 -*-
#
# django-granadilla
# Copyright (C) 2009-2012 Bolloré telecom
# See AUTHORS file for a full list of contributors.
#
# 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, eith... | Polyconseil/granadilla | granadilla/urls.py | Python | gpl-3.0 | 1,872 |
# 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 ... | sharbison3/python-docs-samples | auth/api-client/snippets.py | Python | apache-2.0 | 2,252 |
#!/usr/bin/python
import os, sys, re, glob
if len(sys.argv) != 2:
print "Usage: check-consistency <path>"
sys.exit(0)
rexp = re.compile('.*{ CPU_FEATURE_([^,]+), "([^"]+)".*}.*')
print "Finding features:"
for fn in glob.glob("%s/*.c" % sys.argv[1]):
f = open(fn, "rt")
line = 1
nfeat = 0
for s in f.readlines():... | joestringer/libcpuid | libcpuid/check-consistency.py | Python | bsd-2-clause | 3,913 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from pootle.core.plugin import getter
from p... | claudep/pootle | tests/core/plugin/getters.py | Python | gpl-3.0 | 3,135 |
# -*- coding: utf-8 -*-
from distutils.core import setup
import os.path
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Library or Lesser General Public Lice... | huyx/icall | setup.py | Python | lgpl-3.0 | 1,026 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.