filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_27798
import os from setuptools import find_packages, setup with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-polls', version='0.1'...
the-stack_106_27799
"""Tests for our `watches just_indices_stats` subcommand.""" import json from subprocess import PIPE, Popen as popen from secure_support import TestSecureSupport class TestJustIndicesStats(TestSecureSupport): def test_returns_index_per_line(self): cmd = self.appendSecurityCommands(['watches', 'just_ind...
the-stack_106_27800
import os import pprint import warnings os.environ['TF_CPP_MIN_LOG_LEVEL']='3' warnings.filterwarnings("ignore",category=FutureWarning) from model import Model import numpy as np import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) flags = tf.app.flags flags.DEFINE_string("arch", "...
the-stack_106_27801
# -*- coding: utf-8 -*- """ dp for Tornado MVC Web Application Framework with Tornado http://github.com/why2pac/dp-tornado Copyright (c) 2015, why2pac <youngyongpark@gmail.com> """ import tornado.web import tornado.ioloop import tornado.httpserver import time import os import multiprocessing import impo...
the-stack_106_27802
from collections import OrderedDict from guillotina import routes from guillotina._settings import app_settings from guillotina.configure import component from guillotina.configure.behaviors import BehaviorAdapterFactory from guillotina.configure.behaviors import BehaviorRegistration from guillotina.exceptions import C...
the-stack_106_27803
"""Main battle system implementation.""" from random import randint # items from items import antidote from items import cookie from items import echo_screen from items import health_kit from items import power_potion from items import pp_restore # moves from moves import blast from moves import blaze from moves imp...
the-stack_106_27804
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import boto3 import datetime from ecs_crd.canaryReleaseDeployStep import CanaryReleaseDeployStep from ecs_crd.rollbackChangeRoute53WeightsStep import RollbackChangeRoute53WeightsStep from ecs_crd.destroyBlueStackStep import DestroyBlueStackStep from ecs_crd.sendNotificat...
the-stack_106_27805
from typing import List, Dict, Optional import logging from uuid import UUID from sqlalchemy import select, update, delete from sqlalchemy.exc import IntegrityError from hetdesrun.utils import State, Type from hetdesrun.persistence import SQLAlchemySession from hetdesrun.persistence.dbservice.nesting import ( d...
the-stack_106_27806
# -*- coding: UTF-8 -*- # Copyright (c) 2020 Saint Corp. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Archive extraction utilities """ import os import shutil import subprocess import tarfile from pathlib import Path, PurePosixPath fro...
the-stack_106_27809
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
the-stack_106_27810
import os import numpy as np import tensorflow as tf import tensorflow_probability as tfp import time tfk = tf.keras tfkl = tf.keras.layers tfpl = tfp.layers tfd = tfp.distributions tfb = tfp.bijectors from softlearning.models.convnet import convnet_model from softlearning.models.feedforward import feedforward_model...
the-stack_106_27811
def calcEquation(self, equations, values, queries): # Step 1: Build the graph graph = collections.defaultdict(dict) # Default dict beacuse if a value DNE it won't throw an expection unlike normal dict for (num, denom), product in zip(equations, values): # zip(equations, values) = [([a, b], ...
the-stack_106_27812
from machinetranslation import translator from flask import Flask, render_template, request import json import machinetranslation app = Flask("Web Translator") @app.route("/englishToFrench") def englishToFrench(): textToTranslate = request.args.get('textToTranslate') translatedText = machinetranslation.transl...
the-stack_106_27813
class ControllerView: def __init__(self): pass def final_result(self, name, sum_result): if sum_result > 21: print(f"O Player {name} perdeu a partida!") elif sum_result == 21: print(f"O Player {name} venceu a partida!") else: print(f"O Player ...
the-stack_106_27814
""" Some codes from https://github.com/Newmu/dcgan_code """ from __future__ import division import math import json import random import pprint import scipy.misc import numpy as np from time import gmtime, strftime import tensorflow as tf import tensorflow.contrib.slim as slim pp = pprint.PrettyPrinter() def get_st...
the-stack_106_27816
# -*- coding: utf-8 -*- """ werkzeug.wsgi ~~~~~~~~~~~~~ This module implements WSGI related helpers. :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import io try: import httplib except ImportError: from http import ...
the-stack_106_27817
from struct import pack, unpack import hashlib import sys import traceback from typing import Optional, Tuple from electrum_zcash import constants from electrum_zcash import ecc from electrum_zcash import bip32 from electrum_zcash.crypto import hash_160 from electrum_zcash.bitcoin import (int_to_hex, var_int, b58_addr...
the-stack_106_27818
# -*- coding: utf-8 -*- ''' Functions for working with files ''' from __future__ import absolute_import # Import Python libs import contextlib import errno import logging import os import re import shutil import stat import subprocess import tempfile import time import urllib # Import Salt libs import salt.utils.val...
the-stack_106_27821
import distutils.cmd import os import subprocess from setuptools import find_packages, setup class BaseCommand(distutils.cmd.Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def create_command(text, commands): """Creates a custom setu...
the-stack_106_27822
import random import numpy import math from solution import solution import time def HHO(objf, lb, ub, dim, SearchAgents_no, Max_iter): # dim=30 # SearchAgents_no=50 # lb=-100 # ub=100 # Max_iter=500 # initialize the location and Energy of the rabbit Rabbit_Location = numpy.zeros(dim) ...
the-stack_106_27823
import torch import torch.nn as nn import torch.nn.functional as F from layers import Flatten, Concatenate from torch.nn.utils import spectral_norm # https://github.com/heykeetae/Self-Attention-GAN/blob/master/sagan_models.py def snconv2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups...
the-stack_106_27825
import pytest import numpy as np import transform as tf @pytest.mark.circles @pytest.mark.parametrize('myinput, myref', [(1, np.pi), (0, 0), (1j, 0), (2.1, np.pi * 2.1**2), # (-5, pytest.ra...
the-stack_106_27826
import unittest import tethys_apps.base.handoff as tethys_handoff from types import FunctionType from unittest import mock from tethys_sdk.testing import TethysTestCase def test_function(*args): if args is not None: arg_list = [] for arg in args: arg_list.append(arg) return ar...
the-stack_106_27827
import numpy as np from vec_io import fvecs_read from sorter import parallel_sort from lsh import SRP from transform import spherical_transform, simple_lsh def intersect(gs, ids): rc = np.mean([ len(np.intersect1d(g, list(id))) for g, id in zip(gs, ids)]) return rc def recalls(index, q_, gt)...
the-stack_106_27828
import torch from torch import nn from torch.nn import functional as F import numpy as np from torch.distributions import Categorical from .layers import * class BiGRULanguageModel(nn.Module): def __init__(self, config, vocab, pad_token=0, device=0): super().__init__() self.hidden_size = config.lm...
the-stack_106_27831
from functools import reduce ## Journal of Biomedical And Health Informatics (JBHI) 2020 import pdb import torch import torch.nn.functional as F import torch.nn as nn from torch.autograd import Variable from bis3d_v2.networks.nets.msga_net.attention import ( PAM_Module, CAM_Module, semanticModule, PAM_...
the-stack_106_27833
import sciunit from sciunit.scores import BooleanScore # import morphounit.capabilities as cap import morphounit.plots as plots import os from subprocess import call import shlex import json from datetime import datetime import matplotlib.backends.backend_pdf from neurom.apps.cut_plane_detection import find_cut_plane...
the-stack_106_27834
# coding: utf-8 """ Talon.One API The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #...
the-stack_106_27835
from __future__ import unicode_literals import re from setuptools import find_packages, setup def get_version(filename): with open(filename) as fh: metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", fh.read())) return metadata['version'] setup( name='Mopidy-FrontPanel', version=get...
the-stack_106_27837
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # michael a.g. aïvázis # orthologue # (c) 1998-2018 all rights reserved # """ Build and test a simple tokenizer """ def test(): import pyre.parsing COMMENT = r"#" SEPARATOR = r":" class Simple(pyre.parsing.scanner): """a simple scanner""" ...
the-stack_106_27838
from netapp.netapp_object import NetAppObject class SecurityLoginGetIterKeyTd(NetAppObject): """ Key typedef for table login_rbac_zapis """ _key_3 = None @property def key_3(self): """ Field authmethod """ return self._key_3 @key_3.setter def key_3(s...
the-stack_106_27839
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Created on Fri Aug 9 14:01:22 2019 @author: cherrabi """ from P2N_Lib import GenereListeFichiers # import from P2N_Config import LoadConfig # import os # importation de la bibliothèque os qui sert à from textblob import TextBlob # importation de...
the-stack_106_27840
#!/usr/bin/env python # --coding:utf-8-- # Copyright (c) 2020 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License, # attached with Common Clause Condition 1.0, found in the LICENSES directory. import sys import os from datetime import date current_dir = os.path.dirname(os.path...
the-stack_106_27841
#!/usr/bin/python """ IOC Report Configuration File """ # VirusTotal configurations vt_api_key = '' # Hybrid-Analysis configurations ha_api_key = '' ha_secret_key = '' # These settings are used to create the reports. File paths should be entered # as the absolute path. input_file = 'sample_resources.txt' c...
the-stack_106_27843
""" ============ Boxplot Demo ============ Example boxplot code """ import numpy as np import matplotlib.pyplot as plt # Fixing random state for reproducibility np.random.seed(19680801) # fake up some data spread = np.random.rand(50) * 100 center = np.ones(25) * 50 flier_high = np.random.rand(10) * 100 + 100 flier_...
the-stack_106_27844
from __future__ import print_function import sys sys.path.append(r"../..") from pymdwizard.gui import fgdc_date def test_single_date_setgetdate(qtbot): widget = fgdc_date.FGDCDate() qtbot.addWidget(widget) widget.ui.fgdc_caldate.setText('1234') assert widget.get_date() == '1234' widget.set_date...
the-stack_106_27845
# -*- coding: utf-8 -*- # Author: Your Name <your@email.com> import argparse import os import tensorflow as tf from tensorpack import * """ This is a boiler-plate template. All code is in this file is the most minimalistic way to solve a deep-learning problem with cross-validation. """ BATCH_SIZE = 16 SHAPE = 28 CH...
the-stack_106_27848
# (c) 2019 Piotr Wojciechowski (@wojciechowskipiotr) <piotr@it-playground.pl> # (c) Thierry Bouvet (@tbouvet) # 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 import json from time impo...
the-stack_106_27851
"""Template for the build file used in android_sdk_repository.""" # Copyright 2016 The Bazel 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.ap...
the-stack_106_27852
# Copyright (c) 2020 PaddlePaddle 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 appli...
the-stack_106_27854
"""jase_im URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
the-stack_106_27855
""" Collection of functions to perform CRUD operations on a database in the background """ from operator import index import yfinance as yf import pandas as pd from flask import Flask import os import sys from models import db from models import (Security, Transaction, Broker, Event, CryptoCurren...
the-stack_106_27860
# standard library from datetime import datetime, date # Django from django.contrib import messages from django.contrib.auth.decorators import login_required, user_passes_test from django.http import JsonResponse, HttpResponseRedirect from django.shortcuts import render, redirect from django.urls import reverse, rever...
the-stack_106_27861
import math import torch from torch import nn from torch.nn.parameter import Parameter from torch.nn import init from torch.autograd import Function import _torch_ipex as core class IpexMLPHandle: def __init__(self, N, C, K, bn, bc, bk, dtype, fuse_bias, act_type): self.handle = core.mlp_create_handle(N, C...
the-stack_106_27862
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Copyright (c) 2011-2018, wradlib developers. # Distributed under the MIT License. See LICENSE.txt for more info. import numpy as np import wradlib.ipol as ipol import wradlib.georef as georef import unittest import warnings class InterpolationTest(unittest....
the-stack_106_27864
"""Store constants.""" import voluptuous as vol import re import homeassistant.util.dt as dt_util from homeassistant.helpers import config_validation as cv from homeassistant.const import ( WEEKDAYS, ATTR_ENTITY_ID, SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET, ATTR_SERVICE, ATTR_SERVICE_DATA,...
the-stack_106_27865
""" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0 """ from cfnlint.rules import CloudFormationLintRule from cfnlint.rules import RuleMatch class Configuration(CloudFormationLintRule): """Check if Parameters are configured correctly""" id = 'E2001' shortd...
the-stack_106_27866
## Brian Blaylock ## April 28, 2021 import warnings import configparser from pathlib import Path warnings.warn( "The hrrrb API is deprecated. Use the new Herbie API instead.", DeprecationWarning ) ######################################################################## # Load custom xarray accessors t...
the-stack_106_27868
""" Dataset setting and data loader for MNIST. Adapted from https://github.com/corenel/pytorch-adda/tree/master/datasets """ import torch from torchvision import datasets, transforms import numpy as np def get_mnist_shift(train, batch_size=32, drop_last=True, num_channel=3, image_size=28, total_s...
the-stack_106_27869
import sqlite3 import os import json import pandas.io.sql as sqlio class MapDb(object): def __init__(self, folder="./db"): self.conn_str = os.path.join(folder, 'dublin-bus.sqlite') def connect(self): return sqlite3.connect(self.conn_str, check_same_thread=False) def disconnect(self): ...
the-stack_106_27870
from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass from queue import Queue from typing import Any, Dict, List, Tuple, Callable, Union import numpy as np import torch import torch.distributed as dist from torch.utils.data.dataset import IterableDataset from transformers import BertToken...
the-stack_106_27871
import requests import networkx as nx import matplotlib.pyplot as plt from pyvis.network import Network import numpy as np from Graph import * import os import re class Crawler(Graph): # Constructor def __init__(self, template, root_page): self.template = template self.root_page = root_page ...
the-stack_106_27872
# 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 u...
the-stack_106_27874
#!/usr/bin/env python3 # Copyright 2021-2022 Efabless 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 ap...
the-stack_106_27877
""" In this code we include a lightweight adaption algorithm for dominating relationships computing. The code is adapted from Networkx Please see the original one at https://networkx.org/documentation/stable/_modules/networkx/algorithms/dominance.html#dominance_frontiers TODO: implement a datastructure such as G from ...
the-stack_106_27878
import random from sklearn.feature_extraction.text import CountVectorizer from sklearn.neighbors import NearestNeighbors from flask import Flask, request, render_template import cloudpickle app = Flask(__name__, template_folder="templates") with open("model.pkl", "rb") as f: model = cloudpickle.load(f) @app.rout...
the-stack_106_27879
# -*- coding: utf-8 -*- # @Time : 2020/6/16 23:51 # @Author : zonas.wang # @Email : zonas.wang@gmail.com # @File : inference.py import math import os import os.path as osp import time import tensorflow as tf import cv2 import numpy as np import pyclipper from shapely.geometry import Polygon from tqdm import t...
the-stack_106_27880
''' DDS: DDS image loader ''' __all__ = ('ImageLoaderDDS', ) from kivy.lib.ddsfile import DDSFile from kivy.logger import Logger from kivy.core.image import ImageLoaderBase, ImageData, ImageLoader class ImageLoaderDDS(ImageLoaderBase): @staticmethod def extensions(): return ('dds', ) def load(...
the-stack_106_27884
"""methods/crf CRF module """ import sys import os import pycrfsuite from kleis.config.config import MODELS_PATH from kleis.resources import dataset as kl def crf_preprocess_candidates(candidates): """Receive annotated candidates and return features and labels list""" features = [] labels = [] f...
the-stack_106_27887
from collections import defaultdict, OrderedDict import csv import logging import os import arff import pandas as pd class AlgorithmSelectionProblem(object): def __init__(self, directory): self.logger = logging.getLogger(__name__) # Create data structures self.dir_ = directory se...
the-stack_106_27888
from modules.content import * def sort_base_by_number(data_base): data_base = sorted(data_base) return data_base class User: def __init__(self, telegram_id, username, number=None, name=None, sex=None, email=None, phone_number=None, answers=None): self.base_file = USERS_FILE_PATH...
the-stack_106_27891
class Pessoa: def __init__(self, nome=None, idade=35): self.idade = idade self.nome = nome def cumprimentar(self): return f'Ola {id(self)}' if __name__ == '__main__': p = Pessoa('Renato') print(Pessoa.cumprimentar(p)) print(id(p)) print(p.cumprimentar())...
the-stack_106_27893
#!/usr/bin/env python try: from shlex import quote except ImportError: from pipes import quote import subprocess import shlex import datetime from time import sleep # import virtkey import os def run_cmd(cmd, cwd=None, timeout=None, shell=False): if shell: ccmd = cmd else: ccm...
the-stack_106_27894
import hlir import utils import expr import vmcall import dataflow import addressdispenser ########################################################################### # HLIR REWRITES BELOW # undo the compiler optimization which turns individual returns into jumps to # a common return BB def duplicate_terminating_...
the-stack_106_27897
def get_anchor_root(spec, state): anchor_block_header = state.latest_block_header.copy() if anchor_block_header.state_root == spec.Bytes32(): anchor_block_header.state_root = spec.hash_tree_root(state) return spec.hash_tree_root(anchor_block_header) def add_block_to_store(spec, store, signed_block...
the-stack_106_27898
""" The molten web framework is automatically traced by ``ddtrace`` when calling ``patch``:: from molten import App, Route from ddtrace import patch_all; patch_all(molten=True) def hello(name: str, age: int) -> str: return f'Hello {age} year old named {name}!' app = App(routes=[Route('/hello/{...
the-stack_106_27899
"""Run-time calculation of offset into Python string structure Does a scan to find the digits of pi in a string structure in order to produce an offset that can be used to produce data-pointers from Python strings. Porting note: Currently this uses id( str a ) to get the base address of the Python strin...
the-stack_106_27901
import tensorflow as tf import common no_such_word = 'NOSUCH' no_such_composite = no_such_word + ',' + no_such_word + ',' + no_such_word class PathContextReader: # 这个类很关键 class_word_table = None class_target_word_table = None class_path_table = None def __init__(self, word_to_index, target_word...
the-stack_106_27904
import sys import click from json import loads import codecs from ocrd import Resolver, Workspace from ocrd.task_sequence import ProcessorTask, validate_tasks from ocrd_utils import initLogging, parse_json_string_or_file from ocrd_validators import ( OcrdToolValidator, OcrdZipValidator, PageValidator, ...
the-stack_106_27905
''' show_ospf.py IOSXE parsers for the following show commands: * show ip ospf * show ip ospf interface * show ip ospf interface {interface} * show ip ospf sham-links * show ip ospf virtual-links * show ip ospf neighbor detail * show ip ospf neighbor * show ip ospf neighbor {interface}...
the-stack_106_27907
import os import pickle import random import numpy as np class ReplayMemory: def __init__(self, capacity, seed): random.seed(seed) self.capacity = capacity self.buffer = [] self.position = 0 def push(self, state, action, reward, next_state, done): if len(self.buffer) < ...
the-stack_106_27908
""" Loading results, formatting and adding columns result is the raw result metric computed from predictions at the end the benchmark. For classification problems, it is usually auc for binomial classification and logloss for multinomial classification. score ensures a standard comparison between tasks: higher is alway...
the-stack_106_27909
# -*- encoding:utf-8 -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 8 _modified_time = 1350123761.8453729 _enable_loop = True _template_filename = '/home/smita/cyberweb/cyberweb/templates/gcem/gcem_sim_details.mako' _templat...
the-stack_106_27910
# -*- coding: utf-8 -*- from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter from matplotlib.colors import LinearSegmentedColormap import matplotlib.pyplot as plt import numpy as np import bbobbenchmarks #########User-configured Parameters: ...
the-stack_106_27914
import json import pytest from buildtrigger.test.githubmock import get_github_trigger from buildtrigger.triggerutil import ( SkipRequestException, ValidationRequestException, InvalidPayloadException, ) from endpoints.building import PreparedBuild from util.morecollections import AttrDict @pytest.fixture ...
the-stack_106_27915
# G 改 E, 实际上需要用G Block改出E block, 完成逆序对称,在同样位置还原style潜码 # 比第0版多了残差, 每一层的两个(conv/line)输出的w1和w2合并为1个w # 比第1版加了要学习的bias_1和bias_2,网络顺序和第1版有所不同(更对称) # 比第2版,即可以使用到styleganv1,styleganv2, 不再使用带Equalize learning rate的Conv (这条已经废除). 以及Block第二层的blur操作 # 改变了上采样,不在conv中完成 # 改变了In,带参数的学习 # 改变了了residual,和残差网络一致,另外旁路多了conv1处理通道和In学习参数 ...
the-stack_106_27916
import math from machine import PWM, Pin from .pca9685 import PCA9685 def map_angle(x, in_min, in_max, out_min, out_max): return int((x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min) class Servo: """ A abstract base class for controlling hobby servos. Parent classes must implement th...
the-stack_106_27918
# Given a binary tree, find the second largest # node in it class Node: def __init__(self, data): self.data = data self.left = None self.right = None def find_largest(root): current = root while current is not None: if current.right is not None: return current.right.data ...
the-stack_106_27922
import numpy as np from ann import NeuralNetwork # input x = np.array([ [30, 40, 50], [40, 50, 20], [50, 20, 15], [20, 15, 60], [15, 60, 70], [60, 70, 50] ], dtype=np.float64) # Expected output y = np.array([20, 15, 60, 70, 50, 40], dtype=np.float64) def main(): size_of_learn_sample = i...
the-stack_106_27924
# Authors: Manoj Kumar # Thomas Unterthiner # License: BSD 3 clause import scipy.sparse as sp import numpy as np from .fixes import sparse_min_max, bincount from .sparsefuncs_fast import csr_mean_variance_axis0 as _csr_mean_var_axis0 from .sparsefuncs_fast import csc_mean_variance_axis0 as _csc_mean_var_axis...
the-stack_106_27925
# -*- coding: utf-8 -*- ''' Created on 2018. 9. 24. @author: jason96 Apply Gini Impurity ''' import pandas as pd from graphviz import Digraph import os import operator import numpy as np raw_data = { 'name': ["Kang", "Kim", "Choi", "Park", "Yoon"], '짱절미': [True, False, False, False, False], '셀스타그램': [F...
the-stack_106_27926
from django.db import models from core.utils import validate_slug from labour.models import ObsoleteSignupExtraBaseV1 SHIRT_SIZES = [ ('NO_SHIRT', 'Ei paitaa'), ('XS', 'XS Unisex'), ('S', 'S Unisex'), ('M', 'M Unisex'), ('L', 'L Unisex'), ('XL', 'XL Unisex'), ('XXL', 'XXL Unisex'), (...
the-stack_106_27929
# coding: utf-8 # /*########################################################################## # Copyright (C) 2016 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # i...
the-stack_106_27932
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: char-rnn.py # Author: Yuxin Wu import argparse import numpy as np import operator import os import sys from collections import Counter import tensorflow as tf from tensorpack import * from tensorpack.tfutils import optimizer, summary from tensorpack.tfutils.gradpr...
the-stack_106_27935
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: i2cy(i2cy@outlook.com) # Filename: remote_controller # Created on: 2020/9/17 """ WARNING: INTERNAL NETWORK USE ONLY WARNING: INTERNAL NETWORK USE ONLY WARNING: INTERNAL NETWORK USE ONLY """ import socket import time import os import threading LI...
the-stack_106_27936
import copy import itertools import warnings import torch import torch.nn as nn import torch.nn.quantized as nnq from torch.nn.intrinsic import _FusedModule from .quantization_mappings import ( get_default_dynamic_quant_module_mappings, get_default_static_quant_module_mappings, get_default_qat_module_mapp...
the-stack_106_27939
# Short-term MFCC Cepstrum Distance # pr6_5_3 from MFCC import * from Noisy import * from Universal import * from VAD import * if __name__ == '__main__': # Set_I IS = 0.25 # unvoice segemnt length wlen = 200 # frame length 25ms inc = 80 # frame shift filename = 'bluesky1.wav' SNR = 10 # PART_I speech = S...
the-stack_106_27941
#!/usr/bin/python import os import re import sys import csv import json import pandas import installLib requiredConfigParameters = ["dataFolder"] # Load the configuration file. config = json.loads(installLib.readFile("config/config.json")) for requiredConfigParameter in requiredConfigParameters: if not requiredConf...
the-stack_106_27942
# -*- coding: utf-8 -*- import argparse from multiprocessing import cpu_count from ncc import LOGGER try: from dataset.codesearchnet_feng.proj_oriented import ( LANGUAGES, MODES, RAW_DATA_DIR, RAW_PROJ_DATA_DIR, LIBS_DIR, FLATTEN_PROJ_DATA_DIR, ) except ImportError: from . import ...
the-stack_106_27943
"""Support for Xiaomi aqara binary sensors.""" import logging from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platfor...
the-stack_106_27944
from floppy.graph import Graph from floppy.floppyUi import Painter2D, MainWindow import sys from PyQt5.QtWidgets import QApplication import argparse import logging logger = logging.getLogger('Floppy') logger.setLevel(logging.DEBUG) fh = logging.FileHandler('floppy.log') fh.setLevel(logging.DEBUG) formatter = logging.F...
the-stack_106_27946
__version__ = "1.0.0" __author__ = "Akhier Dragonheart" __license__ = "MIT" import json import pygame def get_spritesheet(jsonpath): """Get a spritesheet through data stored in a json file This function expects all sprites to be the same size. Along with that it needs your json file to be formated like...
the-stack_106_27947
from django.conf.urls import include, patterns, url from django.conf import settings from django.contrib import admin from django.contrib.auth.decorators import login_required from django.views.i18n import javascript_catalog from django.views.decorators.cache import cache_page from django.views.generic.base import Redi...
the-stack_106_27948
""" Utility for generating grids of plots. """ import os import math import itertools from typing import Any, Callable, Optional import matplotlib.pyplot as plt # type: ignore from experiment_utils.plotting.defaults import DEFAULT_SETTINGS def try_cell_row_col( value_dict: dict, row: Any, col: Any, default_va...
the-stack_106_27954
from pytest import raises from mutmut import ( partition_node_list, name_mutation, Context, mutate) def test_partition_node_list_no_nodes(): with raises(AssertionError): partition_node_list([], None) def test_name_mutation_simple_mutants(): assert name_mutation(None, 'True') == 'Fa...
the-stack_106_27956
from __future__ import unicode_literals from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.db import models from django.utils import timezone from django.utils.encoding import python_2_unic...
the-stack_106_27959
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.common.exceptions import TimeoutException import time import re import json import config import utils # if you want to make this word on a system with no GUI, install Xvfb first and then uncomment these lines. # from pyvirtualdisplay import Disp...
the-stack_106_27962
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' import socket import sys sys.path.append('..') from common import send_msg, recv_msg PORT = 9090 with socket.socket() as sock: sock.bind(('', PORT)) sock.listen() print(f'Server: {sock.getsockname()}') while True: ...
the-stack_106_27964
#https://www.youtube.com/watch?v=jO6qQDNa2UY&ab_channel=TechWithTim #The mp3 files doesn't work import pygame #OS to help find the path to the assets import os pygame.font.init() pygame.mixer.init() #surface is like a Window in pygame WIDTH, HEIGHT = 900, 500 WIN = pygame.display.set_mode((WIDTH, HEIGHT)) pygame....
the-stack_106_27965
# Copyright (C) 2014 Christine Dodrill <xena@yolo-swag.com> All rights reserved. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of this software. # # Permission is granted to anyone to use this software...