content stringlengths 4 20k |
|---|
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
import boto3
import datetime
from botocore.exceptions import NoCredentialsError, ClientError
from .models import CloudfrontDistribution
def invalidate_cloudfront_caches():
try:
distribution = CloudfrontDistribution.objects.all()[0]
client = boto3.client('cloudfront')
response = client.creat... |
from __future__ import print_function
from math import pi
import pandas as pd
from bokeh.models import Plot, ColumnDataSource, FactorRange, CategoricalAxis, TapTool, HoverTool, OpenURL
from bokeh.models.glyphs import Rect
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.resources impor... |
from os.path import dirname, abspath, join
from tri.struct import Struct
from django.http import HttpResponse
from django.utils.safestring import mark_safe
from django.utils.html import format_html
from .models import Foo, Bar
from tri_form import Form, Field, Link, choice_parse
from tri_form.views import create_obje... |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Voting engine: Alternative vote
See C.G.P. Grey video on Alternative vote
:author: Thomas Calmant
:license: Apache Software License 2.0
:version: 1.1.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
... |
#!/usr/bin/env python3
## -*- coding: utf-8 -*-
from __future__ import print_function
from triton import *
from unicorn import *
from unicorn.arm_const import *
import pprint
import random
import sys
ADDR = 0x100000
STACK = 0x200000
HEAP = 0x300000
SIZE = 5 * 1024 * 1024
CODE ... |
# Common utility functions used by various script execution tests
# e.g. test_cmd_line, test_cmd_line_script and test_runpy
import importlib
import sys
import os
import os.path
import tempfile
import subprocess
import py_compile
import contextlib
import shutil
import zipfile
from imp import source_from_cache
from te... |
"""Support for AdGuard Home sensors."""
from datetime import timedelta
from adguardhome import AdGuardHomeConnectionError
from homeassistant.components.adguard import AdGuardHomeDeviceEntity
from homeassistant.components.adguard.const import (
DATA_ADGUARD_CLIENT,
DATA_ADGUARD_VERION,
DOMAIN,
)
from homea... |
"""
Xylem - Phylogenetic Pipelines with MPI
Scheduler.py contains routines for distributing tasks across worker
nodes with MPI.
Copyright (C) 2015 Pranjal Vachaspati
<EMAIL>
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
... |
# -*- coding: utf-8 -*-
import httplib
import logging
from django.db import transaction, connection
from django.contrib.contenttypes.models import ContentType
from framework.auth import get_or_create_user
from framework.exceptions import HTTPError
from framework.flask import redirect
from framework.transactions.hand... |
r"""
******************************************
espressopp.analysis.MeanSquareInternalDist
******************************************
.. function:: espressopp.analysis.MeanSquareInternalDist(system, chainlength, start_pid)
:param system:
:param chainlength:
:param start... |
# -*- encoding: utf-8 -*-
from abjad import *
def test_selectiontools_ContiguousSelection_partition_by_durations_not_greater_than_01():
staff = Staff("abj: | 2/8 c'8 d'8 || 2/8 e'8 f'8 |"
"| 2/8 g'8 a'8 || 2/8 b'8 c''8 |")
tempo = Tempo(Duration(1, 4), 60)
attach(tempo, staff, scope=Staff)
a... |
import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
"""PrismaCloudAttribution
"""
from typing import Dict, List, Any, Iterable, Union
import traceback
IPADDRESS_KEYS = ['publicIpAddress', 'natIP', 'publicIp', 'i... |
#!/usr/bin/env python
"""
--- Day 15: Dueling Generators ---
Here, you encounter a pair of dueling generators. The generators, called generator A and generator B, are trying to agree on a sequence of numbers. However, one of them is malfunctioning, and so the sequences don't always match.
As they do this, a judge wai... |
from django.contrib.sessions.models import Session
from django.contrib.auth.models import AnonymousUser, User
from django.http import HttpResponse
import json
# Create your views here.
def get_user(request):
def get_response(data):
return HttpResponse(json.dumps(data),
content_type="applicati... |
#!/usr/bin/env python3
import argparse
import getpass
import logging as log
import os
import re
import sys
import gnupg
debug = 0
home = os.environ['HOME']
aws_config_dir = '{}/.aws/'.format(home)
credential_file = '{0}/credentials'.format(aws_config_dir)
env_file = '{0}/.env'.format(aws_config_dir)
def get_args():... |
#!/usr/bin/env python3
from numpy import arange,concatenate,array,argsort
import os
import sys
import vtktools
import math
from pylab import *
from matplotlib.ticker import MaxNLocator
import re
from scipy.interpolate import UnivariateSpline
import glob
#### taken from http://www.codinghorror.com/blog/archives/00101... |
#!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 03.08.2017 12:28
:Licence MIT
Part of grammpy
"""
from unittest import TestCase, main
from grammpy.old_api import Grammar
from grammpy.old_api import Nonterminal
class TempClass(Nonterminal):
pass
class Second(Nonterminal):
pass
class Third(Non... |
# -*- coding: utf-8 -*-
import scrapy
from cwpoliticl.scraped_websites import WebsiteTypes, websites_allowed_domains, websites_parses, is_pagination
class TheIndianEconomistDebugSpider(scrapy.Spider):
url_from = WebsiteTypes.theindianeconomist
name = "{}_debug".format(url_from.value)
details_urls = [
... |
"""Solar geometry functions
This module contains the most important functions for calculation of the position of the sun.
"""
import math
import datetime
from . import constants
from . import time
from . import radiation
def solar_test():
latitude_deg = 42.364908
longitude_deg = -71.112828
d = datetime.d... |
import importlib
import numpy as np
from scipy.integrate import simps
import matplotlib.pyplot as plt
import load_data
import common
importlib.reload(load_data)
importlib.reload(common)
save_figures = False
files_root_prefix = 'print/data/probability_sweep/v8/'
L = 64
file_name = load_data.get_probability_sweep_file_... |
# importing libraries:
import maya.cmds as cmds
import dpAutoRigSystem.Controls.dpBaseControlClass as BaseControl
reload(BaseControl)
# global variables to this module:
CLASS_NAME = "Diamond"
TITLE = "m105_Diamond"
DESCRIPTION = "m099_cvControlDesc"
ICON = "/Icons/dp_diamond.png"
dpDiamondVersion = 1.3
class Dia... |
import sys
import binascii
import dns.message
import dns.exception
import dns.flags
import dns.opcode
import dns.rcode
import dns.rdataclass
import dns.rdatatype
class DNSPacket:
"""
This class represents a DNS packet.
"""
def __init__(self, data):
self.data = data
fields = self._parse... |
"""Extension management for Windows.
Under Windows it is unlikely the .obj files are of use, as special compiler options
are needed (primarily to toggle the behavior of "public" symbols.
I don't consider it worth parsing the MSVC makefiles for compiler options. Even if
we get it just right, a specific freeze applica... |
#!/usr/bin/python
import sys
from math import sqrt
from os import path, remove, chdir, rmdir, system
from tempfile import mkdtemp
from pyraf import iraf
###################################################################
#
# invocation:
#
# fiesgainron FIpj190003_cal
#
# purpose:
#
# calculates an... |
from odoo import fields, models
class ResPartnerType(models.Model):
_name = 'res.partner.type'
_description = 'Contact Type'
_company_inherit_fields = ['company_type', 'customer', 'supplier']
_person_inherit_fields = ['company_type', 'type']
id = fields.Integer(readonly=True)
name = fields.Ch... |
from ffflash.inc.nodelist import handle_nodelist
from ffflash.inc.sidecars import handle_sidecars
from ffflash.info import info
from ffflash.lib.api import FFApi
from ffflash.lib.args import parsed_args
from ffflash.lib.clock import get_iso_timestamp
from ffflash.lib.files import check_file_location, dump_file, load_fi... |
"""Unit test for treadmill.spawn.utils.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from treadmill import spawn
from treadmill.spawn import utils
class UtilsTest(unittest.TestCase):
"""T... |
#!/usr/bin/env python
# brought to you by error:undefined design
#
# w: https://error-undefined.de
# g: https://github.com/errorundefined
# b: https://behance.net/errorundefined
#
# This is part of the APOD client getspace.
# Get the latest version here on Github:
# https://github.com/errorundefined/getspace
# http... |
"""
Modification of Michael Waskom's JointGrid implementation in Seaborn.
Supports multiple JointGrids in single figure
"""
import numpy as np
import pandas as pd
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import seaborn as sns
class JointGrid(sns.JointGrid):
"""Grid for drawing a bi... |
import sys, subprocess, os, errno, re, argparse, logging, hashlib, types
from itertools import repeat, takewhile
from collections import deque
import wmf
class cirquelar(list):
"""
Circular queue use for tracking the most recent N things appended to it.
Specifically used by dequedict below.
"""
def __init__(sel... |
import sys
import unittest
from svgwrite.shapes import Line
class TestLine(unittest.TestCase):
def test_numbers(self):
line = Line(start=(0,0), end=(10,20))
self.assertEqual(line.tostring(), '<line x1="0" x2="10" y1="0" y2="20" />')
def test_coordinates(self):
line = Line(s... |
"""
This is all the functionality we need to exfiltrate a message by smuggling it
in IP packet ID numbers. This is protocol independent since it just uses the
IP packet and not any layer 4 header.
Note that this field is only 16-bits
"""
from scapy.all import *
def add_n0ise_ipid(packet_sequence, pkt):
"""Add ... |
from django.contrib.auth import get_user_model
from django.utils.encoding import smart_str
from django.forms.models import inlineformset_factory, BaseInlineFormSet
from django.utils.translation import ugettext as _
from selvbetjening.core.members import signals
from selvbetjening.core.members.models import UserWebsite... |
from frodo import setup
from frodo import insert
from frodo import delete
class FrodoCtxManager:
"""
Frodo's default Context Manager
it leaves connection open
used in django context and in managed mode
"""
def __init__(self, db):
self.db = db
self.db.current_cursor().execute('S... |
import json
from itertools import groupby
from operator import itemgetter
from django import forms
from django.conf import settings
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.contenttypes.models import Co... |
from __future__ import absolute_import
import sys
import types
from contextlib import contextmanager
from kombu.utils.encoding import str_to_bytes
from celery import signature
from celery import states
from celery import group
from celery.backends.cache import CacheBackend, DummyClient
from celery.exceptions import... |
from xblock.fragment import Fragment
from xmodule.x_module import XModule
from xmodule.seq_module import SequenceDescriptor
from xmodule.progress import Progress
from xmodule.studio_editable import StudioEditableModule
from pkg_resources import resource_string
from copy import copy
# HACK: This shouldn't be hard-coded... |
import gtk, gobject
class PageableListStore (gtk.ListStore):
"""A ListStore designed to show bits of data at a time.
We show chunks of data from our parent list in pages of a set size.
parent_args and parent_kwargs get handed to setup_parent.
It shouldn't be too hard to expand this to support TreeSt... |
#!/usr/bin/env python3
import json
import os
import sys
import numpy as np
import math
import itertools
import argparse
## TODO: there is a problem where one of cells might switch to next cell
## to reproduce use example 6
# 0-'*': unknown
# 1-'X': black
# 2-'.': white
NCH = ['*', 'X', '.']
class NonogramSolver(obj... |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
import argparse
import os
import os.path as p
import subprocess
import sys
DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) )
def ParseArgu... |
"""Light support for switch entities."""
import logging
from typing import Any, Callable, Optional, Sequence, cast
import voluptuous as vol
from homeassistant.components import switch
from homeassistant.components.light import PLATFORM_SCHEMA, LightEntity
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF... |
#!/usr/bin/python2.7
#coding:utf-8
# ----------------------------------------------------------------------------------------------------
# func: 主要模块,爬虫的具体实现。
# web: https://github.com/lvyaojia/crawler
# modified by mody at 2014-07-23
# modified by mody at 2014-09-18
# 并发有问题,要获取线程返回结果,然后主线程处理
# ---------------------... |
__author__ = 'Max'
class SessionHelper:
def __init__(self,app):
self.app = app
def login(self,user_name, password):
wd = self.app.wd
wd.get("http://localhost/addressbook/")
wd.find_element_by_id("LoginForm").click()
wd.find_element_by_name("user").click()
wd.fi... |
# -*- coding: utf-8 -*-
import sys
import time
import pyocr
import pyocr.builders
import Image
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.commo... |
import time
import sys
import _mysql
import random
import string
import re
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import selenium.webdriver.chrome.service as service
try:
# Check to see if it was added
db=_mysql.connect('localhost','root','root','paws_db')
rand_fname=''.jo... |
import csv
import datetime
from django.core.exceptions import PermissionDenied
from django.core.paginator import InvalidPage
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect
from django.utils.encoding import smart_str
from django.utils.translation import ungettext
from djan... |
# -*- coding: utf-8 -*-
import sympy
from repr import ReprPrinter
from str import StrPrinter
# A list of classes that should be printed using StrPrinter
STRPRINT = ("Add", "Infinity", "Integer", "Mul", "NegativeInfinity",
"NegativeOne", "One", "Pow", "Zero")
class PythonPrinter(ReprPrinter, StrPrinter):
... |
#!/usr/bin/env python
import os
import re
import sys
def GetKV(key, vals):
lk = len(key)
for v in vals:
if (len(v) >= len(key) and v[0:lk] == key):
return v[lk:]
else:
return None
def GetStrand(value):
if (value & 16 != 0):
return 1
else:
return 0
def... |
from __future__ import absolute_import, print_function, unicode_literals, division
import logging
from jormungandr.exceptions import TechnicalError
from jormungandr import app
from jormungandr import fallback_modes as fm
from jormungandr.street_network.kraken import Kraken
from jormungandr.utils import get_pt_object_co... |
"""
A Python implementation of ranking forests using TreeRank.
"""
import numpy
import logging
from sandbox.ranking.AbstractTreeRank import AbstractTreeRank
from sandbox.ranking.TreeRank import TreeRank
from sandbox.util.Parameter import Parameter
from sandbox.util.Util import Util
class TreeRankForest(AbstractTreeRan... |
# This is a parser for assembler listings (?)
from . import asm
from .mask import Mask
from .block import Block
from .patch import Patch
__all__ = ['parseFile', 'ParseError', 'FilePos']
class FilePos:
" This holds current line info (filename, line text, line number) "
def __init__(self, filename, lnum=-1, li... |
import copy
import requests
import StringIO
import testtools
from ripcordclient.common import http
class FakeAPI(object):
def __init__(self, fixtures):
self.fixtures = fixtures
self.calls = []
def _request(self, method, url, headers=None, body=None):
call = (method, url, headers or {... |
#! /usr/bin/env python
# Version 0.2.0
import subprocess
import shlex
import argparse
import logging
import os
from os import chdir, getcwd
import yaml
# Constants
DEF_DOTFILE = '.dotfile'
# Description and misc docstrings:
DESCRIPT = """
Makes symlinks to working directories and public git directories as specifie... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Auxiliary visualization procedures"""
import datetime
import matplotlib
import matplotlib.dates as plt_dates
import pylab as plt
from common import RESULTS_PATH, get_flu_data, remove_background_incidence, get_city_name
from core import datetime_functions as dtf
def... |
""" functionality for drawing trees on sping canvases
"""
from rdkit.sping import pid as piddle
import math
class VisOpts(object):
circRad = 10
minCircRad = 4
maxCircRad = 16
circColor = piddle.Color(0.6, 0.6, 0.9)
terminalEmptyColor = piddle.Color(.8, .8, .2)
terminalOnColor = piddle.Color(0.8, 0.8, 0.8... |
"""A multi-layer perceptron for classification of MNIST handwritten digits."""
from __future__ import absolute_import, division
from __future__ import print_function
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.misc import logsumexp
from autograd import grad
from autograd.util imp... |
from miscellaneous.decorators import update_paths
from operator import itemgetter
from pyQT_widgets.Q_console_edit import QConsoleEdit
from PyQt5.QtWidgets import QWidget, QGridLayout
class ARPTable(QWidget):
@update_paths
def __init__(self, node, controller):
super().__init__()
self.setWi... |
from decaf_utils_rpc.rpc_errors import ApplicationError
__author__ = 'thgoette'
from threading import Event
import weakref
import imp
from twisted.internet.defer import *
from functools import wraps
from twisted.python.failure import Failure
class SyncResult(object):
"""
A blocking interface to Deferred ... |
import mock
from sahara.service.api import v10 as api
from sahara.service.validations import node_group_template_schema as ngt_schema
from sahara.service.validations import node_group_templates as nt
from sahara.tests.unit.service.validation import utils as u
class TestNGTemplateCreateValidation(u.ValidationTestCase... |
from __future__ import division
fvList = {"AAPL": [None,None], "BOND": [None,None], "GOOG": [None,None], "MSFT": [None,None], "NOKFH": [None,None], "NOKUS": [None,None], "XLK": [None,None]}
def updateValues(data, symb):
buys = data['buy']
sells = data['sell']
if(len(buys) > 0):
mean_buy = sum([in... |
#!/usr/bin/env python
class Edge:
"""Edge class, to contain a directed edge of a tree or directed graph.
attributes parent and child: index of parent and child node in the graph.
"""
def __init__ (self, parent, child, length=None):
"""create a new Edge object, linking nodes
with indice... |
"""
Surface alignment for semantic entities.
"""
from delphin.exceptions import PyDelphinException
# Default modules need to import the PyDelphin version
from delphin.__about__ import __version__ # noqa: F401
class LnkError(PyDelphinException):
"""Raised on invalid Lnk values or operations."""
class Lnk(objec... |
from flumotion.twisted import reflect
from flumotion.common import testsuite
class TestSimple(testsuite.TestCase):
def testSimple(self):
s = reflect.namedAny('flumotion.test.test_reflect.TestSimple')
self.failUnlessIdentical(s, TestSimple)
# XXX: Write a test for the exception, but how? |
"""Adds an ad group level mobile bid modifier override for a campaign.
To get your ad groups, run get_ad_groups.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentic... |
#!/usr/bin/env python3
import tornado.autoreload
import tornado.ioloop
import tornado.web
import json
import subprocess
import os
import miami_api
import html_functions
class OpenLocationHandler(tornado.web.RequestHandler):
def get(self):
response = miami_api.get_open()
json_response = json.dumps(response, inde... |
import logging
# Third Party
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.mixins import (
LoginRequiredMixin,
PermissionRequiredMixin
)
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or... |
""" Run unit tests for Cosimulation """
import gc
import os
import random
import sys
if sys.platform == "win32":
import msvcrt
from myhdl import Signal
from myhdl._Cosimulation import Cosimulation, CosimulationError, _error
if __name__ != '__main__':
from helpers import raises_kind
random.seed(1) # random,... |
"""hug/validate.py
Defines hugs built-in validation methods
Copyright (C) 2016 Timothy Edmund Crosley
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 Software without restriction, including without limi... |
import os
import datetime
import unittest
import base64
from pympesa import pympesa
ENV = "production"
#ENV = "development"
class PympesaTests(unittest.TestCase):
def setUp(self):
if ENV == "production":
access_token = pympesa.oauth_generate_token(
os.getenv("PROD_MPESA_CONSUM... |
import json
import uuid
from openstackclient.tests.functional.network.v2 import common
class NetworkQosPolicyTests(common.NetworkTests):
"""Functional tests for QoS policy"""
def setUp(self):
super(NetworkQosPolicyTests, self).setUp()
# Nothing in this class works with Nova Network
i... |
import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
from tempest.services.compute.xml.common import xml_to_json
class HostsClientXML(RestClientXML):
def __init__... |
from msrest.serialization import Model
class DiagnosticsProfile(Model):
"""Describes a diagnostics profile.
:param boot_diagnostics: Boot Diagnostics is a debugging feature which
allows the user to view console output and/or a screenshot of the virtual
machine from the hypervisor.
:type boot_di... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import smtplib
import mimetypes
import time
import optparse
from email import Encoders
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email.MIMEMultipart import MIMEMultipart
import mailConfig
destaddr = mailConfig.ADDRESS
fromaddr = mailCo... |
from aiocache import cached, RedisCache
from aiocache.serializers import PickleSerializer
import asyncio
from enum import Enum, auto
import progressbar
import uvloop
import domparser
import styledprint
import utils
import web
class Rating(Enum):
Platinum = auto()
Gold = auto()
Silver = auto()... |
#grab the current path so we can set some thing automatically
import sys
app_path = sys.path[1]
#the app version. you can use in templates via the Filters.version() helper.
#good for browser cache busting on js & css
version = '0.1'
#run mode
mode = "development"
#define a port for testing
port = 8000
#set static... |
from new import instancemethod
import hashlib
import cPickle
from twisted.internet.defer import succeed, maybeDeferred, inlineCallbacks
from txweb2.dav.util import allDataFromStream
from txweb2.stream import MemoryStream
from txweb2.http_headers import Headers
from twistedcaldav.cache import MemcacheResponseCache, C... |
import asyncio
from gremlinclient.aiohttp_client.client import Pool
try:
from gremlin_driver import RemoteConnection, Traverser
except ImportError:
raise ImportError("Please install gremlinpython to use RemoteConnection")
class RemoteConnection(RemoteConnection):
def __init__(self, url, loop=None):
... |
"""
Defines KheperaRobot, a subclass of robot.
(c) 2005, PyrobRobotics.org. Licenced under the GNU GPL.
"""
__author__ = "Douglas Blank <<EMAIL>>"
__version__ = "$Revision: 2429 $"
from pyrobot.system.share import config
from pyrobot.robot import *
from pyrobot.robot.device import *
from pyrobot.system.serial import... |
from opus.core.sampling_functions import sample_choice
from opus.sandbox.estimation_toolbox import count_agents_by_location
from opus.core.opusnumarray import sum
from numarray import zeros, where, Float32,ones, array
from numarray.nd_image import sum as nd_image_sum
import copy
#def copy_dataset(dataset):
# ... |
import wpan
from wpan import verify
# -----------------------------------------------------------------------------------------------------------------------
# Test description: Verify Thread mode change on children and recovery after parent reset.
#
test_name = __file__[:-3] if __file__.endswith('.py') else __file__... |
"""A workflow that uses a simple Monte Carlo method to estimate π.
The algorithm computes the fraction of points drawn uniformly within the unit
square that also fall in the quadrant of the unit circle that overlaps the
square. A simple area calculation shows that this fraction should be π/4, so
we multiply our counts... |
"""
The diagnostic interface to TVM, used for reporting and rendering
diagnostic information by the compiler. This module exposes
three key abstractions: a Diagnostic, the DiagnosticContext,
and the DiagnosticRenderer.
"""
import enum
import tvm._ffi
from . import _ffi_api
from ... import get_global_func, register_func... |
''' This module contains function responsible for creating several models and
parameters in the case when RETURN_TO_SCALE or ORIENTATION is set to both.
'''
import pyDEA.core.utils.model_factory as model_factory
from pyDEA.core.data_processing.parameters import Parameters
def build_models(params, model_input):
... |
# encoding: utf-8
import json
from datetime import datetime, timedelta
import airflow
from airflow.utils.db import provide_session
from airflow.utils.email import send_email
from sqlalchemy import (
Column, Integer, String, DateTime, Text, Boolean, ForeignKey, PickleType,
Index, Float)
from sqlalchemy.ext.dec... |
from weboob.capabilities.bill import ICapBill, Subscription, SubscriptionNotFound, Detail
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword
from .browser import PoivyBrowser
__all__ = ['PoivyBackend']
class PoivyBackend(BaseBackend, ICapBill):
NAME ... |
import io
import uuid
from xml.sax import saxutils
from django.db.models import F, Func, CharField, BigIntegerField
from django.db.models.expressions import RawSQL
from django.db.models.functions import Cast
from django.http import HttpResponse, Http404
from django.utils ... |
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class AccountLoanPost(models.TransientModel):
_name = "account.loan.post"
@api.model
def _default_journal_id(self):
loan_id = self._context.get('default_loan_id')
if loan_id:
return self.env['account... |
from __future__ import absolute_import
import os
import pwd
import six
import sys
import copy
import traceback
import collections
from oslo_config import cfg
from st2common import log as logging
from st2common.models.base import DictSerializableClassMixin
from st2common.util.shell import quote_unix
from st2common.con... |
import functools
import json
import unittest
import urlparse
import mock
from pulp_puppet.forge.unit import Unit
unit_generator = functools.partial(
Unit, name='me/mymodule', file='/path/to/file', db={}, repo_id='repo1',
host='localhost', protocol='http', version='1.0.0',
dependencies = [{'name':'you/yo... |
"""
The OpenStack Neat Project
==========================
OpenStack Neat is a project intended to provide an extension to
OpenStack implementing dynamic consolidation of Virtual Machines (VMs)
using live migration. The major objective of dynamic VM consolidation
is to improve the utilization of physical resources and ... |
"""Tests formatting as writer-agnostic ExcelCells
ExcelFormatter is tested implicitly in pandas/tests/io/excel
"""
import pytest
import pandas._testing as tm
from pandas.io.formats.css import CSSWarning
from pandas.io.formats.excel import CSSToExcelConverter
@pytest.mark.parametrize(
"css,expected",
[
... |
#### import the simple module from the paraview
from paraview.simple import *
body = GetActiveSource()
generateSurfaceNormals1 = GenerateSurfaceNormals(Input=body)
generateSurfaceNormals1.ComputeCellNormals = 1
cellCenters1 = CellCenters(Input=generateSurfaceNormals1)
scale = 0.0001
try:
calculator1 = Calculator(Inp... |
#!/usr/bin/env python
#
# Script from https://gist.github.com/neothemachine/4060735
#
import sys
import os
import os.path
import xml.dom.minidom
if os.environ["TRAVIS_SECURE_ENV_VARS"] == "false":
print "no secure env vars available, skipping deployment"
sys.exit()
homedir = os.path.expanduser("~")
m2 = xml.dom.mi... |
#!/usr/bin/env python
'''
Containerize
Create a docker-compose file from a web service specification.
'''
import argparse
import os
import sys
import six
from pycontainerize.constants import DEFAULT_OUTPUT_DIR
from pycontainerize.constants import DEFAULT_PROJECTS_DIR
from pycontainerize.constants import DEFAULT_TEMP... |
#!/usr/bin/env python
import fblib
import threading
import random
import time
from scapy.all import *
#REMEMBER TO REFRESH EVERY TIME THE TOKEN!!!!!
#REMEMBER TO SET TO IGNORE YYOUR IP ADDRESS
#REMEMBER TO SET THE SNIFFING INTERFACE
#rischio falsi positivi, match multiplo se pacchetto ritrasmesso
match_found = Fals... |
"""Prepare dataset for keras model benchmark."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from official.utils.misc import model_helpers # pylint: disable=g-bad-import-order
# Default values for dataset.
_NU... |
"""Test class for Remote Execution Management UI"""
from robottelo.decorators import stubbed, tier1, tier2, tier3
from robottelo.test import UITestCase
class RemoteExecutionTestCase(UITestCase):
"""Test class for remote execution feature"""
@stubbed()
@tier1
def test_positive_create_simple_job_templa... |
# -*- coding:utf-8 -*-
# Created Time: Thu 13 Apr 2017 04:07:50 PM CST
# $Author: Taihong Xiao <<EMAIL>>
from __future__ import print_function
import os
import tensorflow as tf
import numpy as np
from dataset import config, Dataset
from six.moves import reduce
class Model(object):
def __init__(self, is_train=T... |
from __future__ import absolute_import
from . import tasks
from digits.job import Job
from digits.utils import override
# NOTE: Increment this everytime the pickled object changes
PICKLE_VERSION = 1
class ModelJob(Job):
"""
A Job that creates a neural network model
"""
def __init__(self, dataset_id... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.