text stringlengths 17 737k |
|---|
#!/usr/bin/env python2
import matplotlib.pyplot as plt
import numpy as np
import nflgame
import random
import h5py
import os
from itertools import chain
from math import exp
'''
Directions:
1) Enter the teams below which you've already picked this season
2) Delete scores.hdf (caches score data and should be regenera... |
from routes.mapper import Mapper
from webob import Request, Response
from webob.exc import HTTPException, HTTPNotFound
from wsgiref.simple_server import make_server
class App(object):
def __init__(self):
self.url_map = Mapper()
self.Request = Request
self.Response = Response
def expose... |
from __future__ import print_function, unicode_literals
import numpy
from preshed.maps import PreshMap
try:
import cupy
from cupy import get_array_module
except ImportError:
cupy = None
get_array_module = lambda _: numpy
try:
basestring
except NameError:
basestring = str
try:
unicode
exce... |
import asyncio
from .config import BERTHS as B
from .async_output import AsyncOutput
from .input import Input
from .berth import Berth, PriorityBerth, FringeBerth
from .websocket_client import WebsocketClient
from .drawer import HeadcodeDrawer, FringeDrawer
class FatController(object):
DISPLAY_BERTHS = (
... |
import os
import numpy as np
import requests
from astropy.coordinates import SkyCoord, match_coordinates_sky
from astropy.table import hstack
from easyquery import Query
__all__ = [
"get_sdss_bands",
"get_sdss_colors",
"get_des_bands",
"get_des_colors",
"get_decals_bands",
"get_decals_colors",... |
from cStringIO import StringIO
from shapely.geometry import MultiPolygon
from shapely import geometry
from shapely.wkb import loads
from tilequeue.tile import coord_to_mercator_bounds
from tilequeue.tile import pad_bounds_for_zoom
from tilequeue.tile import tolerance_for_zoom
from tilequeue.transform import mercator_po... |
import os
import sys
here = sys.path[0]
sys.path.insert(0, os.path.join(here,'..'))
import threading
from coap import coap, \
coapResource, \
coapDefines as d
import test_setup
class testResource(coapResource.coapResource)... |
#!/usr/bin/env python
"""
Usage: update_site.py [options]
Updates a server's sources, vendor libraries, packages CSS/JS
assets, migrates the database, and other nifty deployment tasks.
Options:
-h, --help show this help message and exit
-e ENVIRONMENT, --environment=ENVIRONMENT
T... |
#!/usr/bin/env python
"""
A module for getting input from Microsoft XBox 360 controllers via the XInput library on Windows.
Adapted from Jason R. Coombs' code here:
http://pydoc.net/Python/jaraco.input/1.0.1/jaraco.input.win32.xinput/
under the MIT licence terms
Upgraded to Python 3
Modified to add deadzones, reduce... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010 Cidadanía Coop.
# Written by: Oscar Carballal Prego <info@oscarcp.com>
#
# This file is part of e-cidadania.
#
# e-cidadania 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 F... |
#!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (c) 2015-2016 Daniel Standage <daniel.standage@gmail.com>
# Copyright (c) 2015-2016 Indiana University
#
# This file is part of genhub (http://github.com/standage/genhub) and is
# licensed under the B... |
import pandas as pd
from warnings import warn
import math
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation, LSTM
from keras.optimizers import RMSprop
from random import randint
# data import
df = pd.read_csv("./data/trump_tweets.csv", encoding="latin-1")
sequences = df[... |
#!/usr/bin/env python
"""
Docstring for instanceinfo.py. This script will act as an abstraction layer
between the connection information for AWS instances and private instances that
might reside beyond a proxy server.
Several namedtuples are used in the script and are defined as:
InstanceDetails defines the elements ... |
import logging
import os.path
import sys
import tarfile
import zipfile
import shutil
logger = logging.getLogger(__name__)
if sys.version_info[0] >= 3:
import urllib.request as urllib
from urllib.error import URLError
from urllib.error import HTTPError
else:
import urllib
from urllib2 import URLErr... |
#!/usr/bin/env python
# -==[ Hikvision DVR Brute forcer - V 1.0 ]==-
# -==[ Author : XD4rker ]==-
#
# Copyright 2015 XD4rker
#
#
# 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://... |
#!/usr/bin/env python
#
# WHAT DOES IT DO:
# pre-process data for template.
#
# LOCATION OF pipeline_template.sh
# $SCT_DIR/dev/template_preprocessing
#
# HOW TO USE:
# run: pipeline_template.sh
#
# REQUIRED DATA:
# ~/subject/t2/centerline_propseg_RPI.nii.gz --> a series of binary labels along the cord to help propseg.... |
"""
Created on Jun 21, 2011
@author: tiradani
"""
import os
import re
import sys
import pwd
import binascii
import traceback
import gzip
import cStringIO
import base64
import glideFactoryLib
from glideinwms.lib import condorPrivsep
from glideinwms.lib import condorMonitor
from glideinwms.lib import logSupport
MY_US... |
"""
Check the availability of NEXRAD Composites
"""
import datetime
import os
import sys
import pytz
def run(sts, ets):
''' Loop over a start to end time and look for missing N0Q products '''
now = sts
interval = datetime.timedelta(minutes=5)
while now < ets:
fn = now.strftime(("/mesonet/ARCHI... |
import subprocess
"""
Start up Terminals for dev environment
"""
CMD_DICT =dict(\
run_geoserver="cd /Users/rmp553/Documents/github-worldmap/cga-worldmap;workon cga-worldmap;paver start_geoserver"\
, run_geonode="cd /Users/rmp553/Documents/github-worldmap/cga-worldmap;workon cga-worldmap;django-admin.py runser... |
# Copyright (C) 2018 Zhixian MA <zx@mazhixian.me>
import os
import time
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
from scipy.misc import imsave
class printException(Exception):
"""
Ref: http://blog.csdn.net/kwsy2008/article/details/48468345
"""
pass
class ... |
#!/usr/bin/env python3
import argparse
import asyncio
import math
import os
import sys
import traceback as tb
import warnings
from pathlib import Path
import aiohttp
from aiohttp.web import Application, HTTPBadGateway, Response, WebSocketResponse, WSMsgType, hdrs, json_response
from devtools import VERSION
with_ujs... |
from __future__ import division
import numpy as np
import numpy.random as rn
import scipy.special as sp
import scipy.stats as st
########################################################################################################################
def betaln(x, a=1, b=1):
"""Returns the log-density of the bet... |
#!/usr/bin/env python3
# -*- encoding:utf-8 -*-
# TODO: import python-apt
import os
import re
import sys
# xml parser
import json
from pprint import pprint
# random tmp dir
import random
import string
import suprocess
# debug switch
DEBUG = 0
from multiprocessing import Pool, Manager
def log_print(output):
... |
# This deprecation library was adapted from Twisted. Full copyright
# statement retained at the bottom of this file
"""
Deprecation framework for Twisted.
To mark a method or function as being deprecated do this::
from twisted.python.versions import Version
from twisted.python.deprecate import deprecated
... |
#!/usr/bin/env python
# Written by Kieran O'Leary, with a major review and overhaul/cleanup by Zach Kelling aka @Zeekay
# Makes a single ffv1.mkv
import subprocess
import sys
import filecmp
from glob import glob
import os
import shutil
import csv
import time
import itertools
import getpass
try:
from ififuncs impo... |
"""
Copyright (c) 2016 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
from math import fabs
import numpy as np
import requests
import utm
from datetime import datetime
from pytz import timezone
from nexustiles.nexustiles import NexusTileService
from pyspark import SparkContext,... |
import datetime
class NeverExpires(object):
def expired(self):
return False
class Timer(object):
"""
A simple timer that will indicate when an expiration time has passed.
"""
def __init__(self, expiration):
"Create a timer that expires at `expiration` (UTC datetime)"
self... |
import numpy as np
class ArraySlot(object):
__lt__ = lambda x, y: x.key < y.key
__le__ = lambda x, y: x.key <= y.key
__eq__ = lambda x, y: x.key == y.key
__ge__ = lambda x, y: x.key >= y.key
__gt__ = lambda x, y: x.key > y.key
__ne__ = lambda x, y: x.key != y.key
def __init__(self, key, va... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import sklearn.metrics as metrics
from keras import backend as K
from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, EarlyStopping
from keras.datasets import cifar10
from keras.o... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import abc
import sys
from copy import deepcopy
import numpy as np
from numpy import ma
from ..units import Unit
from .. import log
from ..utils import OrderedDict, isiterable
from .structhelper import _drop_fields
from .pprint import _pformat_table, _pf... |
import asyncio
import numpy as np
from numpy import pi
import networkx as nx
import matplotlib.pyplot as plt
import logging
import time
from bokeh.plotting import figure
from bokeh.client import push_session
from bokeh.plotting import curdoc
from bokeh.driving import cosine
from pycontrol.plotting import BokehServerT... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import os
import math
import time
import itertools
import functools
import collections
import sys
import platform
import warnings
import re
from functools import reduce
import threading
import six
import vaex.utils
# import vaex.image
import numpy... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
import click
import fileinput
import logging
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
import string
import subprocess as sp
import sys
impor... |
import os
import sys
import re
def modTitle(modName, modDir=''):
fls = open(modDir+modName+'.mod', 'r')
data = fls.readlines()
title = ''
for line in data:
if '<ODSAtitle \"' in line:
str = re.split('ODSAtitle "', line, flags=re.IGNORECASE)[1]
title = str.partition('"')[0]
fls.c... |
from django.core.template.decorators import simple_tag
def admin_media_prefix():
try:
from django.conf.settings import ADMIN_MEDIA_PREFIX
except ImportError:
return ''
return ADMIN_MEDIA_PREFIX
admin_media_prefix = simple_tag(admin_media_prefix)
|
#-*- coding: utf-8 -*-
# 该文件用于批量递归地执行数据抓取操作。步骤为:
# 1. 从personalURL表中,抽取一个用户URL作为种子URL开始抓取操作。
# 2. 删除该URL;
# 3. 执行1.
import tourist
import travelnote
import MFWdb
import time
import requests
# 循环抓取多用户
def fetchMany():
conn = MFWdb.MFWConnect()
cur = conn.cursor()
cur.execute('select perUrl from personalUrl'... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
from HTMLParser import HTMLParseError
from time import time
from urlparse import urlparse
import requests
from bs4 import BeautifulSoup
from app import logger
from http_cache import http_get
from http_cache import is_response_too_large
from oa_local impor... |
#!/usr/bin/python2.4
#
# Copyright (c) 2006-2007 rPath, Inc. All rights reserved.
#
"""
rMake Backend server
"""
import errno
import itertools
import logging
import pwd
import os
import shutil
import signal
import sys
import time
import traceback
import xmlrpclib
from conary.deps import deps
from conary.lib import ut... |
#functions included here are those that you SHOULD be able to do in python syntax but can not.
import csv
import os
import itertools as it
import numpy as np
import numpy.lib.recfunctions as nprf
import matplotlib.mlab
from datetime import datetime
from dateutil.parser import parse
NOT_A_TIME = np.datetime64('NaT')
... |
from bs4 import BeautifulSoup
import requests
from .hero import Hero
class Rotation:
"""Rotation is able to get the latest free hero rotation."""
FORUM_URL = "https://us.battle.net/heroes/en/forum/topic/17936383460"
# TODO: omg get this outta here
SECOND_SPRITESHEET_HEROES = ["Samuro", "Ragnaros", "... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of c... |
# -*- coding: utf-8 -*-
from cronos.announcements.models import *
from cronos.dionysos.forms import *
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import render_to_response
from django.template import RequestContext
@login_required
def dec... |
"""Shared docstrings for plotting function parameters.
"""
from textwrap import dedent
def doc_params(**kwds):
"""\
Docstrings should start with "\" in the first line for proper formatting.
"""
def dec(obj):
obj.__doc__ = dedent(obj.__doc__).format(**kwds)
return obj
return dec
... |
import requests
from nflpool.data.dbsession import DbSessionFactory
from nflpool.data.activeplayers import ActiveNFLPlayers
import nflpool.data.secret as secret
from requests.auth import HTTPBasicAuth
from nflpool.data.seasoninfo import SeasonInfo
'''After updating the season to a new year, get all active NFL players... |
#
# This file is part of KwarqsDashboard.
#
# KwarqsDashboard 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.
#
# KwarqsDashboard is distributed in the hope that it will be useful,
# but... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright (c) 2013 AnsibleWorks, Inc.
#
# This file is part of Ansible Commander.
#
# Ansible Commander 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 of the License.
#
# Ansible Commander is di... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2018 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... |
# coding: utf-8
# Python 2; doesn't fail in Python 3
from __future__ import unicode_literals
import os
import json
import requests
from hashlib import md5
class AvatarsIOException(Exception): pass
def block_md5(fileobj, block_size=2**15):
hashed = md5()
while True:
data = fileobj.read(block_size)
if not data:... |
# The Hazard Library
# Copyright (C) 2012-2016 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#... |
from threading import Thread
from collections import defaultdict
from ..interface import SimulationInterface
from ..interface import TxInterface
from ..base import World, Yellow, Blue
from ..core import Dummy
from ..core.skills import goto
from ..core.skills import gotoavoid
from ..core.skills import drivetoobject
fr... |
# -*- coding: utf-8 -*-
import argparse
import os
import re
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--check', action='store_true', dest='check')
parser.set_defaults(check=False)
args = parser.parse_args()... |
"""Extract files Microsoft Access OLE object fields"""
import struct
import re
import sys
from pprint import pprint
class BadDataError(Exception):
pass
def bmps(oleobject):
"""Return iterator over all BMPs inside OLE object field"""
for object_type, data in objects(oleobject):
if object_type == ... |
from ..forms import BS3PasswordFieldWidget
from flask import render_template, flash, redirect, session, url_for, request, g, \
current_app
from openid.consumer import discover
from openid.consumer.consumer import Consumer, SUCCESS, CANCEL
from openid.extensions import ax
from openid.extensions.sreg import SRegReque... |
import random
import math
def guessNumber():
number = int(raw_input("Type any number(0-10):"))
if number > 10 or number < 0:
number = random.randint(0, 10)
numberValue = float(number)/10
return numberValue
def output(minnumber, maxnumber):
number= minnumber
number2= maxnumber
return """
I am thinking of a n... |
from __future__ import unicode_literals, division, absolute_import
import logging
import re
import urllib
from flexget import plugin, validator
from flexget.entry import Entry
from flexget.event import event
from flexget.utils import requests
from flexget.utils.soup import get_soup
from flexget.utils.search import to... |
"""
An example script which generates a plot of flutter velocity versus altitude.
Run via: python plot_fin_flutter.py
The plot is written to: flutter-velocity-example.pdf
"""
# Configure matplotlib to generate PDF output rather than popping a window up
import matplotlib
matplotlib.use('PDF')
import numpy as np
from... |
#!/usr/bin/env python3
import networkx as nx
import numpy as np
import itertools
from scipy import sparse
from pgmpy import Exceptions
from pgmpy.Factor import CPD
class BayesianModel(nx.DiGraph):
"""
Public Methods
--------------
add_nodes('node1', 'node2', ...)
add_edges_from([('node1', 'node2'... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
import odoo.addons.decimal_precision as dp
cl... |
"""Implement a blocking, procedural style connection adapter on top of the
asynchronous core.
"""
import logging
import socket
import time
from pika import callback
from pika import channel
from pika import exceptions
from pika import spec
from pika import utils
from pika.adapters import base_connection
LOGGER = log... |
#!/usr/bin/env python3
#
# Tests the basic methods of the Hamiltonian MCMC routine.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import unittest
import numpy as np
... |
'''
(c) 2015 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see the LICENSE.txt file included with this software for more information
authors: Arindam Bose (arindam.1993@gmail.com), Tucker Balch (trbalch@gmail.com)
'''
from LinearAlegebraUtils import *
import numpy as... |
import matplotlib.pyplot as plt
try: from matplotlib import animation
except: animation = None
from IPython.core.pylabtools import print_figure
from IPython.core import page
try:
from IPython.core.magic import Magics, magics_class, line_magic, cell_magic, line_cell_magic
except:
from nose.plugins.skip impor... |
import argparse
import html
import os
import re
from hashlib import sha1
from random import randint
##############
# Public API #
##############
def convert(text):
return Markdown(text).text
class Markdown:
def __init__(self, text, pre_hook=None, post_hook=None):
if pre_hook:
text = pre_h... |
## @file
# This file is used to create a database used by build tool
#
# Copyright (c) 2008, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full tex... |
#!/usr/bin/python
# Copyright 2010 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
# This script is a replacement for llvm-gcc and llvm-g++ driver.
# It detects automatically which role it is supposed to assume.
# Th... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cairo,Image
from operator import itemgetter
import numpy as np
from numpy import sin, cos, pi, arctan2, square,sqrt, logical_not, linspace, array
from numpy.random import random, randint
import gtk, gobject
PI = pi
PII = PI*2.
N = 1080 # size of png image
NUM = 300 #... |
# =============================================================================
#
# SELFIES: a robust representation of semantically constrained graphs with an example application in chemistry
# v0.2.3, 01. October 2019
# by Mario Krenn, Florian Haese, AkshatKuman Nigam, Pascal Friederich, Alan Aspur... |
import unicodedata
good_accents = {
u'\N{LATIN CAPITAL LETTER N WITH TILDE}',
u'\N{LATIN SMALL LETTER N WITH TILDE}',
u'\N{LATIN CAPITAL LETTER C WITH CEDILLA}',
u'\N{LATIN SMALL LETTER C WITH CEDILLA}'
}
class Normalizer:
def normalize(text, options={}):
"""
Normalize a given tex... |
import inspect, time, re
import base64
try: from hashlib import md5
except: md5 = __import__('md5').new
import traceback, sys, os
import socket
ranks = (5, 15, 30, 100, 300, 1000, 3000, 10000)
restricted = {
'everyone':['TOKENIZE','TELNET','HASH','EXIT','PING'],
'fresh':['LOGIN','REGISTER','REQUESTUPDATEFI... |
# Copyright 2019 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... |
# (c) Fugro GeoServices. MIT licensed, see LICENSE.rst.
from __future__ import absolute_import
from datetime import datetime, timedelta
import cStringIO
import csv
import logging
import os
import smtplib
import string
import time
import urllib2
import zipfile
from celery.signals import after_setup_task_logger
from ce... |
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
import datetime
import rfc3339 # for date object -> date string
import iso8601 # for date string -> date object... |
class Instance:
"""Create a new Instance instance.
It may take as parameter either:
- a string
- a list of strings as first parameters
- the parameters given as the constructor parameters (must be strings)
- a MediaControl instance
"""
def __new__(cls, *p):
if p and p[0]... |
#!/usr/bin/env
import os, sys
import argparse
import requests
import json
import subprocess
def get_genome(parameters):
target_file = os.path.join(parameters["output_path"],parameters["gid"]+".fna")
if not os.path.exists(target_file):
genome_url= "data_url/genome_sequence/?eq(genome_id,gid)&limit(2500... |
# Module: sockets
# Date: 04th August 2004
# Author: James Mills <prologic@shortcircuit.net.au>
"""Socket Components
This module contains various Socket Components for use with Networking.
"""
import os
from collections import defaultdict, deque
from errno import EAGAIN, EALREADY, EBADF
from errno import EC... |
#!/usr/bin/python3
import sys, os
# we're in directory 'tools/' we have to update sys.path
sys.path.append(os.path.dirname(sys.path[0]))
from rom.ips import IPS_Patch
from rom.rom import RealROM
from patches.common import patches as common_patches
vanilla=sys.argv[1]
ipsToReverse = sys.argv[2:]
rom = RealROM(vanil... |
#!/usr/bin/env python
import os
from argparse import ArgumentParser
from threaded_ssh import ThreadedClients
from ServerConfig import Storage
from ServerConfig import TellStore
from ServerConfig import Kudu
from ServerConfig import Cassandra
from ServerConfig import Microbench
def startMBClient(populate = False, uoutF... |
#!/usr/bin/env python
import sys
import subprocess
import re
failed = False
_ansi = re.compile(r'\x1b[^m]*m')
_help = '''claptests 0.0.1
Kevin K. <kbknapp@gmail.com>
tests clap library
USAGE:
\tclaptests [FLAGS] [OPTIONS] [ARGS] [SUBCOMMAND]
FLAGS:
-f, --flag tests flags
-F tests flags ... |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... |
# -*- coding: utf-8 -*-
import argparse
import logging
import iso8601
import json
import sys
import os
from urlparse import urljoin
from dateutil.tz import tzlocal
from copy import deepcopy
from datetime import timedelta, datetime
from pytz import timezone
from couchdb.client import Database
from couchdb.http import HT... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2013, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... |
"""
:module:`openquake.hazardlib.gsim.nrcan15` implements
:class:`EasternCan15Mid`, :class:`EasterCnan15Low`,
:class:`EasternCan15Upp`
"""
import copy
import numpy as np
from openquake.hazardlib.gsim.base import CoeffsTable, GMPE
from openquake.hazardlib.gsim.can15 import utils
from openquake.hazardlib.gsim.can15.wes... |
import csv
import traceback
import time
# you need easy_install PyGithub or pip install PyGithub for this
from github import Github, UnknownObjectException
import os
import random
import datetime
import urllib
from utils import *
from analyzeDeps import analyzeImports, parseDESCRIPTION
import pdb
# Fixed sql statement... |
import copy
import inspect
import re
import sre_constants
import os
class CfgType:
""" A config value type wrapper -- gives a config value a conversion
to and from a string, a way to copy values, and a way to print
the string for display (if different from converting to a string)
NOTE: mo... |
#! /usr/bin/env python
import os
import re
import sys
import time
import random
import getopt
import logging
import tempfile
import subprocess
import shutil
# This python script runs db_stress multiple times. Some runs with
# kill_random_test that causes rocksdb to crash at various points in code.
def main(argv):
... |
#!/usr/bin/python3
import sys, os, pty, shlex
sys.path.append(os.path.join(os.path.dirname(__file__),'../bindings/python/'))
import serverboards, pexpect, shlex, re, subprocess, random, sh
import urllib.parse as urlparse
import base64, re, time
from common import *
from serverboards import file, print, rpc, cache_ttl
s... |
"""Functions for solving for equilibria with multigrid continuation method."""
import copy
import numpy as np
from desc.equilibrium import EquilibriaFamily, Equilibrium
from desc.objectives import get_equilibrium_objective, get_fixed_boundary_constraints
from desc.optimize import Optimizer
from desc.perturbations im... |
from pymongo import MongoClient
import os
mongodb_path = os.environ['MONGODB_URI']
client = MongoClient(mongodb_path)
celeb_collection = client.heroku_lsms3n9l.celebs
def addRecord(celeb_id, en_name, sex, country, image_url, local_name=None, zh_name=None, age=None, message_id=None):
record = {
'celeb_id':... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-learn
Follows scikit-learn API conventions
"""
import numpy as... |
# -*- coding: utf-8 -*-
'''Provisioning. (alpha)
See http://github.com/exosite/exoline#provisioning for vendor token setup instructions.
Usage:
exo [options] provision model list [--long]
exo [options] provision model info <model>
exo [options] provision model create (<rid>|<code>) [--noaliases] [--nocomme... |
import urllib, urllib2
import re
import time
import os
def check_status():
status_page = urllib2.urlopen(link)
status_page_list = status_page.read().split("\n")
for line in status_page_list:
if 'status' in line:
t= line.split("<BR>")
print t[2] + "\t" + t[3].split("<a href... |
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from whoosh.index import create_in, open_dir
from whoosh.fields import TEXT, ID, Schema
from whoosh.qparser import MultifieldParser, FieldsPlugin, WildcardPlugin
fro... |
import json
from django.test import TestCase
from django.test.client import Client
from mock import patch, Mock
from override_settings import override_settings
from django.conf import settings
from django.core.urlresolvers import reverse
from path import path
from student.models import Registration
from django.contrib... |
from unittest import TestCase
from mock import Mock
from cloudshell.cm.ansible.domain.playbook_downloader import PlaybookDownloader, HttpAuth
from tests.mocks.file_system_service_mock import FileSystemServiceMock
class TestPlaybookDownloader(TestCase):
def setUp(self):
self.zip_service = Mock()
... |
#!/usr/bin/env python2.5
#
# Copyright 2008 the Melange 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... |
"""
Protocol module mainly for Python representations of objects from the google API
"""
import urllib.parse
import urllib.request
import urllib.error
import struct
import time
import random
import posixpath
import re
import hashlib
import socket
import binascii
import logging
from io import BytesIO
import gglsbl3.uti... |
# SSSD Providers
#
# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# li... |
import unittest
from __main__ import vtk, qt, ctk, slicer
import SimpleITK as sitk
import sitkUtils
#
# LabelObjectStatistics
#
class LabelObjectStatistics:
def __init__(self, parent):
import string
parent.title = "Label Object Statistics"
parent.categories = ["Microscopy"]
parent.contributors = ["B... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals, print_function
import argparse
import io
import logging
import os
import subprocess
import tarfile
import tempfile
from collections import defaultdict
logger = logging.getLogger(__name__)
def main():
logging.basicConfig(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.