filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_13960
# Crie um programa onde o usuario possa # digitar _sete valores numericos_ e # cadastre-os em uma _lista unica_ que mantenha # separados of valores _pares_ e _impares_ # No final, mostre os valores pares e impares # em ordem crescente print('Me de sete valores por favor') valores = [[], []] for num in range(7): val...
the-stack_0_13961
from enum import Enum from spectroscope.model.update import Action from spectroscope.model.database import RaiseUpdateKeys from spectroscope.module import ConfigOption, Plugin from spectroscope.constants import enums import spectroscope from typing import List from pymongo import MongoClient, UpdateOne, DeleteOne from...
the-stack_0_13962
from setuptools import setup, find_packages version = '5.3.4' setup( name="alerta-hipchat", version=version, description='Alerta plugin for HipChat', url='https://github.com/alerta/alerta-contrib', license='MIT', author='Nick Satterly', author_email='nick.satterly@theguardian.com', pa...
the-stack_0_13972
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import logging import math from typing import List import torch import torch.nn as nn import torch.nn.init as init from reagent.models.base import ModelBase logger = logging.getLogger(__name__) def gaussian_fill_w_gain(...
the-stack_0_13973
# qubit number=2 # total number=10 import pyquil from pyquil.api import local_forest_runtime, QVMConnection from pyquil import Program, get_qc from pyquil.gates import * import numpy as np conn = QVMConnection() def make_circuit()-> Program: prog = Program() # circuit begin prog += H(0) # number=1 p...
the-stack_0_13975
#!/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. """Setup for GTalk Pyauto tests.""" import os import sys def _SetupPaths(): """Setting path to find pyauto_functional.py.""" ...
the-stack_0_13976
# Copyright (C) 2009 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...
the-stack_0_13978
"""Get info from gce metadata and put it into grains store.""" from __future__ import print_function from __future__ import unicode_literals import json import six def _decode_list(data): """Decode list items from unicode to normal strings.""" ret = [] for item in data: if isinstance(item, six.t...
the-stack_0_13979
#!/usr/bin/env python # encoding: utf-8 import re import datetime def time_fix(time_string): now_time = datetime.datetime.now() if '分钟前' in time_string: minutes = re.search(r'^(\d+)分钟', time_string).group(1) created_at = now_time - datetime.timedelta(minutes=int(minutes)) return create...
the-stack_0_13980
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import re import glob def file_to_df(file_path): pattern = "genome=([a-zA-Z0-9]+)_.*_run=(\d+)" genome, run = re.search(pattern, file_path).groups() df = pd.read_csv(file_path) df["fracti...
the-stack_0_13983
def output(): print('\n'"Customer Code: ", a) print("Beginning Meter Reading: ", b) print("Ending Meter Reading: ", c) print("Gallons of Water Used: ", gallons_used) print("Amount Billed: $", bill,'\n') while True: a = input("Enter code:\n ") a = a.lower() #Changing the customer code t...
the-stack_0_13984
from django import template import datetime from website.models import * register = template.Library() # tag nay dung trong gio hang @register.simple_tag(takes_context=True) def get_image_product(context, id_product): product = Product.objects.get(id=id_product) if product.type_product == False: id_or...
the-stack_0_13985
''' Author: alex Created Time: 2020年08月20日 星期四 16时09分37秒 ''' import cv2 import numpy as np def remove_watermark(image, thr=200, convol=3): """ 简单粗暴去水印,可将将pdf或者扫描件中水印去除 使用卷积来优化计算 :param image: 输入图片,cv格式灰度图像 :param thr: 去除图片中像素阈值 :param convol: 卷积窗口的大小 :return: 返回np.array格式图片 """ ...
the-stack_0_13989
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_0_13991
import os import localstack_client.config # LocalStack version VERSION = '0.10.7' # constant to represent the "local" region, i.e., local machine REGION_LOCAL = 'local' # dev environment ENV_DEV = 'dev' # backend service ports, for services that are behind a proxy (counting down from 4566) DEFAULT_PORT_APIGATEWAY_B...
the-stack_0_13994
from PySide2.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QFileDialog, QWidget, QLabel, \ QListWidget, QListWidgetItem import os from custom_src.global_tools.Debugger import Debugger class SelectPackages_Dialog(QDialog): def __init__(self, parent, packages): super(SelectPackages_D...
the-stack_0_13995
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python import copy import json import logging import re from collections import OrderedDict from datetime import timedelta # OAuth2 from oauthlib import oauth2 from oauthlib.common import generate_token # Django from django.conf import settings from django....
the-stack_0_13999
import librosa import os import numpy as np import matplotlib.pyplot as plt from scipy.fftpack import dct from scipy.signal import spectrogram import operator import pickle import time import csv from random import shuffle import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim fr...
the-stack_0_14000
# coding=utf-8 # Copyright 2018 Hao Tan, Mohit Bansal, and the HuggingFace team # # 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 r...
the-stack_0_14002
# MenuTitle: Make Kerning Display # -*- coding: utf-8 -*- __doc__ = """ Open tab containing Kerning strings for the selected glyphs. """ import re from collections import defaultdict, OrderedDict try: from itertools import zip_longest except ImportError: from itertools import izip_longest as zip_longest from ...
the-stack_0_14007
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core import serializers from django.core.management import call_command from django.db import migrations, models import os fixture_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../fixtures')) def load_fixture(fixture_filename...
the-stack_0_14008
# Copyright 2021 Google LLC # # 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_0_14010
import os GRID_FOLDER = "gpw-v4-national-identifier-grid-rev11_30_sec_asc/" GRID_LOOKUP = "gpw_v4_national_identifier_grid_rev11_lookup.txt" DATA_FOLDER = os.path.expanduser("~") + "/.sedac_gpw_parser/" def id_lookup(searchterm, lookup_file=DATA_FOLDER+GRID_FOLDER+GRID_LOOKUP, verbose=True): succes...
the-stack_0_14011
# __author__ = 'ktc312' # -*- coding: utf-8 -*- # coding: utf-8 import urllib2 as ul from bs4 import BeautifulSoup import csv import os import pandas as pd import time import data_cleaning data_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'tw_perm_data_analysis/') # Construct the ...
the-stack_0_14012
# -*- coding: utf-8 -*- """ Created on Thu Nov 14 13:46:42 2019 @author: Zaki """ from sympy.parsing import sympy_parser from pint import UnitRegistry import numpy import sympy ureg = UnitRegistry() Q = ureg.Quantity LENGTH = '[length]' INDUCTANCE = '[length] ** 2 * [mass] / [current] ** 2 / [time] ** 2' CAPACITANC...
the-stack_0_14013
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ General utils_ """ import contextlib import glob import logging import math import os import platform import random import re import shutil import signal import time import urllib from itertools import repeat from multiprocessing.pool import ThreadPool from pathlib impor...
the-stack_0_14015
#! /usr/bin/env python # -*- coding: utf-8 -*- # Tom van Steijn, Royal HaskoningDHV import adopy import numpy as np import pytest import shutil import os @pytest.fixture def steadyflofile(tmpdir): datadir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data') flofilename = r'flairs.FLO' flof...
the-stack_0_14016
"""Test asyncpraw.models.user.""" import pytest from asynctest import mock from asyncpraw.exceptions import RedditAPIException from asyncpraw.models import Multireddit, Redditor, Subreddit from .. import IntegrationTest class TestUser(IntegrationTest): async def test_blocked(self): self.reddit.read_only...
the-stack_0_14019
#!/usr/bin/env python3 # Connect the ipad (ground station) to your computer and find the dji # go flight log. Upload that to https://www.phantomhelp.com/LogViewer, # download as csv and copy that next to the flight movie and srt file. # extract srt form of subtitles from dji movie (caption setting needs # to be turn...
the-stack_0_14021
# -*- coding: utf-8 -*- """ cannlytics.traceability..utils.utils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains general cannabis analytics utility functions. """ from datetime import datetime, timedelta from re import sub, findall def camelcase(string): """Turn a given string to CamelCase. Args: ...
the-stack_0_14023
# -*- coding: utf-8 -*- ''' noxfile ~~~~~~~ Nox configuration script ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import os import sys import glob import json import pprint import shutil import tempfile if __name__ == '__main__': sys.stderr.write('Do not execu...
the-stack_0_14024
# # Copyright (c) 2019-2020, NVIDIA 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 ag...
the-stack_0_14026
# -*- coding: utf-8 -*- # # websockets documentation build configuration file, created by # sphinx-quickstart on Sun Mar 31 20:48:44 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
the-stack_0_14028
from sqlalchemy.exc import IntegrityError from .. import auth from ..base_view import BaseView from ..collaborator.models import Collaborator from ..department.models import Department from ..dependent.models import Dependent from ..dependent.schemas import DependentsSchema from .schemas import CollaboratorSchema cl...
the-stack_0_14029
#!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/globocom/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com timehome@corp.globo.com from thumbor.filters import BaseFilter, filter_method from thumbor.e...
the-stack_0_14033
import pyrogram import asyncio import os from pyrogram import Client, filters from pyrogram.types import Message, User, InlineKeyboardMarkup, InlineKeyboardButton from donlee_robot.donlee_robot import DonLee_Robot from config import FORCE_CHANNEL, SAVE_USER, DEV_USERNAME, WELCOME_BUTTON_NAME, CUSTOM_WELCOME_TEXT, CUSTO...
the-stack_0_14034
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
the-stack_0_14037
# Given a binary search tree and a node in it, find the in-order successor of that node in the BST. # # The successor of a node p is the node with the smallest key greater than p.val. # # Input: root = [2, 1, 3], p = 1 # Output: 2 # Explanation: 1 # 's in-order successor node is 2. Note that both p and the return value...
the-stack_0_14038
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT """ import pytest import os import sys from ly_test_tools.o3de.editor_test import EditorTestSuite sys.path.append...
the-stack_0_14039
from sympy.core.expr import unchanged from sympy.sets import (ConditionSet, Intersection, FiniteSet, EmptySet, Union, Contains, ImageSet) from sympy.core.function import (Function, Lambda) from sympy.core.mod import Mod from sympy.core.numbers import (oo, pi) from sympy.core.relational import (Eq, Ne) from sympy.co...
the-stack_0_14040
class Piece: def __init__(self, piece_type, piece_colour, piece_name, xy = None): assert piece_colour.lower() in ['black', 'white'], 'Invalid colour' assert piece_type.lower() in ['pawn', 'bishop', 'rook', 'knight', 'king', 'queen'], 'Invalid piece_type' self.type = piece_type self.colour = piece_colour self...
the-stack_0_14042
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
the-stack_0_14044
import unittest from slack_sdk.http_retry import RateLimitErrorRetryHandler from slack_sdk.scim import SCIMClient from tests.slack_sdk.scim.mock_web_api_server import ( setup_mock_web_api_server, cleanup_mock_web_api_server, ) from ..my_retry_handler import MyRetryHandler class TestSCIMClient(unittest.TestCa...
the-stack_0_14046
import os import pyttsx3 import pyaudio import speech_recognition as sr assistente = pyttsx3.init() recon = sr.Recognizer() inpvoz = "" def retorno(frase): assistente.say(frase) assistente.setProperty("voice", b"brasil") assistente.setProperty("rate", 210) assistente.setProperty("volu...
the-stack_0_14047
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
the-stack_0_14051
""" snp2counts.py - count number SNPs in geneset ============================================ :Tags: Python Purpose ------- read a list of genomic point locations (SNPs) and count the number of SNPs falling in pre-defined windows. The windows are given in gtf format. .. note:: The script will be able to count ...
the-stack_0_14052
# coding=utf-8 __author__ = "Dimitrios Karkalousos" from typing import Union import torch from torch import nn from mridc import ifft2c, complex_mul, complex_conj from .e2evn import SensitivityModel from .rim.rim_block import RIMBlock from ..data.transforms import center_crop_to_smallest class CIRIM(nn.Module): ...
the-stack_0_14053
#!/usr/bin/env python ############################################################################## # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompani...
the-stack_0_14054
# -*- coding: utf-8 -*- import unittest from openprocurement.api.constants import SANDBOX_MODE from openprocurement.api.tests.base import snitch from openprocurement.tender.belowthreshold.tests.base import test_organization from openprocurement.tender.belowthreshold.tests.contract import ( TenderContractResourceT...
the-stack_0_14055
"""expand content column Revision ID: 6dd556a95d2b Revises: 599d269adf7f Create Date: 2020-10-19 18:21:14.384304 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = '6dd556a95d2b' down_revision = '599d269adf7f' branch_labels = N...
the-stack_0_14056
import csv import logging import zipfile from sqlalchemy.orm import sessionmaker from opennem.db import db_connect from opennem.utils.pipelines import check_spider_pipeline logger = logging.getLogger(__name__) class TableRecordSplitter(object): @check_spider_pipeline def process_item(self, item, spider): ...
the-stack_0_14059
import argparse import os from PIL import Image import numpy as np import torch from torchvision.transforms import Compose, Resize, ToTensor, Normalize # import lung_segmentation.importAndProcess as iap import importAndProcess as iap from ..models import model as model from ..models.unet_models import unet11, unet16 ...
the-stack_0_14060
# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
the-stack_0_14064
import re import copy from epjson_handler import EPJSON from expand_objects import ExpandObjects, ExpandThermostat, ExpandZone, ExpandSystem, ExpandPlantLoop, \ ExpandPlantEquipment from custom_exceptions import InvalidTemplateException, InvalidEpJSONException, PyExpandObjectsYamlStructureException class HVACTemp...
the-stack_0_14065
from __future__ import print_function import pandas as pd from sklearn.model_selection import train_test_split from keras_text_summarization.library.utility.plot_utils import plot_and_save_history from keras_text_summarization.library.seq2seq import Seq2SeqSummarizer from keras_text_summarization.library.applications....
the-stack_0_14067
# -*- coding: utf-8 -*- # # Copyright 2016 SUSE LLC # # 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_0_14068
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ fMRIprep base processing workflows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. autofunction:: init_fmriprep_wf .. autofunction:: init_single_subject_wf """ import sys import os from copy import deepcopy f...
the-stack_0_14069
from django.urls import path from apps.superbonus import views urlpatterns = [ path('', views.app, name='bonus-app-view'), path('add-condo', views.add_condo, name='bonus-add-condo'), path('add-villa', views.add_villa, name='bonus-add-villa'), path('interventions/<int:id>', views.interventions, nam...
the-stack_0_14070
''' Template tags for Stripe Non PCI Complaince ''' from django import template from django.template.loader import render_to_string register = template.Library() class StripeNode(template.Node): def __init__(self, integration): self.integration = template.Variable(integration) def render(self, contex...
the-stack_0_14071
import torch import torchaudio import pytorch_lightning as pl from torch.utils.data import DataLoader from utils.config import config from typing import Optional from transforms.audio import RandomSoxAugmentations, NoSoxAugmentations from transforms.mfsc import ToMelSpec, SpecAug from dataset.test_dataset import SimClr...
the-stack_0_14072
# -*- coding: utf-8 -*- import random from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core.management.base import BaseCommand from django.db import transaction from allauth.account.models import EmailAddress from datetime import da...
the-stack_0_14073
# Tic Tac Toe import random def drawBoard(board): # This function prints out the board that it was passed. print(' | |') print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9]) print(' | |') print('-----------') print(' | |') print(' ' + board[4] + ' | ' + board[5] + ' | ' ...
the-stack_0_14075
"""Tests for `inne` package.""" import time from unittest.mock import Mock, patch import numpy as np import pytest from inne import IsolationNNE from scipy.sparse import csc_matrix, csr_matrix from sklearn.datasets import (load_diabetes, load_digits, load_iris, make_blobs, make_moons) f...
the-stack_0_14078
import copy import six import sqlalchemy.pool from .pool import DjangoQueuePool class DjangoPoolParams(object): _slow_and_safe = { 'django_pool_class': sqlalchemy.pool.QueuePool, # sqlalchemy's builtin queue pool class 'django_pre_ping': True, ...
the-stack_0_14080
""" This file is uses slightly modified code from pyDRMetrics [1]_, see: - https://doi.org/10.1016/j.heliyon.2021.e06199 - the article. - https://data.mendeley.com/datasets/jbjd5fmggh/1 - the supplementary files. The following changes have been made: - :mod:`numba` JIT for performance reasons - use b...
the-stack_0_14082
# -*- coding: utf-8 -*- import json import threading from plexapi import log class AlertListener(threading.Thread): """ Creates a websocket connection to the PlexServer to optionally receive alert notifications. These often include messages from Plex about media scans as well as updates to currently runn...
the-stack_0_14085
# 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_0_14087
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Copyright (c) 2017-2019 The Raven Core developers # Copyright (c) 2020-2021 The Hive Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ""...
the-stack_0_14088
# 导入类 from collections import OrderedDict # 创建有序空字典 glossary = OrderedDict() # 给有序空字典添加键-值对 glossary['print'] = '打印' glossary['title'] = '首字母大写' glossary['lower'] = '全部小写' glossary['upper'] = '全部大写' glossary['str'] = '字符串' glossary['key'] = '键' glossary['value'] = '值' glossary['items'] = '项目' glossary['sorted'] = '排序...
the-stack_0_14091
class Solution: def floodFill(self, grid, sr, sc, newColor): m, n = len(grid), len(grid[0]) self.target = grid[sr][sc] def dfs(x, y): grid[x][y] = newColor for i, j in [(1, 0), (-1, 0), (0, 1), (0, -1)]: if (0 <= x + i < m and 0 <= y + j < n) and gri...
the-stack_0_14092
''' snpPriority.py - score SNPs based on their LD score and SE weighted effect sizes =============================================================================== :Author: Mike Morgan :Release: $Id$ :Date: |today| :Tags: Python Purpose ------- .. Score SNPs based on their LD score and SE weighted effect sizes from...
the-stack_0_14093
""" track, part of glbase """ import pickle, sys, os, struct, math, sqlite3, zlib, time, csv, zlib from operator import itemgetter from .progress import progressbar from .errors import AssertionError from .location import location from . import genelist as Genelist from . import utils, config from .data import po...
the-stack_0_14095
from __future__ import unicode_literals import datetime import decimal import itertools from wtforms import widgets from wtforms.compat import text_type, izip from wtforms.i18n import DummyTranslations from wtforms.validators import StopValidation from wtforms.utils import unset_value __all__ = ( 'BooleanField'...
the-stack_0_14097
import os import sys from datetime import datetime import logging import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, random_split from torch.utils.tensorboard import SummaryWriter import torchvision.transforms as transforms from models...
the-stack_0_14098
import torch from gaussed.distribution.base import Distribution from gaussed.utils.lin_alg_solvers import DefaultSolver class GP(Distribution): def __init__(self, mean, kernel, solver=DefaultSolver()): self.mean = mean self.kernel = kernel self.solver = solver self.dim = self.ke...
the-stack_0_14099
import numpy as np import pytest import pandas as pd from pandas import Series import pandas._testing as tm from pandas.core.api import Float64Index def test_get(): # GH 6383 s = Series( np.array( [ 43, 48, 60, 48, ...
the-stack_0_14100
frase = str(input('Digite uma Frase: ')).strip().upper() palavras = frase.split() junto = ''.join(palavras) inverso = '' #para cada letra no Range, a gente ta pegando o valor total menos 1 pra corrigir; invertido; fazendo vir no caminho oposto. for letra in range(len(junto) - 1, -1, -1): inverso += junto[letra] pri...
the-stack_0_14101
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_0_14104
import os print("Starting Capsian Setup Tool...") print("This script will install all the dependencies you need") input("Press enter to continue or close to terminate ") _pip_type = "pip" if os.name == "posix": _pip_type = "pip3" os.system(_pip_type + " install pyglet==1.5.6") os.system(_pip_type + " install PyO...
the-stack_0_14105
# Copyright (c) MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
the-stack_0_14106
''' test_dnssec_nsecx - Tests NSECx support routines. .. Copyright (c) 2015 Neustar, Inc. All rights reserved. .. See COPYRIGHT.txt for full notice. See LICENSE.txt for terms and conditions. ''' # pylint: skip-file import dns.rdatatype import dns_sprockets_lib.dnssec_nsecx as nsecx def test_encode_salt(): t...
the-stack_0_14107
from setuptools import setup version = '0.0.0' setup( name = 'grid-plot', version = version, description = 'Plots data onto a grid.', url = 'http://github.com/doggan/grid-plot', license = 'MIT', author='Shyam Guthikonda', packages = ['grid_plot'], install_requires = [ 'Pillow ...
the-stack_0_14108
from datetime import datetime import numpy as np import csv from utils import total_gini import tensorflow.compat.v1 as tf import json from pgd_attack import LinfPGDAttack from utils_MLP_model import init_MLP_vars with open('config.json') as config_file: config = json.load(config_file) w_vars, b_vars, stable_var,...
the-stack_0_14113
# 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 # distributed under t...
the-stack_0_14114
import datetime import logging import os from itertools import groupby from math import ceil from django.db.models import Max from django.db.models import Sum from le_utils.constants import content_kinds from sqlalchemy import and_ from sqlalchemy import cast from sqlalchemy import exists from sqlalchemy import false ...
the-stack_0_14115
""" Evo-LeViT in PyTorch A PyTorch implement of Evo-LeViT as described in 'Evo-ViT: Slow-Fast Token Evolution for Dynamic Vision Transformer' The code is modified from LeViT as described in 'LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference' - https://arxiv.org/abs/2104.01136 The official ...
the-stack_0_14120
# encoding:utf-8 import sys sys.path.append("..") from mf import MF from utility.matrix import SimMatrix from utility.similarity import cosine_sp class ItemCF(MF): """ docstring for ItemCF implement the ItemCF Sarwar B, Karypis G, Konstan J, et al. Item-based collaborative filtering recommendation ...
the-stack_0_14121
#!/usr/bin/env python import json import os import requests from typing import List, Dict from typing_extensions import Final # 1 page fetches 100 proposals. Remember to increment the number below periodically # to match the number of currently open proposals on # https://github.com/godotengine/godot-proposals/issue...
the-stack_0_14122
# 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_0_14127
__title__ = 'splitwise' __description__ = 'Splitwise Python SDK' __version__ = '2.2.0' __url__ = 'https://github.com/namaggarwal/splitwise' __download_url__ = 'https://github.com/namaggarwal/splitwise/tarball/v'+__version__ __build__ = 0x022400 __author__ = 'Naman Aggarwal' __author_email__ = 'aggarwal.nam@gmail.com' _...
the-stack_0_14131
# Copyright 2020 PerfKitBenchmarker 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_0_14133
#!/usr/bin/env python3 import rich.markup from pwncat.db import Fact from pwncat.modules import ModuleFailed from pwncat.platform.windows import Windows, PowershellError from pwncat.modules.enumerate import EnumerateModule class InstalledProgramData(Fact): def __init__(self, source, path: bool): super(...
the-stack_0_14134
from keras.models import Sequential from keras.layers.core import Dense, Activation, Flatten, Dropout from keras.layers.embeddings import Embedding # from keras import optimizers from preprocess.unsw import generate_dataset from netlearner.utils import quantile_transform import numpy as np generate_dataset(one_hot_enc...
the-stack_0_14136
#encoding:utf-8 import datetime import csv import logging from multiprocessing import Process import time import yaml from croniter import croniter from supplier import supply logger = logging.getLogger(__name__) def read_own_cron(own_cron_filename, config): with open(own_cron_filename) as tsv_file: ...
the-stack_0_14138
__author__ = 'Lambert Justo' import glob # for getting botcogs import discord from discord.ext import commands #import schmoobot.src.credentials as credentials import credentials from botcogs.utils import check #from schmoobot.src.botcogs.utils import check bot_prefix = "!" formatter = commands.HelpFormatter...
the-stack_0_14141
from SeismicReduction import * set_seed(42) # set seed to standardise results ### Data loading: dataholder = DataHolder("Glitne", [1300, 1502, 2], [1500, 2002, 2]) dataholder.add_near('./data/3d_nearstack.sgy'); dataholder.add_far('./data/3d_farstack.sgy'); dataholder.add_horizon('./data/Top_Heimdal_subset.txt') ###...
the-stack_0_14142
import gdb.printing class SmallStringPrinter: """Print an llvm::SmallString object.""" def __init__(self, val): self.val = val def to_string(self): begin = self.val['BeginX'] end = self.val['EndX'] return begin.cast(gdb.lookup_type("char").pointer()).string(length = end - begin) def display_h...
the-stack_0_14144
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import tqdm tqdm.monitor_interval = 0 # workaround for https://github.com/tqdm/tqdm/issues/481 class SimpleTqdm(): def __init__(self, iterable=None, total=None, **kwargs): self.iterable = list(iterable) if iterable is not...
the-stack_0_14151
# -*- coding: UTF-8 -*- # @Time : 04/02/2020 10:58 # @Author : BubblyYi # @FileName: seeds_net_data_provider_aug.py # @Software: PyCharm from torch.utils.data import Dataset from torch.utils.data import DataLoader import torch import pandas as pd import os import numpy as np import SimpleITK as sitk import random ...
the-stack_0_14153
import torch import os from skimage import io, transform from torch import nn, optim from torch.nn import functional as F from torchvision import datasets, transforms from torch.autograd import Variable from torchvision.utils import save_image import matplotlib.pyplot as plt import seaborn as sns from torch.nn.modules....