gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
# -*- coding: utf-8 -*-
"""tests for api.validators"""
from mock import MagicMock
from tests.unit import UnitTestCase
from app.api.validators import DummyForm, DummyField, Base, password
class DummyFormTestCase(UnitTestCase):
def test_class(self):
self.assertTrue(issubclass(DummyForm, dict))
class Du... | |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# 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... | |
"""Test to verify that we can load components."""
from asynctest.mock import ANY, patch
import pytest
from homeassistant.components import http, hue
from homeassistant.components.hue import light as hue_light
import homeassistant.loader as loader
from tests.common import MockModule, async_mock_service, mock_integrati... | |
#
# Copyright 2016 Quantopian, Inc.
#
# 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 wr... | |
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import *
from direct.fsm import FSM
from direct.distributed import DistributedObject
from direct.showutil import Rope
from direct.showbase import PythonUtil
from direct.ta... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | |
#!/usr/bin/env python3
###############################################################################
# Copyright 2017 The Apollo Authors. All Rights Reserved.
#
# 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... | |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 14 13:33:57 2016
@author: Pedro
"""
# pylint: disable=E1101
import re
#import sys
import logging
# nice debug printing of settings
#import pprint
import os
from pkg_resources import resource_filename
from typing import Dict, List, Tuple, Any, Set
import numpy as np
fro... | |
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth import REDIRECT_FIELD_NAME, login as django_login
from django.views.decorators.csrf import csrf_exempt
from django.http import QueryDict, HttpRes... | |
from __future__ import unicode_literals
import datetime
import os
import unittest
from django import get_version
from django.db import models
from django.template import Template, Context
from django.test import SimpleTestCase
from django.test.utils import override_settings
from django.utils.encoding import python_2_... | |
# -*- coding: utf-8 -*-
from ..describe import Description, autoDescribeRoute
from ..rest import Resource, filtermodel, setResponseHeader, setContentDisposition
from girder.api import access
from girder.constants import AccessType, TokenScope
from girder.models.collection import Collection as CollectionModel
from girde... | |
"""Utility functions used across Superset"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import decimal
import functools
import json
import logging
import numpy
import os
import parsedatetime
import pytz
import smt... | |
# Copyright 2020 DeepMind Technologies Limited.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | |
import inspect
import time
from collections import OrderedDict
from typing import Any
import debug
import logsupport
from logsupport import ConsoleError
from utils.utilfuncs import safeprint
ValueStores = OrderedDict() # General store for named values storename:itemname accessed as ValueStore[storename].GetVal(itemn... | |
# Copyright 2005-2010 Wesabe, Inc.
#
# 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 ... | |
'''
Created on 2013-2-1
@author: desperedo
miniPascal Compiler Code Generator
'''
import Bytecode
class InvokableStub(object):
def __init__(self, ID, Address, Function, ReturnMap):
self.ID = ID;
self.Address = Address;
self.Function = Function;
self.ReturnMap = ReturnMap;
class Generator(object):
def ... | |
import logging
import requests
import json
import html2text
import hashlib
from operator import attrgetter
import model
import utils
requests.packages.urllib3.disable_warnings()
class ZendeskRequest(object):
_default_url = 'https://{}/api/v2/help_center/' + utils.to_zendesk_locale(model.DEFAULT_LOCALE) + '/{}'
... | |
#!/usr/bin/env python2.7
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# 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... | |
from __future__ import absolute_import
import string
import os
from .dawg import Dawg
from .chunk import Chunk, WordPoint
_punctuation = string.whitespace + string.punctuation
class Token:
def __init__(self, text):
self.text = text
def __str__(self):
return repr(self.text)
class MMSegToken... | |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | |
from activitystreams import Activity, Object, MediaLink, ActionLink, Link
import re
import datetime
import time
def make_activities_from_stream_dict(stream_dict):
activities = []
for activity_dict in stream_dict["items"]:
activities.append(make_activity_from_activity_dict(activity_dict))
ret... | |
from future import standard_library
standard_library.install_aliases()
from builtins import zip
from builtins import str
from past.builtins import basestring
from builtins import object
from contextlib import contextmanager
import datetime
import email.utils
import ftplib
import functools
import os
import re
import url... | |
# 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 ... | |
import ctypes
import re
from PyQt4 import Qt
from PyQt4 import QtGui
from PyQt4 import QtCore
try:
import pxss
except:
pass
try:
import enchant
except ImportError:
enchant = None
class SpellTextEditor(Qt.QPlainTextEdit):
'''A QTextEdit-based editor that supports syntax highlighting and
spell... | |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | |
import numpy as np
import pytest
import mbuild as mb
from mbuild.formats.lammpsdata import write_lammpsdata
from mbuild.tests.base_test import BaseTest
from mbuild.utils.io import get_fn, has_foyer
@pytest.mark.skipif(not has_foyer, reason="Foyer package not installed")
class TestLammpsData(BaseTest):
def test_s... | |
from django.urls import path
from members.views.ajax_views import (
ajax_people,
ajax_person,
ajax_adults,
ajax_password,
ajax_postcode,
ajax_dob,
ajax_set_pin,
ajax_task_status,
)
from members.views.billing_views import BillingView, SetYearView, FinanceAnalysisView, YearEndView
from me... | |
"""
The OGRGeometry is a wrapper for using the OGR Geometry class
(see http://www.gdal.org/ogr/classOGRGeometry.html). OGRGeometry
may be instantiated when reading geometries from OGR Data Sources
(e.g. SHP files), or when given OGC WKT (a string).
While the 'full' API is not present yet, the API is "pythonic" u... | |
# Do the necessary imports
import argparse
import shutil
import base64
from datetime import datetime
import os
import cv2
import numpy as np
import socketio
import eventlet
import eventlet.wsgi
from PIL import Image
from flask import Flask
from io import BytesIO, StringIO
import json
import pickle
import matplotlib.ima... | |
"""
Testing that we work in the downstream packages
"""
import importlib
import subprocess
import sys
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
# geopandas, xarray, fsspec, fastparquet all produce these
py... | |
from __future__ import print_function, division
from astropy.tests.helper import pytest
import numpy as np
from ..optical_properties import OpticalProperties
from ..emissivities import Emissivities
from ...util.functions import virtual_file
def test_init():
Emissivities()
VECTOR_ATTRIBUTES = ['nu', 'var']
ARRA... | |
import unittest
from datetime import timedelta
import reactivex
from reactivex import operators as ops
from reactivex.testing import ReactiveTest, TestScheduler
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = Reac... | |
"""
django_excel
~~~~~~~~~~~~~~~~~~~
A django middleware that provides one application programming interface
to read and write data in different excel file formats
:copyright: (c) 2015 by Onni Software Ltd.
:license: New BSD License
"""
from django.core.files.uploadhandler import (
MemoryF... | |
"""Plotlywrapper: to make easy plots easy to make."""
from typing import Generator, Optional
from tempfile import NamedTemporaryFile
import plotly.offline as py
import plotly.graph_objs as go
from plotly.basedatatypes import BaseTraceType # pylint: disable=no-name-in-module,import-error
import numpy as np
import p... | |
#
# 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 us... | |
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
import pylab as plt
import numpy as np
import emcee
import triangle
from astrometry.util.util import *
from astrometry.util.plotuti... | |
'''
Layer definitions
'''
import json
import cPickle as pkl
import numpy
from collections import OrderedDict
import theano
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from initializers import *
from util import *
from theano_util import *
from alignment_util i... | |
"""This module holds all the functions that deal with starting up
Fjord for both the developer and server environments.
These functions shouldn't be used after startup is completed.
"""
import logging
import os
import sys
from itertools import chain
from fjord import path
log = logging.getLogger(__name__)
# Denot... | |
import ast as python_ast
from botlang.ast.ast import *
class SExpression(object):
"""
https://en.wikipedia.org/wiki/S-expression
"""
OPENING_PARENS = ['(', '[', '{']
CLOSING_PARENS = [')', ']', '}']
def to_ast(self):
raise NotImplementedError
def accept(self, visitor):
ra... | |
# implementation of Spaceship - program template for RiceRocks
import simplegui
import math
import random
# globals for user interface
width = 800
height = 600
score = 0
lives = 3
time = 0
started = False
class ImageInfo:
def __init__(self, center, size, radius = 0, lifespan = None, animated = False):
sel... | |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# 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 requ... | |
import json
import threading
from . import defaults
from .exceptions import HTTPError, StopCCEIteration
from .http import HTTPRequest
from ..common.log import get_cc_logger
_logger = get_cc_logger()
class CloudConnectEngine(object):
"""The cloud connect engine to process request instantiated
from user opti... | |
#!/usr/bin/python
'''
Commands that allow surface Drawing for meshes
Currently the user enters "draw mode" which stops any further
zooming / rotation in the vtk window. Left clicks on the surface
make black dots at selected vertices. Right clicking closes the
loop and extracts a surface enclosed by the boundary.
Th... | |
from flask import render_template
import jsonrpclib
import ast
import os
from ironworks import serverTools
from ironworks.noneditable import *
from ironworks.tools import *
from threading import Thread
from modules_lib.plugin_models import recentlyAdded, xbmcServer
app = serverTools.getApp()
logger = serverTools.getL... | |
"""Database interface for the qrscp application.
Unique Keys
-----------
* At each level one attribute is unique
* A unique key shall uniquely identify a single instance at a given level
* Unique keys **may** be in a C-FIND request's Identifier
* Unique keys **shall** be in a C-MOVE or C-GET request's Identifier
* C-F... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nicira Networks, Inc
# All Rights Reserved.
#
# 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.apach... | |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems Inc.
# 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.o... | |
# Copyright 2017, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2.... | |
import os
import struct
import logging
from collections import deque
from dropbox import client, rest, session
from StringIO import StringIO
from util import *
import re
from appkeys import *
#use /dev/random if security matters
class WrongDiskSize(Exception):
def __init__(self,message):
super(WrongDiskSize, self).... | |
# Copyright 2013 NEC Corporation. All rights reserved.
#
# 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 ... | |
#!/usr/bin/env python
"""
:mod:`ddfs <ddfscli>` -- DDFS command line utility
==================================================
:program:`ddfs` is a tool for manipulating data stored in :ref:`ddfs`.
Some of the :program:`ddfs` utilities also work with data stored in Disco's temporary filesystem.
.. note::
This is... | |
import errno
import os
import sys
import time
import traceback
import types
import warnings
from eventlet.green import urllib
from eventlet.green import socket
from eventlet.green import BaseHTTPServer
from eventlet import greenpool
from eventlet import greenio
from eventlet.support import get_errno, six
DEFAULT_MAX... | |
from __future__ import absolute_import, print_function
from os import path
import hashlib
import logging
import six
from django.db import IntegrityError, transaction
from sentry.api.serializers import serialize
from sentry.cache import default_cache
from sentry.tasks.base import instrumented_task
from sentry.utils ... | |
# Copyright (C) 2008 The Android Open Source Project
#
# 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 ... | |
#!/usr/bin/env python
#
# Copyright (c) Vicent Marti. All rights reserved.
#
# This file is part of clar, distributed under the ISC license.
# For full terms see the included COPYING file.
#
from __future__ import with_statement
from string import Template
import re, fnmatch, os, sys, codecs, pickle
class Module(obje... | |
"""Support to interface with the Plex API."""
from __future__ import annotations
import logging
from homeassistant.components.media_player import BrowseMedia
from homeassistant.components.media_player.const import (
MEDIA_CLASS_ALBUM,
MEDIA_CLASS_ARTIST,
MEDIA_CLASS_DIRECTORY,
MEDIA_CLASS_EPISODE,
... | |
"""plistlib.py -- a tool to generate and parse MacOSX .plist files.
The PropertyList (.plist) file format is a simple XML pickle supporting
basic object types, like dictionaries, lists, numbers and strings.
Usually the top level object is a dictionary.
To write out a plist file, use the writePlist(rootObject, pathOrF... | |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | |
# Copyright 2015 Cisco Systems, Inc.
# All Rights Reserved.
#
# 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 requi... | |
# -*- coding: utf-8 -*-
""" Constants and global configuration options, like `logging.getLogger` and loading secrets.cfg """
from __future__ import print_function, unicode_literals, division, absolute_import
from builtins import (bytes, dict, int, list, object, range, str, ascii, chr, # noqa
hex,... | |
import yaml
import argparse
import numpy as NP
from astropy.io import fits
import progressbar as PGB
import interferometry as RI
import delay_spectrum as DS
import my_DSP_modules as DSP
import geometry as GEOM
import ipdb as PDB
## Parse input arguments
parser = argparse.ArgumentParser(description='Program to creat... | |
import os, sys
from subprocess import Popen, PIPE
import time
import errno
import fcntl
import logging
from holland.core.command import Command, option, run
from holland.core.backup import BackupRunner, BackupError
from holland.core.exceptions import BackupError
from holland.core.config import hollandcfg, ConfigError
f... | |
# -*- coding: utf-8 -*-
import click
from urls import IMAGES
from base_request import DigitalOcean, print_table, CONTEXT_SETTINGS
@click.group()
def images_group():
"""
images command group
"""
pass
def validate(dic, option_list):
"""
images command validation
"""
for key in dic.viewkeys():
if key in opt... | |
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q
from django.utils.translation import gettext_lazy
from .assignment import Assignment
class NonzeroSmallesMinimalPointsValidationError(ValidationError):
pass
class InvalidLargestMaximumPointsValidation... | |
import math
import unittest
from pedemath.vec3 import Vec3
from pedemath.matrix import Matrix44
class TestMatrix44MakeIdentity(unittest.TestCase):
"""Test Matrix44.make_identity()."""
def test_make_identity(self):
"""Ensure identity matrix is correct."""
mat = Matrix44()
mat.make_i... | |
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# All Rights Reserved.
#
# 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/LICEN... | |
# -*- coding: UTF-8 -*-
# Copyright 2013-2018 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
"""
A Sphinx extension used to write multilingual user documentation
for a Lino application.
.. rst:directive:: lino2rst
Execute Python code and process the output as reStruct... | |
# Copyright 2019 Scalyr Inc.
#
# 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 writing, so... | |
import math
import operator
from functools import reduce
import numpy as np
import gym
from gym import error, spaces, utils
from .minigrid import OBJECT_TO_IDX, COLOR_TO_IDX, STATE_TO_IDX, Goal
class ReseedWrapper(gym.core.Wrapper):
"""
Wrapper to always regenerate an environment with the same set of seeds.
... | |
import logging
import urlparse
import urllib2
import urllib
from bs4 import BeautifulSoup
from collections import defaultdict
from time import sleep
from jenkinsapi.build import Build
from jenkinsapi.jenkinsbase import JenkinsBase
from exceptions import NoBuildData, NotFound
log = logging.getLogger(__name__)
class J... | |
#!/usr/bin/env python3
import unittest
from framework import VppTestCase, VppTestRunner
from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
from scapy.contrib.geneve import GENEVE
from scapy.packet import Raw
from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP
from scapy.layers.vxlan im... | |
# Copyright 2018 Google LLC. All Rights Reserved.
#
# 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 a... | |
#!python -u
import pyglet
import pyglet.gl as gl
import timevars as tv
import sprites
from config import Config
class ActiveObject(object):
""" Abstract base class representing items that show up on screen """
def __init__(self, started=False):
super(ActiveObject, self).__init__()
self.start... | |
# -*- coding: utf-8 -*-
'''shove cache core.'''
from collections import deque
from copy import deepcopy
from operator import delitem
from random import seed, sample
from threading import Condition
from time import time
from shove._compat import synchronized
from shove.base import Mapping, FileBase, SQLiteBase, CloseS... | |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import pymongo
import numpy as np
from pymongo import MongoClient
from . import core
_API_MAP = {1: core}
def _sanitize_np(val):
"Convert any numpy objects into built-in Python types."
if ... | |
import os
import time
import sched
import atexit
import functools
import threading
import traceback
import collections
import synapse.glob as s_glob
import synapse.lib.queue as s_queue
from synapse.common import *
from synapse.eventbus import EventBus
def current():
return threading.currentThread()
def iden():
... | |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. Yo... | |
# Auto Encoders
"""
TODO:
* Need a validation and testing thats better than just measuring rmse. Can't find something
great.
* Loss increases after 3 epochs.
"""
from yann.network import network
def autoencoder ( dataset= None, verbose = 1 ):
"""
This function is a demo exampl... | |
# 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 u... | |
from __future__ import division
from functools import wraps
import pandas as pd
from base.uber_model import UberModel, ModelSharedInputs
from .trex_functions import TrexFunctions
import time
def timefn(fn):
@wraps(fn)
def measure_time(*args, **kwargs):
t1 = time.time()
result = fn(*args, **kwa... | |
#!/usr/bin/env python
import qi
import argparse
import sys
import os
import time
from pprint import pprint
from naoqi import ALProxy
# colored prints
class tcol:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\0... | |
from __future__ import unicode_literals
from PySide import QtGui
from PySide import QtCore
import os
from .constants import EXTENSION
from .widgets import TagCompletion
import noteorganiser.text_processing as tp
class Dialog(QtGui.QDialog):
"""
Model for dialogs in Note Organiser (pop-up windows)
"""
... | |
# -*- 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):
# Adding M2M table for field shared_users on 'DataQuery'
m2m_table_name = db.shorten_name('avocado_dataquery... | |
MBLENGTH = {
8:1,
33:3,
88:2,
91:2
}
class Charset(object):
def __init__(self, id, name, collation, is_default):
self.id, self.name, self.collation = id, name, collation
self.is_default = is_default == 'Yes'
def __repr__(self):
return "Charset(i... | |
"""
This tests module docstrings to ensure
* all the config options are documented
* correct default values are given
* config parameters listed in alphabetical order
Specific modules/config parameters are excluded but this should be discouraged.
"""
import ast
import os.path
import re
from collections import Ord... | |
from tensorflow.contrib.layers import fully_connected
import tensorflow as tf
from tensorflow.python.ops import rnn_cell
import numpy as np
import os
import operator
from PIL import Image
from resizeimage import resizeimage
import PIL
import random
import math
from gensim.models import word2vec
import logging
from PIL.... | |
# -*- coding: utf-8 -*-
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NotSupported
class coincheck (Exchange):
def describe(self):
return self.deep_extend(super(coincheck, self).describe(), {
'id': 'coincheck',
'na... | |
#!/usr/bin/env python
import random
import struct
from devp2p.crypto import sha3
from Crypto.Hash import keccak
sha3_256 = lambda x: keccak.new(digest_bits=256, update_after_digest=True, data=x)
from devp2p.crypto import ECCx
from devp2p.crypto import ecdsa_recover
from devp2p.crypto import ecdsa_verify
import pyellipt... | |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | |
import ply.yacc
import os
import string
import oelite.parse
import oelite.meta
import oelite.path
import oelite.util
class OEParser(object):
def __init__(self, meta=None, parent=None, lexer=None):
import oelite
if lexer is None:
import oelite.parse
lexer = oelite.parse.oele... | |
"""Tests for the Hyperion integration."""
from __future__ import annotations
import asyncio
import base64
from collections.abc import Awaitable
from typing import Callable
from unittest.mock import AsyncMock, Mock, patch
from aiohttp import web
import pytest
from homeassistant.components.camera import (
DEFAULT_... | |
import os
import unittest
import dem.project.reader as reader
import pyfakefs.fake_filesystem_unittest as fake_filesystem_unittest
from mock import patch, MagicMock
SAMPLE_CONTENT = '''
config:
remote-locations:
['/opt',
'http://github.com']
http-proxy: http://192.168.1.2:9000
packages:
qt... | |
#!/usr/bin/env python
# Copyright (c) 2015, Robot Control and Pattern Recognition Group,
# Institute of Control and Computation Engineering
# Warsaw University of Technology
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | |
#!/usr/bin/env python
import jip
import jip.jobs
import jip.db
import os
@jip.tool()
class nop_noval(object):
"""
usage:
nop_noval <input>
"""
def get_command(self):
return "${input}"
def test_job_names_after_multiplexing():
p = jip.Pipeline()
j = p.job("1").run('nop_noval')
... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import tensorflow as tf
import numpy as np
from collections import Counter
from multiprocessing import Queue, Process, Value, get_logger
from time import sleep
from ctypes import c_bool
import backend
from hailo_platform.common.jlf import readjlf
f... | |
#!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
"""dvsim is a command line tool to deploy ASIC tool flows such as regressions
for design verification (DV), formal property verification (FPV), lintin... | |
"""
Defines the unit tests for the
:mod:`colour.models.rgb.transfer_functions.sony_slog` module.
"""
import numpy as np
import unittest
from colour.models.rgb.transfer_functions import (
log_encoding_SLog,
log_decoding_SLog,
log_encoding_SLog2,
log_decoding_SLog2,
log_encoding_SLog3,
log_decod... | |
# -*- 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):
# Adding model 'Placeholder'
db.create_table(u'cms_placeholder', (
(u'id', self.gf('django.db.mo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.