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 |
|---|---|---|---|---|---|
a_l = [0, 1, 2]
b_l = [10, 20, 30]
a_t = (0, 1, 2)
b_t = (10, 20, 30)
a_s = 'abc'
b_s = 'xyz'
print(a_l + b_l)
# [0, 1, 2, 10, 20, 30]
print(a_t + b_t)
# (0, 1, 2, 10, 20, 30)
print(a_s + b_s)
# abcxyz
# print(a_l + 3)
# TypeError: can only concatenate list (not "int") to list
print(a_l + [3])
# [0, 1, 2, 3]
# ... | nkmk/python-snippets | notebook/arithmetic_operator_list_tuple_str.py | Python | mit | 1,210 |
"""Interface for stack manifest YAML files written by buildlsstsw.sh
The purpose of these YAML files is to isolate ltd-mason from Eups/Scons
builds of the software itself and to merely tell ltd-mason where the built
software can be found, and metadata about the versioning of this Stack.
"""
import abc
from urllib.par... | lsst-sqre/ltd-mason | ltdmason/manifest.py | Python | mit | 7,686 |
"""The tests for the Roku remote platform."""
from unittest.mock import patch
from homeassistant.components.remote import (
ATTR_COMMAND,
DOMAIN as REMOTE_DOMAIN,
SERVICE_SEND_COMMAND,
)
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
from homeassistant.helpers import enti... | w1ll1am23/home-assistant | tests/components/roku/test_remote.py | Python | apache-2.0 | 2,309 |
from core.models import *
from django.contrib.auth import authenticate, login
from django.contrib.auth.forms import UserCreationForm
from django.shortcuts import render, redirect, get_object_or_404
#import redis
#r = redis.StrictRedis(host='localhost', port=6379, db=0)
def home(request):
return render(request, '... | mburst/gevent-socketio-starterkit | djangoproject/core/views.py | Python | mit | 855 |
# 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... | dhuang/incubator-airflow | tests/providers/microsoft/azure/hooks/test_azure_data_factory.py | Python | apache-2.0 | 15,858 |
import minecraft as minecraft
import random
import time
x = 128
y = 2
z = 128
mc = minecraft.Minecraft.create()
while y < 63:
j = mc.getBlock(x,y,z)
if j == 0:
mc.setBlock(x,y,z,8)
z = z - 1
if z <= -128: ... | mohsraspi/mhscs14 | jay/wowobsidian.py | Python | gpl-2.0 | 437 |
from django.http import HttpResponse
from django.shortcuts import render_to_response
from models import HttpResponse
def hello_world(request):
return HttpResponse('hello world')
| MeirKriheli/Open-Knesset | simple/views.py | Python | bsd-3-clause | 184 |
"""
WSGI config for expression_data project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLIC... | davebridges/expression-data-server | expression_data/expression_data/wsgi.py | Python | bsd-2-clause | 1,152 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 06 14:24:18 2017
@author: jpeacock
"""
#==============================================================================
# Imports
#==============================================================================
#import os
#import time
import numpy as np
#import mtpy.usgs.... | simpeg/processing | tests/test_ts.py | Python | mit | 1,875 |
from collections import namedtuple
import pytest
from app.utils import get_errors_for_csv
MockRecipients = namedtuple(
'RecipientCSV',
[
'rows_with_bad_recipients',
'rows_with_missing_data'
]
)
@pytest.mark.parametrize(
"rows_with_bad_recipients,rows_with_missing_data,template_type... | gov-cjwaszczuk/notifications-admin | tests/app/main/test_errors_for_csv.py | Python | mit | 1,478 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os
import sys
from setuptools import setup
name = 'drf-proxy-pagination'
package = 'proxy_pagination'
description = 'Pagination class for Django REST Framework to choose pagination class by query parameter'
url = 'https://github.com/tuffnatty/drf-proxy-pa... | tuffnatty/drf-proxy-pagination | setup.py | Python | mit | 2,908 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# File name: a.py
#
# Creation date: 09-04-2015
#
# Created by: Pavlos Parissis <pavlos.parissis@booking.com>
#
import re
def main():
# [[:digit:]]{1,}\. [0-9A-Za-z_]{1,} \[.*B.*\]:'
frontend = []
backend = []
server = []
with open('... | unixsurfer/haproxyadmin | tools/generate_constants_for_metrics.py | Python | apache-2.0 | 1,229 |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
# Modifications copyright 2016 Meteotest
#
# 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
#... | meteotest/hurray | hurray/server/ioloop.py | Python | bsd-3-clause | 41,487 |
# -*- coding:utf-8 -*-
'''
输入一个链表,从尾到头打印链表每个节点的值。
'''
'''
方法一:
使用insert()方法
方法二:
使用append()和reverse()方法
'''
class ListNode:
def __init__(self, x = None):
self.val = x
self.next = None
class Solution_1:
def ListFromTailToHead(self, ListNode):
if ListNode.val == None:
r... | shabbylee/algorithm | 从尾到头打印链表.py | Python | apache-2.0 | 1,593 |
from corehq.apps.app_manager.management.commands.helpers import (
AppMigrationCommandBase,
)
from corehq.apps.app_manager.models import Application
class Command(AppMigrationCommandBase):
help = "Migrate preload dict in advanced forms to " \
"allow loading the same case property into multiple quest... | dimagi/commcare-hq | corehq/apps/app_manager/management/commands/migrate_advanced_form_preload.py | Python | bsd-3-clause | 1,053 |
# coding=utf-8
"""Docstring for this file."""
__author__ = 'ismailsunni'
__project_name = 'watchkeeper'
__filename = 'movement'
__date__ = '5/11/15'
__copyright__ = 'imajimatika@gmail.com'
__doc__ = ''
from django import forms
from event_mapper.utilities.commons import get_verbose_name, get_help_text
from event_mapp... | MariaSolovyeva/watchkeeper | django_project/event_mapper/forms/movement.py | Python | bsd-2-clause | 2,831 |
from django.forms import ValidationError
from django.test import TestCase
from nap.serialiser import fields
class Mock(object):
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
class FieldTestCase(TestCase):
'''
Field cycles:
deflate: digattr -> red... | limbera/django-nap | tests/test_fields.py | Python | bsd-3-clause | 4,834 |
import logging
from datetime import timedelta
pygame = None
from rx.internal import PriorityQueue
from rx.concurrency.schedulerbase import SchedulerBase
from rx.concurrency.scheduleditem import ScheduledItem
log = logging.getLogger("Rx")
class PyGameScheduler(SchedulerBase):
"""A scheduler that schedules works... | Sprytile/Sprytile | rx/concurrency/mainloopscheduler/pygamescheduler.py | Python | mit | 2,426 |
#! /usr/bin/env python
# @author Billy Wilson Arante
# @created 1/7/2016 PHT
# @modified 1/8/2016 PHT
# @description
# A. Encrypts a message using Caesar cipher
# B. Decrypts a message back from Caesar cipher encryption
def encrypt_word(in_word, shift_val):
enc_word = ""
for char in in_word:
if (ord(... | arantebillywilson/python-snippets | py3/cs-circle/caesar_cipher.py | Python | mit | 1,613 |
# -*- coding: utf-8 -*-
import re
import numpy as np
from scipy.optimize import leastsq
import matplotlib.pyplot as pl
def func(x, p):
a2, a1, a0 = p
return a2 * x * x + a1 * x + a0
def residuals(p, y, x):
return y - func(x, p)
# hack
x = [0, 1, 2, 3, 4, 5, 6, 8]
y = [1, 2, 2, 2, 3, 3, 4, 4]
p = (0, 0... | voidrank/science_python | least_square/leastsq_1.py | Python | mit | 710 |
#!/usr/bin/env python3
import os
import socket
import errno
from time import sleep
from pySilkroadSecurity import SilkroadSecurity
from stream import *
def HandlePacket(security, packet):
r = stream_reader(packet['data'])
if packet['opcode'] == 0x2001:
server = r.read_ascii(r.read_uint16())
if server == 'Ga... | ProjectHax/pySilkroadSecurity | python/pySilkroadStats.py | Python | unlicense | 2,038 |
# -*- coding: utf-8 -*-
'''
================================================================================
This confidential and proprietary software may be used only
as authorized by a licensing agreement from Thumb o'Cat Inc.
In the event of publication, the following notice is applicable:
Copyright (C... | luuvish/libvio | script/test/model/libvio.py | Python | mit | 1,572 |
import xml.etree.ElementTree as ET
from stats import parsers
from django.conf import settings
from pytvdbapi import api
import requests
def query_service(url, headers={}, payload={}):
"""
A generalised function that handles making requests and
injecting a user agent header.
No assumption is made abo... | marcus-crane/site | site/stats/sources.py | Python | mit | 7,067 |
import time
import bbio
import numpy as np
ULTRAS = ((bbio.GPIO1_12, bbio.GPIO1_13),
(bbio.GPIO0_3, bbio.GPIO0_2),
(bbio.GPIO1_17, bbio.GPIO0_15),
(bbio.GPIO3_21, bbio.GPIO0_14),
(bbio.GPIO3_19, bbio.GPIO3_16),)
# trigger duration
DECPULSETRIGGER = 0.0001
# loop iterations bef... | delijati/ultrabot | test/ultra_pybbio.py | Python | mit | 1,932 |
# -*- coding: utf-8 -*-
"""
Load Cell 2.0 Plugin
Copyright (C) 2018 Olaf Lüke <olaf@tinkerforge.com>
__init__.py: package initialization
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 versio... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/load_cell_v2/__init__.py | Python | gpl-2.0 | 926 |
# -*- coding: utf-8 -*-
"""
Tests of responsetypes
"""
from datetime import datetime
import json
import os
import pyparsing
import random
import unittest
import textwrap
import requests
import mock
from . import new_loncapa_problem, test_capa_system
import calc
from capa.responsetypes import LoncapaProblemError, \
... | XiaodunServerGroup/ddyedx | common/lib/capa/capa/tests/test_responsetypes.py | Python | agpl-3.0 | 92,013 |
import types
from StringIO import StringIO
from validator.contextgenerator import ContextGenerator
class PropertiesParser(object):
"""
Parses and serializes .properties files. Even though you can pretty
much do this in your sleep, it's still useful for L10n tests.
"""
def __init__(self, dtd):
... | mattbasta/amo-validator | validator/testcases/l10n/properties.py | Python | bsd-3-clause | 2,287 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import calculus
import numpy as np
import system_constraints as cnstr
import system_loglikelihood as logl
class direction:
def __init__(self,panel):
self.gradient=calculus.gradient(panel)
self.hessian=calculus.hessian(panel,self.gradient)
self.panel=panel
self.c... | espensirnes/paneltime | paneltime/system/system_direction.py | Python | gpl-3.0 | 5,279 |
from condottieri_notification.models import Notice
def notification(request):
if request.user.is_authenticated:
return {
"notice_unseen_count": Notice.objects.unseen_count_for(request.user)
}
else:
return {}
| jantoniomartin/condottieri_notification | context_processors.py | Python | agpl-3.0 | 253 |
from flask import request, session, redirect, url_for, current_app
from .base import authlib_oauth_client
from ..models.setting import Setting
def oidc_oauth():
if not Setting().get('oidc_oauth_enabled'):
return None
def fetch_oidc_token():
return session.get('oidc_token')
def update_to... | ngoduykhanh/PowerDNS-Admin | powerdnsadmin/services/oidc.py | Python | mit | 1,425 |
"""
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from tests.helpers import http_client
def test_view_profile_of_existing_user(site_app, site, user):
response = request_profile(site_app, user.id)
assert response.status_code == 200
assert response.m... | homeworkprod/byceps | tests/integration/blueprints/site/user_profile/test_view.py | Python | bsd-3-clause | 1,245 |
import sys, copy, types as pytypes
IS_RPYTHON = sys.argv[0].endswith('rpython')
if IS_RPYTHON:
from rpython.rlib.listsort import TimSort
else:
import re
# General functions
class StringSort(TimSort):
def lt(self, a, b):
assert isinstance(a, unicode)
assert isinstance(b, unicode)
r... | hterkelsen/mal | rpython/mal_types.py | Python | mpl-2.0 | 7,771 |
# Copyright 2013 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... | nkrinner/nova | nova/tests/virt/xenapi/test_vmops.py | Python | apache-2.0 | 42,897 |
from ogcserver.cgiserver import Handler
from jon import fcgi
class OGCServerHandler(Handler):
configpath = '/path/to/ogcserver.conf'
fcgi.Server({fcgi.FCGI_RESPONDER: OGCServerHandler}).run()
| pbabik/OGCServer | conf/fcgi_app.py | Python | bsd-3-clause | 198 |
#contains different packages | riccardodg/lodstuff | lremap/it/cnr/ilc/lremap2owl/__init__.py | Python | gpl-3.0 | 28 |
#! /usr/bin/env python3
#Michiel Merx and Inne Lemstra 2017-01-24
#Not working still under construction
import subprocess
import time
def benchmark(outputPreStep, shortReads):
output = "../test_data/Soap2_alignment_paired.sam"
startTime = time.time()
debug = go(outputPreStep, shortReads, output)
endTime = time.... | MWJMerkx/pcfb_project | client/sra_modules/soap2Align.py | Python | gpl-3.0 | 863 |
# -*- coding: utf-8 -*-
"""
test_cookiecutter_invocation
----------------------------
Tests to make sure that cookiecutter can be called from the cli without
using the entry point set up for the package.
"""
import os
import pytest
import subprocess
import sys
from cookiecutter import utils
def test_should_raise_... | atlassian/cookiecutter | tests/test_cookiecutter_invocation.py | Python | bsd-3-clause | 1,239 |
# sbhs-timetable-python
# Copyright (C) 2015 Simon Shields, James Ye
#
# 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, either version 3 of the License, or
# (at your option) any later ver... | sbhs-forkbombers/sbhs-timetable-python | sbhstimetable/colours.py | Python | agpl-3.0 | 2,506 |
import flask
from git_code_debt.server.servlets.index import Metric
from testing.assertions.response import assert_no_response_errors
def _test_it_loads(server):
response = server.client.get(flask.url_for('index.show'))
assert_no_response_errors(response)
# Should have a nonzero number of links to things... | Yelp/git-code-debt | tests/server/servlets/index_test.py | Python | mit | 841 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2017 Ben Kurtovic <ben.kurtovic@gmail.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 ... | gencer/mwparserfromhell | mwparserfromhell/parser/contexts.py | Python | mit | 5,649 |
# -*- coding: utf-8 -*-
import os
import re
import shutil
import cv2
def getImageFile(srcFolder, dstFolder, pattern):
"""
指定フォルダ内にある正規表現にマッチしたファイルのみを指定フォルダにコピーする
"""
if not os.path.exists(dstFolder):
os.makedirs(dstFolder)
for fileName in os.listdir(srcFolder):
matchOB = re.matc... | yizumi1012xxx/research-rcnn | cnn/cnn/src/util/image.py | Python | mit | 769 |
# 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
# d... | openstack/vitrage-dashboard | vitrage_dashboard/templates/version.py | Python | apache-2.0 | 656 |
from py_particle_processor_qt.py_particle_processor_qt import *
| DanielWinklehner/py_particle_processor | py_particle_processor_qt/__init__.py | Python | mit | 64 |
#
# The Python Imaging Library.
# $Id$
#
# PCX file handling
#
# This format was originally used by ZSoft's popular PaintBrush
# program for the IBM PC. It is also supported by many MS-DOS and
# Windows applications, including the Windows PaintBrush program in
# Windows 3.
#
# history:
# 1995-09-01 fl Cr... | robiame/AndroidGeodata | pil/PcxImagePlugin.py | Python | mit | 4,834 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This file is part of MoaT, the Master of all Things.
##
## MoaT is Copyright © 2007-2016 by Matthias Urlichs <matthias@urlichs.de>,
## it is licensed under the GPLv3. See the file `README.rst` for details... | smurfix/MoaT | irrigation/irrigator/views/level.py | Python | gpl-3.0 | 2,763 |
#0 seznam zvířat
dom_zvirata = ['pes','kočka','kralík','had']
#4 jména zvířat
moji_mazlicci = ['Chula', 'Gordo', 'Bondy', 'Alan', 'Sancho']
vasi_mazlicci = ['Chula', 'Gordo', 'Brok', 'Alfonso', 'Silák']
spolecni_mazlicci = []
jen_moji = []
jen_vasi = []
for jmena_1 in moji_mazlicci:
for jmena_2 in vasi_mazlicci:
... | Zuzanita/PyZuzu | DP_07_seznamy/Jmena_mazliku.py | Python | mit | 1,217 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/oval_5/sc/linux/PartitionItemElement.py | Python | gpl-3.0 | 1,766 |
# Python test set -- part 5, built-in exceptions
from test_support import *
from types import ClassType
print '5. Built-in exceptions'
# XXX This is not really enough, each *operation* should be tested!
def test_raise_catch(exc):
try:
raise exc, "spam"
except exc, err:
buf = str(err)
try:... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/test/test_exceptions.py | Python | mit | 2,720 |
from Screens.Screen import Screen
from Screens.Dish import Dishpip
from enigma import ePoint, eSize, eRect, eServiceCenter, getBestPlayableServiceReference, eServiceReference, eTimer
from Components.SystemInfo import SystemInfo
from Components.VideoWindow import VideoWindow
from Components.config import config, ConfigP... | XTAv2/Enigma2 | lib/python/Screens/PictureInPicture.py | Python | gpl-2.0 | 8,262 |
#!/usr/bin/env python
#-
# Copyright (c) 2010 Gleb Kurtsou
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this l... | dplbsd/soc2013 | head/tools/tools/shlib-compat/shlib-compat.py | Python | bsd-2-clause | 36,865 |
import locale
from urh.util.Logger import logger
class Formatter:
@staticmethod
def local_decimal_seperator():
return locale.localeconv()["decimal_point"]
@staticmethod
def science_time(time_in_seconds: float, decimals=2, append_seconds=True, remove_spaces=False) -> str:
if time_in_se... | jopohl/urh | src/urh/util/Formatter.py | Python | gpl-3.0 | 1,943 |
# 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... | dmlc/tvm | python/tvm/relay/analysis/_ffi_api.py | Python | apache-2.0 | 892 |
#!/usr/bin/python3
import math
import os
import subprocess
import traceback
import dbus
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('CDesktopEnums', '3.0')
gi.require_version('CinnamonDesktop', '3.0')
from gi.repository import Gio, Gtk, GObject, Gdk, GLib, GdkPixbuf, CDesktopEnums, CinnamonDesktop, ... | linuxmint/Cinnamon | files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py | Python | gpl-2.0 | 39,017 |
from base import Task
from common import phases
import filesystem
import volume
class PartitionVolume(Task):
description = 'Partitioning the volume'
phase = phases.volume_preparation
@classmethod
def run(cls, info):
info.volume.partition_map.create(info.volume)
class MapPartitions(Task):
description = 'Mapp... | brianspeir/Vanilla | vendor/bootstrap-vz/common/tasks/partitioning.py | Python | bsd-3-clause | 798 |
import os
import re
import yaml
import types
from keystoneclient.auth.identity import v2
from keystoneclient import session
from keystoneclient.v2_0.client import Client as keyclient
class OpenStack(object):
def __init__(self, conf):
config_file = os.path.join(os.path.dirname(__file__), conf)
tr... | armab/st2contrib | packs/openstack/actions/lib/openstack.py | Python | apache-2.0 | 2,933 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields
class ProductCategory(... | Eficent/odoomrp-wip | procurement_purchase_no_grouping/models/product_category.py | Python | agpl-3.0 | 1,186 |
from mock import MagicMock, patch
from nose.tools import eq_, raises
from orchestrator.tasks.common import ErrorHandlerTask, ping, async_wait
from orchestrator.tasks.util import TaskNotReadyException
@patch('orchestrator.tasks.common.group')
def test_on_failure_for_error_handler_task(m_group):
"""
Should invo... | totem/cluster-orchestrator | tests/unit/orchestrator/tasks/test_common.py | Python | mit | 2,816 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListMembers
# Retrieves the email addresses of members of a MailChimp list.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
... | jordanemedlock/psychtruths | temboo/core/Library/MailChimp/ListMembers.py | Python | apache-2.0 | 4,839 |
#!/usr/bin/python
# Copyright 2003 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Test that C files are compiled by C compiler
from BoostBuild import Tester, List
t = Tester()
t.write("project-root.ja... | albmarvil/The-Eternal-Sorrow | dependencies/luabind/boost-build/test/c_file.py | Python | apache-2.0 | 691 |
import string
from django.conf import settings
# Default backend used to for get_connection() function.
DEFAULT_BACKEND = getattr(settings, 'BREVISURL_BACKEND', 'brevisurl.backends.local.BrevisUrlBackend')
# Domain that is used to create shortened urls.
LOCAL_BACKEND_DOMAIN = getattr(settings, 'BREVISURL_BACKEND_LO... | Peach-Labs/django-brevisurl | brevisurl/settings.py | Python | bsd-3-clause | 1,212 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^index$', views.index, name='index'),
url(r'^signup/$', views.signup, name = 'signup'),
url(r'^map/$', views.map, name = 'map'),
url(r'^qrtest/$', views.qrtest, name = 'qrtest'),
u... | cliffpanos/True-Pass-iOS | CheckIn/pages/urls.py | Python | apache-2.0 | 403 |
#!/usr/bin/env python
import logging
from ina219 import INA219
SHUNT_OHMS = 0.1
MAX_EXPECTED_AMPS = 0.2
def read():
ina = INA219(SHUNT_OHMS, MAX_EXPECTED_AMPS, log_level=logging.INFO)
ina.configure(ina.RANGE_16V, ina.GAIN_AUTO)
print("Bus Voltage : %.3f V" % ina.voltage())
print("Bus Current ... | chrisb2/pi_ina219 | example.py | Python | mit | 560 |
# Copyright (C) 2010 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/port/base.py | Python | bsd-3-clause | 71,188 |
#!/usr/bin/env python
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googleads/google-ads-python | examples/basic_operations/pause_ad.py | Python | apache-2.0 | 3,013 |
from Cython.Compiler import Options
from Cython.Compiler import PyrexTypes
from Cython.Compiler.Visitor import CythonTransform
from Cython.Compiler.StringEncoding import EncodedString
from Cython.Compiler.AutoDocTransforms import (
ExpressionWriter as BaseExpressionWriter,
AnnotationWriter as BaseAnnotationWrit... | mpi4py/mpi4py | conf/cyautodoc.py | Python | bsd-2-clause | 9,170 |
#!/usr/bin/python
import sys
import re
for line in sys.stdin:
# Turn the list into a collection of lowercase words
for word in re.findall(r'[a-zA-Z]+', line):
if word.isupper():
print("Capital 1")
else:
print("Lower 1") | JasonSanchez/w261 | week1/mapper.py | Python | mit | 268 |
"""Config flow for Somfy MyLink integration."""
import asyncio
from copy import deepcopy
import logging
from somfy_mylink_synergy import SomfyMyLinkSynergy
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.components.dhcp import HOSTNAME, IP_ADDRESS, MAC_ADDRESS
fr... | w1ll1am23/home-assistant | homeassistant/components/somfy_mylink/config_flow.py | Python | apache-2.0 | 7,332 |
from django.contrib import admin
# Register your models here.
from products.models import Product
admin.site.register(Product) | katchengli/IntlWDHackathon | products/admin.py | Python | mit | 128 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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 appl... | kuke/models | fluid/PaddleNLP/language_model/lstm/lm_model.py | Python | apache-2.0 | 12,234 |
from random import shuffle
import sys
import argparse
import re
parser = argparse.ArgumentParser(description="Colorize stdin; (optionally) add a tag.")
parser.add_argument("--tag", type=str, help="Optional tag")
parser.add_argument("--no-color", action="store_true", help="Flag to force the output to be no color.")
ar... | ucbrise/clipper | bin/colorize_output.py | Python | apache-2.0 | 1,153 |
#!/usr/bin/python3
import pygame
import sys
import math
# own modules
#import pygame.math.Vector2
#import pygame.math.Vector3 as Vec3d
#import pygame.math.Vector2 as Vec2d
from Vec2d import Vec2d
from Vec3d import Vec3d
class Circle(object):
"""a Circle in 3D Space"""
def __init__(self, surface, color, cent... | gunny26/python-demoscene | Circle.py | Python | gpl-2.0 | 4,946 |
import sys, getopt, csv
from math import log
def main(argv):
try:
opts, args = getopt.getopt(argv, "w:h:r:c:",["ref=","cmp="])
except getopt.GetoptError:
print 'psnr.py -r <reference yuv> -c <comparing yuv>'
sys.exit(2)
width = 1920
height = 1080
ref_yuv = ''
cmp_yuv = '... | dspmeng/code | scripts/psnr.py | Python | apache-2.0 | 1,982 |
from __future__ import annotations
from typing import TYPE_CHECKING, Container, cast
import numpy as np
from physt.binnings import BinningBase, as_binning
from physt.histogram1d import Histogram1D, ObjectWithBinning
if TYPE_CHECKING:
from typing import Any, Dict, Optional, Tuple
import physt
from physt... | janpipek/physt | physt/histogram_collection.py | Python | mit | 6,905 |
# -*- coding: utf-8-*-
# 路线查询
import sys
import os
import re
import json, urllib
from urllib import urlencode
import socket
reload(sys)
sys.setdefaultencoding('utf8')
class JpLearn(object):
mappings = {}
scenes = {}
"""docstring for JpLearn"""
def __init__(self):
self.mappings = {
'第1课':'lesson_1',
'第... | masonyang/test | jplearn.py | Python | gpl-3.0 | 4,204 |
"""
Django settings for djasmine project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
imp... | tjwalch/djasmine | test_project/settings.py | Python | mit | 1,951 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEST_RUNNER = "django.test.runner.DiscoverRunner"
SECRET_KEY = 'i%&(axb!!5yfg6kv$m*ytf9i-0)z-&1y-wkmv^oz#6l&$*+!v6'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.... | PetrDlouhy/django-gpxpy | tests/settings.py | Python | gpl-3.0 | 340 |
"""Test class for GPG Key CLI.
The gpg sub-command was deprecated in favour of content-credential in
Satellite 6.8
:Requirement: ContentCredential
:CaseAutomation: Automated
:CaseLevel: Component
:CaseComponent: ContentCredentials
:Assignee: swadeley
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""... | jyejare/robottelo | tests/foreman/cli/test_content_credentials.py | Python | gpl-3.0 | 33,540 |
import sys
import event
class ducklingScriptParser():
#Split the timeString (mmss) from the EventString (xxx)
"""
"""
def __init__(self):
pass
@staticmethod
def splitEvent(strEvent):
"""
@param strEvent:
@return:
"""
i = 0
while strEv... | nlaurens/SpaceAlert | ducklingScriptParser.py | Python | mit | 4,232 |
# Python library for Remember The Milk API
__author__ = 'Sridhar Ratnakumar <http://nearfar.org/>'
__all__ = (
'API',
'createRTM',
'set_log_level',
)
import urllib.request
import urllib.parse
import urllib.error
from hashlib import md5
from GTG import _
from GTG.tools.logger import Log
_use_jsonlib = F... | sagarghuge/recurringtask | GTG/backends/rtm/rtm.py | Python | gpl-3.0 | 11,239 |
#!/usr/bin/python
import sys
from participantCollection import ParticipantCollection
names = sys.argv[1::]
participants = ParticipantCollection()
for name in names:
if participants.hasParticipantNamed(name):
participants.participantNamed(name).hasCheckedIn = True
print "just checked in " + name
... | foobarbazblarg/stayclean | stayclean-2017-january/checkin.py | Python | mit | 427 |
#
#
# MMP (Multiscale Modeling Platform) - EU Project
# funded by FP7 under NMP-2013-1.4-1 call with Grant agreement no: 604279
#
# Copyright (C) 2014-2016
# Ralph Altenfeld (Access e.V., Germany)
#
# This script code is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser G... | mupif/mupif | obsolete/APIs/micress/micressConfig.py | Python | lgpl-3.0 | 1,359 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, publish... | rwl/PyCIM | CIM15/IEC61970/Wires/GroundDisconnector.py | Python | mit | 1,730 |
# -*- coding: utf-8 -*-
from .base import SqlNode
from .utils import _setup_joins_for_fields
# TODO: add function(function()) feature.
class SqlFunction(SqlNode):
sql_template = '%(function)s(%(field)s)'
sql_function = None
args = []
def __init__(self, field, *args, **kwargs):
self.field = f... | cr8ivecodesmith/django-orm-extensions-save22 | django_orm/core/sql/functions.py | Python | bsd-3-clause | 1,172 |
from discord import VoiceChannel, PCMVolumeTransformer, FFmpegPCMAudio
from discord.ext import commands
from discord.ext.commands import Context
from Cogs.Utils.custom_bot import CustomBot
from Cogs.Utils.youtube_downloader import YTDL_Source
class Music_Commands(object):
def __init__(self, bot:CustomBot):
... | 4Kaylum/Spar.cli | Cogs/_Music_Commands.py | Python | gpl-3.0 | 2,450 |
#### this is the server class as well as the starter script for MusicMashup.
# server is build upon cherrypy
import cherrypy
import os
# the actual program logic is handled by the artist class
from MusicMashupArtist import MusicMashupArtist
# template engine
from mako.template import Template
from mako.lookup import... | kaozente/MusicMashup | MusicMashupServer.py | Python | mit | 2,945 |
#!/usr/bin/env python3
import time
import sys
import os
import math
import argparse
import matplotlib.pyplot as plt
# if PAPARAZZI_HOME not set, then assume the tree containing this
# file is a reasonable substitute
PPRZ_HOME = os.getenv("PAPARAZZI_HOME", os.path.normpath(os.path.join(os.path.dirname(os.pat... | HWal/paparazzi | sw/tools/opti_dist/dist.py | Python | gpl-2.0 | 3,072 |
import unittest
import unittest.mock as mock
from tower_of_hanoi import Disk, Game, Peg
class DiskTestCase(unittest.TestCase):
def test____eq____when_self_equals_other__returns_true(self):
self.assertEqual(Disk(1), Disk(1))
def test____eq____when_self_size_not_equals_other__returns_false(self):
... | ssoloff/tower-of-hanoi | imperative/test/test_tower_of_hanoi.py | Python | gpl-3.0 | 8,787 |
"""
https://en.wikipedia.org/wiki/Square_root_of_a_matrix
B is the sqrt of a matrix A if B*B = A
"""
import numpy as np
from scipy.linalg import sqrtm
from scipy.stats import special_ortho_group
def denman_beaver(A, n=50):
Y = A
Z = np.eye(len(A))
for i in range(n):
Yn = 0.5*(Y + np.linalg.inv(... | qeedquan/misc_utilities | math/matrix-sqrt.py | Python | mit | 1,781 |
import sys
def dictContains(D, key):
if sys.version_info[0] == 2:
return D.has_key(key)
elif sys.version_info[0] == 3:
return key in D
else:
raise Exception("No support for self.__dictContains for python major " +
"version: {}".format(sys.vers... | Quva/sparkplug | sparkplug/helpers/helpers.py | Python | apache-2.0 | 339 |
"""Support for OpenTherm Gateway sensors."""
import logging
from homeassistant.components.sensor import ENTITY_ID_FORMAT
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity, async_ge... | jnewland/home-assistant | homeassistant/components/opentherm_gw/sensor.py | Python | apache-2.0 | 9,134 |
# This file is part of browser, and contains the default variables.
#
# Copyright (C) 2009-2010 Josiah Gordon <josiahg@gmail.com>
#
# browser 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 o... | zepto/webbrowser | webbrowser/defaults.py | Python | gpl-3.0 | 1,073 |
import sys
from itertools import izip
from heinzel.core import connection
from heinzel.core import signals
from heinzel.core import relations
from heinzel.core.managers import Manager
from heinzel.core.fields import *
from heinzel.core.queries import BaseQuerySet
from heinzel.core.sql.dml import (SelectQuery... | kurvenschubser/pyheinzel | heinzel/core/models.py | Python | mit | 12,195 |
"""Fill empty added_at date
Revision ID: 71cacff30853
Revises: d26b4a2cc2ef
Create Date: 2016-04-04 16:43:45.040889
"""
# revision identifiers, used by Alembic.
revision = '71cacff30853'
down_revision = 'd26b4a2cc2ef'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from dat... | openmaraude/APITaxi | APITaxi_models2/migrations/versions/20160404_16:43:45_71cacff30853_fill_empty_added_at_date.py.py | Python | agpl-3.0 | 927 |
from .. import bar, manager, xcbq, window
import base
import xcb
from xcb.xproto import EventMask, SetMode
import atexit, struct
class Icon(window._Window):
_windowMask = EventMask.StructureNotify |\
EventMask.Exposure
def __init__(self, win, qtile, systray):
window._Window.__init__... | andrelaszlo/qtile | libqtile/widget/systray.py | Python | mit | 4,106 |
# coding=utf-8
# Copyright 2014 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)
import copy
import s... | areitz/pants | src/python/pants/option/options.py | Python | apache-2.0 | 16,359 |
# -*- coding: utf-8 -*-
'''
Manage RabbitMQ Virtual Hosts
=============================
Example:
.. code-block:: yaml
virtual_host:
rabbitmq_vhost.present:
- user: rabbit_user
- conf: .*
- write: .*
- read: .*
'''
# Import python libs
from __future__ import absolute_import
... | stephane-martin/salt-debian-packaging | salt-2016.3.3/salt/states/rabbitmq_vhost.py | Python | apache-2.0 | 3,164 |
# encoding: utf-8
from gerencianet import Gerencianet
from credentials import CREDENTIALS
gn = Gerencianet(CREDENTIALS)
params = {
'id': 1
}
body = {
'notification_url': 'http://yourdomain.com',
'custom_id': 'my_new_id'
}
response = gn.update_subscription_metadata(params=params, body=body)
print(respo... | gerencianet/gn-api-sdk-python | examples/update_subscription_metadata.py | Python | mit | 325 |
#!/usr/bin/env python
# Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICE... | PolicyStat/selenium-old | py_test.py | Python | apache-2.0 | 2,243 |
"""Python wrappers around Brain.
This file is MACHINE GENERATED! Do not edit.
"""
from google.protobuf import text_format
from tensorflow.core.framework import op_def_pb2
from tensorflow.python.framework import op_def_registry
from tensorflow.python.framework import ops
from tensorflow.python.ops import op_def_libra... | shishaochen/TensorFlow-0.8-Win | tensorflow/python/training/gen_training_ops.py | Python | apache-2.0 | 30,814 |
#-*- coding: utf-8 -*-
import argparse
import os
import numpy as np
import paddle.fluid as fluid
from train import get_player
from tqdm import tqdm
def predict_action(exe, state, predict_program, feed_names, fetch_targets,
action_dim):
if np.random.random() < 0.01:
act = np.random.ran... | lcy-seso/models | fluid/DeepQNetwork/play.py | Python | apache-2.0 | 2,279 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.