src stringlengths 721 1.04M |
|---|
import py, sys
from rpython.rtyper.lltypesystem import lltype
from rpython.rtyper.annlowlevel import llstr
from rpython.flowspace.model import Variable, Constant, SpaceOperation
from rpython.jit.codewriter.support import decode_builtin_call, LLtypeHelpers
from rpython.jit.codewriter.support import _ll_1_int_abs
def ne... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pyquery import PyQuery as pq
import yapbib.biblist as biblist
class ACM(object):
def __init__(self, id):
self.id = id
@property
def title(self):
if not hasattr(self, 'b'):
self.b = self._full_bibtex()
return self.b.g... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2017 Canonical Ltd
#
# 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 ... |
import numpy
import pfft
import mpsort
from . import domain
from .window import FindResampler, Affine
from mpi4py import MPI
import numbers # for testing Numbers
import warnings
def is_inplace(out):
return out is Ellipsis
class slab(numpy.ndarray):
pass
class slabiter(object):
def __init__(self, field):... |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... |
# Copyright (c) 2010 Citrix Systems, 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 applicab... |
import ast
from ply import lex
from util import sqlerror
DEBUG = False
_keywords = {
'select':'SELECT',
'from':'FROM',
'where':'WHERE',
'between':'BETWEEN',
'group':'GROUP',
'order':'ORDER',
'by' : 'BY',
'as' : 'AS',
'limit':'LIMIT',
'and':'AND',
'or' : 'OR',
'in' : '... |
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
import abjad
import consort
import collections
from abjad.tools import systemtools
from abjad.tools import timespantools
def _make_timespan_inventory():
timespan_inventory = abjad.TimespanList([
consort.PerformedTimespan(
start_offset=0,
stop_offset=20,
voice_name='A',
... |
from __future__ import division, absolute_import, print_function
import sys
import warnings
import collections
from . import multiarray
from . import umath
from .umath import *
from . import numerictypes
from .numerictypes import *
if sys.version_info[0] >= 3:
import pickle
basestring = str
else:
import c... |
# Copyright 2018 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... |
import unittest
from qrc_pathlib import qrc_glob
from test import fixture
class TestQrcGlob(unittest.TestCase):
def test_iglob_with_files(self):
self.assertEqual(set(qrc_glob.iglob(':привет.txt')), {':/привет.txt'})
self.assertEqual(set(qrc_glob.iglob(':привет.txt/')), set())
def test_iglob... |
"""Test Home Assistant template helper methods."""
import asyncio
from datetime import datetime
import unittest
import random
import math
from unittest.mock import patch
from homeassistant.components import group
from homeassistant.exceptions import TemplateError
from homeassistant.helpers import template
from homeass... |
# file django/existdb/tests.py
#
# Copyright 2010 Emory University General Library
#
# 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/LI... |
# Copyright 2013 Mirantis 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 ... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
from django.core.management import CommandError
from django.core.management.base import AppCommand
from anonymizer.utils import get_anonymizers
try:
unicode
except NameError:
unicode = str # python 3
class Command(AppCommand):
def add_arguments(self, parser):
parser.add_argument('args', metava... |
# coding: utf-8
# Copyright (C) 2016 Bruno Abude Cardoso
#
# Imagem Cinemática 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.
#
# Imag... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Sat Mar 31 15:44:43 2012
import wx
import os
import sys
from olifant import Olifant
from olifantException import OlifantException
# begin wxGlade: extracode
# end wxGlade
def showError(label,text):
dial = wx.MessageDialog(None, text , lab... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
from get_size import getSize
import os
# Fetch parameters from environment
start_major = int(os.environ['__VJ_START_MAJOR__'])
start_minor = int(os.environ['__VJ_START_MINOR__'])
# Specific do internet data
LINE_SHIFT=10
def getNext((major, minor) = (None, None), n = 0):... |
"""
@author: J.W. Spaak
This programm plots Fig. S4
"""
from plot_functions import bars
import community_construction_repl as repl
#compute DeltaEF/EF for the different communities and different cases
EF_data = {key: repl.delta_EF_lin(*repl.para[key]) for key in repl.para.keys()}
# species have different f
EF_data... |
import curses
import sys
import time
from curses import wrapper
from datetime import datetime
from alertaclient.models.alert import Alert
from alertaclient.utils import DateTime
class Screen:
ALIGN_RIGHT = 'R'
ALIGN_CENTRE = 'C'
def __init__(self, client, timezone):
self.client = client
... |
#!/usr/bin/python
# http://mcsp.wartburg.edu/zelle/python/graphics.py
# https://mcsp.wartburg.edu/zelle/python/graphics/graphics/index.html
import math
from graphics import *
XSCALE = 2550
YSCALE = 1310
XCENTER = XSCALE / 2
YCENTER = YSCALE / 2
# https://en.wikipedia.org/wiki/Incircle_and_excircles_of_a_triangle#... |
import ipaddress
from io import BytesIO
import pytest
from mitmproxy.net import socks
from mitmproxy.test import tutils
# this is a temporary placeholder here, we remove the file-based API when we transition socks proxying to sans-io.
class tutils: # noqa
@staticmethod
def treader(data: bytes):
io ... |
#!/usr/bin/env python
from struct import pack, unpack
# http://nlp.stanford.edu/IR-book/html/htmledition/variable-byte-codes-1.html
def vb_encode(numbers):
if isinstance(numbers, int):
return vb_encode_number(numbers)
bytestream = ''
for n in numbers:
bytes = vb_encode_number(n)
by... |
from thredds_crawler.etree import etree
import urllib
import urlparse
import requests
import os
import sys
import re
from thredds_crawler.utils import construct_url
INV_NS = "http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
XLINK_NS = "http://www.w3.org/1999/xlink"
import logging
try:
# Python >= 2... |
from typing import List, Optional, Union
from hdlConvertorAst.hdlAst._defs import HdlIdDef
from hdlConvertorAst.hdlAst._expr import HdlValueId
from hdlConvertorAst.hdlAst._structural import HdlModuleDec, HdlModuleDef, \
HdlCompInst
from hwt.code import If
from hwt.hdl.operatorDefs import AllOps
from hwt.hdl.types.... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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... |
from robinhood import Robinhood
import numpy as np
import math
import os
import random
import time
import smtplib
import datetime
from pymongo import MongoClient
import quandl
import requests
try:
import config
print('using local config file')
rhuser = config.rhuser
rhpass = config.rhpass
guser = ... |
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Demonstration of InfiniteLine visual.
"""
import sys
import numpy as np
from vispy import app, scene
# vertex positions of data to draw
N = 200
pos = np.z... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from flask import url_for
from udata.core.topic.models import Topic
from . import APITestCase
from ..factories import TopicFactory, AdminFactory
class TopicsAPITest(APITestCase):
def test_topic_api_list(self):
'''It should fetch a topic li... |
#pylint: disable=W0703,W0105
""" admin controller """
import re
from agent.lib.security import authutil
from agent.lib import manifestutil, utils, contextutils, configutil
from agent.lib.agent_thread.exec_thread import ExecThread
from agent.lib.base import BaseController
from agent.lib.errors import Errors
from agent.l... |
#!/usr/bin/env python3
from __future__ import print_function
import logging, socket, gtk, webkit, gobject, multiprocessing, sys, scapy_http.http, warnings, logger
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
warnings.filterwarnings("ignore")
from scapy.all import sniff
class Sniffer(object):
def _... |
#!/usr/bin/python3
#--------------------------------------------------------------------
# Function: enumer_d_and_c
# Description: Computes the maximum sub-array and the associated sum using a div# ide and conquer algorithm
# Receives: values - list of integers
# Returns: maximum sub-array sum, and maximum sub-arra... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import os
import argparse
from copy import deepcopy
import bibtexparser
from bibtexparser.bparser import BibTexParser
from jinja2 import Environment, FileSystemLoader
from auxfun import *
PATH = os.getcwdu()
# Create command line arguments parser
parser = argparse.Argumen... |
# coding=utf-8
# Copyright (c) 2017,2018, F5 Networks, 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... |
import sys
from com.l2scoria.gameserver.datatables import SkillTable
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "125_IntheNameofEvilPart1"
# NPCs
MUSHIKA = 32114
... |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# Some utils for the skin
# -----------------------------------------------------------------------
# $Id$
#
# Notes:
# Todo:
#
# -----------------------------------------------------------------------
# Freevo - A Ho... |
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseServerError, HttpResponseBadRequest, HttpResponseNotFound, HttpResponseForbidden
from django.views.generic import View
from django.views.generic.base imp... |
# coding: utf-8
# # Publications markdown generator for academicpages
#
# Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook, with the core python code in publications.py. Run either from the `markdown_g... |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... |
# Copyright (c) 2012 Santosh Philip
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
# =======================================================================
"""py.test fo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import logging
from sachi import six, fields
from sachi.query import QAll
from sachi.backends.base import SearchBackend
logger = logging.getLogger(__name__)
FIELD_MAPPINGS = {
fields.TextField: 'text_en',
fields.StringField: 'string... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#----------------------------------------------------------------------------
"""HTTP content negotiation application."""
__author__ = ('Lance Finn Helsten',)
__version__ = '0.0'
__copyright__ = """Copyright (C) 2014 Lance Finn Helsten"""
__license__ = """
Licensed und... |
#!/usr/bin/env python
"""
Annotation of standard bar chart with genetic constructs
"""
import dnaplotlib as dpl
from pylab import *
import matplotlib.pyplot as plt
__author__ = 'Bryan Der <bder@mit.edu>, Voigt Lab, MIT\n\
Thomas Gorochowski <tom@chofski.co.uk>, Voigt Lab, MIT'
__license__ = 'MIT'... |
# Bob build tool
# Copyright (C) 2017 Jan Klötzke
#
# SPDX-License-Identifier: GPL-3.0-or-later
from ..audit import Audit
from ..errors import BobError
from ..utils import binStat, asHexStr, infixBinaryOp
import argparse
import gzip
import json
import os, os.path
import pickle
import pyparsing
import re
import sqlite... |
#emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See the COPYING file distributed along with the PTSA package for the
# copyright and license terms.
#
### ### ### ### ### ### ### #... |
#!/usr/bin/env python
'''
author: Kyle Wendt <kylewendt@gmail.com>
copyright: 2015 Kyle Wendt
License: GPL v3
'''
def main():
import argparse, textwrap
from numpy import arange, array, sqrt
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=tex... |
from __future__ import absolute_import, division, print_function
from collections import OrderedDict, defaultdict
import contextlib
import fnmatch
import hashlib
import json
from locale import getpreferredencoding
import libarchive
import logging
import logging.config
import mmap
import operator
import os
from os.path... |
"""
Test for LMS courseware app.
"""
from textwrap import dedent
from unittest import TestCase
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
import mock
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.tests.helpers import LoginEnrollmentTest... |
# To Do
# Other class Scenarii: run several AvgSimulation with different configurations (Attributes)
# Ideally, be able to pass the logic of the decision tree as a parameter to the simulation so that we can test several rotations
# Also, program to read a gearset from a file, reference the stats on that ... |
# -*- coding: utf-8 -*-
"""
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER
Copyright 2016 LiJie, lj201112@163.com
Mineral Formula Calculation 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, eit... |
import argparse
import sys
__author__ = 'buchholb'
parser = argparse.ArgumentParser()
parser.add_argument('--nt',
type=str,
help='n-triple file.',
required=True)
def writeNtFileToStdout(nt):
for line in open(nt):
cols = line.strip('\n').split(... |
# Copyright (C) Mesosphere, Inc. See LICENSE file for details.
import copy
import logging
import time
import pytest
import requests
from generic_test_code.common import ping_mesos_agent, verify_header
from mocker.endpoints.marathon import (
SCHEDULER_APP_ALWAYSTHERE,
SCHEDULER_APP_ALWAYSTHERE_DIFFERENTPORT,
... |
# -*- coding: utf-8 -*-
from pkg_resources import DistributionNotFound, get_distribution
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
__version__ = None
__license__ = 'Apache 2.0'
import cherrypy
import functools
import logging
import loggi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# dependencies:
# - https://github.com/python-telegram-bot/python-telegram-bot
# - https://github.com/dsoprea/PyInotify
#
# similar project:
# - https://github.com/FutureSharks/rpi-security/blob/master/bin/rpi-security.py
#
# - todo:
# - configurable log file path
# ... |
# LICENSE
#
# Copyright (c) 2010-2017, GEM Foundation, G. Weatherill, M. Pagani,
# D. Monelli.
#
# The Hazard Modeller's Toolkit 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 ... |
import asyncio, aiohttp, json
def setup(bot):
# Not a cog
pass
async def async_post_json(url, data = None, headers = None):
async with aiohttp.ClientSession(headers=headers) as session:
async with session.post(url, data=data) as response:
return await response.json()
async def as... |
"""Hermitian conjugation."""
from sympy import Expr, sympify, Add, Mul, Matrix, Pow
from sympy.physics.quantum.qexpr import QExpr
from sympy.physics.quantum.matrixutils import (
numpy_ndarray, scipy_sparse_matrix, matrix_dagger
)
__all__ = [
'Dagger'
]
class Dagger(Expr):
"""General Hermitian conjugate... |
'''
Created on Aug 30, 2013
@author: novpa01
'''
import logging
import sys
import importlib
from mmupdater.Settings import Settings
from mmupdater.UserError import UserError
from mmupdater.MMexDb import MMexDb
from mmupdater.CategoryAssigner import CategoryAssigner
# Parse settings file
settings = Settings('settings... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Martin Raspaud
# Author(s):
# Martin Raspaud <martin.raspaud@smhi.se>
# 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, eit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@author: Joseph
@email:liseor@gmail.com
Created on 2012-7-20
'''
from riakClient.document import Document
from config.settings import globalSetting
from models.thumb import Thumb
class Board(Document):
bucket_name = globalSetting['boardBucket']
data = {
... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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
... |
# -*- coding: utf-8 -*-
#
# mimesis documentation build configuration file, created by
# sphinx-quickstart on Fri May 28 12:50:21 2010.
#
# 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.
#
# All... |
from __future__ import print_function, division
import os,unittest
from pyscf.nao import tddft_iter
from pyscf.nao.m_comp_spatial_distributions import spatial_distribution
import h5py
import numpy as np
dname = os.path.dirname(os.path.abspath(__file__))
Ha = 27.211386024367243
td = tddft_iter(label='water', iter_broa... |
# Copyright (C) 2014 Peter Feiner
import argparse
import sys
import os
import signal
from . import record
from . import report
SIGNALS = {}
for name in dir(signal):
if name.startswith('SIG') and not name.startswith('SIG_'):
SIGNALS[name] = getattr(signal, name)
def parse_signal(string):
if string ... |
#!/usr/bin/env python
"""
rubrik - Uses Rubrik REST API to get summary of performance stats.
API Explorer: https://rubrik/docs/v1
Internal API Explorer: https://rubrik/docs/internal/playground
NOTE: These REST API calls are now considered INTERNAL, so if history is any guide, you can
expect them to break each ti... |
#
# rpcserver.py
#
# Copyright (C) 2008,2009 Andrew Resch <andrewresch@gmail.com>
#
# Deluge is free software.
#
# You may 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... |
import subprocess
import yaml
try:
# Python3 imports
from unittest import mock
from unittest.mock import patch
except ImportError:
# Python2 imports
from mock import patch
import mock
from common import PromotionError
from dlrn_hash import DlrnCommitDistroHash, DlrnHash
from test_unit_fixture... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace
from caffe2.python.core import CreatePythonOperator
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given
... |
#!/usr/bin/python
from PyQt4 import QtGui
from PyQt4 import QtCore
import time
import sys
import math
import myGui
import functions
import SocketServer
import threading
import socket
import random
import parameters
import datetime
from collections import deque
params=parameters.getParams()
socket.setdefaulttimeout(2)
... |
""" Core classes. """
from sklearn.externals.joblib import Parallel, delayed
from sklearn.model_selection import cross_val_score, cross_val_predict
from sklearn.model_selection import GridSearchCV
from sklearn.metrics.scorer import check_scoring
from sklearn.pipeline import Pipeline
from sklearn.base import Transform... |
#!/usr/bin/python
#
# Copyright 2014 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 b... |
import os
import json
import shutil
from pathlib import Path
from subprocess import call
# The changes in this pull request change the interface/arguments to
# the autograding scripts, thus it requires that all gradeables be
# rebuilt/recompiled
def up(config):
# ================================================... |
from django.test import TestCase
from casexml.apps.case.mock import CaseFactory, CaseIndex, CaseStructure
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from casexml.apps.case.xform import get_extensions_to_close
from casexml.apps.phone.tests.utils import create_restore_user
from corehq.apps.dom... |
# coding=utf-8
"""DockWidget test.
.. note:: 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) any later version.
"""
__author__ = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
compress and decompress data using zlib.
"""
__version__ = "0.0.1"
__author__ = "Sanhe Hu"
__license__ = "MIT"
import sys
import types
import zlib
import base64
import pickle
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY3:
string_types = ... |
"""Conditional module is the xmodule, which you can use for disabling
some xmodules by conditions.
"""
import json
import logging
from lazy import lazy
from lxml import etree
from pkg_resources import resource_string
from xmodule.x_module import XModule
from xmodule.modulestore import Location
from xmodule.seq_module... |
# -*- coding: utf-8 -*-
u"""
检查FlexiNS 各个CPU 单元状态
- 检查指令:
ZUSI:COMP;
该指令列出当前的CPU 单元状态情况。
"""
import re,sys,time
from libs.checker import ResultInfo
from libs.checker import CheckStatus
from libs.infocache import shareinfo
from libs.log_spliter import LogSpliter ,LOG_TYPE_FLEXI_NS
__author__ = 'OuYan... |
# Copyright 2000-2010 Michael Hudson-Doyle <micahel@gmail.com>
# Antonio Cuni
# Armin Rigo
#
# All Rights Reserved
#
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose is hereby granted without fe... |
# coding:utf-8
'''
Created on 2017/12/1.
@author: chk01
'''
from class_four.week_four.NST.nst_utils import *
import tensorflow as tf
import scipy
STYLE_LAYERS = [
('conv1_1', 0.0),
('conv2_1', 0.1),
('conv3_1', 0.1),
('conv4_1', 0.3),
('conv5_1', 0.5)]
def gram_matrix(A):
return tf.matmul(A,... |
from django.db.models import signals
from celery_haystack.indexes import CelerySearchIndex as BaseCelerySearchIndex
from crate.web.packages.models import Package, Release, ReleaseFile
class PackageCelerySearchIndex(BaseCelerySearchIndex):
# We override the built-in _setup_* methods to connect the enqueuing
... |
import csv
import datetime
import importlib
import sys
from abc import abstractmethod
from collections import defaultdict
from typing import Dict, List, Set
import numpy as np
import pandas as pd
from dateutil import relativedelta as rdelta
import logging
from functools import partial
from xlrd import xldate_as_tupl... |
from MySQLdb import escape_string
from optparse import OptionParser
import sys
import pickle, os
from math import sqrt
from scipy.sparse import coo_matrix, csr_matrix, lil_matrix
from numpy import zeros, array, matrix
import numpy as np
import datetime, random
from collections import Counter
import heapq, operator
#s... |
# -*- coding: utf-8 -*-
from __future__ import division
from numpy import datetime64, maximum as max_, minimum as min_, round as round_, timedelta64
from ....base import * # noqa analysis:ignore
from .base import apply_bareme_for_relevant_type_sal
class jei_date_demande(Variable):
column = DateCol(default = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import math
import numpy as np
from koheron import command
class AdcDacBram(object):
def __init__(self, client):
self.client = client
self.dac_size = self.get_dac_size()
self.dac = np.zeros((2, self.dac_size))
self.adc_size... |
# Copyright 2018 The trfl 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 law... |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.contrib.contenttypes.models import ContentType
from geonode.base.models import TopicCategory
from geonode.layers.models import Layer
from geonode.maps.models import Map
from geonode.documents.models import Document
fro... |
# 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 agreed to in writing, ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('firestation', '0042_firedepartment_owned_tracts_geom'),
]
sql = """
CREATE OR REPLACE FUNCTION department_fts_document(integer) RET... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestC... |
# -*- coding: utf-8 -*-
from flask import Flask, render_template, request
import missing
app = Flask(__name__)
# take in names from datainput.html form
# run massagenames (implicitly chunks into 50 titles per request) and leftout
# return result to user in results.html form
def onWikipedia(names, lang):
names =... |
import json
import os
import re
import lxml.etree as et
from snorkel.utils import corenlp_cleaner
directory = os.path.abspath(os.path.dirname(__file__))
# Load IPython display functionality libs if possible i.e. if in IPython
try:
from IPython.core.display import display_html, HTML, display_javascript, Javascript
e... |
#!/usr/bin/env python
# filename: sequence.py
#
# Copyright (c) 2015 Bryan Briney
# License: The MIT license (http://opensource.org/licenses/MIT)
#
# 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 Soft... |
import io
import os
import re
import tempfile
from unittest import TestCase
from ruamel import yaml as ryaml
from shanghai.config import Configuration, NamedConfig, ConfigurationError
SAMPLE_YAML = '''\
# set global logging level
logging:
level: INFO
networks:
GLOBAL:
nick: TestBot
user: Shanghai
r... |
"""
Commands for Bot and command related helper functions.
"""
from logbot.config import settings
def give_help():
help_text = "Available commands are: "
for command in sorted(COMMANDS.iterkeys()):
help_text += command + ", "
help_text = help_text[:-2] + ". Syntax: '!give <nick> <command>' or !<c... |
# 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 absolute_import
import cgi
import logging
import urllib
import urlparse
from django.conf import settings
from django.http import (HttpResponse, HttpResponseRedirect,
HttpResponseNotAllowed, HttpResponseBadRequest)
from django.utils.translation import ugettext as _
from... |
# -*- coding: utf-8 -*-
#
# PUG documentation build configuration file, created by
# sphinx-quickstart on Sat Apr 11 17:46:58 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.
#
# All c... |
from sfm.settings.common import *
import tempfile
import os
DATABASES = {
# for unit tests
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'testdb'
}
}
SFM_DB_DATA_DIR = os.path.join(tempfile.gettempdir(), "test-data")
SFM_MQ_DATA_DIR = os.path.join(tempfile.gettempdir(), "tes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.