src stringlengths 721 1.04M |
|---|
# -*- 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
#... |
import typing
from randovania.game_description import node_search
from randovania.game_description.area import Area
from randovania.game_description.game_patches import GamePatches
from randovania.game_description.hint import Hint, HintLocationPrecision, RelativeDataArea, HintRelativeAreaName
from randovania.game_desc... |
# coding=utf-8
# From https://github.com/ControlEverythingCommunity/SHT25/blob/master/Python/SHT25.py
import time
import copy
from mycodo.inputs.base_input import AbstractInput
from mycodo.inputs.sensorutils import calculate_dewpoint
from mycodo.inputs.sensorutils import calculate_vapor_pressure_deficit
# Measuremen... |
from __future__ import absolute_import
from .card import Card
from .list import List
from .member import Member
class Board(object):
"""
Class representing a Trello board. Board attributes are stored as normal
Python attributes; access to all sub-objects, however, is always
an API call (Lists, Cards)... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a stlcoind or Stl... |
########################################################################
# File : Watchdog.py
# Author: Stuart Paterson
########################################################################
""" The Watchdog class is used by the Job Wrapper to resolve and monitor
the system resource consumption. The Watchdog... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
# Mateusz Kruszyński <mateusz.kruszynski@gmail.com>
#
from obci.gui.ugm import ugm_config_manager as m
MAZE = {'id':'1986',
'stimulus_type':'maze',
'width_type':'relative',
'width':1.0,
'height_type':'relative',
'heigh... |
# PyParticles : Particles simulation in python
# Copyright (C) 2012 Simone Riva
#
# 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 late... |
"""
This file is part of the LEd Wall Daemon (lewd) project
Copyright (c) 2009-2012 by ``brainsmoke'' and Merlijn Wajer (``Wizzup'')
lewd 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 ver... |
# -*- coding: utf-8 -*-
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# Copyright ©2017 The go-hep Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from array import array as carray
import ROOT
f = ROOT.TFile.Open("gauss-h1.root","RECREATE")
histos = []
for t in [
(ROOT.TH1D, "h1d", (10,-4,4)),
... |
"""
Tags which can retrieve events from a public google calendar Atom feed,
and return the results for use in templates.
Copyright (c) 2011, Olivier Le Thanh Duong <olivier@lethanh.be>
Based on django-template-utils :
Copyright (c) 2009, James Bennett & Justin Quick
Based, in part, on the original idea by user b... |
#!/usr/bin/env python
"""Get all images of a wikipedia commons category."""
import json
import logging
import os
import sys
import urllib # images
import urllib2 # text
import xmltodict
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
level=logging.DEBUG,
... |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
"""Fetch and print the most common user agents.
This script fetches the most common user agents according to
https://github.com/Kikobeats/top-user-agents, and prints the most recent
Chrome user agent for Windows, macOS and Linux.
"""
import ma... |
# -*- coding: utf-8 -*-
# pylint: skip-file
import re
import json
from django.test import TestCase
from django.http import JsonResponse
try:
from django.urls import reverse
except expression as identifier:
from django.core.urlresolvers import reverse
import six
from .models import Author, Book
from .views im... |
# Copyright 2016 Open Source Robotics Foundation, 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... |
"""Tokenization help for Python programs.
This is tokenize module from Python 2.4.3 with minor modification needed to
support Hebrew tokens.
generate_tokens(readline) is a generator that breaks a stream of
text into Python tokens. It accepts a readline-like method which is called
repeatedly to get the next line of i... |
import re
import urllib
from typing import Dict, List, Optional, Set
import requests
from bs4 import BeautifulSoup
from decksite import translation
from decksite.data import deck
from magic import decklist, legality
from shared import configuration, fetch_tools, logger
from shared.pd_exception import InvalidDataExcep... |
from __future__ import absolute_import, division, print_function
import logging
import datetime
from cbopensource.tools.eventduplicator.utils import get_process_id, get_parent_process_id
import sys
__author__ = 'jgarman'
log = logging.getLogger(__name__)
class Transporter(object):
def __init__(self, input_sourc... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import numpy as np
from scipy.optimize import curve_fit
def FWHM(x, noise=100, fano=0.114):
sigma = np.sqrt((noise / 2.3548) ** 2 + 3.58 * fano * x)
return 2.3548 * sigma
def fit_FWHM(x, F):
def _FWHM(x, noise, fano):
return (noise / 2.3548) ** 2 + 3.58 * fano * x
popt, pcov = curve_fit(_FW... |
#! /usr/bin/env python
import pytest
from pandas import concat, DataFrame, read_csv, to_numeric, wide_to_long
from numpy import where
import re
import decimal as dc
import sys, os
from poplerGUI.logiclayer import class_logconfig as log
from poplerGUI.logiclayer.datalayer import config as orm
rootpath = os.path... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 10:59:19 2017
@author: marcobarsacchi
"""
import numpy.random as random
class MarkovChain(object):
"""Simple Markov Chain Model.
Parameters
----------
n : int
Number of states.
p : list, len (n)
Base probabili... |
#!/usr/bin/env python
#
# PyGazelle - https://github.com/cohena/pygazelle
# A Python implementation of the What.cd Gazelle JSON API
#
# Loosely based on the API implementation from 'whatbetter', by Zachary Denton
# See https://github.com/zacharydenton/whatbetter
from HTMLParser import HTMLParser
import sys
import json... |
# Generated by Django 2.2.4 on 2019-09-19 10:08
from django.conf import settings
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('events', '0033_auto_20190820_1356'),
]
operations = [
migrations.AddFiel... |
# Copyright 2016-2021 The Matrix.org Foundation C.I.C.
#
# 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... |
"""
@package mi.dataset.driver.dofst_k.wfp.test.test_driver
@file marine-integrations/mi/dataset/driver/dofst_k/wfp/driver.py
@author Emily Hahn
@brief Test cases for dofst_k_wfp driver
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/dsa/test_driver
$ bin/dsa/test_driver -i [-t test... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 4 juin 2013
@author: Aristote Diasonama
'''
import logging
from shop.handlers.base_handler import BaseHandler, no_user_required
import helper_functions as helpers
from webapp2_extras.auth import InvalidAuthIdError, InvalidPasswordError
class LoginHandle... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-02 15:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0045_update_justification_values'),
]
operations = [
migrations.RunSQL(
... |
##########################################################################
#
# Copyright (c) 2011, John Haddon. All rights reserved.
# Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... |
# This file is part of PSAMM.
#
# PSAMM 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.
#
# PSAMM is distributed in the hope that it wi... |
########################################################################
# Author : Andrei Tsaregorodtsev
########################################################################
"""
Utilities for managing DIRAC configuration:
getCEsFromCS
getUnusedGridCEs
getUnusedGridSEs
getSiteUpdates
getSEUpdates
"""
_... |
#
# 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
# ... |
import pika
import sys
import logging
logging.basicConfig()
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='Australia_NZ_Exchange',
type='headers')
result = channel.queue_declare(excl... |
#-*- encoding: utf8 -*-
"""Retrieve user id from ldap server."""
import logging
import sys
logging.basicConfig(level=logging.INFO)
LOGGER = logging.getLogger(__name__)
try:
import ldap
except ImportError, exception:
LOGGER.error(str(exception))
sys.exit()
LDAP_SERVER_URL = 'ldap://directory.lvl.intranet'... |
#!/usr/bin/env python
"""
Plastic
==================================
"""
from datetime import timedelta
from opendrift.readers import reader_netCDF_CF_generic
from opendrift.models.plastdrift import PlastDrift
o = PlastDrift(loglevel=20)
o.list_configspec() # to see available configuration options
# Arome atmospher... |
from Truemax.moduleScene import get_author_initials
__author__ = 'sofiaelm'
import manager
import maya.cmds as cmds
from pymel.all import mel
if get_author_initials() == 'mj':
bg_colour = [0.9, 0.4, 1]
else:
bg_colour = [0.4, 0.4, 0.4]
class ModuleRig(manager.Module):
def create_ui(self):
tab = ... |
from sqlalchemy import Column, Integer, String, Sequence, ForeignKey, ForeignKeyConstraint, Boolean
from sqlalchemy.orm import relationship, backref
from sqlalchemy.schema import CheckConstraint
import enums
from common import BaseSchema
class AcquisitionPaths(BaseSchema):
"""
MLS player acquisition data mod... |
# coding=utf-8
# Copyright 2018 Sascha Schirra
#
# 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
# list of conditions and the following di... |
import numpy as np
import pandas as pd
# from matplotlib.pyplot import plot,show,draw
import scipy.io
from functions import *
import _pickle as cPickle
import time
import os, sys
import ipyparallel
import neuroseries as nts
import scipy.stats
from pylab import *
from multiprocessing import Pool
data_directory = '/mn... |
import os
import json
class DictQuery(dict):
def get(self, path, default=None):
try:
return self.__get(path, default)
except:
import logging
logging.exception('get failed')
def __get(self, path, default=None):
keys = path.split("/")
val = No... |
import logging
import re
import requests
from copy import deepcopy
from mozilla_version.balrog import BalrogReleaseName
BALROG_API_ROOT = 'https://aus5.mozilla.org/api/v1'
log = logging.getLogger(name=__name__)
class BalrogError(Exception):
pass
class TooManyBlobsFoundError(BalrogError):
def __init__(sel... |
import logging
from django.core import mail
from django.conf import settings
from django.template import loader, Context
from django.contrib.sites.models import Site
from django.db.models import get_model, Max
from oscar.apps.customer.notifications import services
from oscar.core.loading import get_class
ProductAler... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
class LatencyMetric(object):
@staticmethod
def length_from_padding_mask(padding_mask, batch_first: bool = False):
... |
# jsb/less.py
#
#
""" maintain bot output cache. """
# jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.limlist import Limlist
from jsb.lib.cache import get, set, delete
## basic imports
import logging
## Less class
class Less(object):
""" output cache .. caches upto <nr> item of ... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def DVPortConfigSpec(vim, *args, **kwargs):
'''Specification to reconfigure a Distributed... |
#!/usr/local/bin/python2.7
##
# OOIPLACEHOLDER
#
# Copyright 2020 Raytheon Co.
##
import os
from mi.core.versioning import version
from mi.dataset.dataset_driver import SimpleDatasetDriver, ParticleDataHandler
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.parser.ctdpf_ckl_wfp import Ct... |
#!/usr/bin/env python3
# Copyright 2020 Timothy Trippel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... |
from redis_accessor import get_safe_redis
from django.http import HttpResponse
def get_visitor_ip(req):
if req.META.has_key('HTTP_X_FORWARDED_FOR'):
ip = req.META['HTTP_X_FORWARDED_FOR']
else :
ip = req.META['REMOTE_ADDR']
return ip
def is_bad_ip(str_ip):
if l... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2014, Jens Depuydt <http://www.jensd.be>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
# Copyright 2013, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
import struct
from vtdb import dbexceptions
from vtdb import keyrange_constants
ZK_KEYSPACE_PATH = '/zk/local/vt/ns'
pack_keyspace_id = struct.Struct('!Q').pack
... |
# -*- coding: utf-8 -*-
# Dioptas - GUI program for fast processing of 2D X-ray diffraction data
# Principal author: Clemens Prescher (clemens.prescher@gmail.com)
# Copyright (C) 2014-2019 GSECARS, University of Chicago, USA
# Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# References:
# - Static and abstract methods: https://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods
# - Singletons in Python: http://stackoverflow.com/questions/6760685/creating-a-singleton-in-python?rq=1
# - Lock acquisition with a decorator: ht... |
# coding=utf-8
import json
import codecs
import os
import sys
import re
if __name__ == '__main__':
fr1 = codecs.open(sys.argv[1], 'r', encoding='utf-8') # 我统计的
fr2 = codecs.open(sys.argv[2], 'r', encoding='utf-8') # 君哥统计的
dics1 = []
dics2 = []
for i in fr1:
js = json.loads(i)
... |
import collections
import string
from os.path import commonprefix
import parse
FORMATTER = string.Formatter()
class Stringable(object):
def __init__(self, name, template, valid_values={}):
self.template_pieces = []
self.field_names = []
parsed = FORMATTER.parse(template)
for (lit... |
from nodeconductor.cost_tracking import CostTrackingStrategy, CostTrackingRegister, ConsumableItem
from . import models
class ExchangeTenantStrategy(CostTrackingStrategy):
resource_class = models.ExchangeTenant
class Types(object):
SUPPORT = 'support'
STORAGE = 'storage'
class Keys(obje... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-05-18 11:16
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('base', '0270_auto_20180514_11... |
import copy
from functools import reduce
from .cup import Cup
or_reduction = lambda x, y: x or y
and_reduction = lambda x, y: x and y
class Game(object):
cups = None
parent = None # Game that created this one
children = None
def __init__(self, sizes=None, parent=None):
"""
S... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Frédéric Rodrigo 2014 ##
## ... |
from keras.models import *
from keras.layers import *
from keras.layers.advanced_activations import *
from keras.callbacks import *
from keras.optimizers import Adam
from keras.initializers import *
import tensorflow as tf
from utils import huber_loss
def guide_v1():
S = Input(shape = (64,64,12))
x = C... |
from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "BOL"
addresses_name = "2021-05-01T18:52:07.783562/Democracy_Club__06May2021.CSV"
stations_name = "2021-05-01T18:52:07.783562/Democracy_Club__06May2021.CSV"
... |
#!/usr/bin/python
import sys
# Input dictionary from KVP file
d = {}
# Defaults dictionary
defaults = {}
# Checks whether the key exists in the input dictionary
def Write(_key, _file):
if _key in d:
if not d[_key].strip():
_file.write("; ")
_file.write(_key + ' = ' + d[_key])
el... |
# coding=utf-8
from docc.exceptions import APIError
class Image(object):
"""Represent an Image object (name and distribution information)"""
def __init__(self, identifier, name, distribution):
self.id = identifier
self.name = name
self.distribution = distribution
def __repr__(se... |
import os
import zipfile
from django.shortcuts import render
from django.http import JsonResponse, HttpResponse
from .docMerge import mergeDocument
from .xml4doc import getData
from random import randint
from datetime import datetime
from django.views.decorators.csrf import csrf_exempt
#from .merge_utils import get_loc... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
import os.path
import re
from setuptools import find_namespace_packages, setup
VERSION_RE = re.compile(r"""__version__ = ['"]([0-9.]+)['"]""")
BASE_PATH = os.path.dirname(__file__)
with open(os.path.join(BASE_PATH, "shadowproxy", "__init__.py")) as f:
try:
version = VERSION_RE.search(f.read()).group(1)
... |
from django.contrib import auth
from django.contrib.auth.models import User
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, render_to_response
from django.template import RequestContext
import forms as myforms
def login(request):
if not request.user.is_authenticated(... |
# enable or disable the whole program
ENABLED = True
# if we're in testing mode, output more debug and allow testers to add their own email
DEBUG = True
# used with above, you can check the output of emails that would have been sent
SEND_EMAILS = True
# iSAMS Batch API key
API_KEY = "11D497FF-A7D9-4646-A6B8-D9D1B871... |
import numpy as np
import pandas as pd
import tensorflow as tf
import time
import csv
from random import shuffle
import random
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score
from sklearn import metrics
from math import sqrt
user_name = 'David Mendoza'
step_size = 40
batch_size = 5
... |
# Bulletproof Arma Launcher
# Copyright (C) 2016 Lukasz Taczuk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# b... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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.apach... |
# Copyright 2019 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from unittest import skipIf
from django.urls import reverse
from django.test.utils import override_settings
from django.test import RequestFactory
from myuw.views.lti.photo_list import LTIPhotoList
from myuw.test.api import missing_... |
# 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
# distributed under the Li... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##########################################################################
#
# Gaia, task list organiser in with Caldav server sync.
#
# Copyright (C) 2013-2014 Dr Adam S. Candy.
# Dr Adam S. Candy, contact@gaiaproject.org
#
# This file is part of the Gaia project... |
"""
Module containing functions to differentiate functions using autograd.
"""
try:
import autograd.numpy as np
from autograd.core import grad
except ImportError:
np = None
grad = None
from ._backend import Backend, assert_backend_available
class AutogradBackend(Backend):
def __str__(self):
... |
from django.db import models
# the bullet object
class Bullet(models.Model):
# required fields
content = models.CharField(max_length=512)
ret_time = models.DateTimeField(blank=True, null=True)
post_time = models.DateTimeField(blank=True, null=True)
# optional fields
info = models.ForeignKey('I... |
# -*- coding: UTF-8 -*-
import importlib
import logging
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from user_sessions.models import Session as UserSession
logger = logging.getLogger(__name__)
def get_model_class(full_model_name):
try:
old_model_pa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import os
import io
version = {}
with io.open(os.path.join('metric_learn', '_version.py')) as fp:
exec(fp.read(), version)
# Get the long description from README.md
with io.open('README.rst', encoding='utf-8') as f:
long_description = f.re... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from mcrouter.test.McrouterTestCase import McrouterTestCase
class TestNoReplyBase(McrouterTestCase):
config = '.... |
"""Extend introspect.py for Java based Jython classes."""
from introspect import *
import string
__author__ = "Don Coleman <dcoleman@chariotsolutions.com>"
__cvsid__ = "$Id$"
def getAutoCompleteList(command='', locals=None, includeMagic=1,
includeSingle=1, includeDouble=1):
"""Return lis... |
# Under the unix shell, type:
# python q1_recommendation_system_numpy_scipy.py
# from scipy.spatial import distance
from scipy.spatial import distance as dt
from collections import Counter
import numpy as np
import time
start_time = time.time()
def center_vector(vector): #[7, 6, 0, 2] => [2, 1, 0, -3] (center only o... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Boris Pavlovic (boris@pavlovic.me).
# 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
#
# ... |
import itertools
def pairwise(iterable):
"""
s -> (s0,s1), (s1,s2), (s2, s3), ...
"""
a, b = itertools.tee(iterable)
next(b, None)
return list(zip(a, b))
def str2bool(v):
"""
converts a string to a boolean
"""
return v.lower() in ("yes", "true", "t", "1")
def chunks(li, siz... |
# Rex Lei rexlei86@uvic.ca
# parse the coordinates data from the file generated by leapmotion
import sys, glob, os,csv
def parser2(filename):
raw = open(filename)
fbname = filename.split('.')[0]
pfile = open("../"+fbname+".txt", "w")
pFre = open("../statistics/"+fbname+"Stat.txt", "w")
csvFp = csv.writer(open(".... |
from django.conf import settings as default_settings
from django.core.exceptions import ImproperlyConfigured
try:
from importlib import import_module
except ImportError: # PY26 # pragma: no cover
from django.utils.importlib import import_module
# DEPRECATED: To be removed in Backends 2.0
import warnings
DID_... |
#-*- coding: utf-8 -*-
#!/usr/bin/env python
import sys, os, time, atexit
from signal import SIGTERM
from datetime import datetime
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', std... |
#!/usr/bin/python
import os
import sys
import time
import glob
import trace
import tempfile
tmpdir = tempfile.mkdtemp(prefix='gpaw-sphinx-')
os.chdir(tmpdir)
def build():
if os.system('svn export ' +
'https://svn.fysik.dtu.dk/projects/ase/trunk ase') != 0:
raise RuntimeError('Checkout of ... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import py_utils
from py_utils import binary_manager
from py_utils import dependency_util
import dependency_manager
from dependency_... |
from dilap.geometry.quat import quat
from dilap.geometry.vec3 import vec3
import dilap.geometry.tools as dpr
import matplotlib.pyplot as plt
import unittest,numpy,math
import pdb
#python3 -m unittest discover -v ./ "*tests.py"
class test_quat(unittest.TestCase):
def test_av(self):
a = 3*dpr.PI4
... |
import numbers
class IndexSet(object):
def __init__(self):
return
def __getitem__(self, t):
if t in self:
return t
else:
raise KeyError("Time %.2f not in index set." % t)
def __contains__(self, value):
return False
def __eq__(self, other):
... |
import threading
from PyQt4.Qt import (QDialog, QInputDialog, QLineEdit,
QVBoxLayout, QLabel, SIGNAL)
import PyQt4.QtCore as QtCore
from electrum.i18n import _
from .ledger import LedgerPlugin
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
from electrum_gui.qt.util import *
from btchip.... |
import json
import os
import shutil
from typing import Tuple, List, Callable
import torch
import torchvision
from torch import nn, optim
from torch.nn import functional as F
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from root import from_root
from src.experiments.config... |
#!/usr/bin/env python3
import logging
import lxc
import os
import tunneldigger
# random hash
CONTEXT = None
# lxc container
SERVER = None
CLIENT = None
# pids of tunneldigger client and server
SERVER_PID = None
CLIENT_PID = None
LOG = logging.getLogger("test_nose")
def setup_module():
global CONTEXT, SERVER, ... |
#!/usr/bin/env python
# region Import
from sys import path
from os.path import dirname, abspath
project_root_path = dirname(dirname(dirname(abspath(__file__))))
utils_path = project_root_path + "/Utils/"
path.append(utils_path)
from base import Base
from network import Ethernet_raw, ARP_raw, IP_raw, UDP_raw, DHCP_raw... |
import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestSoftmax(unittest.TestCase):
def setUp(self):
self... |
#
# Copyright 2017 Carsten Friedrich (Carsten.Friedrich@gmail.com). All rights reserved
#
# Based on: http://efavdb.com/battleship/ by Jonathan Landy
#
import tensorflow as tf
import numpy as np
import legacy.ttt_board as ttt
BOARD_SIZE = 9
hidden_units = BOARD_SIZE
output_units = BOARD_SIZE
input_positions = tf.pl... |
"""
Django settings for my_proj project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from django.core.urlresolvers import reverse_lazy
from os.path import dirna... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.