filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_16131
import numpy as np import random import math import os.path from keras.models import Sequential, load_model from keras.layers import Conv1D, MaxPooling1D, GlobalAveragePooling1D, Dropout, Dense, Flatten from keras.constraints import max_norm from keras.callbacks import EarlyStopping, ModelCheckpoint from keras.preproce...
the-stack_106_16132
import numpy as np import pytest import astropy import astropy.units as u from astropy.constants import c as speed_of_light from astropy.coordinates import ( ICRS, Angle, CartesianDifferential, CartesianRepresentation, ConvertError, HeliocentricMeanEcliptic, Longitude, SkyCoord, Sph...
the-stack_106_16135
# Copyright (c) AIRBUS 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. from __future__ import annotations from typing import Callable, List from skdecide.domains import Domain, PipeParallelDomain, ShmParallelDomain __all...
the-stack_106_16136
sidade = 0 hidade = 0 conth = 0 contm = 0 nomeh = '' for c in range(1, 5): nome = str(input(f'=-=-=-=-=- DADOS {c}ª PESSOA -=-=-=-=-=' f'Digite o nome da pessoa: ')).lower().strip() idade = int(input('Digite a idade da pessoa: ')) sexo = str(input('Digite o sexo da pessoa: ')).lower()....
the-stack_106_16137
import logging from typing import Any, Dict, List, Optional import hummingbot.connector.exchange.ascend_ex.ascend_ex_constants as constants from hummingbot.connector.exchange.ascend_ex.ascend_ex_order_book_message import AscendExOrderBookMessage from hummingbot.core.data_type.order_book import OrderBook from hummingbo...
the-stack_106_16138
import copy import pprint from typing import Any, Dict, List, Tuple, Optional, Sequence, TYPE_CHECKING import numpy as np from ..constants import TYPE, INTENSITY from .image import Image from ..utils import get_subclasses if TYPE_CHECKING: from ..transforms import Transform, Compose class Subject(dict): ""...
the-stack_106_16140
# 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 ...
the-stack_106_16143
#!/usr/bin/env python3 # Copyright (c) 2017-2020 The Matilda Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test debug logging.""" import os from test_framework.test_framework import MatildaTestFramework from ...
the-stack_106_16144
from collections.abc import Collection, Iterable, Iterator, Sequence from typing import Any, Generic, TypeVar, overload T = TypeVar('T') S = TypeVar('S', bound=Sequence) def _get_slice_value(o: Any, if_none: int) -> int: if o is None: return if_none if isinstance(o, int): return o if (idx...
the-stack_106_16145
""" # Copyright 2022 Red Hat # # 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 agr...
the-stack_106_16149
""" The command line interface. Trains a directory of data. """ from .configuration import Configuration from .inputs import * from hypergan.gan_component import ValidationException from hypergan.gan_component import ValidationException, GANComponent from hypergan.process_manager import ProcessManager from hypergan.tr...
the-stack_106_16150
from flask import (Blueprint, current_app, render_template) from ..errors import ErroInterno, UsoInvalido, TipoErro from . import generic_handler bp = Blueprint('docs', __name__, url_prefix='/apidocs') bp.register_error_handler(ErroInterno, generic_handler) bp.register_error_handler(UsoInvalido, generic_handler) @b...
the-stack_106_16151
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 LE GOFF Vincent # 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 ...
the-stack_106_16153
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn from .roi_box_feature_extractors import make_roi_box_feature_extractor from .roi_box_predictors import make_roi_box_predictor from .inference import make_roi_box_post_processor from .loss import make_roi_box_loss_...
the-stack_106_16154
import sys from cleo.helpers import argument from cleo.helpers import option from poetry.utils.helpers import module_name from .command import Command class NewCommand(Command): name = "new" description = "Creates a new Python project at <path>." arguments = [argument("path", "The path to create the ...
the-stack_106_16156
#!/usr/bin/python # Copyright (c) 2014 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 directory tha...
the-stack_106_16158
from collections import OrderedDict, abc, deque import datetime as dt from datetime import datetime from decimal import Decimal from io import StringIO from itertools import combinations from warnings import catch_warnings import dateutil import numpy as np from numpy.random import randn import pytest from pandas.cor...
the-stack_106_16163
#!/usr/bin/env python from nipype.pipeline import engine as pe from nipype.interfaces import fsl, ants, utility as niu from ...interfaces.fmap import Phases2Fieldmap def init_phase_wf(bet_mag): wf = pe.Workflow(name='phase_prep_wf') inputnode = pe.Node( niu.IdentityInterface( fields=['m...
the-stack_106_16165
from push_relabel import * def isbipartite(g: Graph) -> bool: """A bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint and independent sets U and V such that every edge connects a vertex in U to one in V. Vertex sets U and V are usually called the parts ...
the-stack_106_16166
import csv import os import os.path as op import threading import time import timeit from collections import OrderedDict from .Profiler import Profiler from functools import reduce class ConfigError(Exception): pass class AndroidPlugin(Profiler): def __init__(self, config, paths): super(AndroidPlug...
the-stack_106_16168
#! /usr/bin/env python import rospy import time import actionlib from ardrone_as.msg import ArdroneAction, ArdroneGoal, ArdroneResult, ArdroneFeedback # We create some constants with the corresponing vaules from the SimpleGoalState class PENDING = 0 ACTIVE = 1 DONE = 2 WARN = 3 ERROR = 4 nImage = 1 # definition of ...
the-stack_106_16169
"""SCons.Tool.swig Tool-specific initialization for swig. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy ...
the-stack_106_16170
from datetime import date, datetime, timedelta import functools import inspect import re from typing import Any, List import warnings import numpy as np from pandas._libs import NaT, Timestamp, lib, tslib, writers import pandas._libs.internals as libinternals from pandas._libs.tslibs import Timedelta, conversion from...
the-stack_106_16175
from unittest import TestCase, mock from flask import Response from api import init_app from config import config from application.resource.resources import Person from api.controller import create_person, get_persons, get_person, Service from uuid import uuid4 from json import loads class TestController(TestCase): ...
the-stack_106_16176
import sima import sima.motion import numpy as np import os import pickle import h5py import sys from sima import sequence import time import bidi_offset_correction from contextlib import contextmanager import matplotlib import matplotlib.pyplot as plt import tifffile as tiff import utils # important for text to be de...
the-stack_106_16178
""" @ukinti_bot Available Commands: .unbanall .kick option Available Options: d, y, m, w, o, q, r """ from telethon import events from datetime import datetime, timedelta from telethon.tl.types import UserStatusEmpty, UserStatusLastMonth, UserStatusLastWeek, UserStatusOffline, UserStatusOnline, UserStatusRecently, Chan...
the-stack_106_16179
import numpy as np import matplotlib.pyplot as plt # Make a plot of cosine thetas = np.linspace(0, 8, 32) cosines = [] for theta in thetas: cosines.append(np.cos(theta)) # Plot the data fig, ax = plt.subplots() ax.plot(thetas, cosines, 'r.', label="Cosine") ax.set_title("Cosine") plt.show()
the-stack_106_16180
from functools import cache from itertools import count from aoc_utils import Vec, dirs4 from aocd import get_data @cache def find(n): return next(p for p, c in mapp.items() if c == n) @cache def distances_from_point(startpos): boundary = {startpos} visited = boundary.copy() res = {} for i in c...
the-stack_106_16182
import numbers import numpy as np import pytest import ubermagutil.typesystem as ts @ts.typesystem( t1=ts.Typed(expected_type=int), t2=ts.Typed(expected_type=numbers.Real), t3=ts.Typed(expected_type=str, allow_none=True), t4c=ts.Typed(expected_type=list, const=True), s1=ts.Scalar(), s2=ts.Sc...
the-stack_106_16183
from tests import ScraperTest from recipe_scrapers.thewoksoflife import Thewoksoflife class TestThewoksoflifeScraper(ScraperTest): scraper_class = Thewoksoflife def test_host(self): self.assertEqual( 'thewoksoflife.com', self.harvester_class.host() ) def test_ti...
the-stack_106_16184
# -*- coding: utf-8 -*- import os, re from configurations import Configuration, importer, values from froide.settings import ThemeBase, Base # noqa # importer.install(check_options=True) class OpenGovHK(ThemeBase, Base): FROIDE_THEME = 'opengovhk.theme' LANGUAGES = ( ('en', 'English'), ('zh-h...
the-stack_106_16189
import time import os import MySQLdb from flask import Flask, request, g, Response from utils import ( Json, build_image_info, build_range_query, build_keyword_query, build_search_query_from_dic, set_params ) from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) app = Flask(__name__) def conn...
the-stack_106_16191
#!/usr/bin/env python3 # # 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 argparse import distutils.command.build import distutils.util import fnmatch import glob import io import os i...
the-stack_106_16193
from typing import List, Dict, Optional, Tuple import math MIN_RATED_PCT = 50 # Based on the given judgements score the ordered list of document IDs in document_ids def ndcg(judgements: Dict[str, float], document_ids: List[str], at_n=10) -> Optional[float]: judgements_sorted: List[Tuple[str, float]] = sorted(ju...
the-stack_106_16195
"""Test init of Brother integration.""" from homeassistant.components.brother.const import DOMAIN from homeassistant.config_entries import ( ENTRY_STATE_LOADED, ENTRY_STATE_NOT_LOADED, ENTRY_STATE_SETUP_RETRY, ) from homeassistant.const import CONF_HOST, CONF_TYPE, STATE_UNAVAILABLE from tests.async_mock i...
the-stack_106_16196
import os, json, argparse, sys, datetime, time, csv, datetime import urllib.request as ureq from curses import wrapper """ bzcat latest-all.json.bz2 |wikibase-dump-filter --simplify --claim 'P356' |jq '[.id,.claims.P356]' -c >DOI.ndjson or use wdumper """ # Initiate the parser parser = argparse.ArgumentParser() parse...
the-stack_106_16197
import sys import dlib detector = dlib.simple_object_detector("detector.svm") win = dlib.image_window() for f in sys.argv[1:]: img = dlib.load_rgb_image(f) dets = detector(img) win.clear_overlay() win.set_image(img) win.add_overlay(dets) input("hit enter to continue")
the-stack_106_16198
from __future__ import division, print_function __all__ = ["Signal", "LikelihoodError"] from .global_imports import * from . import global_imports from .Data import Data from .Instrument import Instrument, ChannelError from .Background import Background from .Interstellar import Interstellar from .tools.energy_inte...
the-stack_106_16199
import glfw from OpenGL.GL import * from OpenGL.GL.shaders import compileProgram, compileShader import pyrr from pyrr import Vector3, vector, vector3, matrix44 ##Self-defined modules from TextureLoader import load_texture from ObjLoader import ObjLoader from camera import Camera import ShaderLoader cam=Camera() WIDTH...
the-stack_106_16200
import copy import json import math import numbers import os import random import time from enum import Enum from queue import Full from os.path import join import numpy as np from algorithms.appo.appo_utils import TaskType, iterate_recursively from algorithms.utils.algo_utils import EPS from utils.utils import log, ...
the-stack_106_16202
from tftk.image.dataset import Mnist from tftk.image.dataset import Food101 from tftk.image.dataset import ImageDatasetUtil from tftk.image.model.classification import SimpleClassificationModel from tftk.callback import CallbackBuilder from tftk.optimizer import OptimizerBuilder from tftk import Context from tftk.ima...
the-stack_106_16203
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test -maxmempooltx limit-number-of-transactions-in-mempool # code # from test_framework.test_framework im...
the-stack_106_16205
from math import hypot import numpy as np import json import sys def givens_rotation(A): """Perform QR decomposition of matrix A using Givens rotation.""" (num_rows, num_cols) = np.shape(A) # Initialize orthogonal matrix Q and upper triangular matrix R. Q = np.identity(num_rows) R = np.copy(A) ...
the-stack_106_16206
"""Test the main class DataExporter and functions in the dataio module, ExportData.""" import pathlib import shutil import re from collections import OrderedDict import logging import json import yaml import pytest import xtgeo import fmu.dataio # pylint: disable=protected-access CFG = OrderedDict() CFG["model"] = {"...
the-stack_106_16210
# -*- coding: utf-8 -*- """Algorithms for spectral clustering """ import logging import dask.array as da import numpy as np import six import sklearn.cluster from dask import delayed from scipy.linalg import pinv, svd from sklearn.base import BaseEstimator, ClusterMixin from sklearn.utils import check_random_state fr...
the-stack_106_16211
import pandas as pd from bokeh.palettes import Spectral4 from bokeh.plotting import figure, output_file, show p = figure(plot_width=800, plot_height=250, x_axis_type="datetime") p.title.text = 'Click on legend entries to mute the corresponding lines' for name, color in zip(['AAPL', 'IBM', 'MSFT', 'GOOG'], Spectral4)...
the-stack_106_16212
import numpy as np def OR(x1, x2): x = np.array([x1, x2]) w = np.array([0.5, 0.5]) b = -0.2 tmp = np.sum(w * x) + b if tmp <= 0: return 0 else: return 1 if __name__ == '__main__': for xs in [(0, 0), (1, 0), (0, 1), (1, 1)]: y = OR(xs[0], xs[1]) print(str(x...
the-stack_106_16213
# -*- coding: utf-8 -*- """ Logging adapter --------------- """ import logging from flask_login import current_user # NOQA import enum log = logging.getLogger(__name__) # pylint: disable=invalid-name class Logging(object): """ This is a helper extension, which adjusts logging configuration for the appl...
the-stack_106_16214
import os import csv import torch import torch.optim as optim import itertools import sys sys.path.append('../') #import dataPreperation.Fact2_Only_F1_H_exact_tokens as data import dataPreperation.Original_Fact2 as data # from dataPreperation.Fact2_Only_F1_H_exact_tokens import dataPreparation from copynet_seq2seq_da...
the-stack_106_16215
""" ********************************************************************** ********************************************************************** ** author: ZSAIm ** email: 405935987@163.com ** github: https://github.com/ZSAIm/CaptchaReconition-CNN ** ** programm...
the-stack_106_16216
from pygame import * from check_files import check_files #inzialate fonts and mixer font.init() mixer.init() #score racket1 score1 = 0 #score racket2 score2 = 0 FPS = 60 speed_x = 3 speed_y = 3 game = True finish = False back = (200,255,255) win_width = 600 win_height = 500 required_files = ['images/...
the-stack_106_16218
import os import shutil import itertools import glob import textwrap import configparser from conans import ConanFile, tools, RunEnvironment from conans.errors import ConanInvalidConfiguration from conans.model import Generator class qt(Generator): @property def filename(self): return "qt.conf" @...
the-stack_106_16219
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib as mpl from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable from mpl_toolkits.axes_grid1.colorbar import colorbar from matplotlib import colors from bpnet.plot.utils import MidpointNormalize class QuantileTruncate...
the-stack_106_16221
""" Delete snapshot action for AWS RDS DB snapshot. """ from resourcehandlers.aws.models import AWSHandler from common.methods import set_progress from infrastructure.models import CustomField, Environment import boto3 import time from django.db import IntegrityError def generate_options_for_snapshot(server=None, **kw...
the-stack_106_16222
from lbrynet import conf class ClientRequest(object): def __init__(self, request_dict, response_identifier=None): self.request_dict = request_dict self.response_identifier = response_identifier class ClientPaidRequest(ClientRequest): def __init__(self, request_dict, response_identifier, max_...
the-stack_106_16225
import numpy as np import pandas as pd def check_df_col(df, column, name=None): """ Checks for the presence of a column (or columns) in a tidy DataFrame with an informative error message. Passes silently, otherwise raises error. """ if column is not None: if type(column) != list: ...
the-stack_106_16226
from django.conf.urls import url from django.conf import settings from django.conf.urls.static import static from . import views urlpatterns=[ url(r'^$',views.landing,name='landing'), url(r'^profile/$',views.profile,name='profile'), url(r'^profile/edit/$',views.edit,name='edit'), url(r'^businesses/$',...
the-stack_106_16227
from pygears.conf import safe_bind from pygears.typing import TypingNamespacePlugin, Queue, Tuple, Union, typeof def next_pos(type_list, comb, t): if len(type_list) == 1: yield comb + [t] else: yield from type_comb_rec(type_list[:-1], comb + [t]) def type_comb_rec(type_list, comb): type_...
the-stack_106_16229
import base64 import io import json import os import gdown #import fastbook #fastbook.setup_book() import fastai import pandas as pd import requests import torchtext import nltk import snscrape.modules.twitter as sntwitter from copy import deepcopy from torchvision import models from torchvision import transforms from...
the-stack_106_16230
"""Admin suppor for inlines Peter Cicman, Divio GmbH, 2008 """ from django.utils.text import capfirst, get_text_list from django.contrib.admin.util import flatten_fieldsets from django.http import HttpResponseRedirect from django.utils.encoding import force_unicode import re from copy import deepcopy from django.conf...
the-stack_106_16232
#!/usr/bin/env python # Copyright (c) 2013 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Use the raw transactions API to spend bitcoins received on particular addresses, # and send any change back ...
the-stack_106_16234
import math,time from .velocity_to_duration import velocity_to_duration class Feedforward_interpolation: def __init__(self, motion, current_posture, postures, starting_velocity, velocities): self._motion_proxy = mo...
the-stack_106_16235
import tensorflow as tf import numpy as np import argparse import os import json import glob import random import collections import math import time from PIL import Image import cv2 import sys sys.path.append("..") from utils.losses import Losses from utils.misc import blend_uv parser = argparse.ArgumentParser() pa...
the-stack_106_16236
# Copyright 2019 The Oppia 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 ...
the-stack_106_16238
""" Copyright 2015 Rackspace 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 dist...
the-stack_106_16239
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 24 00:08:33 2020 @author: hiroyasu """ import numpy as np import pandas as pd import matplotlib.pyplot as plt import pickle def grad_U(Ui,Yij,Vj,mu,ai,bj,reg,eta): return eta*(reg*Ui-((Yij-mu)-(Ui@Vj+ai+bj))*Vj) def grad_V(Ui,Yij,Vj,mu,ai,bj,...
the-stack_106_16244
# -*- coding: UTF-8 -*- import logging import os import re from typing import Any, Dict, List, Optional, Text from rasa_nlu import utils from rasa_nlu.featurizers import Featurizer from rasa_nlu.training_data import Message from rasa_nlu.components import Component from rasa_nlu.model import Metadata from rasa_nlu.tr...
the-stack_106_16245
import unittest from pathlib import Path import pandas as pd import json import lusid import lusid.models as models from lusidfeature import lusid_feature from lusidtools import cocoon as cocoon from lusidtools.cocoon.utilities import create_scope_id import datetime from dateutil.tz import tzutc import logging logger...
the-stack_106_16247
# coding=utf-8 # Copyright 2018 The TF-Agents Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
the-stack_106_16250
from datetime import timedelta from feast import Entity, FeatureView, Field, RedshiftSource, ValueType from feast.types import Float32, Int64 # Define an entity for the driver. Entities can be thought of as primary keys used to # retrieve features. Entities are also used to join multiple tables/views during the # con...
the-stack_106_16251
# # %CopyrightBegin% # # Copyright Ericsson AB 2013-2020. 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 re...
the-stack_106_16254
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import yaml from .utils import * def readConfig(configfile, output_dir=None, input_dir=None, backup_dir=None, interval=None, logfile=None, loglevel=None, env=None, logger=None): """ Read a config file or return a default config """ if not env: en...
the-stack_106_16255
# ------------------------------------------------------------------------------ # pose.pytorch # Copyright (c) 2018-present Microsoft # Licensed under The Apache-2.0 License [see LICENSE for details] # ------------------------------------------------------------------------------ from __future__ import absolute_impor...
the-stack_106_16256
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
the-stack_106_16257
#!/usr/bin/env python # Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo # Copyright (C) 2009-2017 German Aerospace Center (DLR) and others. # This program and the accompanying materials # are made available under the terms of the Eclipse Public License v2.0 # which accompanies this distribution...
the-stack_106_16258
# Copyright 2020 Red Hat, 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 a...
the-stack_106_16259
#!/usr/bin/env python # Copyright 2014-2019 The PySCF Developers. 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 # # U...
the-stack_106_16262
""" Debug printer Handles logging at different debug levels """ from colorama import Fore, Style, init init() LOOP_TEMPLATE = """ {tab_level}{HEADER_COLOR}[{id}] {name}{END_COLOR} {tab_level} * Required? {VALUE_COLOR}{req}{END_COLOR} {tab_level} * Max repeat: {VALUE_COLOR}{repeat}{END_COLOR} """ SEGMENT_TEMPLATE = ...
the-stack_106_16263
# Copyright 2019 Atalaya Tech, 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, ...
the-stack_106_16264
from django.core.management.base import BaseCommand, CommandError from django.db import connection, transaction from django.conf import settings from optparse import make_option import os.path from subprocess import call import tempfile class Command(BaseCommand): args = '<dem_path>' help = 'Load DEM data (pr...
the-stack_106_16266
#!/usr/bin/env python # encoding: utf-8 """ predict.py Created by Shuailong on 2016-12-3. Validate the correctness of the algorithm. """ from __future__ import print_function from time import time from keras.models import load_model import os from utils import true_accuracy from utils import token2word from datas...
the-stack_106_16268
# Given the list motions=[1,1] which means the robot # moves right and then right again, compute the posterior # distribution if the robot first senses red, then moves # right one, then senses green, then moves right again, # starting with a uniform prior distribution. p = [0.2, 0.2, 0.2, 0.2, 0.2] world = ['green', ...
the-stack_106_16270
# -*- 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 #...
the-stack_106_16272
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
the-stack_106_16273
import matplotlib.pyplot as plt if __name__=="__main__": with open('data.csv') as f: raw=f.read().split("\n") times,temps,freqs=[],[],[] for line in raw: if "," in line and not line.startswith("#"): a,b,c=line.strip().split(",") times.append(float(a)/60) t...
the-stack_106_16276
""" Copyright (c) 2018 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 wri...
the-stack_106_16279
# =============================================================================== # Copyright 2014 Jake Ross # # 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...
the-stack_106_16280
import textwrap import tkinter as tk from tkinter import font as tk_font from tkinter import ttk from thonny import get_workbench from thonny.codeview import CodeView from thonny.config_ui import ConfigurationPage from thonny.ui_utils import create_string_var class ThemeAndFontConfigurationPage(ConfigurationPage): ...
the-stack_106_16281
from typing import List, Dict, Tuple import ROOT as r from tqdm import tqdm from . import calibrationUtils as util import os class CalibrationData: def __init__(self, image_dir_path: str, MPPC_high_voltage: str) -> None: self._image_dir_path: str = image_dir_path self._HV: str = MPPC_high_voltage...
the-stack_106_16282
# Copyright (c) 2020 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...
the-stack_106_16283
# Copyright 2017 Vector Creations 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 in ...
the-stack_106_16284
from contextlib import contextmanager from functools import partial import torch import numpy as np from torchvision.transforms import Resize from PIL import Image import gym from utils.general_utils import ParamDict, AttrDict from utils.pytorch_utils import ar2ten, ten2ar class BaseEnvironment(gym.core....
the-stack_106_16286
"""LMM testing code""" import unittest import scipy as SP import pdb import limix.deprecated as dlimix from .covar import Acovar_test class CCovSqexpARD_test(unittest.TestCase,Acovar_test): """test class for CCovSqexpARD""" def setUp(self): SP.random.seed(1) self.n=10 self.n_dim=10 ...
the-stack_106_16287
from semantic_aware_models.dataset.movielens.movielens_data_model import ItemUnstructuredDataModel from semantic_aware_models.dataset.movielens.movielens_data_model import ItemStructuredDataModel import torch class DeepCBRSDataModel: def __init__(self): pass # Reads the text descriptions associated ...
the-stack_106_16288
from __future__ import division from pymer4.utils import con2R, R2con, get_resource_path, result_to_table import pandas as pd import numpy as np from pymer4.models import Lm import os def test_con2R(): x = np.array([[-1, 0, 0, 1], [-0.5, -0.5, 0.5, 0.5], [-3 / 3, 1 / 3, 1 / 3, 1 / 3]]) out = con2R(x) asse...
the-stack_106_16290
import numpy as np from random import sample, shuffle, randint ''' create batches ''' def create_batches(data_): qr = list(zip(data_['q'], data_['r'], data_['respect'])) batches = {} for qi,ri,respecti in qr: lqi, lri = len(qi), len(ri) if (lqi,lri) in batches: batchi = batch...
the-stack_106_16291
""" HTTP server that implements the Python WSGI protocol (PEP 333, rev 1.21). Based on wsgiref.simple_server which is part of the standard library since 2.5. This is a simple server for use in testing or debugging Django apps. It hasn't been reviewed for security issues. DON'T USE IT FOR PRODUCTION USE! """ import l...
the-stack_106_16292
"""Functions for validating JWT Bearer tokens.""" from connexion.exceptions import Unauthorized import logging from typing import (Dict, Iterable, List, Optional) from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicKey from flask import current_a...
the-stack_106_16293
# # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html # # KEA and SKIPJACK Algorithms in CMS # # ASN.1 source from: # https://www.rfc-editor.org/rfc/rfc2876.txt # ...
the-stack_106_16294
from __future__ import print_function, division import numpy as np import sys from pyscf.nao.m_color import color as bc from pyscf.nao.m_system_vars_dos import system_vars_dos, system_vars_pdos from pyscf.nao.m_siesta2blanko_csr import _siesta2blanko_csr from pyscf.nao.m_siesta2blanko_denvec import _siesta2blanko_denv...