src stringlengths 721 1.04M |
|---|
#!/usr/bin/python
import math, random, time, subprocess, re, os, sys
def unlink_f(n):
try:
os.unlink(n)
except OSError:
pass
random.seed(1)
dt = float('nan')
factors = sys.maxint
while not (20.0 <= dt <= 30.0 and factors < 20):
# Fewer factors = easier prime factorization but more difficult to brute fo... |
import xml.sax
import xml.sax.handler
import types
try:
_StringTypes = [types.StringType, types.UnicodeType]
except AttributeError:
_StringTypes = [types.StringType]
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
START_DOCUMENT = "START_DOCUMENT"
END_DOCUMENT = "END_DOCUMENT"
... |
import unittest
import os
import logging
import traceback
from jsonschema import validate as json_validate, ValidationError as json_validateError
from decaf_specification import Specification
class DescriptorValidatorTest(unittest.TestCase):
def setUp(self):
self.logger = logging.getLogger(__name__)
... |
import cv2
import numpy as np
class Connector(object):
class Direction:
OUTPUT = 1
INPUT = 2
def __init__(self,node,name,direction,type):
self.node = node
self.name = name
self.direction = direction
self.value = None
self.type = type
self.parse... |
#!/usr/bin/env python3
from datetime import datetime, timezone
from reporting.category import Category
from reporting.activity import Activity
#{
# "id": "669bfeea-92e8-47f8-a9e7-03497253bd21",
# "state": "CLOSED",
# "result": "SUCCEEDED",
# "rootTrace": { "startDate": 1494844210865, "endDate": 149484422... |
## COPYRIGHT
## Copyright (C) 2015 Kyle Briggs (kbrig035<at>uottawa.ca)
##
## This file is part of cusumtools.
##
## 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 Soft... |
# -*- coding: utf-8 -*-
import collections
from xml.sax.xmlreader import AttributesImpl
from ecoxipy import _python2, _unicode
from ecoxipy import _helpers
from ._common import XMLNode, ContainerNode, _string_repr
from ._content_nodes import Text
from .indexing import (IndexDescriptor, ElementByUniqueAttributeValueIn... |
import argparse
import time
import math
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
from torch.autograd import Variable
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sklearn.metrics import preci... |
#
# 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... |
# Authors: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
# Robert Luke <mail@robertluke.net>
#
# License: BSD 3 clause
from collections import OrderedDict
from datetime import datetime, timezone
from itertools import repeat
import sys
import os.path as op
import pytest
from pytest import approx
from numpy.te... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2005-2007 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2009 Benny Malengier
# Copyright (C) 2010 Nick Hall
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute... |
# Copyright (c) 2013 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2013 Julien Danjou <julien@danjou.info>
#
# 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, inclu... |
import argparse
from nltk.corpus import brown
import requests
import arrow
import json
parser = argparse.ArgumentParser()
parser.add_argument('host')
args = parser.parse_args()
def create_new_novel():
url = 'http://{host}/api/novel'.format(host=args.host)
response = requests.post(url, json={'title': 'Test No... |
import gocept.lxml.interfaces
import grokcore.component
import martian
import zeit.edit.block
import zeit.edit.interfaces
import zope.component.zcml
import zope.interface
class NoneGuard(object):
"""An IRuleGlob must never return None, because then it would not show up
in the getAdapters() result, so its name... |
#-*- coding:utf-8 -*-
import logging.config
IMAGE_SIZES = {
"large": (680,382),
"middle": (720, 0),
"small": (226,150 )
}
IMAGE_SAVE_DIR = "/Users/jiangqiurong/Desktop"
mongodb_conn_string = "mongodb://47.88.194.127:27017/"
mysql_config = {
"user": "zhaozhi",
"password": "zzhao",
"host": "47... |
# encoding: utf-8
u'''MCL Site Knowledge — interfaces.'''
from . import MESSAGE_FACTORY as _
from zope import schema
from zope.interface import Interface
class IIngestor(Interface):
u'''Interface for objects that are ingestors.'''
def ingest():
u'''Ingest data from your RDF source and populate your ... |
"""add user_identities
Revision ID: 316bb58e84f
Revises: 38c8ec357e0
Create Date: 2015-03-11 01:40:12.157458
"""
# revision identifiers, used by Alembic.
revision = '316bb58e84f'
down_revision = '38c8ec357e0'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic ... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
CURRENT_PATH = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(CURRENT_PATH, 'requirements.txt')) as f:
required = f.read().splitlines()
setup(
name='django-postgrefts',
author='Bertrand Bordage',
author_... |
import urllib
import urllib2
from django.contrib.sites.models import Site
from django.conf import settings
from django.template import RequestContext, loader, Context
from django.http import HttpResponseRedirect, HttpResponse, Http404, HttpResponseNotFound
from django.shortcuts import render_to_response
from django.s... |
import numpy as np
def header_parse(header,maxvols,prninfo):
#Define some substrings used in reading header
underscore='_'
dot='.'
#
#number of voxels in the file
volnum=np.zeros(maxvols)
regionID=list()
structType=list()
molecules=list()
#
volnames=header.split()
for i ... |
# Parts of this code are taken from: https://gist.github.com/chris-hailstorm/4989643
# All credits go to the original author
import unicodedata
def _remove_accents(data):
"""
Changes accented letters to non-accented approximation, like Nestle
"""
return unicodedata.normalize('NFKD', data).encode('as... |
# You've just started to study impartial games, and came across an interesting theory. The theory is quite complicated, but
# it can be narrowed down to the following statements: solutions to all such games can be found with the mex function.
# Mex is an abbreviation of minimum excludant: for the given set s it fin... |
from __future__ import print_function
import argparse
import logging
from collections import namedtuple
import satsolver.parser as parser
from satsolver.util import Success, Failure
from satsolver.state import Instance
class Node(object):
def __init__(self, lit, asg, level):
assert lit > 0
self.... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
#Copyright (c) 2011 Yahoo! Inc. All rights reserved. Licensed under the BSD License.
# See accompanying LICENSE file or http://www.opensource.org/licenses/BSD-3-Clause for the specific language governing permissions and limitations under the License.
"""
This is the Boss search API
search is the main function
Examp... |
import logging
from tornado import escape
from odin.adapters.adapter import ApiAdapterResponse, \
request_types, response_types
from odin_data.odin_data_adapter import OdinDataAdapter
class MetaListenerAdapter(OdinDataAdapter):
"""An OdinControl adapter for a MetaListener"""
def __init__(self, **kwarg... |
# encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __fu... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Intel Corp.
#
"""
Get BIOS version
"""
from ...commands.command import CommandResult
from ...plugin import DeclarePlugin
from .bios import BiosCommand
@DeclarePlugin('bios_version', 100)
class BiosVersionCommand(BiosCommand):
"""Bios Get Version Command"""
def ... |
#!/usr/bin/env python
from __future__ import print_function, division
import sys
import string
import select
import socket
import numpy as np
import zlib
import pdb
import time
import zmq
import json
import struct
SECRET_CODE = 314159
class ClientSocket:
"""This is copied to macquarie-observatory-automation/common... |
import os, sys
import imp
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
constants = imp.load_source('modulename', 'constants.py')
from decimal import *
def get_unsettled_transaction_list():
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = const... |
# -*- coding: utf-8 -*-
# @Author: liuli
# @Date: 2016-07-03 16:42:59
# @Last Modified by: XUEQUN
# @Last Modified time: 2016-07-15 21:09:41
from dbutils import MySQLConnection
import hashlib
import codecs
import os
import utils
import time
import paramiko
import pika
import sys
class User(object):
def __ini... |
# -*- coding: utf-8 -*-
"""Public section, including homepage and signup."""
from flask import Blueprint, flash, redirect, render_template, request, url_for, g
from flask_login import login_required, login_user, logout_user
from grasshopper.extensions import login_manager
from grasshopper.public.forms import LoginForm... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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 3 of the License, or
# (at y... |
from __future__ import print_function
import sys
import copy
import random
import numpy as np
from collections import defaultdict
def data_partition(fname):
usernum = 0
itemnum = 0
User = defaultdict(list)
user_train = {}
user_valid = {}
user_test = {}
# assume user/item index starting fro... |
import numpy as np
from deepforest.scan import Scan, MultiGrainedScan
from .utils import TestWithData, create_models, prepare_x, prepare_y
class Test(TestWithData):
def setup(self):
self.X_train = prepare_x((100, 3, 3))
self.y_train = prepare_y((100,))
def test_fit_transform_should_return_2_... |
import sys
from importlib import import_module
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.db.models import Count, Prefetch, Q
from django.shortcuts import redirect
from django.utils.decorators import method_decorator
from django.utils.timezone import now
from djang... |
# -*- coding: utf-8 -*-
from django.utils.translation import gettext_lazy as _
from django.utils.html import mark_safe, format_html
from django.contrib.humanize.templatetags import humanize
from django.template.defaultfilters import date as date_format
from spirit.core.conf import settings
from spirit.core.tags.regis... |
# -*- coding: utf-8 -*-
from django.shortcuts import get_object_or_404, render_to_response
from django.template.context import RequestContext
from dndtools.dnd.menu import MenuItem, menu_item, submenu_item
from dndtools.dnd.views import permanent_redirect_object, permanent_redirect_view, is_3e_edition
from dndtools.dnd... |
# -*- 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 or... |
from __future__ import print_function
import sys
import os.path
from setuptools import setup, find_packages
readme = os.path.join(os.path.dirname(__file__), 'README.rst')
long_description = open(readme).read()
setup(
name='statz',
version='0.0.1',
author='Fabio Pliger',
author_email='fabio.pliger@gma... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# tifffile.py
# Copyright (c) 2008-2014, Christoph Gohlke
# Copyright (c) 2008-2014, The Regents of the University of California
# Produced at the Laboratory for Fluorescence Dynamics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or w... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
import os
# 扫描资源引用
import re
class ImageScanner(object):
def __init__(self, path):
self.path = path
def scan_image_name(self):
# 扫描所有图片资源,遇到.imageset结尾的文件夹,则返回
files = self.__class__.__get_all_files(self.path, r'.png|.jpg|.pdf')
image_... |
# -*- coding:Utf-8 -*-
from django.conf.urls import url
from django.core.exceptions import ObjectDoesNotExist
from tastypie import fields as base_fields, http
from tastypie.utils import trailing_slash
from tastypie.validation import Validation
from tastypie_mongoengine import fields
from dateutil.parser import parse
... |
import gym
import time
import random
import numpy as np
from collections import deque
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
os.system('export CUDA_VISIBLE_DEVICES=""')
import gc
import os
import tensorflow as tf
import keras.backend.tensorflow_backend as KTF
def get_session(gpu_fraction=0.7):
'''Ass... |
"""pypyr step yaml definition for commands - domain specific language."""
import shlex
import subprocess
import logging
from pypyr.errors import ContextError
from pypyr.utils import types
# logger means the log level will be set correctly
logger = logging.getLogger(__name__)
class CmdStep():
"""A pypyr step that... |
#!/usr/bin/env python
# Copyright (C) 2013 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 b... |
# -*- coding: utf-8 -*-
__licence__ = """
Copyright (C) 2009 Mikhail Ryzhov <rymiser@gmail.com>
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 3 of the License.
This program is dist... |
# -*- coding: utf-8 -*-
#
# Zephyr documentation build configuration file, created by
# sphinx-quickstart on Fri May 8 11:43:01 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
import os.path as osp
import PIL
import numpy as np
import sc... |
"""
This file contains celery tasks for programs-related functionality.
"""
from celery import task
from celery.utils.log import get_task_logger # pylint: disable=no-name-in-module, import-error
from django.conf import settings
from django.contrib.auth.models import User
from edx_rest_api_client.client import EdxRest... |
import json
from django.http import HttpResponse
class AjaxableResponseMixin(object):
"""
Mixin to add AJAX support to a form.
Must be used with an object-based FormView (e.g. CreateView)
"""
def render_to_json_response(self, context, **response_kwargs):
data = json.dumps(context)
... |
########################################################################
# $HeadURL $
# File: FileCatalogProxyHandler.py
########################################################################
""" :mod: FileCatalogProxyHandler
================================
.. module: FileCatalogProxyHandler
:synopsi... |
# -*- coding: utf-8 -*-
from Traductores.TraductorInterface import TraductorInterface
import math
class TraductorFiscal(TraductorInterface):
def dailyClose(self, type):
"Comando X o Z"
# cancelar y volver a un estado conocido
self.comando.cancelAnyDocument()
self.comando.start()
... |
"""prosper.datareader.robinhood.news: news parsing from Robinhood"""
import itertools
import warnings
import requests
from .. import config
from .. import exceptions
RH_NEWS = 'https://api.robinhood.com/midlands/news/'
PAGE_HARDBREAK = 50
def fetch_company_news_rh(
ticker,
page_limit=None,
ur... |
import logging
import string
import tweepy
from credentials import (consumer_key, consumer_secret)
from models import Stopword
from collections import Counter
class Service(object):
# Map uppercase to lowercase, and deletes any punctuation.
trans = {ord(string.ascii_uppercase[i]): ord(string.ascii_lowercase... |
from tests.integration.integration_test_case import IntegrationTestCase
class TestConfirmationPage(IntegrationTestCase):
def test_confirmation_page(self):
self.rogue_one_login_and_check_introduction_text()
self.post(action='start_questionnaire')
self.rogue_one_check_character_page()
... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
NextGIS WEB API
-------------------
begin : 2014-11-19
git sha : $Format:%H$
copyright : (C) 2014 by NextGIS
e... |
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
# Create your models here.
class Department(models.Model):
departname = models.CharField(max_length=50 , unique=True)
description = models.TextField(max_length=2000)
class Meta:
db_table = ... |
# -*- coding: utf-8 -*-
"""
Defines the fields that can be added to redisco models.
"""
import sys
from datetime import datetime, date
from dateutil.tz import tzutc, tzlocal
from calendar import timegm
from redisco.containers import List
from exceptions import FieldValidationError, MissingID
__all__ = ['Attribute', 'C... |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
# mixbox
from mixbox import fields
# stix
import stix
import stix.bindings.ttp as ttp_binding
from .malware_instance import MalwareInstance, MalwareInstanceFactory
from .exploit import Exploit
from .attack_pattern... |
'''Transform operation on globally scoped symbols to
operations on symbol_cell mapping.
'''
from __future__ import absolute_import
from __future__ import with_statement
from ..runtime.symbol import get_symbol_cells_map, gensym
from ..compiler import ir as I
from ..compiler import bind
from ..compiler.walk import I... |
from curtsies import FSArray, fmtstr
from .layout_manager import LayoutManager, OverlayLayout
from .utils import wrap, box, fmtfsa, center, blit
__author__ = 'malte'
class Decorator(object):
def __init__(self, fg=None, bg=None):
self.fg = fg
self.bg = bg
self.kwargs = {}
if fg is ... |
"""
Separation of Concerns Disclaimer:
While created specifically for checking fonts and font-families this
module has no domain knowledge about fonts. It can be used for any kind
of (document) checking. Please keep it so. It will be valuable for other
domains as well.
Domain specific knowledge should be encoded only i... |
# Copyright 2016 gRPC authors.
#
# 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... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import array
import re
import socket
import struct
import subprocess
import sys
import mozinfo
import m... |
"""
Tests that the stem.version functions can handle the tor instance we're
running with.
"""
import unittest
import stem.prereq
import stem.version
import test.runner
from test.runner import require_controller
class TestVersion(unittest.TestCase):
def test_get_system_tor_version(self):
"""
Basic verific... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
# Figure out the version
import re
here = os.path.dirname(os.path.abspath(__file__))
version_re = re.compile(
r'__version__ = (\(.*?\))')
fp = open(os.path.join(here, 'glob2', '__init__.py'))
version = None
for line in fp:
match = ver... |
#-*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
import copy
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin, RegressorMixin
from sklearn.externals.six import with_metaclass
from chainer import Variable, FunctionSet, optimizers, cuda
import chainer.functions as F
from .dA impor... |
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at h... |
"""
Description:
Transaction Basic Class
Usage:
from neo.Core.Transaction import Transaction
"""
import sys
from itertools import groupby
import binascii
from neo.Core.UInt160 import UInt160
from neo.Blockchain import GetBlockchain
from neo.Core.TX.TransactionAttribute import TransactionAttributeUsage
from neo.... |
# Copyright (c) 2014 Deutsche Telekom AG
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# 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... |
# coding: utf8
import locale
from mz_wkasa_platby import fix_login, Uc_sa
# Uc_sa - id účtů účtové osnovy - při importu zde je vidí controléry i views
locale.setlocale(locale.LC_ALL, 'cs_CZ.UTF-8')
class IS_IN_DB_(IS_IN_DB):
def build_set(self):
super(IS_IN_DB_, self).build_set()
... |
import sys
import argparse
from time import process_time
import Bio
from Bio.SeqFeature import FeatureLocation
from Bio.SeqFeature import SeqFeature
from decimal import *
class MySeqFeature(SeqFeature):
def __str__(self):
out = "type: %s\n" % self.type
if self.strand == 1:
out += "loca... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# 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 3 of the License, or
# (at your option) any l... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of ... |
#!/usr/bin/env python
#
# Python-bindings file type test script
#
# Copyright (C) 2009-2021, Joachim Metz <joachim.metz@gmail.com>
#
# Refer to AUTHORS for acknowledgements.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publishe... |
import os, logging
from datetime import datetime,timedelta
import webapp2
from google.appengine.ext import db, blobstore, deferred
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.api import images, taskqueue, users, mail, search, urlfetch
import logging
from models import *
import tools... |
'''
Test markdown.py with unittest
To run tests:
python test_markdown_unittest.py
'''
import unittest
from markdown_adapter import run_markdown
class TestMarkdownPy(unittest.TestCase):
def setUp(self):
pass
def test_non_marked_lines(self):
'''
Non-marked lines should only get 'p'... |
import os
from astropy import units as u
import pkg_resources
from digicampipe.io.simtel import simtel_event_source
from digicampipe.io.event_stream import event_stream, calibration_event_stream
example_file_path = pkg_resources.resource_filename(
'digicampipe',
os.path.join(
'tests',
'resourc... |
import pytest
from dulwich.repo import Repo
from fargo import find_and_replace
suits = [u'\u2660', u'\u2665', u'\u2666', u'\u2663']
ranks = list(str(i) for i in range(2, 11)) + ['J', 'Q', 'K', 'A']
deck_text = u"This here is a deck of cards man:\n\n{}".format(
"\n".join(''.join((r, s)) for s in suits for r in ran... |
import logging
logger = logging.getLogger('spacel')
# These could always use tuning:
COSTS = {
'AWS::AutoScaling::AutoScalingGroup': {
'Add': 2,
'Modify': 300,
'Remove': 2
},
'AWS::AutoScaling::LaunchConfiguration': {
'Add': 2,
'Modify': 2,
'Remove': 2
}... |
#!/usr/bin/env python
#
# Copyright 2016 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 requir... |
import pathlib
from modelx.testing.testutil import compare_model
from modelx.serialize import ziputil
import modelx as mx
import pytest
from modelx.tests.testdata import (
CSV_SINGLE_PARAM,
CSV_MULTI_PARAMS
)
@pytest.mark.parametrize("write_method", ["write_model", "zip_model"])
def test_single_param(tmp_pat... |
import logging
import requests
import requests.exceptions
from gssapi import Credentials, exceptions
from requests.compat import urlencode, urljoin
from requests_gssapi import HTTPSPNEGOAuth
log = logging.getLogger(__name__)
class Client(object):
"""
A fasjson client to make very specific requests to fasjs... |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
from test.doctype import assign_notify
from test.doctype import create_test_results,create_child_testresult, ... |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio 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 opt... |
import os
import subprocess
import sys
from pixiv_pixie.cli import main as cli_main, NAME
BINARY_PATH = 'lib'
DATA_PATH = 'data'
def is_packaged():
# Return true if executing from packaged file
return hasattr(sys, 'frozen')
def get_path(path, package_prefix=DATA_PATH):
if os.path.isabs(path) or not is... |
import json
import os
import unittest
from unittest.mock import patch
import numpy as np
from orangecontrib.text.pubmed import (
Pubmed, PUBMED_TEXT_FIELDS,
_mesh_headings_to_class,
_date_to_iso, _corpus_from_records,
_records_to_corpus_entries
)
class MockEntrezHandle:
@staticmethod
def clo... |
##
# Copyright (c) 2009-2017 Apple 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 l... |
import mock
from bravado_core.model import create_model_type
from tests.model.conftest import pet_spec as pet_spec_fixture
from tests.model.conftest import \
definitions_spec as definitions_spec_fixture
def test_pet_model(pet_spec):
Pet = create_model_type('Pet', pet_spec)
expected = set(['id', 'category... |
import unittest
from utils.GeoTools import GeoTools
"""
This is a POJO used for testing GeoTools methods
"""
class PhysicalObject():
def __init__(self, longitude, latitude):
self.longitude = longitude
self.latitude = latitude
class GeoToolsTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(s... |
#!/usr/bin/env python
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import optparse
import re
import subprocess
import time
def query_surfaceflinger_frame_count():
parcel = subprocess.Pope... |
import os
from conans.client.build.cppstd_flags import cppstd_default
from conans.errors import ConanException
from conans.model.env_info import EnvValues
from conans.model.options import OptionsValues
from conans.model.ref import PackageReference
from conans.model.values import Values
from conans.paths import CONANIN... |
def generateMatrix(A):
n = A
rows, cols = n, n
top, bottom = 0, n - 1
left, right = 0, n - 1
direction = 0
result = [[0 for j in xrange(n)] for i in xrange(n)]
count = 1
while top <= bottom and left <= right:
if direction is 0:
for i in xrange(left, right + 1):
... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from datetime import datetime
import pytest
from py.xml import html
@pytest.mark.optionalhook
def pytest_html_results... |
#!/usr/bin/python
# Usage: python list_bam_reads.py in1.bam [in2.bam ...] in.fasta
"""
A script for listing filenames of all reads in a bamfile
"""
import pysam
import sys
import os
import shutil
import multiprocessing
import functools
import itertools
from Bio import SeqIO
def loadRef(fasta):
"""
Create a ... |
'''
@Author Sean McLaughiln
This is my copy of the dnn module. I'm adding some features so I can use DNN for regression rather than just classification.
'''
import cPickle
import gzip
import os
import sys
import time
import collections
import numpy
import theano
import theano.tensor as T
from theano.tensor.shared_ra... |
#httplib was ok and httplib2 especially had nice api, but they don't work thru proxies and stuff
#-- curl is the most robust thing
#import httplib
import curl #a high level wrapper over pycurl bindings
import json
import hashlib #only 'cause has a hardcoded pwd here now - for real this comes from connection or launcher... |
"""
Classname: DirectoryFeedConstructor
Description: Creates a feed for an internal directory type of feed
Authored by: MapLarge, Inc. (Scott Rowles)
Change Log:
"""
"""
Define all the imports for the site_feed_constructor class
"""
import os
import re
import sys
import datetime as dt
import codecs
import uuid
impor... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from behave.formatter.base import Formatter
from behave.model_describe import ModelPrinter
from behave.textutil import make_indentation
# -----------------------------------------------------------------------------
# CLASS: PlainFormatter
# ------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.