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 mock import patch
from nose.tools import assert_equals
from prompter import prompt
@patch('prompter.get_input', return_value='Dave')
def test_prompt_returns_input(mock_raw_input):
returned_value = prompt('What is your name?')
assert_equals(returned_value, 'Dave')
@patch('prompter.get_input', return_value... | tylerdave/prompter | tests/test_prompt.py | Python | mit | 1,159 |
# Copyright 2013: Mirantis 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... | varunarya10/rally | tests/functional/test_cli_deployment.py | Python | apache-2.0 | 3,966 |
# Copyright 2010 Michael Murr
#
# This file is part of LibForensics.
#
# LibForensics is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | 306777HC/libforensics | code/lf/win/ole/ps/ctypes.py | Python | lgpl-3.0 | 3,684 |
#!/usr/bin/python
#
# Copyright (c) 2016 Thomas Stringer, <tomstr@microsoft.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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | tersmitten/ansible | lib/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py | Python | gpl-3.0 | 6,027 |
import argparse
import subprocess as sub
import sys
from termcolor import colored
def createarguments():
"""
Function to create arguments that can be passed to the main function
"""
parser = argparse.ArgumentParser()
parser.add_argument('-n', '--new', help="Downoad a new verion of Pharo", required=False, action="... | LorenzoBaracchi/pharo-startup | PharoStartupAndConfs/startPharo.py | Python | gpl-3.0 | 1,395 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019 RERO
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that... | rero/reroils-app | rero_ils/modules/templates/models.py | Python | gpl-2.0 | 1,343 |
"""Reload file from disk automatically."""
from __future__ import annotations
from porcupine import get_tab_manager, tabs
# TODO: should cursor and scrolling stuff be a part of reload() or change_batch()?
def reload_if_necessary(tab: tabs.FileTab) -> None:
if tab.other_program_changed_file():
cursor_pos ... | Akuli/porcupine | porcupine/plugins/reload.py | Python | mit | 762 |
from elasticsearch_dsl import Boolean, Document, Integer, Keyword, Text, GeoPoint, Float, Nested
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=['localhost'])
class Listing(Document):
"""Base class containing the common fields."""
access = Text()
additional_hous... | bashedev/airbnb_scraper | deepbnb/model.py | Python | gpl-3.0 | 2,005 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="font", parent_name="heatmapgl.hoverlabel", **kwargs
):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=par... | plotly/plotly.py | packages/python/plotly/plotly/validators/heatmapgl/hoverlabel/_font.py | Python | mit | 1,875 |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2018 CRS4.
#
# 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 ... | elzaggo/pydoop | test/timings/setup.py | Python | apache-2.0 | 900 |
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozil... | kpkhxlgy0/SublimeText3 | Packages/SublimeCodeIntel/libs/textinfo.py | Python | mit | 88,803 |
from jsmin import jsmin
xpath = """\
function xpath(root, xpath) {
if(root == null)
root = document;
var nt = XPathResult.ANY_UNORDERED_NODE_TYPE;
return document.evaluate(xpath, root, null, nt, null).singleNodeValue;
}
"""
in_flight = jsmin("""
function isHidden(el) {if(el === null) return true; ... | nachandr/cfme_tests | cfme/js.py | Python | gpl-2.0 | 6,846 |
import rcpy
from rcpy._encoder import *
class Encoder:
def __init__(self, channel, count = None):
self.channel = channel
if count is not None:
self.set(count)
def get(self):
return get(self.channel)
def set(self, count):
set(self.channel, count)
def rese... | mcdeoliveira/rcpy | rcpy/encoder.py | Python | mit | 469 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 16 12:56:06 2017
@author: sridhar
"""
from swan.widgets.mypgwidget import PyQtWidget3d
from numpy import count_nonzero, argmax, amax, zeros, trim_zeros, any as np_any
from sklearn.decomposition import PCA
from itertools import chain
class PgWidge... | INM-6/swan | swan/views/pca_3d_view.py | Python | bsd-3-clause | 8,724 |
# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
__copyright__ = '2011, John Schember <john at nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Generates and writes an APNX page mapping file.
'''
import re
import struct
from calibre.ebooks.mobi.reader.mobi6 import MobiReader
from calibre.ebooks.pdb.heade... | jelly/calibre | src/calibre/devices/kindle/apnx.py | Python | gpl-3.0 | 10,297 |
#!/bin/python
import serial
import multiprocessing
from lockfile import LockFile
def main():
lock = LockFile("/tmp/relay")
with lock:
ser = serial.Serial('/dev/ttyUSB0',19200,timeout=1)
ser.flushInput()
ser.write('t')
s = ser.readline()
print s
if __name__ == "__main__":
... | MappaM/monitoring | scripts/gettemp2.py | Python | gpl-2.0 | 330 |
#
# 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 us... | rangadi/incubator-beam | sdks/python/apache_beam/runners/portability/fn_api_runner_test.py | Python | apache-2.0 | 25,989 |
#!/usr/bin/python
import sys
sys.path.append('..')
from bcert_pb2 import *
import binascii
# fill out a minimal bitcoin cert
cert = BitcoinCert()
# first the data part (the part is later signed by the "higher level cert" or "the blockchain")
cert.data.version = '0.1'
cert.data.subjectname = 'Foo Inc.'
email = cert.... | bcpki/bitcoin | src/bcert/examples/mk_foo1_p2csingle.py | Python | mit | 2,900 |
#!/usr/bin/env python3
from classes.myqueue import MyQueue
import time # time.sleep(0.02)
import random # random.randint(1, 100)
import socket # socket.gethostname()
import sys
import argparse
CONF_DB = {
'server': 'localhost',
'user': 'root',
'pass': 'x',
'db': 'myqueue'
}
def worker_create(q, amount... | garmann/playground | python/python_mysql_queue/app.py | Python | mit | 2,098 |
# Copyright 2016 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... | nburn42/tensorflow | tensorflow/python/keras/layers/serialization_test.py | Python | apache-2.0 | 1,578 |
##########################################################################
#
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | lento/cortex | test/IECore/LRUCacheTest.py | Python | bsd-3-clause | 6,773 |
# Copyright 2013 Simonas Kazlauskas
# 2015-2020 Nick Boultbee
# 2019 Joschua Gandert
#
# 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 yo... | Mellthas/quodlibet | quodlibet/util/cover/built_in.py | Python | gpl-2.0 | 7,271 |
from .plots import Plot,PlotError
from .. import context
from .. import items
from .. import maps
from .. import waypoints
from .. import monsters
from .. import dialogue
from .. import services
from .. import teams
from .. import characters
import random
from .. import randmaps
from .. import stats
from .. import spel... | jwvhewitt/dmeternal | old_game/narrator/encounters.py | Python | gpl-2.0 | 6,062 |
from radical.entk import Task
import threading
import Queue
import sys
import time
from pympler import asizeof
from datetime import datetime
from multiprocessing import Process
kill = threading.Event()
DATA = ''
def push_function(q, name):
try:
start_time = time.time()
tasks_pushed = 0
... | vivek-bala/radical.entk | design_helpers/threading_throughput/runme_threads.py | Python | mit | 4,138 |
# Copyright 2017 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 agreed ... | jdanbrown/pydatalab | datalab/utils/_dataflow_job.py | Python | apache-2.0 | 1,506 |
import os
from django.test.utils import override_settings
from django.test import TestCase
from casexml.apps.case.tests.util import delete_all_cases
from corehq.apps.receiverwrapper.util import submit_form_locally
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
@override_settings(CASEXML_FORCE_... | qedsoftware/commcare-hq | corehq/ex-submodules/casexml/apps/case/tests/test_out_of_order_processing.py | Python | bsd-3-clause | 1,076 |
import natmsgclib
import natmsgactions
# This is a test of manually recovering raw shards from a download
# temp directory that is created by natmscc_0_1.py
natmsgclib.nm_start()
natmsgclib.VERBOSITY = 9
#natmsgactions.unpack_metadata_files(inbound_save_dir='~/nm_mail/Identity1/incoming/20150225_175352.20',
# privat... | naturalmessage/natmsgcc | natmsgcc/recover.py | Python | gpl-3.0 | 1,029 |
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
from django.conf import settings
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TouristicContent.approved'
db.add_column('t_t_contenu_touristique', 'labellise',
s... | mabhub/Geotrek | geotrek/tourism/migrations/0027_auto__add_field_touristiccontent_labelled__add_field_touristicevent_la.py | Python | bsd-2-clause | 16,901 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | trabacus-softapps/openerp-8.0-cc | openerp/addons/mass_mailing/__init__.py | Python | agpl-3.0 | 1,074 |
"""The tests for marytts tts platforms."""
| fbradyirl/home-assistant | tests/components/marytts/__init__.py | Python | apache-2.0 | 43 |
#!/usr/bin/env python3
# coding: utf-8
# Pythonista appex script to copy and unpack a repo zipfile from GitHub
import appex, os, zipfile # noqa
if appex.is_running_extension():
srce_path = appex.get_file_path()
from_gh = os.path.abspath(os.path.expanduser("from GitHub"))
os.makedirs(from_gh, exist_ok=Tr... | cclauss/Ten-lines-or-less | read_zipfile_from_github.py | Python | apache-2.0 | 988 |
from socket import *
JSESSIONID =0
data = '''GET /ntss/ HTTP/1.1
Host: 192.168.176.246:8080
Connection: keep-alive
'''
data2 ='''POST /ntss/login!welcome.action HTTP/1.1
Host: 192.168.176.246:8080
Connection: keep-alive
Content-Length: 87
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xm... | relzhong/SMUClass | test.py | Python | gpl-2.0 | 1,375 |
# Copyright 2013 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
#
# Unl... | rzarzynski/tempest | tempest/api/identity/admin/v2/test_roles_negative.py | Python | apache-2.0 | 11,624 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2014 OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... | LeartS/odoo | openerp/netsvc.py | Python | agpl-3.0 | 8,801 |
"""
This script processes the output from the C preprocessor and extracts all
qstr. Each qstr is transformed into a qstr definition of the form 'Q(...)'.
This script works with Python 2.6, 2.7, 3.3 and 3.4.
"""
from __future__ import print_function
import re
import sys
import os
# Blacklist of qstrings that are spe... | swegener/micropython | py/makeqstrdefs.py | Python | mit | 3,315 |
# pylint: disable=missing-docstring
import logging
import requests
from games.models import Game, Genre
from games.util.steam import get_store_info, create_steam_installer
from platforms.models import Platform
from common.util import slugify
LOGGER = logging.getLogger(__name__)
def run():
response = requests.get... | lutris/website | scripts/import_steam_linux_games.py | Python | agpl-3.0 | 2,485 |
#/************************************************************************************************************************
# Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modificat... | DavidAntliff/AwaLWM2M | api/python/api.py | Python | bsd-3-clause | 3,068 |
"""
Django channels.
In our ws_connect function, we will simply echo back to the client
what their reply channel address is. The reply channel is the unique address
that gets assigned to every browser client that connects to our
websockets server. This value which can be retrieved from
message.reply_channel.name can b... | matthiaskoenig/tellurium-web | teweb/combine/consumers.py | Python | lgpl-3.0 | 3,438 |
"""Regex validate PIN code.
https://www.codewars.com/kata/55f8a9c06c018a0d6e000132
ATM machines allow 4 or 6 digit PIN codes
and PIN codes cannot contain anything but exactly 4 digits or exactly 6 digits.
If the function is passed a valid PIN string, return true, else return false.
eg:
validate_pin("1234") == True... | benpetty/Code-Katas | katas/validate_pin/validate_pin.py | Python | mit | 604 |
# Copyright (C) 2018 Philipp Hörist <philipp AT hoerist.com>
#
# This file is part of nbxmpp.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your opt... | gajim/python-nbxmpp | nbxmpp/modules/bookmarks/native_bookmarks.py | Python | gpl-3.0 | 4,130 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | tomas-edwardsson/check_mk | modules/packaging.py | Python | gpl-2.0 | 17,534 |
from sqf.base_type import ParserType
class Comment(ParserType):
def __init__(self, string):
super().__init__()
assert (string.startswith('/*') or string.startswith('//'))
self._string = string
def __str__(self):
return self._string
def __repr__(self):
return ('C(... | LordGolias/sqf | sqf/parser_types.py | Python | bsd-3-clause | 1,337 |
import weakref
import threading
from django.dispatch import saferef
from django.utils.six.moves import xrange
WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)
def _make_id(target):
if hasattr(target, '__func__'):
return (id(target.__self__), id(target.__func__))
return id(target)
... | Anlim/decode-Django | Django-1.5.1/django/dispatch/dispatcher.py | Python | gpl-2.0 | 10,167 |
from base64 import b64encode
from fastapi import FastAPI, Security
from fastapi.security import HTTPBasic, HTTPBasicCredentials
from fastapi.testclient import TestClient
from requests.auth import HTTPBasicAuth
app = FastAPI()
security = HTTPBasic(realm="simple", description="HTTPBasic scheme")
@app.get("/users/me"... | tiangolo/fastapi | tests/test_security_http_basic_realm_description.py | Python | mit | 2,842 |
# -*- coding:utf-8 -*-
import scrapy
from report_crawler.spiders.__Global_function import get_localtime
from report_crawler.spiders.__Global_variable import now_time, end_time
class HNU001_Spider(scrapy.Spider):
name = 'HNU001'
start_urls = ['http://csee.hnu.edu.cn/Front/TZXX_List?LMXX_BH=20130728174138ec48068e-48b... | AnselCmy/ARPS | report_crawler/report_crawler/spiders/spiders_001/_H/HNU001.py | Python | mit | 1,423 |
# source: http://docs.python.org/2.7/library/datetime.html#tzinfo-objects
from datetime import tzinfo, timedelta
ZERO = timedelta(0)
HOUR = timedelta(hours=1)
# A UTC class.
class UTC(tzinfo):
"""UTC"""
def utcoffset(self, dt):
return ZERO
def tzname(self, dt=None):
return "UTC"
d... | smhg/sublime-suncycle | timezone.py | Python | mit | 1,762 |
# This sample demonstrates a common training scenario.
# New models are being trained strarting from the production model (if it exists).
# This sample produces two runs:
# 1. The trainer will train the model from scratch and set as prod after testing it
# 2. Exact same configuration, but the pipeline will discover the... | GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/labs/samples/core/continue_training_from_prod/continue_training_from_prod.py | Python | apache-2.0 | 7,776 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitsend Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test gettxoutproof and verifytxoutproof RPCs."""
from test_framework.messages import CMerkleBlock, Fro... | LIMXTEC/BitSend | test/functional/rpc_txoutproof.py | Python | mit | 5,465 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, json
import time
from datetime import datetime
from base64 import b64encode
from pprint import pprint
import alfred
alfred.setDefaultEncodingUTF8()
__version__ = '1.4.0'
_base_host = 'http://www.kuaidi100.com/'
_expire_day = 3600 * 24
_expire_year = _exp... | vaginessa/alfred-workflows | src/express/express.py | Python | mit | 16,040 |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | QingChenmsft/azure-cli | src/command_modules/azure-cli-network/setup.py | Python | mit | 2,104 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from setting... | vied12/superdesk | server/apps/auth/ldap/tests.py | Python | agpl-3.0 | 1,346 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest import TestCase, main
from pitchpx.mlbam_util import MlbamUtil, MlbAmHttpNotFound
__author__ = 'Shinichi Nakagawa'
class TestMlbamUtil(TestCase):
"""
MLBAM Util Class Test
"""
def setUp(self):
pass
def tearDown(self):
p... | Shinichi-Nakagawa/pitchpx | tests/pitchpx/test_mlbam_util.py | Python | mit | 3,194 |
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from .utils import get_beers
from django.shortcuts import render
from .scripts.trainClassifier import LRBeerClassifier
import simplejson as json
# Create your views here.
def index(request):
beers = get_beers()
return rende... | hacktobacillus/fermenter | kettle/views.py | Python | mit | 987 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Wil Clouser <clouserw@micropipes.com>
#
# 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 ri... | qguv/config | weechat/plugins/python/emoji2alias.py | Python | gpl-3.0 | 41,578 |
#!/usr/bin/env python
# coding=utf-8
# Copyright (C) 2015 Swift Navigation Inc.
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EI... | StefanD986/peregrine | peregrine/sbas_msgs.py | Python | gpl-3.0 | 11,705 |
from django.conf.urls import url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', 'testproject.views.home', name='home'),
# url(r'^testproject/', include('testproject.foo.urls')),
# Uncomment the adm... | CloudNcodeInc/django-phonenumber-field | testproject/testproject/urls.py | Python | mit | 541 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-21 13:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0008_auto_20170118_0955'),
]
operations = [
migrations.RemoveField(
... | TexasLAN/texaslan.org | texaslan/users/migrations/0009_auto_20170221_0755.py | Python | mit | 1,209 |
"""Provide functionality to record stream."""
import logging
import os
import threading
from typing import List
import av
from homeassistant.core import callback
from .const import OUTPUT_CONTAINER_FORMAT
from .core import Segment, StreamOutput
_LOGGER = logging.getLogger(__name__)
@callback
def async_setup_recor... | turbokongen/home-assistant | homeassistant/components/stream/recorder.py | Python | apache-2.0 | 3,182 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models.signals import post_save
# Create your models here.
class Profile(models.Model):
user = models.OneToOneField(User, on_del... | peromo93/instapix | accounts/models.py | Python | mit | 772 |
""" tools for handling fasta files """
from Bio import SeqIO
from contextlib import nested
import os
def count_seqio(in_file, predicate, kind):
""" counts the records in a file that pass a predicate """
with open(in_file) as in_handle:
return reduce(lambda x, y: x + 1,
filter(pre... | roryk/bipy | bipy/toolbox/fasta.py | Python | mit | 1,632 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Justin Santa Barbara
# 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.apach... | rcbops/nova-buildpackage | nova/image/fake.py | Python | apache-2.0 | 9,011 |
"""
Compare various elastic materials w.r.t. uniaxial tension/compression test.
Requires Matplotlib.
"""
import sys
sys.path.append( '.' )
from sfepy.base.base import *
def define():
"""Define the problem to solve."""
filename_mesh = 'el3.mesh'
options = {
'nls' : 'newton',
'ls' : 'ls',
... | olivierverdier/sfepy | examples/standalone/elastic_materials/compare_elastic_materials.py | Python | bsd-3-clause | 7,019 |
import json
from django.http import HttpResponse
from django.shortcuts import render
from torrents.logic import active_torrents_info
def active(request):
if request.is_ajax():
content = {"torrents": active_torrents_info()}
return HttpResponse(json.dumps(content), content_type="application/json")
... | onepesu/django_transmission | torrents/views.py | Python | mit | 371 |
__author__ = 'civa'
import os
import sys
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class User(Base):
__tablename__ = 'app_user'
user... | Civa/Zenith | src/Backend/Distributed/hubs/auth/model/user.py | Python | gpl-3.0 | 985 |
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from MOOCworkbench.production_settings import REDIS_HOST
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'MOOCworkbench.settings')
broker_host = 'redis://{0... | MOOCworkbench/MOOCworkbench | MOOCworkbench/celery.py | Python | mit | 860 |
import warnings
import sys
import numpy as np
from numpy.testing import *
import unittest
class _GenericTest(object):
def _test_equal(self, a, b):
self._assert_func(a, b)
def _test_not_equal(self, a, b):
try:
self._assert_func(a, b)
passed = True
except Asserti... | qsnake/numpy | numpy/testing/tests/test_utils.py | Python | bsd-3-clause | 15,034 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Hook to make the commit command automatically close bugs when the commit... | sss/calibre-at-bzr | setup/git_pre_commit_hook.py | Python | gpl-3.0 | 2,553 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'impact_functions_doc_base.ui'
#
# Created: Wed Mar 20 16:03:36 2013
# by: PyQt4 UI code generator 4.9.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromU... | rukku/inasafe | safe_qgis/impact_functions_doc_base.py | Python | gpl-3.0 | 9,760 |
__author__ = 'rich'
| pirandig/bootstrap-breadcrumbs | bootstrap_breadcrumbs/templatetags/__init__.py | Python | bsd-3-clause | 20 |
########################################################################
#
# File Name: HTMLUListElement
#
# Documentation: http://docs.4suite.com/4DOM/HTMLUListElement.html
#
### This file is automatically generated by GenerateHtml.py.
### DO NOT EDIT!
"""
WWW: http://4suite.com/4DOM e-mail... | iCarto/siga | extScripting/scripts/jython/Lib/xml/dom/html/HTMLUListElement.py | Python | gpl-3.0 | 1,686 |
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class Picking(models.Model):
_inherit = "stock.picking"
require_wa = fields.Boolean(compute="_compute_... | OCA/purchase-workflow | purchase_work_acceptance/models/stock_picking.py | Python | agpl-3.0 | 4,677 |
import irclib
import urllib
import BeautifulSoup
class eat:
def on_pubmsg(self, nick, connection, event):
message = event.arguments()[0]
source = event.source().split('!')[0]
if message.startswith(".eat"):
message = message[5:]
name = message
message = message.replace(" ", "%20")
url =... | Oozemeister/Gypsy | modules/pubmsg/eat.py | Python | gpl-2.0 | 677 |
__all__ = ["markdown", "mdx_code", "mdx_footnotes", "mdx_lifeflow"]
| lethain/lifeflow | markdown/__init__.py | Python | mit | 68 |
#---------------------------------------------------------------------------
# Copyright 2010, 2011 Sushil J. Louis and Christopher E. Miles,
# Evolutionary Computing Systems Laboratory, Department of Computer Science
# and Engineering, University of Nevada, Reno.
#
# This file is part of OpenECSLENT
#
# OpenECS... | bgaunt/openEcslent | engine/gui/selectionHandler.py | Python | gpl-3.0 | 3,155 |
import datetime
import importlib
import os
import sys
from django.apps import apps
from django.db.models.fields import NOT_PROVIDED
from django.utils import timezone
from .loader import MigrationLoader
class MigrationQuestioner:
"""
Give the autodetector responses to questions it might have.
This base c... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/db/migrations/questioner.py | Python | mit | 9,918 |
# Copyright 2011 Jamie Norrish (jamie@artefact.org.nz)
# Copyright 2008 - 2010 Lars Heuer (heuer[at]semagia.com)
#
# 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/... | ajenhl/django-tmapi | tmapi/models/signature.py | Python | apache-2.0 | 4,627 |
"""Support for myStrom Wifi bulbs."""
import logging
from pymystrom.bulb import MyStromBulb
from pymystrom.exceptions import MyStromConnectionError
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_EFFECT,
ATTR_HS_COLOR,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS... | nkgilley/home-assistant | homeassistant/components/mystrom/light.py | Python | apache-2.0 | 4,976 |
import pickle
from qanta.guesser.abstract import AbstractGuesser
from qanta.guesser.dan import DanGuesser
from qanta.util.constants import BUZZER_TRAIN_FOLD, BUZZER_DEV_FOLD
guesser_directory = AbstractGuesser.output_path(
"qanta.guesser.dan", "DanGuesser", 0, ""
)
guesser = DanGuesser.load(guesser_directory) # t... | Pinafore/qb | generate_guesses.py | Python | mit | 646 |
import deepdish as dd
class Foo(dd.util.SaveableRegistry):
def __init__(self, x):
self.x = x
@classmethod
def load_from_dict(self, d):
obj = Foo(d['x'])
return obj
def save_to_dict(self):
return {'x': self.x}
@Foo.register('bar')
class Bar(Foo):
def __init__(self... | agarbuno/deepdish | doc/source/codefiles/saveable_example.py | Python | bsd-3-clause | 542 |
from bpy_extras.view3d_utils import location_3d_to_region_2d
def render_get_resolution_(r):
xres = int(r.resolution_x * r.resolution_percentage * 0.01)
yres = int(r.resolution_y * r.resolution_percentage * 0.01)
return xres, yres
def render_get_aspect_(r, camera=None, x=-1, y=-1):
if x != -1 and y... | prman-pixar/RenderManForBlender | rfb_utils/camera_utils.py | Python | mit | 2,235 |
#!/usr/bin/python
"""
Module to test RO manager RDF report creation function
"""
import os, os.path
import sys
import re
import shutil
import logging
import datetime
import StringIO
import json
import unittest
log = logging.getLogger(__name__)
if __name__ == "__main__":
# Add main project directory and ro manag... | wf4ever/ro-manager | src/roweb/test/TestRdfReport.py | Python | mit | 27,177 |
# -*- coding: utf-8 -*-
#
# pysimplelog documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 12 22:54:29 2016.
#
# 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.
#... | bachiraoun/pysimplelog | docs/source/conf.py | Python | agpl-3.0 | 10,451 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from io import BytesIO
from django.core.exceptions import ValidationError
from django.core.validators import BaseValidator
from django.utils.translation import ugettext_lazy as _
from PIL import Image
class BaseSizeValidator(BaseValida... | epowers/django-stdimage | stdimage/validators.py | Python | mit | 1,947 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2010:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Licens... | wbsavage/shinken | test/test_livestatus_db.py | Python | agpl-3.0 | 36,115 |
"""
This module provides a set of utilities for writing TSV files.
.. autoclass:: mysqltsv.writer.Writer
:members:
.. autofunction:: mysqltsv.functions.write
"""
import logging
from .util import write_row
logger = logging.getLogger(__name__)
class Writer:
"""
Constructs a new TSV row writer.
:Pa... | halfak/mysqltsv | mysqltsv/writer.py | Python | mit | 1,278 |
"""The tests for the pushbullet notification platform."""
from http import HTTPStatus
import json
from unittest.mock import patch
from pushbullet import PushBullet
import pytest
import homeassistant.components.notify as notify
from homeassistant.setup import async_setup_component
from tests.common import assert_setu... | aronsky/home-assistant | tests/components/pushbullet/test_notify.py | Python | apache-2.0 | 8,810 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cpro', '0007_auto_20160928_2324'),
]
... | SchoolIdolTomodachi/CinderellaProducers | cpro/migrations/0008_auto_20160928_2326.py | Python | apache-2.0 | 1,097 |
"""
Build control worker: cruise through build steps and dispatch
tasks to perform the actual build
Copyright (c) 2013 Heikki Nousiainen, F-Secure
See LICENSE for details
"""
import time
import tempfile
import copy
from distci.worker import worker_base, task_base
from distci import distcilib
c... | F-Secure/distci | src/distci/worker/build_control/build_control.py | Python | apache-2.0 | 9,652 |
from heppy.framework.analyzer import Analyzer
from heppy.framework.event import Event
from heppy_fcc.particles.tlv.jet import Jet
from heppy_fcc.particles.jet import JetConstituents
import os
from ROOT import gSystem
CCJetClusterizer = None
if os.environ.get('ANALYSISCPP'):
gSystem.Load("libanalysiscpp-tools")
... | semkiv/heppy_fcc | analyzers/JetClusterizer.py | Python | gpl-3.0 | 2,690 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-11-21 16:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('question', '0006_auto_20171121_1107'),
]
operations = [
migrations.AlterFie... | airportmarc/the416life | src/apps/question/migrations/0007_auto_20171121_1110.py | Python | mit | 509 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Justin Santa Barbara
# 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.apach... | 30loops/nova | nova/image/fake.py | Python | apache-2.0 | 6,986 |
# coding=utf-8
import abc
import logging
import tempfile
from bireus.client.download_service import AbstractDownloadService
from bireus.client.notification_service import NotificationService
from bireus.shared import *
from bireus.shared.diff_head import DiffHead
from bireus.shared.diff_item import DiffItem
from bireu... | Brutus5000/BiReUS | bireus/client/patch_tasks/base.py | Python | mit | 3,803 |
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QLineEdit, QFrame, QDialogButtonBox, QApplication, QComboBox
from PyQt5.QtCore import pyqtSignal
from domestic.core import ReaderDb, isFeed, feedInfo
from bs4 import BeautifulSoup
from urllib.request import urlopen
from urllib.parse import urljoin
import ssl
i... | mthnzbk/domestic | domestic/dialogs/feedadd.py | Python | gpl-3.0 | 5,865 |
# -*- coding:utf-8 -*-
import datetime
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from django.views.generic.base import TemplateView
from django.utils.decorators import method_decorator
from django.contr... | sfcl/severcart | docs/views.py | Python | gpl-2.0 | 11,197 |
# python/example2.py -- Python version of an example application that shows
# how to use the form helper class. For a C++ implementation, see
# '../src/example2.cpp'.
#
# NanoGUI was developed by Wenzel Jakob <wenzel@inf.ethz.ch>.
# The widget drawing code is based on the NanoVG demo application
# by Mikko Mononen.
#
#... | LiveAsynchronousVisualizedArchitecture/lava | nuklear/nanogui/python/example2.py | Python | apache-2.0 | 1,982 |
from osim.env import L2RunEnv
import numpy as np
import unittest
class ActivationsTest(unittest.TestCase):
def test_clipping(self):
env = L2RunEnv(visualize=False)
observation = env.reset()
env.step(np.array([5.0] * 18))
self.assertLessEqual( np.sum(env.osim_model.last_action), 18.... | stanfordnmbl/osim-rl | tests/test.clipping.py | Python | mit | 498 |
# -*- coding: utf-8 -*-
from odoo.tests import common
class TestGroupOnSelection(common.TransactionCase):
def setUp(self):
super(TestGroupOnSelection, self).setUp()
self.Model = self.env['test_read_group.on_selection']
def test_none(self):
self.Model.create({'value': 1})
self.... | jeremiahyan/odoo | odoo/addons/test_read_group/tests/test_group_expand.py | Python | gpl-3.0 | 7,222 |
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tartavull/google-cloud-python | spanner/tests/unit/test_transaction.py | Python | apache-2.0 | 15,202 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2013 - 2014 by Wilbert Berendsen
#
# 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
... | brownian/frescobaldi | frescobaldi_app/lydocument.py | Python | gpl-2.0 | 8,870 |
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^sql/$', 'sqlparser.views.parse_sql'),
)
| slack-sqlbot/slack-sqlbot | slack_sqlbot/urls.py | Python | mit | 164 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.