src
stringlengths
721
1.04M
#!/usr/bin/env python # # @file DowncastPackagesFile.py # @brief class for generating downcast packages file # @author Frank Bergmann # @author Sarah Keating # # <!-------------------------------------------------------------------------- # # Copyright (c) 2013-2015 by the California Institute of Technology # (C...
from isochrones.dartmouth import Dartmouth_Isochrone from isochrones.utils import addmags import numpy as np import pandas as pd file = open('/tigress/np5/true_params.txt','a') def get_index(n): if n < 10: return '000' + str(n) elif n < 100: return '00' + str(n) elif n < 1000: retu...
import re from myfitnesspal.base import MFPBase class Entry(MFPBase): def __init__(self, name, nutrition): self._name = name self._nutrition = nutrition #split out quantity and measuring unit out of entry name regex = r'(?P<short_name>.+), (?P<quantity>\d[\d\.]*) (?P<unit...
import mock import pytest from ulauncher.api.server.DeferredResultRenderer import DeferredResultRenderer from ulauncher.api.server.ExtensionController import ExtensionController from ulauncher.api.server.ExtensionManifest import ExtensionManifest from ulauncher.api.shared.action.BaseAction import BaseAction from ulaun...
"""This file is part of asyncoro; see http://asyncoro.sourceforge.net for details. This module provides API for asynchronous file and pipe processing. They work with Windows, Linux, OS X and likely other UNIX variants. Note that regular (on-disk) files don't support asynchronous I/O, as they are non-blocking and can't...
#!/usr/bin/env python """ This module uses feedparser to get item titles and links from any rss feed, and presents the results as simple command-line output. It's great for browsing your favorite sites unobtrusively, without having to open a browser window. Feeds are memoized for feed_memoize_interval seconds after ...
# Copyright (c) 2016 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. import sys import os.path import signal import traceback from PyQt5.QtCore import QObject, QUrl, pyqtSlot, pyqtProperty, pyqtSignal from PyQt5.QtQml import QQmlApplicationEngine, qmlRegisterType from PyQt5.QtWidgets imp...
#!/usr/bin/python3 # # Copyright (C) 2012 Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright notice, # this list o...
#!/usr/bin/env python """ Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that: Only one letter can be changed at a time Each intermediate word must exist in the word list For example, Given: beginWord = "hit" endWord ...
""" Django settings for elsyser project. Generated by 'django-admin startproject' using Django 1.10.2. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os...
# # File : building.py # This file is part of RT-Thread RTOS # COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team # # 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...
"""Tests for items views.""" from __future__ import absolute_import import copy import json import tempfile import textwrap from codecs import BOM_UTF8 from uuid import uuid4 import ddt import six from django.conf import settings from django.test.utils import override_settings from django.urls import reverse from ed...
import sys sys.path.insert(0, '../') import unittest import lib.base as sinon from lib.matcher import SinonMatcher from lib.spy import SinonSpy from lib.stub import SinonStub """ ====================================================== FOR TEST ONLY START ===============================================...
#!/usr/bin/env python # # 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 requir...
# -*- 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 #...
#!/usr/bin/env python # -*- coding: utf-8 -*- import luigi import sqlite3 import glob import numpy as np import json from simulation_meta_task import * class DynamicRangeSimulation(SimulationDynamicMetaTask, luigi.Task): name = luigi.Parameter("dynamic-range-simulation-bretz") n_repititions = luigi.IntParamete...
from rest_framework import serializers from rest_framework.reverse import reverse from fastapp.models import Base, Apy, Setting, Counter, TransportEndpoint, Transaction, LogEntry import logging logger = logging.getLogger(__name__) class CounterSerializer(serializers.ModelSerializer): class Meta: model =...
import datetime import time from ht1632cpy import HT1632C import settings from lightsensor import getLight interface = HT1632C(2, 0) interface.pwm(settings.read('settings', 'matrix', 'default_brightness')) def dimmer(): dimmer_brightness = settings.read('settings', 'matrix', 'dimmer_brightness') default_br...
# coding=utf8 """ seen.py - Willie Seen Module Copyright 2008, Sean B. Palmer, inamidst.com Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> Licensed under the Eiffel Forum License 2. http://willie.dftba.net """ from __future__ import unicode_literals import time import datetime from willie.tools import Identi...
"""Given the names and grades for each student in a Physics class of N students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade. Note: If there are multiple students with the same grade, order their names alphabetically and print each name on a new line. Input For...
#!/usr/bin/env python # pylint: disable=missing-docstring # flake8: noqa: T001 # ___ ___ _ _ ___ ___ _ _____ ___ ___ # / __| __| \| | __| _ \ /_\_ _| __| \ # | (_ | _|| .` | _|| / / _ \| | | _|| |) | # \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____ # | \ / _ \ | \| |/ _ \_ _| | __| \_ ...
""" Massively univariate analysis of a computation task from the Localizer dataset ============================================================================== A permuted Ordinary Least Squares algorithm is run at each voxel in order to determine which voxels are specifically active when a healthy subject performs a...
#coding=UTF-8 from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext from pyspark.sql.types import * from datetime import date, datetime, timedelta import sys, re, os st = datetime.now() conf = SparkConf().setAppName('PROC_A_R_OUTCOME_TOP').setMaster(sys.argv[2]) sc = SparkContext(conf = conf) sc.se...
# encoding: utf-8 import socket import os from mytor.pool import ConnectionNotFoundError from pymysql import OperationalError from tornado.testing import gen_test from mytor import Connection, ConnectionPool from maproxy.proxyserver import ProxyServer from maproxy.session import SessionFactory from . import BaseTestCas...
class Subject: def __init__(self, name): self.name = name self.observer_set = set([]) def add_observer(self, observer): self.observer_set.add(observer) def remove_observer(self, observer): self.observer_set.remove(observer) def say_something(self, something): p...
# -*- coding: utf-8 -*- # 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 distributed ...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
# -*- coding: utf-8 -*- """ These methods are specific to working with DOIs and are not part of the standard API or may expose a part of the API in a different in useful way. DOI notes: ---------- 1) DOIs are not case sensitive """ import requests from .errors import InvalidDOI, UnhandledHTTPResonseFailure # TO...
import torch from torch import nn, Tensor from torch.nn.modules.utils import _pair from torchvision.extension import _assert_has_ops from ._utils import convert_boxes_to_roi_format, check_roi_boxes_shape def ps_roi_pool( input: Tensor, boxes: Tensor, output_size: int, spatial_scale: float = 1.0, ) -...
import os import random import itertools import model #experiments = [[1, 1, 1, 1, 1, 1]] def dist_a(source, correlation): return max(0.0,min(1.0, random.gauss(source, 1.0-correlation))) def dist_b(source, correlation): x = random.gauss(source, 1.0-correlation) while x < 0.0 or x > 1.0: x = ...
# -*- coding: utf-8 -*- # This file is part of Shoop. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. from __future__ import unicode_literals, with_statement from django.core.ex...
"""The Risco integration.""" import asyncio from datetime import timedelta import logging from pyrisco import CannotConnectError, OperationError, RiscoAPI, UnauthorizedError from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONF_PASSWORD, CONF_PIN, CONF_SCAN_INTERVAL, ...
# GestureLogic - state machine for interface logic for the gesture-based editing. # # This encompasses all the logic for the editor which is easier to write in # Python than Grasshopper objects. Only one GestureLogic instance is expected to # exist since it holds and tracks user inputs. # # Objectives for this ...
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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 ...
# -------------------------------------------------------- # Fully Convolutional Instance-aware Semantic Segmentation # Copyright (c) 2016 by Contributors # Copyright (c) 2017 Microsoft # Licensed under The MIT License [see LICENSE for details] # Modified from py-faster-rcnn (https://github.com/rbgirshick/py-faster-rcn...
# encoding: utf-8 # Copyright 2013 maker # License """ Core module Dashboard URLs """ from django.conf.urls.defaults import patterns, url urlpatterns = patterns('maker.core.dashboard.views', url(r'^(\.(?P<response_format>\w+))?$', 'index', name='core_dashboard_index'), # Widgets ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): "Write your forwards methods here." for question in orm.question.objects.filter(export_label=''): que...
############################################################################### ## ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary forms, with or without ## modification, ...
#!/usr/bin/env python """Setup script for the package.""" import os import sys import setuptools PACKAGE_NAME = 'gridcommand' MINIMUM_PYTHON_VERSION = 3, 5 def check_python_version(): """Exit when the Python version is too low.""" if sys.version_info < MINIMUM_PYTHON_VERSION: sys.exit("Python {}....
# -*- coding: utf-8 -*- from math import sin, cos, degrees, radians, pi class CoordCalc: def __init__(self, star_data_list, area, diagram_size): self.star_data_list = star_data_list self.area = area self.center_ra_angle = self._ra_to_angle((area.ra_min + area.ra_max)/2) if area.ra...
""" Overrides for Docker-based devstack. """ from .devstack import * # pylint: disable=wildcard-import, unused-wildcard-import # Docker does not support the syslog socket at /dev/log. Rely on the console. LOGGING['handlers']['local'] = LOGGING['handlers']['tracking'] = { 'class': 'logging.NullHandler', } LOGGIN...
# # Race Capture App # # Copyright (C) 2014-2016 Autosport Labs # # This file is part of the Race Capture App # # This 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 ...
#!/usr/bin/env python3 # # Copyright (c) 2019 Roberto Riggio # # 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 applicabl...
import warnings from abc import ABC, abstractmethod from queue import Queue from typing import List, Optional, Dict, Generator, Tuple, Set from autogentoo.cportage import ( get_portage, Dependency, Atom, Ebuild, UseFlag, UseOperatorT, Portage, AtomUseT, AtomUseDefaultT, Required...
""" The task is to use breadth-first search to compute single-source shortest distances in an unweighted directed graph. Given: A simple directed graph with n≤103 vertices in the edge list format. Return: An array D[1..n] where D[i] is the length of a shortest path from the vertex 1 to the vertex i (D[1]=0). If i is n...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'School' db.create_table('gsaudit_school', ( ('id', self.gf('django.db.models.f...
from datetime import datetime, timedelta from odoo import fields from odoo.tests.common import TransactionCase class TestCase(TransactionCase): at_install = True post_install = True def setUp(self): super(TestCase, self).setUp() self.event = self.env["event.event"].create( { ...
#!/usr/bin/python # need root privileges import struct import sys import time from socket import AF_INET, AF_INET6, inet_ntoa sys.path.append('python') sys.path.append('build/python') import nflog sys.path.append('dpkt-1.6') from dpkt import ip l = nflog.log() def cb(payload): try: print "python call...
#python libs import logging logger = logging.getLogger(__name__) #Libs from addons.captcha.recaptcha import PluginRecaptcha #CONNECTION_RETRY = 3 BASE_URL = "http://www.filefactory.com" WAITING = 60 class PluginDownload(PluginRecaptcha): def parse(self): link = self.link page = self.get_page(lin...
#!/usr/bin/env python """ (C) 2008-2009 Javi Roman <javiroman@kernel-labs.org> $Id$ """ import sys import traceback import Ice import socket import signal import syslog import time import os # # Important sanity tests. # slice_dir = os.getenv('ICEPY_HOME', '') if len(slice_dir) == 0 or not os.path.exists(os.path.joi...
# vim: set fileencoding=utf-8 : # (c) 2009 Marcos Dione <mdione@grulic.org.ar> # This file is part of satyr. # satyr 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 ...
from __future__ import print_function import pytest from pytest import approx from SuchTree import SuchTree from dendropy import Tree from itertools import combinations, chain import numpy try : import networkx has_networkx = True except ImportError : has_networkx = False test_tree = 'SuchTree/tests/test...
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from impact.api_data import APIData from accelerator.models import ProgramStartupStatus class StartupListData(APIData): ALPHA_ASC_ORDER = "AlphaAsc" ALPHA_DSC_ORDER = "AlphaDsc" RANDOM_ORDER = "Random" ORDER_BY_VALUES = [ALPHA_ASC_ORDER, ALPHA_DS...
# -*- coding: utf-8 -*- import hashlib import time import simplejson from xml.etree import ElementTree as etree from xml.etree.ElementTree import Element, SubElement, ElementTree import utils import log import constant import messagebuilder class YiXin(object): ''' Main class of this lib. ''' def __init__(self, ...
# -*- coding: utf-8 -*- #****************************************************************************** # # lesis2sqlite # --------------------------------------------------------- # This plugin convert lesis GIS working dir structure to sqlite data base # # Author: Alexander Lisovenko, alexander.lisovenko@nextgis.ru...
# -*- coding: utf-8 -*- from django.conf import settings as settings from django.contrib.auth.decorators import login_required from django.core.context_processors import csrf from django.core.urlresolvers import reverse from django.db.models import Q from django.http import HttpResponse, HttpResponseRedirect, Http404 f...
#!/usr/bin/env python """Setup script for the pyparsing module distribution.""" from setuptools import setup import sys import os from pyparsing import __version__ as pyparsing_version modules = ["pyparsing",] setup(# Distribution meta-data name = "pyparsing", version = pyparsing_version,...
""" HTML Widget classes """ from __future__ import unicode_literals import copy from itertools import chain import warnings from django.conf import settings from django.forms.utils import flatatt, to_current_timezone from django.utils.datastructures import MultiValueDict, MergeDict from django.utils.html import cond...
import aslam_backend as aopt import aslam_splines as asp import IccUtil as util import incremental_calibration as inc import kalibr_common as kc import sm import gc import numpy as np import multiprocessing import sys # make numpy print prettier np.set_printoptions(suppress=True) CALIBRATION_GROUP_ID = 0 HELPER_GROU...
#!/usr/bin/python # *-* coding:utf-8 *-* __appname__ = 'pytacad-clt' __version__ = "0.1" __author__ = "Benoit Guibert <benoit.guibert@free.fr>" __licence__ = "" import os, sys import unicodedata from django.utils.encoding import smart_unicode server = os.path.dirname(sys.argv[0]) + '/pytacad-server' cwd = '/var/loca...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of AudioLazy, the signal processing Python package. # Copyright (C) 2012-2014 Danilo de Jesus da Silva Bellini # # AudioLazy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # ...
import re import os import math import pickle import numpy as np def save(fname, obj): with open(fname, 'w') as f: pickle.dump(obj, f) def load(fname): with open(fname, 'r') as f: return pickle.load(f) class BatchLoader(object): def __init__(self, data_dir, dataset_name, batch_size, seq_length, max_wor...
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the LGPLv3 or higher. import copy from UM.Logger import Logger from UM.Math.Vector import Vector from UM.View.GL.OpenGL import OpenGL from UM.View.GL.OpenGLContext import OpenGLContext from PyQt5.QtGui import QOpenGLVertexArrayObject ver...
# This file is part of LibreOsteo. # # LibreOsteo 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 later version. # # LibreOsteo is distributed ...
import os import sys filenames = [ 'Albuquerque_6x6.tfix', 'Atlanta_6x6.tfix', 'Austin_6x6.tfix', 'Baltimore_6x6.tfix', 'Boston_6x6.tfix', 'Charlotte_6x6.tfix', 'Chicago_6x6.tfix', 'Cleveland_6x6.tfix', 'Columbus_6x6.tfix', 'Dallas_6x6.tfix', 'Denver_6x6.tfix', 'Detroit_6x6.tfix', 'El_Paso_6x6.tfix', 'Fort_Worth_6x6.t...
from pudzu.charts import * from PIL import ImageFilter # generate map df = pd.read_csv("datasets/euhowtomake.csv").set_index('country') bg = '#181820' fg = 'white' def colorfn(c, w, h): if c == 'Sea': return bg elif c == 'Borders': return "#D0D0D0" elif c not in df.index: return "#...
import json import asyncio from pitcrew import task @task.arg("zone_id", desc="The zone id to operate on", type=str) @task.arg("records", desc="A list of records to ensure are set", type=list) class HasRecords(task.BaseTask): """Ensure route53 has the set of records""" async def verify(self): json_ou...
''' Created on 19.08.2013 @author: Walter Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6. n Relatively Pri...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2015 GNS3 Technologies 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 3 of the License, or # (at your optio...
import time from nep import* import signal import sys import datetime as dt def time_diference(str_t1,str_t2): try: y = dt.datetime.strptime(str_t1, "%Y-%m-%d %H:%M:%S.%f") except: y = dt.datetime.strptime(str_t1, "%Y-%m-%d %H:%M:%S") try: x = dt.datetime.strptime(str_t2,...
# -*- coding: utf-8 -*- # # Woofer - free open-source cross-platform music player # Copyright (C) 2015 Milan Herbig <milanherbig[at]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, e...
import dectate import morepath from morepath.app import App from morepath.publish import publish, resolve_response from morepath.request import Response from morepath.view import render_json, render_html from webob.exc import HTTPNotFound, HTTPBadRequest, HTTPFound, HTTPOk import webob from webtest import TestApp as Cl...
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import hashlib impor...
# -*- coding: utf-8 -*- # 统计几天内CPC总消费额度 import time, MySQLdb, os from pychartdir import * result = open('result.txt','w') #频道类型 arr = [1,3,5,6,7,8,9] dic = {} sum = 0 timeNow = int(time.time()) dateNow = time.strftime('%Y-%m-%d',time.localtime(timeNow)) dayNow = time.strftime('%H:%M:%S',time.localtime(ti...
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
# Copyright (c) 2015 Mirantis, 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...
from csv import DictReader from datetime import datetime from pprint import pprint from flask.ext.script import Manager from taarifa_api import add_document, delete_documents, get_schema from taarifa_waterpoints import app from taarifa_waterpoints.schemas import facility_schema, service_schema manager = Manager(app)...
from math_g4z3 import mod_exp from converts import big_int_to_bin_str import random DH_p = 0xffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe64...
from django.contrib.auth.models import User from tastefulpy import fields from tastefulpy.constants import ALL from tastefulpy.resources import ModelResource from tastefulpy.authorization import Authorization from basic.models import Note, AnnotatedNote, UserForm from django import forms from tastefulpy.validation impo...
# -*- coding: utf-8 -*- # @Author: Manuel Rodriguez <vallemrv> # @Date: 29-Aug-2017 # @Email: valle.mrv@gmail.com # @Last modified by: valle # @Last modified time: 18-Feb-2018 # @License: Apache license vesion 2.0 import sys import inspect import importlib from constant import constant class RelationShip(object...
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.conf import settings from django.db.models import QuerySet from jsonfield.fields import JSONField from six import python_2_unicode_compatible from django.u...
''' Generate a time series incorporating the motion of the screen across the source. This script may take a long time to run. I suggest you read through it first and adjust the num_samples variable to check out its performance. ''' import numpy as np from scipy.ndimage import imread import time import matplotlib.pyplot...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2013 IBM Corp. # All Rights Reserved. # # Licensed under the Apa...
import sys, os, copy, pickle import numpy as np import pandas as pd import pyneb_parser_castep from pyneb_parser_castep import deprecate import pyneb_structureformat from time import time def write_supercells2pickle(path,supercells): # write data from supercell form into a dataframe and write that to disk...
from .die import Die from .utils import i_just_throw_an_exception class GameRunner: def __init__(self): self.dice = Die.create_dice(5) self.reset() def reset(self): self.round = 1 self.wins = 0 self.loses = 0 @property def answer(self): ...
# coding=utf-8 # # Copyright © 2015 VMware, Inc. All Rights Reserved. # # 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 to use, co...
# coding=utf-8 # Copyright 2021 The TensorFlow Datasets 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 appl...
''' Author: Jacob "Speedy" Gonzalez (Thanks sam) Contributers: Sam Lewis Ben Morris Jake Lane ''' import sublime, sublime_plugin ''' header files will be to the right/bottom source files will be to the left/top ''' class AssistantListener(sublime_plugin.EventListener): '''EventListener class for events''' d...
import pygtk pygtk.require('2.0') import gtk class DialogSettings(gtk.Dialog): def __init__(self, title, parent, flag, settings): gtk.Dialog.__init__(self, title, parent, flag) s = settings self.s = s t = gtk.Table(rows = 3, columns = 3) t.set_col_spacings(10) t.set_row_spacings(10) l...
import numpy as np import pytest from pandas.core.dtypes.common import is_integer import pandas as pd from pandas import Series, Timestamp, date_range, isna import pandas._testing as tm def test_where_unsafe_int(sint_dtype): s = Series(np.arange(10), dtype=sint_dtype) mask = s < 5 s[mask] = range(2, 7)...
import pytest from test_app.models import ( Droid, Episode, Human, ) @pytest.fixture def starwars_data(transactional_db): luke, _ = Human.objects.get_or_create( id=1000, name='Luke Skywalker', ) darth_vader, _ = Human.objects.get_or_create( id=1001, name='Darth...
from __future__ import unicode_literals from unittest import TestCase from mock import patch, MagicMock, Mock import json from . import SofortProvider from .. import RedirectNeeded SECRET = 'abcd1234' CLIENT_ID = '1234' PROJECT_ID = 'abcd' class Payment(Mock): id = 1 variant = 'sagepay' currency = 'USD'...
# -*- coding: utf-8 -*- """ Fwlib32_h.py This file contains ctypes structures to match the data structures found in the library header Fwlib32.h. All classes contain `_pack_ = 4`; this comes from Fwlib32.h: #pragma pack(push,4) Don't unit test these because it would basically be running tests against the ctypes ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tests for the command line interface """ import os import unittest import unittest.mock import click.testing import botman.cli import botman.bot # pylint: disable=too-few-public-methods class CliRunnerMixin(object): """ Test case mixin for adding CLI runner...
# coding=utf-8 # Copyright 2020 The TF-Agents 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # mib: Modular irc bot # Copyright Antti Laine <antti.a.laine@tut.fi> # # 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 ...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) Philipp Joos 2017 # (c) Baptiste Agasse 2019 # (c) Mark Hlawatschek 2020 # # 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...
from builder.btools import RegisterCustomTest from builder.btools import AddConfigKey from builder.bconfig import getAutoconfPrefix from builder.bconfig import filterOut from builder.bconfig import Version def CheckAxtor(ctx, write_config_h=False, add_to_compiler_env=False, min_version=None, max_version...
from flask import Flask, request, abort from configparser import ConfigParser import sys import os from subprocess import Popen, PIPE, STDOUT import urllib import json import logging config_paths = ["./config.ini", "/etc/hooks.conf"] config = ConfigParser() for p in config_paths: try: config.readfp(open(p...
from datetime import timedelta import json from os import listdir from os.path import isfile, join import pr0gramm import logging __author__ = "Peter Wolf" __mail__ = "pwolf2310@gmail.com" __date__ = "2016-12-26" LOG = logging.getLogger(__name__) class DataSources: IMAGE, THUMBNAIL, FULL_SIZE = range(3) class...