src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutNewStyleClasses(Koan):
class OldStyleClass:
"An old style class"
# Original class style have been phased out in Python 3.
class NewStyleClass(object):
"A new style class"
# Introduced in Python... |
#!/usr/bin/python3
import xrandr as x
import sys
import logging
import argparse
# because map function in python3 stops to shortest list
from itertools import zip_longest, starmap
monitors = []
monitors = x.list_connected_monitors( )
log = logging.getLogger()
if len(sys.argv) < 2:
log.error("Usage: {name} <output... |
# 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... |
####################
### Farkel Game ####
####################
import dice
import player
dice_list = [dice.Dice() for i in range(6)]
### Set up players ###
number_of_players = input("How many players? ")
player_list = []
for i in range(number_of_players):
player_list.append(player.Player(raw_input("What is player "... |
# 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... |
input = """
1 13 3 2 14 19 16
1 35 3 2 70 6 68
1 5 3 2 47 62 91
1 91 3 1 33 15 57
1 26 3 2 27 28 2
1 22 3 2 68 2 17
1 18 3 1 60 16 17
1 44 3 2 8 6 33
1 39 3 2 46 47 43
1 8 3 1 90 31 54
1 6 3 2 48 81 90
1 9 3 2 3 82 3
1 46 3 2 70 37 61
1 80 3 1 81 79 28
1 14 3 1 13 21 40
1 14 2 1 47 90
1 22 3 1 37 91 68
1 14 3 1 46 30 8... |
# -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
class HiHostelsSpider(scrapy.Spider):
name = "hihostels"
allowed_domains = ['hihostels.com']
start_urls = (
'https://www.hihostels.com/sitemap.xml',
)
def parse(self, response):
response.... |
#!/usr/bin/env python3
'''
setuptools based setup module;
see <https://packaging.python.org/en/latest/distributing.html>;
'''
from os import path
from setuptools import find_packages
from setuptools import setup
here = path.abspath(path.dirname(__file__))
## get long description from readme file;
with open(path.j... |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/bitcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' for... |
#!/usr/bin/python2
import matplotlib, sys
if 'show' not in sys.argv:
matplotlib.use('Agg')
from pylab import *
from numpy import random
random.seed(0)
ks = arange(0.0, 1.0, .005)
ks[ks>0.5] -= 1
kx, ky = meshgrid(ks, ks)
gaus = random.normal(size = kx.shape)/(kx**2 + ky**2)**.7
for i in range(gaus.shape[0]):
... |
from collections import OrderedDict
import numpy as np
import sfsimodels.exceptions
#
# def convert_stress_to_mass(q, width, length, gravity):
# """
# Converts a foundation stress to an equivalent mass.
#
# :param q: applied stress [Pa]
# :param width: foundation width [m]
# :param length: foundatio... |
from unittest import TestCase
import simpl.music_directories
class TestSimplDirectories(TestCase):
dir_list = [{'playlists': [],
'directory': '01-Test',
'files': ['Doobie Brothers - Without Love (Where would you be now).mp3',
'Frank Sinatra - New York ... |
from app.config import config
from app.pythomas import shapes as shapelib
from app.pythomas import pythomas as lib
class Path:
def __init__(self, path_nodes):
path_nodes = None if path_nodes == [None] else path_nodes
self.nodes = [] if not path_nodes else path_nodes
self.complete = False
... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 30 18:28:24 2013
@author: jpeacock-pr
"""
#==============================================================================
import matplotlib.pyplot as plt
import numpy as np
import os
from matplotlib.ticker import MultipleLocator
import mtpy.imaging.mtplottools as mtpl
i... |
import hycohanz as hfss
raw_input('Press "Enter" to connect to HFSS.>')
[oAnsoftApp, oDesktop] = hfss.setup_interface()
raw_input('Press "Enter" to create a new project.>')
oProject = hfss.new_project(oDesktop)
raw_input('Press "Enter" to insert a new DrivenModal design named HFSSDesign1.>')
oDesign =... |
__author__ = 'Neil Butcher'
from Rota_System.Reporting.HTMLObjects import HTMLObjects
from Abstract import event_title, person_code
from Rota_System.StandardTimes import date_string, time_string
class EventsReporter(object):
def write_reports_about(self, a_list, a_folder):
self._reporter = EventReporte... |
# coding: utf-8
from __future__ import division, unicode_literals
"""
This module provides classes that operate on points or vectors in 3D space.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.... |
# coding: utf-8
import re
class IsNotTextTypeException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Text(object):
pass
class Break(Text):
def __init__(self):
self.xml = """<w:br/>"""
def _get_xml(self):
... |
# ***************************************************************************
# *
# * Copyright (C) 2013-2016 University of Dundee
# * All rights reserved.
# *
# * This file is part of SAMoS (Soft Active Matter on Surfaces) program.
# *
# * SAMoS is free software; you can redistribute it and/or modify
# * it unde... |
# _*_ coding:utf-8 _*_
from database.db4 import db4, Channel4, ConstDB4
from utils.log import Logger, Action
class Location:
channel_name = Channel4.gis_gateway_location + '*'
def __init__(self):
self.ps = db4.pubsub()
def psubscribe_gis(self):
self.ps.psubscribe(self.channel_name)
... |
#!/usr/bin/python
"""This script run the orf prediction """
try:
import sys, re, csv, traceback
from os import path, _exit
import logging.handlers
from optparse import OptionParser, OptionGroup
from libs.python_modules.utils.sysutil import pathDelim
from libs.python_modules.utils.metapathways_util... |
#--coding:utf8--
from flask.ext.bootstrap import Bootstrap
from flask import Flask, render_template, redirect
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField, TextAreaField
from util.DataBaseManager import DataBaseManager
app = Flask(__name__)
bootstrap = Bootstrap(app)
app. config['SECRET... |
#! /usr/bin/env python
#-*- coding: utf-8 -*-
from rauth import OAuth1Service, OAuth1Session
import requests
################################################################################
oauth_client_key = "zGtBQ4zQfaWqy0G3HtRua2d00gvIcSfS4iHHwH2s"
oauth_client_secret = "2KOQG8eUVvcHcTGV5I12XsseRuaeBW0vcmRTTuli"
... |
from django.apps import apps as django_apps
from django.core.exceptions import MultipleObjectsReturned
from django.db import models
app_config = django_apps.get_app_config('edc_call_manager')
class CallLogLocatorMixin(models.Model):
"""A Locator model mixin that has the Locator model update the Log if changed."... |
# encoding: utf-8
# module _elementtree
# from /usr/lib/python2.7/lib-dynload/_elementtree.so
# by generator 1.130
# no doc
# imports
import xml.etree.ElementPath as ElementPath # /usr/lib/python2.7/xml/etree/ElementPath.pyc
import xml.etree.ElementTree as __xml_etree_ElementTree
# Variables with simple values
VERS... |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; eithe... |
#!/usr/bin/python
from simple_salesforce import Salesforce
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from pyspark import Row
from pyspark.sql.types import *
#from pyspark.sql.functions import *
from optparse import OptionParser
from pyspark.sql import Data... |
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal, stats
import sys
sys.path.append('..')
from anc_field_py.ancfield import *
from anc_field_py.ancutil import *
def add_microphones(ancObject):
# error_mic
ancObject.AddMic([4,1... |
from ipv8.keyvault.crypto import default_eccrypto
from pony.orm import db_session
from tribler_core.modules.metadata_store.orm_bindings.channel_node import COMMITTED, TODELETE, UPDATED
from tribler_core.modules.metadata_store.restapi.metadata_endpoint import TORRENT_CHECK_TIMEOUT
from tribler_core.modules.torrent_che... |
"""
WSGI config for scheduler_site 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_A... |
# Copyright (c) 2014 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
#!/usr/bin/env python3
"""
This script checks up the general state of the system (updates required, CPU
usage, etc.) and returns a string that can be used in an MOTD file.
You can use this script as part of a cron job to update the MOTD file in order
to display relevant system information to sysadmins upon login.
""... |
# This file is part of GridCal.
#
# GridCal 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.
#
# GridCal is distributed in the hope that... |
"""
Events module URLs
"""
from django.conf.urls import patterns, url
from anaf.events import views
urlpatterns = patterns('anaf.events.views',
url(r'^(\.(?P<response_format>\w+))?$', views.month_view, name='events'),
url(r'^index(\.(?P<response_format>\w+))?$', views.in... |
"""Full integration test - do not run in CI."""
from copy import deepcopy
from unittest import mock
import pytest
from django.contrib.auth import get_user_model
from django.test import Client
from django.urls import reverse
from onfido.helpers import create_applicant, create_check
from onfido.models import Event, Rep... |
from Tkinter import *
from tkSimpleDialog import Dialog
import json
import csv
import tkFileDialog
class ErrorWindow(Dialog):
"""
Provided a list of error messages, shows them in a simple pop-up window.
"""
def __init__(self, master, errors):
self.errors = errors
self.cancelPressed = Tr... |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2008, 2009, 2010 Edgar Luna
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at... |
# -*- coding: utf-8 -*-
from __main__ import *
from utils import *
commands = [
'^torrent',
'^t ',
'^kickass'
]
parameters = {('query', True)}
description = 'Search Kickass Torrents. Results may be NSFW.'
action = 'typing'
def get_category_icon(category):
if category == 'Anime':
... |
#!/usr/bin/env python
"""Determine single-source or multiple-source reachability in a digraph"""
#pylint: disable=invalid-name
import sys
from os.path import join
from AlgsSedgewickWayne.Digraph import Digraph
from AlgsSedgewickWayne.DirectedDFS import DirectedDFS
from AlgsSedgewickWayne.testcode.InputArgs import cli_... |
"""
Link to (question)[https://www.codechef.com/SEPT20B/problems/ADAMAT]
The key insight is that when a row or column is out of order, we want to sort
it using the smallest number of operations. To do this, we could iterate from
the largest submatrix to the smallest one and rotate whenever a given
submatrix is out of o... |
import pickle
from extraction.FormatModel.VariableDefinitions import *
from extraction.FormatModel.RawVariableDefinitions import *
import json
def jsonDefault(object):
return object.__dict__
if __name__ == '__main__':
Page3 = Category('page3', 'pagina 3')
############
for r in range(1,6):
s... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
import unittest
from mantid.kernel import V3D... |
import re
import os
APP_PATH = os.path.join(*os.path.split(os.path.dirname(os.path.realpath(__file__)))[:-1])
import sys
if APP_PATH not in sys.path:
sys.path.append(APP_PATH)
import MyTrack
import PowerShell
import Phonebook
import Overlord
import Log
LOGGER = Log.MyLog(name=__name__)
# # # #
"""
Special setup ... |
#!/usr/bin/env python
import sys
import numpy as np
import argparse
import matplotlib.pyplot as plt
from plotTools import addToPlot
from spectraTools import spectraAnalysis
from netcdfTools import read3dDataFromNetCDF
from analysisTools import sensibleIds, groundOffset
from utilities import filesFromList
'''
Descripti... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import math
import time
import random
random.seed(67)
import numpy as np
np.random.seed(67)
import pandas as pd
from sklearn.utils import shuffle
from sklearn.ensemble import RandomForestClassifier, VotingCl... |
from django.core.urlresolvers import reverse
from django.test import TestCase
from .models import Page
class PageTests(TestCase):
def test_404(self):
response = self.client.get('/')
self.assertEqual(response.status_code, 404)
def test_home(self):
Page.objects.create(
url=... |
# coding=utf-8
import os
import unittest
import mock
from conans.client.tools import env
class ToolsEnvTest(unittest.TestCase):
def test_environment_append_variables(self):
with mock.patch.dict('os.environ', {}),\
env.environment_append({'env_var1': 'value',
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
import falcon
import pytest
from falcon import testing
from falcon.cmd.print_routes import print_routes
from falcon_resource_factory import ResourceFactory
def detail_view(resource, req, res, **kwargs):
res.body = '{... |
import os
from pymongo import MongoClient
from TicTacToeBoard import TicTacToeBoard
from ProgressCounter import ProgressCounter
client = MongoClient(os.environ["MONGOLABURL"])
collection = client['test1']['one']
_ = TicTacToeBoard._
blankBoard = TicTacToeBoard([
_, _, _,
_, _, _,
_, _, _
])
collection.r... |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Lithomop3d by Charles A. Williams
# Copyright (c) 2003-2005 Rensselaer Polytechnic Institute
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated... |
# -*- coding: utf-8 -*-
# pylint: disable-msg=E1101,W0612
from copy import copy, deepcopy
from warnings import catch_warnings, simplefilter
import pytest
import numpy as np
import pandas as pd
from pandas.core.dtypes.common import is_scalar
from pandas import (Series, DataFrame, Panel,
date_range... |
#!/usr/bin/env python
# encoding: UTF-8
import asyncio
from collections import namedtuple
try:
from functools import singledispatch
except ImportError:
from singledispatch import singledispatch
import logging
import sqlite3
import warnings
from cloudhands.common.connectors import initialise
from cloudhands.c... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future.utils import bytes_to_native_str
from hypothesis import given
import hypothesis.strategies as st
import unittest
from caffe2.proto import caffe2_pb2
from caf... |
"""
pyexcel.plugin.renderers.sqlalchemy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Export data into database datables
:copyright: (c) 2015-2017 by Onni Software Ltd.
:license: New BSD License
"""
from pyexcel_io import save_data
import pyexcel_io.database.common as sql
from pyexcel._compact import Ord... |
'''
Created on Dec 17, 2014
@author: Dominik Lang
'''
import csv
import os.path
from random import shuffle
import collections
import numpy
from sklearn.preprocessing import Imputer
class DataHandler(object):
def __init__(self):
pass
'''
@summary: A method to handle reading the data in from... |
# This file is part of aoc2016.
#
# aoc2016 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.
#
# aoc2016 is distributed in the hope that... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Base Phone module for Odoo/OpenERP
# Copyright (C) 2010-2014 Alexis de Lattre <alexis@via.ecp.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... |
# -*- coding:utf-8 -*-
"""
Django settings for day11_Django project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os... |
from .BTcrypto import Crypto
from .Encrypter import protocol_name
class SingleRawServer(object):
def __init__(self, info_hash, multihandler, doneflag, protocol):
self.info_hash = info_hash
self.doneflag = doneflag
self.protocol = protocol
self.multihandler = multihandler
s... |
from django import template
from datetime import datetime
from simon_app.functions import GMTUY
import operator
"""
Module that holds the Simon
"""
register = template.Library()
@register.filter(name="substract")
def substract(value, arg):
"""
Substract
"""
return value - arg
@register.fil... |
# Copyright (c) 2014 Parker Harris Emerson
# Subject to the MIT License; please see file LICENSE.
# Replaces all instances of a user's name with [REDACTED], or vis a versa.
import sys, fileinput, getopt
def main(argv):
NAME = "Parker Harris Emerson"
REDACT = "[REDACTED]"
redact_file = ""
redact_option = Tru... |
# -*- 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... |
from gi.repository import Gtk
import random
from verb import Verb
from noun import Noun
class TestUI(Gtk.Box):
def set_q(self, s):
self.q.set_markup('<span size="50000"><b>%s</b></span>'%s)
def __press(self, b):
if b.is_correct:
self.new_word()
else:
# TODO: something
pass
def get_answers(self, w... |
# -*- coding: utf-8 -*-
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
/envroot/
/db # This is where it'll write the database file
/edx-platform # The location of this repo
/log # Where we're going to write log files
"""
# We ... |
#!/usr/bin/python
#-*- coding: UTF-8 -*-
# File: blocks.py
# Solely for identifying Unicode blocks for unicode characters.
# Based on code from:
# http://stackoverflow.com/questions/243831/unicode-block-of-a-character-in-python
# But updated for 2013.
# Copyright (C) 2013-2020 Peter Murphy <peterkmurphy@gmail.com>
#
# ... |
# encoding: utf-8
"""
Test suite for the pptx.opc.packuri module
"""
import pytest
from pptx.opc.packuri import PackURI
class DescribePackURI(object):
def cases(self, expected_values):
"""
Return list of tuples zipped from uri_str cases and
*expected_values*. Raise if lengths don't matc... |
# -*- coding: utf-8 -*-
"""Conversion functions for BEL graphs with node-link JSON."""
import gzip
import json
from io import BytesIO
from itertools import chain, count
from operator import methodcaller
from typing import Any, Mapping, TextIO, Union
from networkx.utils import open_file
from .utils import ensure_ver... |
# 国债指数:id=0000121;http://pdfm2.eastmoney.com/EM_UBG_PDTI_Fast/api/js?id=0000121&TYPE=k&js=(x)&rtntype=5&isCR=false&fsData1518154947301=fsData1518154947301
# 沪市企业: id=0000131;http://pdfm2.eastmoney.com/EM_UBG_PDTI_Fast/api/js?id=0000131&TYPE=k&js=(x)&rtntype=5&isCR=false&fsData1518156740923=fsData1518156740923
# 深圳企业:... |
__author__ = 'Magnus Forzelius & Jesper Lehtonen'
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from utils.validators import liu_id_validator
from tags.models import Tag
import os
import datetime
class... |
"""
platformer.py
Author: Jasper Meyer
Credit: You, the internet, Brendan
Assignment:
Write and submit a program that implements the sandbox platformer game:
https://github.com/HHS-IntroProgramming/Platformer
"""
from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame
SCREEN_WIDTH = 1080
S... |
# (C) British Crown Copyright 2010 - 2016, Met Office
#
# This file is part of Iris.
#
# Iris 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 l... |
import getpass
from lib_file_ops import *
from lib_keyslot import is_header_psk
from lib_gui import *
def input_int_until_list_or_default(list_desired, default_val):
is_done = False
while is_done == False:
try:
tv = int(input())
if tv in list_desired:
is_done = True
else:
print('Incorrect Value')
... |
#!/usr/bin/env python
import re
import sys
def getData(data):
name = re.search(r'\w\s\w\s[\w]+|\w\s{3}\w+', data)
employee = name.group()
# Headers are as follows below:
# Event, Date, Time, Train, OD Date, OD Time
tuples = re.findall(r'(\w+|\w+\s\w+|\w+\s\w+\s\w+|[\w-]+)\s+(\d+)\s(\d+)\s(\w+)\s(\d+)\s(\d+... |
import numpy as np
a = np.genfromtxt('data/src/sample_nan.csv', delimiter=',')
print(a)
# [[11. 12. nan 14.]
# [21. nan nan 24.]
# [31. 32. 33. 34.]]
a_nan = np.array([0, 1, np.nan, float('nan')])
print(a_nan)
# [ 0. 1. nan nan]
print(np.nan == np.nan)
# False
print(np.isnan(np.nan))
# True
print(a_nan == np.na... |
# -------------------------------------------------------
# Sample Plotter
# -------------------------------------------------------
import Tkinter
import random
from pyrobot.robot.device import Device
import pyrobot.system.share as share
class SimplePlot(Device):
COLORS = ['blue', 'red', 'tan', 'yellow', 'orang... |
# coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.... |
#
# 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... |
# -*- coding: utf-8 -*-
__author__ = 'Alex Bo'
__email__ = 'bosha@the-bosha.ru'
from torhandlers.base import HTTPError
from torhandlers.templating.base import BaseTemplater
from torhandlers.templating.exceptions import TemplatingException
class Jinja2Templater(BaseTemplater):
def render(self, **kwargs):
... |
import RPi.GPIO as GPIO
import time
from socket import *
import thread
from threading import Thread
import os
import datetime
import pygame
import paramiko
MAINDOORIP = '192.168.1.17' #Enter the IP address of the main door
DOORBELLPORT = 12346 #Port to send the doorbell command through
PORT = 12345 #Send in out info o... |
import os
import sys
from collections import OrderedDict
from datetime import datetime, timedelta
import calendar
from argparse import ArgumentParser
import configparser
import traceback
import time
import csv
import io
import copy
import hashlib
import logging
import logging.handlers
import pytz
from rakuten_ws impo... |
'''This module generates the views for the veterinary app.
There is one generic home view for the entire app as well as detail, create update and delete views for these models:
* :class:`~mousedb.veterinary.models.MedicalIssue`
* :class:`~mousedb.veterinary.models.MedicalCondition`
* :class:`~mousedb.veterinary.model... |
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from datetime import timedelta
from gluon import current
from gluon.storage import Storage
T = current.T
settings = current.deployment_sett... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
#!/usr/bin/python3
import xml.etree.cElementTree as ET
import sys
import argparse
parser = argparse.ArgumentParser(description='Strip namespace and a list of xml-tags in a tsv format')
parser.add_argument('--path', dest='path', type=str, default='',
help='output directory file')
parser.add_argume... |
import os
import motor.motor_asyncio
from aiohttp import web
from app.clients.github_client import GithubClient
from app.clients.jenkinses_clients import JenkinsesClients
from app.clients.mongo_client import MongoClient
from app.config.triggear_config import TriggearConfig
from app.controllers.github_controller impor... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'SourceDataPoint.error_msg'
db.alter_column(u'source_da... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#Copyright (c) 1986 Nick Wong.
#Copyright (c) 2016-2026 TP-NEW Corp.
# License: TP-NEW (www.tp-new.com)
__author__ = "Nick Wong"
"""
如果要部署到服务器时,通常需要修改数据库的host等信息,直接修改config_default.py不是一个好办法,
更好的方法是编写一个config_override.py,用来覆盖某些默认设置
"""
#由于密码等信息保存于本地,所以先读取自定义的配置文档文档获取需要的... |
"""Core Quantmod functions
Contains some wrappers over 'chart.py' for those used to R's Quantmod style,
along with other tools for financial data acquisition.
"""
from __future__ import absolute_import
import six
import datetime as dt
import pandas_datareader.data as web
from .chart import Chart
def get_symbol(ti... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def CustomFieldDefRenamedEvent(vim, *args, **kwargs):
'''This event records the renaming ... |
import pygame
import pygame.gfxdraw
import os
import sys
from engine.Point import Point
from engine.Scene import Scene
from engine.managers.Texture import Texture
from engine.managers.Font import Font
from engine.managers.TextureSpec import TextureSpec
# tamanho fake da tela. Todos os objetos pensam que a tela tem ess... |
import hashlib
import urllib
import urllib2
from django.conf import settings
from django.db import models
import django.dispatch
from multiselectfield import MultiSelectField
from skrill.settings import *
try:
user_model = settings.AUTH_USER_MODEL
except AttributeError:
from django.contrib.auth.models impor... |
#!/usr/bin/python
import urwid
import mainview
"""
NOTES
-----
This module builds the widget to allow the user to create a table in a database.
"""
class CreateTableInfo:
def __init__(self):
self.count = None
self.table_name = ""
self.table_fields = None
self.query_string = ""
self.atr_name = ... |
import os
import json
from django.test import TestCase
from edge.models import Genome, Operation, Fragment, Genome_Fragment
from edge.blastdb import build_all_genome_dbs, fragment_fasta_fn
from edge.crispr import find_crispr_target, crispr_dsb
from Bio.Seq import Seq
class GenomeCrisprDSBTest(TestCase):
def build... |
import numpy as np
from decimal import Decimal
import os
from scipy.misc import comb
from numpy import linalg as LA
import itertools
# bitCount() counts the number of bits set (not an optimal function)
def bitCount(int_type):
""" Count bits set in integer """
count = 0
while(int_type):
int_type &... |
#!/usr/bin/python
# coding: utf-8
# ## Code demonstration for using *beamline* python package to do online modeling
#
# Tong Zhang, March, 2016 (draft)
#
# For example, define lattice configuration for a 4-dipole chicane with quads:
#
# ... |
# Copyright 2019 Google LLC. 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... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from cms.models import Page
from django.core import management
from cms.test_utils.testcases import CMSTestCase
from cms.test_utils.util.context_managers import SettingsOverride
from cms.api import create_page, add_plugin
from cms.management.command... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Weather Bot to reply to Telegram messages
"""
Author: Phuc Tran Truong, Marcus Ding
Date: 19.07.2016
Large parts of the code are taken from the Conversationbot example (see 'python-telegram-bot' module).
https://github.com/python-telegram-bot/python-telegram-bot/blob/m... |
import numpy as np
import cv2
cap = cv2.VideoCapture('../data/vtest.avi')
# cap = cv2.VideoCapture('output.avi')
# cap = cv2.VideoCapture('Minions_banana.mp4')
# 帧率
fps = cap.get(cv2.CAP_PROP_FPS) # 25.0
print("Frames per second using video.get(cv2.CAP_PROP_FPS) : {0}".format(fps))
# 总共有多少帧
num_frames = cap.get(cv2... |
# Copyright 2015 FUJITSU LIMITED
#
# 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 writ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.