text stringlengths 3.07k 12.6k |
|---|
from time import sleep
from typing import Counter
from dbService.api import get_outside_sensors_data, get_room_count_open_windows, get_room_devices, get_rooms, get_turn_off_room_devices
import itertools, socket, windowScoreCalculator
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.sets... |
# Copyright 2014-2018 The PySCF Developers. 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... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright [2010] [Anso Labs, 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.... |
'''
Created on Apr 9, 2018
@author: <NAME>, <NAME>
'''
import Util
from collections import Counter
import random
from HyperParameters import name_embedding_size, type_embedding_size
max_nb_args = 2
class CodePiece(object):
def __init__(self, callee, arguments, src):
self.callee = callee
self.... |
# pylint: disable=C,R,E1101,E1102,W0622
import torch
import numpy as np
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
from se3cnn import basis_kernels
from functools import partial
from se3cnn.blocks import GatedBlock
from experiments.datasets.modelnet.modelnet_old import ModelNet10, Obj... |
import pytest
import numpy
import pandas
from dataset import Dataset
# collect helpful articles here:
# https://semaphoreci.com/community/tutorials/testing-python-applications-with-pytest
# TODO (johngiorgi): is there a better way to get the dummy_word_types?
# TODO (johngiorgi): Update example with words 'null' and... |
import argparse
import glob
import csv
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.preprocessing import sequence
from tensorflow.contrib import rnn
from sklearn.metrics import classification_report, precision_recall_fscore_support
from vectorizer import TokenizingEmbeddingVectorizer
... |
from datetime import timedelta
from django.contrib.auth.models import Group
from django.test.utils import get_runner
from django.utils import six
from django_performance_testing import test_runner as djpt_test_runner_module
from django_performance_testing.serializer import Reader
from freezegun import freeze_time
impor... |
# -*- coding: utf-8 -*-
"""bioimageit_core docker process service.
This module implements a service to run process in
using Docker.
Classes
-------
ProcessServiceProvider
"""
import os
import subprocess
from bioimageit_core.config import ConfigAccess
from bioimageit_core.core.utils import Observable
from bioimag... |
from calendar import c
from math import remainder
import re
import pyautogui
import time
import line
pyautogui.FAILSAFE= 2.5
def is_loading():
loading_img = pyautogui.locateOnScreen('images/loading.png', grayscale=True, confidence=0.7)
if loading_img is None:
return False
print('loading is appear... |
#!/usr/bin/env python3
"""
Sample script to combine LiDAR data to generate point cloud.
"""
import argparse
import datetime
import matplotlib.pyplot
import numpy
import pytz
import scipy.interpolate
import scipy.spatial.transform
import utm
from mpl_toolkits.mplot3d import Axes3D
import cepton_sdk.export
import cept... |
# -*- coding: utf-8 -*-
import json
import os.path
from uuid import UUID
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.functional import lazy
import commonware.log
from djang... |
import torch
import torch.nn.functional as F
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from vtpack import _C
class _GrainedSampleCompress(Function):
@staticmethod
def forward(ctx, input, patches, height, width, num_extra_tokens):
... |
"""
Overrides cross_val_score to store Fit and Metric Events for each fold.
"""
import numpy as np
import time
import warnings
import sys
from sklearn.grid_search import ParameterGrid, _CVScoreTuple
from sklearn.pipeline import Pipeline
from sklearn import datasets, linear_model, cross_validation
from sklearn.cross_val... |
import logging
import os
from typing import List, Tuple
import numpy as np
from mlagents.trainers.buffer import AgentBuffer
from mlagents.trainers.brain import BrainParameters
from mlagents.trainers.brain_conversion_utils import group_spec_to_brain_parameters
from mlagents_envs.communicator_objects.agent_info_action_pa... |
# Copyright 2020 DataStax, 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 writing,... |
"""Dependency parsing using MALT Parser."""
import logging
import re
import sparv.util as util
from sparv import Annotation, Binary, Config, Model, ModelOutput, Output, annotator, modelbuilder
log = logging.getLogger(__name__)
# Running malt processes are only kept if the input is small: otherwise
# flush() on std... |
# Copyright 2013 Google, Inc. All Rights Reserved.
#
# Google Author(s): <NAME>, <NAME>
from fontTools import ttLib
import fontTools.merge.base
from fontTools.merge.cmap import computeMegaGlyphOrder, computeMegaCmap, renameCFFCharStrings
from fontTools.merge.layout import layoutPreMerge, layoutPostMerge
from fontTools... |
import os
import pandas as pd
def bea_use(data_dir):
from .parse import bea_use
data_dir = os.path.join(data_dir, "windc_2_0_1", "BEA", "IO")
df = []
for i in dir(bea_use):
if callable(getattr(bea_use, i)):
df.append(getattr(bea_use, i)(data_dir))
df = pd.concat(df, ignore_i... |
import random
#using pygame python GUI
import pygame
import time
pygame.init()
# Setting the width and height of the screen [width, height]
size = (1200, 700)
screen = pygame.display.set_mode(size)
cellSize = 6
wallThickness = 2
unvisited = []
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255... |
import logging
import random
from collections import defaultdict
from math import sqrt, log10
import numpy as np
import tqdm
from rec.dataset.dataset import Dataset
from rec.recommender.base import SessionAwareRecommender
from rec.recommender.sknn import SetSimilarities
class VMSessionKnnRecommender(SessionAwareRec... |
'''
Data handling, this is currently sqlite
'''
import sqlite3
import threading
from pprint import pprint
import aegir.config
dbconn = None
def init(app):
#app.before_first_request(instance_init)
app.after_request(after_request)
pass
def dict_factory(cursor, row):
d = {}
for idx, col in enumera... |
import os
import sys
from keras import backend as K
import tensorflow as tf
from keras_model import ModelFactory
#from configparser import ConfigParser
import numpy as np
import pandas as pd
from PIL import Image
from random import shuffle
#from skimage.transform import resize
#os.environ["CUDA_VISIBLE_DEVICES"] = "0"
... |
import itertools
import random
import vectorization_tools
from digit_input import Digit
from digit_mutator import DigitMutator
from utils import print_archive
import numpy as np
from deap import base, creator, tools
from deap.tools.emo import selNSGA2
from tensorflow import keras
import archive_manager
from individu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import wave
import numpy
import csv
import cPickle as pickle
import librosa
import yaml
def load_audio(filename, mono=True, fs=44100):
"""Load audio file into numpy array
Supports 24-bit wav-format, and flac audio through librosa.
Parameters
-... |
import Xlib.display
import numpy as np
import cv2 as cv
import atexit
import subprocess
import sys
import os
import time
import argparse
import glob
from typing import List, Optional, Callable, Tuple
# add 'PathBench/tests' to system path for module imports
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.a... |
"""abstract base class for f1-micro averaging evaluation for tag components, spans detection + classification"""
from src.evaluators.evaluator_base import EvaluatorBase
class EvaluatorF1MicroSpansAlphaMatchBase(EvaluatorBase):
"""
EvaluatorF1MicroSpansAlphaMatchBase is an abstract base class for f1-micro aver... |
import pygame
import sys
import numpy
pygame.init()
FPS = 60
WIN_WIDTH = 600
WIN_HEIGHT = 400
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RUNNING = True
RADIUS = 4
EPS = 0.0000001
clock = pygame.time.Clock()
sc = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT))
FONT = pygame.font.Font(None, 20)
def lieInBoarders... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# The program reads from console and writes input into an XML file
import argparse
from glob import glob
import os
import sys
import xml.dom.minidom
import xml.etree.ElementTree as ET
def add_to_xml(xml_file, message):
# parse the message
message_tree = ET.fromstr... |
import pygame
import random
import math
from pygame import mixer
pygame.init()
screen = pygame.display.set_mode((800, 600))
# Music load
mixer.music.load('background.wav')
mixer.music.play(-1)
# Title
pygame.display.set_caption('Space Invaders')
# Photos
icon = pygame.image.load('idea.png')
pygame.display.set_icon... |
from variable import GlobalVar
# from gstreamer import *
from gstreamer_appsink import gst_appsink_init
from gstreamer_appsrc import gst_appsrc_init
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GObject, GLib
from yolo import YoloNet
from minitouch import TouchStatus, MiniTouch, XY
import ... |
# -*- coding: utf-8 -*-
import functools
import reader
import printer
import lib
from datatypes import Nil, Bool, Symbol, LinkedList
from env import Env
from core import ns, concat
from errors import NoEnvFound, NoSpecialFormFound
# special forms (TODO: special forms)
SF_DEF = "def!"
SF_DO = "do"
SF_FN = "fn*"
SF_IF... |
import pytest
from pywikigraph import WikiGraph
# +---+
# +---------->| C |---+
# | +---+ +--->+---+ +---+
# +---+ | F -------->| H |+-----+
# +------->| A | +-->+---+ +----+---+ ... |
# -*- coding: utf-8 -*-
# pylint: disable-msg=E0602, E1103
"""
This package contains all the abstraction patterns.
"""
from .rhythm import (
RHYTHMSTART_PATTERN,
SINUS_PATTERN,
TACHYCARDIA_PATTERN,
EXTRASYSTOLE_PATTERN,
BRADYCARDIA_PATTERN,
RHYTHMBLOCK_PATTERN,
VFLUTTER_PATTERN,
ASYSTOLE... |
import os
from copy import copy, deepcopy
from datetime import datetime
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
from typing import List
from utils import Cell, cellStates, color_world, cellTypes, gen_save_plots, init_world, choose_moore_domain, \
precompute_moore_domai... |
import pytest
from bank import Bank
from atm_controller import AtmController, ControlType
from cash_bin import CashBin
from card_reader import CardReader
@pytest.fixture(scope="module")
def cards():
""" 카드 데이터 fixture 생성 """
# 쉽게 알아보기 위하여 card number와 account를 문자열로 처리
card_list = {
"card1": [
... |
load("//bazel/linux:providers.bzl", "KernelBundleInfo", "KernelImageInfo", "RuntimeBundleInfo", "RuntimeInfo")
load("//bazel/linux:utils.bzl", "expand_deps", "get_compatible")
load("//bazel/utils:messaging.bzl", "location", "package")
load("//bazel/utils:files.bzl", "files_to_dir")
load("@bazel_skylib//lib:shell.bzl", ... |
'''
the unweighted perfect matching algorithm is referenced the following materials.
https://stanford.edu/~rezab/classes/cme323/S16/projects_reports/shoemaker_vare.pdf
'''
import logging
logger = logging.getLogger('blossom')
from blossom.graph import UGraph, Blossom
from blossom.tree import Tree
def find_perfect_m... |
'''
Deserializes mutation sequence
data to a more easily
digestable format
USAGE EXAMPLE:
arr = np.array([[1,2,3], [4,5,6]])
ms = MutationSequence(numpy_matrix)
for mutation in ms:
# Do something with mutation object
'''
class Mutation:
END_OF_SEQUENCE = 17
def __init__(self, serialized_params):
... |
import turtle
def check_braces(s): #program to check for braces
c=0
d=0
for ch in s:
if ch=="{":
c=c+1
elif ch=="}":
d=d+1
if(d>c):
return 0
if c!=d:
return 0
else:
return 1
def check_keyword(s,j):
... |
from logging import getLogger
from openprocurement.api.constants import TZ
from openprocurement.tender.core.utils import (
context_unpack,
get_now,
has_unanswered_questions,
has_unanswered_complaints,
block_tender,
)
from openprocurement.tender.openua.utils import check_complaint_status, add_next_a... |
from nornir import InitNornir
from nornir.plugins.tasks.networking import netmiko_send_command
from nornir.plugins.functions.text import print_result
from nornir.core.task import Result
import argparse
import sys
from pathlib import Path
from datetime import datetime, timedelta
import yaml
# Nornir Tool
#
# -c "comma... |
#!/usr/bin/env python3
# Copyright 2021 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.
"""Runs dwarfdump on passed-in .so."""
import bisect
import dataclasses
import subprocess
import typing
import path_util
@dataclass... |
from Lib.Node import SingleLinkNode
from Lib.LinkedList import LinkedList
from Lib.Stack import Stack
from Lib.Queue import Queue
from Lib.Tree import BinaryTree
import os
import sys
import filecmp
class bcolors:
GREEN = '\033[92m'
RED = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
cla... |
from collections import Iterable
import numpy as np
import tensorflow as tf
try:
import cPickle as pickle
except ImportError:
import pickle
from tensorflow.keras.layers import Layer
def convert_to_noisy_model(model: tf.keras.Model, shape, lambda_0):
inp = tf.keras.layers.Input(shape)
x = inp
fo... |
import json
import warnings
from datetime import datetime
import candig.server.exceptions as exceptions
from pronto import Ontology
class OntologyFile():
"""
Get a list of ontology terms of an ontology file.
Example usage:
from pronto import Ontology
ont = Ontology("https://raw.githubuserconte... |
from os import path, mkdir
from shutil import rmtree, copyfile
from http import server
import hashlib
from random import choice, random, shuffle
from time import time_ns
from threading import Thread
WEBTREE = {}
F = lambda : int(random() * random() * time_ns()/10000) % 0x100
class HTTPRequestHandler (server.SimpleH... |
"""
MIT License
Original work: Copyright (c) 2018 <NAME>
Modified work: Copyright (c) 2019 <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... |
#!/usr/bin/env python3
from itertools import takewhile
import os
import sys
import posixpath
from urllib.parse import urlparse
import re
import cchardet as chardet
import argparse
# FIXME: need a better method than str.replace(), there are situations where it
# will accidentally replace the wrong text. For example hav... |
""" Base class and options for API clients """
# pylint: disable=no-self-use,too-few-public-methods
import abc
import asyncio
import inspect
import json
import logging
import socket
from typing import Any, Callable, Dict, Optional, Union
from urllib.parse import urljoin, urlparse
import httpx
import websockets.client... |
import asyncio
import struct
from contextlib import suppress
from bitahoy_sdk.addon.utils import Device
from watchdog.core.modules import Module
from watchdog.ipc.event import (
ADDONQUEUE,
DEVICEID_DEVICELIST,
DEVICEID_NEWDEVICE,
DEVICEIDDATA_DHCP,
DEVICEIDDATA_NETDISCO,
NODECONFIG,
Event... |
from typing import TypeVar, List
from copy import copy
from math import sqrt
import random
import numpy as np
from jmetal.component.archive import BoundedArchive
from jmetal.component.evaluator import Evaluator, SequentialEvaluator
from jmetal.core.algorithm import ParticleSwarmOptimization
from jmetal.core.operator ... |
"""
MIT License
Copyright (c) 2022 Texas Tech University
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, merge, pu... |
import datetime
import functools
from flask import (
Blueprint, flash, g, redirect, render_template, request, url_for, current_app
)
from sqlalchemy import and_
from flask_login import current_user
from werkzeug.exceptions import abort
from flask_login import login_required
from . import main
from .forms import Cr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.urls import reverse
from django.http import HttpResponse,HttpResponseRedirect
from django.views.generic.base import View
from app_spider.models import APP_API,APP_TEMPLETE_ROOT
from mysite.settings import RED... |
from __future__ import annotations
import itertools as its
from dataclasses import dataclass
from math import ceil, floor
from typing import Optional, Union
from ..solution import Solution
@dataclass
class Number:
left: Union[Number, int]
right: Union[Number, int]
parent: Optional[Number]
@classmet... |
"""Custom write module."""
from docutils import nodes
from docutils.nodes import Node
from sphinx.writers.html5 import HTML5Translator
from sphinx_revealit.elements import RjsElementSection
from sphinx_revealit.nodes import RevealjsNode, revealjs_break
def has_child_sections(node: nodes.Element, name: str):
"""S... |
#!/usr/bin/env python3
"""
Image Processing -- SCC0251/5830— Prof. <NAME>
Assignment 1 : image generation
assignment1: fundamentals of image processing -- generation, sampling, and quantization
2021, April -- 1º Semester
"""
__author__ = "<NAME> -- NUSP: 11023222"
import numpy as np
import... |
# Copyright 2021 <NAME>
# Contact: <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 required by applicable law or agreed... |
# Python script to encode data to DNA and then decode it
# Developed by: <NAME>
# Git Hub: https://github.com/wdhobgood/DataToDNAConverter.git
#-------------------------------------------------
# Import
from tkinter.constants import TRUE
from HammingCode import emitterConverter, receptorConverter
import dateti... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
import matplotlib
import multiprocessing as mp
import numpy as np
import os
import cv2
import sys
# Fix problem: no $DISPLAY environment variable
matplotlib.use('Agg')
from argparse import ArgumentParser
from datetime import datetime as dt
from ... |
from DataLoad.DataLoad_NER import *
import os
from wt_DataUtils.Alphabet import CreateAlphabet
import time
import shutil
from wt_DataUtils.batch_iterator import *
from wt_DataUtils.UniversalData import *
from wt_DataUtils.wt_Embed import *
from model.Sequence_Label_Model import *
from model_test import *
def get_lear... |
'''
/*----------------------------------------------------------------------------
/* Copyright (c) FIRST 2008. All Rights Reserved.
/* Open Source Software - may be modified and shared by FRC teams. The code
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. ... |
import argparse
import os
from datetime import datetime
import torch
import torchvision.transforms as transforms
from dataset import ApesDataset, AttributesDataset, mean, std
from model import MultiOutputModel
from test import calculate_metrics, validate, visualize_grid
from torch.utils.data import DataLoader
from tor... |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import cholesky, cho_solve, solve_triangular
from scipy.spatial.distance import pdist, cdist, squareform
from sklearn.datasets import fetch_openml
def main():
plot_gpr_on_f(f=lambda x: np.sin(x), n_train=5, x_min=-np.pi, ... |
# ---------------------------------------------------------------------
# Time Patterns DSL compiler
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Pyth... |
from bs4 import BeautifulSoup as bs
import os
from .core.Crawler import Crawler, parse_tree, read_file
def _fo(x):
p = list()
if x[0]:
p.append('i' + str(x[0]))
if x[1]:
p.append('c' + str(x[1]))
if x[2]:
p.append('p' + str(x[2]))
return 'https://www.zhipin.com/{}/'.format('... |
# -*- coding: utf-8 -*-
#
import sqlalchemy as sa
from aiohttp.web import View
from aiohttp_jinja2 import render_template, template
from aiohttp_session import get_session
from .saform import generate_form
from sqlalchemy import func, select
import sqlalchemy.sql.sqltypes as types
import copy
class AdminListView(View... |
import torch
import torchvision
import torchvision.transforms as transforms
import numpy as np
import time
import matplotlib.pyplot as plt
import argparse
import torch.optim as optim
import os
from models import *
class Trainer():
def weights_init(self, m):
classname = m.__class__.__name_... |
# Copyright (c) 2003-2005 <NAME>. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... |
import numbers
from abc import ABCMeta, abstractmethod
import numpy as np
from sklearn.base import BaseEstimator, is_classifier
from sklearn.utils import check_random_state, check_scalar
from sklearn.utils.validation import check_is_fitted
from . import _criterion, _splitter
from ._tree import Tree, DepthFirstTreeBui... |
import json
# keras module for building LSTM
from keras.preprocessing.sequence import pad_sequences
from keras.layers import Embedding, LSTM, Dense
from keras.preprocessing.text import Tokenizer
from keras.models import Sequential
import keras.utils as ku
from keras.models import load_model
import re
import sys
# set ... |
import theano
import theano.tensor as T
import numpy as np
def clipped_gradients(gradients, gradient_clipping):
clipped_grads = [T.clip(g, -gradient_clipping, gradient_clipping)
for g in gradients]
return clipped_grads
def gradient_descent(learning_rate, parameters, gradients):
... |
import random
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from src.utils import BaseNet, cprint, to_variable
from src.utils import rms
from src.probability import homo_Gauss_mloglike
def ensemble_predict(net, savefiles, x, return_model_std=False, return_individual_functions=False, to_cpu=F... |
#!/usr/bin/env python
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2009-2020 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.ec... |
import argparse
from tensorflow.contrib.keras import datasets
from tensorflow.contrib.keras import models
from tensorflow.contrib.keras import layers
from tensorflow.contrib.keras import preprocessing
from tensorflow.contrib.keras import optimizers
import os
import numpy as np
HEIGHT = 32
WIDTH = 32
CHANNELS = 3
SA... |
import logging
import os
import time
from dataclasses import dataclass, field
from typing import List, Optional
import inspect
import torch
from torch.utils.data.dataset import Dataset
from ...tokenization_roberta import RobertaTokenizer, RobertaTokenizerFast
from ...tokenization_utils import PreTrainedTokenizer
from... |
#!/usr/bin/python3
description_text = 'SplitTomogram: split the tiled images from a tilt-series into a individual images and stack.'
##############################################################################
## Adapted from `split.sh` to Python scripting
## CryoMontage tilt series developed by <NAME>, Wright Lab... |
#!/usr/bin/env python
# configuration.py
# Munki Enrollment Server
# Configuration used by the Enrollment Server.
# Written by <NAME> (<EMAIL>)
# Project started 2015-06-15. This file created 2015-07-24.
# 2016-09-19, 2016-10-11, 2016-10-18.
# Copyright Georgia State University.
# This script uses publicly-documente... |
import os
from deeploader.dataset.dataset_dir import FileDirReader
from deeploader.util.opencv import *
WIN_NAME = 'label-tool'
WIN_SIZE = (1000, 800)
def get_screen_size():
import tkinter
win = tkinter.Tk()
w = win.winfo_screenwidth()
h = win.winfo_screenheight()
win.quit()
return w, h
WI... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import abc
import numpy as np
import torch
import torch.nn as nn
from habitat_baselines.common.utils import Categorical... |
# Confidential Information of Forward Networks, Inc.
# Copyright (c) 2015 Forward Networks, Inc. All rights reserved.
import json
import subprocess
import abc
class Check(object):
'''Base class for all Forward checks.
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def to_check_dict(self):... |
# Copyright (C) 2021 UAVCAN Consortium <uavcan.org>
# This software is distributed under the terms of the MIT License.
# Author: <NAME> <<EMAIL>>
from __future__ import annotations
import typing
import logging
import asyncio
import concurrent.futures
from pyuavcan.presentation import Publisher
from org_uavcan_yukon.... |
"""gdrive_sync tasks"""
import logging
from datetime import datetime
import celery
import pytz
from celery import chain, chord
from dateutil.parser import parse
from django.conf import settings
from content_sync.tasks import sync_website_content
from gdrive_sync import api
from gdrive_sync.api import (
create_gdr... |
import os
import sys
import json
import wget
import glob
import boto3
import logging
import requests
import argparse
import xmltodict
import pandas as pd
import xml.etree.ElementTree as ET
from logging.handlers import TimedRotatingFileHandler
FORMATTER = logging.Formatter("%(asctime)s %(levelname)s %(name)s %(lineno)d... |
#!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from utils import utils, inspector
# https://www.oig.dol.gov/auditreports.htm
archive = 1979
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
# - Fix published date ... |
import unittest
from welltrajconvert.wellbore_trajectory import *
def compare_arrays(array_a, array_b):
"""compare array a and array b values"""
comparison = array_a == np.array(array_b)
return comparison.all()
class TestWellboreTrajectoryCalcLatLonPoints(unittest.TestCase):
def test_wellbore_trajec... |
from django import forms
from .models import *
from academic.models import ClassInfo
class AcademicInfoForm(forms.ModelForm):
class Meta:
model = AcademicInfo
exclude = ['registration_no', 'status', 'personal_info', 'address_info', 'guardian_info', 'emergency_contact_info', 'previous_academic_info... |
# MIT License
# Copyright (C) <NAME>-<NAME> (taoyil AT UCI EDU)
import logging
import tkinter
from typing import TYPE_CHECKING
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from uci_cbp_demo.backend.bluet... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, fmt_money, flt, nowdate, getdate
from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricin... |
import asyncio
import signal
import time
from nats.aio.client import Client as NatsClient
def require_connect_async(func):
async def wrapper(self, *args, **kwargs):
if not self.connected and self._connect_params is not None:
await self.connect_async(**self._connect_params)
return awai... |
import os
import numpy as np
import pandas as pd
import os, time
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier
from sklearn.metrics import accuracy_score, classification_report, ... |
import numpy as np
import warnings
import src.core.constants as constants
import src.retina_net.datasets.dataset_utils as dataset_utils
def read_labels(
label_path,
difficulty='hard',
categories=(
'car',
'pedestrian',
'cyclist')):
"""
Reads ground truth labels and parses t... |
"""
This file is part of the accompanying code to our paper
<NAME>., <NAME>., <NAME>., & <NAME>. (2021). Uncovering flooding mecha-
nisms across the contiguous United States through interpretive deep learning on
representative catchments. Water Resources Research, 57, e2021WR030185.
https://doi.org/10.1029/2021WR030185... |
# -*- coding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1424397611.813653
_enable_loop = True
_template_filename = '/Users/Nate/chf_dmp/homepage/templates/person.html'
_template_uri = 'person.h... |
"""Build cubic spline and interpolate data."""
from dataclasses import dataclass
from itertools import islice
from typing import Callable, List, Tuple
import numpy as np
@dataclass
class Spline:
"""Store coefficients and function arguments."""
a: float = 0.0
b: float = 0.0
c: float = 0.0
d: flo... |
#! /bin/python
from bs4 import BeautifulSoup
import datetime
import json
import os
import re
import requests
INPUT_FILE_NAME = 'urls.txt'
BASE_URL = 'https://en.wikipedia.org'
OUTPUT_PATH = 'src/data'
OUTPUT_FILE = 'results.json'
EVENT_LIST = [
'100 metres',
'200 metres',
'400 metres',
'800 metres',
... |
# Copyright 2016 Mandiant, A FireEye Company
# Authors: <NAME>
# License: Apache 2.0
''' Example run script for "Relational Learning with TensorFlow" tutorial '''
import os
from pprint import pprint
import time
from collections import defaultdict
import numpy as np
import pandas as pd
import tensorflow as tf
import... |
# -----------------------------------------------------------------------------
# Copyright (c) 2016+ <NAME> + <NAME>
# www.pagebot.io
#
# P A G E B O T
#
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# Supporting Flat, xxyxyz.org/flat
# --------------------------------... |
"""
Author: <NAME>
Date: 10/9/2021
Summary:
This file contains the pytorch lightning implementation for training a UNET model for RGB carvana dataset
"""
from argparse import ArgumentParser
from RGB_Segmentation.data.Carvana_Dataset.CarvanaDS import CarvanaData
from RGB_Segmentation.data.Carvana_Dataset.ValDS import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.