content stringlengths 4 20k |
|---|
from __future__ import print_function
import requests as r
import decoder
import struct
import sys
import xml.etree.ElementTree as ET
import xml.dom.minidom
"""
Pull all the data from TrickBot
20july2017 - Jason Reaves
20jul2017 - Added dpost and mailconf - thanks @mesa_matt
Eventually the botid will get blacklisted ... |
__author__ = '<EMAIL>'
from . import dms
def parse(strin):
"""Parse string in RADEC to two floats. RA is expected to be in hours(:minutes:seconds). Both RA and DEC are returned in degrees."""
(ra,dec) = strin.split()
return (dms.parse(ra) * 15.0, dms.parse(dec))
if __name__ == '__main__':
print(parse('12:30:40 1... |
"""
Visualize the system cells and MPI domains. Run ESPResSo in parallel
to color particles by node. With OpenMPI, this can be achieved using
``mpiexec -n 4 ./pypresso ../samples/visualization_cellsystem.py``.
Set property ``system.cell_system.node_grid = [i, j, k]`` (with ``i * j * k``
equal to the number of MPI ranks... |
"""
This module contains different fonctions to make end and opening
credits, even though it is difficult to fill everyone needs in this
matter.
"""
from moviepy.video.VideoClip import TextClip, ImageClip
from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
from moviepy.video.fx import resize
d... |
# -*- coding: 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):
# Deleting model 'InfoObject2AuthoredData'
db.delete_table(u'dingos_authoring_infoobject2authoreddata')
... |
#!/usr/bin/python
import sqlite3
import sys
if ( len(sys.argv) < 2 ):
print("Usage: ./tableCleaner.py <database>")
exit()
path = sys.argv[1]
conn = sqlite3.connect(path)
cursor = conn.cursor()
rows = cursor.execute('select distinct s2.year, s2.week, s3.team from (select distinct year from schedule) s1 jo... |
import os
from conans import ConanFile, CMake
# This easily allows to copy the package in other user or channel
CHANNEL = os.getenv("CONAN_CHANNEL", "testing")
USERNAME = os.getenv("CONAN_USERNAME", "osechet")
class QtTestConan(ConanFile):
""" Qt Conan package test """
requires = "Qt/5.6.2@%s/%s" % (USERNAME... |
import nest
import nest.voltage_trace
nest.ResetKernel()
neuron = nest.Create("iaf_neuron")
nest.SetStatus(neuron, "I_e", 376.0)
voltmeter = nest.Create("voltmeter")
nest.SetStatus(voltmeter, {"withgid": True, "withtime": True})
nest.Connect(voltmeter, neuron)
nest.Simulate(1000.0)
nest.voltage_trace.from_device(... |
import os
import sys
import shutil
for arg in sys.argv[1:]:
if arg == "-h" or arg == "--help":
print("python download_compile_sire.py OPTIONS")
print("\nScript to download and (optionally) compile and install Sire.")
print("\nOptions:")
print(" -r / --rebuild Rebuild Sire from... |
"""
Test cases for twisted.protocols package.
"""
from twisted.trial import unittest
from twisted.protocols import wire, portforward
from twisted.internet import reactor, defer, address, protocol
from twisted.test import proto_helpers
class WireTestCase(unittest.TestCase):
"""
Test wire protocols... |
import os
import datetime
import config
from modules.init_logging import init_logging
from modules.camera_pooler import CameraPooler
from modules.tar_storage import TarStorage
from modules.tar_to_h264_compressor import TarToH264Compressor
from modules.archive_rotation import ArchiveRotation
def main():
init_logg... |
"""Code to parse output from the EMBOSS eprimer3 program.
As elsewhere in Biopython there are two input functions, read and parse,
for single record output and multi-record output. For primer3, a single
record object is created for each target sequence and may contain
multiple primers.
i.e. If you ran eprimer3 with a... |
from __future__ import absolute_import, division, print_function
try:
from collections.abc import Hashable
except ImportError:
from collections import Hashable
from types import GeneratorType
from ._vendor.six import wraps
# TODO: spend time filling out functionality and make these more robust
def memoize(f... |
from peg import RE, SOMEOF, OR, SYMBOL, NoMatch
from ast import symap, Id, Int, Str, ShellCmd, RegEx, Comment
from log import Log
log = Log("tokenizer")
# CONSTANTS
FLOATCONST = RE(r'\d+\.\d*')
INTCONST = RE(r'\d+', Int)
STRCONST = RE(r'"(.*)"', Str)
SHELLCMD = RE(r'`(.*)`', ShellCmd)
REGEX = RE(r'/(.*)/',... |
# Socket level samples
# Show the three models?
# * dispatching a thread to handle clientsocket
# * create a new process to handle clientsocket
# * restructure this app to use non-blocking sockets
# Probably just the first two
import socket
PORT = 8090
MAX_OPEN_REQUESTS = 5
def process_client(clientsocket):
pri... |
import os
import sys
def get_mpi_implementation():
mpi = os.environ.get('GPAW_MPI_IMPLEMENTATION')
if mpi is not None:
return mpi
machine = os.uname()[4]
if machine == 'sun4u':
return 'sun'
if sys.platform == 'aix5':
return 'poe'
if sys.platform == 'ia64':
... |
import sys
sys.path.insert(0, "../../python/")
import mxnet as mx
import numpy as np
import numpy.random as rnd
import time
def check_diff_to_scalar(A, x, rank=None):
""" assert A == x"""
assert(np.sum(np.abs((A - x).asnumpy())) == 0), (rank, A.asnumpy(), x)
# setup
keys = ['3', '5', '7']
rsp_keys = ['9', '11... |
'''
The models is the interface to the database using the flask-sqlalchemy package
Columns in the database are translated below as attributes of a class and then
translated into tables by the Object-Relational Mapper.
The particular example below is a Resource. A resource is some link to a URL
that may be useful for s... |
"""Box predictor for object detectors.
Box predictors are classes that take a high level
image feature map as input and produce two predictions,
(1) a tensor encoding box locations, and
(2) a tensor encoding classes for each box.
These components are passed directly to loss functions
in our detection models.
These m... |
"""
C function wrapper
"""
import sys
PY3 = (sys.version_info[0] >= 3)
if PY3:
import types
string_types = str,
else:
string_types = basestring,
from copy import copy
from pybindgen.typehandlers.base import ForwardWrapperBase, ReturnValue
from pybindgen.typehandlers import codesink
from pybindgen.cppexc... |
#!/usr/bin/env python
"""Miscellaneous small utility functions.
vol(vol=None) - Get or set volume using aumix.
progress(ratio, length=40, col=1, cols=("yellow", None, "cyan"),
nocol="=.")
Text mode progress bar.
yes(question, [default answer])
i.e. if yes("erase file?", 'n'): ... |
from contextlib import contextmanager
import pytest
import altair.vegalite.v3 as alt
@contextmanager
def check_render_options(**options):
"""
Context manager that will assert that alt.renderers.options are equivalent
to the given options in the IPython.display.display call
"""
import IPython.dis... |
"""Functions for creating form to customize cluster configuration."""
def get_base_cluster_html_form(configs, locations_list, jhub_region):
"""
Args:
- List configs: List of Cloud Dataproc cluster config files path in GCS.
- List locations_list: List of zone letters to choose from to create a
... |
#ImportModules
import ShareYourSystem as SYS
import operator
#Definition of a brian structure
MyNetworker=SYS.NetworkerClass(
).produce(
'Connecters',
["E","I"],
SYS.ConnecterClass
).__setitem__(
'Dis_<Connecters>',
#Here are defined the brian classic specific arguments for each pop
[
{
'Populatin... |
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
# +++your code here+++
# Write functions and modify main() to call them
def get_special_path(dir):
special_path = []
filenames = os.listdir(dir)
for filename in filenames:
if re.search('__\w+__',filename):
specia... |
import os
from karbor import exception
from karbor.i18n import _
from karbor.services.protection import bank_plugin
from karbor.services.protection.checkpoint import CheckpointCollection
from karbor import utils
from oslo_config import cfg
from oslo_log import log as logging
provider_opts = [
cfg.MultiStrOpt('plu... |
"""This module contains the general information for HuuFirmwareUpdater ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class HuuFirmwareUpdaterConsts:
ADMIN_STATE_TRIGGER = "trigger"
ADMIN_STATE_TRIGGERED = "triggered"
... |
# Load in our dependencies
from math import ceil
# Define our class
class Paginator(object):
def __init__(self, total, items_per_page):
"""
Constructor for pagination class
:param int total: Count of items we are paginating
:param int items_per_page: How many items to place on eac... |
__author__ = 'Shamal Faily'
class TemplateAsset:
def __init__(self,assetId,assetName,shortCode,assetDescription,assetSig,assetType,sType,aRight,spValues,spRat,tags,ifs):
self.theId = assetId
self.theName = assetName
self.theShortCode = shortCode
self.theDescription = assetDescription
self.theSign... |
#!/usr/bin/env python
#import vrep
import time
import socket
import sys
from pyxl320 import ServoSerial
from pyxl320 import Packet
from pyxl320 import DummySerial
port = '/dev/ttyUSB0'
serial = ServoSerial(port) # use this if you want to talk to real servos
# serial = DummySerial(port) # use this for simulation
s... |
import unittest
from BST.Node import Node
class TestNode(unittest.TestCase):
def test_node_is_left_child_is_false(self):
node = Node(5, 2)
self.assertFalse(node.is_leaf())
def test_node_is_left_child(self):
parent_node = Node(5, 2)
lef_child = Node(5, 2, parent=parent_node)
... |
import os
from textwrap import dedent
from pants.backend.python.register import build_file_aliases as register_python
from pants.backend.python.targets.python_binary import PythonBinary
from pants.build_graph.address import Address
from pants.testutil.subsystem.util import init_subsystem
from pants.testutil.task_test_... |
"""Planck-based two-component emission/extinction prediction utilities."""
import numpy as np
import math
import pyfits
import os
def par_struc_2comp():
"""Return dictionary containing various two-component parameters"""
# ----- name of results file
fname = 'planck_2comp.fits'
# ----- Planck+DIRBE best-... |
<<<<<<< HEAD
from __future__ import unicode_literals
import unittest
from django.utils.ipv6 import clean_ipv6_address, is_valid_ipv6_address
class TestUtilsIPv6(unittest.TestCase):
def test_validates_correct_plain_address(self):
self.assertTrue(is_valid_ipv6_address('fe80::223:6cff:fe8a:2e8a'... |
from recipe_engine import recipe_api
from . import android
from . import chromebook
from . import chromecast
from . import default
from . import ios
from . import valgrind
"""Abstractions for running code on various platforms.
The methods in this module define how certain high-level functions should work.
Each flav... |
import random
from odoo import api, fields, models, _
from odoo.exceptions import AccessDenied, AccessError
from odoo.tools import html_escape
class CrmLead(models.Model):
_inherit = "crm.lead"
partner_latitude = fields.Float('Geo Latitude', digits=(16, 5))
partner_longitude = fields.Float('Geo Longitu... |
from office import MSWord, MSExcel
from ooxml import MSWordX, MSExcelX, MSPowerPointX
from ppt import MSPowerPoint
from rtf import RTF
__all__ = [
'MSWord',
'MSExcel',
'MSPowerPoint',
'RTF',
# OOXML
'MSWordX',
'MSExcelX',
'MSPowerPointX',
] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from appconf.models import Project, AuthInfo
# Create your models here.
DEPLOY_POLICY = (
("Direct", "Direct"),
# ("BlueGreen", "BlueGreen"),
)
class Delivery(models.Model):
job_name = mode... |
"""
@name: PyHouse_Install/src/Update/update_install.py
@author: D. Brian Kimmel
@contact: <EMAIL>
@copyright: (c) 2015-2016 by D. Brian Kimmel
@license: MIT License
@note: Created on Oct 14, 2015
@Summary:
This is run as root by the shell script update_install which is run as bin/update_install
"""
... |
import pytest
from cfme.containers.provider import ContainersProvider, refresh_and_navigate
from cfme.utils.ansible import (setup_ansible_script, run_ansible, get_yml_value,
fetch_miq_ansible_module, create_tmp_directory, remove_tmp_files)
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.u... |
{
"name" : "Spain - Accounting (PGCE 2008)",
"version" : "4.0",
"author" : "Spanish Localization Team",
'website' : 'https://launchpad.net/openerp-spain',
'category': 'Localization',
"description": """
Spanish charts of accounts (PGCE 2008).
========================================
* Define... |
#!/usr/bin/env python
"""
.. py:currentmodule:: FileFormat.Results.test_ElectronParameters
.. moduleauthor:: Hendrix Demers <<EMAIL>>
Tests for module `ElectronParameters`.
"""
# Script information for the file.
__author__ = "Hendrix Demers (<EMAIL>)"
__version__ = ""
__date__ = ""
__copyright__ = "Copyri... |
import os
import contextlib
import time
import glob
import re
from inaugurator import sh
class DiskOnKey:
_MOUNT_POINT = "/sourceDOK"
DEVICES_REGEX_PAT = "(/dev/sd[a-z]{1,}(?![0-9]))$"
def __init__(self, expectedLabel=None):
self._expectedLabel = expectedLabel
self._device = self._findDev... |
from six import BytesIO
from avro import ipc
from avro import io
from zope.interface import implements
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
from twisted.internet.defer import maybeDeferred, Deferred
from twisted.web.iweb import IBodyProducer
from twisted.web import resour... |
import sys
sys.stdout.write("#include <stdint.h>\n")
sys.stdout.write("const uint8_t rb528_table[32] = {\n")
for i in range(32):
if not (i % 8):
sys.stdout.write(" ")
sys.stdout.write("%3d" % (((i * 255) + 15.5) // 31))
if (i + 1) % 8:
sys.stdout.write(", ")
elif i != 31:
sys... |
from .agent import (
Agent,
AgentValidationResult,
CreateAgentRequest,
DeleteAgentRequest,
ExportAgentRequest,
ExportAgentResponse,
GetAgentRequest,
GetAgentValidationResultRequest,
ListAgentsRequest,
ListAgentsResponse,
RestoreAgentRequest,
SpeechToTextSettings,
Upda... |
import unittest
import threading
import time
import random
host = "localhost"
port = 80
class Connection:
def __init__(self, host, port=8080):
self.connection = None
self.host = host
self.port = int(port)
def get(self, context='/', headers={}, body=None):
return self.request(... |
#!/usr/bin/env python
# -*- coding:utf-8 -*
"""Scan the all .svg files and add the rts script for the digital
package point name, Bool point
Input: svg files in a directory
Output: svg files in output directory.
"""
__author__ = "Zhiwei Yan"
__copyright__ = "Copyright 2015, The FindPointName Project"... |
class PlotWorkbench(Workbench):
"""Workbench of Plot module."""
def __init__(self):
self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/Plot/resources/icons/PlotWorkbench.svg"
self.__class__.MenuText = "Plot"
self.__class__.ToolTip = "The Plot module is used to edit/save output plots p... |
import tvm
from tvm import te
from tvm.contrib import util
import numpy as np
import tvm.testing
@tvm.testing.requires_gpu
def test_large_uint_imm():
value = (1 << 63) + 123
other = tvm.tir.const(3, "uint64")
n = 12
num_thread = 2
A = te.compute((n,), lambda *i: tvm.tir.const(value, "uint64") + o... |
"""
Translation CLI.
"""
import argparse
import sys
import time
from contextlib import ExitStack
from typing import Generator, Optional, List
import mxnet as mx
from math import ceil
from sockeye.lexicon import TopKLexicon
from sockeye.log import setup_main_logger
from sockeye.output_handler import get_output_handler... |
"""\
UnitTest runner. This one searches for all files named test_*.py and collects
all test cases from these files. Finally it runs all tests and prints a
summary.
"""
import unittest
import sys
import os
# inject local copy to avoid testing the installed version instead of the
sys.path.insert(0, os.path.dirname(os.p... |
#!/usr/bin/env python
#
# Parses delta v file from Lance Benner
# @ http://echo.jpl.nasa.gov/~lance/delta_v/delta_v.rendezvous.html
#
import csv
import re
import StringIO
import sys
import urllib2
BENNER_URL = 'http://echo.jpl.nasa.gov/~lance/delta_v/delta_v.rendezvous.html'
def process_from_internet():
data = url... |
"""Hello World API implemented using Google Cloud Endpoints.
Contains declarations of endpoint, endpoint methods,
as well as the ProtoRPC message class and container required
for endpoint method definition.
"""
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remot... |
from openerp.osv import fields, osv
class company(osv.osv):
_inherit = 'res.company'
_columns = {
'security_lead': fields.float(
'Security Days', required=True,
help="Margin of error for dates promised to customers. "\
"Products will be scheduled for procurement... |
# std
import os
import logging
import glob
import subprocess
import tempfile
import time
import sys
import signal
# datadog
from util import get_os, yLoader, yDumper
from config import get_config, get_confd_path, get_logging_config, \
PathNotFound, DEFAULT_CHECK_FREQUENCY
# 3rd party
import yaml
log = logging.ge... |
"""Activates arm mirror, changes eyes and says a short sentence every few seconds"""
from time import sleep
from random import randint
import subprocess
import threading
from Movements import Movements
from Audio import Audio
from Eyes import Eyes
MOVEMENTS = Movements()
AUDIO = Audio()
EYES = Eyes()
def arm_mirror(... |
import os
gridName = os.environ['gridName']
start_date = os.environ['start_date']
end_date = os.environ['end_date']
startup_type = os.environ['startup_type']
startup_file = os.environ['startup_file']
startup_uv_type = os.environ['startup_uv_type']
startup_turb_type = os.environ['startup_turb_type']
extstep_seconds = o... |
import atb
import numpy as np
from gl_utils import draw_gl_polyline_norm
from ctypes import c_float,c_int
import cv2
from plugin import Plugin
from calibrate import get_map_from_cloud
class Show_Calibration(Plugin):
"""Calibration results visualization plugin"""
def __init__(self, img_shape, atb_pos=(500,300)... |
import logging
from django.conf import settings
from heatclient import client as heat_client
from openstack_dashboard.api.base import url_for
LOG = logging.getLogger(__name__)
def format_parameters(params):
parameters = {}
for count, p in enumerate(params, 1):
parameters['Parameters.member.%d.Parame... |
import zipfile
from lxml import etree
class Epub(object):
def __init__(self, filename):
self.__fileName = filename
self.__title = ""
self.__author = ""
self.__rights = ""
self.__identifier = ""
self.__language = ""
self.__zipFile = None
self.__book... |
#!/usr/bin/python
import cv2, sys
from cv2 import cv
import os
import numpy as np
def showme(pic):
cv2.imshow('window',pic)
cv2.waitKey()
cv2.destroyAllWindows()
def main(argv):
inputfile = 'test/test-tmp-1-34227-polygon-extracted.tif'
if len(argv) == 1:
inputfile = argv[0]
circleDetect(inputfile)
def cir... |
"""
"""
# standard
import json
# package
from pyvault import errors
from pyvault import settings
# from pyvault.db import utils
from pyvault.db.table import TABLE
from pyvault.db.key_manager import KEYMAN
from pyvault.crypto import encryption_utils
class PasswordManager(object):
"""Singleton class that acts as ... |
from datetime import datetime
def obj_string(obj_name: str, obj_value):
"""
Return a string of attr_name:\n\tobj_value.attr_name[0]: obj_value.attr_value[0]...
:param obj_name: The name of the object.
:param obj_value: The value of the object.
:return:
"""
str_out = ''
if obj_value:
... |
# # # # # select from NetCDF Dataset across an AOI # # # #
def transform_from_latlon( lat, lon ):
''' simple way to make an affine transform from lats and lons coords '''
from affine import Affine
lat = np.asarray( lat )
lon = np.asarray(lon)
trans = Affine.translation(lon[0], lat[0])
scale = Affine.scale(lon[1... |
import os
from io import StringIO
from unittest import mock
from django.contrib.gis.geos import Point
from django.core.management import call_command, CommandError
from django.test import TransactionTestCase
from geotrek.altimetry.functions import RasterValue
from geotrek.altimetry.models import Dem
class CommandLo... |
#!/usr/bin/env python3
import sys
import os
import unittest
import logging
# Extend PYTHONPATH with local 'lib' folder
if __name__ == "__main__":
jasyroot = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir, os.pardir))
sys.path.insert(0, jasyroot)
print("Running from %s..."... |
import sys
import os
from bs4 import BeautifulSoup
characters = " abcdefghijklmnopqrstuvwxyz;,./['LR"
def main():
path = 'keytime.html'
if 2 <= len(sys.argv):
path = sys.argv[1]
content = ''
with open(path) as file:
content = file.read()
soup = BeautifulSoup(content, 'html5lib')
... |
#!/usr/bin/env python3
__author__ = 'nlw'
import argparse
import logging
import unittest
import re
from scigraph.api.SciGraph import SciGraph
from scigraph.renderers.TabRenderer import *
from scigraph.renderers.RawRenderer import *
from scigraph.renderers.EntityAnnotationTabRenderer import *
import wikipedia
render... |
# -*- coding: utf-8 -*-
"""
State tracking functionality for django models
"""
import inspect
from functools import wraps
import sys
from django.db import models
try:
from django.apps import apps as django_apps
def get_model(app_label, model_name):
app = django_apps.get_app_config(app_label)
re... |
#!/usr/bin/python
"""
Map an RPM package name to the equivalent DEB.
The MAPPING is static, but in future will be
made dynamically by querying the package databases.
"""
import platform
TARGET_SPECIFIC_MAPPING = {
'debian:jessie/sid': {
'kernel': ['linux-image-amd64'],
'kernel-firmware': ['firmwa... |
from unittest import TestCase
from test.utils import skipUnlessIntegrationTest
from test.utils import ConfigFileOverrideMixin
from harvester.fetcher import get_log_file_path
@skipUnlessIntegrationTest()
class CouchIntegrationTestCase(ConfigFileOverrideMixin, TestCase):
def setUp(self):
super(CouchIntegrati... |
import datetime
import random
import time
import numpy as np
import pandas as pd
from QUANTAXIS.QAMarket.QAOrder import QA_Order, QA_Order_list
from QUANTAXIS.QAUtil.QALogs import QA_util_log_info
from QUANTAXIS.QAUtil.QAParameter import MARKET_TYPE, Order_DIRECTION
from QUANTAXIS.QAUtil.QARandom import QA_util_rando... |
import collections
from unittest import mock
from django.urls import reverse
from horizon.workflows import views
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.networks import tests
from openstack_dashboard.test import helpers as test
from openstack_dashboard.usage import quotas
DET... |
"""Utility functions for security features of Ganeti.
"""
import logging
import OpenSSL
import os
import uuid as uuid_module
from ganeti.utils import io
from ganeti.utils import x509
from ganeti import constants
from ganeti import errors
from ganeti import pathutils
def UuidToInt(uuid):
uuid_obj = uuid_module.UU... |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth.models import User
from django.conf import settings
from django.forms.models import construct_instance
from django.contrib.auth.mixins import LoginRequiredMixin
from bootstrap_toolkit.widgets import BootstrapDateTimeInput, BootstrapDateInput
from... |
#!/usr/bin/env python
# common params for amino acids (from SEQUEST)
AA_MonoMassMap = {
'G' : 57.0214636,
'A' : 71.0371136,
'S' : 87.0320282,
'P' : 97.0527636,
'V' : 99.0684136,
'T' : 101.0476782,
#'C' : 103.0091854,
'C' : 160.0306454, #103.0091854+57.02146,
'... |
"""
Platform that supports scanning iCloud.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.icloud/
"""
import logging
import random
import os
import voluptuous as vol
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD
from home... |
'''
------------------------------------------------------------------------------
Copyright (c) 2015 Microsoft Corporation
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... |
"""API tests for the projector plugin in TensorBoard."""
import os
import tensorflow as tf
from google.protobuf import text_format
from tensorboard.plugins import projector
from tensorboard.util import test_util
def create_dummy_config():
return projector.ProjectorConfig(
model_checkpoint_path="test"... |
# -*- coding: utf-8 -*-
"""The interface for Windows Registry related objects."""
import abc
class WinRegKey(object):
"""Abstract class to represent the Windows Registry key interface."""
PATH_SEPARATOR = u'\\'
@abc.abstractproperty
def last_written_timestamp(self):
"""The last written time of the key ... |
from __future__ import unicode_literals
from .compat import implements_to_string
from . import diagnose
from .interface import AttributeExposer
__all__ = ["MoyaException", "FatalMoyaException", "throw"]
@implements_to_string
class MoyaException(Exception, AttributeExposer):
fatal = False
__moya_exposed_att... |
import sys
from tqdm import tqdm
from nlpia.loaders import get_data
if len(sys.argv) > 1:
lang = sys.argv[1][:3].lower()
else:
lang = 'deu'
df = get_data(lang)
print(df.columns)
input_texts, target_texts = [], [] # <1>
input_vocabulary = set() # <3>
output_vocabulary = set()
start_token, stop_token = '\t\... |
"""
This file contains basic api for generator_tool and osm tools to generate maps.
"""
import functools
import json
import logging
import os
import shutil
import subprocess
from typing import AnyStr
from maps_generator.generator import settings
from maps_generator.generator.env import Env
from maps_generator.generato... |
import collections
import os
import time
import uuid
from ovs.db import idl
from ovs import jsonrpc
from ovs import poller
from ovs import stream
from neutron._i18n import _
from neutron.common import exceptions
RowLookup = collections.namedtuple('RowLookup',
['table', 'column', '... |
import os
import sys
import subprocess
import json
import jinja2
import shutil
sys.path.append('../../../libbeat/tests/system')
from beat.beat import TestCase
from beat.beat import Proc
TRANS_REQUIRED_FIELDS = ["@timestamp", "type", "status",
"beat.name", "beat.hostname", "beat.version"]
FL... |
import os.path
# Import cutils modules
from types import C_TYPES
from generator import methods, Function
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
GUARD = 'SINGLY_LINKED_LIST', '35118355245711974'
PROTO = 'void*'
LLIST = 'SinglyLinkedList'
PREFIX = 'cutils_csll'
#- - - - - -... |
"""
Django settings for simpleCMDB project.
Generated by 'django-admin startproject' using Django 1.9.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... |
"""
For CommonsCloud copyright information please see the LICENSE document
(the "License") included with this software package. This file may not
be used in any manner except in compliance with the License
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed ... |
import re
import urllib2
from autopkglib import Processor, ProcessorError
__all__ = ["MozillaURLProvider"]
MOZ_BASE_URL = "http://ftp.mozilla.org/pub/mozilla.org/"
#"firefox/releases")
re_dmg = re.compile(r'a[^>]* href="(?P<filename>[^"]+\.dmg)"')
class MozillaURLProvider(Processor):
descripti... |
# Set of util functions for work with ToolDog container
import sys
import logging
LOGGER = logging.getLogger(__name__)
def cd(path, cmd):
return "bash -c 'cd " + path + " && " + cmd + "'"
def pip(v, cmd):
return "pip" + str(v) + " " + cmd
def execute(ctx, cmd):
result = ''
exe = ctx.exec(cmd)
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from entropyfw.common.event import Event
from entropyfw.common.request import Request
import abc
__author__ = 'otger'
class Player(metaclass=abc.ABCMeta):
def __init__(self, name):
self.d = None
self.name = name or self.name
self._req_counter = 0
... |
from __future__ import print_function
import os
import sys
from threading import RLock, Timer
from py4j.java_gateway import java_import, JavaObject
from pyspark import RDD, SparkConf
from pyspark.serializers import NoOpSerializer, UTF8Deserializer, CloudPickleSerializer
from pyspark.context import SparkContext
from ... |
# -*- coding: utf-8 -*-
"""config.example
This is an example configuration file for SIPA, suggesting
defaults for deployment.
Every value not commented with "Must be set" has been given the
default value which is assigned in the comment.
"""
# The Secret key. It should ALWAYS be set and kept secret!
... |
from .sub_resource import SubResource
class Probe(SubResource):
"""A load balancer probe.
Variables are only populated by the server, and will be ignored when
sending a request.
:param id: Resource ID.
:type id: str
:ivar load_balancing_rules: The load balancer rules that use this probe.
... |
from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
from django.utils.encoding import force_text
from django.utils.transla... |
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from django.contrib.admin.sites import site
from django.urls.conf import include, path
from forum.account.urls import urlpatterns_account
from forum.base.urls import urlpatterns_base
from forum.rest_api.urls im... |
# -*- coding: utf-8 -*-
"""Setup script for django-gae2django."""
import os
from distutils.core import setup
def find_packages(base_dir):
yield base_dir
for fname in os.listdir(base_dir):
if fname.startswith('.'):
continue
fullpath = os.path.join(base_dir, fname)
if os.p... |
def probY( S, y, beta ):
return float( float( len( subsetWithY( S, y ) ) + beta ) / float( len( S ) + beta ) )
def probX( S, x, beta ):
return float( float( len( subsetWithX( S, x ) ) + beta ) / float( len( S ) + beta ) )
def subsetWithY( S, y ):
return [ s for s in S if s[-1] == y ]
def subsetWithX( S, x ):
ret... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This module implements community detection.
"""
__all__ = ["partition_at_level", "modularity", "best_partition", "generate_dendogram", "induced_graph"]
__author__ = """Thomas Aynaud (<EMAIL>)"""
# Copyright (C) 2009 by
# Thomas Aynaud <<EMAIL>>
# All right... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.