filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_28975
import io import os import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def create_lr_sched(start_epoch, n_epochs, lr0=1e-3, lr_end=1e-9, warmup=True): """ start_epoch: epoch where to start decaying n_epochs: total number of epochs lr0: initial learning rate lr_end: learning...
the-stack_106_28976
from .channel import Channel from .exceptions import SlackClientError from .slackrequest import SlackRequest from .user import User from .util import SearchList, SearchDict import json import logging import time import random from requests.packages.urllib3.util.url import parse_url from ssl import SSLError from webso...
the-stack_106_28977
# Copyright (C) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
the-stack_106_28978
import pytest from typing import Callable import torch from torch.optim import Optimizer, Adam, AdamW from torch.optim.lr_scheduler import _LRScheduler, LambdaLR from simple_model import args_from_dict, SimpleModel, random_dataloader from common import distributed_test from util import required_torch_version import d...
the-stack_106_28979
"""Onnx Model Tools."""# coding=utf-8 # # /************************************************************************************ # *** # *** Copyright Dell 2021, All Rights Reserved. # *** # *** File Author: Dell, 2021年 03月 23日 星期二 12:42:57 CST # *** # ********************************************************************...
the-stack_106_28980
from simula_random import simula_random from simula_2 import simula2 def run(): """Main function to run simulation""" stock_tickers = ['LPP', 'INVESTORMS', 'PEKAO', 'KGHM', 'INGBSK','KETY','WAWEL','BZWBK','PZU','STALPROD','PKOBP','CCC', 'BOGDANKA','PKNORLEN','BUDIMEX','PGE', 'PULAWY', 'AMICA','HA...
the-stack_106_28981
#------------------------------------------------------------------------------- # Name: CONNECT 4 GAME # Purpose: PROJECT FOR GAME DEVELOPMENT IN OOP # # Author: GROUP CATACUTAN, PASCUAL, LAURENT, VENERACION # # Created: 30/10/2019 # Copyright: (c) XENON_XEIN_XENLY 2019 # Licence: <your licen...
the-stack_106_28983
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Module to deal with result cache.""" from __future__ import print_function import glob import hashlib import os import pickle import re import tem...
the-stack_106_28987
from itertools import chain from django import forms from django.template.loader import render_to_string from django.utils.encoding import force_str from django.utils.html import conditional_escape from django.utils.safestring import mark_safe class SortedCheckboxSelectMultiple(forms.CheckboxSelectMultiple): cla...
the-stack_106_28988
import sys import numpy as np import pandas as pd import multiprocessing import time from joblib import Parallel, delayed from tqdm import tqdm from .QCRSC import QCRSC from .calc_rsd_dratio import calc_rsd_dratio def batch(BatchTable, PeakTable, gamma='default', transform='log', parametric=True, zeroflag=True, remov...
the-stack_106_28989
# # Copyright (C) 2007 Google Inc. # # Licensed under the Apache License 2.0; # __author__ = 'api.jscudder (Jeff Scudder)' import re import unittest import urllib.error import urllib.parse import urllib.request import atom import gdata.contacts.service import gdata.test_config as conf conf.options.register_option(...
the-stack_106_28990
# 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. from urllib.parse import parse_qs import bottle import common.auth as _auth import common.helpers as util from common.logging import logger fr...
the-stack_106_28991
""" Given an ip address in dotted-decimal representation, determine the binary representation. For example, decimal_to_binary(255.0.0.5) returns 11111111.00000000.00000000.00000101 accepts string returns string """ def decimal_to_binary_util(val): """ Convert 8-bit decimal number to binary representation :...
the-stack_106_28994
# pydicom_Tkinter.py # # Copyright (c) 2009 Daniel Nanz # This file is released under the pydicom (http://code.google.com/p/pydicom/) # license, see the file license.txt available at # (http://code.google.com/p/pydicom/) # # revision history: # Dec-08-2009: version 0.1 # # 0.1: tested with pydicom version 0.9.3, Pyth...
the-stack_106_28995
# -*- coding: utf-8 -*- from flask_login import LoginManager from .views.tokens import ns from .helpers.tokens import Tokens class Authenticator(object): def __init__(self, app=None, **kwargs): self.app = app self.tokens = None self.login_manager = None if app is not None: ...
the-stack_106_28996
""" # Filename: Benchmark.py # Author: yangchaofan # Last Modified: 2018-7-18 15:13 # Description: a simple example of multi-thread query """ # before you run this example, make sure that you have started up ghttp service (using bin/ghttp db_name port) import threading import sys sys.path.append('../src') import Gstor...
the-stack_106_29000
""" In order to implement the post_processor you need to follow these steps: - Step 1 Configuration: In order to configure the post_processor you need just one document processed through Document AI. Open the configuration GUI calling run_GUI.py from the command line and set the 'path' flag: 'python run_GUI.py --pa...
the-stack_106_29003
# coding=utf-8 # Copyright (c) 2014-2018, F5 Networks, 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...
the-stack_106_29007
from flask import Flask, render_template from flask_pymongo import PyMongo import scrape_mars app = Flask(__name__) app.config["MONGO_URI"] = "mongodb://localhost:27017/mars_app" mongo = PyMongo(app) @app.route('/') def index(): mars = mongo.db.mars.find_one() return render_template("index.html", mars=mars)...
the-stack_106_29008
import logging from colorlog import ColoredFormatter LOG_LEVEL = logging.DEBUG LOG_FORMAT = " %(log_color)s%(levelname)-8s%(reset)s | %(log_color)s%(message)s%(reset)s" logging.root.setLevel(LOG_LEVEL) formatter = ColoredFormatter(LOG_FORMAT) stream = logging.StreamHandler() stream.setLevel(LOG_LEVEL) stream...
the-stack_106_29012
import numpy from scipy.integrate import quad from summer.model import order_dict_by_keys, add_zero_to_age_breakpoints from copy import copy """ pallettes of functions that may be useful for creating parameter values to submit to the SUMMER module """ def change_parameter_unit(parameter_dict, multiplier): """ ...
the-stack_106_29016
# # 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 us...
the-stack_106_29017
class Cuboid: def __init__(self, state, *bounds): self.state = state self.bounds = tuple() for bound in zip(*[iter(bounds)]*2): self.bounds += (bound,) @property def ndim(self): return len(self.bounds) def expand_dims(self, n): defic...
the-stack_106_29018
# The MIT License (MIT) # # Copyright (c) 2020 NVIDIA CORPORATION # # 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...
the-stack_106_29019
"""Training related classes and functions.""" import collections import os import time import tensorflow as tf from opennmt.data import dataset as dataset_util from opennmt.optimizers import utils as optimizer_util from opennmt.utils import misc class Trainer(object): """Model trainer.""" def __init__(self, c...
the-stack_106_29021
import tensorflow as tf from synthesizer.utils.symbols import symbols from synthesizer.infolog import log from synthesizer.models.helpers import TacoTrainingHelper, TacoTestHelper from synthesizer.models.modules import * from tensorflow.contrib.seq2seq import dynamic_decode from synthesizer.models.architecture_wrappers...
the-stack_106_29023
import numpy from rascil.data_models.memory_data_models import Image, Visibility from rascil.data_models.polarisation import PolarisationFrame from rascil.processing_components.image.operations import image_is_canonical __all__ = ['get_rowmap', 'get_polarisation_map', 'get_frequency_map'] def get_frequency_map(vis, ...
the-stack_106_29024
import os import codecs import shutil from html.parser import HTMLParser spells = [] class Spell: def __init__(self, name=None): self.name = name self.description = '' def __str__(self): return self.name + '\n' + self.type + '\n' + self.castingTime + '\n' + self.range + '\n' + self.components + '\n' + self.d...
the-stack_106_29026
""" """ from __future__ import (absolute_import, division, print_function, unicode_literals) import sys import pandas as pd import patsy import numpy.linalg as la import numpy as np def adjust_nums(numerical_covariates, drop_idxs): # if we dropped some values, have to adjust those with ...
the-stack_106_29027
''' We define to be a permutation of the first natural numbers in the range . Let denote the value at position in permutation using -based indexing. P is considered to be an absolute permutation if holds true for every . Given and , print the lexicographically smallest absolute permutation . If no absolute pe...
the-stack_106_29032
# no shebang-line as Python scripts aren't really executable on Windows # use runner = ["python", "runner.py"] in your Cargo config instead from hashlib import sha3_224 from shlex import quote import os import pathlib import platform import sys import subprocess as sp # "parse" command line EXECUTABLE = s...
the-stack_106_29033
"""Etcd Transport. It uses Etcd as a store to transport messages in Queues It uses python-etcd for talking to Etcd's HTTP API """ from __future__ import absolute_import, unicode_literals import os import socket from collections import defaultdict from contextlib import contextmanager from kombu.exceptions import C...
the-stack_106_29034
# Copyright 2017 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 a...
the-stack_106_29035
from sys import path import pygame from pygame import rect from pygame.sprite import Sprite class Bullet(Sprite): """ The definition of bullets of the game. Args: setting(Settings):the basic values of the game. screen(Any):the values and function of the game screen. plane(Plane):v...
the-stack_106_29036
#!/usr/bin/env python # coding: utf-8 from __future__ import absolute_import, division, print_function import collections import logging import math import os import random import warnings from dataclasses import asdict from multiprocessing import cpu_count import tempfile from pathlib import Path from collections i...
the-stack_106_29038
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import datetime import json import logging import random import sys import threading impo...
the-stack_106_29039
import networkx as nx import logging from itertools import combinations from random import sample from typing import Union, TypeVar Node = Union[str, int] # Node type hint: A node is a string or an int CausalDAG = TypeVar("CausalDAG") logger = logging.getLogger(__name__) from .scenario import Scenario from .variable...
the-stack_106_29040
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\vet\vet_clinic_handlers.py # Compiled at: 2017-08-16 22:23:19 # Size of source mod 2**32: 3879 bytes...
the-stack_106_29042
import pytest def pytest_addoption(parser): parser.addoption( "--edgetest", action="store_true", default=False, help="run edge tests: rpc server should be launched on the edge device in advance", ) parser.addoption( "--tvm_target_device", action="store", ...
the-stack_106_29043
# coding=utf-8 """ nsfw plugin for DecoraterBot. """ import random from discord.ext import commands import nsfw_dl from DecoraterBotUtils.utils import * class NSFW: """ NSFW Commands Plugin Class. """ def __init__(self): self.image = None self.nsfw_text = PluginTextReader( ...
the-stack_106_29046
# Copyright 2020 Xilinx 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_29047
from djmodels.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('author_app', '0001_initial'), ('book_app', '0001_initial'), # Forces the book table to alter the FK ] operations = [ migrations.AlterField( model_name='author', ...
the-stack_106_29053
# Copyright 2018-2019 The glTF-Blender-IO 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 ...
the-stack_106_29054
# -*- coding: utf-8 -*- import warnings import glob import numpy as np from scipy import misc, io import matplotlib.pyplot as plt from skimage.transform import PiecewiseAffineTransform, warp gdal_available = True try: from osgeo import gdal except ImportError as gdal_import_error: gdal_available = False war...
the-stack_106_29055
from flask import g, jsonify, request from flask_security import roles_required from meltano.api.api_blueprint import APIBlueprint from meltano.api.security.auth import block_if_readonly from meltano.core.error import PluginInstallError from meltano.core.plugin import PluginType from meltano.core.plugin.project_plugin ...
the-stack_106_29058
#!/usr/bin/env python3 # Copyright 2018 Brocade Communications Systems LLC. 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 also obtain a copy of the License at # http://www.apache.org/licenses/LICENS...
the-stack_106_29059
from django.conf.urls import url from . import rel_views from . import views app_name = 'apis_relations' urlpatterns = [ url(r'^ajax/get/$', views.get_form_ajax, name='get_form_ajax'), url( r'^ajax/save/(?P<entity_type>\w+)/(?P<kind_form>\w+)/(?P<SiteID>[0-9]+)(?:/(?P<ObjectID>[0-9]*))?/$', v...
the-stack_106_29060
# support Quandl 3.x.x try: import quandl as Quandl except: # if import fails use Quandl 2.x.x import Quandl from chartpy import Chart, Style, Canvas # get your own free bQuandl API key from https://www.quandl.com/ try: from chartpy.chartcred import ChartCred cred = ChartCred() quandl_api_key...
the-stack_106_29062
from pygears.hls import ir from functools import partial from pygears.typing import Array, Integer, Queue, code, typeof, Integral, Tuple, Union, Int, Unit from .sv_keywords import sv_keywords # TODO: Use precedence of operators to induce parenthesis around expressions SLICE_FUNC_TEMPLATE = """function {4} [{2}:0] sli...
the-stack_106_29063
#! /usr/bin/env python3 # Read from stdin, spit out C header or body. import argparse import copy import fileinput import re from collections import namedtuple Enumtype = namedtuple('Enumtype', ['name', 'value']) type2size = { 'pad': 1, 'struct channel_id': 32, 'struct short_channel_id': 8, 'struct ...
the-stack_106_29064
# # -*- coding: utf-8 -*- # # 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 app...
the-stack_106_29065
import os from aws_cdk import core as cdk from infra.features_ingestion_stack import FeatureIngestionStack project_name = os.getenv("SAGEMAKER_PROJECT_NAME") project_id = os.getenv("SAGEMAKER_PROJECT_ID") app = cdk.App() bucket_name = os.getenv("PROJECT_BUCKET") region = os.getenv("AWS_REGION") synth = cdk.Defaul...
the-stack_106_29067
import numpy as np import pytest import ezaero.vlm.steady as vlm_steady INFINITE_WING = { 'wing': vlm_steady.WingParams(cr=1.0, ct=1.0, bp=10000, theta=0.0, delta=0.0), 'mesh': vlm_steady.MeshParams(m=2, n=400) } @pytest.mark.parametrize('alpha', np.array((-2, -1, 0, 1, 2, ...
the-stack_106_29068
# ****************************************************************************** # Copyright 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.o...
the-stack_106_29071
import io import os import textwrap import warnings import unittest import pathlib from typing import Type, Iterable from collections.abc import Mapping from collections import UserDict from compat import support, os_helper from backports import configparser def nice_literals(str): "Remove b and u prefixes fro...
the-stack_106_29074
""" Classes for reading FASTA and FASTQ files """ __all__ = ['FastaReader', 'FastqReader'] import io from xopen import xopen from ._core import fastq_iter as _fastq_iter, Sequence from ._util import shorten as _shorten from .exceptions import FastaFormatError class BinaryFileReader: """ A mixin for readers t...
the-stack_106_29075
import logging # import sentry_sdk # # from sentry_sdk.integrations.django import DjangoIntegration # from sentry_sdk.integrations.logging import LoggingIntegration # from sentry_sdk.integrations.celery import CeleryIntegration from .base import * # noqa from .base import env # GENERAL # --------------------------...
the-stack_106_29080
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pylab as plt from gradient_2d import numerical_gradient def gradient_descent(f, init_x, lr = 0.01, step_num = 100): x = init_x x_history = [] for i in range(step_num): x_history.append( x.copy() ) grad = numerical_gr...
the-stack_106_29081
import _plotly_utils.basevalidators class SizeValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="size", parent_name="icicle.marker.colorbar.tickfont", **kwargs, ): super(SizeValidator, self).__init__( plotly_name=plotly...
the-stack_106_29085
# model settings model = dict( type='CenterNet', pretrained='./pretrain/darknet53.pth', backbone=dict( type='DarknetV3', layers=[1, 2, 8, 8, 4], inplanes=[3, 32, 64, 128, 256, 512], planes=[32, 64, 128, 256, 512, 1024], norm_cfg=dict(type='BN'), out_indices=(1...
the-stack_106_29086
import os import config_module import sqlite3 #for creating databases for new galleries import requests import string import random import hashlib def create_new_gallery(gallery_id): if(str(gallery_id) not in os.listdir(config_module.library_path)): gallery_path = os.path.join(config_module.library_path, s...
the-stack_106_29088
import lightbulb from . import music_plugin from nrk.utils.Equalizers import Equalizers @music_plugin.command @lightbulb.add_checks(lightbulb.guild_only) @lightbulb.option('filter_name', 'Select EQ filter name', choices=("flat", "boost", "metal", "piano")) @lightbulb.command( 'eq', "Add a filter to the current s...
the-stack_106_29093
import tkinter as tk from tkinter_gui_builder.widgets.widget_utils.widget_events import WidgetEvents class Spinbox(tk.Spinbox, WidgetEvents): def __init__(self, master=None, cnf={}, **kw): super(tk.Spinbox, self).__init__(master, 'spinbox', cnf, kw) super(WidgetEvents, self).__init__() def se...
the-stack_106_29094
import datetime import os from ...utils import paths try: from google.cloud import storage # type:ignore except ImportError: pass from typing import Optional def blob_writer( source_file_name: str, target_path: str, date: Optional[datetime.date] = None, add_exten...
the-stack_106_29095
# Copyright 2018 Samuel Payne sam_payne@byu.edu # 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_29104
import graphene import pytest from saleor.discount import DiscountValueType, VoucherType from saleor.graphql.discount.enums import ( DiscountValueTypeEnum, VoucherTypeEnum) from tests.api.utils import get_graphql_content def test_voucher_query(staff_api_client, voucher, permission_manage_discounts): query = ...
the-stack_106_29105
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Enables directory-specific presubmit checks to run at upload and/or commit. """ from __future__ import print_function __versio...
the-stack_106_29108
import random f = open("data/cli/clinical_train.txt","r") lines = f.readlines() tab = [lines[0]] lines = lines[1:] random.shuffle(lines) test = tab + lines[:160] train = tab + lines[160:] f_train = open("data/cli/train.txt","w") f_test = open("data/cli/test.txt","w") f_train.writelines(train) f_test.writelines(test) pr...
the-stack_106_29113
import altair as alt import pandas as pd class AltAirLogPlot(object): df = None DTCSH = 70 DTCMA = 55.8 DTCW = 200 #PHIS = (DTC - DTCMA) / (DTCW - DTCMA) / KCP def __init__(self, df): self.df = df @classmethod def plot_log_df(cls, df): chart = alt.Chart(df).mark_line(...
the-stack_106_29115
import asyncio, aiohttp, json def setup(bot): pass async def async_post_json(url, data = None, headers = None): async with aiohttp.ClientSession(headers=headers) as session: async with session.post(url, data=data) as response: return await response.json() async def async_post_text(url, data ...
the-stack_106_29119
# coding=utf-8 import logging try: import rospy from rosgraph_msgs.msg import Log except ImportError: logging.warning("ROS not available: no ROS logging") roslevel = {'DEBUG':1, 'INFO':2, 'WARNING':4, 'ERROR':8, 'CRITICAL':16} class RXConsoleHandler(logging.Handler): def __init__(self, topic = "/roso...
the-stack_106_29120
# Copyright 2017-2020 typed_python 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_29121
""" RenderPipeline Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com> 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 right...
the-stack_106_29123
# coding: utf-8 """ Pure Storage FlashBlade REST 1.11 Python SDK Pure Storage FlashBlade REST 1.11 Python SDK. Compatible with REST API versions 1.0 - 1.11. Developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/...
the-stack_106_29124
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import xml.etree.Ele...
the-stack_106_29125
""" The DQN improvement: Prioritized Experience Replay (based on https://arxiv.org/abs/1511.05952) View more on my tutorial page: https://morvanzhou.github.io/tutorials/ Using: Tensorflow: 1.0 gym: 0.8.0 """ import numpy as np import tensorflow as tf np.random.seed(1) tf.set_random_seed(1) class SumTree(object): ...
the-stack_106_29126
# -*- coding: utf-8 -*- import sys, numpy, scipy import scipy.cluster.hierarchy as hier import scipy.spatial.distance as dist import csv import scipy.stats as stats import json import networkx as nx from networkx.readwrite import json_graph def makeNestedJson(leaf) : leaf=json.loads(leaf) #A tree is ...
the-stack_106_29127
#!/usr/bin/env python3 """ Tasks Get example output for tests - Ted Parser for ODGI Bin file format - Ted Component Segmentation Detection - Josiah and Joerg Python memory object model - Josiah Output format """ from typing import List, Tuple, Set, Dict from pathlib import Path as osPath from nested_dict import neste...
the-stack_106_29128
import itertools from functools import partial import numpy as np import tensorflow as tf import deep500 as d5 from .tf_network import TensorflowNetwork class TensorflowVisitor(d5.OnnxBaseVisitor): def __init__(self): self.counter = 0 self.net_input = {} self.is_training = None de...
the-stack_106_29129
# Complex Data Structures - nested lists that contain lists, dicts that contain dicts, etc etc import re """ step 1: look at to see what type the data structure is (list or dict) step 2: look at the length of the data structure step 3: slowly drill down into the nested data to figure out how it is setup -its usefu...
the-stack_106_29135
# Copyright 2014 Cisco Systems, 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 requir...
the-stack_106_29136
import frappe from frappe.patches.v7_0.re_route import update_routes from frappe.installer import remove_from_installed_apps def execute(): if 'knowledge_base' in frappe.get_installed_apps(): frappe.reload_doc('website', 'doctype', 'help_category') frappe.reload_doc('website', 'doctype', 'help_article') updat...
the-stack_106_29137
""" Charaterization funcions """ import pprint pp = pprint.PrettyPrinter(indent=4) from typing import Optional, TypeVar, Union, Tuple, List import os import sys import shutil import pandas as pd import numpy as np from collections import Counter #ignore divide by zero warinings import warnings warnings.filterwarning...
the-stack_106_29138
from common import ( checks, host_helpers, plugintools, ) SERVICES = ["etcdctl", "calicoctl", "flanneld", "kubectl2", "kubelet", "containerd-shim", "containerd", "dockerd", "kubelet", "kube-proxy", ...
the-stack_106_29139
import argparse import torch import torchvision transform = torchvision.transforms.Compose([ torchvision.transforms.ToTensor(), torchvision.transforms.Normalize((0.1307,), (0.3081,)) ]) def training_set(): dataset = torchvision.datasets.MNIST('data', train=True, download=True, transform=transform) ret...
the-stack_106_29141
class Solution: """ @param x: an integer @param y: an integer @return: return an integer, denote the Hamming Distance between two integers """ def hammingDistance(self, x, y): # write your code here count=0 xor=x^y while xor: if xor%2!=0: ...
the-stack_106_29142
# Copyright 2019 The MediaPipe 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 ...
the-stack_106_29144
import cv2 import json ''' Tool to visualize crowd counting ground truth annotations. Input: json_path: the path to json annotation files json format: { "JPG_FILE_PATH":[ {"x": x_coordinate, "y": x_coordinate }, ...
the-stack_106_29145
# -*- coding=utf-8 -*- #!/usr/bin/python3 import math import tensorflow as tf from tensorflow.keras import backend as K from yolo3.postprocess import yolo3_decode def softmax_focal_loss(y_true, y_pred, gamma=2.0, alpha=0.25): """ Compute softmax focal loss. Reference Paper: "Focal Loss for Dense O...
the-stack_106_29146
# 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_29147
# Copyright (c) 2022, RC and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _, _dict def execute(filters=None): columns = get_columns() data = get_data(filters) return columns, data def get_columns(): columns = [ { "fie...
the-stack_106_29149
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 15 23:09:15 2018 @author: vinayak """ from keras.models import Sequential from keras.layers import Conv2D, ZeroPadding2D, Activation, Input, concatenate from keras.models import Model from keras.layers.normalization import BatchNormalization from k...
the-stack_106_29151
__all__ = [ 'RegressionRandomIndexComponent', 'RegressionPredictionSummaryComponent', 'PredictedVsActualComponent', 'ResidualsComponent', 'RegressionVsColComponent', 'RegressionModelSummaryComponent', ] import numpy as np import pandas as pd import dash import dash_core_components as dcc impor...
the-stack_106_29153
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import shutil from setuptools.command.test import test as TestCommand from setuptools import find_packages def remove_dir(dirpath): if os.path.exists(dirpath) and os.path.isdir(dirpath): ...
the-stack_106_29155
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class VotcaTools(CMakePackage): """Versatile Object-oriented Toolkit for Coarse-graining ...
the-stack_106_29158
# -*- coding: utf-8 -*- import os import discord from discord.ext import commands from discord.ext.commands import CommandNotFound import logging import asyncio import itertools import sys import traceback import random import itertools import math from async_timeout import timeout from functools impor...
the-stack_106_29159
# Copyright 2020,2021 Sony Corporation. # Copyright 2021 Sony Group 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 ...
the-stack_106_29160
import numpy as np import os def load_bin(fname, start_time, N_CHAN, chunk_len, d_type='float32'): """Load Raw data """ with open(fname, 'rb') as fin: if d_type=='float32': fin.seek(start_time * 4 * N_CHAN, os.SEEK_SET) elif d_type =='int16': fin.seek(start_time *...
the-stack_106_29162
#!/usr/bin/env/python """ manage_columns_filter.py -- add needed columns, remove unused columns """ __author__ = "Michael Conlon" __copyright__ = "Copyright 2015 (c) Michael Conlon" __license__ = "New BSD License" __version__ = "0.01" import sys from pump.vivopump import read_csv_fp, write_csv_fp, improve_jobco...
the-stack_106_29163
# Displays average item active price and sends as text message import json import requests import boto3 from config import key, number from colorama import init, Fore init() def calculate_average(x): return sum(x) / float(len(x)) searchTerm = input ("\nEnter Search Term: ") condition = ("3000") minPrice =("200") m...