gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
import logging
import re
import time
from typing import List
from requests.exceptions import ConnectTimeout
from requests.exceptions import ConnectionError
from django.db import transaction
from tkapi import TKApi
from tkapi.util import queries
from tkapi.persoon import Persoon as TKPersoon
from tkapi.dossier impor... | |
# Copyright (c) 2018 PaddlePaddle 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 app... | |
"""
For Handling db calls on Ideas
"""
import json
import datetime
from lib.model import (User, Organization, MiniOrganization, IdeaMeta, IdeaVersion,
MiniIdea, Comment, Reply)
from mongoengine import Q
def create_idea(creator, org_id, **kwargs):
#Get my creator's object and my org
my... | |
from unittest import TestCase
from iota import Address
from iota.crypto.addresses import AddressGenerator
from iota.crypto.types import Seed
class AddressGeneratorTestCase(TestCase):
maxDiff = None
def setUp(self):
super(AddressGeneratorTestCase, self).setUp()
self.seed_1 =\
Seed(
b'TESTV... | |
#!/usr/bin/env python
import math
import os
import shutil
import six
import stat
import collections
"""
.. module:: pycopy
:platform: Unix, Windows
:synopsis: Recursively copy a directory.
.. moduleauthor:: Brandon Huber
"""
__version__ = '0.1'
try:
import scandir
_SCANDIR_FN = scandir
except... | |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
""" compile javascript to caffscript (js -> cjs)
starts block ('{') - increase indentation
if more as one block starts at single line, then 2+ lines in cs are needed; handle this with cs_delay variable
ends block ('}') - decrease indentation
none of previous:
last ch... | |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | |
import time
import unittest
import six
if six.PY3:
from unittest import mock
else:
import mock
from engineio import packet
from engineio import payload
from engineio import socket
class TestSocket(unittest.TestCase):
def _get_mock_server(self):
mock_server = mock.Mock()
mock_server.ping_... | |
from django.conf.urls import include, url
from django.shortcuts import redirect
from olympia.addons.urls import ADDON_ID
from olympia.amo.decorators import write
from olympia.amo.utils import partial
from olympia.lib.misc.urlconf_decorator import decorate
from . import views
# These will all start with /theme/<slug... | |
"""Exchange and Queue declarations."""
from __future__ import absolute_import, unicode_literals
import numbers
from .abstract import MaybeChannelBound, Object
from .exceptions import ContentDisallowed
from .five import python_2_unicode_compatible, string_t
from .serialization import prepare_accept_content
TRANSIENT_... | |
from constant import *
from clientserver import *
from decimal import *
import re
# phase number (key) : [phase name, phase specific prompt message]
# used to generate phase specific messages
PHASE_DICTIONARY = {
PHASE_NUM.KEYWORD_CAMPAIGN: ['keyword campaign', 'Please select the number corresponding ' +
'to the ... | |
# -*- coding: utf-8 -*-
import httplib as http
import importlib
import pkgutil
import pytest
from pytz import utc
from datetime import datetime
import urllib
from nose.tools import * # noqa:
import re
from tests.base import ApiTestCase, DbTestCase
from osf_tests import factories
from tests.utils import make_drf_req... | |
# Copyright (C) 2012 - 2014 EMC 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
#
# Unle... | |
# Copyright 2015 CloudByte 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 required b... | |
# -*- coding: utf-8 -*-
'''
Manage client ssh components
.. note::
This module requires the use of MD5 hashing. Certain security audits may
not permit the use of MD5. For those cases, this module should be disabled
or removed.
'''
from __future__ import absolute_import
# Import python libs
import binasc... | |
#
# 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 la... | |
#!@PYTHON_EXECUTABLE@
#ckwg +28
# Copyright 2011-2013 by Kitware, 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,... | |
"""
author Talha Oz
this is the main code implemented for cs780 class project
"""
# -*- coding: utf-8 -*-
import pandas as p
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
import re
from sklearn import cross_validation
import preprocessing as pre
from sklearn.naive_bayes import Multinom... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Datacratic Inc. All rights reserved.
# @Author: Alexis Tremblay
# @Email: atremblay@datacratic.com
# @Date: 2015-01-07 15:45:01
# @Last Modified by: Alexis Tremblay
# @Last Modified time: 2015-06-02 08:32:09
# @File Name: data.py
import pandas as pd
from pyml... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Antons Rebguns, Cody Jorgensen, Cara Slutter
# 2010-2011, Antons Rebguns
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are perm... | |
from future import standard_library
standard_library.install_aliases()
from builtins import str
from configparser import ConfigParser
import errno
import logging
import os
import sys
import textwrap
try:
from cryptography.fernet import Fernet
except:
pass
def generate_fernet_key():
try:
FERNET_K... | |
# Copyright (c) 2012-2014 Jonathan Warren
# Copyright (c) 2012-2014 The Bitmessage developers
comment= """
This is not what you run to run the Bitmessage API. Instead, enable the API
( https://bitmessage.org/wiki/API ) and optionally enable daemon mode
( https://bitmessage.org/wiki/Daemon ) then run bitmessagemain.py.... | |
# 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... | |
"""
Created: 11 November 2016
Last Updated: 11 April 2018
Dan Marley
daniel.edison.marley@cernSPAMNOT.ch
Texas A&M University
-----
Base class for performing deep learning
Designed for running on desktop at TAMU
with specific set of software installed
--> not guaranteed to work in CMSSW environment!
... | |
# Copyright 2013 IBM Corp.
#
# 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 agree... | |
import re
import os
import six
class Compiler(object):
RE_INTERPOLATE = re.compile(r'(\\)?([#!]){(.*?)}')
doctypes = {
'5': '<!DOCTYPE html>'
, 'xml': '<?xml version="1.0" encoding="utf-8" ?>'
, 'default': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR... | |
# Copyright (C) 2009 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 ... | |
# Copyright 2015 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 (c) 2013 GigaSpaces Technologies Ltd. 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... | |
# Copyright 2021 Google LLC
#
# 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, ... | |
import pytest
from django.conf.urls import include, url
from django.test import override_settings
from rest_framework import serializers, status, versioning
from rest_framework.decorators import APIView
from rest_framework.relations import PKOnlyObject
from rest_framework.response import Response
from rest_framework.r... | |
# Copyright 2014 Mirantis, 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... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
class BTree:
class Node:
def __init__(self):
self.sons = []
self.keys = []
def __repr__(self):
return 'Node' + str(self.keys) + str(self.sons)
def _lower_bound(self, key):
... | |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team 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-... | |
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2015, David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
#-----------------------------------------------------------------------------
"""
IPv6 address logic... | |
"""
Support for recording details.
Component that records all events and state changes. Allows other components
to query this database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/recorder/
"""
import atexit
import json
import logging
import queue
i... | |
"""Support ezviz camera devices."""
from __future__ import annotations
import logging
from pyezviz.exceptions import HTTPError, InvalidHost, PyEzvizError
import voluptuous as vol
from homeassistant.components import ffmpeg
from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
from homea... | |
##########################################
# File: shard.py #
# Copyright Richard Stebbing 2014. #
# Distributed under the MIT License. #
# (See accompany file LICENSE or copy at #
# http://opensource.org/licenses/MIT) #
##########################################
# Imports
import n... | |
## Title: Server_Project_With_GUI.py
## Abstract:
## Author(s): Greg Greenleaf (pacohojaverde@gmail.com)
## Alex Hauser (ahauser@csumb.edu)
## Zac Leids (zleids@csumb.edu)
## Date: September 24, 2014
import socket, sys, pygame, time, os, random
if (sys.version_info < (3,0)):
import thread
e... | |
# Author: Lisandro Dalcin
# Contact: dalcinl@gmail.com
"""
Support for building mpi4py with distutils/setuptools.
"""
# -----------------------------------------------------------------------------
import sys
import os
import shlex
import shutil
import platform
from distutils import log
from distutils import sysco... | |
#
# The Python Imaging Library
# $Id$
#
# JPEG2000 file handling
#
# History:
# 2014-03-12 ajh Created
#
# Copyright (c) 2014 Coriolis Systems Limited
# Copyright (c) 2014 Alastair Houghton
#
# See the README file for information on usage and redistribution.
#
__version__ = "0.1"
from PIL import Image, ImageFile, _b... | |
# -*- coding: utf-8 -*-
from ...Qt import QtCore, QtGui
from ..Node import Node
from . import functions
from ... import functions as pgfn
from .common import *
import numpy as np
from ... import metaarray as metaarray
class Downsample(CtrlNode):
"""Downsample by averaging samples together."""
nodeName = 'Dow... | |
# -*- coding: utf-8 -*-
"""
werkzeug.local
~~~~~~~~~~~~~~
This module implements context-local objects.
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
# Since each thread has its own greenlet we can just use those as identi... | |
"""Configuration used when connecting to a device.
A configuration describes a device, e.g. it's name, IP address and credentials. It is
possible to manually create a configuration, but generally scanning for devices will
provide configurations for you.
"""
from copy import deepcopy
from ipaddress import IPv4Address
f... | |
# -*- coding: utf-8 -*-
from __future__ import division
import os
import re
import importlib
import logging
from copy import deepcopy
from sentence import Sentence
from data_prep import DataPrep
from file_io import fileRead, fileWrite
__version__ = '1.1'
logger = logging.getLogger('DATAPOOL')
class DataPool():
"... | |
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2019 David Shah <dave@ds0.me>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.generic_platform import *
from litex.build.lattice import LatticePlatform
from litex.build.lattice.programmer import OpenOCDJTAGProgrammer
# IOs -----------------------------... | |
from django.apps.registry import Apps
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models
from django.db.migrations.exceptions import InvalidBasesError
from django.db.migrations.operations import (
AddField, AlterField, DeleteModel, RemoveField,
)
from django.db.migrations.... | |
import unittest
import numpy as np
import pandas as pd
import scipy.stats as st
from os import path, getcwd
from ..graphs import GraphGroupScatter
from ..data import Vector
from ..analysis.exc import NoDataError
from ..data import UnequalVectorLengthError
class MyTestCase(unittest.TestCase):
@property
def s... | |
from ..adapters.oracle import Oracle
from .._compat import integer_types, basestring
from .base import SQLDialect
from . import dialects, sqltype_for
import re
@dialects.register_for(Oracle)
class OracleDialect(SQLDialect):
false_exp = "1=0"
true_exp = "1=1"
@sqltype_for("string")
def type_string(sel... | |
"""
Decorator module by Michele Simionato <michelesimionato@libero.it>
Copyright Michele Simionato, distributed under the terms of the BSD License (see below).
http://www.phyast.pitt.edu/~micheles/python/documentation.html
Included in NLTK for its support of a nice memoization decorator.
"""
__docformat__ = 'restructu... | |
"""
I/O for Gmsh's msh format (version 4.1, as used by Gmsh 4.2.2+), cf.
<http://gmsh.info/doc/texinfo/gmsh.html#MSH-file-format>.
"""
from functools import partial
import numpy as np
from .._common import cell_data_from_raw, num_nodes_per_cell, raw_from_cell_data, warn
from .._exceptions import ReadError, WriteError... | |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | |
#!/usr/bin/env python
# Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Compiles all *.proto files it finds into *_pb2.py."""
from __future__ import print_function
import logging
import optpa... | |
# Copyright 2018 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... | |
"""
The qiprofile imaging Mongodb data model.
"""
import re
import decimal
from numbers import Number
import mongoengine
from mongoengine import (fields, signals, ValidationError)
from .common import (Encounter, Outcome, TumorExtent)
class Point(mongoengine.EmbeddedDocument):
"""The 3D point in the volume voxel ... | |
#!/usr/bin/python -u
"""Checks codeDeps dependencies are correctly declared."""
# Copyright 2011, 2012, 2013, 2014 Matt Shannon
# This file is part of codedep.
# See `License` for details of license and warranty.
import os
import sys
import argparse
import inspect
import _ast
import ast
import symtable
import impor... | |
import unittest
from cpuinfo import *
import helpers
class MockDataSource(object):
bits = '64bit'
cpu_count = 4
is_windows = False
arch_string_raw = 'aarch64'
uname_string_raw = 'x86_64'
can_cpuid = False
@staticmethod
def has_proc_cpuinfo():
return True
@staticmethod
def has_lscpu():
return True
... | |
import pytest
import time
from .common import create_kubeconfig
from .common import CLUSTER_MEMBER
from .common import CLUSTER_OWNER
from .common import PROJECT_MEMBER
from .common import PROJECT_OWNER
from .common import PROJECT_READ_ONLY
from .common import get_client_for_token
from .common import delete_node
from .c... | |
#
# 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 la... | |
# Copyright 2015 Google 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 required by applicable law or ag... | |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, The Horizomer Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------... | |
import unittest
from collections import deque
def bfs(source, neighbors):
res = []
visited = set([source])
queue = deque([source])
while queue:
v = queue.popleft()
res.append(v)
for n in neighbors(v):
if n not in visited:
visited.add(n)
... | |
# https://github.com/ethereum/go-ethereum/wiki/Blockpool
import time
from ethereum.utils import sha3
import rlp
from rlp.utils import encode_hex
from ethereum import processblock
from synchronizer import Synchronizer
from ethereum.slogging import get_logger
from ethereum.chain import Chain
from ethereum.blocks import B... | |
# encoding: 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 'DataVisualizationResource'
db.create_table('data_displays_datavisualizationresource', (
... | |
#!/usr/bin/env python
""" A unittest script for the Study module. """
import unittest
import json
from cutlass import Study
from cutlass import MIXS, MixsException
from CutlassTestConfig import CutlassTestConfig
from CutlassTestUtil import CutlassTestUtil
# pylint: disable=W0703, C1801
class StudyTest(unittest.Te... | |
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, EVEthing team
# 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... | |
##########################################
# File: util.py #
# Copyright Richard Stebbing 2014. #
# Distributed under the MIT License. #
# (See accompany file LICENSE or copy at #
# http://opensource.org/licenses/MIT) #
##########################################
# Imports
import r... | |
# -*- coding: utf-8 -*-
"""
we test .agg behavior / note that .apply is tested
generally in test_groupby.py
"""
from __future__ import print_function
import pytest
from datetime import datetime, timedelta
from functools import partial
import numpy as np
from numpy import nan
import pandas as pd
from pandas import... | |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" test byte codecs """
from __future__ import print_function
import numpy as np
import unittest
import faiss
from common_faiss_tests impor... | |
###############################################################################
# Tested so far:
#
# OpenClassesRoot
# OpenCurrentUser
# OpenLocalMachine
# OpenPerformanceData
# OpenUsers
# BaseRegCloseKey
# BaseRegCreateKey
# BaseRegDeleteKey
# BaseRegFlushKey
# BaseRegGetKeySecurity
# BaseRegOpenKey
# BaseRegQueryI... | |
"""
Geckoboard decorators.
"""
import base64
from types import ListType, TupleType
from xml.dom.minidom import Document
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback
from django.conf import settings
from django.http import HttpResponse, ... | |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... | |
#
# Copyright (c) 2015, Arista Networks, 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 list of condit... | |
"""
Component to interface with cameras.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/camera/
"""
import asyncio
import base64
import collections
from contextlib import suppress
from datetime import timedelta
import logging
import hashlib
from random ... | |
#!/usr/bin/env python
#
# Copyright 2006 The Closure Library 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
... | |
from __future__ import unicode_literals
import datetime
from decimal import Decimal
import re
from django.db import connection
from django.db.models import Avg, Sum, Count, Max, Min
from django.test import TestCase
from django.test.utils import Approximate
from django.test.utils import CaptureQueriesContext
from .mo... | |
#!/usr/bin/env python2
import argparse
import subprocess
import shlex
import re
import os
import sys
import json
import hashlib
from collections import defaultdict, OrderedDict
import time
from StringIO import StringIO
import webbrowser
from distutils.version import LooseVersion
import logging
import paramiko
logging... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2013 IBM Corp.
# All Rights Reserved.
#
# Licensed under the Apa... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Model tests."""
from __future__ import absolute_import, print_function
import u... | |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | |
# Copyright 2013 Google 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 required by applicable law or ... | |
#!/usr/bin/env python
"""SeqAn code generation from templates / skeletons.
This module contains code to help the creation of modules, tests, apps etc.
It can be called directly or imported and the main() function can be called.
It will perform the following replacements:
%(AUTHOR)s will be replaced by the author'... | |
import unittest as real_unittest
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models import get_app, get_apps
from django.test import _doctest as doctest
from django.test.utils import setup_test_environment, teardown_test_environment
from django.test.testcases ... | |
import os
os.environ['PATH'] = '../caffe/build/tools:'+os.environ['PATH']
import sys
sys.path = ['../caffe/python'] + sys.path
import cv2
import cv
import numpy as np
import shutil
import random
import leveldb
import caffe
from google import protobuf
from caffe.proto import caffe_pb2
from xml.dom import minidom
import... | |
# coding=utf-8
setThrowException(True)
class Nautilus:
REMOTE = 0
LOCAL = 1
_tab = None
_dirs = {}
def __init__(self):
self._dirs = {self.LOCAL: [], self.REMOTE: []}
self._startNautilus()
self._initWebdav()
sleep(1)
self._initLocal()
def _startNautilus(self):
... | |
from parsr import *
import unittest
class myTestCase(unittest.TestCase):
@classmethod
def suite(cls):
suite = unittest.TestSuite()
for name in cls.tests:
suite.addTest(cls(name))
return suite
class myTestSuite(unittest.TestSuite):
@classmethod
def suite(cls):
return cls()
class tokenTests(myTestCase... | |
import time
import os
from subprocess import Popen, PIPE
import re
import timenode
import subprocess
class TimeLog:
def __init__(self, args, logfilename=None):
self.dir = args.dir
self.systray = args.systray
self.logfilename = logfilename or time.strftime("%Y-%m-%d.log")
self.cur... | |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
... | |
#!/usr/bin/env python
"""EMR cost calculator
Usage:
emr_cost_calculator.py total --region=<reg> \
--created_after=<ca> --created_before=<cb> \
[--aws_access_key_id=<ai> --aws_secret_access_key=<ak>]
emr_cost_calculator.py cluster --region=<reg> --cluster_id=<ci> \
[--aws_access_key_id=<ai> --aws_secret_access_... | |
from django.core.exceptions import ValidationError
from django.test import TestCase
from bestiary import models
class Rune(models.Rune):
class Meta:
abstract = True
@classmethod
def stub(cls, **kwargs):
defaults = {
'type': Rune.TYPE_ENERGY,
'stars': 6,
... | |
from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from markdown import markdown
import bleach
from flask import current_app, request, url_for, Markup
from flask.ext.login import Us... | |
from __future__ import unicode_literals
from django.utils import six
from channels import Channel
from channels.tests import ChannelTestCase
from channels.handler import AsgiRequest
from channels.exceptions import RequestTimeout, RequestAborted
class RequestTests(ChannelTestCase):
"""
Tests that ASGI request... | |
# Copyright (c) 2014 Intel Corporation.
#
# 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... | |
#!/usr/bin/env python
#
## Differential Evolution Solver Class
## Based on algorithms developed by Dr. Rainer Storn & Kenneth Price
## Original C++ code written by: Lester E. Godwin
## PushCorp, Inc.
## Dallas, Texas
## 972-840-02... | |
# Copyright (C) 2018, HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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/license... | |
#! /usr/bin/env python
from __future__ import print_function
import os
import re
import argparse
import logging
from collections import defaultdict
buffer_size = 1000 # How many IGTs to cache before writing to the file
default_split_key = '_ungrouped_'
### READING ODIN TEXT #######################################... | |
# Natural Language Toolkit: Semantic Interpretation
#
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
#
# Copyright (C) 2001-2011 NLTK Project
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Utility functions for batch-processing sentences: parsing and
extraction of the semantic representation of... | |
# coding: utf-8
from __future__ import unicode_literals
from contextlib import contextmanager
from ctypes import c_int, c_uint, c_char, c_char_p, pointer, POINTER, byref, Structure, sizeof
import os
from Queue import Queue
import sys
import subprocess
from threading import Thread
from time import sleep
from uuid impor... | |
# coding=utf8
import sys, re, logging, os, random, urllib2, hashlib, time, wave, struct, traceback
import json
from common import VoiceEntry, Song, get_sqla_session, SCRIPT_DIR, MAX_SAMPLE_VAL, iframes_to_frames, frames_to_iframes
from sqlalchemy import or_, not_, null, and_
import numpy as np
import scipy
import s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.