text stringlengths 3.07k 22.1k |
|---|
import argparse
import sys
from collections import defaultdict
from datetime import datetime
import re
import csv
pfai_headers = "School ID", "School Name", "Test Date", "Student DOB", "Student Grade", "Student Gender", "Height", "Weight", "Skinfold Tricep", "Skinfold Calf", "1 Mile Run (Minutes)", "1 Mile Run (Second... |
import django
from django.contrib import admin
from django.contrib.admin.utils import unquote
from django.db.models import TextField
from django.forms import ModelForm, ChoiceField, CharField, BooleanField
from django.forms.widgets import Input
from django.template.defaultfilters import truncatechars
from django.utils.... |
import unittest
import random as pyrandom
import numpy as np
from numpy import random as numpyrandom
from rlscore.learner.kron_svm import KronSVM
from rlscore.utilities import sampled_kronecker_products
def dual_svm_objective(a, K1, K2, Y, rowind, colind, lamb):
#dual form of the objective function for support ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import sqlite3
import pickle
import collections
from math import log
from itertools import groupby
# Из местных скриптов:
import wordfreq_morph
from profiler_config import *
from gen_database import dict_sort
from gen_database import correct_path... |
#!/usr/bin/env python
# knihovny ####################################################################################
# knihovna pro vytvareni her
import pygame
import pygame.locals as GAME_GLOBALS
import pygame.event as GAME_EVENTS
# knihovna zakladnich funkci
import sys
# knihovna nahodnych cisel
import random
# kn... |
import functools
from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
from perception.custom_datasets import ComparisonDataset
from perception.utils.visualization import plot_segmentation, plot_image, display_images_... |
from django.db import models
from django.conf import settings
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
PermissionsMixin,
)
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""create and saves a new user """
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import hashlib
import pathlib
import tempfile
from io import StringIO
from sys import getsizeof
from django.conf import settings
from django.contrib.auth.models import User
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.db import models
from ... |
initial_section = {
creep_base_work_full_move_hauler: [WORK, WORK, MOVE, MOVE],
creep_base_work_half_move_hauler: [WORK, WORK, MOVE],
creep_base_goader: [ATTACK, MOVE, TOUGH],
creep_base_full_move_goader: [ATTACK, MOVE],
# etc...
}
scalable_sections = {
creep_base_worker: [MOVE, MOVE, MOVE, MOV... |
import numpy as np
np.seterr(all='raise')
import tensorflow as tf
import pandas as pd
class Episode:
def __init__(self, observation, observation_enc, goal, reward):
self.length = 1
self.observations = [observation]
self.observations_enc = [observation_enc]
self.rewards = [reward]... |
import django_otp
from django.contrib.sites.shortcuts import get_current_site
from django.core.paginator import Paginator
from django.shortcuts import render
from django.template.defaultfilters import register
from rest_framework.parsers import FileUploadParser
from rest_framework.response import Response
from rest_fra... |
# coding: utf-8
# In[1]:
# Setup (Imports)
from LoadData import *
from keras import regularizers
from keras import optimizers
from keras.models import Sequential
from keras.layers.advanced_activations import LeakyReLU
from keras.callbacks import ReduceLROnPlateau, EarlyStopping, ModelCheckpoint
from keras.layers i... |
from utils import Singleton
import json
import trt_pose.coco
import trt_pose.models
#from trt_pose.draw_objects import DrawObjects
from trt_pose.parse_objects import ParseObjects
import torch
"""pytorch -> tensorRTのコンバーター"""
import torch2trt
from torch2trt import TRTModule
import cv2
import torchvision.transforms as tr... |
# -*- coding: utf-8 -*-
# Copyright 2017-2019 ControlScan, Inc.
#
# This file is part of Cyphon Engine.
#
# Cyphon Engine 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 of the License.
#
# Cyphon En... |
from typing import List, Set, Union, Optional
class AnnotatedToken:
ALLOWED_POS: Set[str] = {"NUM", "PUNCT", "NOUN", "VERB", "ADJ", "ADV", "ADP", "SCONJ", "CCONJ", "AUX"}
ALLOWED_ROLES = {"EVENT", "EXPLICIT_INGREDIENT", "IMPLICIT_INGREDIENT", "O"}
SEPARATOR = "\t"
def __init__(self, id: int, raw_toke... |
"""
Collection of validators for rating data.
"""
from collections import defaultdict
import itertools
import attr
from registered import parser
from registered.validate import helpers
@attr.s(frozen=True)
class ValidationError: # pylint: disable=too-few-public-methods
"""
Wrapper around a single instance of... |
__author__ = "<EMAIL>"
__copyright__ = "Copyright 2021, VietMoney Face Anti-spoofing"
import os
import signal
from typing import Sequence
import click
import numpy
import orjson
import uvicorn
from fastapi import FastAPI, HTTPException, Depends
from library.task_manager import stop_worker, SpoofingDetectorWorker, F... |
# -*- coding: utf-8 -*-
from flask import Flask, request, json, Response
from flask_restful import Resource, Api
from sqlalchemy import create_engine
from flask_jsonpify import jsonify
from geonameapp import app
from itertools import groupby
from copy import deepcopy
geo_db_connect = create_engine('mysql+pymysql... |
import argparse
from copy import deepcopy
import torch
from torch import optim
from torch import nn
from torch.optim.lr_scheduler import StepLR
from torchvision.utils import make_grid
from torch.utils.tensorboard import SummaryWriter
import os
import time
import numpy as np
from collections import defaultdict
from da... |
# -*- coding: utf-8 -*-
from pathlib import Path
from fastapi import Response
from fastapi.responses import JSONResponse
from fastapi.templating import Jinja2Templates
from rdflib import Graph, Namespace, URIRef, Literal, RDF, RDFS
from pyldapi.renderer import Renderer
from pyldapi.profile import Profile
from pyldapi... |
import glfw
import numpy as np
from OpenGL.GL import *
from OpenGL.GL.shaders import compileProgram, compileShader
import pyrr
from PIL import Image
from utils.logger import Logger
from shaders import vertex_src, fragment_src
from enum import Enum
class BufferType:
TRIANGLE = [
]
QUAD = [
]
CUBE... |
#!/usr/bin/env python
import os
import os.path
import shutil
import tempfile
import contextlib
import airflow
import airflow.plugins_manager
from airflow import configuration
from flask import Flask
from unittest import TestCase, main
from airflow_code_editor.commons import PLUGIN_NAME, PLUGIN_DEFAULT_CONFIG
from airf... |
############################################
#
# LSTMs with Luang attention
#
############################################
##### Load .npy data file and generate sequence csv and profile csv files #####
import numpy as np
import pandas as pd
from keras.preprocessing import text, sequence
from keras.preprocessing.text... |
import numpy as np
import pandas as pd
from statsmodels.tsa.stattools import coint
from statsmodels.tsa.stattools import adfuller
from statsmodels.stats.diagnostic import acorr_ljungbox
from statsmodels.tsa.arima_model import ARIMA
from arch import arch_model
from statsmodels.stats.stattools import jarque_bera
from pan... |
#!/usr/bin/env python3
#
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
#
import ctypes, os, struct
from unicorn.x86_const import *
from unicorn.arm_const import *
from qiling.os.const import *
from qiling.const import *
from qiling.os.macos.structs import IOExternalMethodArguments, IOE... |
"""
Functions used for the creation of the image transformation network.
File author: <NAME>
Date: Jan 2017
"""
import tensorflow as tf
# TODO: For resize-convolution, what if we use strides of 1 for the
# convolution instead of upsampling past the desired dimensions? Test this.
def create_net(X, upsample_method='... |
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Get and parse options from CQ config files for changes."""
from __future__ import print_function
import ConfigParser
import o... |
import os
import math
import time
import cv2
import datetime
from multiprocessing import Process
from multiprocessing import Queue
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from scipy.spatial import distance
import sklearn.metrics as metrics
from sklearn.metrics import roc_auc_score
impor... |
# MODULE: TypeRig / Core / Math (Functions)
# -----------------------------------------------------------
# (C) <NAME>, 2015-2021 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#------------------------------------------------------------
# www.typerig.com
# No warranties. By using... |
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch
class Identity(nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x
class PretrainedInception(nn.Module):
def __init__(self):
super(PretrainedInceptio... |
import base64
import json
import logging.config
import os
import sys
from pygluu.containerlib.persistence.couchbase import CouchbaseClient
from pygluu.containerlib.persistence.couchbase import get_couchbase_user
from pygluu.containerlib.persistence.couchbase import get_couchbase_password
from pygluu.containerlib.persi... |
# coding: utf-8
# In[ ]:
__author__ = '<NAME>'
# get_ipython().magic('matplotlib notebook')
# from IPython.display import set_matplotlib_formats
# set_matplotlib_formats('png', 'pdf')
# from IPython.display import Image
# from IPython.display import Math
import os
import sys
import shutil
import gdal
import pickle
i... |
import grequests
from bs4 import BeautifulSoup
import re
import requests
from pymongo import MongoClient
import time
# Connect to MongoDB
client = MongoClient('localhost', 27017)
db = client['KinoBotDB']
genres = ['action', 'adventure', 'animation', 'comedy', 'crime', 'documentary', 'drama', 'family', 'fan... |
import json
import requests
AWESOME_VIDEO_COLLECTION_ID = 11035632
def find(string):
url = re.findall(
'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\), ]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', string)
return url
def insertCharacterAtPos(char, string, index, ):
return string[:index] + '-' + string[index... |
import numpy as np
import time
import os
import cv2
# import openslide
# import pyvips
from PIL import Image
Image.MAX_IMAGE_PIXELS = None
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
from Fast_WSI_Color_Norm.Estimate_W import Wfast
#################################3
format_to_dtype = {
'uc... |
#!/usr/bin/env python3
"""===============================================================================
FILE: money.py
USAGE: ./money.py
DESCRIPTION:
OPTIONS: ---
REQUIREMENTS: ---
BUGS: ---
NOTES: ---
AUTHOR: <NAME> (<EMAIL>)
ORGANIZATION:
VERSION: ---
CREATE... |
import polyloader
import pytest
import py_compile
from . import ptutils
import stat
import sys
import os
import imp
import random
import struct
class Compiler:
def __init__(self, pt):
self.pt = pt
def __call__(self, source_text, filename, *extra):
return compile("result='Success for %s: %s'" %... |
import pandas as pd
from matplotlib import pyplot as plt
import urllib.request as urllibr
from urllib.error import HTTPError
import json
import datetime
import numpy as np
import os
from sklearn.preprocessing import scale
from core.views import initRequest, setupView, DateEncoder, setCacheData
from django.shortcuts imp... |
import logging
import os
import select
import socket
import sys
import time
import traceback
from kivy.app import App
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.properties import ObjectProperty, ListProperty
from kivy.uix.actionbar import ActionItem
from ki... |
import logging
import ConfigParser
import gtk
LOG = logging.getLogger('config')
class ConfigurableIface:
"""
A class to make storing persistant configutation information, and generating
configuration dialogs much easier. For example, plugins may derive from
this class.
Derived objects may either... |
from sklearn.utils import check_array, check_random_state
import numpy as np
import os
import datetime as dt
# Following is used in experiment.py
""" Checks if X is a list of arrays of 2 dimensions
Turns X into an array of 2 dimensions and computes an array (lengths) containing
the lengths of the individual s... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 20 11:47:48 2016
@author: rutzmoser
"""
import sympy as sy
import numpy as np
xi, eta, zeta = sy.symbols('xi, eta, zeta')
xi_vec = sy.Matrix([xi, eta, zeta])
#%% Build shape functions automatically
def build_hex_8_shape_fcts(point_coords):
no_of_nodes = point_co... |
# coding: utf-8
# In[16]:
from numpy import *
# In[17]:
# define the number of movies in our 'database'
num_movies = 10
# In[18]:
# define the number of users in our 'database'
num_users = 5
# In[19]:
# randomly initialize some movie ratings
# a 10 X 5 matrix
ratings = random.randint(11, size = (num_mov... |
from copy import deepcopy
from datetime import datetime
import click
import numpy as np
import pandas as pd
pd.options.mode.chained_assignment = None
DEFAULT_ANDROMONEY_FILENAME = "AndroMoney - AndroMoney.csv"
DEFAULT_MOZE_FILENAME = "MOZE.csv"
MOZE_HEADER = [
# Required
"帳戶",
"幣別",
# Required
... |
# -*- coding: ascii -*-
__pyspec = 1
"""These classes serve aspect support for modules, classes, methodes.
If you use this module, you can add some information to modules, classes,
and methods. In pyspec, methods can have test result themselves and several
methods for judgement of method type and suppor of running t... |
import os
import platform
from asyncio import sleep
from contextlib import suppress
from functools import partial
from pathlib import Path
from shutil import rmtree
from subprocess import Popen
from logzero import logger
from send2trash import send2trash
from send2trash.exceptions import TrashPermissionError
from watc... |
# Copyright 1999-2018 Alibaba Group Holding 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 applicable law or a... |
'''
This module contains functionality related to integration with the SLURM HPC
resource manger.
'''
import datetime
import logging
import re
import time
import sciluigi.parameter
import sciluigi.task
import subprocess as sub
# ================================================================================
# Setup... |
#! /usr/bin/env python
''' Main program'''
import re
import os.path
import shutil
import json
import sys
from typing import Tuple
class Folder():
''' Stores the folder name and its full path'''
def __init__(self, name: str, path: str):
self.name = name
self.path = path
class File():
'... |
import re, markdown
from collections import defaultdict
from dataclasses import dataclass
from lxml import etree, html
# output formats
DIRECTIONS_FORMAT = '<label><input type="checkbox">%s</label>\n' # add another newline to make sure the downstream processor turns these into separate HTML paragraphs (if we add the <... |
import random
import datetime
import time
import fcntl
from ip.IPSocket import *
from tcp.TCPPacket import *
def get_ip(ifname='eth0'):
"""
Get ip address of the source, only works for linux machine
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
data = struct.pack('256s', ifname[:15].enc... |
import torch
from torch import nn
from torchvision.models.vgg import vgg16
import model
class GeneratorLoss(nn.Module):
def __init__(self, inchannel=3):
super(GeneratorLoss, self).__init__()
vgg = vgg16(pretrained=True)
layer1 = nn.Conv2d(inchannel, 64, kernel_size=(3, 3), stride=(1, 1), pa... |
# coding=utf-8
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from django.core.exceptions import ObjectDoesNotExist
import requests
from urlparse import urljoin
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers... |
from . import WidgetBase
import os
class _Button(WidgetBase):
def __init__(self, master, label, **options):
super().__init__(master)
from tkinter.ttk import Button
if not "command" in options:
from tkinter import IntVar
self.var=IntVar(master=self.master, value=0)
... |
# Copyright 2021 The FedLearner 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 applica... |
#!/usr/bin/env python3
# Copyright (c) 2021 <NAME>
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
#... |
#!/usr/bin/env python
# Copyright (c) 2007-8 Qtrac Ltd. All rights reserved.
# This program or module 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 2 of the License, or
# version 3 of the Lice... |
'''
A library of tools to help with the creation of HD plots
Created on Feb 5, 2016
@author: thomasriddick
'''
import matplotlib.pyplot as plt
import numpy as np
import math
from Dynamic_HD_Scripts.base import grid
from Dynamic_HD_Scripts.base import field
class OrogCoordFormatter(object):
"""Class that create... |
import datetime
import itertools
import logging
from collections import UserDict, UserList
from dataclasses import dataclass
from pprint import pformat
from pymongo.collection import Collection
from elasticsearch import AsyncElasticsearch
# NOTE
# Throughout this module, an XML-like serialization
# format is utilize... |
#!/usr/bin/python3
import datetime
import os
import pyasicam as pc
import sys
import numpy as np
import cairo
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf, GLib, Gdk, Gio, GObject
def gamma_stretch(im, gamma):
if im.dtype != np.float:
im = im.astype(np.float)
i... |
import logging
import time
import os
import json
from pathlib import Path
from mavros import mission
from maverick_api.modules import api_callback, moduleBase, schemaBase
from maverick_api.modules.base.util.functions import mkdirs
from tornado.options import options
# graphql imports
from graphql import (
Graph... |
#!/usr/bin/env python
"""
Copyright (c) 2011, <NAME>, Inc.
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 copyright
notice, this list o... |
# Copyright (c) 2016, <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 applicable law or agreed to in writing, s... |
#!/usr/bin/python3
import sys
import argparse
import nltk
import re
from typing import List, Tuple
# a regex to mark sentences as direct speech sentences
# this regex only matches with sentences that start with a quotation mark and end with a quotation mark
re_compl_direct_speech = re.compile('^".+"$')
# a regex to ... |
#%%
from PIL import Image
from matplotlib import pyplot as plt
import numpy as np
import cv2
import math
from tqdm import tqdm
#%%
img_raw = Image.open("test1.png")
img = img_raw.convert('L')
img_arr = np.array(img)
imgw, imgh = img_arr.shape
def show_img(img):
plt.imshow(img,cmap=plt.cm.gray)
plt.show()
#%%
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data import TensorDataset, DataLoader
from torch.optim.lr_sche... |
import inspect
import typing
from contextlib import asynccontextmanager
import starlette.types
from di import AsyncExecutor, BaseContainer, JoinedDependant
from di.api.dependencies import DependantBase
from starlette.datastructures import State
from starlette.middleware import Middleware
from starlette.middleware.erro... |
# %%%%
import pandas as pd
import numpy as np
import re
# %%%% functions
## Fill missing values
def fillmissing(x,col,index,benchmark):
for i in range(index,len(x)):
# find missing value
if x.loc[i,col] == benchmark:
# if first is missing, fill using the value next to it
if... |
import xml.etree.ElementTree as ET
from .constants.namespaces import namespaces, check_namespace_of_tag
from typing import Union, List, Callable, Dict, Tuple, Optional
from .properties import Property, PropertyDescription
from .constants import property_enums as pr_const
class Parser:
element_description = None
... |
import cv2
import random
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from shared import norm
import os
from scipy import ndimage
import yaml
import time
import keras
def millis():
return int(round(time.time() * 1000))
#Load data and model
with open(f'./Configur... |
"""
The unit test module for AutoScheduler dialect.
"""
# pylint:disable=missing-docstring, redefined-outer-name, invalid-name
# pylint:disable=unused-argument, unused-import, wrong-import-position, ungrouped-imports
import argparse
import os
import re
import tempfile
import mock
import pytest
from moto import mock_dy... |
import curses
import random
from pwdmanage import DataOp
from datetime import datetime
import pyperclip
## banner
ICON = """ ******* ** ** ******* ****** ******* ** **
/**////**/** /**/**////** /*////** **/////** //** **
/** /**/** * /**/** /** /* /** ** //** //** **
/**... |
import logging
import re
from pyramid.view import view_config
import pyramid.httpexceptions as exc
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from sqlalchemy.exc import (
InternalError,
ProgrammingError,
)
from sqlalchemy.sql.expression import cast
from sqlalchemy import Text, Integer,... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 20 09:56:23 2017
@author: Martin
"""
import os
import numpy as np
import sys
import csv
import argparse
import logging
import pickle
from lib.data import Data
from lib.classifier import *
from lib.json_to_table import parse_json
from lib.json_to_table im... |
# -*- coding: utf-8 -*-
import unittest
from werkzeug.exceptions import NotFound, Forbidden, Gone
from flask import Response
from nodular import Node, NodeView, NodePublisher, NodeRegistry, ViewNotFound
from .test_db import db, TestDatabaseFixture
from .test_nodetree import TestType
class MyNodeView(NodeView):
@... |
# -*- coding: utf-8 -*-
"""
Author: <NAME>
Created: 28.02.2019
Updated: 12.03.2019
Email: <EMAIL>
# Description
The main function of this script is to update the annotation of reactions to different subsystems and pathways.
The curated annotation of subsystems and pathways is found in "ComplementaryData/curation/pat... |
import sys
import os
import logging
import argparse
import json
import time
import re
import pickle as pkl
import six
import numpy as np
import torch
import torch.nn.functional as F
import progressbar
from sklearn.metrics import accuracy_score, classification_report
from allennlp.modules.elmo import Elmo, batch_to_ids... |
'''
Bing Speech To Text (STT) and Text To Speech (TTS)
based on https://github.com/Uberi/speech_recognition
'''
import json
import uuid
import wave
import io
from monotonic import monotonic
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
impo... |
# =============================================================================
# ---------------------------------------------
# Battery Monitoring System:
# ---------------------------------------------
# =============================================================================
import random
#Declare global ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 4 10:58:20 2017
@author: sifeluga (<NAME>)
"""
import argparse
import math
import numpy as np
from os import getcwd
# for plotting the k-space/density
import matplotlib.pyplot as plt
class PoissonSampler:
# those are never changed
f2PI = math.... |
# SPDX-FileCopyrightText: Copyright (c) 2020,2021 <NAME>
#
# SPDX-License-Identifier: MIT
# This library based upon Sparkfun's Arduino library and firmware sources:
# github.com/sparkfun/SparkFun_Qwiic_Button_Arduino_Library/blob/master/src
# github.com/sparkfunX/Qwiic_Switch/blob/master/Firmware/Qwiic_Button
"""
`i2c... |
# -*- coding: utf-8 -*-
"""
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-蓝鲸 PaaS 平台(BlueKing-PaaS) available.
* Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except in complianc... |
# -*- coding: utf-8 -*-
import scrapy
import re
from .. import items
from bs4 import BeautifulSoup
from selenium import webdriver
from requests import get
from time import sleep
# change this path to wherever the chrome webdriver is located in your system
WEBDRIVER_PATH = ("D:\\chromedriver_win32\\" + "chromedriver.ex... |
#
# Copyright (c) 2020 <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, merge, publish, distribute... |
# -*- coding:utf-8 -*-
from __future__ import print_function
import os
import argparse
import json
import numpy as np
import cv2
def save_tensor_bytes(save_path, x):
y = x.flatten()
n = len(y)
with open(save_path, 'wb') as f:
for i in range(n):
v = y[i]
f.wri... |
# -*- coding:utf-8 -*-
"""
@author: 古时月
@file: functions.py
@time: 2021/2/25 13:09
"""
import win32gui, win32ui, win32con
from numpy import where
import logging
import pyautogui
import random
import time
import json
import cv2
import os
logging.basicConfig(level=logging.INFO)
pyautogui.FAILSAFE = True
def jietu(hw... |
import time
from collections import defaultdict
from thomas import Item, router
from .exceptions import PathNotFoundException
from .plugins import DatabaseCacheLayer
from .utils import hash_string
COMMIT_COUNTER = 10000 # listing entries before adding to work queue
BUCKET_SIZE = 1 # bytes,
GC_DELETED_FILES = 60 * ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import pyro.distributions as D
import math
from model.models import POMDP, VRNN
from model.building_blocks import CGMM, CGGMM, MLP
from utils.util import max_deviation, softclamp, eps
class BatteryModel(POMDP):
def __init__(self, state_dim: int = ... |
#!/usr/bin/env python3
#
# products.py
"""
Classes to model products and tariffs.
"""
#
# Copyright © 2020 <NAME> <<EMAIL>>
#
# 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 rest... |
import re
import os
import argparse
import map_helpers #why we don't have some generic package for these reee
default_map_directory = "../../_maps"
replacement_re = re.compile('\s*([^{]*)\s*(\{(.*)\})?')
def tgm_check(map_file):
with open(map_file) as f:
firstline = f.readline()
#why some maps hav... |
# Code for "TSM: Temporal Shift Module for Efficient Video Understanding"
# arXiv:1811.08383
# <NAME>*, <NAME>, <NAME>
# {jilin, <EMAIL>, <EMAIL>
import pdb
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import sys
sys.path.append("..")
from archs import repvgg
class TemporalSh... |
import flops_counter
import flops_counter.nn as nn
import flops_counter.nn.functional as F
class M_Module(nn.Module):
def __init__(self, in_channels, out_channels_left, out_channels_right):
super(M_Module, self).__init__()
inc = in_channels
ocl, ocr = out_channels_left, out_channels_right
... |
import os
from typing import Optional, List, Callable, Tuple
from hetdesrun.adapters.exceptions import AdapterHandlingException
from hetdesrun.adapters.local_file.detect import (
get_local_files_and_dirs,
LocalFile,
local_file_from_path,
)
from hetdesrun.adapters.local_file.models import (
Structur... |
import networkx as nx
from chebi import map_to_chebi
from ctd_chemicals import map_to_ctd_chemicals
from fuzzywuzzy import fuzz, process
from medic import map_to_medic
from strings import candidate_string
def write_candidates(entity_list, candidates_filename, entity_type, ontology_graph, link_mode, extrac... |
import math
from functools import wraps
from statiskit import stl
from . import _core
from .__core.statiskit import (encoding_type,
SampleSpaceVector,
UnivariateSampleSpace,
CategoricalSampleS... |
'''
Created on 2020-07-06
@author: wf
'''
from ptp.titleparser import ProceedingsTitleParser,TitleParser
import ptp.ceurws
import ptp.wikidataproceedings
import ptp.gnd
from lodstorage.sql import SQLDB
from lodstorage.entity import EntityManager
from lodstorage.storageconfig import StoreMode, StorageConfig
from dateti... |
import random
import numpy as np
#--- EXAMPLE COST FUNCTIONS ---------------------------------------------------+
def func1(x):
# Sphere function, use any bounds, f(0,...,0)=0
return sum([x[i]**2 for i in range(len(x))])
def func2(x):
# Beale's function, use bounds=[(-4.5, 4.5),(-4.5, 4.5)], f(3,0.5)=0.
... |
"""
Authors:
<NAME>
"""
from Pwm_Interface import set_pwm
import threading
import Frame_Thread as ft
# prints an assload of debug statements for the servo with the specified ID
# specifically only frame-thread debug statements
# there is no servo with id -1 so that will turn off debugging
DEBUG_SERVO_ID = -1
... |
#!/usr/bin/env python3
"""
Simple tools used in various places across this package.
"""
import re
import time
import functools
import warnings
import numpy as np
from matplotlib import rcParams
from numbers import Number, Integral
try: # use this for debugging instead of print()!
from icecream import ic
except Imp... |
from array import *
import time
import os
import queue
from copy import copy, deepcopy
AGENT_SYMBOL = 'A'
GOAL_SYMBOL = 'G'
WALL_SYMBOL = '#'
VISITED_CELL_SYMBOL = 'V'
EXPANDED_NOT_VISITED_CELL_SYMBOL = 'E'
EMPTY_SYMBOL = ' '
print_rate_per_sec = 1.0
agent_coord = [1, 3]
goal_coord = [4, 7]
initial_map = [
['#'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.