filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_16992 | # -*- coding: utf-8 -*-
#
# Database upgrade script
#
# RLPPTM Template Version 1.8.1 => 1.8.2
#
# Execute in web2py folder after code upgrade like:
# python web2py.py -S eden -M -R applications/eden/modules/templates/RLPPTM/upgrade/1.8.1-1.8.2.py
#
import sys
#from gluon.storage import Storage
#from gluon.tools impor... |
the-stack_106_16993 | import utils
import string
import consts
import torch
import torch.nn as nn
from tqdm import tqdm
from pathlib import Path
PUNCS = set(string.punctuation) - {'-'}
class BaseModel(nn.Module):
def __init__(self, model_dir) -> None:
super().__init__()
self.sigmoid = nn.Sigmoid()
self.dropout... |
the-stack_106_16994 | #! /usr/bin/env python3
# Note that, for readability purposes, we only plot 1-4 threads for uFS.
# Empirically, we observe uFS-5 to uFS-10 perform similar to uFS-4, which causes
# the curve overlapping with each other and make it difficult to read.
import sys
from zplot import *
def print_usage_and_exit():
prin... |
the-stack_106_16996 | import originpro as op
import numpy as np
from skimage.util import invert
#load image stack
fn = op.path('e') + r'Samples\Image Processing and Analysis\*.tif'
iw=op.new_image()
iw.from_file(fn)
print(iw.frames)
#get the 3rd image
im2 = iw.to_np2d(2)
im2 *= 2
im2 = invert(im2)
#put it back into 2nd image
iw.from_np2d(im... |
the-stack_106_16998 | # model settings
model = dict(
type='MaskRCNN',
pretrained='modelzoo://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
normalize=dict(type='SyncBN', frozen=False),
nor... |
the-stack_106_17001 | import requests
import re
import lxml.html
import date
import MySQLdb
conn = MySQLdb.connect(db='Crawler', user='cloud', passwd='1111', charset='utf8mb4')
c=conn.cursor()
def crawling(page_count):
front_url="http://www.jobkorea.co.kr/Starter/?JoinPossible_Stat=0&schOrderBy=0&LinkGubun=0&LinkNo=0&schType=0&schGid... |
the-stack_106_17002 | # Copyright (c) 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
the-stack_106_17003 | # Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# 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_17006 | import os
import shutil
import sys
from typing import Optional
import click
from valohai_cli.api import get_host_and_token
from valohai_cli.commands.project.create import create
from valohai_cli.commands.project.link import link
from valohai_cli.ctx import get_project
from valohai_cli.exceptions import NotLoggedIn
fr... |
the-stack_106_17007 | # -*- coding: utf-8 -*-
# Copyright (c) 2020, bikbuk and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe.model.document import Document
class VetProductQuantity(Document):
pass
@frappe.whitelist()
def get_quantity_list(filt... |
the-stack_106_17008 | import copy
from typing import Union, Any, Optional, List
import numpy as np
from ding.worker.replay_buffer import IBuffer
from ding.utils import LockContext, LockContextType, BUFFER_REGISTRY
from .utils import UsedDataRemover
@BUFFER_REGISTRY.register('naive')
class NaiveReplayBuffer(IBuffer):
r"""
Overview... |
the-stack_106_17009 | import angr
from angr.sim_type import SimTypeString, SimTypeLength, SimTypeInt
import logging
l = logging.getLogger("angr.procedures.libc.strncmp")
class strncmp(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, a_addr, b_addr, limit, a_len=None, b_len=None, wchar=False, ignore_case=False): ... |
the-stack_106_17011 | # coding: utf-8
import pprint
import re
import six
class CreateConnectorRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the v... |
the-stack_106_17013 | # 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 the "... |
the-stack_106_17016 | from pydub import AudioSegment
from pydub.playback import play
from musicBoxMaker import *
partition = parsePartitionFile("listNotes.txt")#put your partition here
notes = AudioSegment.from_mp3("recording_notes.mp3")#put your recording here
#put the start time (in ms) of each note here
startTimes = [4984, 5538, 6071,... |
the-stack_106_17017 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module contains some variables settings for COCO.
These variables are used for producing figures and tables
in rungeneric1, -2, and -many.
For setting variables dynamically see config.py, where some
of the variables here and some
"""
import os
import warning... |
the-stack_106_17020 | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
# Enable dynamic imports
sys.path.append(".")
from argparse import ArgumentParser
from syncdirector import SyncDirector
# Publish rdf patch files as resource dumps.
# Bundle up to max_files_compressed rdf patch files as successive definitely published resou... |
the-stack_106_17022 | import math
from flask import current_app, request
class PagedResult:
def __init__(self, items=None, total=None, page_size=None, page_number=None):
self.items = items or []
self.total = total or len(self.items)
self.page_size = page_size
self.page_number = page_number
@proper... |
the-stack_106_17023 | from __future__ import print_function
import os
try:
import io
except ImportError:
import cStringIO as io
import token
import tokenize
def do_path(pathname):
if os.path.isdir(pathname):
for rootdir, dirs, files in os.walk(pathname):
for file in files:
if file.endswith... |
the-stack_106_17024 | # Django settings for stati_project project.
import os.path
import pinax
PINAX_ROOT = os.path.abspath(os.path.dirname(pinax.__file__))
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# tells Pinax to serve media through django.views.static.serve.
SERVE_MEDIA = DEBUG
AD... |
the-stack_106_17025 | #!/usr/bin/env python3
try:
import polyinterface
except ImportError:
import pgc_interface as polyinterface
import sys
import requests
LOGGER = polyinterface.LOGGER
class LinkTap:
def __init__(self, username, apiKey):
self.base_url = 'https://www.link-tap.com/api/'
self.username = username... |
the-stack_106_17026 | # -*- encoding: UTF-8 -
import logging
import filecmp
import os
import re
import shutil
from time import sleep
from zipfile import ZipFile
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.management.base import BaseCommand, CommandError
from django.db.models impor... |
the-stack_106_17027 | #!/usr/bin/env python
"""
Copyright (C) 2014-2016 Twitter Inc and other contributors.
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
Unl... |
the-stack_106_17028 | import numpy as np
import pandas as pd
import xarray as xr
import Grid
import pf_dynamic_sph
import os
import sys
from timeit import default_timer as timer
from copy import copy
if __name__ == "__main__":
start = timer()
# ---- INITIALIZE GRIDS ----
higherCutoff = False; cutoffRat = 1.5
betterResol... |
the-stack_106_17029 | from __future__ import print_function
# This file is part of Androguard.
#
# Copyright (C) 2013, Anthony Desnos <desnos at t0t0.fr>
# 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... |
the-stack_106_17030 | #
# Copyright 2019 BrainPad Inc. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... |
the-stack_106_17033 | """
@author: David Lei
@since: 21/08/2016
@modified:
"""
def joinWords(list_of_strings):
sentence = ""
for string in list_of_strings:
sentence = sentence + string # string concatenation
# new copy of sentance
# as stri... |
the-stack_106_17035 | #Uses python3
import sys
from collections import deque
def distance(adj, s, t):
dist = {v: float('Inf') for v in range(len(adj))}
dist[s] = 0
q = deque()
q.append(s)
while q:
u = q.popleft()
for nbr in adj[u]:
if dist[nbr] == float('Inf'):
q.append(nbr)
... |
the-stack_106_17037 | """
Local storage
Store data under .metaflow/ in the cwd
"""
import os
import json
import gzip
from tempfile import NamedTemporaryFile
from metaflow.metaflow_config import DATASTORE_LOCAL_DIR, DATASTORE_SYSROOT_LOCAL
from .datastore import MetaflowDataStore, DataException, only_if_not_done
from ..metadata import Meta... |
the-stack_106_17039 | #!/usr/bin/env python
from __future__ import print_function
from subprocess import PIPE, Popen
import os, sys, re
def joinhere(*args):
return os.path.realpath(os.path.join(os.path.dirname(__file__), *args))
class ushuffle(object):
def __init__(self, s, k=2, seed=12345, cap=True):
self._ushuf = joinh... |
the-stack_106_17040 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 9 10:34:48 2017
@author: Aujasvi
"""
from numpy import *
import matplotlib.pyplot as plt
#Load the data set
data = loadtxt('nonlinear_classification.data')
X = data [:, :2]
T = data [:,2]
N, d = X.shape
#Parameters
eta = .3 #Learning rate
K = 15 #Number of hidden neuro... |
the-stack_106_17042 | """Utility functions for tests."""
from __future__ import annotations
import asyncio
from typing import Any, Dict
from httpx import AsyncClient
__all__ = ["wait_for_business"]
async def wait_for_business(
client: AsyncClient, username: str
) -> Dict[str, Any]:
"""Wait for one loop of business to complete ... |
the-stack_106_17043 | # -*- coding: utf-8 -*-
"""Cisco DNA Center Add Port assignment for access point data model.
Copyright (c) 2019-2021 Cisco Systems.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restric... |
the-stack_106_17046 | # coding=utf8
# Copyright 2018 the pycolab 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
the-stack_106_17047 | # Copyright (c) 2019 Nitin Agarwal (agarwal@uci.edu)
from __future__ import print_function
import numpy as np
import os
import sys
import scipy.sparse
import torch
import torch.utils.data as data
sys.path.append('./utils')
from pc_utils import *
class getDataset(data.Dataset):
def __init__(self, root, train=Tr... |
the-stack_106_17049 | # Copyright 2020. ThingsBoard
#
# 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_17054 | """ Model Implementation """
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow import keras
class Attention(keras.Model):
def __init__(self, input_dim, var_scope, reuse=tf.AUTO_REUSE):
super(Attention, self).__init__()
self.input_dim = input_dim
with tf.variable... |
the-stack_106_17055 | import logging
def linear_system(a, b, c, d, e, f):
""" Solves linear system given by coeffs:
{ a x + b y = c
{ d x + e y = f
Returns (x, y) if there is a single solution, otherwise None.
"""
if a == 0:
if b == 0:
return None
y, x = linear_system(b,a,c, e,d,f)
return x, y
a = float(a)
if abs(e - d * ... |
the-stack_106_17057 | from __future__ import annotations
import toolcli
import tooltime
import toolstr
from ctc.protocols.fei_utils import fei_psms
from ctc import rpc
from ctc import spec
def get_command_spec() -> toolcli.CommandSpec:
return {
'f': async_psms_command,
'help': 'display recent FEI redemptions',
... |
the-stack_106_17058 | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from math import cos,sin
import pinocchio
from pinocchio.rpy import rpyToMatrix
from mpl_toolkits.mplot3d import Axes3D
data = np.transpose(np.loadtxt("data/nmpc_traj_offline.csv"))
# # time_interp = np.linspace(0,100, len(traj[0]))
#... |
the-stack_106_17060 | import base64
import json
from typing import Callable, Dict, Mapping
import uuid
from cryptography.fernet import Fernet
from starlette.datastructures import MutableHeaders, Secret
from starlette.requests import HTTPConnection
from starlette.types import ASGIApp, Message, Receive, Scope, Send
class SessionMiddleware:... |
the-stack_106_17061 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Functions to perform input/output operations."""
import sys
import os
import glob
import copy
import re
from collections.abc import Iterable
import importlib
import warnings
import pickle
import os.path
import numpy as np
try:
import netCDF4 as n... |
the-stack_106_17063 | # 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_106_17064 | import socket
import math
import time
import threading
from Helpers import PacketState, calc_checksum, lose_the_packet, make_ack_packet, print_progress_bar
PACKET_SIZE = 200
HEADER_SIZE = 12
SERVER_PORT_NO = None
PLP = None
WINDOW_SIZE = None
MAX_SEQ_NO = None
main_lock = threading.Lock()
threads = []
state = {
... |
the-stack_106_17065 | ###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... |
the-stack_106_17066 | from seldon_e2e_utils import (
wait_for_rollout,
initial_rest_request,
rest_request_ambassador,
retry_run,
create_random_data,
wait_for_status,
rest_request,
)
from subprocess import run
import time
import logging
class TestPrepack(object):
# Test prepackaged server for sklearn
de... |
the-stack_106_17067 | #!/usr/bin/env python3
# Copyright 2020 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.
"""Command-line tool to run jdeps and process its output into a JSON file."""
import argparse
import functools
import math
import mult... |
the-stack_106_17068 | import matplotlib as mpl
# mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import rff
import csv
import rff
def trials_agg(trials, folder, prefix, suffix):
content = list()
for idx in trials:
sourcename = folder + prefix + str(idx) + suffix + '.csv'
with open(sourcename,'r') a... |
the-stack_106_17069 | import sys
import os
from PIL import Image
path = sys.argv[1]
directory = sys.argv[2]
if not os.path.exists(directory):
os.makedirs(directory)
count = 0
for filename in os.listdir(path):
count += 1
clean_name = os.path.splitext(filename)[0]
img = Image.open('{}{}'.format(path,filename))
#added the / in case... |
the-stack_106_17070 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Media',
fields=[
('id', models.AutoField(verbos... |
the-stack_106_17073 | from hikari.scripts.angular_explorer import angular_property_explorer_factory
def r1_map(a, b, c, al, be, ga,
space_group='P1',
axis='',
fix_scale=False,
histogram=True,
opening_angle=35,
orientation=None,
path='~/sortav.lst',
out... |
the-stack_106_17074 | """
Module containing functions used to load and write data
"""
from typing import *
import zarr
import sys
import time
import numpy as np
import pandas as pd
from pathlib import Path
from dask import dataframe as dd
from dask.distributed import Client
from pysmFISH.utils import convert_from_uint16_to_float64
from py... |
the-stack_106_17075 | import socketserver
class MyTCPHandler(socketserver.StreamRequestHandler):
# обработчик входящих соединений
def handle(self):
self.data = self.request.recv(1024)
value = bytes.decode(self.data)
print("CLIENT SEND: " + value)
self.request.sendall(b"Hello, client")
if __name__... |
the-stack_106_17076 | num = 10
limit = 6
cnt = 0
playGame = False
guess = 0
while guess != num :
print("You have "+str(limit - cnt)+" left")
guessFirst = input("Enter a Number : ")
if(guessFirst.isnumeric()):
guess = int(guessFirst)
if guess == num : playGame = True
if(guess > num):
print("Wro... |
the-stack_106_17077 | # -*- coding: utf-8 -*-
'''
定时处理任务启动器
主要根据自动触发配置加载任务,然后启动func_runner
'''
# Builtin Modules
import time
import traceback
# 3rd-party Modules
import arrow
from croniter import croniter
import six
# Project Modules
from worker import app
from worker.utils import toolkit, yaml_resources
from worker.tasks import gen_tas... |
the-stack_106_17078 | #! /usr/local/bin/python3
""" Run the antler parser against a scribe block, and record
info about the block, as well as timing and output info
for later analysis.
"""
import os
import subprocess
import sys
import time
from argparse import ArgumentParser
from pathlib import Path
from dgw_filter import dgw_fil... |
the-stack_106_17079 | import timeit
def validate_input(n):
if type(n) != int:
raise TypeError("n must be a positive int")
if n < 1:
raise ValueError("n must be a positive int")
def stress(prefixes=[], globals=None):
print("Cache warmup with fib(128), fib(256), fib(512), fib(1000)")
for prefix in prefixes:... |
the-stack_106_17080 | import os
import functools
import time
import glob
import argparse
import numpy as np
import joblib
import yaml
from blocks.core import utils, labels, duplocorpus
from blocks.estimation import imageprocessing, models, render, metrics
def removeBackground(image, foreground_mask, replace_with=None):
if replace_wi... |
the-stack_106_17083 | #!/usr/bin/env python
# encoding: utf-8
import pickle
from flask import current_app
import application.models as Models
from application.services.user import create_user
DEFAULT_BACKUP_FILE = '/tmp/posts.bak'
def import_posts():
backup_file = current_app.config.get('BACKUP_FILE', DEFAULT_BACKUP_FILE)
with... |
the-stack_106_17084 | import io
import os
from distutils.file_util import copy_file
from setuptools import setup, find_packages
from gremlinapi.util import get_version
__version__ = get_version()
def getRequires():
deps = ['requests>=2.22.0', 'urllib3>=1.25.8']
return deps
dir_path = os.path.abspath(os.path.dirname(__file__))... |
the-stack_106_17087 | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode:
St = []
for num in nums:
node = TreeNode(num)
... |
the-stack_106_17088 | import asyncio
import pytest
async def _sleep_override(interval):
pass
asyncio.sleep = _sleep_override
from receptor_satellite.worker import Host, Run # noqa: E402
from receptor_satellite.response_queue import ResponseQueue # noqa: E402
from fake_logger import FakeLogger # noqa: E402
class FakeQueue:
... |
the-stack_106_17089 | # optical_density_MEC.py v1.0
# by William H. Grover, Department of Bioengineering
# University of California, Riverside
# wgrover@engr.ucr.edu
# http://groverlab.org
# Copyright (c) 2016 Regents of the University of California. Permission is
# hereby granted, free of charge, to any person obtaining a copy of this
#... |
the-stack_106_17090 | """
https://leetcode.com/problems/maximum-product-subarray/
Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product.
Example 1:
Input: [2,3,-2,4]
Output: 6
Explanation: [2,3] has the largest product 6.
Example 2:
Input: [-2,0,-1]
Output... |
the-stack_106_17091 | # -*- coding: utf-8 -*-
'''
The core behaviors used by minion and master
'''
# pylint: disable=W0232
# pylint: disable=3rd-party-module-not-gated
from __future__ import absolute_import
# Import python libs
import time
import os
import multiprocessing
import logging
from salt.ext.six.moves import range
# Import salt ... |
the-stack_106_17092 | """
"""
from typing import List
import numpy as np
import pandas as pd
import statsmodels.api as sm
import src.features.build_features as bf
import src.data.download as dwn
def reducto_explain_downloads(
log_y: bool = False,
log_x: bool = True,
drop_columns: List[str] = None
):
"""Line... |
the-stack_106_17096 | # qubit number=3
# total number=12
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... |
the-stack_106_17098 | import boto3
import dagster._check as check
MAX_KEYS = 1000
def get_s3_keys(bucket, prefix="", since_key=None, s3_session=None):
check.str_param(bucket, "bucket")
check.str_param(prefix, "prefix")
check.opt_str_param(since_key, "since_key")
if not s3_session:
s3_session = boto3.resource("s3... |
the-stack_106_17100 | #!/usr/bin/env python
"""
Reads a list of intervals and a maf. Produces a new maf containing the
blocks or parts of blocks in the original that overlapped the intervals.
If a MAF file, not UID, is provided the MAF file is indexed before being processed.
NOTE: If two intervals overlap the same block it will be written... |
the-stack_106_17101 | #learning to modify the attributes of the turtle and window objects
#Modify this program so that before it creates the window, it prompts the user to enter the desired background color. It should store the user’s responses in a variable, and modify the color of the window according to the user’s wishes.
#Do similar ch... |
the-stack_106_17107 | import os
from datetime import datetime
from logging import getLogger, Logger
from typing import Dict, Any, List
import json
import jwt
import requests
from requests.exceptions import HTTPError
BASE_URL: str = 'https://api.liquid.com'
"""API Base URL"""
SIDE_BUY: str = 'buy'
"""Side: buy"""
SIDE_SELL: str = 'sell... |
the-stack_106_17112 | # -*- coding: utf-8 -*-
import os
import logging
import shutil
import hashlib
import collections
import numpy as np
import torch
from PIL import Image
LOGGER = logging.getLogger(__name__)
class Pad:
def __init__(self, border, mode='reflect'):
self.border = border
self.mode = mode
def __cal... |
the-stack_106_17114 | import numpy as np
from pyscf import lib, gto
from kspies import wy
import matplotlib.pyplot as plt
from scipy.linalg import toeplitz
from scipy.linalg import eigh
#Define system
x = np.linspace(-10, 10, 201) #Domain
h = (x[-1]-x[0])/(len(x)-1) #grid spacing
n = len(x) #Dimension of basis
a = np.z... |
the-stack_106_17115 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
from nni.nas.pytorch.mutables import LayerChoice, InputChoice
from nni.nas.pytorch.darts import DartsTrainer
class Net(nn.Module):
def __init__(self):
... |
the-stack_106_17116 | import numbers
from . import meter
import numpy as np
import torch
class AUCMeter(meter.Meter):
"""
The AUCMeter measures the area under the receiver-operating characteristic
(ROC) curve for binary classification problems. The area under the curve (AUC)
can be interpreted as the probability that, give... |
the-stack_106_17117 | # MIT License
#
# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... |
the-stack_106_17118 | from numpy.distutils.core import setup, Extension
import platform
import sys
import os
conf = {
'fortran_lib' : None,
'fortran_library_dir' : None
}
if (os.environ.has_key('DFLAGS') == True):
if (os.environ['DFLAGS'] == ''):
import distutils.sysconfig
old_str = distutils.sysconfig._co... |
the-stack_106_17119 | #!/usr/bin/env python3
from pprint import pprint
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/webhooks/inbound-message", methods=['POST'])
def inbound_message():
data = request.get_json()
pprint(data)
return "200"
if __name__ == '__main__':
app.run(host="www.example.or... |
the-stack_106_17120 | # !/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
ONTOSPY
Copyright (c) __Michele Pasin__ <http://www.michelepasin.org>.
All rights reserved.
"""
from __future__ import print_function
from colorama import Fore, Style
import sys
import os, os.path
import time
import optparse
import shutil
import... |
the-stack_106_17121 | import tweepy
import databasehandler as db
import json
from userio import say, ok, warn, error
say("Establishing connection to Twitter...")
auth = tweepy.OAuthHandler(db.get_authentication()["consumer_key"], db.get_authentication()["consumer_secret"])
auth.set_access_token(db.get_authentication()["access_token"], db.g... |
the-stack_106_17123 | # coding: utf-8
"""
Python SDK for Opsgenie REST API
Python SDK for Opsgenie REST API # noqa: E501
The version of the OpenAPI document: 2.0.0
Contact: support@opsgenie.com
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class AlertAttachment... |
the-stack_106_17124 | # Copyright 2019-2020 The ASReview 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 appl... |
the-stack_106_17126 | from loguru import logger
import matplotlib.patheffects as PathEffects
from matplotlib import gridspec
from matplotlib import transforms as mtransforms
import matplotlib.pyplot as plt
def plot_curves(
fig, curves, index, tracks="auto",
):
if not isinstance(index, dict):
index = {id(c): index for c in ... |
the-stack_106_17129 | import jinja2
from . import abc_pdf
__all__ = [
"DefaultTemplateManager"
]
default_template = """
<html>
<head>
<style type="text/css">
table {
font-family: "Courier New", monospace;
text-align: left;
border-collapse: separate;
border-spacing: 5px;
background: #E... |
the-stack_106_17130 | #!/usr/bin/env python
##############################################################################
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
################################... |
the-stack_106_17131 | import paddle
import paddle.nn as nn
from model.losses import SigmoidBinaryCrossEntropyLoss
class BRSMaskLoss(nn.Layer):
def __init__(self, eps=1e-5):
super().__init__()
self._eps = eps
def forward(self, result, pos_mask, neg_mask):
pos_diff = (1 - result) * pos_mask
pos_targ... |
the-stack_106_17133 | #!/usr/bin/env python3
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Statically analyze stack usage of EC firmware.
Example:
extra/stack_analyzer/stack_analyzer.py \
--export_taskinf... |
the-stack_106_17134 | import rlkit.misc.hyperparameter as hyp
from rlkit.demos.source.dict_to_mdp_path_loader import EncoderDictToMDPPathLoader
from rlkit.launchers.experiments.ashvin.awac_rig import awac_rig_experiment
from rlkit.launchers.launcher_util import run_experiment
from rlkit.launchers.arglauncher import run_variants
from rlkit.t... |
the-stack_106_17135 | import constant
from discord import Message, utils
from discord.ext.commands import Bot, Cog
class Thread(Cog):
def __init__(self, bot: Bot):
self.bot = bot
@Cog.listener()
async def on_message(self, message: Message):
author = message.author
channel = message.channel
if a... |
the-stack_106_17136 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2018, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
the-stack_106_17137 | """Anagram finding functions."""
from nagaram.scrabble import blank_tiles, word_list, word_score
def _letter_map(word):
"""Creates a map of letter use in a word.
Args:
word: a string to create a letter map from
Returns:
a dictionary of {letter: integer count of letter in word}
"""
... |
the-stack_106_17138 | # Copyright 2018 Iguazio
#
# 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, soft... |
the-stack_106_17139 | import re
import random
import discord
from redbot.core import commands, data_manager, Config, checks, bot
from .eris_event_lib import ErisEventMixin
BaseCog = getattr(commands, "Cog", object)
RETYPE = type(re.compile("a"))
class JustMetHer(BaseCog, ErisEventMixin):
def __init__(self, bot_instance: bot):
... |
the-stack_106_17142 | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSHelperFn, AWSObject, AWSProperty, FindInMap, Ref
from .validators import (
boolean, integer, integer_range, network_port, positive_integer
)
try:
from awacs.aws import Policy
... |
the-stack_106_17145 | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the prioritisetransaction mining RPC."""
from test_framework.test_framework import BitcoinLamboTe... |
the-stack_106_17146 | from jira_config import jira_config
from jira_data import jira_data
from jira_graph import jira_graph
import sys
jira_lookup = jira_config()
def extract_csv_data_and_plot(filename, teams):
plotter = jira_graph(jira_lookup)
plotter.create_ticket_graphs_by_team(filename, teams)
def get_filter_data_and_plot(f... |
the-stack_106_17147 | # !/usr/bin/python3
# coding: utf-8
# Copyright 2015-2018
#
# 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_17148 | import logging
from pathlib import Path
import pytest
from math import isclose
from farm.data_handler.processor import SquadProcessor
from farm.modeling.adaptive_model import AdaptiveModel
from farm.infer import QAInferencer
from farm.data_handler.inputs import QAInput, Question
@pytest.mark.parametrize("distilbert_s... |
the-stack_106_17149 | """Tools for reading a directory of torrent files
"""
import os
import hashlib
from BitTornado.Meta.bencode import bencode
from BitTornado.Meta.Info import check_info, MetaInfo
def _errfunc(msg):
print(":: ", msg)
def parsedir(directory, parsed, files, blocked, exts=('.torrent',),
return_metainfo=... |
the-stack_106_17152 | from shapely import geometry
from shapely.geometry import shape, Polygon, LineString, Point, MultiLineString, MultiPolygon
import matplotlib.pyplot as plt
import requests
import rasterio
from pandas import DataFrame
from geopandas import GeoDataFrame
import geopandas as gpd
import pandas as pd
from math import acos, sq... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.