content stringlengths 4 20k |
|---|
""" Fast approximation for k-component structure
"""
# Copyright (C) 2015 by
# Jordi Torrents <<EMAIL>>
# All rights reserved.
# BSD license.
import itertools
import collections
import networkx as nx
from networkx.exception import NetworkXError
from networkx.utils import not_implemented_for
from networkx... |
import re
from typing import List
import string
from qanta import qlogging
from nltk import word_tokenize
from sklearn.model_selection import train_test_split
from qanta.datasets.abstract import TrainingData
log = qlogging.get(__name__)
ftp_patterns = {
"\n",
", for 10 points,",
", for ten points,",
... |
'''
Created on Feb 14, 2016
@author: Wuga
'''
import network
import data
import numpy as np
import matplotlib.pyplot as plt
initial_setting = {
"inputs_N" : 2,
"layers" : [ (100, network.ReLU),(1, network.Sigmoid)],
"weights_L" : -0.1,
"weights_H" : 0.1... |
import pytest
from mitmproxy import options
from mitmproxy.addons import command_history
from mitmproxy.test import taddons
from mitmproxy.tools.console.commander import commander
@pytest.fixture(autouse=True)
def commander_tctx(tmpdir):
# This runs before each test
dir_name = tmpdir.mkdir('mitmproxy').dirna... |
from wsgi_graphql import wsgi_graphql
from wsgiref.simple_server import make_server
from webob.dec import wsgify
from webob.exc import HTTPNotFound
from webob.static import DirectoryApp, FileApp
from .schema import StarWarsSchema
def server():
graphql = wsgi_graphql(StarWarsSchema)
static = DirectoryApp('buil... |
"""Change OpVariable (of Function storage class) to registers.
This pass promotes the OpVariable that only are accessed by OpLoad and
OpStore instructions.
The pass implementation naively inserts a OpPhi instruction at each join point,
and promotes the loads and stores as it iterates through the function.
This pass ... |
# -*- coding: utf-8 -*-
"""Package tests."""
#
# (C) Pywikibot team, 2007-2020
#
# Distributed under the terms of the MIT license.
#
from __future__ import (absolute_import, division,
print_function, unicode_literals)
__all__ = (
'requests', 'unittest', 'TestRequest', 'patch_request', 'unpa... |
""" Common compiler level utilities for typed dict and list. """
import operator
import warnings
from llvmlite import ir
from llvmlite.llvmpy.core import Builder
from numba.core import types, cgutils
from numba.core import typing
from numba.core.registry import cpu_target
from numba.core.typeconv import Conversion
f... |
# -*- coding: utf-8 -*-
import inspect
from numbers import Number
import numpy as np
from ..constants import neutron_mass, hbar
from ..crystal import Sample
from ..energy import Energy
from .exceptions import AnalyzerError, MonochromatorError, ScatteringTriangleError
class _Dummy(object):
r"""Empty class for co... |
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .. import MatchesFilterBase
#----------------------------------... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'InformationPointer'
db.create_table('lizard_levee_informationpointer', (
('id'... |
import numpy as np
def write_monte(spec, rslt):
""" Write out results to table.
"""
num_evals = rslt['num_evals']
num_steps = rslt['num_steps']
points = rslt['points']
stat = rslt['rmse']
# Write out information.
fname = 'table_4.' + str(spec + 1) + '.txt'
with open(fname, 'w') as... |
#!/usr/bin/env python
"""Abstract Datastore Input Reader Test Helper for the map_job API."""
import os
import unittest
from google.appengine.api import datastore_types
from google.appengine.api import namespace_manager
from google.appengine.datastore import datastore_stub_util
from google.appengine.ext import key_rang... |
import logging
import humanfriendly
import celery
from celery.utils.log import get_task_logger
import api.files.services as file_ctrl
import api.scans.services as scan_ctrl
import config.parser as config
from irma.common.base.exceptions import IrmaDatabaseError, IrmaFileSystemError
import api.common.ftp as ftp_ctrl
... |
from spack import *
class Neovim(CMakePackage):
"""NeoVim: the future of vim"""
homepage = "http://neovim.io"
url = "https://github.com/neovim/neovim/archive/v0.2.0.tar.gz"
version('0.3.1', '5405bced1c929ebc245c75409cd6c7ef')
version('0.3.0', 'e5fdb2025757c337c17449c296eddf5b')
version(... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"""Move notes from the CorrectionsAdditionsComments field to definitions with role 'Private Note'"""
for gloss... |
import vim
class ConqueSole(Conque):
window_top = None
window_bottom = None
color_cache = {}
color_mode = None
color_conceals = {}
buffer = None
# counters for periodic rendering
buffer_redraw_ct = 0
screen_redraw_ct = 0
# **************************************************... |
"""Test replication of commands
"""
import sys
sys.path[0:0] = [""]
import pymongo
from mongo_connector import errors
from mongo_connector.command_helper import CommandHelper
from mongo_connector.doc_managers.doc_manager_base import DocManagerBase
from mongo_connector.locking_dict import LockingDict
from mongo_conn... |
import toolz
import deap.gp
import itertools
import numpy as np
def mutuniform(pset, **kwargs):
"""Factory for mutuniform
"""
min_ = kwargs.get("min_", 0)
max_ = kwargs.get("max_", 2)
expr_mut = toolz.partial(deap.gp.genFull, min_=min_, max_=max_)
mutate = toolz.partial(deap.gp.mutUniform, exp... |
import _lxc
import os
import subprocess
import time
default_config_path = _lxc.get_global_config_item("lxc.lxcpath")
get_global_config_item = _lxc.get_global_config_item
version = _lxc.get_version()
class ContainerNetwork(object):
props = {}
def __init__(self, container, index):
self.container = con... |
"""Group models."""
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group as AuthGroup, Permission
from django.core.cache import cache
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.db imp... |
import numpy as np
import scipy.sparse as sparse
import igl
def p2e(m):
if isinstance(m, np.ndarray):
if m.dtype.type == np.int32:
return igl.eigen.MatrixXi(m)
elif m.dtype.type == np.float64:
return igl.eigen.MatrixXd(m)
raise TypeError("p2e only support dtype float... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('bots', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Kudos',
fields=[
... |
from datetime import timedelta
from zipline.algorithm import TradingAlgorithm
from zipline.utils.api_support import api_method
from zipline.utils.events import StatelessRule, _build_offset
import numpy as np
from powerline.utils.tradingcalendar_epex import get_auctions
from powerline.exchanges.epex_exchange import Ep... |
"""
Script for building the example.
Usage:
python setup.py py2app
"""
from setuptools import setup
from itertools import imap, chain
import glob
import os, sys
try:
set
except NameError:
from sets import Set as set
NAME = 'wxGlade'
VERSION = '0.3.4'
WXDIR = '%s-%s' % (NAME, VERSION)
# these are files an... |
#!/usr/bin/python
import urllib, json, subprocess, time, sys, getopt
def getplaylist(playlistid):
apikey = 'AIzaSyA7s-mBPBU5snEKPZ7CAuLwIuvGa6hRGyc'
inp = urllib.urlopen(r'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId={0}&key={1}&maxResults=50'.format(playlistid, apikey))
resp... |
#!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL
from youtube_dl.extractor import (
YoutubePlaylistIE,
YoutubeIE,
)
cla... |
'''
Created on Feb 28, 2014
@author: Damon Cathey
'''
import unittest
from autooam.cluster.cluster import Cluster
from emtools.cluster.configspec import ConfigSpec
from autooam.cluster.clustermgr import ClusterMgr
from emtools.cluster.playbookinstall import PlaybookInstall
import json
import test_common
import emtools... |
#!/usr/bin/python
# Nagios Script written by Johan Guldmyr @ CSC 2015 to check if anybody has used "shred".
import subprocess # run curler
import json # parse output from curler
import sys # control exit code
import os # check if curler exist
import optparse # parse arguments
import datetime # measure execution time
... |
from flask.ext.sqlalchemy import SQLAlchemy
from urllib.request import urlopen
from urllib.parse import urlencode
from website import app
import codecs, json
db = SQLAlchemy(app)
def get_steam_userinfo(steam_id):
options = {
'key': app.config['STEAM_API_KEY'],
'steamids': steam_id
}
url ... |
# -*- coding: utf-8 -*-
"""Test for tmuxp Pane object.
tmuxp.tests.pane
~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import, division, print_function, \
with_statement, unicode_literals
import unittest
import logging
from . import t
from .helpers import TmuxTestCase
logger = logging.getLogger(__name__... |
from odoo import fields
from odoo.tests.common import TransactionCase
class TestCalendar(TransactionCase):
def setUp(self):
super(TestCalendar, self).setUp()
self.CalendarEvent = self.env['calendar.event']
# In Order to test calendar, I will first create One Simple Event with real data
... |
class Signal(object):
def __init__(self):
self.receivers = []
def connect(self, sender, handler):
self.receivers.append((sender, handler))
def disconnect(self, sender, handler):
self.receivers.remove((sender, handler))
def send(self, instance):
for sender, handler in ... |
#!/usr/bin/python
import sys, getopt
import xmlrpclib
'''
host = raw_input('Enter openerp host name : ')
port = raw_input('Enter openerp host port : ')
dbname = raw_input('Enter database name : ')
if dbname == 'metro_production':
print('Can not perform operation on this database')
sys.exit(0)
user... |
#!/usr/bin/env python
""" load uhcsdb metadata from sqlite database into pandas dataframe """
import sys
import numpy as np
import pandas as pd
from contextlib import contextmanager
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker, contains_eager
sys.path.append('.')
from uh... |
import os
from pyembed.core.render import PyEmbedRenderer
from pkg_resources import resource_string
from pystache import Renderer
class MustacheRenderer(PyEmbedRenderer):
"""Renders OEmbed responses using Mustache templates."""
def __init__(self, template_dir):
self.template_dir = template_dir
... |
__author__ = 'walter'
from pymorm import MongoObject, MongoObjectMeta, Document
from pymongo import MongoClient, ASCENDING, DESCENDING
from pymongo.cursor import Cursor
db = MongoClient("mongodb://localhost:27017/pymorm").get_default_database()
class Test(MongoObject):
__metaclass__ = MongoObjectMeta
__col... |
from boto.resultset import ResultSet
from boto.ec2.elb.listelement import ListElement
class Alarm(object):
def __init__(self, connection=None):
self.connection = connection
self.name = None
self.alarm_arn = None
def __repr__(self):
return 'Alarm:%s' % self.name
def startEl... |
import json
import os
import tempfile
from exception.dagda_error import DagdaError
# Gets programming languages dependencies from docker image
def get_dependencies_from_docker_image(docker_driver, image_name, temp_dir):
# Init
filtered_image_name = image_name.replace(' ', '_').replace('/', '_').replace(':', '... |
from nova.compute import api as compute_api
from nova.compute import manager as compute_manager
from nova.servicegroup import api as service_group_api
from nova.tests.integrated.v3 import test_servers
class EvacuateJsonTest(test_servers.ServersSampleBase):
extension_name = "os-evacuate"
def test_server_evacu... |
class SetseboolError(Exception):
"""Raised when setting a SELinux boolean fails
:param failed: Dictionary mapping boolean names to intended values
to their intended values, for booleans that cound not be set
:param command: Command the user can run to set the booleans
The initialize... |
# -*- coding: utf-8 -*-
"""
adam.auth.py
~~~~~~~~~~~~
The auth class.
:copyright: (c) 2015 by Nicola Iarocci and CIR2000.
:license: BSD, see LICENSE for more details.
"""
from flask import current_app as app
from eve.auth import TokenAuth
from domain.user_accounts import key
class Auth(TokenAuth... |
""" Implementation of Eli Melaas' Landsat phenology algorithm
See:
Melaas, EK, MA Friedl, and Z Zhu. 2013. Detecting interannual variation in
deciduous broadleaf forest phenology using Landsat TM/ETM+ data. Remote
Sensing of Environment 132: 176-185.
"""
from __future__ import division
from datetime impo... |
import unittest
from jpb.tree import *
class TestAutoTree (unittest.TestCase):
class ValueTree (AutoTree):
def __init__ (self, default = None):
super (TestAutoTree.ValueTree, self).__init__ ()
self.value = default
class CountingTree (AutoTree):
def __init__ (self):
... |
"""
Tests for ajax view utilities.
"""
from django.template.response import TemplateResponse
from django.test import RequestFactory
from tests import case
class AjaxTest(case.TestCase):
"""Tests for ajax template-swapping view decorator."""
@property
def ajax(self):
"""The decorator-factory und... |
from flask import request, render_template, g
from flask.ext.oauthprovider import OAuthProvider
from bson.objectid import ObjectId
from models import ResourceOwner as User, Client, Nonce
from models import RequestToken, AccessToken
from utils import require_openid
class ExampleProvider(OAuthProvider):
@property
... |
from unittest import TestCase
import json.encoder
from json import dumps
from collections import OrderedDict
CASES = [
('/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'),
... |
import sys
import time
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import keras.backend as K
import numpy as np
from keras.callbacks import LambdaCallback, Callback
from cnnmodel import CNNModel
from text_to_vector import TextToVector
from utils import sample
if __name__ == '__main__':
par... |
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.Codec.Dirac import DiracDecoder
from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor
from Kamaelia.Util.RateFilter import MessageRateLimit
from Kamaelia.UI.Pygame.VideoOverlay import VideoOverlay
import sys
if len(sys.argv) != 2:
sys.stderr.write("U... |
"""
Tests for L{twisted.protocols.haproxy._parser}.
"""
from twisted.trial.unittest import SynchronousTestCase as TestCase
from twisted.test.proto_helpers import MemoryReactor
from twisted.internet.endpoints import (
_WrapperServerEndpoint, TCP4ServerEndpoint, TCP6ServerEndpoint,
UNIXServerEndpoint, serverFrom... |
"""Contains the classes which deal with the atoms.
Copyright (C) 2013, Joshua More and Michele Ceriotti
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 o... |
import datetime
from helpers import unittest, in_parse
import luigi
import luigi.interface
class DateTask(luigi.Task):
day = luigi.DateParameter()
class DateHourTask(luigi.Task):
dh = luigi.DateHourParameter()
class DateMinuteTask(luigi.Task):
dm = luigi.DateMinuteParameter()
class MonthTask(luigi.... |
import multiprocessing
import requests
import imghdr
import os
def _setupSession():
session = requests.Session()
session.header = { 'User-Agent': "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0","Accept-Encoding": "gzip, deflate, sdch"}
return session
# function to get one image spec... |
#!/usr/bin/env python
'''
these tables are generated from the STM32 datasheets for the
STM32F40x
'''
# additional build information for ChibiOS
build = {
"CHIBIOS_STARTUP_MK" : "os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk",
"CHIBIOS_PLATFORM_MK" : "os/hal/ports/STM32/STM32F4xx/platform.mk"
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... |
# encoding: utf-8
# 2008-2009 © Václav Šmilauer <<EMAIL>>
"""
Remote connections to woo: authenticated python command-line over telnet and anonymous socket for getting some read-only information about current simulation.
These classes are used internally in gui/py/PythonUI_rc.py and are not intended for direct use.
""... |
"""
django-guardian helper functions.
Functions defined within this module should be considered as django-guardian's
internal functionality. They are **not** guaranteed to be stable - which means
they actual input parameters/output type may change in future releases.
"""
from __future__ import unicode_literals
import ... |
"""
VCL driver
"""
import sys
import time
from libcloud.utils.py3 import xmlrpclib
from libcloud.common.types import InvalidCredsError, LibcloudError
from libcloud.compute.types import Provider, NodeState
from libcloud.compute.base import NodeDriver, Node
from libcloud.compute.base import NodeSize, NodeImage
class... |
from functools import wraps, partial
from ...utils.logging import logger
from ...constants import LOG_URL_MAX_LENGTH
def logging_dispatch_middleware(reporter, dispatch):
@wraps(dispatch)
async def enhanced(*args, **kwargs):
log = _log_factory(reporter)
log('Dispatching reporter with {} intel'.... |
from mongoWork import MongoWork
from flask import Flask, request, session, render_template, url_for, redirect, jsonify
from json import loads
app = Flask('lc-server')
app.secret_key = 'developerkey'
config = {}
mongo = None
@app.route('/', methods=['GET', 'POST'])
def index():
if session.get('logged') is not None:
... |
from contextlib import contextmanager
import itertools
import json
import os
import signal
from typing import Dict, List, Union, Undefined, Any, Tuple
from .exceptions import AdamaError
def location_of(filename):
return os.path.dirname(os.path.abspath(filename))
def interleave(a, b):
""" '+', [1,2,3] -> [... |
__author__ = 'Aaron Hosford'
import logging
import unittest
import xcs
from xcs.scenarios import MUXProblem, HaystackProblem
class TestXCS(unittest.TestCase):
def test_against_MUX(self):
scenario = MUXProblem(training_cycles=10000, address_size=3)
algorithm = xcs.XCSAlgorithm()
algorit... |
from typing import Any, Dict, TYPE_CHECKING
from . import VersionUpgrade21to22
if TYPE_CHECKING:
from UM.Application import Application
upgrade = VersionUpgrade21to22.VersionUpgrade21to22()
def getMetaData() -> Dict[str, Any]:
return {
"version_upgrade": {
# From ... |
"""
DEMO showing a 2 layer network learning XOR using backprop.
Note that this does not always converge!
"""
import backprop
import math
n_in=2
n_hid=2
n_out=1
# test the net and return an error estimate
def test_net(nn,training_in,training_out):
error=0.0
for x,target in zip(training_in,training_out):... |
"""Using os.exec*().
"""
__module_id__ = "$Id$"
#end_pymotw_header
import os
child_pid = os.fork()
if child_pid:
os.waitpid(child_pid, 0)
else:
os.execlp('ls', 'ls', '-l', '/tmp/') |
##@package interactionmodel
#@author Sebastien MATHIEU
import csv
from . import options
## Contains the options of the interaction model.
class InteractionModel:
## Constructor.
# @param filePath Optional path to the file with the parameters of the interaction model.
def __init__(self, filePath=None):
... |
import gtk
import gobject
import pango
import gpodder
_ = gpodder.gettext
from gpodder.gtkui.widgets import SpinningProgressIndicator
class ProgressIndicator(object):
# Delayed time until window is shown (for short operations)
DELAY = 500
# Time between GUI updates after window creation
INTERVAL = ... |
# encoding: utf-8
# 2009 © Václav Šmilauer <<EMAIL>>
"""
Module for 2d postprocessing, containing classes to project points from 3d to 2d in various ways,
providing basic but flexible framework for extracting arbitrary scalar values from particles/contacts
and plotting the results. There are 2 basic components: flatten... |
"""
Name: Ayush Kumar, Kaushik S Kalmady
Date: 5/10/2017
Ref : https://github.com/jakeret/tf_unet/blob/master/demo/demo_radio_data.ipynb
Visualizing processed data to know what the dataset looks like
Follow instructions in process_data.py and run it before you run this script.
This code requires th... |
# -*- coding: utf-8 -*-
# for datasets acquired with topspin > 2.1 (requires INF)
# scale F1 dimension to get unified scale for MQMAS/STMAS experiments
# the program rewrites BF1/SFO1/O1/SW/SF/OFFSET according to
# the apparent Larmor frequency of isotropic dimension
# Select the nucleus to use for indirect dimension
... |
from rest_framework import serializers as ser
from rest_framework import exceptions
from modularodm.exceptions import ValidationValueError
from framework.exceptions import PermissionsError
from website.models import Node
from api.base.serializers import LinksField, RelationshipField, DevOnly, JSONAPIRelationshipSerial... |
import numpy as np
from mockdt import (define_a_type,
leveltwomod,
use_a_type,
top_level)
a = define_a_type.Atype() # calls initialise()
a.rl = 3.0 # calls set()
assert(a.rl == 3.0)
a.vec[:] = 0. # calls get() then sets array data in place
assert(np.all(a.... |
import unittest
import IECore
import math
class SummedAreaOpTest( unittest.TestCase ) :
def test( self ) :
b = IECore.Box2i( IECore.V2i( 0 ), IECore.V2i( 1 ) )
y = IECore.FloatVectorData( [ 1, 2, 3, 4 ] )
i = IECore.ImagePrimitive( b, b )
i["Y"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpola... |
"""Model for languages."""
from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
'Language',
]
from sqlalchemy import Column, Integer, Unicode
from zope.interface import implementer
from mailman.database.model import Model
from mailman.interfaces.language... |
# -*- coding: utf-8 -*-
"""
Tests for static parts of Twitter package
"""
import os
import unittest
from nose import SkipTest
try:
import twython
except ImportError as e:
raise SkipTest("The twython library has not been installed.")
from nltk.twitter import Authenticate
class TestCredentials(unittest.TestC... |
from twisted.internet import defer, reactor
import allocation
import clone
import util
import sys
from logs import sonarlog
# Setup logging
logger = sonarlog.getLogger('controller')
def try_connecting(domain_configuration):
'''
Wait until a connection with domain's Relay service
could be established.
... |
######################################
#
# Nikolai Rozanov (C) 2017-Present
#
# <EMAIL>
#
#####################################
#
# This is a base file containing the base class for Kernels, which is not very exhaustive and concrete implementations of Kernels
#
import numpy as np
import tensorflow as tf
class... |
from django.apps import apps
from django.conf import settings
from django.core.management.base import BaseCommand
from share.tasks import BotTask
from share.models import ShareUser
from share.bot import BotAppConfig
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--all'... |
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
from app.ChatWidget import ChatWidget
from app.handlers.IrcHandler import IRChandler
from app.handlers.apiHandler import APIhandler
from app.core.ircPgpError import IrcPgpConnectionError
class ConnectionWidget(QtWidgets.QWidget):
ircHandler = None
apiHand... |
# -*- coding: utf-8 -*-
{
'!langcode!': 'my-mm',
'!langname!': 'မြန်မာ',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'%s %%{row} del... |
def include_operators(pg):
@pg.production("old_test : or_test")
@pg.production("old_test : old_lambdef")
def old_test(pack):
(level,) = pack
return level
@pg.production("testlist_safe : old_test comma old_test")
def testlist_safe(pack):
(old_test, comma, old_test2) = pack
... |
# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.decorators import register
from django.contrib.admin.filters import (
AllValuesFieldListFilter, BooleanFieldListFilter, ChoicesFieldListFilter,
DateFieldListFilter, Fiel... |
"""A converter from a V1 BERT encoder checkpoint to a V2 encoder checkpoint.
The conversion will yield an object-oriented checkpoint that can be used
to restore a TransformerEncoder object.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from... |
"""
# Requirements:
* Generate a service account key for your Google API credentials, then create environment variable GOOGLE_SPREADSHEET_CREDENTIALS.
- e.g export GOOGLE_SPREADSHEET_CREDENTIALS=/path/to/credentials.json.
# Environment Variable/s:
* GOOGLE_SPREADSHEET_CREDENTIALS = Your service account... |
"""Theme blueprint in order for template and static files to be loaded."""
import re
from flask import Blueprint, render_template, current_app, redirect, request
from hepdata_validator import LATEST_SCHEMA_VERSION, RAW_SCHEMAS_URL
from hepdata.version import __version__
blueprint = Blueprint(
'hepdata_theme',
... |
import sys
sys.path.insert(0, "../../python")
import numpy as np
import mxnet as mx
from lstm import LSTMState, LSTMParam, lstm, bi_lstm_inference_symbol
class BiLSTMInferenceModel(object):
def __init__(self,
seq_len,
input_size,
num_hidden,
num_... |
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.views.generic.date_based import archive_day
from django.views.generic.date_based import archive_month
from django.views.generic.date_based import archive_year
from django.views.generic.list_detail import object_detai... |
import beanstalkc
from sys import stdout, stderr
from json import dumps
from beanstalkc import Connection, Job
def catch_notfound(f):
"""A decorator to produce KeyErrors where necessary."""
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except beanstalkc.CommandFail... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
LrsPlugin
A QGIS plugin
Linear reference system builder and editor
-------------------
begin : 2017-5-29
copyright ... |
import re
import sys
import os
from pathlib import Path
from docutils import nodes
from docutils.statemachine import ViewList
from docutils.transforms import Transform
from docutils.parsers.rst import Directive, directives
from sphinx import addnodes
from sphinx.util.nodes import set_source_info, process_index_entry
s... |
"""
Copyright (C) 2017 kanishka-linux <EMAIL>
This file is part of kawaii-player.
kawaii-player 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 vers... |
"""Switch support for the Skybell HD Doorbell."""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import (
CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS)
import homeassistant.helpers.config_validation as cv
from . impor... |
"""
==============================================
Plot randomly generated classification dataset
==============================================
Plot several randomly generated 2D classification datasets.
This example illustrates the :func:`datasets.make_classification`
:func:`datasets.make_blobs` and :func:`datasets.... |
"""
Tests for DropShadowFrame wiget.
"""
from PyQt4.QtGui import (
QMainWindow, QWidget, QListView, QTextEdit, QHBoxLayout, QToolBar,
QVBoxLayout, QColor
)
from PyQt4.QtCore import Qt, QTimer
from .. import dropshadow
from .. import test
class TestDropShadow(test.QAppTestCase):
def test_drop_shadow_ol... |
#!/usr/bin/env python
# example toolbar.py
import pygtk
pygtk.require('2.0')
import gtk
class ToolbarExample:
# This method is connected to the Close button or
# closing the window from the WM
def delete_event(self, widget, event=None):
gtk.main_quit()
return False
# that's easy... w... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QAD Quantum Aided Design plugin
funzioni per undo e redo
-------------------
begin : 2014-04-24
copyright : iiiii
email ... |
# ICMP Plugin
#
#
"""
<plugin key="ICMP" name="Pinger (ICMP)" author="dnpwwo" version="3.1.1">
<description>
ICMP Pinger Plugin.<br/><br/>
Specify comma delimted addresses (IP or DNS names) of devices that are to be pinged.<br/>
When remote devices are found a matching Domoticz device is created in the De... |
"""
Factory for reading openssh configuration files: public keys, private keys, and
moduli file.
"""
import os, errno
from twisted.python import log
from twisted.python.util import runAsEffectiveUser
from twisted.conch.ssh import keys, factory, common
from twisted.conch.openssh_compat import primes
class OpenSSHF... |
"""
URL patterns for the views included in ``django.contrib.auth``.
Including these URLs (via the ``include()`` directive) will set up the
following patterns based at whatever URL prefix they are included
under:
* User login at ``login/``.
* User logout at ``logout/``.
* The two-step password change at ``password/c... |
"""
Serializers for the training assessment type.
"""
from django.core.cache import cache
from django.db import IntegrityError, transaction
from openassessment.assessment.data_conversion import update_training_example_answer_format
from openassessment.assessment.models import TrainingExample
from .base import RubricS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.