content stringlengths 4 20k |
|---|
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.comptool import TestManager, TestInstance, RejectResult
from test_framework.blocktools import *
import time
from test_framework.key import CECKey
from test_framework.script import CScript, SignatureHa... |
from spack import *
class RFnn(RPackage):
"""Cover-tree and kd-tree fast k-nearest neighbor search algorithms and
related applications including KNN classification, regression and
information measures are implemented."""
homepage = "https://cran.r-project.org/web/packages/FNN/index.html"
url ... |
"""empty message
Revision ID: 0d20f57adc67
Revises: ed657e16ce20
Create Date: 2016-10-25 00:21:27.423206
"""
# revision identifiers, used by Alembic.
revision = '0d20f57adc67'
down_revision = 'ed657e16ce20'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... |
import threading
import time
import json
import requests
from apiclient.discovery import build
from httplib2 import ServerNotFoundError
class VideoSource(threading.Thread):
def __init__(self, config, identifier):
threading.Thread.__init__(self)
self._config = config
self._identifier ... |
from quantum.openstack.common import cfg
from quantum.openstack.common import context as req_context
from quantum.openstack.common.gettextutils import _
from quantum.openstack.common import log as logging
from quantum.openstack.common import rpc
LOG = logging.getLogger(__name__)
notification_topic_opt = cfg.ListOpt(
... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
from django.utils.translation import ugettext_lazy as _
def tpl_control_icon(icon):
"""
function to produce control html icon
"""
return '<i class="fa %s icon-small"></i>' % (icon)
def get_common_campaign_status_url(id, status, status_link, STATUS_OF_CAMPAIGN):
"""
Helper to display campaign... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'batch.ui'
#
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
... |
"""Delete DAGs APIs."""
import logging
from sqlalchemy import or_
from airflow import models
from airflow.exceptions import DagNotFound
from airflow.models import DagModel, TaskFail
from airflow.models.serialized_dag import SerializedDagModel
from airflow.utils.session import provide_session
log = logging.getLogger(... |
os = "7374727563743b75696e7420626653697a653b75696e7420626652657365727665643b75696e742062664f6666426974733b"
os += "75696e7420626953697a653b696e7420626957696474683b696e742062694865696768743b7573686f7274206269506c616e"
os += "65733b7573686f7274206269426974436f756e743b75696e74206269436f6d7072657373696f6e3b75696e74206269... |
from propresenter_lib.slide import Slide, Slide_Color
from propresenter_lib.presentation import Presentation
from propresenter_lib.playlist import Playlist
from propresenter_lib.transition import Transition, Slide_Transition
from propresenter_lib.control_next import ControlNext
from propresenter_lib.media_cue import Me... |
# -*- coding: utf-8 -*-
"""
Contains the logic for requesting pieces, as well as that for writing them to disk.
"""
__all__ = ['PieceRequester']
import asyncio
import dataclasses
import logging
from collections import defaultdict
from typing import Optional
import bitstring
from .errors import NonSequentialBlockEr... |
import logging
from util import *
import inspect, sys
from collections import OrderedDict
# customizable rules for calculating event scoring
def get_rule_sets():
return OrderedDict(inspect.getmembers(sys.modules[__name__],lambda x: inspect.isclass(x) and issubclass(x,DefaultRules)))
##############################... |
# ################################################ MODULE INFO ###################################################
# Email: <EMAIL>
#
# The module contains functions to process the outputs from network devices, or other python functions that help with
# processing data in our scripts.
#
#
# ######################... |
from django.db import models
class CommonSettings(models.Model):
name = models.CharField(max_length=500, unique=True)
number = models.IntegerField(null=True, default=None)
text = models.CharField(max_length=500, null=True, default=None)
def __str__(self):
return "%s" % self.name
class Job(m... |
import click
from sqlalchemy import create_engine
from kamcli.ioutils import ioutils_dbres_print
from kamcli.cli import pass_context
from kamcli.iorpc import command_ctl
@click.group(
"dispatcher",
help="Manage dispatcher module (load balancer)",
short_help="Manage dispatcher module",
)
@pass_context
def ... |
from msrest.serialization import Model
class DataLakeAnalyticsAccountUpdateParameters(Model):
"""The parameters that can be used to update an existing Data Lake Analytics
account.
:param tags: Resource tags
:type tags: dict
:param max_degree_of_parallelism: the maximum supported degree of
pa... |
from django.db.models import Q
from weblate.trans.management.commands import WeblateLangCommand
class Command(WeblateLangCommand):
help = 'fixes flags for units'
def handle(self, *args, **options):
units = self.get_units(*args, **options).filter(
Q(has_suggestion=True) |
Q(has... |
# -*- coding: utf-8 -*-
import pytest
from cfme.infrastructure.provider import InfraProvider
from cfme.intelligence.reports.reports import CannedSavedReport
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.net import ip_address, resolve_hostname
from cfme.utils.providers import get_crud_... |
__revision__ = "$Revision$"
import logging
import numpy
from .calculationmethod import Method
class Population(Method):
"""A base class for all population-type methods."""
def __init__(self, data, progress=None, \
loglevel=logging.INFO, logname="Log"):
# Call t... |
XXX XXX XXXXXXX
XXXXXXXXX XXX XXXXXXXXX XXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XX XXXXXX XXXXXXXX XXXX XX XXXXXXX XX XXX XXXXXX XXXXXXXXX X XXXX
XX XXXX XXXXXXXX XXX XXXXXXXXXX XXXXXXXXXXXXX XXXXX XXXX XXXXXXXXXXXX XX XXXX
XX XXX XXXXXXXX XXXXXXX XXXXXXXXXXXX XXXXXXXXX XXXXXXX XXXXXXXXXX XXX XXXXXX
XX XXXX ... |
from __future__ import unicode_literals
from collections import Mapping
from pyLibrary.debugs.logs import Log
from pyLibrary.dot import wrap, set_default, split_field
from pyLibrary.dot.dicts import Dict
from pyLibrary.queries import containers
type2container = Dict()
config = Dict() # config.default IS EXPECTED TO... |
""":Topic: **convert SIF format to ASP sign consistency**"""
from __future__ import print_function
from cno.io.sif import SIF
__all__ = ["SIF2ASP"]
class SIF2ASP(SIF):
"""Class to convert a SIF file into a ASP sign consistency format
::
>>> from cno import SIF2ASP
>>> from cno import cnoda... |
import logging
from prompt_toolkit.keys import Keys
from prompt_toolkit.key_binding.manager import KeyBindingManager
from prompt_toolkit.filters import Condition
_logger = logging.getLogger(__name__)
def pgcli_bindings(get_vi_mode_enabled, set_vi_mode_enabled):
"""
Custom key bindings for pgcli.
"""
a... |
import lasagne
import lasagne.layers as L
import lasagne.nonlinearities as NL
import lasagne.init as LI
from rllab.core.lasagne_powered import LasagnePowered
from rllab.core.lasagne_layers import batch_norm
from rllab.core.serializable import Serializable
from rllab.misc import ext
from rllab.policies.base import Polic... |
import mock
from django.db import transaction
from django.test import RequestFactory
from django.http import Http404
from nose import tools as nt
from datetime import datetime, timedelta
from website.project.model import Comment
from admin.common_auth.logs import OSFLogEntry
from admin.spam.forms import ConfirmForm,... |
"""create inventory table
Revision ID: 09f196622a3f
Revises: 7975b7f0f792
Create Date: 2017-02-12 12:37:57.799877
"""
# revision identifiers, used by Alembic.
revision = '09f196622a3f'
down_revision = '7975b7f0f792'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
import zun
... |
#!/usr/bin/env python3
import os
import pickle
runtime = True
#Welcome message
print("A simple todo list written in Python\n ")
todoList = []
while runtime:
print("You can choose between the following options:\n 1 Open existing list\n 2 Create a new list\n 3 Exit")
ch1 = int(input("Your choice: "))
... |
class Trim(Service):
def __init__(self, apikey=None, username_pass=None):
self.apikey = apikey
self.username_pass = username_pass
def shrink(self, bigurl, custom=None, searchtags=None, privacycode=None,
newtrim=False, sandbox=False):
parameters = {}
parameters['... |
import psycopg2
# connection parameters to NODA DB official db
pg_host = r'<host>'
pg_user = r'<username>'
pg_pwd = '<password>'
pg_db = r'<db>'
pg_port = r'<port>'
try:
con = psycopg2.connect(
"host={} dbname={} user={} password= {} port={}"
.format(pg_host, pg_db, pg_user, pg_pwd, pg_port))
... |
__author__ = 'byt3smith'
#
# Purpose: Import module for pulling and formatting
# all necessary intelligence feeds
#
from .tools import *
from re import search
ip_addr = regex('ip')
hostname = regex('domain')
class FeedModules():
## Malc0de
def malc0de_update(self):
iocs = gather('http://malc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
---------------------------------------------------------------------------------------------------
strip_basic
DOCUMENT ME!
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 F... |
"""
kombu.common
============
Common Utilities.
"""
from __future__ import absolute_import
import os
import socket
import threading
import uuid as _uuid
from collections import deque
from contextlib import contextmanager
from functools import partial
from itertools import count
from .entity import Exchange, Queue
... |
#!/usr/bin/env python
"""
================================================
ABElectronics ADCDAC Pi 2-Channel ADC, 2-Channel DAC | DAC Speed Demo
run with: python demo_dacspeed.py
================================================
this demo will output a 3.3V square wave, testing the maximum speed of the DAC
"""
from _... |
import sigrokdecode as srd
class SamplerateError(Exception):
pass
class Decoder(srd.Decoder):
api_version = 3
id = 'em4100'
name = 'EM4100'
longname = 'RFID EM4100'
desc = 'EM4100 100-150kHz RFID protocol.'
license = 'gplv2+'
inputs = ['logic']
outputs = ['em4100']
channels = (... |
import numpy as np
from skimage import util
from bptomo import build_projection_operator
import os
from sklearn.mixture import GMM
from scipy import optimize
from math import exp
from skimage import morphology
def _balance_probs(x, weights, means, sigmasq):
"""
Difference of probabilty of two Gaussians
"""... |
"Demonstrate that SRE xml pickling works --fpm "
import UserList, UserDict, sys
from types import *
import gnosis.xml.pickle as xml_pickle
import re, StringIO
from gnosis.xml.pickle.util import setParanoia, getParanoia
import funcs
funcs.set_parser()
class foo_class:
def __init__(self):
pass
def checkfo... |
"""Support for views."""
import asyncio
import json
import logging
from aiohttp import web
from aiohttp.web_exceptions import (
HTTPBadRequest, HTTPInternalServerError, HTTPUnauthorized)
import voluptuous as vol
from homeassistant import exceptions
from homeassistant.const import CONTENT_TYPE_JSON
from homeassist... |
# # An Introduction to Interactive Programming in Python (Part 1)
# Practice exercises for logic and conditionals
# 1. is_even
def is_even(number):
if number%2 == 0:
return True
else:
return False
# Testing
print "1 is even:", is_even(1)
print "2 is even:", is_even(2)
# 2. is_cool
def... |
#!/usr/bin/env python
'''
Meta data for the MN elections.
'''
from datetime import date
# The name of the variable is important. Each entry in the dict
# is for an election. The key is arbitrary but will be used by the
# command line to scrape a specific election. The utility tool will try
# to use the newest el... |
#!/usr/bin/env python
#coding=utf-8
import sys
import argparse
import ConfigParser
from FlushBlogThread import FlushBlogThread
from FlushBlog import FlushBlog
if __name__ == "__main__" :
# 重新设置编码集
reload(sys)
sys.setdefaultencoding( "utf-8" )
sys.setrecursionlimit(1000000)
if len(sys.argv... |
"""Fetch list of popular user-agents.
The script is based on a gist posted by github.com/averrin, the output of this
script is formatted to be pasted into configtypes.py.
"""
import requests
from lxml import html # pylint: disable=import-error
def fetch():
"""Fetch list of popular user-agents.
Return:
... |
from pygranule.file_access_layer import FileAccessLayer, FileAccessLayerError
import paramiko
import stat
class SSHFileAccessLayer(FileAccessLayer):
__implements__ = (FileAccessLayer,)
def __init__(self, hostname, username, password=None, port=22):
FileAccessLayer.__init__(self)
# host in... |
#!/usr/bin/env python
"""models.py
Udacity conference server-side Python App Engine data & ProtoRPC models
$Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $
created/forked from conferences.py by wesc on 2014 may 24
"""
__author__ = '<EMAIL> (Wesley Chun)'
import httplib
import endpoints
from protorpc import me... |
import importlib
from django.conf import settings # noqa
from django.core.exceptions import ImproperlyConfigured
from account.languages import LANGUAGES
from account.timezones import TIMEZONES
from appconf import AppConf
def load_path_attr(path):
i = path.rfind(".")
module, attr = path[:i], path[i + 1:]
... |
import logging
from multiprocessing import Process, Queue
import os
from six import string_types
import sys
import time
from shellbot.channel import Channel
from shellbot.events import Message
from shellbot.i18n import _
from .base import Space
class LocalSpace(Space):
"""
Handles chat locally
This clas... |
import sys
from os import close, remove
from tempfile import mkstemp
import numpy as np
from BioExt.io import LazyAlignIO as AlignIO
from sklearn.svm import SVC
from sklmrmr import MRMR
from idepi.encoder import AminoEncoder, StanfelEncoder
from idepi.feature_extraction import SiteVectorizer
from idepi.labeledmsa... |
"""
Support for Dyson Pure Hot+Cool link fan.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.dyson/
"""
import logging
from homeassistant.components.dyson import DYSON_DEVICES
from homeassistant.components.climate import (
ClimateDevice, STA... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Float32MultiArray
from sensor_msgs.msg import Image, PointCloud2
import numpy
import cv
from cv_bridge import CvBridge
import code # FOR TESTING
#import roslib; roslib.load_manifest('pr2_python')
#from pr2_python import python_pointclouds
class CloudNumpy... |
import mock
from incuna_auth.middleware import permission_feincms
from incuna_auth.models import AccessStateExtensionMixin as AccessState
from .utils import RequestTestCase
class TestFeinCMSPermissionMiddleware(RequestTestCase):
middleware_class = permission_feincms.FeinCMSPermissionMiddleware
middleware_pat... |
__all__ = ['migrate']
import logging
import os
from gi.repository import Gio
import xl.collection
import xl.covers
logger = logging.getLogger(__name__)
def old_get_track_key(track):
"""
Get the db mapping key for a track
"""
album = track.get_tag_raw("album", join=True)
compilation = track... |
# coding: utf8
from __future__ import unicode_literals
STOP_WORDS = set(
"""
من
نحو
لعل
بما
بين
وبين
ايضا
وبينما
تحت
مثلا
لدي
عنه
مع
هي
وهذا
واذا
هذان
انه
بينما
أمسى
وسوف
ولم
لذلك
إلى
منه
منها
كما
ظل
هنا
به
كذلك
اما
هما
بعد
بينهم
التي
أبو
اذا
بدلا
لها
أمام
يلي
حين
ضد
الذي
قد
صار
إذا
مابرح
قبل
كل
وليست
الذين
لهذا
و... |
from debtcollector import removals
from keystoneclient import discover
from keystoneclient import httpclient
from keystoneclient import session as client_session
@removals.remove(message='Use keystoneclient.httpclient.HTTPClient instead',
version='1.7.0', removal_version='2.0.0')
class HTTPClient(ht... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a skeleton file that can serve as a starting point for a Python
console script. To run this script uncomment the following line in the
entry_points section in setup.cfg:
console_scripts =
fibonacci = algorithms.skeleton:run
Then run `python setup.py i... |
"""
NFCBeer
Usage:
nfcbeer.py client <id>
nfcbeer.py server
nfcbeer.py [-h | --help]
Options:
-h --help Shows help
"""
from docopt import docopt
import time
import RPi.GPIO as GPIO
import random
import MFRC522
import sys
import zmq
context = zmq.Context()
sock = context.socket(zmq.REQ)
sock.connect("tcp://127... |
import bpy
scn = bpy.context.scene
def ocultar_relationships():
#bpy.context.space_data.show_relationship_lines = False
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
area.spaces[0].show_relationship_lines = False
def deseleccionar_todo():
bpy.ops.object.select_all... |
"""
To run these doctests, install pytest and run:
$ py.test --doctest-modules pytest_doctest_test.py
Add `-s` option to enable print statements.
"""
from __future__ import unicode_literals
def make_file_factory(func_name, fake, result):
""" Return a simple function with parametrized doctest. """
def make_fi... |
from twisted.trial import unittest
from buildbot.process import results
from buildbot.steps import gitdiffinfo
from buildbot.test.fake.remotecommand import Expect
from buildbot.test.fake.remotecommand import ExpectShell
from buildbot.test.util import steps
from buildbot.test.util.misc import TestReactorMixin
try:
... |
"""Show the objects with references to a given object.
"""
#end_pymotw_header
import gc
flags = (gc.DEBUG_COLLECTABLE |
gc.DEBUG_UNCOLLECTABLE |
gc.DEBUG_OBJECTS
)
gc.set_debug(flags)
class Graph(object):
def __init__(self, name):
self.name = name
self.next = None
... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class RecordActivity(Choreography):
def __init__(self, temboo_session):
"""
Create ... |
from os import path, remove
import gzip
from urllib.request import urlretrieve
fixtures = path.abspath(path.join(path.dirname(__file__), 'fixtures'))
def get_indonesia():
fixt = path.join(fixtures, 'IDN_adm0.shp.geojson')
if not path.exists(fixt):
download_sample_data()
with open(fixt, 'rb') as... |
"""Tests for utils.py."""
import os
from pytype import utils
from pytype.pytd import cfg as typegraph
from pytype.pytd import pytd
from pytype.tests import test_inference
import unittest
# pylint: disable=invalid-name
class DummyValue(object):
"""A class with a 'parameters' function, for testing cartesian prod... |
import six
if six.PY3:
import http.client as httplib
else:
import httplib
import requests.adapters
import socket
try:
import urllib3
except ImportError:
import requests.packages.urllib3 as urllib3
class UnixHTTPConnection(httplib.HTTPConnection, object):
def __init__(self, base_url, unix_socket,... |
from ev3dev.core import TouchSensor as _TouchSensor
from ev3dev.core import ColorSensor as _ColourSensor
from ev3dev.core import UltrasonicSensor as _UltrasonicSensor
from ev3dev.core import InfraredSensor as _InfraredSensor
from math import floor
class TouchSensor:
def __init__(self, port):
self._sensor = _TouchSe... |
import argparse
import numpy as np
import time
from SPARQLWrapper import JSON
from SPARQLWrapper import SPARQLWrapper
parser = argparse.ArgumentParser(description='Parses webquestions files with entity annotations to our internal format.')
parser.add_argument('--input_file', type=str, help='The location of the .json-f... |
from .element import Element
from .groups import GroupVI
from .periods import PeriodIV, PeriodV, PeriodVI, PeriodVII
class Cr(Element, PeriodIV, GroupVI):
__slots__ = ()
@property
def atomic_number(self):
return 24
@property
def isotopes_distribution(self):
return {50: 0.04345, 5... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... |
import sys
import struct
import pprint
from collections import OrderedDict
try:
import configparser
except ImportError:
import ConfigParser as configparser
import struct
import functools
import gzip
def open_file(file_name, mode='rb'):
if file_name.endswith('.gz'):
if gzip:
return gzip... |
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_D, LargeMotor, MediumMotor
from ev3dev.auto import INPUT_1, INPUT_2, ColorSensor, UltrasonicSensor
import time
import ev3dev.ev3 as ev3
#ultrasonicSensor = UltrasonicSensor(INPUT_1)
#colorSensor = ColorSensor(INPUT_2)
clawMotor = MediumMotor(OUTPUT_B)
leftTire = Large... |
import json
from django.conf import settings
from django.db import models, transaction
SITEMAPS_DATA = settings.SITEMAPS_PATH.joinpath('data')
NO_LOCALE = '__' # special value for no locale
def load_sitemaps_data():
with SITEMAPS_DATA.joinpath('etags.json').open() as fh:
etags = json.load(fh)
with... |
""" Lookup tables shared among multi-photon pipelines. """
import datajoint as dj
schema = dj.schema('pipeline_shared', locals(), create_tables=False)
@schema
class Field(dj.Lookup):
definition = """ # fields in mesoscope scans
field : tinyint
"""
contents = [[i] for i in range(1, 25)]
@schema... |
#!/usr/bin/env python
"""Partial Differential Equations example
Demonstrates various ways to solve partial differential equations
"""
from sympy import symbols, Eq, Function, pde_separate, pprint, sin, cos, latex
from sympy import Derivative as D
def main():
r, phi, theta = symbols("r phi theta")
Xi = Functi... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from jnius.reflect import autoclass
from jnius import cast
from jnius.reflect import identify_hierarchy
from jnius import find_javaclass
def identify_hierarchy_dict(cls, level, concrete=True):
... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : <EMAIL>
**... |
"""def softmax_cross_entropy_with_logits(_sentinel=None, # pylint: disable=invalid-name
labels=None, logits=None,
dim=-1, name=None)
解释:这个函数的作用是计算 logits 经 softmax 函数激活之后的交叉熵。
对于每个独立的分类任务,这个函数是去度量概率误差。比如,在 CIFAR-10 数据集上面,每张图片只有唯一一个分类标签:一张图可能是一... |
from __future__ import unicode_literals
import six
from django import forms
from django.contrib import messages
from django.db.models import ObjectDoesNotExist
from django.db.transaction import atomic
from django.utils.translation import ugettext_lazy as _
from shuup.admin.forms.widgets import PackageProductChoiceWid... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.md').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
# TODO: put package requirements here
]
test_requir... |
# -*- coding: utf-8 -*-
"""
chemdataextractor.cli.cem
~~~~~~~~~~~~~~~~~~~~~~~~~
Chemical entity mention (CEM) commands.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import click
from ..nlp.cem import CrfCemTagger
@click.group()
@click.pass_conte... |
"""
manager commands
"""
import os
from twisted.spread import flavors
from twisted.python import failure
from flumotion.common import errors, log
from flumotion.monitor.nagios import util
from flumotion.admin.command import common
__version__ = "$Rev: 6562 $"
class Invoke(common.AdminCommand):
usage = "[meth... |
__all__ = ['qconnection', 'qtype', 'qtemporal', 'qcollection']
__version__ = '2.0.0'
try:
from qpython.fastutils import uncompress
except:
__is_cython_enabled__ = False
else:
__is_cython_enabled__ = True
class MetaData(object):
'''Utility class for enriching data structures with meta data, e.g. q... |
import os
from enum import Enum
from .shared import Shared
from lxml import etree, objectify
import tempfile
from zipfile import ZipFile
import shutil
from .propresenter_object import ProPresenterObject
class Playlist(ProPresenterObject):
def __init__(self, **kwargs):
self.name = kwargs.get("name", "")
self.te... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsPalLabeling: base suite setup
From build dir, run: ctest -R PyQgsPalLabelingBase -V
See <qgis-src-dir>/tests/testdata/labeling/README.rst for description.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Gen... |
"""Tests for the experimental input pipeline ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from os import path
import shutil
import tempfile
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework import dtypes
from te... |
import xml.dom.minidom
import os
import data
class Evaluation:
def __init__(self):
self.evaluations = []
self.populate_evaluations()
def populate_evaluations(self):
filepath = os.path.join("resources", "evaluation.xml")
evaluation = xml.dom.minidom.parse(filepath)
c... |
import random
import re
import struct
import string
def random_string(a, b):
chars = string.letters + string.digits
return ''.join(random.choice(chars) for _ in range(random.randint(a, b)))
def random_regex(a, b):
def random_regex_element():
ret = ''
chars = string.letters + string.digits
... |
from django.conf import settings
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from hiicart import validate_gateway
from hiicart.gateway.base import SubmitResult
from hiicart.models import *
from pprint import PrettyPrinter
from apps.basic import forms
def index(request)... |
from ..import scene
from ..io import read_mesh
from ..geometry import MeshData
__all__ = ['PlotWidget']
class PlotWidget(scene.Widget):
"""Widget to facilitate plotting
Parameters
----------
*args : arguments
Arguments passed to the `ViewBox` super class.
**kwargs : keywoard arguments
... |
import pytest
import pytz
import re
from datetime import datetime, timedelta
from uuid import uuid4
from django.core.files.uploadedfile import SimpleUploadedFile
from django.conf import settings
from django.utils import timezone
from django.urls import reverse
from freezegun import freeze_time
import requests
import r... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
#
# Created on Oct 16, 2015
# @author: Bo Zhao
# @email: <EMAIL>
# @website: http://yenching.org
# @organization: Harvard Kennedy School
from random import randint
import time
from selenium.common.exceptions import TimeoutException
from log import *
from pym... |
import json
from kombu import Connection
from oslo_config import cfg
from st2common import log as logging
from st2common.constants.action import LIVEACTION_STATUS_SUCCEEDED
from st2common.constants.action import LIVEACTION_FAILED_STATES
from st2common.constants.action import LIVEACTION_COMPLETED_STATES
from st2common... |
"""Package des différents contextes de création de joueur.""" |
"""GPhL bespoke input widget. Built from DataCollectParametersWidget"""
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import logging
from collections import namedtuple
from collections import OrderedDict
from mxcubeqt.utils import qt_import
from mxcubeqt.util... |
import os, shutil
import re
from build.download import download_and_verify
from build.tar import untar
from build.quilt import push_all
class Project:
def __init__(self, url, alternative_url, md5, installed, name=None, version=None,
base=None,
patches=None):
if base is No... |
# coding=utf-8
import link_handler
change_email_settings_links = [
'http://tinkoff.us10.list-manage.com/unsubscribe?u=hash&id=hash&c=hash',
'http://meduza.us10.list-manage1.com/unsubscribe?u=hash&id=hash&e=hash',
'https://webopsweekly.com/edit_subscription/hash',
'https://webopsweekly.com/unsubscribe/h... |
from flask import Blueprint
from flask_menu.classy import register_flaskview
from .resource import Agentd
from .resource import AgentdLoginLogoff
from .resource import AgentdPauseUnpause
q_agentd = Blueprint('q_agentd', __name__, template_folder='templates',
static_folder='static', static_url_pat... |
import os
local_path = lambda path: os.path.join(os.path.dirname(__file__), path)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'TEST_NAME': ':memory:'
}
}
SITE_ID = 1
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sites',
'staticfiles',
... |
"""
Data management for maps, basic functions.
"""
from collections import defaultdict, OrderedDict
COUNTRY_MAP = {
'unknown': None,
'UK': 'United Kingdom',
'United Kingdom of Great Britain and Northern Ireland': 'United Kingdom',
'South Afica': 'South Africa',
'Ivory Coast': 'CIV',
'Netherlan... |
from .proxy_only_resource import ProxyOnlyResource
class ContinuousWebJob(ProxyOnlyResource):
"""Continuous Web Job Information.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Id.
:vartype id: str
:ivar name: Resource Name.
:var... |
import csv
import yaml
import random
import time
import urllib2
import json
class PoliticalData():
SPREADSHEET_CACHE_TIMEOUT = 60 # seconds
overrides_data = {} # the google spreadsheet overrides for each campaign
scrape_times = {} # the last google scrape timestamps for campaigns
cache_han... |
from rest_framework import generics, permissions
from rest_framework.decorators import api_view
from .models import *
from .serializers import *
class ProjectList(generics.ListCreateAPIView):
"""
API endpoint that lists all projects or creates new projects
"""
model = Project
serializer_class = P... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.