code
stringlengths
1
199k
import time class ValFix(object): def getMap(self, s_graph, p_graph, _map, matrix, weights): self.__time = time.perf_counter() self.__cost, self.new_map = 0, dict() twins = {x: set(m.loc[lambda m_row: abs(m_row - c) < .0000001].index.tolist()) for x, m, c in ((x, matrix[x], ...
from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import render, get_object_or_404 from django.utils.translation import ugettext as _ from django.views.decorators.cache import never_cache from helfertool.utils import nopermission from registration.decor...
""":class:`SSHKey` and friends.""" from __future__ import ( absolute_import, print_function, unicode_literals, ) str = None __metaclass__ = type __all__ = [ 'SSHKey', ] import binascii from cgi import escape from django.contrib.auth.models import User from django.core.exceptions import Validatio...
{ "name": "MT940 Bank Statements Import", "version": "14.0.1.0.0", "license": "AGPL-3", "author": "Odoo Community Association (OCA), Therp BV", "website": "https://github.com/OCA/l10n-romania", "category": "Banking addons", "depends": ["account_bank_statement_import"], "installable": Tru...
from .choices import ADMINS_PERMISSIONS, MEMBERS_PERMISSIONS, ANON_PERMISSIONS from django.apps import apps def _get_user_project_membership(user, project, cache="user"): """ cache param determines how memberships are calculated trying to reuse the existing data in cache """ if user.is_anonymous(): ...
"""Database models for `lino_welfare.modlib.immersion`. """ from __future__ import unicode_literals import logging logger = logging.getLogger(__name__) from django.db import models from django.utils.translation import ugettext_lazy as _ from lino.api import dd from lino import mixins from lino_xl.lib.cv.mixins import S...
__name__ = 'Remove useless "N/A: " for column phone, mobile, fax '\ 'of RES_PARTNER' def migrate(cr, version): if not version: return cr.execute( "UPDATE res_partner " "SET phone = substring(phone, 6) " "WHERE phone like 'N/A: %';" "UPDATE res_partner " ...
import argparse import os import pandas from nab.util import recur, checkInputs depth = 2 root = recur(os.path.dirname, os.path.realpath(__file__), depth) def sortData(input_filename, output_filename): df = pandas.read_csv(input_filename) df.sort(columns='timestamp', inplace=True) return df.to_csv(output_filename...
""" Module exports :class:`AkkarEtAl2013`. """ from openquake.hazardlib.gsim.akkar_2014 import AkkarEtAlRjb2014 class AkkarEtAl2013(AkkarEtAlRjb2014): """ To ensure backwards compatibility with existing seismic hazard models, the call AkkarEtAl2013 is retained as legacy. The AkkarEtAl2013 GMPE is now im...
import io import csv from taiga.base.utils import db, text from taiga.projects.issues.apps import ( connect_issues_signals, disconnect_issues_signals) from . import models def get_issues_from_bulk(bulk_data, **additional_fields): """Convert `bulk_data` into a list of issues. :param bulk_data: List of is...
class config_eval_signum(config_base): mutable = 3 def eval_signum(param): if len(param) == 0: return '' try: v = float(param[0]) except ValueError: return '' if v < 0.0: return '-1' if v > 0.0: return '1' return '0'
from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(490, 414) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self....
from taiga.celery import app from . import services @app.task() def send_bulk_email(): services.send_bulk_email()
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('exams', '0009_fill_is_last'), ] operations = [ migrations.AddField( model_name='question', name=...
from datetime import datetime import time import os import random from apscheduler.schedulers.background import BackgroundScheduler from InstagramAPI import InstagramAPI from termcolor import colored, cprint banner = """ ## ### ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ...
from osv import fields, osv from datetime import datetime, timedelta from operator import itemgetter class account_invoice(osv.osv): _name = "account.invoice" _inherit = "account.invoice" def _get_next_payment(self, cr, uid, ids, field_names, arg, context=None): vals={} for invoice in self.b...
from django.core.paginator import Paginator, InvalidPage, EmptyPage from django_zoook.config import PAGINATION_DEFAULT_TOTAL, PAGINATOR_DEFAULT_MODE def set_paginator_options(request, default = 'position'): """Paginator options :return None""" if 'paginator' in request.session: request.session['pagi...
from odoo import api, models, fields from odoo.addons.event.models.event_mail import _INTERVALS from odoo.addons.queue_job.job import job class EventMail(models.Model): _inherit = 'event.mail' ########################################################################## # FIELDS...
""" Utility methods for Enterprise """ import json from crum import get_current_request from django.conf import settings from django.urls import NoReverseMatch, reverse from django.utils.translation import ugettext as _ from edx_django_utils.cache import TieredCache, get_cache_key from enterprise.models import Enterpri...
from utility.logger import getLogger logger = getLogger(__name__) import utility.tools utility.tools.show_settings() class webqtlCaseData(object): """one case data in one trait""" def __init__(self, name, value=None, variance=None, num_cases=None, name2=None): self.name = name self.name2 = name2...
from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('cart', '0003_order_transportation'), ] operations = [ migrations.RenameField( model_name='order', old_name='credit', new_name...
from openerp.osv import orm, fields class sale_advance_payment_inv(orm.TransientModel): _inherit = "sale.advance.payment.inv" def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor ...
""" Test cases to cover Accounts-related behaviors of the User API application """ from collections import OrderedDict from copy import deepcopy import datetime import ddt import hashlib import json from mock import patch from pytz import UTC import unittest from django.conf import settings from django.core.urlresolver...
import sys import os from .base import * DEBUG = False import dj_database_url db_from_env = dj_database_url.config() DATABASES['default'].update(db_from_env) SECRET_KEY = os.environ.get('SECRET_KEY') DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID') ...
SQLALCHEMY_DATABASE_TEST_URI = 'postgresql://postgres:@localhost/pybossa' GOOGLE_CLIENT_ID = '' GOOGLE_CLIENT_SECRET = '' TWITTER_CONSUMER_KEY='' TWITTER_CONSUMER_SECRET='' FACEBOOK_APP_ID='' FACEBOOK_APP_SECRET='' TERMSOFUSE = 'http://okfn.org/terms-of-use/' DATAUSE = 'http://opendatacommons.org/licenses/by/' ITSDANGE...
__version__ = r"1.0" class RandomNumberGenerator( object ): """ Interface for a random number generator. """ def __init__( self, **kwargs ): """ Creates a new random number generator. """ self._initialize( **kwargs ) def _initialize( self, **kwargs ): """ ...
import csv import json import unittest from amcat.scripts.article_upload.plugins.csv_import import CSV, DEFAULTS from amcat.scripts.article_upload.tests.test_upload import create_test_upload from amcat.scripts.article_upload.upload import UploadForm from amcat.tools import amcattest from settings import ES_MAPPING_TYPE...
"""Setup the SkyLines application""" from faker import Faker from skylines.model import User def test_admin(): u = User() u.first_name = u'Example' u.last_name = u'Manager' u.email_address = u'manager@somedomain.com' u.password = u.original_password = u'managepass' u.admin = True return u de...
"""Implements basics of Capa, including class CapaModule.""" import cgi import copy import datetime import hashlib import json import logging import os import re import struct import sys import traceback from django.conf import settings try: import dogstats_wrapper as dog_stats_api except ImportError: dog_stats...
import ea_import_template import ea_import_template_line import ea_import_template_line_calc_field import ea_import_template_line_boolean_field import ea_import_template_line_regexp_field import configs import ea_import_chain import ea_import_log import ea_import_scheduler import ea_import_chain_result import wizard im...
""" Copyright 2016 Andriy Drozdyuk This file is part of zmq-soundtouch. zmq-soundtouch 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 License, or (at your option) any later version....
from spack import * class Audacious(AutotoolsPackage): """A lightweight and versatile audio player.""" homepage = "https://audacious-media-player.org/" url = "https://github.com/audacious-media-player/audacious/archive/audacious-4.0.2.tar.gz" version('4.0.2', sha256='92f30a78353c50f99b536061b9d94b...
import time import logging import telepathy import tp import util.coroutines as coroutines import util.misc as misc_utils import gvoice _moduleLogger = logging.getLogger(__name__) class TextChannel(tp.ChannelTypeText): def __init__(self, connection, manager, props, contactHandle): self.__manager = manager self.__p...
""" parse, update and write .signals and .args files """ from twisted.python import util import sys import os def debug(*args): pass class Object: def __init__(self, name): self._signals = util.OrderedDict() self._args = util.OrderedDict() self.name = name def __repr__(self): ...
from __future__ import absolute_import, print_function, unicode_literals import sys import os import gpg del absolute_import, print_function, unicode_literals user = "joe+gpg@example.org" with gpg.Context(armor=True) as c, gpg.Data() as expkey: print(" - Export %s's public keys - " % user) c.op_export(user, 0, ...
import os, mapnik from nose.tools import raises,eq_ from utilities import execution_path, run_all def setup(): # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path('.')) if mapnik.has_webp(): tmp_dir = '/tmp/mapnik-webp/' if no...
""" while True: num = raw_input('Which number? > ') if num == 'stop': break elif not num.isdigit(): print('Please, enter only numbers!') else: print(int(num)**2) print('Buy!') """ while True: num = raw_input('Which number? > ') if num == 'stop': break try: ...
"""Module implements the seq interface.""" from ._intf import _Intf from .sig import sig from sydpy.types import convgen, bit from sydpy._simulator import simwait from sydpy._util._util import arch from sydpy._process import always import types from sydpy._event import Event from sydpy.intfs._intf import IntfDir, Intf,...
import numpy import matplotlib.pyplot as plt import pyparticleest.models.mlnlg as mlnlg import pyparticleest.paramest.paramest as param_est import pyparticleest.paramest.interfaces as pestinf import pyparticleest.paramest.gradienttest as gradienttest gradient_test = False ptrue = 1.0 x0 = numpy.array([[ptrue, ], [-ptru...
""" This module provides testing code for the classes in the auxi.modelling.business.models module. """ import unittest from datetime import datetime from auxi.modelling.business.models import TimeBasedModel from auxi.modelling.business.basic import BasicActivity from auxi.core.time import TimePeriod from auxi.modellin...
from lib.cuckoo.common.abstracts import Signature class AntiDBGWindows(Signature): name = "antidbg_windows" description = "Checks for the presence of known windows from debuggers and forensic tools" severity = 3 categories = ["anti-debug"] authors = ["nex", "KillerInstinct"] minimum = "1.3" ...
from ViewMode import * from cemu import * import TextSelection from TextDecorators import * import string from PyQt5 import QtGui, QtCore, QtWidgets from PyQt5.uic import loadUi class HexViewMode(ViewMode): def __init__(self, themes, width, height, data, cursor, widget=None): super(HexViewMode, self).__init...
""" PyCog utilities. """
import re from . import ( dict_sub, iter_flatten, ) ENTITIES_DECODE = { 'Aacute': '\u00c1', 'aacute': '\u00e1', 'Acirc': '\u00c2', 'acirc': '\u00e2', 'acute': '\u00b4', 'AElig': '\u00c6', 'aelig': '\u00e6', 'Agrave': '\u00c0', 'agrave': '\u00e0', 'alefsym': '\u2135', ...
from dolfin import FunctionSpace from rbnics.backends.basic import TensorSnapshotsList as BasicTensorSnapshotsList from rbnics.backends.dolfin.tensors_list import TensorsList from rbnics.utils.decorators import BackendFor TensorSnapshotsList_Base = BasicTensorSnapshotsList(TensorsList) @BackendFor("dolfin", inputs=(Fun...
""" Default ADRest form for Django models. """ from django.db.models import Model from django.db.models.fields import AutoField from django.db.models.fields.related import ManyToManyField from django.forms.models import ModelForm class PartitialForm(ModelForm): """ Default ADRest form for models. Allows partiti...
from django.contrib import admin from question.models import TextQuestion, MultipleQuestion, MultipleOption class OptionInline(admin.TabularInline): model = MultipleOption class MultipleAdmin(admin.ModelAdmin): inlines = [OptionInline] admin.site.register(TextQuestion) admin.site.register(MultipleQuestion, Multipl...
month_names = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] month_str = input("Give me a month number: ") month_num = int(month_str) if month_num >= 1 and month_num <= 12: print("The name of the month is:", mo...
import astropy.units as u from sunpy.net import vso import jets_info client = vso.VSOClient() save_location = jets_info.save_location jet_times = jets_info.jet_times jet_positions = jets_info.jet_positions observables = [[vso.attrs.Instrument('hmi'), vso.attrs.Physobs('LOS_magnetic_field')], [vso.attrs.I...
import csv from django.db.models import Count, Q from django.conf import settings from django.utils.text import slugify from walt.models import Assignment, Task, Tag, Document, WorkingDocument def is_number(s): ''' Determine if a string may be interpreted as a number (float value) ''' try: float(s) retu...
import os import tempfile import pytest from passcheck import wordlist def test_load(request): with tempfile.NamedTemporaryFile(delete=False) as f: f.write( b'one\n' b'two\n' b'three\n' ) request.addfinalizer(lambda: os.unlink(f.name)) assert wordlist.load...
"""change_uwb_settings.py - Changes the UWB settings of all devices listed. This assumes all listed devices are on the same UWB settings already, otherwise you should run the set_same_settings.py script, as that one finds all devices on all settings. """ from pypozyx import * from pypozyx.definitions.registers import P...
from ..common.Resource import Resource class LetterWizardDialogResources(Resource): MODULE_NAME = "dbw" RID_LETTERWIZARDDIALOG_START = 3000 RID_LETTERWIZARDGREETING_START = 3080 RID_LETTERWIZARDSALUTATION_START = 3090 RID_LETTERWIZARDROADMAP_START = 3100 RID_LETTERWIZARDLANGUAGE_START = 3110 ...
import struct import sys class cached_property(object): """ A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property. Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76 "...
import numpy from test import V2NUnitTest from numpy2vtk.data.raw import points from numpy2vtk.data import line from numpy2vtk.exceptions import Numpy2VtkFormatException class TestLineData(V2NUnitTest): def test_line_with_2d_input_data(self): numpy_points = numpy.array([ [1.0, 2.0], ...
import argparse import os import sys import unittest import pylnk class SupportFunctionsTests(unittest.TestCase): """Tests the support functions.""" def test_get_version(self): """Tests the get_version function.""" version = pylnk.get_version() self.assertIsNotNone(version) def test_check_file_signatu...
from __future__ import print_function import collections import re import sys from . import token_regexes as res class AsssemblerError(Exception): pass Token = collections.namedtuple('Token', 'type val pos') TOKENS = [ ('WHITESPACE', r'[ \t]+'), ('WORD', res.WORD + res.FOLLOWED_BY_WHITESPACE), ('DIRECTI...
import threading import logging class KeyedExecutor(object): """ A class to wrap keys objects for the executer. Items can be added to the KeyRunner while its running. This is used to keep all tasks for a given key in one thread. """ def __init__(self): self.__log = logging.getLogger("root.threadly") ...
class Node: """ Common Node implementation for a LinkedList. Equality of value and to string are supported. """ def __init__(self, value=None, next=None): self.value = value self.next = next def __str__(self): return str(self.value) def __eq__(self, other): """ ...
"""The jupyter-test-notebook stack fabric file""" from fabric.api import local def git(): """Setup Git""" local("git remote rm origin") local("git remote add origin https://korniichuk@github.com/korniichuk/jupyter-test-notebook.git") local("git remote add bitbucket https://korniichuk@bitbucket.org/korni...
"""A dictionary of diagnosis for procedures available.""" DX_92025 = { 'A18.52': 'Tuberculous keratitis', 'H11.021': 'Central pterygium of right eye', 'H11.022': 'Central pterygium of left eye', 'H11.023': 'Central pterygium of eye, bilateral', 'H11.041': 'Peripheral pterygium, stationary, right eye...
from socket import * from time import time from random import random, gauss from Queue import PriorityQueue LOCAL = ('', 5000) HOST = ('127.0.0.1', 5002) DELAY = 0.5 JITTER = 0.1 LOSS = 0.1 sock = socket(AF_INET, SOCK_DGRAM) sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) sock.bind(LOCAL) queue = PriorityQueue() print "Lo...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='License', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=Fals...
from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('goals', '0002_add_target_source_agency_and_stats_available_fields_to_indicator'), ] operations = [ migrations.RemoveField( model_name='indicator', ...
""" host[1-10].example.com => host1.example.com, host2.example.com,.. app[1,5,10].prod => app1.prod, app5,prod, app10.prod.. """ def inst_enumerate(hosts): start = hosts.find('[') end = hosts.find(']') host_numstring = hosts[start+1:end] # handle range ([1-10]) if '-' in host_numstring: host...
"""This example demonstrates the usage of BlendSearch with Ray Tune. It also checks that it is usable with a separate scheduler. """ import time import ray from ray import tune from ray.tune.suggest import ConcurrencyLimiter from ray.tune.schedulers import AsyncHyperBandScheduler from ray.tune.suggest.flaml import Blen...
"""Tests utils for preprocessing layers.""" import collections import numpy as np import tensorflow.compat.v2 as tf class ArrayLike: def __init__(self, values): self.values = values def __array__(self): return np.array(self.values) class PreprocessingLayerTest(tf.test.TestCase): """Base test class for pre...
from google.cloud import resourcemanager_v3 def sample_test_iam_permissions(): # Create a client client = resourcemanager_v3.ProjectsClient() # Initialize request argument(s) request = resourcemanager_v3.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_valu...
""" Server API Reference for Server API (REST/Json) OpenAPI spec version: 2.0.6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest import kinow_client from kinow_client.rest import ApiException from kinow_clien...
""" Ray decorated classes and functions defined at top of file, importable with fully qualified name as import_path to test DAG building, artifact generation and structured deployment. """ import starlette import json from typing import TypeVar import ray RayHandleLike = TypeVar("RayHandleLike") NESTED_HANDLE_KEY = "ne...
""" This module provides everything to be able to search in mails for a specific attachment and also to download it. It uses the imaplib library that is already integrated in python 2 and 3. """ import email import imaplib import os import re from airflow import AirflowException, LoggingMixin from airflow.hooks.base_ho...
from google.cloud import datacatalog_v1beta1 async def sample_create_entry_group(): # Create a client client = datacatalog_v1beta1.DataCatalogAsyncClient() # Initialize request argument(s) request = datacatalog_v1beta1.CreateEntryGroupRequest( parent="parent_value", entry_group_id="entry...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('utils', '0004_auto_20150910_0915'), ] operations = [ migrations.RemoveField( model_name='channel', name='field9', ), ...
import sys import pprint from castingwords import API4 api_key = sys.argv[1] mediaid = sys.argv[2] pp = pprint.PrettyPrinter(indent=4) api4 = API4(api_key) try: pp.pprint(api4.order_url(url, "TRANS6")) except: pp.pprint(api4.response.text)
from django.core.management.base import BaseCommand, CommandError from web import models class Command(BaseCommand): can_import_settings = True def handle(self, *args, **options): cards = models.Card.objects.filter(parent__isnull=False) for card in cards: card.rarity = card.parent.ra...
"""Parser for XML results returned by NCBI's Entrez Utilities. This parser is used by the read() function in Bio.Entrez, and is not intended be used directly. The question is how to represent an XML file as Python objects. Some XML files returned by NCBI look like lists, others look like dictionaries, and others look l...
"""Tests for docstring utilities.""" from tensorflow_probability.python.internal import docstring_util from tensorflow_probability.python.internal import test_util as tfp_test_util class DocstringUtil(tfp_test_util.TestCase): def _testFunction(self): doc_args = """x: Input to return as output. y: Baz.""" @d...
class CleanDirError(Exception): def __init__(self, value): self.value = value def __str__(self): return self.value
input = """ %Non ground rules, constraints and weak constraints with the aggregate %function max in the body. Guards are non ground, too. a(2). a(3). b(1). c(3,1). c(3,2). c(2,1). c(2,2). p(2). q(1). v(3). t(3). %---- #max{nonGroundAtoms} op var ----(at the end) okay01(M, N) :- p(M),q(N), #max{V:a(M),b(N),c(M,V)} = M....
""" A simple pubsub package because the needs of the many outweigh the needs of the few. """ __version__='0.2.0'
import simplegui result = 1 iteration = 0 max_iterations = 10 def init(start): """Initializes n.""" global n n = start print "Input is", n def get_next(current): """??? Part of mystery computation.""" return 0.5 * (current + n / current) def update(): """??? Part of mystery computation."""...
import time import datetime import unittest from ...models.xfs import Filesystem, Usage, Owner from ...tests import now, now_minus_24hrs class FilesystemTestCase(unittest.TestCase): def setUp(self): self.fs = Filesystem.query.first() def test_now(self): rslt = self.fs.summarise(now) self...
from osgeo import gdal, gdalnumeric, ogr from PIL import Image, ImageDraw import os import numpy as np def clip_raster(rast, features_path, gt=None, nodata=-9999): ''' Copyright: http://karthur.org/2015/clipping-rasters-in-python.html Clips a raster (given as either a gdal.Dataset or as a numpy.array in...
import click import prettytable import six from functest.utils import env class Env(object): # pylint: disable=too-few-public-methods @staticmethod def show(): install_type = env.get('INSTALLER_TYPE') scenario = env.get('DEPLOY_SCENARIO') node = env.get('NODE_NAME') build_tag = ...
def import_distinct_roles(source, target): source_group_names = set([group.name for group in source.getGroups()]) required_target_group_names = [group.name for group in target.getGroups() if group.name in source_group_names] required_for_import_role_names = set([]) for name in required_target_group_name...
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'gentilesse.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^', include('t...
from caldavclientlibrary.client.httpshandler import SmartHTTPConnection from caldavclientlibrary.protocol.caldav.definitions import headers from caldavclientlibrary.protocol.caldav.makecalendar import MakeCalendar from caldavclientlibrary.protocol.carddav.makeaddressbook import MakeAddressBook from caldavclientlibrary....
"""Pylons middleware initialization""" from agent.config.environment import load_environment from agent.lib.cronuspylonapp import CronusPylonApp from beaker.middleware import SessionMiddleware from paste.cascade import Cascade from paste.deploy.converters import asbool from paste.registry import RegistryManager from pa...
""" Various classes and functions to provide some backwards-compatibility with previous versions of Python from 2.3 onward. """ import dircache # Module removed in Python 3 import os import platform import subprocess import sys is_py25 = sys.version_info >= (2, 5) is_py26 = sys.version_info >= (2, 6) is_py27 = sys.ver...
from panda3d.core import LineSegs, TextNode from toontown.toonbase.ToonBaseGlobal import * from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import * from direct.task import Task from math import * from direct.distributed.ClockDelta import * from toontown.golf import GolfGlobals AUT...
""" Time CADRE's execution and derivative calculations.""" from __future__ import print_function import os import pickle import unittest import time import numpy as np from openmdao.core.problem import Problem from CADRE.CADRE_group import CADRE idx = '0' setd = {} fpath = os.path.dirname(os.path.realpath(__file__)) da...
from rest_framework.response import Response from engage.api.serializers import AgendaSerializer from engage.ingest.models import Agenda from drf_yasg.utils import swagger_auto_schema, no_body from rest_framework import status, generics from rest_framework.decorators import api_view from rest_framework.pagination impor...
N = int(raw_input().strip()) num = [int(i) for i in raw_input().strip().split()] if 1 <= N <= 10: print sum(num) else: print "N is out of range" quit()
from __future__ import absolute_import, division, print_function, unicode_literals import functools import logging import re from datetime import datetime from concurrent.futures import as_completed from dateutil.tz import tzutc from dateutil.parser import parse from c7n.actions import ( ActionRegistry, BaseAction,...
try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict import os import sys import tempfile from helpers import unittest import luigi.contrib.hive import mock from luigi import LocalTarget class HiveTest(unittest.TestCase): count = 0 def mock_hive_cmd(self, args...
"""Python setuptools Integration.""" """Copyright and License. Copyright 2012-2014 Gregory Holt 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 re...
import constants, random dt = constants.time_step def prob(p): """ returns True with probability p """ a = random.uniform(0,1) if a<p: return True else: return False class Car(object): """ a car should be created with initial position, velocity, target velocity (the one the driver wa...
from typing import * from math import * nrOfPersons = 100 # nr_of_persons gets type int nrOfPersons *= 0.5 # wrong, float is no specialization of int nrOfPersons = 10.5 # wrong, float is no specialization of int weight = 65.5 # weight gets type float weight *= 0.5 ...
""" Module for interfacing with UHPPOTE RFID control boards. .. moduleauthor:: Andrew Vaughan <hello@andrewvaughan.io> """ from .serial_number import SerialNumber, SerialNumberException from .controller_socket import ControllerSocket, SocketConnectionException, SocketTransmitException __all__ = [ 'SerialNumber', ...
''' Created on Oct 30, 2015 @author: lucas ''' from __future__ import unicode_literals from future import standard_library standard_library.install_aliases() from builtins import str from builtins import range from builtins import object import json import logging import urllib.request, urllib.error from random import ...