text
stringlengths
2
999k
from django.db import models from django.contrib.auth.models import User # Create your models here. class GoalStatus(models.Model): status_name = models.CharField(max_length=200) def __str__(self): return self.status_name class ScrumyGoals(models.Model): #goal_name, goal_id, created_by, moved_...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2008, 2019 Zope Foundation 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...
import os, sys import torch import argparse import shutil import pandas as pd from tqdm import tqdm from transformers import TapasTokenizer from data_processing.create_tapas_tables import create_tables from collections import defaultdict from util.util_funcs import load_jsonl, get_tables_from_docs, store_jsonl DIR_P...
# -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-02-22 13:19 from __future__ import unicode_literals import djangocms_attributes_field.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cmsplugin_articles', '0005_auto_20180222_1207'), ...
import os from contextlib import contextmanager from urllib.parse import urlencode from .api_asserts import ( assert_error_code_is, assert_has_keys, assert_not_has_keys, assert_status_code_is, assert_status_code_is_ok, ) from .api_util import ( ADMIN_TEST_USER, get_admin_api_key, get_us...
import tensorflow as tf import numpy as np import cnn.cnn as cnn from models.classifier import Classifier from data import dataset from util import metric import argparse parser = argparse.ArgumentParser(description='Placement quality prediction training.') parser.add_argument('--design', help="Select design. Default ...
'''Train CIFAR10 with PyTorch.''' from __future__ import print_function import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision import torchvision.transforms as transforms import os import argparse os.environ['CUDA_VISIBLE...
from django.shortcuts import render from rest_framework.views import APIView from illegal_fund_raising_forecast import settings from .serializer import TestDatasetSerializer, TrainDatasetSerializer from rest_framework.response import Response from .models import TrainDataset from utils import Res import json import ra...
"""Tests for AVM Fritz!Box sensor component.""" from datetime import timedelta from unittest.mock import Mock from requests.exceptions import HTTPError from homeassistant.components.fritzbox.const import ( ATTR_STATE_DEVICE_LOCKED, ATTR_STATE_LOCKED, DOMAIN as FB_DOMAIN, ) from homeassistant.components.se...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F from fairseq.iterative_refinement_generator import DecoderOut from fairseq....
import tensorflow as tf import numpy as np import math def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial) def bias_variable(shape): initial = tf.constant(0.1, shape=shape) return tf.Variable(initial) def conv2d(xl, W): return tf.nn.conv2d(xl...
# Generated by Django 2.2 on 2021-05-16 22:12 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('profiles_api', '0001_initial'), ] operations = [ migrations.CreateModel( ...
""" IO for NURBS and Bezier extraction data. """ from __future__ import absolute_import import numpy as nm import six from six.moves import range from sfepy.base.ioutils import HDF5ContextManager, enc, dec def write_iga_data(filename, group, knots, degrees, control_points, weights, cs, conn, bezier_...
# # 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...
"""Module containing methodology for populating a Gp Summary Upload template""" import json from pathlib import Path from builder.pystache_message_builder import PystacheMessageBuilder from scr_definitions import ROOT_DIR from typing import Dict, Optional, Callable import xml.etree.ElementTree as ET from utilities impo...
# coding: utf-8 """ Copyright 2017 Square, 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 la...
"""Unit conversion and physical constants. Internal units: Energy: kcal/mol Length: angstrom (A) Atomic units: Energy: hartree (Eh) Length: bohr (a0) """ # Unit ratios KCAL_TO_JOULE = 4.184e+03 ANGSTROM_TO_METER = 1e-10 # 2008 CODATA CODATA08_AVOGADRO_CONSTANT = 6.0221417930e+23 CODATA08_HARTREE_TO_JO...
import recipe_classes import recipe_db from pymongo import MongoClient client = MongoClient() client.drop_database('k_base') try: execfile('recipe_db.py') except: poo = 1 r = recipe_classes.Recipe('http://allrecipes.com/Recipe/Baked-Lemon-Chicken-with-Mushroom-Sauce/', 'mushroom chicken', 'vegetarian') execfile('par...
# 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 ...
# coding=utf-8 """ This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import ...
#!/usr/bin/python # -*- coding: utf-8 -*- ############################################################################## # Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # # # Licensed under the Amazon Software Li...
# -*- coding: utf-8 -*- # Copyright 2016-2021 CERN # # 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 a...
# Contributed by Paraj Shah # https://github.com/parajshah #!/bin/python3 import math import os import random import re import sys # # Complete the 'gradingStudents' function below. # # The function is expected to return an INTEGER_ARRAY. # The function accepts INTEGER_ARRAY grades as parameter. # def gradingStude...
import json from unittest import mock import pytest from httplib2 import Response import demistomock as demisto PROXY_MOCK = { "proxy": "0.0.0.0" } SUCCESS_ASSET_NAME = 'www.google.com' FAILURE_ASSET_NAME = 'www.xyz.com' PARAMS = { 'malicious_categories': 'APT-Activity', 'suspicious_categories': 'Obser...
__author__ = 'simon' from abstract_update_method import AbstractUpdateMethod class SimpleUpdate(AbstractUpdateMethod): """ Simplest update method where the gradients are applied to the weights using a constant learning rate. """ def __init__(self, learning_rate): """ @param learni...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from PyQt5.QtCore import QUrl from PyQt5.QtWidgets import QApplication from PyQt5.QtWebEngineWidgets import QWebEngineView app = QApplication([]) view = QWebEngineView() view.show() url = 'https://www.google.com/search?q=hello world' view.loa...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `xpath` package.""" # firstparty from xpath import cli from xpath import xpath # thirdparty from click.testing import CliRunner import pytest @pytest.fixture def response(): """Sample pytest fixture. See more at: http://doc.pytest.org/en/latest/...
# # Author: Travis Oliphant, 2002 # from __future__ import division, print_function, absolute_import import warnings import numpy as np import math from scipy._lib.six import xrange from numpy import (pi, asarray, floor, isscalar, iscomplex, real, imag, sqrt, where, mgrid, sin, place, issubdtype,...
#!/usr/bin/env python # -*- coding: utf-8 -*- ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ## ## ## ---- ---- ---- BOT TELEGRAM TABLATURES & PAROLES ---- ---- ---- ## ## ## ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
#!/usr/bin/python3 import argparse import copy import datetime import json import os import traceback from curwmysqladapter import MySQLAdapter, Station from continous.LibContinousTimeseries import extractSigleTimeseries from continous.LibContinousTimeseries import getTimeseries from continous.LibContinousValidation...
import os import shutil import time from httprunner import HttpRunner, api, loader, parser from locust import HttpLocust from tests.api_server import HTTPBIN_SERVER from tests.base import ApiServerUnittest class TestHttpRunner(ApiServerUnittest): def setUp(self): self.testcase_cli_path = "tests/data/dem...
class FilterListQueryParams(object): def __init__(self, offset=None, limit=None, name=None): # type: (int, int, string_types) -> None super(FilterListQueryParams, self).__init__() self.offset = offset self.limit = limit self.name = name @property def openapi_types(s...
import sys from os.path import abspath, dirname # Add our module to system path sys.path.insert(0, dirname(dirname(abspath(__file__))))
"""ResNetV1bs, implemented in Gluon.""" # pylint: disable=arguments-differ,unused-argument,missing-docstring,dangerous-default-value from __future__ import division from mxnet.context import cpu from mxnet.gluon.block import HybridBlock from mxnet.gluon import nn from mxnet.gluon.nn import BatchNorm __all__ = ['ResNe...
# qubit number=4 # total number=43 import pyquil from pyquil.api import local_forest_runtime, QVMConnection from pyquil import Program, get_qc from pyquil.gates import * import numpy as np conn = QVMConnection() def make_circuit()-> Program: prog = Program() # circuit begin prog += H(3) # number=40 prog...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: ---------------------------------------------...
# pylint: disable=too-many-lines # 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) AutoRe...
#!/usr/bin/python # # Copyright (c) 2011 The Jgcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import ...
from ripr_x64 import * from ripr_x86 import * from ripr_arm import * import struct class test1(x64_test): def hook_puts(self): print ("In Puts") arg = self.mu.reg_read(UC_X86_REG_RDI) mem = self.mu.mem_read(arg, 0x200) print ("%s" % (mem.split("\x00")[0])) class test2(x86_test): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup setup( name="discord", version="0.2", description="Discord is a tool for determining dependency version " "conflicts in complex Python projects.", ...
from hdfs import InsecureClient from io import StringIO import json import numpy as np from operator import add import os import pandas as pd from pyspark import SparkConf, SparkContext, StorageLevel import sys def list_dir(file_path, hdfs_client=None, use_hdfs=False): """Lists all the files inside the directory ...
# Copyright (c) 2016-present, Facebook, 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 or agreed...
from data_importers.management.commands import BaseDemocracyCountsCsvImporter class Command(BaseDemocracyCountsCsvImporter): council_id = "SNO" addresses_name = "2021-03-04T15:54:30.296900/South Norfolk Democracy Club - Polling Districts - Election ID 7 County Council.csv" stations_name = "2021-03-04T15:5...
from sqlalchemy import Boolean, Column, Integer, String from sqlalchemy.types import Date from database import Base class Sale(Base): __tablename__ = "Sales" id = Column(Integer, primary_key=True, index=True) date = Column(Date) city = Column(String(100), index=True) manager = Column(S...
import os import sys sys.setrecursionlimit(200) import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import tensorflow as tf import numpy as np import tensorflow.contrib.distributions as distributions from svhn_class import svhn, SVHN_Class, SVHN from lifelong_vae import VAE from vanilla_vae import ...
#!/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 require...
#!/usr/bin/env python # coding: utf-8 # In[1]: from fbprophet import Prophet import pandas as pd from pandas import DataFrame from matplotlib import pyplot #univariate # In[2]: turkey = pd.read_excel("datasetler\ecomretailfixed.xls",header=0) # In[3]: turkey.columns = ['ds', 'y'] turkey turkey['ds']= pd.to_d...
#!/usr/bin/env python #-- read the warnings file and count frequency of lvals, etc. import sys import re #-- usage def print_usage () : print 'usage: %prog warn.txt\n' sys.exit (127) def sortFreqs (fs) : return sorted(fs.items(), lambda x, y: cmp(x[1], y[1])) def printLvalFreq (filename) : freqs =...
"""Time Series Data package. The version is managed by bump2version. """ from pathlib import Path __version__ = "0.3.4" __root__ = Path(__file__).parent
class Option: def __init__(self, **args): self.start = args.get('start') if args.get('start') else 0 self.year_low = args.get('year_low') self.year_high = args.get('year_high') self.every = args.get('every')
#!/usr/bin/env python3 # # MIT License # # Copyright (c) 2020 EntySec # # 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,...
from pymjengine.engine.data_encoder import DataEncoder from pymjengine.engine.mj_constants import MJConstants class MessageBuilder: GAME_START_MESSAGE = "game_start_message" ROUND_START_MESSAGE = "round_start_message" ASK_MESSAGE = "ask_message" GAME_UPDATE_MESSAGE = "game_update_message" ROUND_RE...
import logging import os import sys from logging import Logger, StreamHandler, handlers from pathlib import Path TRACE_LEVEL = logging.TRACE = 5 logging.addLevelName(TRACE_LEVEL, "TRACE") def monkeypatch_trace(self: logging.Logger, msg: str, *args, **kwargs) -> None: """ Log 'msg % args' with severity 'TRACE...
# Copyright 2016 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
# -*- coding: utf-8 -*- from text2num import text2num import codecs, json, sys, io, os, copy # add all records to valid and test CWD = os.getcwd() DATA = sys.argv[1] INPUT_PATH = os.path.join("rotowire_temp", DATA) print(INPUT_PATH) os.chdir(INPUT_PATH) # if DATA == 'train': # ORACLE_IE_OUTPUT = 'roto-original-%s...
import os import requests # noqa We are just importing this to prove the dependency installed correctly import time def main(): API_KEY = os.environ["INPUT_BITLYTOKEN"] LONG_URL = os.environ["INPUT_LONGURL"] headers = { "Content-Type": "application/json", "Authorization": "Bearer " + API...
# # PySNMP MIB module RFC1317-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1317-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:57:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
#!/bin/env python from multiprocessing.connection import Client import sys import configparser if len(sys.argv) < 2: print('Please pass the server name of the bot to change as argument') sys.exit(1) server = sys.argv[1] config = configparser.ConfigParser() config.read('config.ini') address = ('localhost', ...
import random """ The goal of this code is to get the probability of success when you roll your dices with the World of Darkness roleplaying system. Brief reminder of the WoD system : - Roll as many D10 (dices with 10 faces) as your character score in attribute + skill (example : you want to give a sword...
### # Copyright (c) 2020, Leonel Faria # 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,...
import pytest from fibsem_tools.io.zarr import zarr_n5_coordinate_inference from xarray import DataArray import numpy as np def pixelResolutionAttr(scales, units, **kwargs): return {"pixelResolution": {"dimensions": scales[::-1], "unit": units[0]}} def resolutionAttr(scales, **kwargs): return {"resolution":...
import turtle height = 5 width = 5 turtle.speed(2) turtle.penup() for y in range(height): for x in range(width): turtle.dot() turtle.forward(20) turtle.backward(20 * width) turtle.right(90) turtle.forward(20) turtle.left(90) turtle.exitonclick()
""" Module: 'uasyncio.core' on esp8266 v1.10 """ # MCU: (sysname='esp8266', nodename='esp8266', release='2.2.0-dev(9422289)', version='v1.10-8-g8b7039d7d on 2019-01-26', machine='ESP module with ESP8266') # Stubber: 1.2.0 class CancelledError: '' DEBUG = 0 class EventLoop: '' def call_at_(): pass ...
# Copyright (c) 2012 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementation of the functionality ...
# -*- coding: utf-8 -*- # # Blank Project 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 ...
from django.urls import path, include from . import views urlpatterns = [ path("", views.get_dashboard_mygigs, name="dashboard"), path("orders/", views.get_dashboard_orders, name="dashboard-orders"), path("profile-edit/", views.get_dashboard_profile_edit, name="dashboard-profile-edit"), path("accept_or...
#!/usr/bin/env python3 # Copyright (c) 2018-2019 The Refnet Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the scantxoutset rpc call.""" from test_framework.test_framework import RefnetTestFramework from te...
# -*- coding: utf-8 -*- from setuptools import setup, find_packages setup( name='svgcsvimg', version='1.0', description='Command line utility that generates a set of PNG images from an SVG template and data provided in a CSV file.', author='Tim Freund', author_email='tim@freunds.net', license ...
import types import tempfile import shutil import json import pathlib import pytest import mock from tests.data_store.bigquery.test_base import MockBigQuery from rudra.data_store.local_data_store import LocalDataStore class MockS3(LocalDataStore): def __init__(self, *args, **kwargs): super().__init__(...
#!/usr/bin/env python """Setup script for ``rio-ds-mask``.""" import itertools as it import os from setuptools import setup with open('README.rst') as f: readme = f.read().strip() def parse_dunder_line(string): """Take a line like: "__version__ = '0.0.8'" and turn it into a tuple: ...
import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.colors import Normalize import matplotlib.patheffects as path_effects import seaborn as sns from crabnet.kingcrab import CrabNet from crabnet.model import Model from crabnet.utils.get_...
# -*- coding: utf-8 -*- # # mlops-deploy 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 h...
# $Id: __init__.py 6381 2010-07-26 19:26:14Z dkuhlman $ # Author: Dave Kuhlman <dkuhlman@rexx.com> # Copyright: This module has been placed in the public domain. """ Open Document Format (ODF) Writer. """ VERSION = '1.0a' __docformat__ = 'reStructuredText' import sys import os import os.path import tempfile impor...
""" Company Name : Uber Problem Statement : Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. For example, if our input was [1, 2, 3, 4, 5], the expected o...
# Jack O'Connor # Pygame Chess Project # ChessServer.py import argparse import os import pickle import socket import threading import numpy as np from ChessBoard import ChessBoard def parseArgs(): parser = argparse.ArgumentParser(description="Starts a chess server") parser.add_argument('--host', default='1...
import cv2 from os import listdir import json import sys import numpy as np from concurrent.futures import ProcessPoolExecutor # This script splits the videos in the raw_data folder into frames. Since it is a multi-hour long process, it saves the names of the videos it has already split into a json file called done_v...
"""Implement some nonlinearies """ import numpy import scipy.interpolate class DelayLine(object): """Delay a signal """ def __init__(self, delay=None): """Constructor Arguments: delay: time to delay the signal by, defaults to no delay (s) Returns: class in...
class RMSD(): _explorer = None _initialized = False _selection = None _syntaxis = None _atom_indices = None def __init__(self, explorer): self._explorer=explorer def set_parameters(self, selection='atom_type!="H"', syntaxis='MolSysMT'): from molsysmt import select ...
# 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 ...
# Time: O(n) # Space: O(1) import collections class Solution(object): def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ idx, cnt = 0, 1 for i in xrange(1, len(nums)): if nums[idx] == nums[i]: cn...
# Auto generated by generator.py. Delete this line if you make modification. from scrapy.spiders import Rule from scrapy.linkextractors import LinkExtractor XPATH = { 'name' : "//div[@class='summary']/h2", 'price' : "//div[@class='product-price']/span[@class='js_widget_product_price']", 'category' : "//div...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2019 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
# -*- coding: utf-8 -*- """ example ~~~~~~~ Demo simple SMTP mail. :copyright: (c) 2014 by Shipeng Feng. :license: BSD, see LICENSE for more details. """ from sender import Mail, Message, Attachment SMTP_HOST = 'smtp.example.com' SMTP_USER = 'user@example.com' SMTP_PASS = 'password' SMTP_ADDRESS...
import torch ###### BIAS GELU FUSION/ NO AUTOGRAD ################ # 1/sqrt(2*pi)-> 0.3989423 # 1/sqrt(2) -> 0.70710678 # sqrt(2/pi) -> 0.79788456 # this function is tanh approximation of gelu # actual gelu is: # x * 0.5 * (1.0 + torch.erf(x * 0.70710678)) @torch.jit.script def bias_gelu(bias, y): x = bias + ...
# code jam: Round 1A 2018: Problem A. Waffle Choppers def cut(B, R, C): newB = [] if R == 0: for Bi in B: ltSet = set() geSet = set() for chocolate in Bi: if chocolate[1] < C: ltSet.add(chocolate) else: ...
from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.models import Group, Permission as DjangoPermission from django.contrib.contenttypes.models import ContentType from django.core.exceptions import MultipleObjectsReturned from django.db.models import Q from django.te...
""" Tests for `tableplanner.genetic.mutations` """ import tableplanner.genetic.mutations as mutations def test_swap_mutations_change_exactly_two_elements(): """Swap mutation should change exactly two elements, other should remain the same""" chromosome = [3, 4, 8, 2, 7, 1, 6, 5] assert sorted(mutations.s...
#!/usr/bin/env python # (c) Stefan Countryman 2017 DESC="""Plot a list of timing diagnostic channels, which will be read from stdin as a newline-delimited channel list, for a time window around a given GPS time. This script can also generate a summary webpage for easy viewing of plot results. Use this script when ther...
import pytest from chapter1 import zerofy as t def test_zerofy(): expected = [[1, 0, 1], [0, 0, 0], [1, 0, 1]] actual = t.zerofy([[1, 1, 1], [1, 0, 1], [1, 1, 1]]) for y in range(len(expected)): for x in range(len(expected[0])): assert expected[y][x] == actual[y][x] expected = [[0, 0, 0], [0, 1, 1],...
""" To compile the grammar and gather the requirements data from input requirements.txt Source code for following functions are used from https://www.python.org/dev/peps/pep-0508/#complete-grammar: format_full_version(info) get_compiled_list_using_grammar(package_list) """ import os import platform import re...
from distutils.core import setup try: with open("README.md","r") as fh: long_description = fh.read() except: long_description = 'OOP Learning Example by Korakot Engineer' setup( name = 'Townschool', # How you named your package folder (MyLib) packages = ['Townschool'], # Chose the same...
from __future__ import print_function from functools import partial import rdflib as R from rdflib.term import URIRef import logging import six import hashlib import PyOpenWorm # noqa from . import BASE_SCHEMA_URL, DEF_CTX from .contextualize import (Contextualizable, ContextualizableClass...
class Solution: def solve(self, rooms, target): for room in rooms: if room >= target: return room return -1
# Exercício Python 066: Crie um programa que leia números inteiros pelo teclado. O programa só vai parar # quando o usuário digitar o valor 999, que é a condição de parada. No final, mostre quantos números foram # digitados e qual foi a soma entre elas (desconsiderando o flag). count = sum = number = 0 while True: ...
import math import numpy as np from common.numpy_fast import clip, interp import selfdrive.messaging as messaging # lookup tables VS speed to determine min and max accels in cruise _A_CRUISE_MIN_V = [-1.0, -.8, -.67, -.5, -.30] _A_CRUISE_MIN_BP = [ 0., 5., 10., 20., 40.] # need fast accel at very low speed for s...
# # Copyright EAVISE # from enum import Enum from .. import box as b from ..annotations import annotation as anno __all__ = ['Detection', 'ParserType', 'Parser'] class Detection(b.Box): """ This is a generic detection class that provides some base functionality all detections need. It builds upon :class:...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. class Vegetable(models.Model): name = models.CharField(max_length=50) price = models.DecimalField(max_digits=5, decimal_places=2) class Meta: verbose_name = "légume" or...
""" Support for AlarmDecoder zone states- represented as binary sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.alarmdecoder/ """ import logging from homeassistant.components.binary_sensor import BinarySensorDevice from homeassista...
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved. # Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved. # # This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA. # # SIPPY is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License a...
#!/usr/bin/env python """Logistic factor analysis on MNIST. Using Monte Carlo EM, with HMC for the E-step and MAP for the M-step. We fit to just one data point in MNIST. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import edward as ed import os import...