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 -*-
# Generated by Django 1.11.5 on 2018-01-08 11:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_workflow', '0005_auto_20180104_1559'),
]
operations = [
migrations.A... | dani0805/django_workflow | django_workflow/migrations/0006_transition_description.py | Python | bsd-3-clause | 518 |
# -*- coding: utf-8 -*-
"""
zine.plugins.miniblog_theme
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Very simple zine theme.
:copyright: (c) 2010 by the Zine Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from os.path import join, dirname
TEMPLATE_FILES = join(dirname(__file_... | mitsuhiko/zine | zine/plugins/miniblog_theme/__init__.py | Python | bsd-3-clause | 917 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 1998-2021 Stephane Galland <galland@arakhne.org>
#
# This program is free library; 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
... | gallandarakhneorg/autolatex | tests/autolatex2tests/translators/dot2png_test.py | Python | lgpl-3.0 | 1,234 |
import sublime
import sys
from lint import Linter
from sublimelint.lint.util import which
class Python(Linter):
language = 'python'
cmd = 'pyflakes'
regex = r'^.+?:(?P<line>\d+):((?P<col>\d+):)?\s*(?P<error>.+)'
def run(self, cmd, code):
python3 = False
if (self.filename or '').starts... | lunixbochs/linters | python.py | Python | mit | 819 |
import SimpleRTK as srtk
import sys
import os
import glob
from .csv_handler import Projection
from .csv_handler import CsvHandler
class GeometryMaker(object):
'''
This class provides a set of instruments to write a .xml geometry for the
RTK (Reconstruction ToolKit) library starting from a .csv
This ... | dannylessio/RTK-handler | RTK_handler/geometry_maker.py | Python | gpl-3.0 | 3,710 |
from __future__ import unicode_literals
import datetime
import hashlib
import random
import re
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.db import models
from django.template import RequestContext, TemplateDoesNotExist
from django.template.loader import render_to... | meletakis/Information-Systems-Technologies---Week-3 | myproject/registration/models.py | Python | gpl-2.0 | 11,725 |
import io
from django.test import TestCase
from explorer.actions import generate_report_action
from explorer.tests.factories import SimpleQueryFactory
from explorer.utils import csv_report
from zipfile import ZipFile
class testSqlQueryActions(TestCase):
def test_simple_query_runs(self):
expected_csv = ... | guilhermemaba/django-sql-explorer | explorer/tests/test_actions.py | Python | mit | 1,728 |
"""
Implements Repos UI
"""
from robottelo.ui.base import Base
from robottelo.common.constants import REPO_TYPE, CHECKSUM_TYPE
from robottelo.ui.locators import locators, common_locators
from selenium.webdriver.support.select import Select
class Repos(Base):
"""
Manipulates Repos from UI
"""
def cre... | apagac/robottelo | robottelo/ui/repository.py | Python | gpl-3.0 | 7,030 |
#coding=utf-8
from flask.ext.wtf import Form
from wtforms import StringField, ValidationError
from wtforms.validators import Required, Length, IPAddress, Regexp
from IPy import IP
from app.models import Sales, Client, IpSubnet, IpPool
re_ip_one = '^(25[0-5]|2[0-4]\d|[01]?\d\d?)$'
class IpPoolForm(Form):
subnet ... | Leon109/IDCMS-Web | web/app/cmdb/ippool/forms.py | Python | apache-2.0 | 2,862 |
# Copyright 2011 Fred Hatfull
#
# This file is part of Partify.
#
# Partify 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.
#
# Partify... | fhats/partify | partify/admin.py | Python | gpl-3.0 | 5,999 |
#!/usr/bin/env python
"""
Reads a list of intervals and an axt. Produces a new axt containing the
portions of the original that overlapped the intervals
usage: %prog interval_file refindex [options] < axt_file
-m, --mincols=10: Minimum length (columns) required for alignment to be output
"""
import sys
import bx... | bxlab/bx-python | scripts/axt_extract_ranges.py | Python | mit | 1,840 |
# -*- coding: utf-8 -*-
import classes.level_controller as lc
import classes.game_driver as gd
import classes.extras as ex
import classes.board
import random
import pygame
class Board(gd.BoardGame):
def __init__(self, mainloop, speaker, config, screen_w, screen_h):
self.level = lc.Level(self,mainloop,5,... | OriHoch/pysiogame | game_boards/game070.py | Python | gpl-3.0 | 12,968 |
from pahera.models import Person
from django.db import connection, transaction
from pahera.Utilities import DictFetchAll
# To check whether there exists a user with same email or phone no before registering the new user..!!!
def VerifyTheUser(data):
cursor = connection.cursor()
email = data['email']
phone ... | thebachchaoproject/bachchao-server | pahera/PythonModules/CheckIfUserExists_mod.py | Python | mit | 1,431 |
import java
from java import util
l = util.ArrayLi<ref>st() | asedunov/intellij-community | python/testData/resolve/pyToJava/PackageType.py | Python | apache-2.0 | 60 |
from scytale.ciphers import RailFence
from scytale.exceptions import ScytaleError
import pytest
def test_from_worksheet():
cipher = RailFence(key=5)
ciphertext = cipher.encrypt("WELCOME TO VILLIERS PARK")
assert cipher.compare("WTEE OIRKLE LSRCMVL AOIP", ciphertext), ciphertext
plaintext = cipher.de... | WilliamMayor/scytale.xyz | tests/test_railfence.py | Python | mit | 1,098 |
# $Id: cluster_ensemble.py 3078 2016-04-06 19:46:43Z schowell $
import numpy
import time
import os
import sasmol.sasmol as sasmol
import sassie.calculate.convergence_test as convergence_test
try:
dummy = os.environ["DISPLAY"]
except:
# allows for creating plots without an xserver
import matplotlib
matpl... | madscatt/zazzie | src_2.7/scripts/cluster_ensemble.py | Python | gpl-3.0 | 4,622 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats
import numpy as np
from scipy.cluster.hierarchy import linkage, dendrogram
def _plot_rectangle(frameloc, color='k', linewidth... | helloTC/ATT | util/plotfig.py | Python | mit | 22,880 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 1.5, s, t 3.1, s, q"
tags = "RotateTo"
import cocos
from cocos.director import director
from cocos.sprite import Sprite
import pyglet
clas... | eevee/cocos2d-mirror | test/test_rotateto.py | Python | bsd-3-clause | 1,292 |
# -*- coding: utf-8 -*-
import random as rand
class PrimeTester(object):
def solovay_strassen(self, primo, acuracidade=5):
nro_tentativas = 0
if primo == 2 or primo == 3:
return (nro_tentativas, True)
if primo < 2:
raise ValueError('Entrada < 2')
if primo %... | tonussi/inseguro | laboratorio/rsa/pseudo.py | Python | mit | 4,350 |
# stdlib
import time
import unittest
# 3p
from mock import Mock
class MockProcess(Mock):
"""
A mocked process.
"""
def __init__(self, agentConfig=None, hostname=None, **options):
super(MockProcess, self).__init__()
self.config = agentConfig
self.hostname = hostname
sel... | huhongbo/dd-agent | tests/core/test_win32_agent.py | Python | bsd-3-clause | 2,436 |
import json
import logging
import requests
from analysis.PluginBase import AnalysisBasePlugin
from objects.file import FileObject
from plugins.mime_blacklists import MIME_BLACKLIST_COMPRESSED, MIME_BLACKLIST_NON_EXECUTABLE
class AnalysisPlugin(AnalysisBasePlugin):
NAME = 'hashlookup'
DESCRIPTION = (
... | fkie-cad/FACT_core | src/plugins/analysis/hashlookup/code/hashlookup.py | Python | gpl-3.0 | 2,418 |
# -*- coding: utf-8 -*-
import os
import json
import re
try:
from xmlrpclib import Fault, ProtocolError
except ImportError: # Python 3
from xmlrpc.client import Fault, ProtocolError
from channelarchiver import codes, utils
tests_dir = os.path.dirname(os.path.realpath(__file__))
data_dir = os.path.join(tests... | NSLS-II/channelarchiver | tests/mock_archiver.py | Python | mit | 5,559 |
# -*- coding: utf-8 -*-
__all__ = ('FilterForm',)
import datetime
from django import forms
class FilterForm(forms.Form):
from_date = forms.DateField(label="De",
required=False,
initial=datetime.date.today,
widget=form... | LethusTI/supportcenter | vendor/lethusbox/lethusbox/django/forms.py | Python | gpl-3.0 | 519 |
# -*- coding: utf-8 -*-
"""<base> template"""
from ..environment import env
base = env.from_string("""\
<base {% if href -%} href="{{ href }}" {% endif -%}
{% if target -%} target="{{ target }}" {% endif -%}>
""")
| bharadwajyarlagadda/korona | korona/templates/html/tags/base.py | Python | mit | 222 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('carts', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='cart',
name='user',
... | giovannicode/djangoseller | carts/migrations/0002_remove_cart_user.py | Python | bsd-3-clause | 335 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libidn2(AutotoolsPackage):
"""Libidn2 is a free software implementation of IDNA2008, Punyc... | rspavel/spack | var/spack/repos/builtin/packages/libidn2/package.py | Python | lgpl-2.1 | 1,020 |
"""
TODO: Modify unittest doc.
"""
import unittest
import random
import sys
from monty.string import remove_non_ascii, unicode2str
class FuncTest(unittest.TestCase):
def test_remove_non_ascii(self):
s = "".join(chr(random.randint(0, 127)) for i in range(10))
s += "".join(chr(random.randint(128, ... | materialsvirtuallab/monty | tests/test_string.py | Python | mit | 674 |
#!/usr/bin/python
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSI... | resmo/ansible | lib/ansible/modules/cloud/openstack/os_network.py | Python | gpl-3.0 | 8,857 |
#
# 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... | airbnb/airflow | tests/utils/test_python_virtualenv.py | Python | apache-2.0 | 2,580 |
import ALA3
from fitensemble.nmr_tools import scalar_couplings
import matplotlib.pyplot as plt
import numpy as np
import experiment_loader
import matplotlib
from fitensemble import belt
matplotlib.rcParams.update({'font.size': 20})
alpha = 0.2
num_grid = 2000
phi = np.linspace(-180,180,num_grid)
O = np.ones(num_grid)
... | kyleabeauchamp/EnsemblePaper | code/figures/old/plot_rhiju_figure_2x2_top_karplus.py | Python | gpl-3.0 | 1,618 |
# -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
import collections
from ....rsr.model... | akvo/akvo-rsr | akvo/iati/imports/mappers/descriptions.py | Python | agpl-3.0 | 8,336 |
"""Access control permission."""
class Permission(object):
"""Permission that identity can have."""
def __init__(self, name):
"""Create permission.
:param name: Unique permission name within one role.
"""
self.name = name
def check(self, identity, *args, **kwargs):
... | paylogic/balrog | balrog/permission.py | Python | mit | 1,084 |
# -*- coding: utf-8 -*-
from django.dispatch import Signal
msg_providing_args = ['message', 'token', 'raw_xml']
user_providing_args = ['user', 'token', 'raw_xml']
message_create = Signal(providing_args=msg_providing_args)
message_update = Signal(providing_args=msg_providing_args)
message_move = Signal(providing_args... | piquadrat/django-lithium-api | django_lithium_api/signals.py | Python | bsd-3-clause | 629 |
# Copyright 2009-2010 10gen, 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,... | reedobrien/mongo-python-driver | pymongo/max_key.py | Python | apache-2.0 | 604 |
"""
Standardizes multiprocessing use. In the CEA, some functions are run using the standard ``multiprocessing`` library.
They are run by ``map``ing the function to a list of arguments (see ``multiprocessing.Pool.map_async``) and waiting
for the processes to finish, while at the same time piping STDOUT, STDERR through
`... | architecture-building-systems/CEAforArcGIS | cea/utilities/parallel.py | Python | mit | 6,152 |
import os as _os
__version__='2.0.1'
__description__='General Purpose Radio Astronomy and Data Analysis Utilities'
__author__='Nithyanandan Thyagarajan'
__authoremail__='nithyanandan.t@gmail.com'
__maintainer__='Nithyanandan Thyagarajan'
__maintaineremail__='nithyanandan.t@gmail.com'
__url__='http://github.com/nithyan... | nithyanandan/general | astroutils/__init__.py | Python | mit | 473 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# print("Hello World")
name = input("请问你的名字是:")
print(name, '你好,欢迎学习Python编程!')
| felix9064/python | Demo/liaoxf/do_input.py | Python | mit | 163 |
"""Tests for the attribute exchange extension module
"""
import unittest
from openid.extensions import ax
from openid.message import NamespaceMap, Message, OPENID2_NS
from openid.consumer.consumer import SuccessResponse
class BogusAXMessage(ax.AXMessage):
mode = 'bogus'
getExtensionArgs = ax.AXMessage._newA... | necaris/python3-openid | openid/test/test_ax.py | Python | apache-2.0 | 21,522 |
#
# Unit tests for the zscii class.
#
# For the license of this file, please consult the LICENSE file in the
# root directory of this distribution.
#
from unittest import TestCase
from zvm import zstring
from zvm import zmemory
def make_zmemory():
# We use Graham Nelson's 'curses' game for our unittests.
story... | BGCX262/zvm-hg-to-git | tests/zscii_tests.py | Python | bsd-3-clause | 2,187 |
"""
Application file for the user accounts app.
"""
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class AccountsConfig(AppConfig):
"""
Application configuration class for the user accounts app.
"""
name = 'apps.accounts'
verbose_name = _('User profiles... | TamiaLab/carnetdumaker | apps/accounts/apps.py | Python | agpl-3.0 | 323 |
import numpy as np
import cv2
import subprocess
class NullFile(object):
def fileno(self):
return 0
def write(self, data):
pass
class FFWriter(object):
def __init__(self, fname, fps, (width, height), codec='libx264', pixfmt=None, moreflags=''):
self.width = width
self.height = height
self.proc = subproc... | crackwitz/videozeug | ffwriter.py | Python | mit | 1,456 |
# 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... | apache/incubator-airflow | airflow/api_connexion/security.py | Python | apache-2.0 | 2,105 |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import hashlib
import sys
import os
from random ... | BTCfork/hardfork_prototype_1_mvf-bu | share/rpcuser/rpcuser.py | Python | mit | 1,169 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-29 13:41
from __future__ import unicode_literals
import datetime
from django.db import migrations
from django.utils.timezone import utc
import django_unixdatetimefield.fields
class Migration(migrations.Migration):
dependencies = [
('antipoac... | antipoachingmap/django-app | antipoaching/migrations/0004_event_timestamp.py | Python | mit | 684 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Locaweb.
# 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/license... | ykaneko/neutron | neutron/agent/linux/iptables_manager.py | Python | apache-2.0 | 14,380 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Author: echel0n <sickrage.tv@gmail.com>
# URL: http://www.github.com/sickragetv/sickrage/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | edlabh/SickRage | sickbeard/providers/omgwtfnzbs.py | Python | gpl-3.0 | 5,875 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; mixedindent off; indent-mode python;
from ..plugin import *
from arsoft.filelist import *
from arsoft.trac.admin import TracAdmin
import tempfile
import sys
class TracBackupPluginConfig(BackupPluginConfig):
class TracEnvItem(obje... | aroth-arsoft/arsoft-python | python3/arsoft/backup/plugins/trac.py | Python | gpl-3.0 | 3,434 |
# -*- coding: utf-8 -*-
from pyxmpp import streamtls
from pyxmpp.all import JID, Message
from pyxmpp.interface import implements
from pyxmpp.interfaces import *
from pyxmpp.jabber.client import JabberClient
from module.plugins.hooks.IRCInterface import IRCInterface
class XMPPInterface(IRCInterface, JabberClient):
... | joberreiter/pyload | module/plugins/hooks/XMPPInterface.py | Python | gpl-3.0 | 8,263 |
import repeat
print repeat.repeat("qwerty",1,4,5)
try:
print repeat.repeat(1,4,5,6)
except Exception as ex:
print ex
try:
print repeat.repeat("qwerty",1,4,5,6)
except Exception as ex:
print ex
| spiridoncha/CPython | testrepeat.py | Python | mit | 212 |
# Copyright (C) 2008-2013 Anders Waldenborg et al.
#
# 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... | wanders/buildbot-extras | buildbotextras/steps/coverity.py | Python | mit | 4,187 |
# -*- coding: utf-8 -*-
# ********************第三方相关模块导入********************
import math
import xlrd # 用于读取Excel数据
import xlutils.copy as xlcopy # 用于重写Excel数据
# ********************PyQt5相关模块导入********************
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont
from PyQt5.QtGui import QIcon
from PyQt5.QtWidge... | IamLJT/LaserQt | code/LaserQt_MainWindow.py | Python | mit | 12,678 |
import ast
import sys
import warnings
try:
from StringIO import StringIO
except:
# Python 3 support
from io import StringIO
# Python 3 does not have execfile, so just create one
def xfile(filename, globalz=None, localz=None):
with open(filename, "r") as fh:
exec(fh.read(), globalz, localz)
de... | huan/Underscore | tests/test_utils.py | Python | mit | 605 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'LostPasswordHash'
db.create_table('sentry_lostpasswordhash', (
('id', self.gf('d... | rdio/sentry | src/sentry/migrations/0069_auto__add_lostpasswordhash.py | Python | bsd-3-clause | 20,587 |
from ursina import *
class Wolf3dPlayer(Entity):
def __init__(self, **kwargs):
super().__init__()
self.speed = 5
self.position = (1,5,1)
self.height = 0.5
self.camera_pivot = Entity(parent=self, y=self.height)
self.cursor = Entity(parent=camera.ui, model='quad', col... | jammers-ach/pywolf3d | pywolf3d/player.py | Python | mit | 3,285 |
#!/usr/bin/env python3
"""Unpack and repack OP1 firmware in order to create custom firmware."""
import os
import stat
import lzma
import shutil
import struct
import tarfile
import logging
import binascii
class OP1Repack:
"""Unpack and repack OP-1 firmware and other related utilities."""
# TODO:
# - Do so... | op1hacks/op1-fw-repacker | op1repacker/op1_repack.py | Python | mit | 7,411 |
# Comet VOEvent Broker.
# Check for previously seen events.
from twisted.internet.threads import deferToThread
from zope.interface import implementer
from comet.icomet import IValidator
import comet.log as log
__all__ = ["CheckPreviouslySeen"]
@implementer(IValidator)
class CheckPreviouslySeen(object):
def __i... | jdswinbank/Comet | comet/validator/previously_seen.py | Python | bsd-2-clause | 992 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Tristan Fischer (sphere@dersphere.de)
#
# 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 Lice... | dersphere/plugin.video.4players | resources/lib/api.py | Python | gpl-2.0 | 6,803 |
from p2pool.arcticcoin import networks
PARENT = networks.nets['arcticcoin_testnet']
SHARE_PERIOD = 20 # seconds
CHAIN_LENGTH = 24*60*60//20 # shares
REAL_CHAIN_LENGTH = 24*60*60//20 # shares
TARGET_LOOKBEHIND = 100 # shares
SPREAD = 10 # blocks
IDENTIFIER = '75D8B6F2A87E5BEC'.decode('hex')
PREFIX = '4184B6F5BA58529B'.... | DenisZagvozkin/p2pool | p2pool/networks/arcticcoin_testnet.py | Python | gpl-3.0 | 527 |
"""
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... | CubicERP/geraldo | site/newsite/django_1_0/django/core/cache/__init__.py | Python | lgpl-3.0 | 2,288 |
# -*- coding: utf-8 -*-
# pylint: disable-msg=W0142,W0201,W0233,E0201,R0921
# pylint-version = 0.7.0
#
# Copyright 2004-2005 André Malo or his licensors, as applicable
#
# 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 ... | m-tmatma/svnmailer | src/lib/svnmailer/notifier/_multimail.py | Python | apache-2.0 | 25,752 |
def cast_spell(func):
"""
Wraps a function that is tied to a spell cast.
What is general for all spells is they require some resource (currently - mana)
and have a cooldown.
This decorator checks if both those needs are met, and if not, does not cast the spell.
"""
def decorator(*args, **kwa... | Enether/python_wow | decorators.py | Python | mit | 2,150 |
# 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/BrokerageModelAlgorithm.py | Python | apache-2.0 | 3,724 |
import subprocess
import glob
import os
import sys
import shutil
import datetime
import threading
import subprocess
import shlex
import json
class Runner(threading.Thread):
def __init__(self, id, lock, config_dir, wip_dir, results_dir, failed_dir, config_filter):
threading.Thread.__init__(self)
sel... | zdvresearch/fast15-paper-extras | cache-simulator/run_cache_eval.py | Python | mit | 3,912 |
# -*- 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-game-servers | samples/generated_samples/gameservices_v1_generated_game_server_deployments_service_update_game_server_deployment_async.py | Python | apache-2.0 | 1,658 |
#!/usr/bin/env python
import unittest
from unittest.mock import patch, sentinel, MagicMock
import imi.web
import imi.context
__all__ = ['TestWebApp']
class TestWebApp(unittest.TestCase):
def setUp(self):
ensuredatadir = patch('imi.web.ensuredatadir')
ctx = patch('imi.web.ContextAgent')
... | eamy-org/imi | tests/web.py | Python | mpl-2.0 | 2,528 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.core.db import db
from indico.util.string import format_repr
RoomEquipmentAssociation = db.T... | indico/indico | indico/modules/rb/models/equipment.py | Python | mit | 1,674 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | var/spack/repos/builtin/packages/pbmpi/package.py | Python | lgpl-2.1 | 1,918 |
"""Utility functions for handling and fetching repo archives in zip format."""
from __future__ import absolute_import
import os
import tempfile
from zipfile import ZipFile
import requests
try:
# BadZipfile was renamed to BadZipFile in Python 3.2.
from zipfile import BadZipFile
except ImportError:
from z... | luzfcb/cookiecutter | cookiecutter/zipfile.py | Python | bsd-3-clause | 4,640 |
"""tokyo_fish_market.py"""
from lib.stage import Stage
class TokyoFishMarket(Stage):
"""Tokyo Fish Market stage"""
def desc(self):
"""Desc action"""
action = """
It's about 8AM and you are in a famous fish market in Tokyo. Some contacts
told you about a really strange man fooling around, get... | brunitto/python-runner | lib/stages/tokyo_fish_market.py | Python | mit | 1,249 |
from __future__ import generators
import sys
import inspect, tokenize
import py
from types import ModuleType
cpy_compile = compile
try:
import _ast
from _ast import PyCF_ONLY_AST as _AST_FLAG
except ImportError:
_AST_FLAG = 0
_ast = None
class Source(object):
""" a immutable object holding a sour... | ktan2020/legacy-automation | win/Lib/site-packages/py-1.4.13-py2.7.egg/py/_code/source.py | Python | mit | 14,677 |
#!/usr/bin/env python
# setup.py
#
# Copyright (C) 2008-2016 Veselin Penev, http://bitdust.io
#
# This file (setup.py) is part of BitDust Software.
#
# BitDust 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 Founda... | vesellov/bitdust.devel | release/sources/setup.py | Python | agpl-3.0 | 4,098 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.smalltalk
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for Smalltalk and related languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, bygroups, defa... | prashanthr/wakatime | wakatime/packages/pygments_py3/pygments/lexers/smalltalk.py | Python | bsd-3-clause | 7,215 |
class Solution(object):
def findAnagrams(self, s, p):
"""
:type s: str
:type p: str
:rtype: List[int]
"""
import collections
result = []
c1 = collections.Counter(p)
c2 = collections.Counter(s[:len(p)])
for index in range(... | lilsweetcaligula/Online-Judges | leetcode/easy/find_all_anagrams_in_a_string/py/solution.py | Python | mit | 663 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - DocBook Formatter
@copyright: 2010 by Uche ogbuji <uche@ogbuji.net>
Based on 4Suite version by:
@copyright: 2005,2008 by Mikko Virkkilä <mvirkkil@cc.hut.fi>
@copyright: 2005 by MoinMoin:AlexanderSchremmer (small modifications)
@copyright: 2005 by... | uogbuji/akara | demo/etc/MoinMoin/formatter/text_docbook.py | Python | apache-2.0 | 40,794 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bokeh/bokeh | bokeh/util/__init__.py | Python | bsd-3-clause | 2,529 |
# -*- coding: utf-8 -*-
############################################################################################
#
# Zoook. OpenERP e-sale, e-commerce Open Source Management Solution
# Copyright (C) 2011 Zikzakmedia S.L. (<http://www.zikzakmedia.com>). All Rights Reserved
# $Id$
#
# This program is free... | eoconsulting/django-zoook | django_zoook/payment/urlsPayment.py | Python | agpl-3.0 | 3,166 |
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views import generic
from .models import Choice, Question
from django.utils import timezone
class IndexView(generic.ListView):
template_name = 'polls/index.... | w0921444648/IT110_DJANGO_ATTEMPT2 | polls/views.py | Python | gpl-2.0 | 1,575 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import os
from urllib import urlretrieve
input_folder = "pages/"
output_folder = "../source"
chapters = {'about': '01',
'gettingstarted': '02',
'configuringshinken': '03',
'runningshinken': '04',
'thebasics': '05',
... | wbsavage/shinken | docs/tools/doku2rst.py | Python | agpl-3.0 | 16,887 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | datanel/navitia | source/jormungandr/jormungandr/interfaces/v1/VehicleJourney.py | Python | agpl-3.0 | 1,925 |
import json
import pytest
from common.utils.attack_utils import ScanStatus
from infection_monkey.model import VictimHost
from infection_monkey.telemetry.attack.t1197_telem import T1197Telem
DOMAIN_NAME = "domain-name"
IP = "127.0.0.1"
MACHINE = VictimHost(IP, DOMAIN_NAME)
STATUS = ScanStatus.USED
USAGE_STR = "[Usage... | guardicore/monkey | monkey/tests/unit_tests/infection_monkey/telemetry/attack/test_t1197_telem.py | Python | gpl-3.0 | 917 |
#!/usr/bin/env python3
# encoding: utf-8
from pymongo import MongoClient
import json
from bson.json_util import dumps
DATABASE = 'igemdata_new'
tables = ['boost_store', 'count', 'link', 'link_pool', 'link_ref', 'node', 'node_pool', 'node_ref']
client = MongoClient('mongodb://localhost/igemdata_new')
db = client[DAT... | igemsoftware2016/USTC-Software-2016 | scripts/import_old_database.py | Python | agpl-3.0 | 810 |
"""The tests for the Recorder component."""
# pylint: disable=protected-access
from datetime import datetime, timedelta
from unittest.mock import patch
from sqlalchemy.exc import OperationalError
from homeassistant.components.recorder import (
CONF_DB_URL,
CONFIG_SCHEMA,
DATA_INSTANCE,
DOMAIN,
SER... | partofthething/home-assistant | tests/components/recorder/test_init.py | Python | apache-2.0 | 23,498 |
import type_conv
from core_types import StructT, ImmutableT, IncompatibleTypes
class SliceT(StructT, ImmutableT):
def __init__(self, start_type, stop_type, step_type):
self.start_type = start_type
self.stop_type = stop_type
self.step_type = step_type
self._fields_ = [('start',start_type), ('stop', s... | pombredanne/parakeet | parakeet/ndtypes/slice_type.py | Python | bsd-3-clause | 1,643 |
from .base import *
DEBUG = True
INSTALLED_APPS += (
'debug_toolbar',
)
SENDFILE_BACKEND = "sendfile.backends.development"
MIDDLEWARE = (
'debug_toolbar.middleware.DebugToolbarMiddleware',
) + MIDDLEWARE
# Use default Google test keys and silence error
del RECAPTCHA_PUBLIC_KEY
del RECAPTCHA_PRIVATE_KEY
SIL... | sairon/score-phorum | src/score/settings/debug.py | Python | bsd-3-clause | 451 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/interfaces/interface/interface_ref/config/__init__.py | Python | apache-2.0 | 19,125 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-07 15:13
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
import django.contrib.postgres.indexes
import django.contrib.postgres.search
from django.contrib.postgres.operations import TrigramExtension
from django.db import... | django/djangoproject.com | docs/migrations/0003_auto_20171107_1513.py | Python | bsd-3-clause | 1,072 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2008 - 2012 Hewlett-Packard Development Company, L.P.
#
# 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/... | rich-pixley/zoo-animals | statlog-rollup.py | Python | apache-2.0 | 3,874 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(templ... | mainglis/adminpanel | config/urls.py | Python | bsd-3-clause | 1,317 |
# -*- coding: utf-8 -*-
#
# progressive documentation build configuration file, created by
# sphinx-quickstart on Sat Aug 1 01:36:56 2015.
#
# 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.
#... | hfaran/progressive | docs/conf.py | Python | mit | 9,581 |
from flask import Flask
from flask_pymongo import PyMongo
from .views import (
index as index_view,
get_image as get_image_view,
)
def setup_routes(app):
app.add_url_rule(
'/',
'view_index',
methods=['GET', 'POST'],
view_func=index_view
)
app.add_url_rule(
... | anxolerd/PlannerVR | fileserver/app.py | Python | mit | 675 |
# http://www.bionicbunny.org/
from b3.utils import spawn
class ExecutableWrapper(object):
"""This class is wrapper for an executable."""
executable = None
def __init__(self, executable=None, verbose=0, dry_run=False, options=[]):
self._dry_run = False
if dry_run:
self.set_dry_run_mode(dry_run)
... | robionica/b3 | src/main/python/b3/utils/executable.py | Python | apache-2.0 | 2,742 |
import os
import sys
import subprocess
import argparse
import binascii
import json
import microservices
import clonerutils
import gitauth
################################################################################
# INFORMATION
#
# Exit code = 0 Update successful, microservices run
# Exit code = 1 Error
... | ke00n/alabno | infrastructure/updater.py | Python | mit | 5,288 |
import os
import pandas as pd
import pytest
import pandas.util.testing as pdt
from numpy.testing import assert_almost_equal
from tardis.plasma.properties import property_collections
###
# saving and loading of plasma properties in the HDF file
###
@pytest.fixture(scope="module", autouse=True)
def to_hdf_buffer(hdf_f... | kaushik94/tardis | tardis/plasma/tests/test_hdf_plasma.py | Python | bsd-3-clause | 3,619 |
from pylab import *
import matplotlib.cm as cm
import numpy as np
import scipy.linalg as la
from scipy.stats import chi2
from scipy.spatial import Voronoi, voronoi_plot_2d
from sklearn.datasets import make_blobs
def plot_2d_clusters(X, labels, centers):
"""
Given an observation array, a label vector, and the ... | tigerneil/MLSS | clustering/tututils.py | Python | gpl-2.0 | 3,275 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
class TestOnlyNew(object):
config = """
tasks:
test:
mock:
- {title: 'title 1', url: 'http://localhost/title1'}
onl... | qvazzler/Flexget | tests/test_only_new.py | Python | mit | 1,576 |
# 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/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/inbound_nat_pool.py | Python | mit | 3,858 |
'''
Intervals sample
@author: Daniel Barcelona Pons
'''
from pyactor.context import set_context, create_host, sleep, shutdown, \
interval, later
class Registry(object):
_ask = []
_tell = ['hello', 'init_start', 'stop_interval']
# _ref = ['hello']
def init_start(self):
self.interval1 = in... | hectorEU/GroupCast | examples/sample10.py | Python | lgpl-3.0 | 857 |
'''In this exercise you need to use the learned classifier to recognize current posture of robot
* Tasks:
1. load learned classifier in `PostureRecognitionAgent.__init__`
2. recognize current posture in `PostureRecognitionAgent.recognize_posture`
* Hints:
Let the robot execute different keyframes, and rec... | semipi/programming-humanoid-robot-in-python | joint_control/recognize_posture.py | Python | gpl-2.0 | 2,269 |
#! /usr/bin/env python
import multiprocessing
import os
import logging
import logging.config
import shutil
import subprocess
import sys
import time
def find_output_path(argv):
for i, arg in enumerate(argv):
if arg == "-o": return argv[i+1]
return None
def repl_output_path(argv, path):
_argv = argv[:]
fo... | plum-umd/java-sketch | java_sk/psketch.py | Python | mit | 3,311 |
"""
Automount utility.
"""
__all__ = ['AutoMounter']
class AutoMounter(object):
"""
Automount utility.
Being connected to the udiskie daemon, this component automatically
mounts newly discovered external devices. Instances are constructed with
a Mounter object, like so:
>>> AutoMounter(Mou... | khardix/udiskie | udiskie/automount.py | Python | mit | 1,590 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.