src stringlengths 721 1.04M |
|---|
import pytest
try:
from unittest import mock # Python 3
except ImportError:
import mock
@pytest.fixture
def app(tmpdir):
from flask import Flask
root_path = tmpdir.ensure("test-proj", dir=True)
tmpdir.ensure("test-proj/static/coffee", dir=True)
p = tmpdir.join("test-proj/static/coffee", "C... |
"""
Copyright (c) 2004, CherryPy Team (team@cherrypy.org)
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 o... |
from dialogs.dialog_configuration import DialogConfiguration
from configuration import configuration
from currency.currency import Currency
import rest
import wx
import swagger_client
from octopart.queries import PartsQuery as OctpartPartsQuery
from snapeda.connection import SnapedaConnection, SnapedaConnectionExceptio... |
from datetime import date, datetime, timedelta
import mock
import os
import unittest
import destalinator
import slacker
import slackbot
sample_slack_messages = [
{
"type": "message",
"channel": "C2147483705",
"user": "U2147483697",
"text": "Human human human.",
"ts": "1355... |
####################################################################################################
# pimms/test/lazy_complex.py
#
# This source-code file is part of the pimms library.
#
# The pimms library is free software: you can redistribute it and/or modify it under the terms of
# the GNU General Public License a... |
import urllib
import urllib2
import cookielib
import re
#bugurl = r"https://bugzilla.kernel.org/show_bug.cgi?id=%d"
#fixedurl = r'https://bugzilla.kernel.org/show_activity.cgi?id=%d'
bugurl = r'https://bz.apache.org/bugzilla/show_bug.cgi?id=%d'
fixedurl = r'https://bz.apache.org/bugzilla/show_activity.cgi?id=%d'
titl... |
"""
This is the file to be used for the link type object for crawler.py
As well as Link String methods used to help the Link object
Author: Jameson Gillis
"""
from tld import get_tld
import re
# this can stay outside of the Link class
def remove_anchor(link_string):
"""
This removes the anchor point from a UR... |
"""
=====================
flask_flatpages.utils
=====================
Utility functions to render Markdown text to HTML.
"""
import markdown
from . import compat
from .imports import PygmentsHtmlFormatter
def force_unicode(value, encoding='utf-8', errors='strict'):
"""Convert bytes or any other Python instanc... |
from PyQt4 import QtGui, QtCore
import gui.submit.fileinfo.common
import gui.submit.fileinfo.maya1
import gui.submit.fileinfo.maya2
import gui.submit.fileinfo.maya_mentalray
import gui.submit.fileinfo.nuke
class FileInfoPanel(QtGui.QTabWidget):
def __init__(self, job_list, dispatcher_list, config_info, parent=No... |
from util import textinput
from util.infolog import log
import chainer
from chainer import Variable
import chainer.functions as F
import chainer.links as L
import numpy as np
from .modules import get_encoder_cbhg, get_decoder_cbhg, PreNet, Attention
from hparams import hparams as hp
def sequence_embed(embed, xs):
... |
# coding=utf-8
# Copyright 2020 The Real-World RL Suite Authors.
#
# 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... |
import ReviewHelper
import pandas as pd
df = ReviewHelper.get_pandas_data_frame_created_from_bibtex_file()
#df_journal = df.groupby('journal')["ID"]
dfJournalList = df.groupby(['journal'])['ID'].count().order(ascending=False)
isOdd = (dfJournalList.size % 2 == 1)
if (isOdd):
table_row_length = dfJournalList.si... |
import logging
from datetime import datetime
from itertools import izip_longest
from celery import chain, chord, group, task
from pytz import utc
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.db import IntegrityError, transaction
from inboxen.mo... |
from os import unlink
from os.path import exists
from unittest import TestCase
from icsv import icsv, Row
class WriteReadTests(TestCase):
def setUp(self):
pass
def test_filter(self):
filename = "/tmp/testCsv.csv"
headers = ["one", "two", "three"]
csv = icsv(headers)
... |
# -*- coding: utf-8 -*-
#
# 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
#... |
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
####################################... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.utils.crypto import constant_time_compare
from django.utils.http import base36_to_int
REGISTRATION_TIMEOUT_DAYS = getattr(settings, 'REGISTRATION_TIMEOUT_DAYS', 15)
class Registra... |
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-12-20 15:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('test_models', '0010_myunsupervisedlearningtechnique'),
]
operations = [
mig... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Modification 20171022: Requirment F3-3 finished.
# Modification 20171025: Requirment F3 finished.
import datetime
from django.db.models import Max
import json
import pandas
import dateutil.parser
from django import forms
from decimal import Decimal
from ... |
# -*- coding:utf-8 -*-
# Author: Kei Choi(hanul93@gmail.com)
import os
import re
import zipfile
import kernel
# -------------------------------------------------------------------------
# zip 파일의 특별한 파일명을 압축 해제하여 데이터를 리턴한다.
# -------------------------------------------------------------------------
def get_zip_data... |
"""Discussion of bloom constants for bup:
There are four basic things to consider when building a bloom filter:
The size, in bits, of the filter
The capacity, in entries, of the filter
The probability of a false positive that is tolerable
The number of bits readily available to use for addressing filter bits
There is... |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.building.DistributedPaintShopInterior
from direct.distributed.DistributedObject import DistributedObject
from direct.actor.Actor import Actor
from RandomBuilding import RandomBuilding
class DistributedPaintShopInterior(DistributedObject, RandomBu... |
"""Objects for interacting with bulk nlp reading tools."""
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import sys
import shutil
import re
import tempfile
import glob
import json
import logging
import subprocess
import zlib
from os import path, mkdir, environ,... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-11-28 09:22
from __future__ import unicode_literals
from django.db import migrations, models
import select_multiple_field.models
class Migration(migrations.Migration):
dependencies = [
('survey', '0073_auto_20161123_1720'),
]
operations ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""""
Usage: toEspresso.py <data> <desc> <out>
Options:
-h --help show this message
"""
import os
import numpy as np
import struct
import json
INPUT = 0
DENSE = 1
BNORM = 2
CONV = 3
POOL = 4
NUM = 1<<4
DATA = 2<<4
def read_param(params, n):
return params['arr_... |
"""
Contains test helpers for managing ORM test models and such.
"""
import os
from collections import OrderedDict
from django.db import models
from django.core import management
from django.db import connections, OperationalError
from django.conf import settings
class AppModelsEnvironment(object):
"""
Cla... |
"""
This module uses the django snippets 'Model inheritance with content type and
inheritance aware manager' (http://djangosnippets.org/snippets/1034/).
Using this module, instances of a model class and its subclasses can be accessed by the objects manager of the super class.
Usage:
from django.db import models
from... |
from __future__ import unicode_literals
from django.conf import settings
from django.test import override_settings
from channels import DEFAULT_CHANNEL_LAYER, channel_layers
from channels.message import Message
from channels.sessions import (
channel_and_http_session, channel_session, enforce_ordering, http_sessi... |
# 1. function create_object_links() gets a bucket path and returns a list of the link of each .img file
# 2. s3://azavea-datahub/emr/bootstrap.sh: install python2.7: sudo yum install -y python27;
# install gdal;
# install gdal_retile... |
#!/usr/bin/env python3
import os
import importlib
import logging
from defs import run_with_locker
basepath = os.path.realpath(__file__)[:-3]
lockfile = basepath + '.lock'
logfile = basepath + '.log'
open(logfile, 'w').close()
logFormatter = logging.Formatter(
'%(asctime)s %(module)s %(levelname)s %(message)s',... |
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import Mutators
def getUniquesTest():
print "Testing getUniques Function..."
knownUniques = [0,99,8000]
l1 = [1,2,3,4,5,6,7,8,9... |
"""
Central caching module.
"""
from sys import getsizeof
from collections import defaultdict
from django.conf import settings
_ENABLE_LOCAL_CACHES = settings.GAME_CACHE_TYPE
_GA = object.__getattribute__
_SA = object.__setattr__
_DA = object.__delattr__
# OOB hooks (OOB not yet functional, don't use yet)
_OOB_FIE... |
#!/usr/bin/env python
import sys, os, re, glob
try:
import io
except ImportError:
import cStringIO as io
def usage():
sys.stdout.write( """usage: mdoc.py set group file [files...]
Add the tag "\\ingroup group" to all the doxygen comment with a \\class
tag in it.
usage: mdoc.py check group ... |
import time
from textwrap import dedent
from typing import Callable, TextIO
from clisnips.database.snippets_db import SnippetsDatabase
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree
def import_xml(db: SnippetsDatabase, file: TextIO, log: Callable... |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... |
import os
def _jsonrpc(value="error", *a, **ka):
base = {"jsonrpc": "2.0", value: None, "id": "id"}
if a or ka:
base[value] = {}.update(*a, **ka)
return base
def save(forms, files, dest):
if "name" in forms:
filename = forms["name"]
elif len(files) > 0:
filename = files.f... |
# Copyright 2014 Rackspace
# 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 app... |
from __future__ import absolute_import
import contextlib
import os
import subprocess
import sys
import tempfile
from Qt import QtWidgets, QtCore
Qt = QtCore.Qt
from . import tickets
class Dialog(QtWidgets.QDialog):
def __init__(self, exceptions=None, allow_no_exception=True):
super(Dialog, self).__... |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
#!/usr/bin/env python
from flask import Flask, request, make_response
import requests
import jsonpickle
import sys
# example: http://localhost:4567
bank_address = "http://172.17.0.2:4567"
app = Flask(__name__)
@app.route('/broker/<gameid>', methods=['GET', 'PUT'])
def broker_management(gameid):
"""
GET: ge... |
import datetime
import json
from collections import OrderedDict
import numpy as np
from rest_framework.views import APIView
from rest_framework.response import Response
from daphne_brain.nlp_object import nlp
from dialogue.nn_models import nn_models
import dialogue.command_processing as command_processing
from auth_A... |
import logging
import numpy as np
import networkx as nx
from pele.landscape import TSGraph, LocalConnect
from pele.landscape._distance_graph import _DistanceGraph
__all__ = ["DoubleEndedConnect"]
logger = logging.getLogger("pele.connect")
class DoubleEndedConnect(object):
"""
Find a connected network of ... |
r"""
Multiconf allows the reading of platform and or host specific values from Sublime settings.
Multiconf is a module that allows you to read platform and/or host
specific configuration values to be used by Sublime Text 2 plugins.
Using this module's `get` function, allows the user to replace any settings
value in a... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 University of Southern California
#
# 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/... |
from abc import ABC, abstractmethod
from collections import namedtuple
Customer = namedtuple('Customer', 'name fidelity')
class LineItem:
def __init__(self, product, quantity, price):
self.product = product
self.quantity = quantity
self.price = price
def total(self):
return s... |
#!/usr/bin/env python3
import os
import sys
import logging
import pytest
from unittest.mock import mock_open, patch
#################################################################################
# Enable logging
log = logging.getLogger('test.github')
############################################################... |
# =============================================================================
# Federal University of Rio Grande do Sul (UFRGS)
# Connectionist Artificial Intelligence Laboratory (LIAC)
# Renato de Pontes Pereira - rppereira@inf.ufrgs.br
# =============================================================================
... |
# Copyright (C) 2007-2008 Dan Pascu <dan@ag-projects.com>
#
"""Schedule calls on the twisted reactor"""
__all__ = ['RecurrentCall', 'KeepRunning']
from time import time
class KeepRunning:
"""Return this class from a recurrent function to indicate that it should keep running"""
pass
class RecurrentCall(o... |
# -*- coding: utf-8 -*-
#
# Flow Framework documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 08 11:09:23 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file... |
from functools import wraps
from flask import render_template, request, url_for
from app.models import PatchState
def filterable(f):
"""Filter a query"""
@wraps(f)
def wrapped(*args, **kwargs):
d = f(*args, **kwargs)
q = d['query']
state = request.args.get('state', None, type=str)... |
'''
Description
This class wraps defs to validate a chromosome
loci table file used by LDNe2 to filter out loci
pairs that share a chromosome.
'''
__filename__ = "pgchromlocifilemanager.py"
__date__ = "20180502"
__author__ = "Ted Cosart<ted.cosart@umontana.edu>"
'''
This string designates that
there is no chrom loci f... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para VePelis
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
from core imp... |
# -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes and CONTRIBUTORS
Email: danaukes<at>asu.edu.
Please see LICENSE for full license.
"""
#from pynamics.tree_node import TreeNode
from dev_tools.acyclicdirectedgraph import Node,AcyclicDirectedGraph
import random
#import numpy
#import yaml
def level(connections):
... |
from django.http import HttpResponse
from .models import Company, CompanyType
from .serializers_company import CompanySerializer
from .helper import auth_decorator
from rest_framework import status
from rest_framework.response import Response
from rest_framework.decorators import api_view
from django.db.models import ... |
import re
from django.db.models import Q
from django.forms import widgets
import django_filters
from extrequests.models import SelfOrganisedSubmission, WorkshopInquiryRequest
from workshops.fields import Select2Widget
from workshops.filters import (
AllCountriesFilter,
AMYFilterSet,
ContinentFilter,
F... |
from django.conf.urls import *
from kishore.views import (ArtistDetail, ArtistList, SongDetail, SongList, ReleaseDetail,
ReleaseList, ArtistSongList, ArtistsByTag, SongsByTag, ReleasesByTag,
DownloadSong)
urlpatterns = patterns(
'',
url(r'^artists/$', Artis... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2011 Matt Keenan (matt.keenan@gmail.com)
# Copyright (C) 2013-2014 Paul Fr... |
from math import sqrt
def checkIfDone(num):
if num == 1:
return True
return False
def IsPrime(num):
for i in range(2, int(sqrt(num))):
if num % i == 0:
return False
return True
def findLargestPrimeFactor(num):
done = False
largestFactor = 1
... |
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
if __name__ == '__main__':
url = 'http://www.bot.com.tw/house/default.aspx'
try:
d... |
import unittest
from dataunit.context import Context, get_global_context
class DataUnitTestCase(unittest.TestCase):
"""A class defining a single DataUnit tests case.
This class is designed to be instantiated with a
list of TestCommand instances which define the
behavior of this tests case.
:not... |
#!/usr/bin/env python3
# Need requests and configparser.
import requests
import configparser
import time
import glob
import sys
import json
def main():
# List of pushes:
push_list = []
# Import configuration with API token.
c = configparser.ConfigParser()
# Read config file and set token var.
... |
# 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... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 Michele Filannino
#
# gnTEAM, School of Computer Science, University of Manchester.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU General Public License.
#
# author: Michele Filannino
#... |
__author__ = 'vmintam'
from cuisine import user_ensure, dir_exists, dir_ensure, mode_sudo, dir_remove
from cuisine import user_remove, user_check, file_write, package_ensure_yum
from cuisine import package_clean_yum, package_update_yum, file_append
from fabric.api import env, hide, sudo, run
from fabric.colors import r... |
#!/usr/bin/env python
#encoding: utf8
import sys, rospy, math
from pimouse_ros.msg import MotorFreqs
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse
class Motor():
def __init__(self):
if not self.set_power(False): sys.exit(1)
rospy.on_shutdown(self.set_power)
self.sub_raw ... |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from __future__ import division
from past.utils import old_div
from bpz_tools import *
def function(z, m, nt):
"""HDFN prior from Benitez 2000
for Ellipticals, Spirals, and Irregular/Starbursts
Returns an array pi[z[:],:nt]
The input magnitude is F814W AB
"""
global zt_at_a
nz = len(z)
... |
# Copyright 2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
# -*- coding: utf-8 -*-
# © 2016 Comunitea Servicios Tecnologicos (<http://www.comunitea.com>)
# Kiko Sanchez (<kiko@comunitea.com>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import fields, models, tools, api, _
from odoo.exceptions import AccessError, UserError, ValidationError
from ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2015 Bastian Kleineidam
#
# 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 option) any later version.
#... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
# Django settings for testsite project.
import os
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
DB_ENGINE = os.environ.get("DB_ENGINE", "postgresql")
DATABASES = {
"default": {
"ENGINE": f"django.db.backends.{DB_ENGINE}",
"NAME": os.environ.get("DB_NAME", "postgres"),
... |
########################################################################
# ampel.py - Trafficlight simulation
#
# Copyright (C) 2013 Nico Wollenzin
#
# This file is part of Raspi_GPIO_Examples.
#
# ampel.py is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... |
# Copyright Kevin Deldycke <kevin@deldycke.com> and contributors.
# All Rights Reserved.
#
# 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 your option) ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2009 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the AdBlock subscription class.
"""
from __future__ import unicode_literals
import os
import re
import hashlib
import base64
from PyQt5.QtCore import pyqtSignal, Qt, QObject, QByteArray, QDateT... |
# Copyright (C) 2017, 2020 Matteo Franchin
#
# This file is part of Pyrtist.
# Pyrtist 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 2.1 of the License, or
# (at your option) an... |
#!/usr/bin/env python
import os
from app import create_app, db
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from werkzeug.security import generate_password_hash
from datetime import datetime
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverag... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Stardust Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Exercise the wallet backup code. Ported from walletbackup.sh.
Test case is:
4 nodes. 1 2 and 3 sen... |
class Connection():
import socket
import netcmd
def __init__(address, port):
connect(address, port)
def connect(self, address, port):
self.sock = socket.socket()
self.sock.connect((address, port))
def disconnect(self):
self.sock.close()
pass
def recieve(self, data):
data = self.sock.re... |
# $Id: BAMBUProd_AODSIM.py,v 1.40 2012/07/25 03:08:41 paus Exp $
import FWCore.ParameterSet.Config as cms
process = cms.Process('FILEFI')
# import of standard configurations
process.load('Configuration/StandardSequences/Services_cff')
process.load('FWCore/MessageService/MessageLogger_cfi')
process.load('Configuratio... |
#!/usr/bin/env python
"""
Example python script for seismogram alignments by SAC p1
Xiaoting Lou (xlou@u.northwestern.edu)
03/07/2012
"""
from pylab import *
import sys
import matplotlib.transforms as transforms
from pysmo.aimbat.sacpickle import loadData, SacDataHdrs
from pysmo.aimbat.plotphase import getOptions, s... |
"""Test cases for quicksort."""
from src.course1.week3.quicksort import sort as randomized_quicksort
def test_quicksort_empty():
assert randomized_quicksort([]) == []
def test_quicksort_single():
assert randomized_quicksort([1]) == [1]
def test_quicksort_single_negative():
assert randomized_quicksort... |
# Copyright (c) Paul R. Tagliamonte <tag@pault.ag>, 2015
#
# 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... |
#!/usr/bin/python2
# -*- coding=utf-8 -*-
#************************************************************************
# $Id: generatenoundict.py,v 0.7 2011/03/26 01:10:00 Taha Zerrouki $
#
# ------------
# Description:
# ------------
# Copyright (c) 2011, Arabtechies, Arabeyes Taha Zerrouki
#
# This file is the main fi... |
# encoding: utf-8
"""Classes used in scattering and gathering sequences.
Scattering consists of partitioning a sequence and sending the various
pieces to individual nodes in a cluster.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import div... |
#!/usr/bin/env python
"""Test utilities for RELDB-related testing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import functools
import sys
import mock
from grr_response_core.lib.util import compatibility
from grr_response_server import data_store
... |
from django.test import TestCase, RequestFactory, Client
from django.urls import reverse
from .factories import UserFactory, RoleFactory, StateFactory
from countryx.sim.models import Section
from countryx.sim.views import (
root, allpaths, allquestions, allvariables, CreateSectionView,
CreateRoleView, StateCre... |
#!/usr/bin/env python3
WIN_MATCH_POINTS = 3
LOSE_MATCH_POINTS = 0
DRAW_MATCH_POINTS = 1
import sys
import random
import numpy
class Player(object):
def __init__(self, name, user):
self.name = name
self.user = user
self.match_wins = 0
self.match_losses = 0
self.match_draws = 0
self.game_wins = 0
self.g... |
# Copyright 2014 John Reese
# Licensed under the MIT license
from flask import abort
from jinja2.filters import do_capitalize
from core import app, context, get, template
from models import Quote, Passage
@get('/', 'Seinfeld Quote')
@template('index.html')
def index():
#passage = Passage(uid=37592)
passage ... |
#!/usr/bin/env python3
#
# Copyright (c) 2016, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''Script to send RPC commands to a running ElectrumX server.'''
import argparse
import asyncio
import json
from functools import p... |
import pyglet
from pyglet.window import key
from src import world
class GameStates:
MAIN_MENU = 0
GAME_LOAD = 1
GAME_PLAY = 2
GAME_MENU = 3
class Window(pyglet.window.Window):
def __init__(self, *args, **kwargs):
# Initialize window.
super(Window, self).__init__(800, 600, *args, **kwargs)
# Initilize wi... |
# Copyright (C) 2010 Canonical
#
# Authors:
# Michael Vogt
# Gary Lasker
#
# 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; version 3.
#
# This program is distributed in the hope that it will b... |
# demo wait.py
"""
Here, princes, are generated.
In the meantime, kings die.
The youngest prince, will become king.
If a new prince arrives, he checks, whether there's a king.
If so, he will wait for a kingdied trigger.
If not, he will become king.
Note that in this demo, the priority (-now) in wait is used to make
t... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
import frappe
import time
from frappe import _, msgprint, is_whitelisted
from frappe.utils import flt, cstr, now, get_datetime_str, file_lock, date_diff
from frapp... |
# Copyright 2014 The Oppia 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 applicable ... |
"""Configuration module.
This module deals with the config object used by the Application class to
make some parts of the application's behaviour configurable.
"""
import yaml
import eupheme.mime as mime
class Config:
"""Config class.
A slightly neater way of accessing the yaml config file instead of
... |
'''
This simple module consists of the Pyxl class and a few helper functions.
'''
from os.path import basename, join
from glob import glob
from PIL import Image, ImageDraw, ImageFont
#import flickrapi
#Helper functions.
def buildHex(hexStr):
'''
Accepts a supposed hex color string and ensures it's 6 chara... |
class NumMatrix(object):
def __init__(self, matrix):
"""
:type matrix: List[List[int]]
"""
m, n = len(matrix), len(matrix[0] if matrix else [])
self._sum = [[0] * n for i in xrange(m)]
col_sum = [0] * n
for i in xrange(m):
s = 0
for j ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.