text
stringlengths
3.07k
12.6k
import re from textblob import TextBlob # Function to fetch details of bank account def account(val): if re.search('balance', val) or re.search(r'remain[ing]*', val) or re.search(r'available', val) or re.search(r'money.*bank', val) or re.search(r'bank.*money', val): # Credit or debit transactions ...
""" Code written by : @Vansh-Coder on Github Note : This code is licensed under the MIT License. Happy Coding ! :) """ from tkinter import * from tkinter import messagebox calc = Tk() calc.title('Calculator') e = Entry(calc, width=58, borderwidth=3) e.grid(row=0, column=0, columnspan=4, padx=10, pady=10)...
# -*- coding: utf-8 -*- """ Copyright (c) 2018-2019, <NAME> Copyright (c) 2015-2018, <NAME> 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 copyrig...
import numpy as np def binary_precision_recall_fscore(true_aspects,aspect_preds, beta = 1): """ Function to compute the micro-averaged precision, recall and f-score based on the model's predicitions Formulas guided by: - MICRO-PRECISION: Micro-precision on the Peltarion Pla...
import sys from dataset import Dataset import tqdm import time from cnn import Net32, Net256 import torch import torch.nn as nn import numpy as np import logging import argparse import torchvision.models as models from torchvision import datasets from tensorboardX import SummaryWriter device = torch.device('cuda' if t...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2012 Yahoo! 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.or...
''' Adapted from https://github.com/IntelligentQuadruped, with permission Description: Module to connect to camera and retrieve RGB and depth data. Currently supports the Intel RealSense R200 Camera. ''' import numpy as np import logging import time import cv2 import matplotlib.pyplot as plt from skimage.transform imp...
""" Manage s3 uploads and downloads. Not quite finished: tidy up the s3 defs and put into class. """ __author__ = 'donal' __project__ = 'dcleaner' from StringIO import StringIO from collections import Counter from flask.ext.login import current_user, login_required from flask import render_template, request, flash, red...
''' This script contains a class for representing the date. Additionally, the class Scraper get the HTML code of a Wikipedia page and extracts the name of celebrities that were born in a certain date ''' import re import requests from bs4 import BeautifulSoup from datetime import datetime class Date: ''' This...
#!/usr/bin/env python import os import re import json import shutil def iter_files(root_dir): outputfile = [] for root,dirs,files in os.walk(root_dir): for file in files: file_name = os.path.join(root,file) outfile_extension = ".data" path,tmpfilename = os.path.split...
''' MIT License Copyright (c) 2019 DEIS Project 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, copy, modify, merge, publish, ...
import os, sys project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) import numpy as np import torch import torchvision import torchvision.transforms as transforms import math import numpy as np def bitreversal_permutation(n): """Return the bit reversal permutation used in FFT. Parameter...
from typing import Optional, Union, List, Dict from django.db.models import QuerySet from django.shortcuts import get_object_or_404 from django.http import Http404 from .models import ( GroupChat, GroupChatRequest, GroupChatRole ) from user_app.models import User from group_chat_app.sql.commands import get_ordere...
import requests from bs4 import BeautifulSoup from python.Constants import * from python.model.CameraSettings import CameraSettings from python.model.ControllerSettings import ControllerSettings from python.model.DeadzoneSettings import DeadzoneSettings from python.model.Player import Player def parse(): # Pars...
import os from django.test import TestCase, override_settings import moto import boto import mock import omaha from boto.s3.key import Key from crash.factories import CrashFactoryWithFiles, SymbolsFactory from feedback.factories import FeedbackFactory from omaha.factories import VersionFactory from sparkle.factories ...
import numpy as np; import utils.utils as ut; import matlab.engine; from tqdm import tqdm; import config as cf; #Indexes for HM36M data to reorder to MPII order hm36m_to_mpii = [6, 5, 4, 1, 2, 3, 0, 8, 9, 10, 16, 15, 14, 11, 12, 13]; def get_ml_eng(): """ Returns a started matlab engine. The eng...
import torch as to from copy import deepcopy from math import ceil, sqrt from torch import nn as nn from torch.nn import functional as F from torch.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _single from typing import Callable, Sequence import pyrado from pyrado.utils.data_types import is_iterab...
""" Location utilities. | Copyright 2017-2021, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ import numpy as np import matplotlib import matplotlib.pyplot as plt import eta.core.utils as etau import fiftyone.core.fields as fof import fiftyone.core.labels as fol import fiftyone.core.utils as fou from ....
from __future__ import (absolute_import, print_function, unicode_literals) from future.utils import raise_from import sys import random import requests import string import time import ssl import socket import varint import json from jodel_api.protos import checkin_pb2 from jodel_api.protos import mcs_pb2 import selec...
import time import threading import json import hashlib from .heap import Heap from .utils import BypassThreadSafe from abc import abstractmethod, ABCMeta from typing import Union class BoundedLRUCache: __metaclass__ = ABCMeta @abstractmethod def clear_all(self): """ Remove all element in...
#! /usr/bin/env python # pylint: skip-file # This file comes copied from a library. There are only a few # modified lines. Will leave style errors in place. # Software License Agreement (BSD License) # # Copyright (c) 2012, <NAME>, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, wit...
#!/usr/bin/env python # coding=utf-8 from __future__ import division, print_function, unicode_literals import re from collections import namedtuple from copy import deepcopy from brainstorm.structure.buffer_views import BufferView from brainstorm.utils import NetworkValidationError, is_valid_layer_name def get_rege...
import torch import wandb from torch.utils.data import DataLoader from src.utils import save_models, saving_path_rn, get_answer, names_models from src.utils import BabiDataset, batchify, get_answer_separately from collections import defaultdict def train(train_stories, validation_stories, epochs, lstm, rn, criterion...
#! /usr/bin/env python import time import numpy import ephem def sunradec(utime): """Return the [RA,Dec] (in radians) of the Moon for a given unix time""" sun = ephem.Sun() utime = time.localtime(utime) # get the time tuple sun.compute((utime[0],utime[1],utime[2],utime[3],utime[4],utime[5]...
import logging import os import subprocess as sp import warnings from subprocess import CalledProcessError import sys import shutil import fileinput from Bio import BiopythonWarning, BiopythonExperimentalWarning, BiopythonParserWarning warnings.simplefilter('ignore', BiopythonWarning) warnings.simplefilter('ignore', ...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from...
"""Module to process the raw read quality files for data collation.""" import sys import re import os def clean_data(dic): """Put dictionary entries in proper format for downstream processing. Inputs -- dic - dictionary from reading in raw read quality data Returns -- tuple - sample name, cleaned dic...
#!/usr/bin/python # Copyright (c) 2018 Catalyst Cloud Ltd. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': [...
# -------------------------------------- IMPORTAR MODULOS Y CONFIGURACION ---------------------------------------------------------- import aiohttp import discord from discord.ext import commands from discord import Embed from tools.dataIO import fileIO from tools.emotes import * import pprint config_locat...
import pickle import sys from abc import ABC, abstractmethod from enum import Enum, auto import numpy as np class Topic(Enum): UNDEFINED = auto() IMU = auto() ATTITUDE = auto() ATTITUDE_AND_GPS = auto() # https://docs.python-guide.org/scenarios/serialization/ class DeserializeError(ValueError): ...
import torch.nn as nn import torch import torch.nn.functional as F import numpy as np from .bilinear_matrix_attention import BilinearMatrixAttention class StructuredAttention(nn.Module): def __init__(self, sent_hiddent_size, bidirectional, py_version, identity_init=False): super(StructuredAttention, self...
import torch torch.manual_seed(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import torch.nn as nn import numpy as np np.random.seed(0) import random random.seed(0) import torch.nn.functional as F import numpy as np from pytorch_transformers import GPT2LMHeadModel, GPT2Tokenizer f...
# 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...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2021 Huawei Device 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 # ...
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- coding: utf-8 -*- """ Batch learner for temporal difference Q learning Should converge to standard temporal difference Q learning for batchsize=1 """ import numpy as np def get_softmax_policy(intensity_of_choice): """Returns a softmax policy with itensity of choice""" beta = intensity_of_choice ...
# -*- coding: utf-8 -*- """Find and replace emojis within text strings. The set of emojis is refreshable from its canonical source at http://www.unicode.org/emoji/charts/full-emoji-list.html. """ from __future__ import print_function, unicode_literals __all__ = ( "findall", "findall_list" "last_download...
""" Library Features: Name: lib_utils_plot Author(s): <NAME> (<EMAIL>) Date: '20220208' Version: '1.0.0' """ ####################################################################################### # Libraries import logging import cartopy import rasterio import numpy as np from lib_utils_...
# -*- coding: utf-8 -*- # USAGE: # PYTHONPATH=".." python test_tokenize.py from eng_to_ipa import tokenize import copy, os, unittest SYMBOLS_FILE = "cmu.symbols.txt" SYMBOLS_FILE_LEGACY = "cmu.symbols.legacy.txt" # Legacy ipa1 = [['ˈtiʧər']] tok1 = [["ˈt i ʧ ə r"]] ipa2 = [['ˈɑrdˌvɑrk']] tok2 = [["ˈɑ r d ˌv ɑ r k...
from datetime import datetime from flask_sqlalchemy import SQLAlchemy from flask_login import UserMixin from icalendar import Calendar, Event, vDatetime import uuid from app.utils import gen_barebones_ical db = SQLAlchemy() # All allowed keys for an icalendar VEVENT date_keys = ( 'dtend', 'dtstamp', 'dts...
"""Cursor-based pagination queries, mostly supporting condenser_api.""" from hive.db.methods import query_one, query_col, query_row, query_all def _get_post_id(author, permlink): """Get post_id from hive db.""" sql = "SELECT id FROM hive_posts WHERE author = :a AND permlink = :p" return query_one(sql, a=a...
import glob import pandas as pd import numpy as np from PIL import Image import matplotlib.pyplot as plt import matplotlib.patches as patches from torchvision.transforms import functional as F from bbaug import policies from random import shuffle aug_policy = policies.policies_custom() policy_container = po...
# -*- coding:utf8 -*- # File : neural_style.py # Author : <NAME> # Email : <EMAIL> # Date : 2/27/17 # # This file is part of TensorArtist. import argparse import os import neural_style_opr import numpy as np from tartist import image from tartist.core import io from tartist.core import load_env, get_env, get_...
import discord from discord.ext import commands import aiohttp import urllib import bs4 import random import datetime import time import pytz class Query(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command() async def tblr(self, ctx, *tags): """Searches Tumblr for a...
""" This test only tests that Python code can be compiled using the pyjaco. It doesn't test if the resulting javascript makes any sense. """ def is_on_the_left(c, a, b, pts_list): ax, ay = pts_list[a] bx, by = pts_list[b] cx, cy = pts_list[c] ux = float(bx - ax) uy = float(by - ay) vx = float(cx - a...
# coding: utf-8 from django.db import models from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from django.template.defaultfilters import slugify from tinymce import models as tinymce_models from esperancanordeste.core.models import STATE_CHOICES OPERATOR_CHOICES =...
""" File: boggle.py Name: <NAME> ---------------------------------------- This program demonstrates the Boggle game. It recursively finds all words that are on the Boggle word board input by user. """ # This is the file name of the dictionary txt file # we will be checking if a word exists by searching through it FIL...
""" """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from load_settings import settings from profiler import Profiler import math import numpy as np import logging import sys import scipy.ndimage as ndi from scipy.ndimage import gaussian_filter im...
"""Script to parse OWL annotations and generate a list of supported Hydra classes.""" import json import sys from hydrus.hydraspec.crud_template import template from hydrus.metadata.subsystem.subsystem_vocab_jsonld import subsystem_data import pprint def fix_keyword(keyword): """Fix keyword occurances in OWL voc...
# -*- coding: utf-8 -*- """ thriftpy2.parser ~~~~~~~~~~~~~~~ Thrift parser using ply """ from __future__ import absolute_import import os import sys import types from .parser import parse, parse_fp, incomplete_type, _cast from .exc import ThriftParserError from ..thrift import TPayloadMeta def load(p...
import json from curling.lib import HttpClientError, HttpServerError import mock from nose.tools import eq_ import amo from amo.tests import app_factory from addons.models import Addon, AddonUser from users.models import UserProfile from mkt.api.base import get_url, list_url from mkt.api.tests.test_oauth import Base...
import torch #print(torch.__version__) import torch_geometric.transforms as T from ogb.nodeproppred import PygNodePropPredDataset #!!!! GraphGym !!!!! from torch_geometric.datasets import TUDataset root = './enzymes' name = 'ENZYMES' pyg_dataset = TUDataset(root, name) #print(pyg_dataset) def get_num_classes(pyg_da...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
"""Plot extrema and zero-crossings.""" import numpy as np import matplotlib.pyplot as plt from neurodsp.plts import plot_time_series from neurodsp.plts.utils import savefig from bycycle.utils.checks import check_param_range from bycycle.utils import limit_signal, get_extrema_df #####################################...
import copy import itertools import weakref from mopidy.models.fields import Field # Registered models for automatic deserialization _models = {} class ImmutableObject: """ Superclass for immutable objects whose fields can only be modified via the constructor. This version of this class has been re...
import unittest from unittest.mock import Mock, patch import numpy as np import numpy.typing as npt from shapely.geometry import Polygon from nuplan.common.actor_state.state_representation import StateSE2 from nuplan.common.geometry.compute import ( AngularInterpolator, compute_distance, compute_lateral_d...
import pickle class DictionaryObject(object): """ Copyright 2012 "Grim Apps" 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 Unle...
# /usr/bin/env python # -*- coding: utf-8 -*- """open_base.py base class for new open objects from open_sync and open_async. Code derived from __init__.py """ import os import sys import json import shutil import platform try: import r2lang except ImportError: r2lang = None try: from .native import RCore ...
from collections import OrderedDict import re from datetime import datetime from flask import url_for from flask_login import current_user from app import db from app.models.activity import Activity from app.models.base_model import BaseEntity from app.models.page import PageRevision, Page from app.models.user import...
import signal import asyncio import functools from typing import List, Callable, Dict, Tuple try: import orjson as json except ImportError: import json DEBUG = False # Code from: https://stackoverflow.com/a/37430948/8153205 def shutdown(stop_condition: asyncio.Event()): stop_condition.set() def catch_s...
''' xbmcswift2.cli.app ---------------- This package contains the code which runs plugins from the command line. :copyright: (c) 2012 by <NAME> :license: GPLv3, see LICENSE for more details. ''' import os import sys import logging from xml.etree import ElementTree as ET from xbmcswift2 import Plu...
# Copyright 2019 <NAME> # See LICENSE for details import pytest from FIT.profile import Profile, ProfileVersion, ProfileContentError, ProfileContentWarning, DEFAULT_PROFILE_CORRECTOR, ProfileCorrector from test.test_common import all_sdk_files def test_duplicates(): assert not Profile.duplicates(()) assert...
from __future__ import print_function from __future__ import absolute_import from __future__ import division ## ## Copyright 2016 SRI International ## See COPYING file distributed along with the package for the copyright and license terms ## from builtins import str from builtins import object from past.utils import...
# objects and functions to assist abasic analyis import numpy as np import glob import pyemma as py from hde import HDE, analysis import mdtraj as md # dictionary linking sequence and site with a near Tm simulation temp abasic_configs = { 'TTTTTTTTTTT':{'control':336, 'b2':335, 'b4':326, 'b6':320}, 'TATAGCGAT...
#!/usr/bin/env python import numpy as np from scipy.stats.distributions import poisson from iminuit import Minuit def gaussian(x, mean, sigma, A): return A / np.sqrt(2*np.pi) / sigma * np.exp(-.5 * (x-mean)**2 / sigma**2) def fit_gaussian(x, y, errordef=10): """ Fit a gaussian to data using iminuit migr...
import pydash import os import requests, json from models import DefiProtocolInfo import pandas from utils.upload_csv_to_gsc import upload_csv_to_gsc from utils.import_gsc_to_bigquery import import_gsc_to_bigquery from config import project_config from utils.slug_transform_util import tranform_slug_from_out defi_llama...
from __future__ import unicode_literals import json import math import os from io import open from django.core.cache import cache from django.http import Http404 from django.http import HttpResponse from django.http.response import FileResponse from rest_framework import serializers from .models import ContentSessio...
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use ...
from django.conf import settings from datetime import date from rest_framework.serializers import ( ModelSerializer, HyperlinkedIdentityField, SerializerMethodField, ValidationError, ) from rest_framework import serializers from django.contrib.auth import get_user_model from ...discount.models impo...
#!/usr/bin/env python # -*- coding: utf-8 -*- import roslib; import rospy import actionlib from actionlib_msgs.msg import * from geometry_msgs.msg import Pose, PoseWithCovarianceStamped, Point, Quaternion, Twist from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal from random import sample from ma...
from typing import Union from pgdrive.world.pg_world import PGWorld import numpy as np from panda3d.bullet import BulletRigidBodyNode, BulletBoxShape from panda3d.core import BitMask32, TransformState, Point3, NodePath, Vec3 from pgdrive.pg_config.body_name import BodyName from pgdrive.pg_config.collision_group import...
import tokenize import inspect from io import StringIO from enum import Enum from typing import Optional, Callable, Union, List, Tuple, Dict, Any from types import FunctionType class AnnotationType(Enum): CALLABLE = 1 CRITICAL = 2 DEBUG = 3 ERROR = 4 FATAL = 5 INFO = 6 WARNING = 7 NONE...
import os import sys import unittest from src.data_reader import VillagerDataReader, AcListerVillagerDataReader from src.data_model import Species from src.data_model import Personality from src.utils import get_data_dir_path class DebuggableTestCase(unittest.TestCase): def __add_error_replacement(self, _, err): ...
''' Module containg the StateUpdateMethod for integration using the ODE solver provided in the GNU Scientific Library (GSL) ''' import sys from .base import (StateUpdateMethod, UnsupportedEquationsException, extract_method_options) from ..core.preferences import prefs from ..devices.device import auto_target, all_dev...
#!/usr/bin/env python3 import socket import sqlite3 import threading import time import traceback from datetime import datetime from constants import * lock = threading.Lock() data_from_db = {} # : dict[int, tuple[bool, bytes]] data_to_db = {} # : dict[int, tuple[bool, bytes]] next_chunk_ids = {} # : dict[int, in...
from tinn.layer import Layer import tinn.activations as activations import numpy as np import pickle class NeuralNet: """ Core class of the neural network """ def __init__(self): self.layers=[] def add(self,layer): """ Add a layer to the model Paramet...
""" Tasks for bookmarks. """ import logging from celery import shared_task from django.db import transaction from edx_django_utils.monitoring import set_code_owner_attribute from opaque_keys.edx.keys import CourseKey from xmodule.modulestore.django import modulestore from . import PathItem log = logging.getLogger...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Copyright 2019-2020 Airinnova AB and the FramAT authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
from abc import ABCMeta, abstractmethod from datetime import datetime, timedelta import requests as req import random import pytz import sys class ScoresAbstract: __metaclass__ = ABCMeta @abstractmethod def get_display_string(self): pass @abstractmethod def validate_response(self, respo...
import logging import asyncio import subprocess import time import sys # ------------------------------------------------------------------------------------------------- async def _output_to_logger(reader, logger, prefix=""): while True: l = await reader.readline() if not l: return ...
##################################################################### # utils.py # # Dev. <NAME> # Description: Util source code of SqueezeNet ##################################################################### import os, time, datetime import torch import torch.nn as nn import torch.optim as optim from tqdm import...
#!/usr/bin/env python # -*- coding: utf-8 -*- #****************************************************************************** # # filter.py # --------------------------------------------------------- # # Copyright (C) 2015 <NAME> (<EMAIL>) # # This source is free software; you can redistribute it and/or modify it unde...
#!c:\python34\python.exe #!/usr/bin/env python #If Running in Windows use top line and edit according to your python #location and version. If running on Linux delete the top line. ###demo code provided by <NAME> at www.steves-internet-guide.com ##email <EMAIL> ###Free to use for any purpose """ This will log messages ...
from pathlib import Path from typing import Tuple import click import pytest from neuro_cli.click_types import ( JOB_NAME, LocalRemotePortParamType, PlatformURIType, _merge_autocompletion_args, ) from neuro_cli.root import Root @pytest.mark.parametrize( "arg,val", [("1:1", (1, 1)), ("1:10", ...
# GUI Application automation and testing library # Copyright (C) 2006 <NAME> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License # as published by the Free Software Foundation; either version 2.1 # of the License, or (at your optio...
""" TODO: - all, backfill, ddl, check, ... - views are elements, goals are like backfill and day and ddl - goals take elements and make ops, ops get rewritten and shit - ‘rules’? - ‘subsystems’? muh - CreateTableAs = rule, 'create table foo as select * from …' = .. rule 'call'? 'instantiation'?, wo.View = ele...
import os import sys from . import grammar class Buffer(object): """Encapsulation of the data buffer """ def __init__(self, file, is_unicode): self.is_unicode = is_unicode self.file = file self.reset() def reset(self): self.buf = str() if self.is_unicode else bytes() ...
# Copyright 2021 BlackRock, 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 to in writing, so...
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License """Tests for programs.py""" import os import sys from flaky import flaky import pytest from spyder.utils.programs import (run_python_script_in_terminal, is_python_inte...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ This implementation is based on https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/mixup.py, published under an Apache License 2.0. COMMENT FROM ORIGINAL: Mixup and Cutmix Papers: mixup: Beyond Empirical Risk Minimization...
from typing import Set, List, Dict, Callable from pandas import DataFrame from pylars.dsl import ExprDSL, C from pylars.expr.agg_expr import Count from pylars.expr.desc import Desc from pylars.utils import varname, flatlist class Step: schema: Set[str] inputs: Set[str] def __init__(self, schema: Set[str]...
import numpy as np import cv2 from collections import defaultdict from numbers import Number from threading import Thread, Lock from queue import Queue class ImageFeature(object): def __init__(self, image, params): # TODO: pyramid representation self.image = image self.height, self.wi...
# -*- coding: utf-8 -*- # Copyright (C) 2013 Yahoo! 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...
# Copyright 2021 The Distla Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
from decimal import Decimal import numpy # nprtt but have some experience about others def strategy(history, memory): # num_rounds == 0 if memory == None: memory = {} memory["sin"] = 0 memory["battle_state"] = "first_peace" memory["strategy"] = None memory["counter"] = ...
# -*- coding: utf-8 -*- from flask import request from .exception import BadParam class QInvalidParamException(BadParam): pass O_PARAM_OPTIONAL = True O_PARAM_REQUIRED = False _REQUEST_TYPES = ( 'GET', 'POST' ) _PARAM_TYPES_MAPPING = { 'boolean': True, 'int': 1, 'float': 1.1, 'str': ''...
# Licensed under a MIT licence - see file `license` import numpy as np from scipy import ndimage, stats from astropy.nddata.utils import extract_array __all__ = ['fit_diffraction_spike', 'center_from_spikes', 'guess_center_nested'] def guess_center_nested(image, halfwidth=50): '''Guess the ...
# Copyright 2019, OpenCensus 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 applicable law or agreed to in w...
import discord from discord.ext import tasks import sqlite3 from datetime import datetime from decouple import config import csv import random TOKEN = config("DISCORD_TOKEN") PREFIX = config("PREFIX") def open_connection(): try: new_connection = sqlite3.connect("bot.db") except Exception as e: ...
#!/usr/bin/env python from __future__ import absolute_import, division, print_function import os import re import subprocess import sys import tempfile ### class DeltaAlgorithm(object): def __init__(self): self.cache = set() def test(self, changes): abstract ### def getTestResult(s...