code stringlengths 1 199k |
|---|
import logging
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from sugar3.graphics import style
from sugar3.graphics.icon import _SVGLoader
ICON_ENTRY_PRIMARY = Gtk.EntryIconPosition.PRIMARY
ICON_ENTRY_SECONDARY = Gtk.EntryIconPosition.S... |
from tendrl.commons import objects
class AlertOrganization(objects.BaseObject):
def __init__(self, org_name=None, org_id=None,
auth_key=None, *args, **kwargs):
super(AlertOrganization, self).__init__(*args, **kwargs)
self.org_name = org_name
self.org_id = org_id
self... |
import sys
from paravistest import datadir, pictureext, get_picture_dir
from presentations import CreatePrsForFile, PrsTypeEnum
import pvserver as paravis
picturedir = get_picture_dir("StreamLines/A1")
myParavis = paravis.myParavis
file = datadir + "hexa_28320_ELEM.med"
print " --------------------------------- "
prin... |
from testlib import *
def content_action_btn(index):
return "#content .list-group li:nth-child(%d) .btn-group" % index
class StorageCase(MachineCase):
def setUp(self):
MachineCase.setUp(self)
# Install a udev rule to work around the fact that serials from
# VirtIO devices don't seem to a... |
from apps.clientes.forms import ClienteForm
from apps.clientes.models import Cliente
from django.views.generic import ListView, CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
class ClientesList(ListView):
"""
Crea una lista con todos los clientes dados de alta en el modelo
... |
'''
Created on Dec 1, 2013
@author: jurek
'''
from hra_math.utils.utils import print_import_error
try:
import pylab as pl
from hra_core.io_utils import number_of_lines
except ImportError as error:
print_import_error(__name__, error)
def prepare_data_arrays(_file, _headers_count, _data):
"""
function... |
import glob
from datetime import datetime
import logging as log
import gensim
import matplotlib.pyplot as plt
import pyLDAvis
import pyLDAvis.gensim
from gensim.models import CoherenceModel
from sklearn.externals import joblib
import gzip
from multiprocessing import Pool
get_ipython().magic(u'matplotlib notebook')
clas... |
"""
This is the Docutils (Python Documentation Utilities) package.
Package Structure
=================
Modules:
- __init__.py: Contains component base classes, exception classes, and
Docutils version information.
- core.py: Contains the ``Publisher`` class and ``publish_*()`` convenience
functions.
- frontend.py: R... |
import numpy
import math
import pyparticleest.models.nlg as nlg
import pyparticleest.simulator as simulator
import matplotlib.pyplot as plt
def generate_dataset(steps, P0, Q, R):
x = numpy.zeros((steps + 1,))
y = numpy.zeros((steps + 1,))
x[0] = numpy.random.multivariate_normal((0.0,), P0)
y[0] = 0.05 ... |
"""Raw representations of every data type in the AWS AutoScalingPlans service.
See Also:
`AWS developer guide for AutoScalingPlans
<https://docs.aws.amazon.com/autoscaling/plans/userguide/>`_
This file is automatically generated, and should not be directly edited.
"""
from attr import attrib
from attr import at... |
from setuptools import setup
setup(
name='salesforce-python-toolkit',
version='0.1.3',
description='A fork of BayAreaCitizen\'s fork of http://code.google.com/p/salesforce-python-toolkit/',
url='http://github.com/nathairtras/salesforce-python-toolkit',
packages=[
'sforce',
],
install... |
import os
import numpy as np
import progressbar as pbar
from collections import namedtuple
from droplets.flow import FlowData
from droplets.interface import get_interface
from strata.dataformats.read import read_from_files
from strata.utils import *
"""Module for finding the spreading of a droplet.
Analyses groups of d... |
from weboob.capabilities.base import find_object
from weboob.capabilities.bank import (
CapBankWealth, CapBankTransferAddRecipient, AccountNotFound, RecipientNotFound,
TransferInvalidLabel, Account,
)
from weboob.capabilities.profile import CapProfile
from weboob.tools.backend import Module, BackendConfig
from ... |
import time
import os
import roslib; roslib.load_manifest('meka_description')
import rospy
from sensor_msgs.msg import JointState
from std_msgs.msg import Header
def shm_humanoid(joint_states):
for i in range(len(joints)):
for j in range(len(joint_states.name)):
if joints[i] == joint_states.name[j]:
posit... |
"""unit_dimension_fk
Revision ID: 6402bb82a531
Revises: 5e381835e382
Create Date: 2019-03-18 15:07:16.318347
"""
from alembic import op
import sqlalchemy as sa
import logging
log = logging.getLogger(__name__)
revision = '6402bb82a531'
down_revision = '5e381835e382'
branch_labels = None
depends_on = None
def upgrade():
... |
import KBEngine
import SpaceContext
from KBEDebug import *
class Teleport:
def __init__(self):
pass
def onDestroy(self):
"""
entity销毁
"""
self.getCurrSpaceBase().logoutSpace(self.id)
def teleportSpace(self, spaceUType, position, direction, context):
"""
defined.
传送到某场景
"""
assert self.base != Non... |
import plot,numpy as np
import matplotlib as mpl
def git(ax,res,yerr):
#res = [3.13,2.18]
#yerr = [1.16,0.89]
labels = ["Iso-energy","Iso-depth"]
ind = np.arange(len(res))
margin = 0.2
width = (1.-2.*margin)
xdata = ind-width/2.
ax.bar(xdata, res, width, yerr=yerr,color='k',ecolor='k',lw... |
from io import *
def value(name):
return sum([ord(c)-ord('A')+1 for c in name])
if __name__ == '__main__':
lines = sum([[ word.strip('"') for word in line.split(',')] for line in open('names.txt','r') ],[])
lines.sort()
acc = 0
print(value("COLIN"))
for i in range(len(lines)):
if lines[i... |
"""LanguageTool command line."""
import argparse
import locale
import re
import sys
from . import __version__
from . import Error
from . import LanguageTool
def parse_args():
parser = argparse.ArgumentParser(
description=__doc__.strip() if __doc__ else None,
prog='language-check')
parser.add_arg... |
import sys
import os
import sphinx_rtd_theme
sys.path.insert(0, os.path.abspath('../..'))
matlab_src_dir = os.path.abspath('../..')
primary_domain = 'mat'
extensions = [
'sphinx.ext.viewcode',
'sphinx.ext.autodoc',
'sphinxcontrib.matlab',
'sphinx.ext.mathjax',
]
templates_path = ['_templates']
source_su... |
from . import hr_payroll |
from unittest import TestCase
from Angles.deflection import Deflection
from degree import Degree
from Angles.azimuth import Azimuth as Azimuth
class TestDeflection(TestCase):
def test_Deflection_basicCreation(self):
defl = Deflection(Degree(7.0))
self.assertIsNotNone(defl)
expected = 7.0
... |
import UserDict
import traceback
void = lambda *args, **kwds: None
def chain(poll, seq):
try:
for ind in seq:
ind(poll, seq)
except StopIteration:
pass
def apply(handle, *args, **kwargs):
try:
seq = handle(*args, **kwargs)
return seq
except:
traceback.... |
{
"name" : "Sale Report - Lithuania",
"version" : "0.1",
"author" : "Cesar Lage",
"category" : "Accounting",
"website" : "https://yelizariev.github.io",
"description": """
Sale Report - Lithuania
""",
"depends": ["account"],
"data": ['report_invoice.xml',],
"installable":... |
from .context import pycal
import pycal.basis as bs
import pycal.geometry as geo
import unittest
import numpy as np
class GeometryL2Test( unittest.TestCase ):
def setUp( self ):
self.P = 1e2
self.grid = np.linspace( 0, 1, self.P )
self.h = self.grid[ 1 ] - self.grid[ 0 ]
self.tol = 5... |
import sys
import cairo
import pycha.line
from lines import lines
def lineChart(output):
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 800, 400)
dataSet = (
('lines', [(i, l[1]) for i, l in enumerate(lines)]),
)
options = {
'axis': {
'x': {
'ticks': [d... |
"""XArray version of bilinear interpolation."""
import warnings
import dask.array as da
import numpy as np
import zarr
from dask import delayed
from xarray import DataArray, Dataset
from pyresample import CHUNK_SIZE
from pyresample._spatial_mp import Proj
from pyresample.bilinear._base import (
BilinearBase,
ar... |
import bpy
import ifcopenshell
import ifcopenshell.api
from blenderbim.bim.module.model import root, product, wall, slab, profile, opening, task
from blenderbim.bim.ifc import IfcStore
from bpy.app.handlers import persistent
@persistent
def load_post(*args):
ifcopenshell.api.add_pre_listener("attribute.edit_attribu... |
def DataHandlerMain(namespace, InputFilename, OutputFilename):
import mcl.imports
import mcl.data.Input
import mcl.data.Output
import mcl.status
import mcl.target
import mcl.object.Message
mcl.imports.ImportNamesWithNamespace(namespace, 'mca.process.cmd.runaschild', globals())
input = mc... |
from __future__ import absolute_import, unicode_literals
import collections
import contextlib
import datetime
import errno
import fileinput
import io
import itertools
import json
import locale
import operator
import os
import platform
import re
import shutil
import string
import subprocess
import socket
import sys
impo... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('goals', '0004_add_value_unit_on_progress'),
]
operations = [
migrations.AlterField(
model_name='progress',
name='value_unit',
... |
from pyspark import SparkConf, SparkContext
from pyspark.sql import SQLContext, Row
from pyspark.sql.types import BooleanType
import sys
sys.path.insert(0, './lib/')
import aggregatedComparison
import fspLib
import to_parquet
from stream_processing import create_bin
def big_print(in_str):
print "###################... |
from __future__ import unicode_literals
AUTHOR = u'YOUR NAME'
SITENAME = u'YOUR SITE NAME'
SITEURL = ''
PATH = 'content'
READERS = {'html': None}
ARTICLE_PATHS = ['articles']
STATIC_PATHS = ['articles', 'extra', 'code']
EXTRA_PATH_METADATA = {'extra/robots.txt': {'path': 'robots.txt'},
'extra/man... |
from consts import METRICS_MAXIMIZE, METRICS_MINIMIZE
from npGIAforZ3 import GuidedImprovementAlgorithm, \
GuidedImprovementAlgorithmOptions
from npGIAforZ3 import setRecordPoint
from z3 import *
import Z3ModelEShopOriginal as SHP
import Z3ModelEmergencyResponseOriginal as ERS
import Z3ModelWebPortalUpdate as WPT
i... |
import unittest
from mushroom.data.TagManager import TagManager
class testTagManager(unittest.TestCase):
def test_tag_creation(self):
manager = TagManager.from_nb_tags(2)
tag = manager.get_tag("cat1")
self.assertEquals(tag, [1,0])
tag = manager.get_tag("cat2")
self.assertEqua... |
class PaginationHelper:
# The constructor takes in an array of items and a integer indicating
# how many items fit within a single page
def __init__(self, collection, items_per_page):
self.num_items = len(collection)
self.page_size = items_per_page
# not strictly necessary but convenient to avoi... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import * # noqa
import os
from nose.tools import eq_, raises
from ycmd.completers.go.... |
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operations = [
migrations.RunPython(
code=share.robot.RobotUserMi... |
"""Domain objects for app feedback reports."""
from __future__ import annotations
import datetime
import re
from core import feconf
from core import utils
from core.domain import app_feedback_report_constants
from core.domain import exp_services
from core.domain import story_domain
from core.domain import topic_domain
... |
from datetime import datetime, timedelta
from urllib.parse import urlencode
import colander
import kinto.core
from cornice.validators import colander_validator
from kinto.authorization import RouteFactory
from kinto.core import resource
from kinto.core import utils as core_utils
from kinto.core.storage import Filter, S... |
import argparse
import os
import random
import wget
import time
import warnings
import json
import collections
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from torch.utils.data import Subset
from utils import get_dataset, get_model, get_optim... |
from setuptools import setup
def get_long_description():
with open('README.md') as f:
txt = f.read()
return txt
setup(
name='Flask-SecuREST',
version='0.8',
url='https://github.com/cloudify-cosmo/flask-securest/',
license='LICENSE',
author='cosmo-admin',
author_email='cosmo-admin... |
"""
Extracting the race rating of both the Senate and House, which is
a spectrum that analyzes the vulnerability (the chances of the
seat switching parties) of the Senate/House races up this cycle
@Author Charles Xu Octorber 21, 2015
"""
from pyvirtualdisplay import Display
from selenium import webdriver
import psyc... |
import argparse
import os
import sys
import hjson
from Crypto.Hash import SHA256
from mako.template import Template
'''
Read in a JSON test vector file, convert the test vector to C constants, and
generate a header file with these test vectors.
'''
RSA_3072_NUMWORDS = int(3072 / 32)
INT_256_NUMWORDS = int(256 / 32)
TEM... |
s = '01101101011011110110111001101011011001010111100101110011'
ans = []
for i in range(len(s) / 8):
ans.append(chr(int(s[i * 8:(i + 1) * 8], 2)))
print ''.join(ans) |
from testtools import matchers
from tempest.api.compute import base
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
CONF = config.CONF
class VolumesGetTestJSON(base.BaseV2ComputeTest):
"""Test compute volumes API with microversion less than 2.36"""
#... |
from functools import partial
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from ..models import Submission
from .factories import SubmissionFactory, UserFactory, VoterFactory, SiteFactory, DebateFactory
old_reverse = reverse
rever... |
import re
def urlify(s, length):
if not s:
return []
# Kind of the pythonic wat
s = ''.join(s)
return list(re.sub(r'\s', '%20', s.strip()))
# String manipulation
# solution = []
# num_chars = 0
# for character in s:
# if character == ' ':
# solution.extend(['%... |
"""
Copyright 2014-2016 Andreas Würl
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... |
"""
Tests For Scheduler
"""
import mox
from nova.compute import api as compute_api
from nova.compute import power_state
from nova.compute import rpcapi as compute_rpcapi
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import context
from nova import db
from nova import excep... |
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.api.urlfetch import DownloadError
from library import login
from boto.ec2.connection import *
class Allocate_IP(webapp.RequestHandler):
def post(self):
mobile = self.request.get('mobile')
if mobile !... |
try:
import json
except ImportError:
import simplejson as json
from django.conf import settings
from djcelery.models import PeriodicTask as PerodicTaskModel
from celery.task import PeriodicTask, Task
from celery.app import current_app
class Provider(object):
def __call__(self):
return self
@clas... |
from security_monkey import rbac
from security_monkey.views import AuthenticatedService
from security_monkey.views import ITEM_FIELDS
from security_monkey.views import AUDIT_FIELDS
from security_monkey.views import ITEM_LINK_FIELDS
from security_monkey.datastore import ItemAudit
from security_monkey.datastore import It... |
__author__ = 'devs@gemynd.ai'
__version__ = '0.1alpha'
from message import Message |
import unittest
import numpy as np
from spectralcluster import custom_distance_kmeans
from spectralcluster import utils
class TestCustomDistanceKmeans(unittest.TestCase):
"""Tests for the run_kmeans function with the CustomKMeans class."""
def setUp(self):
super().setUp()
pass
def test_6by2_matrix_cosine_... |
import proto # type: ignore
__protobuf__ = proto.module(
package="google.cloud.datalabeling.v1beta1",
manifest={"AnnotationSpecSet", "AnnotationSpec",},
)
class AnnotationSpecSet(proto.Message):
r"""An AnnotationSpecSet is a collection of label definitions.
For example, in image classification tasks, y... |
import unittest
import mock
import requests
import responses
from requests_ntlm2 import HttpNtlm2Auth, InvalidCredentialsError, NtlmAuthenticationError
class RequestsNtlm2(unittest.TestCase):
# [MS-NTHT] - v20151016
@classmethod
def setUpClass(cls):
cls.url = "http://www.test.com"
cls.domain... |
"""Base class for Azure Devops unit tests."""
from ..source_collector_test_case import SourceCollectorTestCase
class AzureDevopsTestCase(SourceCollectorTestCase): # skipcq: PTC-W0046
"""Base class for testing Azure DevOps collectors."""
SOURCE_TYPE = "azure_devops"
def setUp(self):
"""Extend to add... |
"""Trains a real-time arbitrary image stylization model.
For example of usage see start_training_locally.sh and start_training_on_borg.sh
"""
import ast
import os
from magenta.models.arbitrary_image_stylization import arbitrary_image_stylization_build_model as build_model
from magenta.models.image_stylization import im... |
"""A simple wrapper around the OAuth2 credentials library."""
from oauth2client import client
def get_credentials():
"""Gets credentials implicitly from the current environment.
.. note::
You should not need to use this function directly. Instead, use the
helper method :func:`gcloud.datastore.__init... |
"""Implementing some types of ENN ensembles in JAX."""
from typing import Callable, Optional, Sequence, Tuple
import chex
from enn import base
from enn.networks import indexers
from enn.networks import priors
import haiku as hk
import jax
import jax.numpy as jnp
class Ensemble(base.EpistemicNetwork):
"""Ensemble ENN ... |
import sys
sys.path.extend(['..'])
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.rnn_cell import LSTMCell
from random import shuffle
import dataset
from tf_ext.bricks import embedding, rnn, rnn_decoder, dense_to_one_hot, brnn, device_for_node_cpu, \
device_for_node_gpu_matmul
from tf_ext.opt... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Request',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=T... |
from pkg_resources import get_distribution
from . client import Client
from . schema import Schema
__version__ = get_distribution('dsclient').version |
"""
Class for VM tasks like spawn, snapshot, suspend, resume etc.
"""
import base64
import os
import time
import urllib
import urllib2
import uuid
from nova.compute import power_state
from nova import exception
from nova import flags
from nova import log as logging
from nova import utils
from nova.virt.vmwareapi import... |
def flatten(data):
if not isinstance(data, dict):
return data
result = {}
for key in data.keys():
children = flatten(data[key])
if not isinstance(children, dict):
result[key] = children
continue
for subkey in children.keys():
result["/".joi... |
import time
def onInsert(row):
row.cell("Date added").rawData = int(time.time())
row.save()
def onUpdate(row):
pass
def onDelete(row):
pass |
from os.path import join, exists
import numpy as np
from tqdm import tqdm
import tensorflow as tf
from third_party.xiuminglib import xiuminglib as xm
from nerfactor.networks import mlp
from nerfactor.networks.embedder import Embedder
from nerfactor.util import logging as logutil, math as mathutil, io as ioutil, \
i... |
import abc
import collections
import functools
import itertools
import random
from neutron_lib import constants as lib_const
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_log import log as logging
import six
from sqlalchemy import sql
from neutron._i18n import _LE, _LW
from neutron.commo... |
import os
from jacket.db.sqlalchemy import migrate_repo
from migrate.versioning.shell import main
if __name__ == '__main__':
main(debug='False',
repository=os.path.abspath(os.path.dirname(migrate_repo.__file__))) |
from devsim import *
device="MyDevice"
interface="MySiOx"
regions =("MyOxRegion", "MySiRegion")
create_1d_mesh(mesh="cap")
add_1d_mesh_line(mesh="cap", pos=0, ps=0.1, tag="top")
add_1d_mesh_line(mesh="cap", pos=0.5, ps=0.1, tag="mid")
add_1d_mesh_line(mesh="cap", pos=1, ps=0.1, tag="bot")
add_1d_contact (mesh="cap... |
import logging
import json
from datetime import datetime
from rest_framework import response, schemas, viewsets, mixins
from rest_framework.decorators import *
from rest_framework_swagger.renderers import OpenAPIRenderer, SwaggerUIRenderer
from rest_framework.response import Response
from rest_framework.permissions imp... |
"""
SQLAlchemy models for nova data.
"""
from sqlalchemy import Column, Index, Integer, BigInteger, String, schema
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import ForeignKey, DateTime, Boolean, Text, Float
from sqlalchemy.orm import relationship, backref, object_mapper
from oslo.config im... |
az.plot_ppc(data, kind='cumulative') |
"""The Apple System Log (ASL) file parser."""
from dfdatetime import posix_time as dfdatetime_posix_time
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import errors
from plaso.lib import definitions
from plaso.lib import specification
from plaso.parsers import dtfabric_pars... |
from dockerspawner import DockerSpawner
from jupyter_client.localinterfaces import public_ips
import base64
c.Authenticator.admin_users = set(['vagrant'])
c.DockerSpawner.http_timeout = 120
c.DockerSpawner.container_image = 'radiasoft/beamsim-jupyter'
c.DockerSpawner.remove_containers = True
c.DockerSpawner.use_interna... |
import os
import pytest
import salt.modules.tls as tls
from tests.support.helpers import SKIP_INITIAL_PHOTONOS_FAILURES
from tests.support.mock import MagicMock, patch
pytestmark = [
SKIP_INITIAL_PHOTONOS_FAILURES,
]
@pytest.fixture
def configure_loader_modules():
return {tls: {}}
@pytest.fixture(scope="module"... |
import os
from flask import Flask, jsonify
from Data import *
from flask import request
from add_signal_db import add_signal
from flask import url_for, redirect
from flask import render_template
from cloudant.client import Cloudant
from cloudant.error import CloudantException
from cloudant.result import Result, ResultB... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mobiles', '0006_auto_20180530_0734'),
]
operations = [
migrations.AlterField(
model_name='product',
name='size',
fiel... |
"""
Uses SimpleXMLRPCServer's SimpleXMLRPCDispatcher to serve XML-RPC requests
New BSD License
===============
Copyright (c) 2007, Graham Binns
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redist... |
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import object
from collections import namedtuple
from contextlib import contextmanager
import mock
from pants.pantsd.service.fs_event_service import FSEventService
from pants.pantsd.watchman import Watchman
from pants_test.... |
from concurrent.futures import Future
from unittest import mock
from gmncurses.ui import signals, views
from gmncurses import controllers, config
from gmncurses.executor import Executor
from gmncurses.core import StateMachine
from tests import factories
def test_sprints_controller_show_the_help_popup():
project = f... |
from __future__ import absolute_import, division, print_function, with_statement
import collections
import logging
import time
import sys,os
sys.path.insert(0, os.path.split(os.path.split(os.path.realpath(sys.argv[0]))[0])[0])
class LRUCache(collections.MutableMapping):
"""This class is not thread safe"""
def ... |
import os
import utils.process_utils as process_utils
import utils.xml_utils as xml_utils
class SvnGateway():
def get_local_changed_files(self, abs_path, ignore_unversioned=True):
status_info = process_utils.invoke(['svn', 'status', '--xml', abs_path])
entries_xpath = '*/entry'
found_results... |
from sistr.src.writers import to_dict, flatten_dict
import numpy as np
import pandas as pd
class Test1:
a = 1
b = 3.2
c = 'abc'
z = False
def __init__(self):
self.i = 9
self.j = 0.56
self.k = 'test'
self.l = [1, 2, 3]
self.d = {'a':1, 'b':2}
class Test2:
q... |
"""Tests for the patches utility."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from moonlight.util import patches
from six import moves
class PatchesTest(tf.test.TestCase):
def test2D(self):
image_t = tf.random_uniform((100... |
"""The Greplin root package."""
import pkg_resources
pkg_resources.declare_namespace('greplin.tornado') |
from ronin.cli import cli
from ronin.contexts import new_context
from ronin.phases import Phase
from ronin.projects import Project
from ronin.rust import RustBuild
from ronin.utils.paths import glob
with new_context(output_path_relative='build1') as ctx:
project = Project('Rust Hello World')
Phase(project=proje... |
import xlrd
def create_table(kwargs):
"""
method for creating latex code
it returns string
kwargs are = rows, left, right, top, bottom
"""
table = "\\begin{tabular}{ |"
width = kwargs.get('right')-kwargs.get('left')+1
height = kwargs.get('bottom')-kwargs.get('top')
rows = kwargs.get(... |
import webapp2
import endpoints
from models.character import Character
class InputCharacter(endpoints.BaseEndpoint):
def get(self):
self.name = self.request.get('NAME')
self.strength = self.request.get('STR')
self.dexterity = self.request.get('DEX')
self.constitution = self.request.g... |
"""This example covers the concepts of Estimator, Transformer, and Param.
"""
from pyspark.ml.linalg import Vectors
from pyspark.ml.classification import LogisticRegression
training = spark.createDataFrame([
(1.0, Vectors.dense([0.0, 1.1, 0.1])),
(0.0, Vectors.dense([2.0, 1.0, -1.0])),
(0.0, Vectors.dense([... |
instrs = {
"ADC": [
{
"instr": "ADC",
"link": "http://www.keil.com/support/man/docs/armclang_asm/armclang_asm_pge1425889307327.htm",
"short": "Add with Carry",
}
],
"ADD": [
{
"instr": "ADD",
"link": "http://www.keil.com/sup... |
import unittest
import os
from speech_recognition import WavFile
from mycroft.client.speech.listener import RecognizerLoop
DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data")
class LocalRecognizerTest(unittest.TestCase):
def setUp(self):
rl = RecognizerLoop()
self.recognizer ... |
from app import app
context = ('NCACert.pem', 'NCAKey.pem')
app.run(host='127.0.0.1', debug=True, port=5006, ssl_context=context, threaded=True) |
from __future__ import print_function
import itertools
from argparse import ArgumentParser
import os
import random
import re
import sys
import subprocess
import glob
import shutil
from collections import namedtuple
from sparktestsupport import SPARK_HOME, USER_HOME, ERROR_CODES
from sparktestsupport.shellutils import e... |
import collections
import ctypes
from ctypes import util
import sys
import netaddr
from neutron_lib import constants
from neutron_lib.utils import helpers
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import netutils
from neutron.agent import firewall
from neutron.agent.linux import ip... |
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-05-03
Last_modify: 2016-05-03
******************************************
'''
'''
Given a singly linked list, determine if it is a palindrome.
Follow up:
Could you do it i... |
"""Models for advection and convection components."""
import functools
from typing import Callable, Optional
import gin
from jax_cfd.base import advection
from jax_cfd.base import grids
from jax_cfd.ml import interpolations
from jax_cfd.ml import physics_specifications
GridArray = grids.GridArray
GridArrayVector = grid... |
"""Module containing the urlparse compatibility logic."""
from collections import namedtuple
from . import compat
from . import exceptions
from . import misc
from . import normalizers
from . import uri
__all__ = ("ParseResult", "ParseResultBytes")
PARSED_COMPONENTS = (
"scheme",
"userinfo",
"host",
"por... |
from django.conf.urls import patterns, include, url
from rango import views
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'rango.views.home', name='home'),
url(r'^admin/', include(admin.site.urls)),
url(r'', inc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.