text stringlengths 3.07k 22.1k |
|---|
#-*- coding: UTF-8 -*-
#
# Copyright 2009 <NAME>
#
# 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, merg... |
"""Functions for manipulating the skeleton object (These could be moved to wkskel repo if not already there)"""
import os
from typing import Sequence
import numpy as np
import pandas as pd
from tqdm import tqdm
import wkskel
from wkskel import Skeleton
from genEM3.data.wkwdata import WkwData
from genEM3.util.path imp... |
import torch
import torch.nn as nn
import torchvision.models as models
import torch.nn.functional as F
from untils.roi_align.modules.roi_align import RoIAlignAvg, RoIAlign
from untils.rod_align.modules.rod_align import RoDAlignAvg, RoDAlign
from torchvision.models.mobilenetv2 import mobilenet_v2 as MobileNetV2
from tor... |
import os
import time
import shutil
import hashlib
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Optional, Callable, List, Set, TypeVar
from nsft_system_utils.file import write_text_file_content, touch_file
try:
from _pytest.... |
import copy
import logging
from json import JSONDecodeError
from sevenbridges.errors import SbgError, NonJSONResponseError
from sevenbridges.meta.fields import Field
from sevenbridges.meta.data import DataContainer
from sevenbridges.meta.transformer import Transform
from sevenbridges.models.enums import RequestParamet... |
import munge
import types
import os
import os.path
import vodka.app
import vodka.exceptions
import vodka.log
import vodka.util
from . import validators
raw = {}
instance = {}
def is_config_container(v):
"""
checks whether v is of type list,dict or Config
"""
cls = type(v)
return issubclass(c... |
#!/usr/bin/env python
import datetime
from flask import url_for
from kvasir import db
from hashlib import md5
from flask.ext.security import UserMixin, RoleMixin
class User(db.Document, UserMixin):
nickname = db.StringField(max_length=255, required=True)
email = db.EmailField(required=True, unique=True)
... |
import warnings
warnings.filterwarnings('ignore', message='The NumPy module was reloaded')
import MySQLdb, sys, os, json, re
import pandas as pd
from bson.json_util import dumps
from datetime import datetime
def validate_string(val):
'''Do validation and checks before insert'''
if val != None:
if typ... |
# -*- coding: utf-8 -*-
import time
import io
import sys
import yaml
import logging
import smtplib
import traceback
from datetime import datetime
from statistics import mean
from garminexport.garminclient import GarminClient
from stravalib.client import Client
from stravalib.exc import ActivityUploadFailed
from nokia ... |
import os
import sys
import time
import shlex
import shutil
import argparse
import traceback
import subprocess
import pptx
import gspread
from pydrive2.auth import GoogleAuth
from pydrive2.drive import GoogleDrive
from alive_progress import alive_bar, alive_it
def replace_powerpoint_text(
presentation: pptx.Prese... |
class MockHit:
def __init__(self, hit_val):
self._hit_val = hit_val
def to_dict(self):
return self._hit_val
"""MOCKED RESPONSES"""
CUSTOM_VAL_KEY = 'indicatorValue'
CUSTOM_TYPE_KEY = 'indicatorType'
CUSTOM_HIT = {
CUSTOM_VAL_KEY: '5.5.5.5',
CUSTOM_TYPE_KEY: 'IP'
}
PARSED_CUSTOM_HI... |
# 深度知识追踪,http://stanford.edu/~cpiech/bio/papers/deepKnowledgeTracing.pdf
from torch.nn.utils.rnn import pack_sequence
from torch.utils.data import Dataset, DataLoader
import torch
from torch.nn import RNN, Sigmoid, Linear, Dropout, Module
from sklearn.metrics import roc_auc_score
import random
import csv
def read_da... |
"""
Smirk - Web Application Framework
Copyright (c) 2016 <NAME>
Source Repository
https://github.com/bFraley/Smirk
MIT License
https://github.com/bFraley/Smirk/blob/master/LICENSE
File: codegen_lib.py
About: Provides utilities for Smirk specific code generation of
HTML, CSS, JS, and other languages and source file ... |
import xlrd
from openpyxl.workbook import Workbook
from openpyxl import load_workbook
from datetime import datetime
from tkinter import filedialog, StringVar, messagebox, ttk, Label
from ttkthemes import ThemedTk
class Converter:
def __init__(self, master):
self.master = master
self.path = StringV... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os
import numpy as np
import scipy.linalg
from warnings import warn
# Here comes the fast implementation:
try:
from _block_diag_ilu import PyILU
except ImportError:
if os.environ.get("USE_FAST_FA... |
# Import required libraries
from turtle import window_width
import pandas as pd
import dash
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
import os
import sys
from dash import html, dcc
from dash.dependencies import Input, Output
pp=os.path.dirname(os.path.abspath(__file__))
pp = os... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.7.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # Prediction Models Analysis
#
# The main goal in th... |
# -*- coding:utf-8 -*-
import os
from collections import OrderedDict
from django.shortcuts import render, get_object_or_404
from django.views import generic
from django.conf import settings
from django.core.cache import cache
from django.db.models.aggregates import (Count, Q)
from rest_framework import viewsets
from ... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 3 15:08:26 2018
@author: johnkenny
"""
from django.http import HttpResponse
#class object repersenting db tables
from .models import Team
from .models import Player
from .models import Fixture
from .models import Table
#used for json handling
im... |
#!/usr/bin/env python
#
# Copyright 2015 <NAME>
#
# 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 applicabl... |
#!/usr/bin/env python
# Copyright 2017 Johns Hopkins University (<NAME>)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import copy
import logging
import os
from chainer.training import extension
import matplotlib
import numpy as np
'''
reuse modules in asr_utils:
CompareValueTrigger, restore_snap... |
# VCS plot-related methods, etc. for AMWG (atmosphere) diagnostics.
# These are too close to the front end to be appropriate for amwg.py.
# N.B. The customize_templates() methods should be moved to here, if this works out ok.
# Probably in some cases the templates share/uvcmetrics.json should be changed.
# It's unco... |
# Copyright 2017 Intel 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 to in wri... |
import os
import numpy as np
import tables as tb
from nose.tools import \
assert_true, assert_false, \
assert_almost_equal, assert_equal, \
assert_raises
import pyne.nucname as nucname
from pyne.pyne_config import pyne_conf
from pyne.material_library import MaterialLibrary
from pyne.material import Materi... |
"""
This is the main module, it handles:
- the flask application
- scheduling news and covid data updates (which can be deleted)
"""
#importing modules for logging
import logging
#Importing modules
import json
import time
#Importing flask modules to run flask
from flask import Flask
from flask import render_... |
# nuke imports
import nuke
import nukescripts
# python imports
import os
# used in tandem with floating windows in the node graph.
# Assigns a 'Close all' method to the alt+` hotkey combo so
# you don't need to click close on all of them.
def closeAllNodes():
"""
Closes all open nodes.
"""
for node ... |
import matplotlib
import matplotlib.collections
import matplotlib.pyplot as plt
import numpy as np
from .entropy_approximate import entropy_approximate
from .optim_complexity_delay import (
_embedding_delay_metric,
_embedding_delay_plot,
_embedding_delay_select,
)
from .optim_complexity_dimension import (
... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import json
import re
import sys
import traceback
try:
import socketserver
except ImportError:
import SocketServer as socketserver
from errno import ENOENT
from os import (
getpid,
unlink
)
from threading import current_thread
... |
#!/bin/env/python
# -*- coding: utf-8 -*-
# Copyright 2010 <NAME>, <EMAIL>
#
# 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 requi... |
#!/usr/bin/python3
import dbus
import dbus.service
import dbus.mainloop.glib
from gi.repository import GLib
import threading
import queue
import traceback
import time
class NotConnectedError(Exception):
pass
class DBusInvalidArgsException(dbus.exceptions.DBusException):
_dbus_error_name = 'org.freedesktop.DB... |
from __future__ import print_function, division
import sys
import os
sys.path.append(os.path.abspath("."))
sys.dont_write_bytecode = True
# from datasets.albrecht import Albrecht
# from datasets.china import China
# from datasets.desharnais import Desharnais
# from datasets.finnish import Finnish
# from datasets.isbsg... |
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... |
import logging
from abc import ABCMeta, abstractmethod
from typing import Dict, Any, Optional, List, Union
import torch
import torch_geometric as geometric
from .layers import GraphConvolutionWrapper, TripletMessagePassingLayer, LinearBlock, MultiplicativeInteractionLayer
from ..core.helpers import Namespace, SuperFa... |
import numpy as np
import pickle
from PIL import Image
import time
import shutil
import random
import argparse
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
import torchvision.models as models
import torch.nn as nn
import torch
import torch.backends.cudnn as cudnn
from to... |
import os
import csv
import argparse
import torch.nn as nn
from tqdm import tqdm
from datetime import datetime
import torch.optim as optim
from pytorch_pretrained_bert import BertAdam
from sklearn.metrics import f1_score, accuracy_score, roc_auc_score
from data.helpers import get_data_loaders
from models import get_mod... |
#-*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os, sys
import numpy as np
import time
sys.path.append(os.path.dirname(sys.path[0])) # 用于上级目录的包调用
from layers import conv2d, depthwise_conv2d, relu, pooling
... |
import ast
from future.builtins.misc import super
from future.utils import with_metaclass
from parsimonious import Grammar, NodeVisitor
from pyjexl.exceptions import InvalidOperatorError
from pyjexl.operators import Operator
def operator_pattern(operators):
"""Generate a grammar rule to match a dict of operator... |
"""
Logging of metrics and weights to local disk and web services.
"""
import logging
import os.path
import sys
import threading
from abc import ABC, abstractmethod
from typing import List, Dict, Any, Literal
import numpy as np
import wandb
from deeperwin.configuration import LoggingConfig, BasicLoggerConfig, Logger... |
#!/usr/bin/env python3
"""
Yandex Transport Webdriver API. Continuous Monitoring tests.
The script to test all API functions. It generates the report JSON file to be sent to the
server which will switch "indicator icons" accordingly (passed, failed).
"""
from yandex_transport_webdriver_api import YandexTransportProx... |
# coding: utf-8
"""
@author: Daan
Finds alignments between two thesauri by performing exact string matching on all possible combinations of types of labels (prefLabel and altLabel) and language (nl and en)
Does a second round of matching in which alignments are found by looking at the stemmed forms of strings that did... |
"""
A collection of classes that write out the demand results files. The default is `HourlyDemandWriter`. A `MonthlyDemandWriter` is provided
that sums the values up monthly. See the `cea.analysis.sensitivity.sensitivity_demand` module for an example of using
the `MonthlyDemandWriter`.
"""
import numpy as np
impor... |
from datetime import datetime,timedelta
from django.contrib.auth.models import User
from pprint import pprint
from django.db.models import Q
import re
from django.contrib import messages
from leave_manager import models as leave_models
from lms_user import models as lms_user_models
from employee import models as employ... |
# Copyright (c) 2012, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
import re
import socket
import mock
from cyclone import web, httpclient
from twisted.application import service
from twisted.internet import defer
from twisted.python import filepath, reflect
from twisted.trial import unittes... |
#!/usr/bin/env python
"""
Author: <NAME>
Purpose: A simple Flask app that manages vlan configuration on network device.
"""
from flask import abort, jsonify, make_response, request
from sqlalchemy.exc import IntegrityError
from database import db, app, Vlans, update_vlans_db
from configurator.provider import manage
... |
"""
A module of generic, reusable tools.
- <NAME> <<EMAIL>>
- First Authored: 2015-01-16
"""
from datetime import datetime
import os
import sys
import pytz
import pickle
class GenericException(Exception):
"""A generic exception for anticipated errors."""
def __init__(self, msg, msg_id=None, filename=None, e... |
import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Sequence, Mapping
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Implementation of Twin Delayed Deep Deterministic Policy Gradients (TD3)
# Paper: https://arxiv.org/abs/1802.0... |
import json
import logging
from ees.model import Response
from ees.commands import *
from ees.infrastructure.dynamodb import DynamoDB
logger = logging.getLogger("ees.infrastructure.aws_lambda")
def event_to_command(event, context={}):
logger.info(f"Parsing incoming event: {event}")
cmd = None
if "requestC... |
import itertools
import pickle
import string
import numpy as np
import pytest
from graphblas import dtypes, lib
from graphblas.dtypes import lookup_dtype
all_dtypes = [
dtypes.BOOL,
dtypes.INT8,
dtypes.INT16,
dtypes.INT32,
dtypes.INT64,
dtypes.UINT8,
dtypes.UINT16,
dtypes.UINT32,
... |
# (C) Copyright 2010-2020 Enthought, Inc., Austin, TX
# All rights reserved.
from functools import partial
import logging
import nevergrad as ng
from nevergrad.functions import MultiobjectiveFunction
import numpy as np
from traits.api import (
Enum,
Float,
provides,
HasStrictTraits,
List,
U... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import json
import time
import os
import logging
import boto3
from multiprocessing import Process
from socket import gethostbyname, gaierror
def split_list(alist, wanted_parts=1):
length = len(alist)
return [ alist[i*length // wanted_parts: (i+1)*length // w... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import grad as torch_grad
import torch.utils.data
from torch.autograd import Variable
import numpy as np
import ot
from torchvision.models.inception import inception_v3
from scipy.stats import entropy
#%% Functions
def entrop... |
# coding=utf8
# Copyright 2018 <NAME>, <NAME>.
# (Strongly inspired by original Google BERT code and Hugging Face's code)
""" Fine-tuning on A Classification Task with pretrained Transformer """
import itertools
import csv
import fire
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoade... |
#!/usr/bin/env python
# coding: utf-8
# title : fully-connected neural network & loss drop in different situation
# 상황 )
# - one input layer(size 2), one hidden layer(size 8), one output layer(size 1)
# - learning rate : [0.001,0.005]
# - stochastic gradient descent : weight update ( batch size = 1 )
# - (a) pl... |
from django.contrib.auth.decorators import permission_required
from django.http import HttpResponse
from xlwt import Workbook
from mittab.apps.tab.models import Team, Judge, Room, Debater
from mittab.libs import tab_logic
def _create_vn_str(novice_status):
"""Creates varsity-novice status string from the integer... |
'''
Objects used in the maze
'''
import pygame
#create a vertex object
class v:
def __init__(self,x,y,s):
self.x = x
self.y = y
self.s = s # Makes vertex arithmetic easier
self.weight = 0 #used in Dijkstra's algorithm
# Store the vertex reference coordinates
# i.e. ... |
# ====================================================================
# Author : swc21
# Date : 2018-03-14 09:41:45
# Project : ClusterFiles
# File Name : evenbetterfit
# Last Modified by : swc21
# Last Modified time : 2018-03-14 11:00:16
# ===========================================================... |
from utils import camelcase
import utils
import i18n
damage_type_constants = {
'DOTA_ATTRIBUTE_STRENGTH': 'str',
'DOTA_ATTRIBUTE_AGILITY': 'agi',
'DOTA_ATTRIBUTE_INTELLECT': 'int'
}
ability_behavior_list = [
'DOTA_ABILITY_BEHAVIOR_NO_TARGET',
'DOTA_ABILITY_BEHAVIOR_PASSIVE',
'DOTA_ABILITY_BEHA... |
"""
Tests the `ephem_utils` module.
This script compares sunrise and sunset times as well as civil, nautical,
and astronomical dawn and dusk times computed by the `astro_utils` module
to ones calculated by the United States Naval Observatory (USNO). The tests
use USNO tables downloaded from
http://aa.usno.navy.mil/dat... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
# Command line :
# python -m benchmark.GG.GB
import os
import logging
from config import SEED
import numpy as np
import pandas as ... |
import logging
import os
import warnings
import pandas as pd
import csv
import itertools
from cellpy import filefinder, prms
from cellpy.exceptions import ExportFailed, NullData, WrongFileVersion
import cellpy.parameters.internal_settings
# logger = logging.getLogger(__name__)
hdr_summary = cellpy.parameters.intern... |
import json
from typing import Any, Dict, List, Set, Tuple
import pytest
import pymq
from pymq.json import DeepDictDecoder, DeepDictEncoder
from pymq.typing import deep_from_dict, deep_to_dict, fullname
class SimpleNested:
name: str
value: int
def __init__(self, name=None, value=None) -> None:
... |
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Input, RNN, LSTMCell, Flatten, Dense, ReLU
from tensorflow.keras.models import Model
from tensorflow.keras.initializers import Orthogonal
cnn_dict = {}
def register(fn_name):
def mappin... |
"""
Django settings for devday project.
Originally generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
Please... |
#! -*- coding:utf-8 -*-
# 通过对抗训练增强模型的泛化性能
# 比CLUE榜单公开的同数据集上的BERT base的成绩高2%
# 数据集:IFLYTEK' 长文本分类 (https://github.com/CLUEbenchmark/CLUE)
# 博客:https://kexue.fm/archives/7234
# 适用于Keras 2.3.1
import json
import numpy as np
from bert4keras.backend import keras, search_layer, K
from bert4keras.tokenizers import Tokenizer
... |
import struct
from typing import Any, List, Optional, Tuple, Union, cast
_fmts = {
"u64": "<Q",
"u32": "<I",
"u16": "<H",
"u8": "<B",
"i64": "<q",
"i32": "<i",
"i16": "<h",
"i8": "<b",
"f32": "<f",
"f64": "<d",
}
class _TokenParser:
# c0: number
# size: number
# ... |
# Copyright 2020 The Sabertooth 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 or agreed to ... |
"""This script contains methods to plot multiple aspects of the results
of MSAF.
"""
import jams
import logging
import mir_eval
import numpy as np
import os
# Local stuff
from msaf import io
from msaf import utils
translate_ids = {
"2dfmc": "2D-FMC",
"cnmf3": "C-NMF",
"foote": "Ckboard",
"levy": "CC"... |
#!/usr/bin/env python3
'''
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER... |
# 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, ... |
# Copyright 2020 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, ... |
# This file updates the figures. It is called by app.py
import numpy as np
import plotly.figure_factory as ff
import plotly.graph_objects as go
from PIL import Image
import calculations as calc
def remove_mesh_points(X, Y, h1, h2, K, W, L):
# This function is used for making flow arrows on the elevation plot.
... |
from easydict import EasyDict
import math
from typing import List
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.optim.optimizer import Optimizer
def get_optimizer(cfg: EasyDict, params: List):
cfg_name = cfg.name
if cfg.name == 'adam':
optimizer = torch.optim.Adam(par... |
import time
import requests
from django.conf import settings
from django.core.cache import cache
from barriers.constants import Statuses
from barriers.models import (
ActionPlan,
Barrier,
Commodity,
EconomicAssessment,
EconomicImpactAssessment,
HistoryItem,
Note,
PublicBarrier,
Pub... |
import batchent
import entropy
import spectral_pca
from scipy.spatial import distance
import csv
import index
import numpy
import previous_ent
import dkl
import pandas as pd
import imp
import math
import spread
import pickle_commands as pc
import Song_D_KL_calc_MK as sdkl_mk
import syllabify
import acoustic_transition_... |
"""Author: <NAME>, All rights reserved, 2018."""
import torch
import numpy as np
if torch.cuda.is_available():
from .skcuda_utils import cublas
CUDA = True
else:
print('CUDA not available in torch, GPU version will not work')
CUDA = False
if not torch.backends.mkl.is_available():
print('MKL not a... |
import sys
from logging import getLogger
from django_filters.constants import EMPTY_VALUES
from rest_framework import exceptions
from caluma.data_source.data_source_handlers import (
get_data_source_data,
get_data_sources,
)
from . import jexl
from .format_validators import get_format_validators
from .models... |
"""PCSC Smartcard request.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: <NAME>, mailto:<EMAIL>
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foun... |
# -*- coding: utf-8 -*-
import codecs
import json
import os
import tempfile
from django import forms
from django.core.files.storage import default_storage as storage
from mock import patch
from nose.tools import eq_
from pyquery import PyQuery as pq
import amo
import amo.tests
from amo.tests.test_helpers import get_... |
# Copyright (C) 2010 Canonical
#
# Authors:
# <NAME> <<EMAIL>>
#
# This program 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; version 3.
#
# This program is distributed in the hope that it will be useful, b... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from maskrcnn_benchmark.modeling.rotated_box_coder import BoxCoder
from maskrcnn_benchmark.structures.bounding_box import BoxList
from maskrcnn_benchmark.structures.boxlist_ops import cat_boxlist
from maskrcnn_benchmark.modeling.rrpn.... |
import os
import re
import shlex
import subprocess
from itertools import islice
from operator import itemgetter
from zorro.di import has_dependencies, dependency, di
from .base import GadgetBase, TextField
from tilenol.commands import CommandDispatcher
from tilenol.window import DisplayWindow
from tilenol.events impo... |
from pygame.locals import *
from random import randint
import pygame
import time
import numpy as np
import datetime
import agents
### WALL ###
class Wall:
def __init__(self,game_size,box_size, random_wall = False):
self.box_size = box_size
self.game_size = game_size
self.X, self.Y = self.ma... |
from corehq.apps.products.models import SQLProduct
from corehq.apps.reports.sqlreport import SqlTabularReport
from corehq.apps.reports.standard import CustomProjectReport, ProjectReportParametersMixin, MonthYearMixin
from couchexport.models import Format
from custom.ilsgateway.models import SupplyPointStatusTypes, Orga... |
""" An rbm implementation for TensorFlow, based closely on the one in Theano """
import tensorflow as tf
import math
import numpy as np
def sample_prob(probs):
"""Takes a tensor of probabilities (as from a sigmoidal activation)
and samples from all the distributions"""
return tf.nn.relu(
tf.sig... |
# Copyright 2019 StreamSets Inc.
#
# 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 writi... |
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c), The AiiDA-CP2K authors. #
# SPDX-License-Identifier: MIT #
# AiiDA-CP2K is hosted on GitHub at https://github.com/a... |
# -*- coding: utf-8 -*-
""" auto documentation for django-rest-framework
usage:
@autodoc("List or create an account")
class PaginatedVersionedAccountApi(ApiVersionMixin, ListCreateAPIView):
...
you can skip certain classes:
@autodoc(skip_classess=[PaginationAutodoc])
or ad... |
# Copyright 2017 Rice University
#
# 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 i... |
"""
..
Copyright (c) 2016-2017, Magni developers.
All rights reserved.
See LICENSE.rst for further information.
Module providing public functions for the magni.imaging.measurements
subpackage.
Routine listings
----------------
lissajous_sample_image(h, w, scan_length, num_points, f_y=1., f_x=1.,
theta... |
from pymongo import MongoClient, ReturnDocument
from pymongo.errors import PyMongoError, ConnectionFailure, ServerSelectionTimeoutError, DuplicateKeyError, AutoReconnect
from pymongo.write_concern import WriteConcern
from pymongo.read_concern import ReadConcern
from bson.objectid import ObjectId
import logging.config
... |
#!/shared/python3shared/bin/python3
"""
:Summary:
With the lack of consensus of which metric is most suitable to determine the most appropriate classifier, we use an inclusive approach.
This includes multiple measures which are commonly used in classification tasks, such as accuracy and AUC, allowing for a more intu... |
import numpy as np
import pandas as pd
from enlopy.utils import make_timeseries
from enlopy.generate import (add_noise, gen_daily_stoch_el, gen_load_from_daily_monthly, gen_load_sinus, gen_demand_response,
disag_upsample, clean_convert, countweekend_days_per_month,
... |
"""
Ensembling methods for object detection.
# USAGE: edit a, b, c as the csv file you want to ensemble
# If you want to change size of width, height, modify convert_ratio.
# There should be './stage_2_sample_submission.csv' in your working directory.
# Output will be './ensemble_answer.csv'
"""
impo... |
import pdb
from copy import deepcopy
import torch
from torch import nn
from xd import Conv, XD, int2tuple
def get_module(model, module_string):
if module_string:
for substring in module_string.split('.'):
model = getattr(model, substring)
return model
WeightNorm = type(list(torch.nn.uti... |
import os
import sys
import time
import datetime
import subprocess
import logging
import shutil
import threading
import pydicom
tags = {
'SeriesNumber': (0x0020, 0x0011),
'SeriesDescription': (0x0008, 0x103E),
'SOPInstanceUID': (0x0008, 0x0018),
'SeriesInstanceUID': (0x0020, 0x000E),
... |
from discord.ext import commands
import discord
import chess
import chess.svg
import random
import cairo
import cairosvg
import logging
import asyncio
import time
import threading
logging.basicConfig(level=logging.DEBUG)
class Player:
def __init__(self, color, username, id):
self.color = color
sel... |
"""Lightweight implementation of Telenczuk 2020 kernel LFP approximation"""
import numpy as np
from numpy.typing import ArrayLike
import scipy
import pickle
import importlib.resources as pkg_resources
def _load_uLFP_A0_profile(fname):
with pkg_resources.open_binary(__package__, fname) as f:
A0_profile = p... |
import os
import logging
from collections import defaultdict
from fs.errors import ResourceNotFound, InvalidCharsInPath
from lml.plugin import PluginManager
from moban import constants, exceptions
from moban.core import utils
from moban.externals import reporter, file_system
from moban.deprecated import deprecated_mo... |
# -*- encoding: utf-8 -*-
'''
@Description: :ZXinc_IPv6数据库查询与更新
@Date :2020/06/24 22:56:01
@Author :Forked from https://github.com/lilydjwg/winterpy
@version :2.0
Parse IPDB database files.
Get it here: http://ip.zxinc.org/
License: GPLv3 or later
'''
import os
import sys
import re
import time... |
# Copyright (c) 2021-2022, <NAME>, Jonxslays
# 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. Redistributions of source code must retain the above copyright notice, this
# list of conditi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.