filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_23755
from decimal import Decimal from unittest.mock import Mock, patch import pytest from ...checkout.calculations import checkout_total from .. import ChargeStatus, GatewayError, PaymentError, TransactionKind, gateway from ..error_codes import PaymentErrorCode from ..interface import GatewayResponse, PaymentMethodInfo fr...
the-stack_106_23756
from gensim.models import KeyedVectors import numpy as np import sys import tqdm import copy import argparse if __name__ == '__main__': ''' ''' parser = argparse.ArgumentParser(description='Embedding similarity order generation') parser.add_argument("--w2v_emb_path", type=str, default="") parser.a...
the-stack_106_23759
from pathlib import Path import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.utils.data import torchvision import torchvision.models as models from tqdm.notebook import tqdm import math def find_lr( model, train_loader, optimize...
the-stack_106_23760
#!/usr/bin/env python # -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Package the game for distribution - make sure to configure project.json # Usage : Build.py <absolute-output-dir> # # Gwennaël Arbona 2021 #--------------------------------------------------...
the-stack_106_23761
''' ArpSpoofer.py by Amitai Farber 1/2021 This script prforming an arp spoofing on the local newtwork. It doing so by constantly sending 'is at' responses to the attacked computer with our mac and the desired IP, so that the attacked computer thinks that we are the ip we sent him. ''' from time import sleep import ar...
the-stack_106_23763
# encoding: utf-8 from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy as _ from userena.forms import SignupForm class SignupFormExtra(SignupForm): """ A form to demonstrate how to add extra fields to the signup form, in this case adding the ...
the-stack_106_23767
#!/usr/bin/env python3 # Copyright (c) 2015-2018 The Stancecoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Utilities for manipulating blocks and transactions.""" from .address import ( key_to_p2sh_p2wpk...
the-stack_106_23768
import multiprocessing as mp import os import time import traceback from datetime import datetime, timedelta from rlbot.botmanager.agent_metadata import AgentMetadata from rlbot.utils import rate_limiter from rlbot.utils.logging_utils import get_logger from rlbot.utils.structures.game_interface import GameInterface fr...
the-stack_106_23769
# coding: utf-8 # ----------------------------------------------------------------------------------- # <copyright company="Aspose Pty Ltd" file="Link.py"> # Copyright (c) 2003-2021 Aspose Pty Ltd # </copyright> # <summary> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this s...
the-stack_106_23770
class ConnectGame: def __init__(self, board): self.board = [row.replace(" ", "") for row in board.splitlines()] def get_winner(self): if self.is_winner("O"): return "O" elif self.is_winner("X"): return "X" else: return "" def is_winner(se...
the-stack_106_23772
import torch from torch.nn import Sequential as Seq, Linear as Lin, ReLU from torch_geometric.nn import PPFConv def test_point_conv(): in_channels, out_channels = (16, 32) edge_index = torch.tensor([[0, 0, 0, 1, 2, 3], [1, 2, 3, 0, 0, 0]]) num_nodes = edge_index.max().item() + 1 x = torch.randn((num_n...
the-stack_106_23774
import numpy as np import matplotlib.pyplot as plt # Compute the x and y coordinates for points on sine and cosine curves x = np.arange(0, 3 * np.pi, 0.1) y_sin = np.sin(x) y_cos = np.cos(x) # Set up a subplot grid that has height 2 and width 1, # and set the first such subplot as active. plt.subplot(3,1,1) # Make t...
the-stack_106_23775
"""Autoupdate older conda dependencies in the requirements section.""" from __future__ import absolute_import import collections import re import xml.etree.ElementTree as ET from galaxy.tool_util.deps import conda_util import planemo.conda from planemo.io import error, info def find_macros(xml_tree): """ G...
the-stack_106_23776
import os #from sys_config import BASE_DIR import matplotlib.pyplot as plt import seaborn as sns BASE_DIR = '../data/' # LIWC Lexicon http://lit.eecs.umich.edu/~geoliwc/LIWC_Dictionary.htm def load_liwc_lexicon(file): # returns LIWC in the form of a dictionary # keys: words, values: feature vector (list) ...
the-stack_106_23779
""" Google Text to Speech Available Commands: .tts LanguageCode as reply to a message .tts LangaugeCode | text to speak""" import asyncio import os import subprocess from datetime import datetime from gtts import gTTS from uniborg.util import admin_cmd @borg.on(admin_cmd("tts (.*)")) async def _(event): if event...
the-stack_106_23782
# 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_23783
""" Specification of IBM Q Rome """ #*************************************************************************************************** # Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). # Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain r...
the-stack_106_23788
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in th...
the-stack_106_23789
# coding=utf-8 # Copyright 2018 The Tensor2Tensor 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...
the-stack_106_23791
# A modification version from chainercv repository. # (See https://github.com/chainer/chainercv/blob/master/chainercv/evaluations/eval_detection_voc.py) from __future__ import division import os import torch import logging import numpy as np from tqdm import tqdm import pycocotools.mask as mask_util from mas...
the-stack_106_23792
import os import numpy as np from sklearn.cluster import KMeans from sklearn.decomposition import PCA from sklearn.manifold import TSNE import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler import pandas as pd import json def plot_3d(vector_array, save_plot_dir): """ Plot 3D vector ...
the-stack_106_23796
# Copyright 2018 Tensorforce Team. 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 la...
the-stack_106_23797
import re from urlparse import parse_qs, urlparse from pyquery import PyQuery as pq from django.conf import settings from django.core import mail from django.test import TransactionTestCase from frontend.models import EmailMessage from frontend.models import OrgBookmark from frontend.models import SearchBookmark fr...
the-stack_106_23800
""" Repeats the last word of the last message in the conversation, and use it in an annoying “C’est toi le” sentence. Installation ------------ You only have to load the plugin: .. code-block:: none /load stoi .. glossary:: /stoi **Usage:** ``/stoi`` """ from poezio.plugin import BasePlugin from ...
the-stack_106_23802
# warning: minified from struct import pack as F from functools import reduce G=lambda m,v:reduce(lambda i,j:i^j,[j*(v>>i&1) for i,j in enumerate(m)]) def make_zip(f,num_files,compressed_size): A,H,B,I,a,o=(1<<32)-1,num_files,compressed_size,[1<<A for A in range(33)],range(8),[0]*8 for n in a: for b in a:o[n...
the-stack_106_23803
import numpy as np import pandas as pd from typing import List from anndata import AnnData import logging logger = logging.getLogger("pegasus") def search_genes( data: AnnData, gene_list: List[str], rec_key: str = "de_res", measure: str = "percentage", ) -> pd.DataFrame: """Extract and display g...
the-stack_106_23804
# -*- coding: utf-8 -*- """Parser for Systemd journal files.""" from __future__ import unicode_literals import lzma from lz4 import block as lz4_block from dfdatetime import posix_time as dfdatetime_posix_time from plaso.containers import events from plaso.containers import time_events from plaso.lib import defini...
the-stack_106_23807
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class X(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "volume.slices" _path_str = "volume.slices.x" _valid_props = {"fill", "locations", "locationssrc",...
the-stack_106_23811
from django.core.management.base import BaseCommand from django.contrib.auth.management import create_permissions as _create_permissions from django_extensions.management.utils import signalcommand try: from django.apps import apps as django_apps get_models = lambda: None get_app = django_apps.get_app_con...
the-stack_106_23812
import time import numpy as np import torch import torch.nn as nn import open3d as o3d import h5py import math import sklearn import copy from sklearn.neighbors import KDTree from PIL import Image import matplotlib.pyplot as plt def show_point_cloud(src_, src_corr_, ref_, ref_corr_): src = src_.c...
the-stack_106_23815
import asyncio import pytest from peas.rpc.wallet_rpc_api import WalletRpcApi from peas.simulator.simulator_protocol import FarmNewBlockProtocol from peas.types.blockchain_format.coin import Coin from peas.types.blockchain_format.sized_bytes import bytes32 from peas.types.mempool_inclusion_status import MempoolInclus...
the-stack_106_23816
from __future__ import with_statement import json import logging import os import sys import textwrap from os.path import join, normpath from tempfile import mkdtemp import pretend import pytest from pip._internal.req.constructors import install_req_from_line from pip._internal.utils.misc import rmtree from tests.li...
the-stack_106_23818
import numpy as np import torch.utils.data as Data import torch from sklearn.decomposition import PCA import numpy as np import torch.utils.data as Data from scipy.special import comb # 排列组合中的组合公式 def f_k(dataSet, Labels, d, q): """ :param dataSet: 某一个样本的特征集 :param Labels: 某一个样本的标签集 :par...
the-stack_106_23820
# ======================================================================= # # Copyright (C) 2018, Hisilicon Technologies Co., Ltd. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1 Redistrib...
the-stack_106_23822
import json import logging from pathlib import Path from flow_py_sdk.cadence import Address from flow_py_sdk.signer import InMemorySigner, HashAlgo, SignAlgo log = logging.getLogger(__name__) class Config(object): def __init__(self, config_location: Path) -> None: super().__init__() self.access...
the-stack_106_23823
import torch as th from torch.autograd import Function def batch2tensor(batch_adj, batch_feat, node_per_pool_graph): """ transform a batched graph to batched adjacency tensor and node feature tensor """ batch_size = int(batch_adj.size()[0] / node_per_pool_graph) adj_list = [] feat_list = [] ...
the-stack_106_23824
""" " " Author: Maximilien Servajean - mservajean " Mail: servajean@lirmm.fr " Date: 04/01/2019 " " Description: The code to extract environmental tensors and environmental vectors given some environmental rasters. " """ import numpy as np import rasterio import re import warnings import matplotlib.pyplot as p...
the-stack_106_23825
import pytest from keybind import KeyBinder, configure_logging def test_basic(xlib_mock): configure_logging() xlib_mock.register_events([ (1, 'K'), (1, 'J'), (1, 'pass'), # captured, no handler (0, 'pass'), # non captured ]) pressed = [] with pytest.raises(Ind...
the-stack_106_23826
from sys import argv, stderr from pickle import dump from copy import copy if len(argv) != 4: stderr.write('USAGE: %s infobox_categories redirects ofile\n' % argv[0]) exit(1) info_categories = {w:c for w,c in [l.split('\t') for l in open(argv[1]).read().split('\n') if l != '']} redirects = {w:r for w,r in [l....
the-stack_106_23830
# # Copyright 2019 The FATE 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_23831
import tensorflow as tf from .configuration import get_defaults from .tfrecords_utils import read_tfrecords from . import utils def load_image(im_id, image_size, image_folder, image_format): """Resolve the correct image path from the given arguments. Args: im_id: image id saved in the tfrecords ...
the-stack_106_23832
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """Tests for the CPU topology emulation feature.""" import platform import re import pytest import framework.utils_cpuid as utils import host_tools.network as net_tools PLATFORM = platform.machine() def ...
the-stack_106_23833
# Lint as: python2, python3 # Copyright 2019 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 # ...
the-stack_106_23834
# coding=utf-8 from pyecharts.chart import Chart class Map(Chart): """ <<< 地图 >>> 地图主要用于地理区域数据的可视化。 """ def __init__(self, title="", subtitle="", **kwargs): super(Map, self).__init__(title, subtitle, **kwargs) def add(self, *args, **kwargs): self.__add(*args, **kwargs) ...
the-stack_106_23835
# coding: utf-8 """ Pure Storage FlashBlade REST 1.9 Python SDK Pure Storage FlashBlade REST 1.9 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/). OpenAPI spec version: 1.9 Contact: i...
the-stack_106_23836
from data.input_set import InputSet from data.point import Point class Configuration(object): def __init__(self): """ path params """ self.PATH = "/home/alex/Documents/Project/data/FRAME_DATABASES" self.PATH_LABELS = "/home/alex/Documents/Project/LSTM_labels/tiles" ...
the-stack_106_23837
#!/usr/bin/env python """ @package mi.dataset.parser.test @file mi-dataset/mi/dataset/parser/test/test_fuelcell_eng_dcl.py @author Chris Goodrich @brief Test code for the fuelcell_eng_dcl parser Release notes: initial release """ __author__ = 'cgoodrich' from mi.logging import log import os from nose.plugins.attrib...
the-stack_106_23838
## https://leetcode.com/problems/counting-bits/ ## for every number between 0 and N, count up the ## number of 1-bits in that number. I briefly tried ## writing this up more intelligently by iterating ## a number in binary up to N, but it wasn't quite ## working and it turns out the simple way (using ## built in ba...
the-stack_106_23840
import mock from pika import spec from pika import frame import time CHANNEL = mock.Mock('pika.channel.Channel') METHOD = spec.Basic.Deliver('ctag0', 1, False, 'exchange', 'routing_key') PROPERTIES = spec.BasicProperties(content_type='application/json', content_encoding='qux', ...
the-stack_106_23841
# Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # This file is licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # This f...
the-stack_106_23845
#!/usr/bin/env python3 def gen_uv(width, height, scale=1.0): w_inv = 1.0 / width h_inv = 1.0 / height uv = [] for h in range(height): for w in range(width): u = (w + 0.5) * w_inv * scale v = (h + 0.5) * h_inv * scale uv.append((u, v)) return uv if __n...
the-stack_106_23846
""" This module is going to parse ICR in JSON format and convert to html web page """ import json import argparse import os.path import cgi import logging import pprint from LogManager import logger, initConsoleLogging from ICRSchema import ICR_FILE_KEYWORDS_LIST, SUBFILE_FIELDS from ICRSchema import isSubFile, isWord...
the-stack_106_23848
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 VMware, 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/li...
the-stack_106_23849
# # @lc app=leetcode id=43 lang=python3 # # [43] Multiply Strings # # @lc code=start class Solution: def multiply(self, num1, num2): s = 0 for i in range(len(num1) - 1, -1, -1): p1 = 10 ** (len(num1) - 1 - i) for j in range(len(num2) - 1, -1, -1): p2 = 10 ** ...
the-stack_106_23851
#!/usr/bin/env python # ----------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ----------------------------------------------------------...
the-stack_106_23852
from __future__ import print_function import platform import socket import errno import os def get_input(): try: return raw_input() except NameError: return input() def set_bit(v, index, x): """ Set the index:th bit of v to x, and return the new value. Note that bit numbers (index)...
the-stack_106_23853
import numpy as np import pandas as pd import os.path as osp import statistics import torch from torch_geometric.datasets import TUDataset import torch_geometric.transforms as T import torch.nn.functional as F from torch_geometric.data import DataLoader, Dataset from optimal_R import option, all_possible_concatenati...
the-stack_106_23854
# -*- coding: utf-8 -*- from __future__ import unicode_literals import logging import os import sys import textwrap import mock import pytest import sh import dotenv from dotenv.compat import PY2, StringIO def test_set_key_no_file(tmp_path): nx_file = str(tmp_path / "nx") logger = logging.getLogger("dotenv...
the-stack_106_23855
#!/usr/bin/python2 # coding=utf8 import os import sys import json import requests import logging reload(sys) sys.setdefaultencoding('utf-8') logging.basicConfig(level=logging.INFO, format='%(asctime)s [%(levelname)s] %(message)s (%(filename)s:L%(lineno)d)', datefmt='%Y-%m-%d %H:...
the-stack_106_23857
# Copyright 2018 Google 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
the-stack_106_23861
#encoding=utf-8 import numpy as np import tensorflow as tf class SequenceTable: def __init__(self, data): # A TensorArray is required as the sequences don't have the same # length. Alternatively a FIFOQueue can be used. # Because the data is read more than once by the queue, # clear_after_read is s...
the-stack_106_23864
# a cursor is the object we use to interact with the database import pymysql.cursors # this class will give us an instance of a connection to our database class MySQLConnection: def __init__(self, db): # change the user and password as needed connection = pymysql.connect(host = 'localhost', ...
the-stack_106_23866
import os ALBUM_FIELD = "ALBUM: " ARTIST_FIELD = "ARTIST: " URL_FIELD = "URL: " SEPARATOR_FIELD = "SEPARATOR: " FORMAT_FIELD = "FORMAT: " TIME_TITLE_TYPE = "TIME->TITLE" TITLE_TIME_TYPE = "TITLE->TIME" class SongsInfoReader: track_list_file = "" def __init__(self, track_list_file: str): self.track_l...
the-stack_106_23867
# This advanced example can be used to compute a more precise reference_clock_speed. Use an # oscilloscope or logic analyzer to measure the signal frequency and type the results into the # prompts. At the end it'll give you a more precise value around 25 mhz for your reference clock # speed. import time from b...
the-stack_106_23868
import torch from torch import cuda from torch.nn import Module from torch.optim.optimizer import Optimizer from torch.utils.data.dataloader import DataLoader from . import BaseTrainer class StickModel(Module): def __init__( self, model: Module, loss_fn, optimizer:...
the-stack_106_23869
#!/usr/bin/env python u""" HDF5_cryosat_L1b.py (08/2020) Reads and Writes HDF5 files for CryoSat-2 Level-1b data products Supported CryoSat Modes: LRM, SAR, SARin, FDM, SID, GDR OUTPUTS a formatted HDF5 file with: Location: Time and Orbit Group Data: Measurements Group Geometry: External Corrections Group ...
the-stack_106_23871
# Copyright 2013-2022 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 RFlexclust(RPackage): """Flexible Cluster Algorithms. The main function kcca implemen...
the-stack_106_23872
#!/usr/bin/env python3 import unittest from collections import namedtuple from bunkai.algorithm.bunkai_sbd.annotator.emoji_annotator import EmojiAnnotator from bunkai.base.annotation import Annotations from .annotation_test_base import TestAnnotatorBase, TestInstance MorphResult = namedtuple("MorphResult", ("input_t...
the-stack_106_23873
#!/usr/bin/env python import argparse import errno import hashlib import os import shutil import subprocess import sys import tempfile from io import StringIO from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \ get_zip_name from lib.util import electron_gyp, execute, ge...
the-stack_106_23875
"""Support classes for dealing with text.""" from typing import Tuple, Union import gi from gaphas.canvas import instant_cairo_context from gaphas.freehand import FreeHandCairoContext from gaphas.geometry import Rectangle from gaphas.painter import CairoBoundingBoxContext from gaphor.core.styling import FontStyle, F...
the-stack_106_23877
__author__ = 'socuialmoneydev' from ConfigParser import SafeConfigParser import os.path import base64 class Connection(object): defaultApiKey = None defaultApiSecret = None defaultDomainName = None defaultProxyServer = None defaultProxyPort = None defaultConfigFilePath = os.path.join(os.path.d...
the-stack_106_23878
"""Example how to reproject by interpolation. """ import numpy as np from astropy.io import fits from astropy.wcs import WCS from wcsaxes import datasets from reproject.interpolation import reproject_celestial_slices # Test 2d interpolation, different frame, different projection hdu = datasets.msx_hdu() hdu.data[100...
the-stack_106_23879
import time from beeline_navigator import explore from natsort import natsorted from os import listdir from os.path import isfile, join def get_valid_wad_paths(wad_dir): all_files = [f for f in listdir(wad_dir) if isfile(join(wad_dir, f))] wad_files = [f for f in all_files if f.endswith('wad')] wad_paths...
the-stack_106_23882
import typing from urllib.parse import urljoin import strawberry from django.conf import settings from django.utils.translation import gettext_lazy as _ from api.permissions import IsAuthenticated from conferences.models.conference import Conference from hotels.models import HotelRoom, HotelRoomReservation from preti...
the-stack_106_23883
class ClientMessage: HTTP_VERSION="HTTP/1.1" HTTP_HEADERS={ "Host": "cs5700sp17.ccs.neu.edu" } def __init__(self, method, URL, headers, body=""): """ Init the variables of the client message """ self.method=method self.URL=URL self.body=body self.versio...
the-stack_106_23884
'''Manages the game mechanics.''' import random import pygame import pytmx import pyscroll import app from pygame.constants import K_1, K_2 from characters import NinjaPlayer, NinjaEnemy, ArcherPlayer, ArcherEnemy, BanditPlayer, BanditEnemy, keymap1, keymap2 from items import LifePotionSmall, Axe, Bow, Knife, Sword, P...
the-stack_106_23885
"""Import data from tensorflow format.""" # Copyright 2019 CSIRO (Data61) # # 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 require...
the-stack_106_23887
# Copyright 2019 Julian Niedermeier & Goncalo Mordido # # 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_23888
from nbconvert.preprocessors import ExecutePreprocessor, CellExecutionError from traitlets import Bool, List, Integer from textwrap import dedent from . import NbGraderPreprocessor from nbconvert.exporters.exporter import ResourcesDict from nbformat.notebooknode import NotebookNode from typing import Any, Optional, Tu...
the-stack_106_23889
""" Example views for interactive testing of payment with netaxept. """ from django.http import HttpRequest from django.http import HttpResponse from django.shortcuts import redirect, get_object_or_404 from django.template.response import TemplateResponse from django.urls import path from django.views.decorators.http ...
the-stack_106_23890
from .base import GnuRecipe class QemacsRecipe(GnuRecipe): def __init__(self, *args, **kwargs): super(QemacsRecipe, self).__init__(*args, **kwargs) self.sha256 = '2ffba66a44783849282199acfcc08707' \ 'debc7169394a8fd0902626222f27df94' self.name = 'qemacs' self....
the-stack_106_23891
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ Interpreting hyperbole with RSA models of pragmatics. Taken from: https://gscontras.github.io/probLang/chapters/03-nonliteral.html """ import torch import collections import argparse import pyro import pyro.distributions as...
the-stack_106_23892
import re import os import numpy as np import itertools import collections from unidecode import unidecode from malaya.text.tatabahasa import ( stopword_tatabahasa, stopwords, stopwords_calon, laughing, ) from malaya.text.rules import normalized_chars from malaya.text.english.words import words as _engl...
the-stack_106_23893
import grpc from .proto import ( ref_pb2, ref_pb2_grpc, commit_pb2, commit_pb2_grpc, blob_pb2_grpc, ) from .proto import shared_pb2 from ..errors import GitlabArtifactsError GITALY_ADDR = 'unix:/var/opt/gitlab/gitaly/gitaly.socket' REF_PREFIX = 'refs/heads/' def _gitaly_repo(project): return shar...
the-stack_106_23894
#!/usr/bin/env python # coding: utf-8 import os import numpy as np import argparse from math import floor def main(args): # class foo(object): # pass # args = foo() # args.ref='raw/training2017/REFERENCE.csv' annot_lines = open(args.ref, 'r').read().splitlines() np.random.shuffle(annot_line...
the-stack_106_23896
import math import torch.nn as nn import torch.nn.functional as F from GDN import Gdn class EONSS(nn.Module): def __init__(self): super(EONSS, self).__init__() self.conv1 = nn.Conv2d(3, 8, 5, stride=2, padding=2) self.gdn1 = Gdn(8) self.conv2 = nn.Conv2d(8, 16, 5, stride=2, padd...
the-stack_106_23897
# # 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...
the-stack_106_23898
#!/usr/bin/env python """ Created by howie.hu at 2021-04-08. Description:从广告文本提取抽取标题作为训练样本 Changelog: all notable changes to this file will be documented """ import os import time import pandas as pd from newspaper import Article from src.config import Config def csv2txt(target_path: str = ""): """...
the-stack_106_23899
# -*- coding: utf-8 -*- """ rstblog.programs ~~~~~~~~~~~~~~~~ Builtin build programs. :copyright: (c) 2010 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import os import yaml import shutil from datetime import datetime from StringIO impor...
the-stack_106_23901
#!/usr/bin/env python3 import argparse import pandas as pd import numpy as np import sys import matplotlib from matplotlib import use use('Agg') import matplotlib.pyplot as plt EOL=chr(10) def parseArguments(): if len(sys.argv)<=1: sys.argv="mafplot.py $input $output".split() parser=argparse.Argume...
the-stack_106_23902
from os import path from os.path import basename from typing import List, Optional, Tuple import dgl import torch from commode_utils.common import download_dataset from commode_utils.vocabulary import build_from_scratch from omegaconf import DictConfig from pytorch_lightning import LightningDataModule from torch.utils...
the-stack_106_23904
# (C) 2019 Baris Ozmen <hbaristr@gmail.com> import pathlib import logging import os import datetime import sys from os.path import dirname, realpath file_path = realpath(__file__) dir_of_file = dirname(file_path) parent_dir_of_file = dirname(dir_of_file) sys.path.insert(0, dir_of_file) now = datetime.datetime.now()...
the-stack_106_23905
import types from unittest.mock import AsyncMock, MagicMock, PropertyMock import pytest from aio.core import directory from envoy.code import check async def test_glint_have_newlines(patches): patched = patches( "NewlineChecker", prefix="envoy.code.check.abstract.glint") path = MagicMock()...
the-stack_106_23906
import sys, os myPath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, myPath + '/../') import torch from torch import nn from torch.optim import Adam from torch.nn.init import xavier_normal as xavier import matplotlib.pyplot as plt from data.loader import cryptoData from models.model import MLPRegre...
the-stack_106_23909
import binascii import ctypes import json import logging import traceback from datetime import date, datetime, timedelta from pathlib import Path from channels.db import database_sync_to_async from channels.generic.websocket import WebsocketConsumer from django.core.exceptions import ObjectDoesNotExist from django.uti...
the-stack_106_23910
import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F import math class Conv2dSubsampling(nn.Module): def __init__(self, input_dim, output_dim, dropout=0.0): """ :param input_dim: the log mel feature (normally 40) :param output_dim: network size (...
the-stack_106_23913
from arches.app.models.system_settings import settings from arches.app.utils.betterJSONSerializer import JSONSerializer from arches.app.search.components.base import BaseSearchFilter details = { "searchcomponentid": "", "name": "Saved", "icon": "fa fa-bookmark", "modulename": "saved_searches.py", "...
the-stack_106_23914
import pytest from literature.crud.editor_crud import create, show, patch, destroy, show_changesets from sqlalchemy import create_engine from sqlalchemy import MetaData # from literature import models from literature.models import ( Base, EditorModel ) from literature.schemas import EditorSchemaPost from literatur...
the-stack_106_23915
import asyncio import hashlib import json import logging import sys import aiohttp import aiostream from . import cli_logger from .. import exceptions from .utils import handle_collection_not_found from .utils import handle_collection_was_removed from .utils import handle_storage_init_error from .utils import load_st...
the-stack_106_23916
# 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 # distrib...