text
stringlengths
1
927k
#!/usr/bin/env python3 # Copyright (c) 2004-present Facebook All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. from pyinventory.api.equipment_type import add_equipment_type from pyinventory.api.service import add_service from pyinventory.api.serv...
from io import BytesIO from PIL import Image from django.conf import settings from django.db import models from pilkit.processors import ProcessorPipeline from pilkit.utils import save_image from sortedm2m.fields import SortedManyToManyField from .forms import PhotoFieldWidget __all__ = ('PhotoField', 'ManyPhotosFie...
import datetime import math import os from collections import namedtuple from urllib.parse import urlparse from django.conf import settings from django.contrib.sitemaps import Sitemap as DjangoSitemap from django.db.models import Count, Max, Q from django.template import loader from django.utils.functional import cach...
import os from flask import ( Flask, flash, render_template, redirect, request, session, url_for) from flask_pymongo import PyMongo from bson.objectid import ObjectId from werkzeug.security import generate_password_hash, check_password_hash if os.path.exists("env.py"): import env app = Flask(__name__) app.c...
# Time: O(m * n * sqrt(m * n)) # Space: O(m * n) # the problem is the same as google codejam 2008 round 3 problem C # https://github.com/kamyu104/GoogleCodeJam-2008/blob/master/Round%203/no_cheating.py import collections from functools import partial # Time: O(E * sqrt(V)) # Space: O(V) # Source code from http:/...
import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '@s8$swhj9du^aglt5+@ut^)wepr+un1m7r*+ixcq(-5i^st=y^' SELENIUM_HEADLESS = True if os.environ.get('SELENIUM_HEADLESS', False) else False DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'django.contrib.auth', 'dj...
import gym from gym import spaces from gym.envs.registration import EnvSpec import numpy as np from mpe.multi_discrete import MultiDiscrete import copy # environment for all agents in the multiagent world # currently code assumes that no agents will be created/destroyed at runtime! class MultiAgentEnv(gym.Env): me...
from tevreden.apiclient import APIClient
# -*- coding: utf-8 -*- """ Created on Wed May 08 16:11:28 2013 @author: kshmirko """ import re from ios.readMeteoBlock import readMeteoFile, readMeteoCtx import StringIO from datetime import datetime, timedelta class ParserException(Exception): def __init__(self, text): super(ParserException, self).__in...
#! /usr/bin/env python3 import argparse import logging from xlsx2csv import Xlsx2csv from io import StringIO import csv import os import subprocess import utils.ht_source def parse_header_row(hr): mapping = {} for i, col in enumerate(hr): mapping[col.lower()] = i return mapping def handle_r...
from prompt_toolkit.output.vt100 import _get_closest_ansi_color def test_get_closest_ansi_color(): # White assert _get_closest_ansi_color(255, 255, 255) == "ansiwhite" assert _get_closest_ansi_color(250, 250, 250) == "ansiwhite" # Black assert _get_closest_ansi_color(0, 0, 0) == "ansiblack" a...
# Copyright (c) 2015 CensoredUsername # This module provides tools for safely analyizing pickle files programmatically import sys PY3 = sys.version_info >= (3, 0) PY2 = not PY3 import types import pickle import struct if PY3: from io import BytesIO as StringIO else: from cStringIO import StringIO __all__ ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-08-01 03:13 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('livebot', '0011_auto_20170731_2011'), ] operations = [ migrations.AlterModelOptions...
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
## # This is the auto-grader for the project. ## import sys, shutil, os, dfaParser ## # Given the teamname and the input (DFA) file name, converts user input # file into haskell file and execute the file. The output is piped # to out.dat. ## def compileRun(teamname, dfa): os.system("python dfaParser.py " + dfa) ...
import pandas as pd from bokeh.charts import Line, Scatter, show, output_file, defaults from bokeh.layouts import gridplot from bokeh.models import HoverTool from bokeh.sampledata.degrees import data defaults.width = 500 defaults.height = 300 TOOLS='box_zoom,box_select,hover,crosshair,reset' TOOLTIPS = [ ("y", "$~y...
''' @author: FangSun ''' import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_state as test_state import functools _config_ = { 'timeout' : 1000, 'noparallel' : True } test_stub = test_lib.lib_get_test_stub() test_obj_dict = test_state.TestStateDict() ''' def test() This ...
# -*- coding: utf-8 -*- """ An Eve Online Cargo Scanner """ import time import json from flask import ( g, flash, request, render_template, url_for, redirect, session, send_from_directory, abort) from sqlalchemy import desc import evepaste from helpers import login_required from estimate import get_market...
""" Blekko (Images) @website https://blekko.com @provide-api yes (inofficial) @using-api yes @results JSON @stable yes @parse url, title, img_src """ from json import loads from searx.url_utils import urlencode # engine dependent config categories = ['images'] paging = True safesearch = ...
# ----------------------------------------------------------------------------- # Name: ObserverData.py # Purpose: Observer Database routines # # Author: Will Smith <will.smith@noaa.gov> # # Created: Jan - July, 2016 # License: MIT # --------------------------------------------------------------...
#!/usr/bin/env python3 # Copyright (c) 2017-2019 The bitphantom Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Tests NODE_NETWORK_LIMITED. Tests that a node configured with -prune=550 signals NODE_NETWORK_LIMIT...
import datetime import unittest import pandas from evidently.analyzers.utils import process_columns from evidently.pipeline.column_mapping import ColumnMapping class TestUtils(unittest.TestCase): def test_process_columns(self): dataset = pandas.DataFrame.from_dict([ dict(datetime=datetime.da...
"""Test the Yeelight binary sensor.""" from unittest.mock import patch from homeassistant.components.yeelight import DOMAIN from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_component from homeassistant.setup import async_setup_component from . import MODULE, NAME, PROPERTIES, YAML...
# util.py # ------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. # # Attri...
""" Copyright (c) 2019 Intel Corporation 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,...
from typing import Union, Dict, Optional, List import torch from torch import Tensor, nn import torch.nn.functional as F from torch_geometric.typing import NodeType, EdgeType, Metadata, Adj from torch_geometric.nn.dense import Linear from torch_geometric.utils import softmax from torch_geometric.nn.conv import Messag...
'''Crie um programa que tenha uma tupla única com nomes de produtos e seus respectivos preços na sequência. No final, mostre uma listagem de preços, organizando os dados de forma tabular.''' produtos = ('Lápis', 0.50, 'Suco', 5.00, 'Playstation', 1500.00, 'TV-led', 1200.00, 'Xbox ONE', 1400.00, 'Forza Horizon 4', 200.0...
import base64 import cProfile import cStringIO import collections import gzip import hmac import inspect import itertools import logging import math import os import socket import struct import time from urlparse import urljoin from django.conf import settings from django.db.models import Model, FloatField from django...
from __future__ import absolute_import __version__ = '0.1.4' VERSION = __version__ from . import time_frequency from . import backend from . import backend_keras from . import augmentation from . import filterbank from . import utils
#!/usr/bin/python3 import json from flask import Flask, jsonify, request, abort from subprocess import call #import cert_issuer.config #from cert_issuer.blockchain_handlers import bitcoin #import cert_issuer.issue_certificates app = Flask(__name__) config = None # def get_config(): # global config # if config ...
from unittest import TestCase from dataclass_bakery.generators import defaults from dataclass_bakery.generators.random_int_generator import RandomIntGenerator class TestRandomIntGenerator(TestCase): def setUp(self): self.random_int_generator = RandomIntGenerator() def test_generate_int_ok(self): ...
#!/usr/bin/python # # Copyright 2019 Polyaxon, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
# 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 # d...
# # The skeleton code used for performance testing # import re, sys from orio.main.util.globals import * #----------------------------------------------------- SEQ_TIMER = ''' #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <sys/time.h> #ifdef BGP_COUNTER #define SPRN_TBRL 0x10C /...
############################################################################### ## ## Copyright (C) 2014 Tavendo GmbH ## ## 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:/...
# Copyright 2016 Canonical Limited. # # This file is part of charm-helpers. # # charm-helpers is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # charm-helpers is distributed in the hope that ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright 2020, Yutong Xie, UIUC. Using recursion to validate BST ''' # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.rig...
import io import unittest from contextlib import redirect_stdout from unittest.mock import patch class TestQ(unittest.TestCase): @patch('builtins.input', side_effect=[ '1', '5', '3 2 3 1 2', ]) def test_case_0(self, input_mock=None): text_trap = io.StringIO() with r...
from warnings import warn import numpy as np from mizani.palettes import rescale_pal from ..doctools import document from ..exceptions import PlotnineWarning from ..utils import alias from .scale import scale_discrete, scale_continuous @document class scale_stroke_continuous(scale_continuous): """ Continuou...
# -*- coding: utf-8 -*- """ (c) 2015 @author: Janto Oellrich email: joellrich@uos.de CONTENT Function for contrast driver sampling """ from modules import * def sampleContrast(trips,n_ref=1000): """ Given the featmatrix samples n_ref contrast trips. """ print 'Sampling contras...
# | Created by Ar4ikov # | Время: 04.02.2019 - 20:19 from core.core import RounefordBot bot = RounefordBot(access_token="Ваш-Access-Token") bot.run()
import os import pandas as pd from string import Template import wget csv_file_path = "https://docs.google.com/spreadsheets/d/1AlflVlTg1KmajQrWBOUBT2XeoAUqfjB9SCQfDIPvSXo/export?format=csv&gid=565678921" project_card_path = "assets/templates/project_card.html" projects_page_path = "assets/templates/template_projects.m...
from allocation.allocator import Server, App, Allocator s1 = Server(32, 16, 1000, name="s1") s2 = Server(32, 16, 1000, name="s2") def test_allocate_tasks_servers_single_server_task(): _a = App(12, 12, 500) alloc = Allocator([s1], [_a]) res = alloc.allocate() expected = [ { "node"...
from typing_extensions import SupportsIndex from django.shortcuts import render # Create your views here. from django.http import HttpResponse from .forms import InputForm import pandas as pd import numpy as np import pickle from pymongo import MongoClient client = MongoClient('localhost', 27017) db = client['Patient...
import logging FORMATTER = logging.Formatter('%(asctime)-15s %(name)-12s: %(levelname)-8s %(message)s') def get_logger(logger_name): logger = logging.getLogger(logger_name) handler = logging.StreamHandler() handler.setFormatter(FORMATTER) logger.addHandler(handler) logger.setLevel(logging.DEBUG) ...
""" It is a Pydantic model for Users """ from typing import Optional from pydantic import BaseModel, EmailStr class UsersBase(BaseModel): """ A schema class used to represent Users table column values """ Username: Optional[str] = None Fullname: Optional[str] = None Email: Optional[EmailStr] =...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: v1.12.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import r...
# Generated by Django 2.1 on 2018-08-19 08:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mainapp', '0055_rescuecamp_facilities_available'), ] operations = [ migrations.AlterField( model_name='rescuecamp', na...
# init.py from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager # init SQLAlchemy so we can use it later in our models db = SQLAlchemy() def create_app(): app = Flask(__name__) app.config['SECRET_KEY'] = '9OLWxND4o83j4K4iuopO' app.config['SQLALCHEMY_DATABA...
import numpy as np import networkx as nx from math import gamma from scipy.optimize import root_scalar from mesa import Model from mesa.time import RandomActivation, SimultaneousActivation from mesa.datacollection import DataCollector from scseirx.testing_strategy import Testing ## data collection functions ## def g...
_base_ = ["../../../_base_/gdrn_base.py"] OUTPUT_DIR = "output/gdrn/lmoPbrSO/resnest50d_online_AugCosyAAEGray_mlBCE_DoubleMask_lmo_pbr_100e/driller" INPUT = dict( DZI_PAD_SCALE=1.5, TRUNCATE_FG=False, CHANGE_BG_PROB=0.5, COLOR_AUG_PROB=0.8, COLOR_AUG_TYPE="code", COLOR_AUG_CODE=( "Seque...
import FWCore.ParameterSet.Config as cms sinPhi = cms.vdouble( -0.0353352962792, -0.122533930843, -0.208795013406, -0.293458528818, -0.375876685504, -0.455418871948, -0.531476481737, -0.603467570232, -0.670841307236, -0.733082191603, -0.789713995522, -0.840303408309, -0.884463351833, -0.921855942186, -0.952195074957...
''' A rendering of the 2014 monthly calendar. This example demonstrates the usage of plotting several plots together using ``gridplot``. A hover tooltip displays the US holidays on the significant dates. .. bokeh-example-metadata:: :sampledata: us_holidays :apis: bokeh.layouts.gridplot, bokeh.models.tools.Ho...
class MaskedTextProvider(object, ICloneable): """ Represents a mask-parsing service that can be used by any number of controls that support masking,such as the System.Windows.Forms.MaskedTextBox control. MaskedTextProvider(mask: str) MaskedTextProvider(mask: str,restrictToAscii: bool) MaskedTextProvider(m...
# !/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################### # This code is an adaptation from Toni Heittola's code [task1 baseline dcase 2018](https://github.com/DCASE-REPO/dcase2018_baseline/tree/master/task1/) # Copyright Nicolas Turpault, Romain Serizel, H...
# -*- 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 #...
"""Forms of the account_keeping app.""" from django import forms from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from . import models class InvoiceForm(forms.ModelForm): class Meta: model = models.Invoice fields = '__all__' try: ...
#!/usr/bin/env python3 # =============================================================================== # NAME: XmlPortsParser.py # # DESCRIPTION: This class parses the XML port types files. # # USAGE: # # AUTHOR: reder # EMAIL: reder@jpl.nasa.gov # DATE CREATED : Feb. 4, 2013 # # Copyright 2007, California Institu...
from __future__ import absolute_import import os import shutil import subprocess import logging import pytest import dockerdb.mongo CONTAINER_CACHE = {} LOG = logging.getLogger(__name__) def insert_data(client, data): for db in data: for collection in data[db]: entries = data[db][collectio...
import pandas as pd import pytest from async_blp.instruments_requests import InstrumentRequestBase @pytest.mark.asyncio class TestInstrumentRequestBase: def test__weight(self): request = InstrumentRequestBase('query', max_results=5) request.response_fields = ['field_1', 'field_2'] asser...
import pytest from unittest import mock from mitmproxy.test import tflow from mitmproxy import io from mitmproxy import exceptions from mitmproxy.addons import clientplayback from mitmproxy.test import taddons def tdump(path, flows): w = io.FlowWriter(open(path, "wb")) for i in flows: w.add(i) cla...
import numpy as np import os import shutil import glob as glob def get_slurm_script(script_name,command,outdir,idir,mail,log,part,nodes,threads,time,job_name): if os.path.isdir(outdir+'/run') == False: os.mkdir(outdir+'/run') file_name = outdir + '/run/' + script_name f = open(file_name,'w') ...
from valclient import Client def join_party(username,password,region,party_id): client = Client(region=region,auth={'username':username,'password':password}) client.activate() return client.party_join(party_id) def request_party(username,password,region,party_id): client = Client(region=region,aut...
config = { "interfaces": { "google.ads.googleads.v5.services.CampaignExperimentService": { "retry_codes": { "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" ], "non_idempotent": [] }, "retry_params": { "default": { "initial_retry_de...
from .stage_data import StageData print('please input the following information:)') password = (input('Database password: ')) host = (input('Host: ')) upload_data = StageData(password, host) data = upload_data.save_to_database() print(f"Data extracted, processed and staged!")
"""Multiple Correspondence Analysis (MCA)""" import numpy as np from sklearn import utils from . import ca from . import one_hot class MCA(ca.CA): def fit(self, X, y=None): if self.check_input: utils.check_array(X, dtype=[str, np.number]) n_initial_columns = X.shape[1]...
#!/usr/bin/env python3 # Copyright (c) 2014-2017 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the dir...
""" Tests for collections' matchers. """ import collections from taipan.testing import skipIf from callee._compat import OrderedDict as _OrderedDict import callee.collections as __unit__ from tests import MatcherTestCase class Iterable(MatcherTestCase): test_none = lambda self: self.assert_no_match(None) te...
from django.template.defaulttags import register @register.filter def get_item(dictionary, key): return dictionary.get(key) @register.filter def get_item_dict(dictionary, key): return {'data': dictionary.get(key)}
# -*- coding: utf-8 -*- # @Time: 2020/2/5,005 22:02 # @Last Update: 2020/2/5,005 22:02 # @Author: 徐缘 # @FileName: 2.practices_on_nlp.py # @Software: PyCharm from __future__ import absolute_import, division, print_function, unicode_literals # 导入一些熟悉的陌生人 # 绝对引入,精确除法,print,unicode类型字符串。都是为了适配python2,不加也罢 import nu...
# coding: utf-8 """ axxell-api No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "License"); ...
""" Base class for interpolation methods that calculate values for each dimension independently. Based on Tables in NPSS, and was added to bridge the gap between some of the slower scipy implementations. """ import numpy as np from openmdao.components.interp_util.interp_akima import InterpAkima, Interp1DAkima from op...
import h5py import numpy as np import torch.utils.data as data class ShapeDataset(data.Dataset): def __init__(self, h5_file, mode, n_points=2048, augment=False): assert (mode == 'train' or mode == 'val'), 'Mode must be "train" or "val".' self.mode = mode self.n_points = n_points se...
from enum import Enum class URLS(Enum): login = "/api/auth/login" challenge_list = "/api/challenges/challenge/all" past_challenge_list = "/api/challenges/challenge/past" future_challenge_list = "/api/challenges/challenge/future" challenge_details = "/api/challenges/challenge/{}" challenge_phas...
# Generated by Django 2.0.2 on 2020-10-19 10:32 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('insta', '0006_image_edit...
# -*- coding: utf-8 -*- # # kaggle_titanic documentation build configuration file, created by # sphinx-quickstart. # # 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. # # All configuration values...
# Copyright 2015, 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: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
import redis from keys import key_list as default_key_list class Relationship(object): def __init__(self, redis_connection=None, key_list=None, actor=None): if key_list: self.key_list = default_key_list.copy() self.key_list.update(key_list) else: self.key_lis...
# @Author: dileep # @Last Modified by: dileep from collections import OrderedDict import os from typing import Tuple, Iterable, Sequence, Dict, Union import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder, OneHotEncoder from sklearn.model_selection import train_test_split from . import...
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000. print(sum( i for i in range(1000) if i % 3 == 0 or i % 5 == 0 ))
import importlib from typing import List class ModuleInterface: @staticmethod def register() -> None: """Init the command""" def import_module(name: str) -> ModuleInterface: return importlib.import_module(name) # type: ignore def load_commands(commands: List[str]) -> None: for command_nam...
from setuptools import setup, find_packages from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='SimString-cuda', version='0.1.0', url='https://github.com/fginter/sim...
load( "//scala/private:common.bzl", "write_manifest_file", ) load("//scala/private:rule_impls.bzl", "compile_scala") load("//scala_proto/private:proto_to_scala_src.bzl", "proto_to_scala_src") ScalaPBAspectInfo = provider(fields = [ "proto_info", "src_jars", "output_files", "java_info", ]) S...
from PyObjCTools.TestSupport import * from Quartz.PDFKit import * class TestPDFAnnotationLine (TestCase): def testConstants(self): self.assertEqual(kPDFLineStyleNone, 0) self.assertEqual(kPDFLineStyleSquare, 1) self.assertEqual(kPDFLineStyleCircle, 2) self.assertEqual(kPDFLineStyleD...
# -*- coding: utf-8 -*- # # This file is part of Django graffle released under the BSD license. # See the LICENSE for more information. from setuptools import setup, find_packages version = '0.5' packages = ['django_graffle'] + ['django_graffle.%s' % x for x in find_packages('django_graffle',)] setup( name='djan...
#SPDX-License-Identifier: MIT import pytest import pandas as pd def test_issues_new(metrics): #repo_id assert metrics.issues_new(1, 1 , period='year').iloc[0]['issues'] > 0 #repo_group_id assert metrics.issues_new(10, period='year').iloc[1]['issues'] > 0 #begin_date & end_date assert metrics...
from collections import namedtuple import os from selfdrive.boardd.boardd import can_list_to_can_capnp from selfdrive.controls.lib.drive_helpers import rate_limit from common.numpy_fast import clip from . import teslacan from .values import AH from common.fingerprints import TESLA as CAR from selfdrive.can.packer impor...
import numpy as _np from .moments import immoment3D as _immoment3D def getSphere(side): """Create a 3D volume of sideXsideXside, where voxels representing a sphere are ones and background is zeros. Keyword arguments: side -- the number of voxels the 3D volume should have on each side. Returns: ...
# # 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...
"""Tests for submission functionality-- primarily if a submission form is validated properly and passed to the backend. """ import pytest import pathlib, json from src.model import Activity, Submission # Load in sample submissions and their expected status codes if they were submitted: with open(pathlib.Path(__file__...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Jul 26 20:42:43 2018 @author: tomer """ #%% # ================================================= # # Mutation per gene # ================================================= import numpy as np import pandas as pd #%% #tumor = sys.argv[1] #tumor = tumor....
# Generated by Django 1.10.5 on 2017-03-16 12:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("zerver", "0061_userprofile_timezone"), ] operations = [ migrations.AlterField( model_name="userprofile", name="timez...
# =========================================================================== # dictionary.py ----------------------------------------------------------- # =========================================================================== # function ---------------------------------------------------------------- # -----...
import gc import numpy as np def dataset_results(dataset, model, binary=False): x = np.array([dataset[i][0][0] for i in range(len(dataset))]) y_true = np.array([dataset[i][1][0] for i in range(len(dataset))]) y_pred = model.predict(x, batch_size=1, verbose=0).flatten() if binary: y_true = y_tr...
import os from typing import Tuple import numpy as np from numpy.random import MT19937, RandomState, SeedSequence import torch from gym import utils from gym.envs.mujoco import mujoco_env class Reacher3DEnv(mujoco_env.MujocoEnv, utils.EzPickle): def __init__(self, task_id=None, hide_goal=False): self.vie...
# 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 ...
# asyncio_queue.py import asyncio async def consumer(n, _queue): """:type _queue asyncio.Queue""" # print('consumer {}: waiting for item'.format(n)) while True: print('consumer {}: waiting for item'.format(n)) item = await _queue.get() print('consumer {}: has item {}'.format(n, it...
# -*- coding: utf-8 -*- # # Copyright (C) 2019 Chris Caron <lead2gold@gmail.com> # All rights reserved. # # This code is licensed under the MIT License. # # 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 th...
# [Built-in modules] import os import re import sys import shutil import time, datetime import math as myMath import glob # [3rd party modules] import cv2 import numpy as np import xml.etree.ElementTree as ET import sympy as sp from sympy.utilities.lambdify import lambdify, implemented_function from...
# 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 ...