filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_12448 | from lyrebird.mock import context
from flask import Response, stream_with_context
import json
class MockHandler:
"""
根据当前设置数据组的匹配条件,查找对应的mock数据。
如果没有找到匹配的数据则交由下一个处理器处理。
"""
def handle(self, handler_context):
data = context.application.data_manager.router.get_mock_data(handler_context.flow... |
the-stack_0_12449 | from flask import Blueprint
from flask_admin.base import MenuLink
from flask_admin.consts import ICON_TYPE_IMAGE
from ddui.dash_app import app as dash_view
from airflow.plugins_manager import AirflowPlugin
ml_repo_website = MenuLink(
category='DataDriver',
name='Git repository',
url='https://gitlab.octo.... |
the-stack_0_12451 | from threading import Thread, Event
from queue import Queue
import time
import numpy as np
import traceback
# This code originally used Process not Thread.
# Process is much slower to start (Process.start() is ~100 ms, Thread.start() is a few ms)
# The process-safe versions of Queue and Event are also significantly sl... |
the-stack_0_12452 | from django import template
register = template.Library()
@register.filter
def getcount(item, choice):
"""returns the number of times choice has been selected for item"""
return item.userchoices.filter(choice=choice).count()
@register.filter
def getuniqueitems(userchoices):
"""return a list of unique it... |
the-stack_0_12454 | # Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
the-stack_0_12455 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... |
the-stack_0_12457 |
import numpy as np
import pandas as pd
from abc import abstractmethod
from gym.spaces import Space, Box
from typing import Dict
from trades import Trade, TradeType
from exchanges import InstrumentExchange
from slippage import RandomSlippageModel
class SimulatedExchange(InstrumentExchange):
"""An instrument ex... |
the-stack_0_12458 | #!/usr/bin/env python3
from omxplayer.player import OMXPlayer
from pathlib import Path
from time import sleep
import logging
logging.basicConfig(level=logging.INFO)
import socket
import pdb
noCommMode = False
if not noCommMode:
HOST = ''
PORT = 55555
sock = socket.socket(socket.AF_INET,socket.SOCK_STREA... |
the-stack_0_12459 | # 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_0_12461 | #!/usr/bin/python3
"""Resets the datastore
Deletes all sqlite files. This will not reset nifi but reset lhipa and cl model states
"""
__author__ = "Martin Eigenmann"
__license__ = "unlicence"
__version__ = "0.0.1"
__email__ = "martin.eigenmann@unisg.ch"
__status__ = "Prototpye"
import json
import sys
import os
impo... |
the-stack_0_12462 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from torch import nn as nn
from torch.nn import functional as F
from mmseg.core import add_prefix
from ..builder import (SEGMENTORS, build_backbone, build_head, build_loss,
build_neck)
from .base import Base3DSegment... |
the-stack_0_12463 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2019 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... |
the-stack_0_12465 | # encoding: utf-8
# For Facebook
FACEBOOK_APP_SECRET = ''
FACEBOOK_APP_ID = ''
TWITTER_CONSUMER_KEY = ''
TWITTER_CONSUMER_SECRET = ''
MESSAGE_FORMAT = u'''Hi,
%(message)s
--
%(creator)s'''
# set email sender address
#default_email_sender = ''
# set default address to send messages
#default_email_to = ''
COMMIT_... |
the-stack_0_12466 | #
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2021 PyMeasure Developers
#
# 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 limit... |
the-stack_0_12467 | ########################################
# CS/CNS/EE 155 2018
# Problem Set 6
#
# Author: Andrew Kang
# Description: Set 6 HMM helper
########################################
import re
import numpy as np
import matplotlib.pyplot as plt
from wordcloud import WordCloud
from matplotlib import animation
from matplo... |
the-stack_0_12468 | import concurrent.futures
import rasterio
from rasterio._example import compute
def main(infile, outfile, num_workers=4):
with rasterio.Env():
with rasterio.open(infile) as src:
profile = src.profile
profile.update(blockxsize=128, blockysize=128, tiled=True)
with rast... |
the-stack_0_12470 | # python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... |
the-stack_0_12472 | #!/usr/bin/env python
__all__ = ['zhanqi_download']
from ..common import *
import re
def zhanqi_download(url, output_dir = '.', merge = True, info_only = False):
html = get_content(url)
rtmp_base_patt = r'VideoUrl":"([^"]+)"'
rtmp_id_patt = r'VideoID":"([^"]+)"'
title_patt = r'<p class="title-name" t... |
the-stack_0_12474 | # --------------------------------------------------------------------------------------------
# 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_12476 |
import os
import zipfile
from datetime import datetime
import numpy as np
import spacy
import twokenize
from nlplingo.common.utils import IntPair
from nlplingo.sandbox.misc.train_test import generate_argument_data_feature
from nlplingo.sandbox.misc.train_test import generate_trigger_data_feature
from nlplingo.sandbox... |
the-stack_0_12477 | from typing import List, Optional
import attr
from casexml.apps.case.xform import extract_case_blocks
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from corehq.motech.value_source import CaseTriggerInfo
@attr.s
class RepeaterResponse:
"""
Ducktypes an HTTP response for Repeater.han... |
the-stack_0_12480 | #!/usr/bin/env python
import unittest
import warnings
import numpy as np
from pymatgen.core.lattice import Lattice
from pymatgen.core.operations import SymmOp
from pymatgen.symmetry.groups import PointGroup, SpaceGroup, _get_symm_data
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Virt... |
the-stack_0_12481 | #
# 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_0_12482 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2021 Snowflake Computing Inc. All right reserved.
#
import decimal
import json
import logging
import os
import pickle
import time
from datetime import date, datetime
from typing import TYPE_CHECKING, List, NamedTuple
import mock
import pytest
import... |
the-stack_0_12484 | from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import os
import sqlite3
import random
from panel import Ui_quiz
# Questions Database
conn = sqlite3.connect('questions.db')
c = conn.cursor()
# User information Database
conn2 = sqlite3.connect('info_user.db')
c2 = conn2.cursor()
c2.execute('''CREATE TABLE IF ... |
the-stack_0_12485 | import cv2
import numpy as np
def rgb2gray(rgb):
return np.dot(rgb[..., :3], [0.299, 0.587, 0.114])
def convert_2d_to_3d(u, v, z, K):
v0 = K[1][2]
u0 = K[0][2]
fy = K[1][1]
fx = K[0][0]
x = (u - u0) * z / fx
y = (v - v0) * z / fy
return (x, y, z)
def feature_match(img1, img2):
... |
the-stack_0_12488 | '''
Various classes and functions for handling Regier and colleagues'
communicative cost model.
'''
import numpy as np
from scipy.spatial.distance import pdist, squareform
class Partition:
'''
A partition object represents a partition of an n-dimensional
space. To create a partition, pass a list like [[0,0,1,1],
... |
the-stack_0_12489 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import logging
def conv3x3(in_channels, out_channels, stride=1):
return nn.Conv2d(in_channels, out_channels, kernel_size=3,
stride=stride, padding=1, bias=False)
class ResidualBlock(nn.Module):
... |
the-stack_0_12491 | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the pairs function below.
def pairs(k, arr):
res = 0
memo = dict()
for el in arr:
if el-k in memo:
res += 1
if el+k in memo:
res += 1
memo[el] = True
return re... |
the-stack_0_12494 | import torch
from torch import nn
def normalize(x, axis=-1):
"""Normalizing to unit length along the specified dimension.
Args:
x: pytorch Variable
Returns:
x: pytorch Variable, same shape as input
"""
x = 1. * x / (torch.norm(x, 2, axis, keepdim=True).expand_as(x) + 1e-12)
return x... |
the-stack_0_12495 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
the-stack_0_12502 | # 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_0_12508 | #!/usr/bin/env python
"""
.. Workspace sub-command
.. codeauthor:: Rich Plevin <rich@plevin.com>
.. Copyright (c) 2016 Richard Plevin
See the https://opensource.org/licenses/MIT for license details.
"""
from __future__ import print_function
from ..subcommand import SubcommandABC, clean_help
def driver(args, too... |
the-stack_0_12509 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# ... |
the-stack_0_12510 |
#!/usr/bin/env python3
"""Script for Tkinter GUI chat client."""
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import tkinter
# crypto imports
# import nacl, nacl.secret, nacl.utils
# from nacl.public import PrivateKey, SealedBox
def receive():
"""Handles receiving of messages."""... |
the-stack_0_12511 | """Regresssion tests for urllib"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
import sys
import tempfile
from nturl2path import url2pathname, pathname2url
from base64... |
the-stack_0_12513 | from gtts import *
from playsound import playsound
import random
import os
r1 = random.randint(1,10000000)
r2 = random.randint(1,10000000)
f=open("C:\\Python\\myfile.txt","w")
f.write(input())
f.close()
f=open("C:\\Python\\myfile.txt","r")
x=f.read()
language='en'
audio=gTTS(text=x,lang=language,slow=False)... |
the-stack_0_12514 | # 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_12515 | import torch.nn as nn
from src.models.layers import ConvBnAct
from .utils import FeatureHooks
class BackboneBase(nn.Module):
def create_hooks(self):
self.stage_names = [i['module'] for i in self.feature_info]
self.encoder_channels = [i['num_chs'] for i in self.feature_info]
hooks = [dict... |
the-stack_0_12517 | #
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... |
the-stack_0_12518 | #Railway API - http://railwayapi.com/api/
from flask import Flask
from flask_ask import Ask, statement, question, session
import json
import requests
import time
import unidecode
import datetime
app = Flask(__name__)
ask = Ask(app, "/train_route")
api_key = '6dg3lgmg'
def date_convert(date):
year1 = datetime.... |
the-stack_0_12519 | # Copyright 2016-2018, Pulumi 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 agreed t... |
the-stack_0_12520 | def addupto(n):
# 1 assignmnet
total = 0
# loop runs n times
for i in range(1, n+1):
# 1 assignment
total += i
return total
# runs 1 times
print(addupto(int(input("Enter value of n: "))))
# Each statement outside a loop will have 1 time complexity.
# And time complexity of stat... |
the-stack_0_12523 | import csv
import sys
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
TEST_SIZE = 0.4
def main():
# Check command-line arguments
if len(sys.argv) != 2:
sys.exit("Usage: python shopping.py data")
... |
the-stack_0_12524 |
# Copyright 2018 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_12525 | from typing import List, Optional, Union
from achi.consensus.block_record import BlockRecord
from achi.consensus.blockchain_interface import BlockchainInterface
from achi.consensus.constants import ConsensusConstants
from achi.consensus.deficit import calculate_deficit
from achi.consensus.difficulty_adjustment import ... |
the-stack_0_12526 | from pathlib import Path
from invoke import task
from nox.virtualenv import VirtualEnv
# Configuration values.
DUMP_DIR = '.dump'
VENV = 'venv'
project_name = 'scrapd'
docker_org = 'scrapd'
docker_repo = f'{docker_org}/{project_name}'
@task
def build_docker(c):
"""Build a docker image."""
tag = c.run('git d... |
the-stack_0_12527 | from save_exp import save_experiment_info, save_acc
import argparse
import os
import torch
import time
from networks.nonlinear_nets import NonlinearNet
from utils import get_hms, TrainingObject
from optim import get_optim
from tensorboardX import SummaryWriter
import py3nvml
from math import ceil
# Training settings
p... |
the-stack_0_12528 | from gzip import GzipFile
from StringIO import StringIO
from django.conf import settings
import mock
from olympia.amo.tests import TestCase, addon_factory, reverse_ns
from olympia.api.middleware import (
GZipMiddlewareForAPIOnly, IdentifyAPIRequestMiddleware)
class TestIdentifyAPIRequestMiddleware(TestCase):
... |
the-stack_0_12529 | from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import *
from .entities import *
from django.db import transaction
from django.utils.translation import ugettext_lazy as _
class FarmerCreationForm(UserCreationForm):
class Meta(UserCreationForm):
model = Farmer
... |
the-stack_0_12530 | """Defines an object which manages resources defined from packages."""
from rpg.data import resource as r
import typing
if typing.TYPE_CHECKING:
from rpg.data.resource import Resource, ResourceType
from typing import Dict, List, Optional
_fmtReplaceError = "cannot replace {} {}; master {} not in allowed list... |
the-stack_0_12532 | """
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com>
# Fabian Pedregosa <fabian@fseoane.net>
# Michael Eickenberg <michael.eickenberg@nsup.org>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
impor... |
the-stack_0_12533 | # coding=utf-8
# Copyright 2018 The Dopamine Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
the-stack_0_12534 | import numpy as np
from grabscreen import grab_screen
import cv2
import time
from getkeys import key_check
import os
def keys_to_output(keys):
'''
Convert keys to a ...multi-hot... array
[A,W,D] boolean values.
'''
output = [0, 0, 0]
if 'A' in keys:
output[0] = 1
elif 'D' in keys... |
the-stack_0_12535 | import json
import asyncio
import websockets
from websockets.http import Headers
import asyncclick as click
import pprint
from .console import console
from .settings import get_settings
import pkg_resources
class WebsocketClient(object):
def __init__(self, host: str, token: str, proto: str, api_version: str = "v... |
the-stack_0_12536 | #
# Copyright (C) 2016 UAVCAN Development Team <uavcan.org>
#
# This software is distributed under the terms of the MIT License.
#
# Author: Pavel Kirienko <pavel.kirienko@zubax.com>
#
import time
import logging
from functools import partial
from PyQt5.QtWidgets import QMainWindow, QWidget, QVBoxLayout, QAction
from... |
the-stack_0_12537 | import datetime
import os
import shutil
import sys
import tempfile
from invoke import task
from invoke.exceptions import Exit
from .build_tags import get_default_build_tags
from .utils import (
REPO_PATH,
bin_name,
get_build_flags,
get_git_branch_name,
get_git_commit,
get_go_version,
get_v... |
the-stack_0_12539 | #!/usr/bin/env python3
"""
This module is used to dump out the SQL/DDL that was used to create any object
(of any type).
End users typically will not use this module directly. Instead, they will use
wrapper scripts that utilize this module. These include
- yb_ddl_table.py
- yb_ddl_view.py
- yb_ddl_sequence... |
the-stack_0_12541 | """
create_label_files.py
---------------
This script produces:
1. Reorient the processed registered_scene mesh in a mesh with an AABB centered at the
origin and the same dimensions as the OBB, saved under the name foldername.ply
2. Create label files with class labels and projections of 3D BBs in the format
si... |
the-stack_0_12543 | from __future__ import print_function, division
import numpy as np
from PyAstronomy.pyaC import pyaErrors as PE
import six.moves as smo
def expCorrRN(n, tau, mean=0.0, std=1.0, rnos=None, fullOut=False):
"""
Generate exponentially correlated random numbers.
This procedure implements the prescription giv... |
the-stack_0_12544 | #import xppcall as pxc
from xppcall import xpprun,read_pars_values_from_file,read_init_values_from_file
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
def get_tone_evoked_FR(t,u,v1,v2,tonelist):
"""
brute force method for extracting peaks following tone-evoked activ... |
the-stack_0_12546 | #!/usr/bin/env python3
"""Cyberjunky's 3Commas bot helpers."""
import argparse
import configparser
import json
import os
import ssl
import sys
import time
import uuid
from pathlib import Path
from aiohttp import web
from helpers.logging import Logger, NotificationHandler
from helpers.misc import format_pair
from help... |
the-stack_0_12547 | ##############################################################################
# Copyright 2020 IBM Corp. 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
#
# htt... |
the-stack_0_12549 | import shutil
import glob
import os
from collections import OrderedDict
import functools
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import _LRScheduler
#from utility import *
class SegmentationMetric(object):
def __init__(self,... |
the-stack_0_12550 | # Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector 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 ... |
the-stack_0_12556 | from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
out_path):
import os
from genomicode import filelib
from genomicode im... |
the-stack_0_12557 | from censys_ml.field_transforms import utils
def encode_certificate_fields(input_field, output_field):
lines = []
parsed_versions = [1, 2]
sha_strs = ["SHA1"]
validity_lengths = ["days", "weeks", "months"]
# 8192 has been added to the options after i saw some records on censys that have it
rs... |
the-stack_0_12561 | #! /usr/bin/env python
# -*-coding: utf-8 -*-
__author__ = 'dracarysX'
from collections import deque
from peewee import Expression, ForeignKeyField
from rest_query.operator import Operator, operator_list
from rest_query.query import QueryBuilder
from rest_query.parser import BaseParamsParser, cache_property
from res... |
the-stack_0_12564 | from . import *
class KernelVersionCommand(Command):
name = "kernel_version"
shell = True
command = "/bin/sh -c 'printf \"`uname -a`\\n`uname -v`\"'"
desc = "analyze changes in kernel version"
def parse(output):
lines = output.splitlines()
if len(lines) != 2:
return None
kernel_version = lines[1]
line... |
the-stack_0_12565 | import numpy as np
from logging import getLogger
import kit_timetable_rebuilder as kitrb
class TimeTable(object):
def __init__(self, image: np.ndarray, logger=None):
self.logger = logger or getLogger(__name__)
self.image = image
bin_img = kitrb.convert_to_bin(image)
# 枠線検出
... |
the-stack_0_12566 | # Copyright (c) 2019 Andres Gomez Ramirez.
# All Rights Reserved.
from __future__ import print_function
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.layers import LSTM
from keras.optimizers import RMSprop
from keras.utils.data_utils import get_file
from arhuaco.analysis.fea... |
the-stack_0_12567 | # 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... |
the-stack_0_12568 | from __future__ import division # Use floating point for math calculations
from CTFd.plugins import register_plugin_assets_directory
from CTFd.plugins.flags import get_flag_class
from CTFd.utils.user import get_current_user
from CTFd import utils
from CTFd.models import (
db,
Solves,
Fails,
Flags,
... |
the-stack_0_12569 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 22 17:32:28 2021
@author: galfredo
"""
# dataset settings
dataset_type = 'CocoVideoDataset'
classes = ('1')
data_root = 'C:/Users/galfredo/Documents/Challenge Everest/dff test/customized annotations/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, ... |
the-stack_0_12570 | """
Copyright 2020 The OneFlow 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 applicable law or agr... |
the-stack_0_12571 | import os
import tensorflow as tf
from tensorflow.python.tools import freeze_graph
from tensorflow.tools.graph_transforms import TransformGraph
import config
import download
import loss
class MSINET:
"""The class representing the MSI-Net based on the VGG16 model. It
implements a definition of the computa... |
the-stack_0_12572 | from dal import autocomplete, forward
from django import forms
from .models import TModel
class TForm(forms.ModelForm):
class Meta:
model = TModel
fields = ('name', 'owner', 'test')
widgets = {
'test': autocomplete.ModelSelect2(
url='linked_data_rf',
... |
the-stack_0_12573 | # coding: utf-8
import sys
import re
from natsort import natsorted
INPUT = sys.argv[ 1 ]
# NOTE: This script for Kontakt6!
# KSP Reference Manual.txt created by Acrobat DC (Windows version & locale cp932) and re-save on vscode as utf-8 encoding.
# If created by different locale, change encoding name.
ENCODING = 'utf... |
the-stack_0_12574 | import re
import tensorflow.compat.v1 as tf
import tensorflow.contrib.slim as slim
from tensorflow.contrib.slim.nets import resnet_v1
from dataset.pose_dataset import Batch
from nnet import losses
net_funcs = {'resnet_50': resnet_v1.resnet_v1_50,
'resnet_101': resnet_v1.resnet_v1_101}
def prediction_... |
the-stack_0_12575 | import unittest
from dmLibrary import create_app
from dmLibrary.external.googleBook import GoogleBook
import time
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class TestBookClass(unittest.TestCase):
def setUp(self):
app = create_app()
self... |
the-stack_0_12576 | #coding=utf-8
'''
use NTFS usn to iter path
requires Admin
'''
import os
import sys
curpath = os.path.dirname(os.path.realpath(__file__))
#sys.path.append(os.path.join(curpath,'msvc','Debug'))
sys.path.append(os.path.join(curpath,'build','lib.win32-2.7'))
def entry():
import libfileiterusn
count = 0
... |
the-stack_0_12580 | import cv2
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
p = "./test/11.jpg"
oriImg = cv2.imread(p)
oriPoints = np.float32([[896.75,145.0],[1246.5,336.0], [796.0,407.25]])
canvasPoints = np.float32([[797.25,143.5],[1151.25,297.5],[710.75,415.25]])
rotationMatrix = cv2.getAffineTransform(np... |
the-stack_0_12581 | from django.conf.urls import include
from django.urls import re_path
from django.views.decorators.cache import never_cache
from . import views
from .utils import render_xml
services_patterns = [
re_path(r'^monitor\.json$', never_cache(views.monitor),
name='amo.monitor'),
re_path(r'^loaded$', neve... |
the-stack_0_12582 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
""" This file is a part of the VeRyPy classical vehicle routing problem
heuristic library and provides an implementation of the Stewart & Golden (1984)
3-opt* heuristic with Lagrangean relaxatio... |
the-stack_0_12584 | # 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_12586 | # -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket 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 applicab... |
the-stack_0_12588 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from six import text_type
from doommoses.corpus import Perluniprops
from doommoses.corpus import NonbreakingPrefixes
from doommoses.util import is_cjk
perluniprops = Perluniprops()
nonbreaking_prefixes = NonbreakingPrefixes()
class MosesTokenizer(object):
... |
the-stack_0_12589 | """#########################################################################
Author: Yingru Liu
Institute: Stony Brook University
Descriptions: Tools to build an RNN.
----2017.11.01
#########################################################################"""
import tensorflow as tf
from dl4s.core... |
the-stack_0_12591 | import pandas as pd
import numpy as np
import json
g1=pd.read_csv('refugees.csv')
g2=g1.iloc[:,:]
longi=[]
lati=[]
jsonvalue=[]
keys=[]
g1dict={}
#print(g1.columns)
df = pd.DataFrame()
df.fillna(2071)
df['col'] = g1.columns
#print(df)
longi = g1["longitude"].tolist()
lati = g1["latitude"].tolist()
... |
the-stack_0_12593 | # 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_0_12594 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
from setuptools import setup, find_packages
def get_version(*file_paths):
"""Retrieves the version from rele/__init__.py"""
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).read()
... |
the-stack_0_12595 | import matplotlib.pyplot as plt
import pymc3 as pm
from scipy.special import logit, expit
from scipy.stats import gaussian_kde
import numpy as np
plt.style.use('seaborn')
from statsmodels.distributions import ECDF
def calc_hpd(ranks, statistic=np.mean):
with pm.Model() as model:
#prior on statistic of int... |
the-stack_0_12597 | # -*- coding: utf-8 -*-
#
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
the-stack_0_12599 | import discord
from redbot.core.bot import Red
from redbot.core import Config, bank, commands
from redbot.core.i18n import Translator, cog_i18n
from redbot.core.utils.chat_formatting import (
bold,
box,
humanize_timedelta,
humanize_number,
)
try:
from redbot.cogs.audio.audio_dataclasses import Que... |
the-stack_0_12600 | #!/usr/bin/env python
"""
plot_hub.py: the plot tool
"""
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def plt_fidelity_vs_iter(fidelities,losses,config,indx=0):
fig, (axs1, axs2) = plt.subplots(1, 2)
axs1.plot(range(len(fidelities)), fidelities)
axs1.set_xlabel('Epoch')
... |
the-stack_0_12602 | # -*- coding: utf-8 -*-
import os
import sys
import numpy as np
IMAGE_SIZE = 64
#按照指定图像大小调整尺寸
def resize_image(image, height = IMAGE_SIZE, width = IMAGE_SIZE):
top, bottom, left, right = (0, 0, 0, 0)
#获取图像尺寸
h, w, _ = image.shape
#对于长宽不相等的图片,找到最长的一边
longest_edge = max(h, w)
#计算短边需要增加多上像素宽度使其与长边等长
if h < long... |
the-stack_0_12603 | """
============================================================================
Decoding in time-frequency space data using the Common Spatial Pattern (CSP)
============================================================================
The time-frequency decomposition is estimated by iterating over raw data that
has b... |
the-stack_0_12604 | """
Copyright 2019-present NAVER Corp.
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, softw... |
the-stack_0_12605 | """
Create a class to measure the average time lapsed between mark() calls
This is useful to measure how frequent is the price update (i.e. we call mark() method on every price update)
"""
import time
import random
class LatencyMetric:
def __init__(self):
self._last_received_timestamp = time.time_ns()
... |
the-stack_0_12606 | #
# Copyright Contributors to the OpenTimelineIO project
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and rep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.