gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
"""
Get API information encoded in C files.
See ``find_function`` for how functions should be formatted, and
``read_order`` for how the order of the functions should be
specified.
"""
from numpy.distutils.conv_template import process_file as process_c_file
import hashlib
import io
import os
import re
import sys
impo... | |
import copy
import datetime
import json
from collections import defaultdict
from google.appengine.ext import ndb
from pyre_extensions import none_throws
from backend.common.consts.alliance_color import ALLIANCE_COLORS, AllianceColor
from backend.common.consts.comp_level import CompLevel
from backend.common.helpers.ma... | |
import responses
import unittest
import time
from tests.support import with_resource, with_fixture, characters
from twitter_ads.account import Account
from twitter_ads.campaign import Campaign
from twitter_ads.client import Client
from twitter_ads.cursor import Cursor
from twitter_ads.http import Request
from twitter... | |
import re
from django.shortcuts import render_to_response
from django.http import Http404
from django.conf import settings
from django.core.urlresolvers import get_script_prefix
from graphite.account.models import Profile
from graphite.compat import HttpResponse, HttpResponseBadRequest
from graphite.logger import log... | |
"""
The Spatial Reference class, represensents OGR Spatial Reference objects.
Example:
>>> from django.contrib.gis.gdal import SpatialReference
>>> srs = SpatialReference('WGS84')
>>> print(srs)
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHOR... | |
import os, sys, gtk, vte, threading
# probono 12/2010
__version__ = "0.1"
def threaded(f):
def wrapper(*args):
t = threading.Thread(target=f, args=args)
t.setDaemon(True)
t.start()
wrapper.__name__ = f.__name__
wrapper.__dict__ = f.__dict__
wrapper.__doc__ = f.__doc__
... | |
import ConfigParser
from copy import copy
from datetime import datetime
import os
import random
import re
import tarfile
import shutil
from tempfile import mkstemp, mkdtemp
from time import strftime
from .config import Config
from .catalogue import Catalogue
from .crypto import Encryptor
from .exceptions import IceItE... | |
# Copyright 2016 ETH Zurich
#
# 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, sof... | |
'''
To run a Bokeh application on a Bokeh server from a single Python script,
pass the script name to ``bokeh serve`` on the command line:
.. code-block:: sh
bokeh serve app_script.py
By default, the Bokeh application will be served by the Bokeh server on a
default port ({DEFAULT_PORT}) at localhost, under the ... | |
from django.test import SimpleTestCase, TestCase
from corehq.util.es.elasticsearch import ConnectionError
from eulxml.xpath import parse as parse_xpath
from casexml.apps.case.mock import CaseFactory, CaseIndex, CaseStructure
from pillowtop.es_utils import initialize_index_and_mapping
from corehq.apps.case_search.fil... | |
# -*- encoding: utf-8 -*-
"""
Haiku.py
Based on Twitter API
(Japanese) http://watcher.moe-nifty.com/memo/docs/twitterAPI13.txt
(Original) http://apiwiki.twitter.com/REST+API+Documentation
"""
__author__="ymotongpoo <ymotongpoo@gmail.com>"
__date__ ="$2008/11/22 09:57:30$"
__version__="$Revision: 0.10"
__credi... | |
from functools import reduce
import operator as op
import numpy as np
import pandas as pd
from zipline.lib.labelarray import LabelArray
from zipline.pipeline import Classifier
from zipline.pipeline.data.testing import TestingDataSet
from zipline.pipeline.expression import methods_to_ops
from zipline.testing import pa... | |
from flask_classy import route
from flask import request, jsonify, Response
from marvin.tools.query import doQuery, Query
from marvin.core.exceptions import MarvinError
from marvin.api.base import BaseView, arg_validate as av
from marvin.utils.db import get_traceback
import json
def _getCubes(searchfilter, **kwargs):... | |
# 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... | |
import logging; _L = logging.getLogger('openaddr.ci.collect')
from ..compat import standard_library
from argparse import ArgumentParser
from os import environ
from zipfile import ZipFile, ZIP_DEFLATED
from os.path import splitext, exists, basename, join
from urllib.parse import urlparse
from operator import attrgette... | |
import hashlib
import operator
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.utils import truncate_name
from django.db.models.fields.related import ManyToManyField
from django.db.transaction import atomic
from django.utils.encoding import force_bytes
from django.utils.log import ... | |
# File with utility functions for models in pytorch
# Imports ___________________________________________________________________
import os
import re
import torch
import torchvision.datasets as datasets
from torch.utils.data import Dataset, DataLoader
import numpy as np
import matplotlib.pyplot as plt
from PIL import ... | |
# python3
# coding=utf-8
# Copyright 2020 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 ... | |
#!/usr/bin/python
# filename: ab_analysis.py
###########################################################################
#
# Copyright (c) 2013 Bryan Briney. All rights reserved.
#
# @version: 1.0.0
# @author: Bryan Briney
# @props: IgBLAST team (http://www.ncbi.nlm.nih.gov/igblast/igblast.cgi)
# @license: MIT (http:... | |
# This file is part of the Soletta Project
#
# Copyright (C) 2015 Intel Corporation. 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 co... | |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | |
#
# 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... | |
import sys
import time
import unittest
from nose.tools import *
compat_24 = sys.version_info >= (2, 4)
class TestTools(unittest.TestCase):
def test_ok(self):
ok_(True)
try:
ok_(False, "message")
except AssertionError, e:
assert str(e) == "message"
else:
... | |
import os, sys
import pytest
from _pytest.monkeypatch import monkeypatch as MonkeyPatch
def pytest_funcarg__mp(request):
cwd = os.getcwd()
sys_path = list(sys.path)
def cleanup():
sys.path[:] = sys_path
os.chdir(cwd)
request.addfinalizer(cleanup)
return MonkeyPatch()
def test_set... | |
import theano
import theano.tensor as T
import pickle
from collections import OrderedDict
import time
from .function_module import Function, WorkerFunction
from .collectives import shareds_registry
from . import exct
from .util import struct, PKL_FILE
# import ipdb
sync = None
synk_functions = list()
#############... | |
# Copyright 2011 VMware, 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 ... | |
from sqlalchemy.testing import assert_raises
from sqlalchemy.testing import assert_raises_message
from sqlalchemy.testing import emits_warning
import pickle
from sqlalchemy import Integer, String, UniqueConstraint, \
CheckConstraint, ForeignKey, MetaData, Sequence, \
ForeignKeyConstraint, ColumnDefault, Index,... | |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | |
"""Windows console screen buffer handlers."""
import atexit
import ctypes
import re
import sys
from colorclass.codes import ANSICodeMapping, BASE_CODES
from colorclass.core import RE_SPLIT
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
INVALID_HANDLE_VALUE = -1
IS_WINDOWS = sys.platform == 'win32'
RE_NUMBER_SEARCH = re... | |
# -*- coding: utf-8 -*-
"""
Magic Reload Library
Luke Campagnola 2010
Python reload function that actually works (the way you expect it to)
- No re-importing necessary
- Modules can be reloaded in any order
- Replaces functions and methods with their updated code
- Changes instances to use updated classes
- Aut... | |
# 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 a... | |
"""Support for Telldus Live."""
import asyncio
import logging
from functools import partial
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant import config_entries
from homeassistant.const import CONF_SCAN_INTERVAL
from homeassistant.helpers.dispatcher import async_dispa... | |
#!/usr/bin/env python
"""Fit F(V,T) data to find EOS parameters from Castep
A Castep 'thermodynamcs' run produces a table of
thermodynamic data from a lattice dynamics calculation.
If a serise of such calculations are done for stuctures
optimised at different hydrostatic pressures, this information
can... | |
from fontTools.misc import arrayTools
from defcon.objects.base import BaseObject
from defcon.tools.fuzzyNumber import FuzzyNumber
from defcon.tools.notifications import NotificationCenter
_representationFactories = {}
def addRepresentationFactory(name, factory):
_representationFactories[name] = factory
def remov... | |
#!/usr/bin/env python
import Lp_FrontEndFunctions
import Lp_CursesDriver
import Lp_XmlParser
import Lp_RpcDispatcher
import Lp_InputProcessing
import Lp_Defines
import shutil
import os
import sys
import socket
import time
import subprocess
import signal
import platform
import threading
from datetime import datetime
... | |
# Copyright 2014 Open Source Robotics Foundation, 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... | |
#!/usr/bin/env python
"""Tests for the dtypes and converters arguments to CSV import.
"""
import pytest
from io import BytesIO
from unittest import mock
from tdclient import api, Client
from tdclient.util import read_csv_records
from tdclient.test.test_helper import gunzipb
from tdclient.test.test_helper import ma... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import json
import logging
import os
import sys
import random
from random import shuffle
import numpy as np
import scipy as scp
import scipy.misc
from scipy.misc import imread, imresize
imp... | |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2017 Peter Williams <peter@newton.cx> and collaborators.
# Licensed under the MIT License.
"""This module contains helpers for modeling X-ray spectra with the `Sherpa
<http://cxc.harvard.edu/sherpa/>`_ package.
"""
from __future__ import absolute_import, division, pri... | |
# -*- coding: utf-8 -*-
import flask
import functools
import logging
import requests
from .. import storage
from .. import toolkit
from . import cache
from . import config
logger = logging.getLogger(__name__)
cfg = config.load()
def is_mirror():
return bool(cfg.mirroring and cfg.mirroring.source)
def _respon... | |
import datetime
from django.conf import settings
import mock
from nose.tools import eq_
import amo
from abuse.models import AbuseReport
from amo.tasks import find_abuse_escalations, find_refund_escalations
from amo.tests import app_factory
from devhub.models import AppLog
from editors.models import EscalationQueue
f... | |
#!/usr/bin/python
import sys, getopt, copy, pprint, traceback, ast
from pymongo import MongoClient
from fluxpy import models
from fluxpy import mediators
from fluxpy.mediators import *
usage_hdr = """
manage.py [COMMAND] [REQUIRED ARGS FOR COMMAND] [OPTIONAL ARGS FOR COMMAND]
Commands:
load Loads... | |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | |
"""Provides methods to bootstrap a home assistant instance."""
import asyncio
import logging
import logging.handlers
import os
import sys
from collections import OrderedDict
from types import ModuleType
from typing import Any, Optional, Dict
import voluptuous as vol
from voluptuous.humanize import humanize_error
imp... | |
# -*- coding: utf-8 -*-
import hashlib
import os
import shutil
import requests
import yaml
import tempfile
from jinja2 import FileSystemLoader, Environment
from pykwalify.core import Core
from pykwalify.errors import SchemaError
from dogen.template_helper import TemplateHelper
from dogen.tools import Tools
from doge... | |
from __future__ import unicode_literals
import os
import sys
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.db.migrations.graph import MigrationGraph
from django.db.migrations.recorder import MigrationRecorder
from django.utils import six
from .exception... | |
#!/usr/local/epd/bin/python
#------------------------------------------------------------------------------------------------------
# Dirac propagator based on:
# Fillion-Gourdeau, Francois, Lorin, Emmanuel, Bandrauk, Andre D.
# Numerical Solution of the Time-Dependent Dirac Equation in Coordinate Space without Ferm... | |
import pytest
import os
from glob import glob
from backports.tempfile import TemporaryDirectory
import pickle
import time
from velox import VeloxObject, register_object, load_velox_object
from velox.exceptions import VeloxCreationError, VeloxConstraintError
from velox.tools import timestamp
from velox_test_utils i... | |
# Copyright 2013-2014 MongoDB, 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 writin... | |
"""Undocumented Module"""
__all__ = ['Messenger']
from PythonUtil import *
from direct.directnotify import DirectNotifyGlobal
import types
from panda3d.core import ConfigVariableBool
# If using the Toontown ActiveX launcher, this must be set true.
# Also, Panda must be compiled with SIMPLE_THREADS or no HAVE_THREA... | |
# 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 ... | |
from __future__ import absolute_import
import logging
import os
import shutil
from pip._vendor import pkg_resources
from pip._vendor import requests
from pip.download import (url_to_path, unpack_url)
from pip.exceptions import (InstallationError, BestVersionAlreadyInstalled,
DistributionN... | |
#!/usr/bin/python
import os
from copy import copy
import shapefile
from opensextant import get_country, Country
from opensextant.gazetteer import DataSource, get_default_db, normalize_name, load_stopterms, parse_admin_code, PlaceHeuristics
from opensextant.utility import is_code, is_abbreviation, get_list
#
stopterm... | |
"""
Quantilization functions and related stuff
"""
from functools import partial
import numpy as np
from pandas._libs.lib import infer_dtype
from pandas.core.dtypes.common import (
_NS_DTYPE, ensure_int64, is_categorical_dtype, is_datetime64_dtype,
is_datetime64tz_dtype, is_datetime_or_timedelta_dtype, is_in... | |
# Copyright (c) 2013 Zelin.io
# Copyright (C) 2015 Nippon Telegraph and Telephone 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
#
# htt... | |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# ext4slower Trace slow ext4 operations.
# For Linux, uses BCC, eBPF.
#
# USAGE: ext4slower [-h] [-j] [-p PID] [min_ms]
#
# This script traces common ext4 file operations: reads, writes, opens, and
# syncs. It measures the time spent in these... | |
#!/usr/bin/env python
"""The MySQL database methods for flow handling."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import threading
import time
from future.utils import iteritems
import MySQLdb
from MySQLdb.constants import ER as my... | |
import argparse
import os
import shutil
import time
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import densenet as dn
# used for logging ... | |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# version 1.02
import re
import os
import sys
import time
import lxml
import pickle
import requests
import urlparse
from bs4 import BeautifulSoup
from misc import *
def main():
from pprint import pprint
robot = WeiboRobot('', '') # username & password
info = ... | |
# Copyright 2007-2016, Sjoerd de Vries
import sys, re, os
from collections import namedtuple, OrderedDict
from .macros import get_macros
from .typedef import typedef_parse
from ..exceptions import SilkSyntaxError
from lxml.builder import E
# from ..validate import is_valid_silktype
# Regular expressions
# quotes (... | |
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@ecdsa.org
#
# 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 limitation the rights... | |
'''
update:
2014/09/03:
softmax in the last layer
customize:
only classify 1
'''
import theano
import theano.tensor as T
import gzip
import cPickle
import numpy
import time
class HiddenLayer(object):
def __init__(self, rng, input, n_in, n_out, W=None, b=None,
a... | |
# Copyright DataStax, 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, softwa... | |
"""Models mixins for Social Auth"""
import re
import time
import base64
import uuid
from datetime import datetime, timedelta
import six
from openid.association import Association as OpenIdAssociation
from social.backends.utils import get_backend
from social.strategies.utils import get_current_strategy
CLEAN_USERNA... | |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
from math import log
import numpy as np
from scipy.linalg import pinvh
import pytest
from sklearn.utils._testing import assert_array_almost_equal
from sklearn.utils._testing im... | |
from sys import getsizeof
import operator
import numpy as np
from pandas._libs import index as libindex
from pandas.core.dtypes.common import (
is_integer,
is_scalar,
is_int64_dtype)
from pandas import compat
from pandas.compat import lrange, range
from pandas.compat.numpy import function as nv
from pand... | |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2014-12-08 22:23:10
import time
import logging
logger = logging.getLogger('bench')
from six.moves import queue as Queue
from pyspider.scheduler import T... | |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import base64
import binascii
from contextlib import closing
import functools
import sys
import threading
import datetime
from io import BytesIO
from tornado.escape import utf8
from tornado import gen
from tornado.... | |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limi... | |
import unittest
import six
import json
from datetime import datetime
from mock import patch, mock_open
from wargaming import WoT, WGN, WoTB, WoWP, WoWS, WoTX, settings
from wargaming.meta import MetaAPI, BaseAPI, WGAPI
from wargaming.settings import RETRY_COUNT, HTTP_USER_AGENT_HEADER
from wargaming.exceptions import ... | |
from __future__ import division, print_function, absolute_import
import sys
import traceback
import numpy as np
# noinspection PyPackageRequirements
from PIL import Image
import vision_definitions
from naoqi import ALProxy
from mlpy.modules import Module
from mlpy.constants import micro
from .detectors import Ball... | |
# $Id: frontmatter.py 8671 2021-04-07 12:09:51Z milde $
# Author: David Goodger, Ueli Schlaepfer <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Transforms related to the front matter of a document or a section
(information found before the main text):
- `DocTitle`: Used to tra... | |
# 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.
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");... | |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import hashlib
import logging
import os
import re
import selectors
import threading
import time
from contextlib import closing
from pants.base.build_environment import get_buildroot
from ... | |
import logging
import re
import sys
from unidecode import unidecode
from sqlalchemy import func, Integer, distinct
from sqlalchemy.orm import subqueryload
from collections import defaultdict
from datetime import datetime
import suggestive.mstat as mstat
from suggestive.db.session import session_scope
from suggestive.d... | |
#!/usr/bin/env python
# Copyright (c) 2015, Andre Lucas
# 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... | |
#!/usr/bin/python2.7
import base64
import Tkinter
# This is a base64 encoded GIF image. One neat trick with using Python to create GUIs
# is you can embed your graphics into the code so anything you want to display doesn't
# need to be pre-loaded or downloaded separately. You can only use GIFs in this way.
gifBase = '... | |
#!/usr/bin/env python
"""
This script is mainly for running autotests on the build server, however, it
can also be used by engineers to run the tests locally on their machines.
It takes as optional parameters the path to the folder containing the test
executables (which must have names ending in _tests), and a list... | |
# 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 applicab... | |
__author__ = 'CwT'
import struct
import Util
import OatParse
class Symbol:
def __init__(self):
self.str = None # name
self.name = 0 # index of name
self.value = 0
self.size = 0
self.info = 0
self.other = 0
self.shndx = 0
self.size = 4 * 3 + ... | |
#! /usr/bin/python
#
# This script builds an OpenDSA textbook according to a specified configuration file
# - Creates an ODSA_Config object from the specified configuration file
# - Validates the configuration file and sets appropriate defaults for omitted fields (see ODSA_Config.py for more information)
# - ... | |
# imaplib utilities
# Copyright (C) 2002-2015 John Goerzen & contributors
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any l... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# Copyright 2011 Justin Santa Barbara
# 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 Licens... | |
import copy
from pytest import raises
from invoke.parser import Argument, Context
from invoke.tasks import task
from invoke.collection import Collection
class Context_:
"ParserContext" # meh
def may_have_a_name(self):
c = Context(name="taskname")
assert c.name == "taskname"
def may_ha... | |
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
import json
from django.shortcuts import render
from django.views import defaults
from django.http import HttpResponse
from rest_framework import viewsets, mixins, status
from .models import Arch, SigKey, Lab... | |
import json
import logging
import unittest
import six
if six.PY3:
from unittest import mock
else:
import mock
from socketio import packet
from socketio import server
@mock.patch('engineio.Server')
class TestServer(unittest.TestCase):
def tearDown(self):
# restore JSON encoder, in case a test cha... | |
# -*- coding: utf-8 -*-
#
# 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
#... | |
"""Storage methods and utilities"""
import getpass
import os
import logging
import re
import shutil
import time
from datetime import datetime
from multiprocessing import Pool
from statusdb.db import connections as statusdb
from taca.utils.config import CONFIG
from taca.utils import filesystem, misc
logger = logging.... | |
"""RPM dependency lines parser and helpers.
Contains class DependencyParser which parses string and generates
token tree. For common manipulation is method flat_out() useful, it
just splits dependencies into list.
For future development is useful find_end_of_macro().
"""
import re
import logging
from .rpmexception ... | |
# 3p
from mock import Mock
# project
from tests.checks.common import AgentCheckTest
from tests.core.test_wmi import SWbemServices, TestCommonWMI
class WMITestCase(AgentCheckTest, TestCommonWMI):
CHECK_NAME = 'wmi_check'
WMI_CONNECTION_CONFIG = {
'host': "myhost",
'namespace': "some/namespace... | |
"""
Tests for uu module.
Nick Mathewson
"""
import unittest
from test import support
import sys, os
import uu
from io import BytesIO
import io
plaintext = b"The smooth-scaled python crept over the sleeping dog\n"
encodedtext = b"""\
M5&AE('-M;V]T:\"US8V%L960@<'ET:&]N(&-R97!T(&]V97(@=&AE('-L965P
(:6YG(&1O9PH """
# ... | |
#
# Copyright (C) 2002-2006 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
"""
unit testing code for ca... | |
"""
Installs and configures nova
"""
import os
import uuid
import logging
from packstack.installer import validators
from packstack.installer import utils
from packstack.installer.exceptions import ScriptRuntimeError
from packstack.modules.ospluginutils import NovaConfig, getManifestTemplate, appendManifestFile, man... | |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, unicode_literals
import os
import logging
import click
import AppKit
from collections import Mapping
from Foundation import *
from AppKit import *
from avashell.utils import resource_path
from avashell.osx.window import Window
from ava... | |
__author__ = 'John'
#modify csv files.
#lowercase every column.
#remove stop words
#remove states
#os.getcwd()
#os.chdir("/tmp/")
#os.getcwd()
import csv
import sys
import operator
import re
import os
def write_nice_csv(file_name):
reader = csv.reader(open("csv/%s" % file_name), delimiter=",")
#omit head... | |
import py, pytest
import _pytest._code
from _pytest.config import getcfg, get_common_ancestor, determine_setup
from _pytest.main import EXIT_NOTESTSCOLLECTED
class TestParseIni:
def test_getcfg_and_config(self, testdir, tmpdir):
sub = tmpdir.mkdir("sub")
sub.chdir()
tmpdir.join("setup.cfg"... | |
import pytest
from baby_steps import given, then, when
from pytest import raises
from district42 import schema
from district42.errors import DeclarationError
@pytest.mark.parametrize("length", [3, 4])
def test_list_contains_elements_len_declaration(length: int):
with given:
elements = [schema.int(1), sch... | |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the fundrawtransaction RPC."""
from decimal import Decimal
from test_framework.test_framework imp... | |
# import os
# import sys
import shelve
import random
import textwrap
from time import sleep, time
from collections import namedtuple
from bearlibterminal import terminal as term
# sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + '/../')
import spaceship.strings as strings
from .screen_functions import *
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.