src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015 Mario Frasca <mario@anche.no>.
#
# This file is part of ghini.desktop.
#
# ghini.desktop 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 Foundat... |
#!/usr/bin/python
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module... |
from gobjcreator3.codegen.code_generator import CodeGenerator
from gobjcreator3.codegen.output import StdOut
from gobjcreator3.codegen.name_creator import NameCreator
from gobjcreator3.codegen.c_marshaller_generator import CMarshallerGenerator, CMarshallerNameCreator
from gobjcreator3.model.type import Type
from gobjcr... |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2017 Stanford University and the Authors
#
# Authors: Robert McGibbon
# Contributors: Jason Swails, Matthew Harrigan... |
import discord
from sigma.core.mechanics.logger import create_logger
class SigmaEvent(object):
def __init__(self, bot, event, plugin_info, event_info):
self.bot = bot
self.db = self.bot.db
self.event = event
self.plugin_info = plugin_info
self.event_info = event_info
... |
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
# License: GPL2 or later see COPYING
# Written by Michael Brown
# Copyright (C) 2007 Michael E Brown <mebrown@michaels-house.net>
# python library imports
import fcntl
import os
import time
# our imports
from mockbuild.trace_decorator impo... |
#!/usr/bin/env python
'''
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")... |
# -*- coding: UTF-8 -*-
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2010 Task Coach developers <developers@taskcoach.org>
Copyright (C) 2008 Rob McMullen <rob.mcmullen@gmail.com>
Task Coach is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License ... |
#!/usr/bin/env python
"""
--- Day 22: Sporifica Virus ---
Diagnostics indicate that the local grid computing cluster has been contaminated with the Sporifica Virus. The grid computing cluster is a seemingly-infinite two-dimensional grid of compute nodes. Each node is either clean or infected by the virus.
To prevent ... |
# -*- coding: utf-8 -*
"""
@author Simon Wu <swprojects@runbox.com>
Copyright (c) 2018 by Simon Wu <Advanced Action Scheduler>
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... |
from django.urls import reverse
from rest_framework.exceptions import ValidationError
from biohub.abacus.result import AbacusAsyncResult
from . import consts, remote
class BaseHandler(object):
"""
Abstract task handler to adjust different environments.
"""
def __init__(self, request):
self._... |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team.
#
# 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... |
# -*- 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
#... |
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from __future__ import print_function
import sys
from datetime import datetime
from pdc_client.plugin_helpers import PDCClientPlugin, add_parser_arguments, extract_arguments
info_des... |
from six.moves import zip
import numpy as np
from numpy import array
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.field_writer_16 import print_card_16
class SPCD(object):
"""
Defines an enforced displacement value for static analysis and an enforced
motion value (displacement,... |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.build_graph.build_file_aliases import BuildFileAliases, TargetMacro
from pants.goal.task_registrar import TaskRegistrar as task
from pants.contrib.go.targets.go_binary import G... |
import numpy as np
import copy
import os
import h5py
from mapio.shake import ShakeGrid
from openquake.hazardlib.geo.geodetic import distance
from readstation import readStation
from init_grid import initialize
def realizations(total_real, my_reals, radius, variables, grid_arr, mu_arr, sigma_arr, list_sizes_grid, list... |
#!/usr/bin/env python
# hacktasic viz of the quadratic surface of advantage around the max output
# for a couple of clear block on right / left / center cases
import agents
import argparse
import base_network
import Image
import numpy as np
import models
import sys
import tensorflow as tf
import replay_memory
import ... |
#!/usr/bin/env python
"""
Command-line interface for various Zeeko components
"""
import click
import logging
import logging.handlers
import zmq
import time
import sys
import numpy as np
from zutils import zmain, ioloop, MessageLine
log = logging.getLogger()
main = zmain()
@main.command()
@click.option(
"--i... |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, print_function, division,
absolute_import)
import sys
import hashlib
from contextlib import contextmanager
from django.views.decorators.csrf import csrf_exempt
from django.db import transaction, models
from django.views.generic ... |
'''
Copyright (C) 2016 Giles Miclotte (giles.miclotte@ugent.be)
This file is part of OMSim
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 ... |
# Copyright 2016 Twitter. 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 agree... |
import xml.etree.cElementTree as ET
input_filename = "unique_nodes.osm"
output_filename = "ready_to_fix.osm"
# Parse the XML from the OSM file
tree = ET.ElementTree(file=input_filename)
#I tried to use the library OSMAPI to parse the OSM files into python structures
# but it hanged the laptop cause it took too much... |
"""Image preprocessing tools."""
from math import sqrt, hypot
import numpy as np
import cv2
from time import sleep
from util import Enum
from base import FrameProcessor
from main import main
import commands
from colorfilter import HSVFilter
blueFilter = HSVFilter(np.array([108, 70, 75], np.uint8), np.array([122, 255,... |
# -*-coding:Utf-8 -*
from django.http import HttpResponse
from django.shortcuts import render
from simulation.models import IndividualForm
from django.forms.formsets import formset_factory, BaseFormSet
from datetime import datetime
from core.utils import Scenario
from simulation.lanceur import Simu
class BaseSc... |
import httplib2
import urllib
try:
import json
except ImportError:
import simplejson as json
try:
from decorator import decorator
except ImportError:
# No decorator package available. Create a no-op "decorator".
def decorator(f):
def decorate(_func):
def inner(*args, **kwargs):... |
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import copy as cp
import numpy as np
from ..epochs import Epochs
from ..proj import compute_proj_evoked, compute_proj_ep... |
#!/usr/bin/env python2.5
#
# Copyright 2008 the Melange 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 applic... |
__author__ = 'jstcyr'
from PyQt4 import QtGui, QtCore
from ..views import DialogAddPointUi
from ..models.Coordinates import Coordinates
from ..utilities import CoordinatesUtils
class DialogAddPoint(QtGui.QDialog, DialogAddPointUi.Ui_Dialog_add_point):
def __init__(self, parent=None):
super(DialogAddPoint... |
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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.... |
#
# Quru Image Server
#
# Document: user_auth.py
# Date started: 10 Aug 2011
# By: Matt Fozard
# Purpose: Image server user authentication module
# Requires:
# Copyright: Quru Ltd (www.quru.com)
# Licence:
#
# This program is free software: you can redistribute it and/or modify
# it under... |
from django.db import models
from django import forms
from django.test import SimpleTestCase, TransactionTestCase
from taggee.fields import TagField
from .models import TagModel
class TagFieldTestCase(SimpleTestCase):
def setUp(self):
self.tags = TagField()
self.model = TagModel()
def test_de... |
"""File translation command"""
import click
from cligj import format_opt
from .helpers import resolve_inout
from . import options
import rasterio
from rasterio.coords import disjoint_bounds
from rasterio.windows import Window
# Geographic (default), projected, or Mercator switch.
projection_geographic_opt = click.o... |
from sfepy.base.base import *
from parseEq import create_bnf
from materials import Materials
from sfepy.terms import Terms, Term, term_table, DataCaches, cache_table
"""
Note:
- create found materials, variables from configuration/input file data
... no - user should be able to create objects even if they are not
... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or '123456'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
FLASKY_MAIL_SUBJECT_PREFIX = '[Flasky]'
FLASKY_MAIL_SENDER = 'Flasky Admin <camdroid_usp@gmail.com>'
FLASKY_ADMIN = os.environ.get(... |
import sys
from distutils.core import setup
#PY3 = sys.version_info.major >= 3
PY3 = sys.version_info[0] >= 3
VERSION_FILE = "pifacecad/version.py"
def get_version():
if PY3:
version_vars = {}
with open(VERSION_FILE) as f:
code = compile(f.read(), VERSION_FILE, 'exec')
ex... |
# -*- coding: utf-8 -*-
"""
plots edi files as resistivity and phase vs period
Only works for Windows installation due to hard-coded paths
CreatedOn: Wed Sep 18 15:35:39 2013
CreatedBy: Alison Kirkby
LastUpdated: 2017-01-24
UpdatedBy: fei.zhang@ga.gov.au
LastUpdated: 2018-03-22 AK updated to us... |
from __future__ import unicode_literals
import difflib
import json
import os
import re
import sys
from copy import copy
from functools import wraps
try:
from urllib.parse import urlsplit, urlunsplit
except ImportError: # Python 2
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseSt... |
# 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, print_function, unicode_literals
from pants.backend.jvm.targets.import_jars_mixin import ImportJarsMixin
from pants.backen... |
# MIT License
# Copyright (c) 2017 Conner Dunn, Tian Zhi Wang, Kyle Carlstrom, Xin Yi Wang, Josh Deng
# 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 ... |
"""Config flow for Bond integration."""
import logging
from typing import Any, Dict, Optional
from aiohttp import ClientConnectionError, ClientResponseError
from bond_api import Bond
import voluptuous as vol
from homeassistant import config_entries, exceptions
from homeassistant.const import (
CONF_ACCESS_TOKEN,
... |
#
# 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 re
from utils import openfile
from gravador import iniciagravador
from servidores import request_servidores
class menulateral(xbmcgui.WindowXMLDialog):
def __init__( self, *args, **kwargs ):
xbmcgui.WindowXML.__init__(self)
self.finalurl = kwargs[ "finalurl" ]
self.sigla... |
"""
Demo platform for the rollor shutter component.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.components.rollershutter import RollershutterDevice
from homeassistant.const import EVENT_TIME_CHANGED
from homeassistant.helpers... |
'''
Created on May 4, 2017
@author: andrei
'''
import logging
import abc
from framework.misc import exception
class PRTCL_SIGNATURE:
CLAUDE_SYS_PRTCL = 'CLAUDE-SYS-PRTCL'
CLAUDE_DSCVRY_PRTCL = 'CLAUDE-DSCVRY-PRTCL'
CLI_TO_JM_PRTCL = 'CLI-TO-JM-PRTCL'
JM_TO_JS_PRTCL = 'JM-TO-JS-PRTCL'
JS_TO_RD_... |
#########################################################################################################
# test_4.py
# Implements unit tests for the genericQSARpyUtils project (see below).
#
# ########################################
# #test_4.py: Key documentation :Contents#
# ########################################... |
# Copyright (C) 2017 Open Information Security Foundation
#
# You can copy, redistribute or modify this Program under the terms of
# the GNU General Public License version 2 as published by the Free
# Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; wi... |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2015, 2016, University of Tuebingen, CERN.
#
# B2Share 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
# ... |
import os
import ast
import traceback
import time
import sys
import types
import builtins
import collections
import astor
import weakref
from .jsonify import jsonify, jsonify_print, jsonify_print_expr
from .datalayer import Analysis, Execution, FileEdit
from .router import send
from . import stdlib
def now():
retu... |
from mock import call
from patchwork.files import directory
class files:
class directory_:
def base_case_creates_dir_with_dash_p(self, cxn):
directory(cxn, "/some/dir")
cxn.run.assert_called_once_with("mkdir -p /some/dir")
def user_sets_owner_and_group(self, cxn):
... |
from __future__ import absolute_import, print_function, division
import unittest
from theano.compat import izip
from six import iteritems
import numpy
import theano
import theano.tensor as T
from theano.tensor import TensorType
from theano.tensor.basic import alloc
# Don't import test classes otherwise they get test... |
from Products.CMFCore.utils import getToolByName
from Products.UWOshSuccess.utils import isSuccessDebugModeEnabled, getSuccessDebugModeEmailAddress, getSuccessCCEmailAddress
import logging
logger = logging.getLogger('subscribers')
def _convertToId(string):
string = string.lower()
string = string.replace(' ', ... |
"""
Gather information about a system and report it using plugins
supplied for application-specific information
"""
## sosreport.py
## gather information about a system and report it
## Copyright (C) 2006 Steve Conklin <sconklin@redhat.com>
### This program is free software; you can redistribute it and/or modify
## i... |
# -*- coding: utf-8 -*-
from scrapy.exceptions import DropItem
from peewee import *
db = SqliteDatabase('timeouts.sqlite')
class Item(Model):
date = DateTimeField()
message = CharField()
class Meta:
database = db
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM... |
import boto3
import os
def list_objects(bucket_name, prefix):
final = []
session = boto3.Session()
client = session.client('s3')
next_token = 'init'
kwargs = {}
while next_token:
if next_token != 'init':
kwargs.update({'ContinuationToken': next_token})
response = cl... |
import btree,bank,datetime,time,shelve,sys
from btree_errors import *
from random import randint,random
def strTimeProp(start, end, format, prop):
"""Get a time at a proportion of a range of two formatted times.
start and end should be strings specifying times formated in the
given format (strftime-style),... |
# -*- coding: utf-8 -*-
import os
import seaborn
seaborn.set()
colors = seaborn.color_palette()
import utils
# For 3D plotting we need to import some extra stuff
from mpl_toolkits.mplot3d import Axes3D
# First create two random vectors in 3 dimensional space
v1 = rand(3, 1)
v2 = rand(3, 1)
# And scale them to uni... |
from django import forms
from django.core.validators import MinLengthValidator
from django.template.loader import render_to_string
from corehq.apps.style.forms.fields import MultiEmailField
from corehq.apps.userreports.reports.view import ConfigurableReport
from crispy_forms import layout as crispy
from crispy_forms.he... |
import time
import os
import string
from oeqa.utils.helper import shell_cmd_timeout
class BTFunction(object):
"""
@class BTFunction
"""
log = ""
def __init__(self, target):
self.target = target
# un-block software rfkill lock
self.target.run('rfkill unblock all')
sel... |
import os
import math
from datetime import datetime, date, time
import csv
import operator
from hashlib import md5
from sets import Set
import subprocess
import mimetypes
from django.contrib.admin.views.decorators import staff_member_required
from django.template import RequestContext
from django.shortcuts import get_... |
#Tyler Smith and Kamryn Harris
#tsmith328@gatech.edu and kharris48@gatech.edu
#CS 1301 Section A06
#We worked on this assignment alone, using only the semester's course materials.
def mass(kg):
stone = kg * 0.157
return stone
def volume(liter):
pint = liter * 2.11
print('There are %.2f' % pint , 'US p... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
from frappe import _
from frappe.utils import formatdate, format_datetime, getdate, get_datetime, nowdate, flt, cstr, add_days, t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NXEZ.COM.
# http://www.nxez.com
#
# Licensed under the GNU General Public 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.gnu.org/licen... |
# coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
from contextlib import ExitStack
from datetime import datetime, timedelta, timezone
from hashlib import sha1
from json import dump, load, loads
from logging import info, warning
from os import environ, remove
from time impor... |
#!/usr/bin/env python
"""
################################################################################
# #
# classification_ttH_ttbb_1_from_saved_model #
# ... |
import os
import sys
import subprocess
import shlex
import sys
import StringIO
import datetime
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + os.sep + os.pardir + os.sep + "makahiki" + os.sep)
from apps.utils import script_utils
def termination_string():
"""
Gets the current system time and app... |
#"INTEL CONFIDENTIAL"
#Copyright 2016 Intel Corporation All Rights Reserved.
#
#The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and... |
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... |
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2014 Bitcraze AB
#
# Cr... |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & 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 3 of the Licen... |
from .base import APITestCase
from django.core.exceptions import ImproperlyConfigured
try:
from django.urls import include
except ImportError:
from django.conf.urls import include
class RestRouterTestCase(APITestCase):
def test_rest_model_conflict(self):
from wq.db import rest
from tests.c... |
import logging
import asyncio
import collections
import json
import zlib
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
LOGGING_PERIOD = 5
PACKET_CHANNEL = 319540379495956490
LEVELS = {
logging.INFO: 326388782829928448,
logging.WARNING: 326388923116945408,
... |
#!/usr/bin/env python
# This example uses Uvicorn package that must be installed. However, it can be
# replaced with any other ASGI-compliant server.
#
# NOTE: Python 3.6 requires aiocontextvars package to be installed.
# Optional asynchronous reporting requires HTTPX package to be installed.
#
# Run: python app... |
import cassiopeia.dto.requests
import cassiopeia.type.dto.team
def get_teams_by_summoner_id(summoner_ids):
"""https://developer.riotgames.com/api/methods#!/986/3358
summoner_ids int | list<int> the summoner ID(s) to look up teams for
return dict<str, list<Team>> the requested sum... |
# -*- coding: utf-8 -*-
"""
Low-level implementations of opaque methods.
"""
from __future__ import print_function, division, absolute_import
import string
from flypy.compiler import opaque
from pykit import ir, types as ptypes
def add_impl(opaque_func, name, implementation, restype=None, restype_func=None):
"... |
"""
redrock.fitz
============
Functions for fitting minima of chi^2 results.
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import scipy.constants
import scipy.special
from . import constants
from .rebin import rebin_template
from .zscan import calc_zchi2_one, spectral_dat... |
"""
Goal: simplify the code when interacting with entities
Usage when declaring a model:
import db
class MyEntity(db.Model, CRUDMixin):
id = db.Column('myID', db.Integer, primary_key=True)
data = db.Column('myData', db.String(255))
MyTableEntity.create(data="abc")
my = MyTableEntity(data="abc")
db.session.s... |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import super... |
#!/usr/bin/env python
#
# Copyright (c) 2014 CNRS
# Author: Steve Tonneau
#
# This file is part of hpp-rbprm-corba.
# hpp-rbprm-corba is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 o... |
# Twitter Toolbox for Python
# Copyright 2016 Hugo Hromic
#
# 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 ... |
# Copyright (C) 2014-2016 Red Hat, Inc.
#
# 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 later version.
#
# This program is distribut... |
"""
This file defines the common pytest fixtures used in current directory.
"""
from contextlib import contextmanager
import json
import pytest
import subprocess
import ray
from ray.cluster_utils import Cluster
@pytest.fixture
def shutdown_only():
yield None
# The code after the yield will run as teardown c... |
import json
import os
from golem.core import utils
from golem.test_runner import test_runner
from golem.report.execution_report import create_execution_directory
from golem.report.execution_report import create_execution_dir_single_test
from golem.report import test_report
from golem.report.test_report import get_tes... |
import os
os.environ['MKL_NUM_THREADS'] = '1'
os.environ['NUMEXPR_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
from ._version import __version__, __version_info__
version = __version__
from . import calibration
from . import pipeline
from . import redmagic
from .configuration import Configuration
from .... |
# -*- coding: utf-8 -*-
# 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, software... |
# Bulletproof Arma Launcher
# Copyright (C) 2017 Lukasz Taczuk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# b... |
import time
import ClydeUnitTest
import ClydeLog
import TestRig
class TestEyePowerOn(ClydeUnitTest.ClydeTestCase):
def __init__(self, methodName):
super(TestEyePowerOn, self).__init__(methodName)
self.testRig = TestRig.rig
def test_010_off_current(self):
MIN_OFF_CURRENT = 0
MAX_OFF_CURRENT = ... |
#!/usr/bin/env python2
import sys, os
import json
import argparse
import sqlite3 as lite
con = None
def extant_file(x):
if not os.path.exists(x):
raise argparse.ArgumentError("{0} does not exist".format(x))
return x
def main():
parser = argparse.ArgumentParser(description="Import flairs")
pa... |
import csv
import logging
import transaction
DIRNAME = "/opt/Plone-4.3/zeocluster/Extensions/"
FILENAME = "ccdet.dat"
MAXROWS = 100000000
TRANSSIZE = 50
TRANSSIZE_FOR_READING = 5000
FOLDERID = 'cbrf-folder'
logger = logging.getLogger('ccdet_mem')
html_escape_table = {
"&": "&",
}
def html_escape(text):... |
#!/usr/bin/env python2
import time
from functools import partial
import sgfc_communication
import sgfc_io
from sgfc_communication.protobufs import sgfc_pb2 as fc_proto
class SgfcDrone(object):
def __init__(self):
self._throttle = 0.0
self._yaw = 0.0
self._pitch = 0.0
def comm_callb... |
import py.test
from tiddlyweb.config import config
from tiddlyweb.model.tiddler import Tiddler
from tiddlyweb.model.bag import Bag
from tiddlywebplugins.utils import get_store
from tiddlywebplugins.sqlalchemy3 import index_query, Base
def setup_module(module):
module.store = get_store(config)
module.environ... |
import socket
####### SOCKET
def create_socket_server(myHost, port):
s = None
for res in socket.getaddrinfo(None, int(port), socket.AF_UNSPEC,socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except socket.error as ms... |
"""
A MathML printer.
"""
from __future__ import print_function, division
from sympy import sympify, S, Mul
from sympy.core.compatibility import range, string_types, default_sort_key
from sympy.core.function import _coeff_isneg
from sympy.printing.conventions import split_super_sub, requires_partial
from sympy.printi... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import shutil
import sys
import tempfile
import unittest
import mock
from pyfakefs import fake_filesystem_unittest
import py_utils
from py_utils ... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, HttpResponseRedirect
from .forms import *
from base.views import group_required
from base.models import *
# Create your views here.
@login_required
@group_required('Doctor')
def createPrescription(request... |
# Copyright 2019 The Sonnet 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 applicable l... |
import time
import datetime
class Timer(object):
'''
A simple timer.
'''
def __init__(self):
self.init_time = time.time()
self.total_time = 0.
self.calls = 0
self.start_time = 0.
self.diff = 0.
self.average_time = 0.
self.remain_... |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... |
# -*- coding: utf-8 -*-
"""Base class for all types of entries."""
class BaseEntry:
"""Base class for all types of entries."""
def format(self, **options):
raise NotImplementedError()
def format_auxiliary_entry(self, entry_type, contents, indent=' ',
singleline... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.