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 |
|---|---|---|---|---|---|
from __future__ import unicode_literals
import unittest
import mock
from mock.mock import MagicMock
from six.moves.urllib.error import HTTPError
from spock.mcp.yggdrasil import YggAuth
@mock.patch('spock.mcp.yggdrasil.Request')
@mock.patch('spock.mcp.yggdrasil.urlopen')
class YggAuthRequestTest(unittest.TestCase)... | MrSwiss/SpockBot | tests/mcp/test_yggdrasil.py | Python | mit | 6,472 |
'''
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 use this ... | alexryndin/ambari | ambari-server/src/test/python/stacks/2.2/common/test_conf_select.py | Python | apache-2.0 | 6,483 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns(
'',
url(r'^font/?$', views.FontUploadView.as_view()),
url(r'^css/?$', views.CSSUploadView.as_view()),
url(r'^svg/?$', views.SVGUploadView.as_view()),
)
| Yanjing123/myicons | convert/urls.py | Python | bsd-2-clause | 257 |
###########################################################################
# (C) Vrije Universiteit, Amsterdam (the Netherlands) #
# #
# This file is part of AmCAT - The Amsterdam Content Analysis Toolkit #
# ... | amcat/amcat | navigator/views/project_views.py | Python | agpl-3.0 | 8,943 |
# Copyright (c) 2015 Huawei Technologies Co., Ltd.
# 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
#
# ... | scality/manila | manila/share/drivers/huawei/base.py | Python | apache-2.0 | 2,783 |
#!/usr/bin/python
# Copyright 2015 Comcast Cable Communications Management, 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 r... | dangogh/traffic_control | misc/kickstart_create_network_line.py | Python | apache-2.0 | 11,116 |
from sner.scripts import utilities
from collections import defaultdict
import codecs
import editdistance
def getPersonalNames(csvFile):
"""
Args:
csvfile = A csv file with the name on line[5] and line[9] is an identifier of its
type, where we are looking for 'PN' indicating a persona... | wwunlp/sner | sner/scripts/readnames.py | Python | mit | 2,892 |
# -*- coding: utf-8 -*-
import numpy as np
from pyfr.backends.openmp.provider import OpenMPKernelProvider
from pyfr.backends.base import ComputeKernel
class OpenMPBlasExtKernels(OpenMPKernelProvider):
def axnpby(self, *arr, subdims=None):
if any(arr[0].traits != x.traits for x in arr[1:]):
r... | Aerojspark/PyFR | pyfr/backends/openmp/blasext.py | Python | bsd-3-clause | 2,050 |
# -*- coding: utf-8 -*-
from openerp import models, fields
class account_tax_withholding(models.Model):
_name = "account.tax.withholding"
_description = "Account Withholding Taxes"
name = fields.Char(
'Name',
required=True,
)
code = fields.Char(
'Code',
require... | levkar/odoo-addons | account_voucher_withholding/models/account.py | Python | agpl-3.0 | 2,915 |
from os import path
import pytest
from .test_utils import text_file_contains, ExampleTest
class TestPcapPrinter(ExampleTest):
pytestmark = [pytest.mark.pcapprinter, pytest.mark.no_network]
def test_sanity(self, tmpdir):
args = {
"": path.join("pcap_examples", "many-protocols.pcap"),
... | seladb/PcapPlusPlus | Tests/ExamplesTest/tests/test_pcapprinter.py | Python | unlicense | 1,614 |
#!/usr/bin/python
#
# Copyright 2015 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... | coxmediagroup/googleads-python-lib | examples/adwords/v201506/basic_operations/get_ad_groups.py | Python | apache-2.0 | 2,395 |
import _plotly_utils.basevalidators
class MetaValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="meta", parent_name="choropleth", **kwargs):
super(MetaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
array_o... | plotly/plotly.py | packages/python/plotly/plotly/validators/choropleth/_meta.py | Python | mit | 438 |
#!/usr/bin/env python
"""
process_file(filename)
takes templated file .xxx.src and produces .xxx file where .xxx
is .pyf .f90 or .f using the following template rules:
'<..>' denotes a template.
All function and subroutine blocks in a source file with names that
contain '<..>' will be replicated according... | shoyer/numpy | numpy/distutils/from_template.py | Python | bsd-3-clause | 8,027 |
from django.conf.urls.defaults import *
urlpatterns = patterns('bellum.province',
(r'^ajax/btools/order/$', 'btools.order'),
(r'^ajax/btools/erect/$', 'btools.erect'),
(r'^ajax/btools/cancel/$', 'btools.cancel'),
(r'^ajax/radar/$', 'radar.radar'),
(r'^ajax/scanner/$', 'radar.scanner'),
)
| piotrmaslanka/bellum | province/urls.py | Python | agpl-3.0 | 310 |
"""Contains classes for different representations of test scores.
It also contains score collections such as arrays and matrices.
"""
from .base import ErrorScore, Score, score_logger
from .complete import *
from .incomplete import *
| scidash/sciunit | sciunit/scores/__init__.py | Python | mit | 236 |
#
# 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... | uber/fbthrift | thrift/lib/py/util/__init__.py | Python | apache-2.0 | 811 |
# Copyright 2016 Peter Dahlberg
#
# 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 ... | IEEE-SB-Passau/pelican-deployment-system | pelican_deploy/deploy.py | Python | apache-2.0 | 12,443 |
#!/usr/bin/env python3
# Copyright (c) 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Hierarchical Deterministic wallet function."""
import os
import shutil
from test_framework.test_... | stamhe/bitcoin | test/functional/wallet_hd.py | Python | mit | 5,385 |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext, loader, Template, Context
from django.core.urlresolvers import reverse
from log.models import Entry
from datetime import datetime
# Create your views here.
def index(request):
... | denis-pitul/web-trash | log/views.py | Python | gpl-2.0 | 1,249 |
# (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
import json
from ansible.modules.storage.netapp.netapp_e_asup import Asup
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
__metaclass__ = type
from ans... | skg-net/ansible | test/units/modules/storage/netapp/test_netapp_e_asup.py | Python | gpl-3.0 | 7,866 |
# Copyright (c) 2014 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 required by applic... | samsu/neutron | tests/unit/db/test_l3_dvr_db.py | Python | apache-2.0 | 12,602 |
import logging
import sys
from six.moves.urllib.parse import urljoin
from xml.etree import ElementTree
import recurly
import recurly.js as js
from recurly.errors import *
from recurly.resource import Resource, Money, PageError, Page
"""
Recurly's Python client library is an interface to its REST API.
Please see th... | cgerrior/recurly-client-python | recurly/__init__.py | Python | mit | 32,624 |
# Copyright 2017 The TensorFlow 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 applica... | tensorflow/tensorflow | tensorflow/python/data/experimental/benchmarks/unbatch_benchmark.py | Python | apache-2.0 | 2,451 |
from functools import partial
from navmazing import NavigateToSibling, NavigateToAttribute
from cfme import Credential
from cfme.exceptions import CandidateNotFound, OptionNotAvailable
import cfme.fixtures.pytest_selenium as sel
import cfme.web_ui.toolbar as tb
from cfme.web_ui import (
AngularSelect, Form, Selec... | jdemon519/cfme_tests | cfme/configure/access_control.py | Python | gpl-2.0 | 24,877 |
import json
from itertools import groupby
from django.conf import settings
from django.utils.safestring import mark_safe
from dimagi.utils.logging import notify_exception
from pillowtop.utils import force_seq_int, get_couch_pillow_instances
from restkit import Resource
from .models import PillowCheckpointSeqStore
E... | qedsoftware/commcare-hq | corehq/apps/hqadmin/utils.py | Python | bsd-3-clause | 4,521 |
from phovea_server import ns
from phovea_server.config import view as config_view
import memcache
import logging
import gevent
import gevent.lock
__author__ = 'Samuel Gratzl'
app = ns.Namespace(__name__)
conf = config_view('phovea_clue')
mc = memcache.Client(conf.get('memcached'), debug=0)
mc_prefix = 'clue_'
_log =... | phovea/phovea_clue | phovea_clue/remoteplayer.py | Python | bsd-3-clause | 6,710 |
n, m = [int(x) for x in input().split()]
V = {x: [] for x in range(1, n+1)}
for i in range(1, m+1):
a, b = [int(x) for x in input().split()]
V[a].append(b)
V[b].append(a)
Color = [0] * (n + 1)
IsBipartite = True
def DFS(start):
for u in V[start]:
if Color[u] == 0:
Color[u] = 3 - C... | alekseik1/python_mipt_study_1-2 | 2sem/training_control_2_sem/7.py | Python | gpl-3.0 | 696 |
"""Reversed pair
revised from
Think Python by Allen B. Downey
http://thinkpython.com
"""
from bisect import bisect_left
def make_word_list():
"""Reads lines from a file and builds a list using append."""
word_list = []
fin = open('words.txt')
for line in fin:
word = line.strip()... | Great-Li-Xin/PythonDev | ClassRoom/reversepair.py | Python | mit | 1,160 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.buil... | scode/pants | contrib/cpp/src/python/pants/contrib/cpp/register.py | Python | apache-2.0 | 1,198 |
#
# Copyright (c) 2015 Open-RnD Sp. z o.o.
#
# 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, publ... | open-rnd/ros3d-www | ros3dui/system/network/__init__.py | Python | mit | 2,154 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Mo 12. Okt 07:59:53 2015
# by: The Resource Compiler for PyQt (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x00\xcf\
\x3c\
\x73\x76\x67\x20\x66\x69\x6c\x6c\x3d\x22\x23\x30\x... | werkuh/kkg_plugin | resources.py | Python | gpl-2.0 | 11,389 |
from server import db
class Ruta(db.Model):
__tablename__ = 'ruta'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(500), nullable=False, unique=True)
def __init__(self, name=None):
if name:
self.name = name.lower()
| aurigadl/EnvReactAsk | server/apiRuta/models.py | Python | gpl-3.0 | 278 |
#
# 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... | vasili-v/themis | vendor/github.com/apache/thrift/lib/py/src/protocol/THeaderProtocol.py | Python | apache-2.0 | 7,373 |
"""
L1-penalized minimization using the feature sign search algorithm.
"""
__authors__ = "David Warde-Farley"
__copyright__ = "Copyright 2010-2011, Universite de Montreal"
__credits__ = ["David Warde-Farley"]
__license__ = "3-clause BSD"
__maintainer__ = "David Warde-Farley"
__email__ = "wardefar@iro"
__all__ = ["fea... | skearnes/pylearn2 | pylearn2/optimization/feature_sign.py | Python | bsd-3-clause | 13,435 |
#!/usr/bin/env python2.6
import re
from PIL import Image, ImageOps
import urllib2
import oembed
from recaptcha.client import captcha
from akismet import Akismet
import pifilter
import logging
import time
import uuid
from time import gmtime, strftime
import random
from datetime import datetime
import urllib
import simpl... | mikemaccana/imeveryone | usermessages.py | Python | mit | 20,662 |
# -*- coding: utf-8 -*-
import structlog
from requests.exceptions import ConnectionError
from .client import get_client
from .conf import settings as metrics_settings
logger = structlog.getLogger(__name__)
def metric(metric_name, num=1, time=None, tags={}, **kwargs):
""" Increments a specific metric.
Thi... | erudit/zenon | eruditorg/core/metrics/metric.py | Python | gpl-3.0 | 1,540 |
# Copyright (C) 2012 Nippon Telegraph and Telephone 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | tashaband/RYU295 | ryu/__init__.py | Python | apache-2.0 | 679 |
from random import randint
outf = open("featureplacement_set.lua","w")
fdef = None
fx = None
fz = None
def ex(s,k):
return s.partition(k)[2].strip().strip(',').strip()
for line in open('model.lua').readlines():
if 'defName = ' in line:
fdef = ex(line," defName = ")
if ' pos = {' in line:
fx = 0
f... | Beherith/springrts_smf_compiler | springboard_model_lua_to_set_lua_feature_dumper.py | Python | cc0-1.0 | 640 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GridSurfaceCreate.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
-----------------... | yordan-desta/QgisIns | python/plugins/processing/algs/lidar/fusion/GridSurfaceCreate.py | Python | gpl-2.0 | 5,575 |
from django.contrib import admin
# Register your models here.
from .models import Lift, LiftInstance, Workout, WorkoutInstance, Cardio, CardioInstance
admin.site.register(Lift)
admin.site.register(LiftInstance)
admin.site.register(Workout)
admin.site.register(WorkoutInstance)
admin.site.register(Cardio)
admin.site.re... | davishayden/gains | lifts/admin.py | Python | mit | 342 |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | sassoftware/mint | mint/django_rest/rbuilder/session/views/v1/urls.py | Python | apache-2.0 | 892 |
from bokeh.plotting import figure, output_file, show
p = figure(plot_width=300, plot_height=300)
p.circle([1,2], [3,4])
# configure visual properties on a plot's title attribute
p.title.text = "Title With Options"
p.title.align = "right"
p.title.text_color = "orange"
p.title.text_font_size = "25px"
p.title.background... | ericmjl/bokeh | sphinx/source/docs/user_guide/examples/plotting_title_visuals.py | Python | bsd-3-clause | 380 |
#!/usr/bin/python3.5
# This is copied from https://raw.githubusercontent.com/gwen001/pentest-tools/master/smuggler.py
# I don't believe in license.
# You can do whatever you want with this program.
# Based on the awesome James Kettle research
# https://twitter.com/albinowax
# https://portswigger.net/web-security/reque... | ajinabraham/WebAppSec | General Web Attacks/http_request_smuggling.py | Python | apache-2.0 | 23,026 |
# 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... | hayderimran7/tempest | tempest/services/botoclients.py | Python | apache-2.0 | 9,303 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | cryptobanana/ansible | lib/ansible/modules/network/f5/bigip_monitor_http.py | Python | gpl-3.0 | 19,195 |
'''OpenGL extension ARB.copy_buffer
This module customises the behaviour of the
OpenGL.raw.GL.ARB.copy_buffer to provide a more
Python-friendly API
Overview (from the spec)
This extension provides a mechanism to do an accelerated copy from one
buffer object to another. This may be useful to load buffer objects
... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GL/ARB/copy_buffer.py | Python | lgpl-3.0 | 1,007 |
# Threadworms (a Python/Pygame threading demonstration)
# By Al Sweigart al@inventwithpython.com
# http://inventwithpython.com/blog
# Released under a "Simplified BSD" license
# This is meant to be an educational example of multithreaded programming,
# so I get kind of verbose in the comments.
import random, pygame, ... | arielisidro/myprograms | python/thread/threadworms.py | Python | gpl-2.0 | 17,109 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class BlogSettings(Document):
def on_update(self):
from frap... | gangadhar-kadam/laganfrappe | frappe/website/doctype/blog_settings/blog_settings.py | Python | mit | 403 |
# Copyright (c) 2010 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2013-2017 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2013-2014 Google, Inc.
# Copyright (c) 2014 Arun Persaud <arun@nubati.net>
# Copyright (c) 2015 Ionel Cristian Maries <contact@ionelmc.ro>
# Copyright (c) 2016 Derek Gust... | ekwoodrich/python-dvrip | env/lib/python3.5/site-packages/pylint/test/unittest_checkers_utils.py | Python | mit | 4,690 |
#!/usr/bin/env python
import numpy as np
from rotCij import rotCij
from generate_strain import cellABC2cellCART
def _rotMat3(axis, theta):
cos_theta = np.cos(theta)
sin_theta = np.sin(theta)
rotMat = np.zeros((3,3))
rotMat[0,0] = cos_theta
rotMat[1,1] = cos_theta
rotMat[2,2] = cos_theta
rotMat[axis,axis] = 1
... | duyuan11/elastic-constants | rotate_Albite.py | Python | bsd-3-clause | 2,567 |
""" Install pvfactors """
from setuptools import setup
import versioneer
DESCRIPTION = (
'2D View Factor Model to calculate the irradiance incident on ' +
'various surfaces of PV arrays')
with open('README.rst', 'r') as f:
LONG_DESCRIPTION = f.read()
with open('requirements.txt', 'r') as f:
INSTALL_RE... | SunPower/pvfactors | setup.py | Python | bsd-3-clause | 1,767 |
#!/usr/bin/python
try:
import config
except:
raise IOError("No configuration present. Please make copy config/config.py to the root of the application and edit it.")
import threading
import re
import json
import traceback
import datetime
from sensLog import sensLog
from thermalNetwork import thermalNetwork
fr... | ThreeSixes/sensorNet | sensorNet.py | Python | gpl-3.0 | 9,830 |
from flask import current_app, Flask, redirect, url_for, render_template
from storage_functions import init_app
from picBook import picbook
from gcloud import storage
import six
app = Flask(__name__)
#Only allow upto 8mb file size
app.config['MAX_CONTENT_LENGTH'] = 8 * 1024 * 1024
app.register_blueprint(picbook)
app.s... | sanikasudhalkar/Projects | FlaskPhotoBlogging/main.py | Python | mit | 608 |
#!/usr/bin/env python
'''
This extension allows you to draw crop, registration and other
printing marks in Inkscape.
Authors:
Nicolas Dufour - Association Inkscape-fr
Aurelio A. Heckert <aurium(a)gmail.com>
Copyright (C) 2008 Authors
This program is free software; you can redistribute it and/or modify
it under t... | mattdangerw/inkscape | share/extensions/printing_marks.py | Python | gpl-2.0 | 24,184 |
#
# 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... | spektom/incubator-airflow | tests/providers/qubole/operators/test_qubole_check.py | Python | apache-2.0 | 4,944 |
# 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/parsing/populators.py | Python | apache-2.0 | 7,495 |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. 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... | deepmind/enn | enn/networks/dropout.py | Python | apache-2.0 | 4,521 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from EmeraldAI.Logic.Singleton import Singleton
from EmeraldAI.Logic.NLP.SentenceResolver import SentenceResolver
from EmeraldAI.Entities.User import User
from EmeraldAI.Entities.ContextParameter import ContextParameter
from EmeraldAI.Config.Config import Config
from EmeraldAI.... | MaxMorgenstern/EmeraldAI | EmeraldAI/Pipelines/TriggerProcessing/ProcessTrigger.py | Python | apache-2.0 | 3,179 |
from inventory import Inventory
import cmd
from room import get_room
from player import Player
import textwrap
import time
import random
class Controls(cmd.Cmd):
prompt = '> '
def __init__(self):
#-----------------------------------------------------------------------
#Here the game is initialized asking for... | kevin2314/TextGame | game/main.py | Python | mit | 4,805 |
"""Support for w800rf32 devices."""
import logging
import W800rf32 as w800
import voluptuous as vol
from homeassistant.const import (
CONF_DEVICE,
EVENT_HOMEASSISTANT_START,
EVENT_HOMEASSISTANT_STOP,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import dispat... | aronsky/home-assistant | homeassistant/components/w800rf32/__init__.py | Python | apache-2.0 | 1,619 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('askapp', '0006_post_deleted'),
]
operations = [
migrations.RenameField(
model_name='tag',
old_name='... | BanzaiTokyo/akihabara-tokyo | askapp/migrations/0007_auto_20161228_0818.py | Python | apache-2.0 | 571 |
from matchers import like
def test_hello_world(cli):
cli.src('tox.ini', r"""
[tox]
envlist = py27,py36
[testenv]
deps = pytest
commands = pytest
""")
# setup.py in the same directory
cli.src('setup.py', r"""
from setuptools import setup
setup(
name='hello-world',
... | imsardine/learning | tox/tests/test_start.py | Python | mit | 2,240 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you... | viggates/nova | nova/network/manager.py | Python | apache-2.0 | 91,318 |
import os
from conans.client.build.compiler_flags import rpath_flags
from conans.model import Generator
"""
PC FILE EXAMPLE:
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: my-project
Description: Some brief but informative description
Version: 1.2.3
Libs: -L${libdir} ... | memsharded/conan | conans/client/generators/pkg_config.py | Python | mit | 3,702 |
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django.views import generic
from oscar.apps.customer import views
from oscar.apps.customer.notifications import views as notification_views
from oscar.apps.customer.alerts import views as alert_views
from oscar.ap... | Giftingnation/GN-Oscar-Custom | oscar/apps/customer/app.py | Python | bsd-3-clause | 8,681 |
"""
Training lists, sets, list comprehensions
"""
import random
minNum = 0
maxNum = 50
comprehended_list = [x for x in range(minNum, maxNum)]
random_list = [random.randint(minNum,maxNum) for x in range(minNum,maxNum)]
print(random_list)
print("Random stats")
print("In our random list there are %d items, %d of them are ... | pajowu/computer-sience | as/list_comprehensions.py | Python | gpl-2.0 | 674 |
import re
from django import http, template
from django.contrib.admin import ModelAdmin
from django.contrib.admin import actions
from django.contrib.auth import authenticate, login
from django.db.models.base import ModelBase
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import re... | CollabQ/CollabQ | vendor/django/contrib/admin/sites.py | Python | apache-2.0 | 20,955 |
import sys
import os
import numpy as np
import scipy.misc
import scipy.io as sio
import random as rnd
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'common'))
from w_util import getsubimg, rgbimg2vec, readLines, gray2vec, rgb2gray
impo... | whereaswhile/DLSR | common/ilvrc2012_joint.py | Python | gpl-2.0 | 8,493 |
import numpy as np
import pytest
import pandas as pd
from pandas.core.sparse.api import SparseDtype
import pandas.util.testing as tm
@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.filterwarnings("ignore:Series.to_sparse:FutureWarning")
class TestSparseSeriesIndexing:
def setup_method(sel... | toobaz/pandas | pandas/tests/sparse/test_indexing.py | Python | bsd-3-clause | 38,613 |
# 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/base.py | Python | apache-2.0 | 1,142 |
"""
Script to display all the user groups and all the users in Administrators group
Requirements: Python 2.7 or 3.4, pyWin32, pywinauto 0.5.4+
download the repo: https://github.com/pywinauto/pywinauto
place the script to the repo root folder
"""
from subprocess import Popen
from pywinauto import application
from pyw... | cetygamer/pywinauto | examples/print_administrators.py | Python | bsd-3-clause | 2,204 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Matt Makai <matthew.makai@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 ... | hostmaster/ansible-modules-extras | notification/twilio.py | Python | gpl-3.0 | 4,405 |
import sys
import re
for n, lines in enumerate(open(sys.argv[1], 'rU')):
if n == 0:
continue
else:
line = lines.strip().split("\t")
hits = line[1]
ID = hits.split("|")[1]
start = int(line[8])
end = int(line[9])
if end - start > 0:
print ID + " " + str(start) + "-" + str(end)
else:
print ID + "... | fandemonium/code | parsers/command_to_pull_out_blast_matched_seqs.py | Python | mit | 354 |
"""
Tests for the recently enrolled messaging within the Dashboard.
"""
import datetime
from django.conf import settings
from django.core.urlresolvers import reverse
from opaque_keys.edx import locator
from pytz import UTC
import unittest
import ddt
from shoppingcart.models import DonationConfiguration
from student.te... | simbs/edx-platform | common/djangoapps/student/tests/test_recent_enrollments.py | Python | agpl-3.0 | 7,863 |
# Copyright 2015 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... | Eric-Gaudiello/tensorflow_dev | tensorflow_home/tensorflow_venv/lib/python3.4/site-packages/tensorflow/python/ops/init_ops.py | Python | gpl-3.0 | 8,394 |
"""Framework za leksičku, sintaksnu, semantičku analizu, te izvođenje programa.
Za više detalja pogledati šalabahter.txt."""
__version__ = '1.4'
import enum, types, collections, contextlib, itertools, functools, math
def identifikator(znak):
"""Je li znak dopušten u C-ovskom imenu (slovo, znamenka ili _)?"""
... | vedgar/ip | package/vepar.py | Python | unlicense | 20,948 |
########################################################################
#
# (C) 2013, James Cammarata <jcammarata@ansible.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 ... | datsfosure/ansible | lib/ansible/cli/galaxy.py | Python | gpl-3.0 | 21,602 |
# -*- encoding: utf-8 -*-
import textwrap
from abjad.tools.datastructuretools.TreeNode import TreeNode
class ReSTParagraph(TreeNode):
r'''A ReST paragraph.
::
>>> paragraph = documentationtools.ReSTParagraph(
... text='blah blah blah')
>>> paragraph
ReSTParagraph(
... | mscuthbert/abjad | abjad/tools/documentationtools/ReSTParagraph.py | Python | gpl-3.0 | 1,721 |
'''OpenGL extension QCOM.perfmon_global_mode
This module customises the behaviour of the
OpenGL.raw.GLES2.QCOM.perfmon_global_mode to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/QCOM/perfmon_global_mode.txt
'''
from OpenGL impo... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GLES2/QCOM/perfmon_global_mode.py | Python | lgpl-3.0 | 803 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | rh-s/heat | heat/tests/test_support.py | Python | apache-2.0 | 3,772 |
import re, collections, enum
from bashlint import flags, shutils, butils, errors, heredoc, state
sh_syntaxtab = collections.defaultdict(set)
def _addsyntax(chars, symbol):
for c in chars:
sh_syntaxtab[c].add(symbol)
_addsyntax('\\`$"\n', 'dquote')
_addsyntax('()<>;&|', 'meta')
_addsyntax('"`\'', 'quote'... | TellinaTool/awesome_nmt | bashlint/tokenizer.py | Python | gpl-3.0 | 41,623 |
import inspect
import json
import msgpack
import pytest
from anom import Key, Model, Property, props
from datetime import datetime
from dateutil.tz import tzlocal, tzutc
from . import models
all_properties = inspect.getmembers(props, lambda x: (
inspect.isclass(x) and issubclass(x, Property) and
x not in {pr... | Bogdanp/anom-py | tests/test_properties.py | Python | bsd-3-clause | 12,490 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016 Michael Gruener <michael.gruener@chaosmoon.net>
# 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
ANSIBLE_METADATA = {'metadata_versio... | hkariti/ansible | lib/ansible/modules/web_infrastructure/letsencrypt.py | Python | gpl-3.0 | 56,392 |
# Copyright 2013-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright 2021 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class BankPaymentLine(models.Model):
_inherit = "bank.payment.line"
priority = ... | OCA/bank-payment | account_banking_pain_base/models/bank_payment_line.py | Python | agpl-3.0 | 959 |
from lxml import etree
import signxml
from signxml import xmldsig
cert = open("cert.pem").read()
key = open("key.pem", "rb").read()
root = etree.parse('texte.xml').getroot()
signer = xmldsig(root, digest_algorithm="sha1")
signer.sign(method=signxml.methods.enveloped, key=key, cert=cert,
algorithm="rsa-sha... | leonardoRC/PyNFe | ass_xml.py | Python | lgpl-3.0 | 611 |
from package.unittest import *
class TestImport(TestCase):
def test_import(self):
import pegex
import pegex.grammar
import pegex.grammar.pegex
self.assertTrue(True, 'pegex modules imported cleanly')
if __name__ == '__main__':
main()
| ingydotnet/pegex-py | tests/test_import.py | Python | bsd-2-clause | 276 |
from django.urls import path
from . import views
app_name = "watchlist"
urlpatterns = [
path("", views.watchlistView.as_view(), name="vaktliste"),
path("register/<int:pk>", views.WatchListRegisterView.as_view(), name="register"),
path(
"unregister/<int:pk>",
views.WatchListUnregisterView.... | hackerspace-ntnu/website | watchlist/urls.py | Python | mit | 436 |
#!/usr/bin/python
#
# plugin_manager.py
#
# Copyright (C) Ben Van Mechelen 2007-2009 <me@benvm.be>
#
# This file is part of Garmon
#
# Garmon 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... | bwhitelock/garmon-ng | garmon/plugin_manager.py | Python | gpl-3.0 | 12,438 |
"""Tests for light platform."""
from datetime import timedelta
import logging
from typing import Callable, NamedTuple
from unittest.mock import Mock, PropertyMock, patch
from pyHS100 import SmartDeviceException
import pytest
from homeassistant.components import tplink
from homeassistant.components.homeassistant impor... | w1ll1am23/home-assistant | tests/components/tplink/test_light.py | Python | apache-2.0 | 22,564 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2010, 2011 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 opt... | kaplun/Invenio-OpenAIRE | modules/miscutil/lib/plotextractor_converter.py | Python | gpl-2.0 | 8,188 |
"""
Author: Orens Xhagolli
File: legal.py
Description: Contains functions that check whether expressions are legal.
"""
import prefix
def check(exp):
"""
Performs all available checks on an expression.
:param exp: Expression in string form.
:return: True if the expression is legal, False ... | MannyOkafor/iqMath-1 | legal.py | Python | mit | 1,751 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'E:\Projects\PyDatcomLab\PyDatcomLab\GUIs\components\BrowseModels.ui'
#
# Created by: PyQt5 UI code generator 5.10
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_BrowseModel(obje... | darkspring2015/PyDatcomLab | PyDatcomLab/GUIs/components/Ui_BrowseModels.py | Python | mit | 5,558 |
from versionbump import VersionBump
class FileBump(object):
file_cache = ''
def __init__(self, fo, version):
self.vb = VersionBump(version)
self.fo = fo
self.file_cache = self.fo.read()
self.validate_cache()
def __str__(self):
ret = '<{0} \'{1}\'>'.format(self.__c... | vortec/versionbump | versionbump/filebump.py | Python | mit | 1,122 |
"""
Use a Text as a watermark
"""
import numpy as np
#import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange')
ax.grid()
# position bottom right
fig.text(0.95, 0.05, 'Property of MPL',
fontsize=5... | cactusbin/nyt | matplotlib/examples/api/watermark_text.py | Python | unlicense | 394 |
from enum import Enum
class AzimuthWindowingMethod(Enum):
disabled = "none"
boxcar = "boxcar"
hanning = "hanning"
hamming = "hamming"
class AzimuthProcessingMethod(Enum):
"""
Enum for azimuth processing method selection flag
"""
approximate = "approx"
exact = "exact"
class Azim... | DeDop/dedop | dedop/conf/enums.py | Python | gpl-3.0 | 559 |
# -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2014, Hartmut Goebel <h.goebel@goebel-consult.de>
"""
Test cases for L{upnp.core.msearch}
"""
import time
from twisted.trial import unittest
from twisted.internet import protocol
from twisted.test ... | coherence-project/Coherence | coherence/upnp/core/test/test_msearch.py | Python | mit | 3,566 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | geokala/cloudify-cli | cloudify_cli/tests/commands/test_cli_command.py | Python | apache-2.0 | 4,813 |
"""
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 use this ... | radicalbit/ambari | ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_windows.py | Python | apache-2.0 | 3,395 |
# Init for ivo tests
| ivo-of-chartres/ivo-tools | ivoing/tests/__init__.py | Python | bsd-2-clause | 21 |
#!/usr/bin/python
import sys
def usageMessage():
print("Usage: fastq_length_filter file.fastq ")
print("Note: ")
print("Filters out the reads > 35bp.")
return()
# Main
if len(sys.argv) > 2:
print("Too many arguments.")
usageMessage()
sys.exit()
if len(sys.argv) < 2:
print("Too f... | adammaikai/OmicsPipe2.0 | omics_pipe/scripts/fastq_length_filter.py | Python | mit | 1,980 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.