text stringlengths 3.07k 22.1k |
|---|
#
# Copyright 2018 Analytics Zoo 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... |
import argparse
from math import ceil
from tqdm import tqdm
from typing import List, Dict, Any
from pyspark.sql import SparkSession
import pyspark.sql.functions as f
from pyspark.sql.types import (
StructType, StructField, StringType, DateType
)
from pyspark.ml import Pipeline
from pyspark.ml.feature import (
C... |
#!/usr/bin/env python
"""
Pandoc filter for adding admonition in LaTeX
"""
from panflute import (
run_filter,
RawInline,
MetaList,
MetaInlines,
convert_text,
Plain,
debug,
)
def x11colors():
"""
Get the x11 colors
Returns
-------
The x11 colors
"""
# See h... |
import streamlit as st
import pandas as pd
import plotly
import plotly.express as px
from other_app_py_files.year_wrapup_viz import create_fig as fig_annot
from other_app_py_files.year_wrapup_viz_without_annotation import create_fig as fig_no_annot
import numpy as np
import plotly.io
import base64
#App data
emotions_l... |
from os import listdir, chdir, startfile
from os.path import isfile, join, getmtime
from plyer import notification
from xml.etree import ElementTree as ET
import tkinter as tk
from reportlab.lib import colors
from reportlab.lib.pagesizes import inch
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 17 11:34 2021
@author: au558899
Source codes for visualization-related codes for main extractor of newsFluxus
"""
import os
from icecream import ic
import numpy as np
import scipy as sp
import scipy.stats as stats
import matplotlib as mpl
import matplotlib.pyplot as pl... |
# Copyright (c) 2011 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.
"""The experiment runner module."""
from __future__ import print_function
import getpass
import os
import shutil
import time
import afe_lock_machine
... |
try:
from matplotlib import pyplot as plt
import matplotlib
except:
import matplotlib
matplotlib.rcParams['backend'] = 'TkAgg'
from matplotlib import pyplot as plt
import numpy as np
import pdb
def cornertex(s, ax, offset=(0,0), fontsize=14):
plt.text(0.02+offset[0],0.95+offset[1],s,transform=a... |
#!/usr/bin/env python3
import _thread
import sys
import cfg
import uuid
from xmlrpc.client import ServerProxy
from enums import ReduceStatus, Status
from fake_fs import FakeFS
import map_libs.word_count
import os
import importlib.util
import json
# fake mapper client for testing
# communication reducer and mapper
cla... |
import torch
import time
import numpy as np
from torch import nn, optim
import torch.utils.data as data
import torch.nn.utils.rnn as rnn_utils
from data_process import MyDataset
from evaluate import valid_evaluate, test_evaluate
def train_epoch(model, train_data, loss_weights, optimizer, epoch, config, padded_quotes,... |
# Copyright (c) 2022 Mira Geoscience Ltd.
#
# This file is part of geoapps.
#
# geoapps is distributed under the terms and conditions of the MIT License
# (see LICENSE file at the root of this source code package).
from copy import deepcopy
import numpy as np
from geoh5py.objects import Points
from geoh5py.works... |
__source__ = 'https://leetcode.com/problems/the-maze-iii/'
# Time: O()
# Space: O()
#
# Description: 499. The Maze III
#
# There is a ball in a maze with empty spaces and walls.
# The ball can go through empty spaces by rolling up (u), down (d), left (l) or right (r),
# but it won't stop rolling until hitting a wall.
... |
import junior
from tokens import TokenType
from tokens import Token
import expr as Expr
import stmt as Stmt
errorEndTokens = [
TokenType.CLASS,
TokenType.FUNCTION,
TokenType.CLASS,
TokenType.VAR,
TokenType.FOR,
TokenType.IF,
TokenType.PRINT,
TokenType.RETURN
]
def parse(lexTokens):
... |
import os
import sys
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(ROOT_DIR)
from models.backbone import Pointnet2Backbone
from around_vi... |
import tornado.escape
import tornado.template
import tornado.web
import tornado.websocket
from hotaru import messages
from hotaru import exceptions
from hotaru.servers import ServerPool
from hotaru.players import Player
import logging
import json
HT_VERSION = "v0"
class Hotaru(tornado.web.Application):
"""
... |
#!/usr/bin/env python3
import os
import sys
from datetime import datetime
from misaka import HtmlRenderer, Markdown
from multiprocessing import Pool
from utils import ABS, has_extension, MarkdownHeader, NULL_MARKDOWN_HEADER, parse_header, parse_post, READ, WRITE
# https://misaka.readthedocs.io/en/latest/ or https:/... |
import os
import tempfile
from io import StringIO
from django.contrib.gis.geos import MultiPolygon
from django.test import TestCase
from organisations.boundaries.management.commands.boundaryline_import_boundaries import (
Command,
)
from organisations.models import (
DivisionGeography,
OrganisationGeography... |
# REST Framework
from rest_framework import generics, permissions, status
from rest_framework.decorators import api_view
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework.test import APIRequestFactory, APITestCase
# User class fr... |
import torch.nn.functional as F
from torch import nn
from torch.nn import Module
import torch
from utils.audioUtils.hparams import hparams
class MyUpsample(Module):
__constants__ = ['size', 'scale_factor', 'mode', 'align_corners', 'name']
def __init__(self, size=None, scale_factor=None, mode='nearest... |
from sqlalchemy import and_
from sqlalchemy.exc import IntegrityError
from .storage import db
from .models import Person, Appointment, Result, User, Staff
from typing import Optional
from secrets import token_urlsafe
def email_exists(email: str) -> bool:
"""
Check if a person with given email exists in the da... |
import os.path
from data.base_dataset import BaseDataset, get_params, get_transform, normalize, make_bp_data
from data.image_folder import make_dataset
from PIL import Image
import pickle
import torch
import torch.nn as nn
from util import util
import numpy as np
import torchvision.transforms as transforms
import rando... |
import math
import numpy as np
import torch
from PIL import Image, ImageFont, ImageDraw
import matplotlib
from flowbias.config import Config
from flowbias.losses import _elementwise_epe
from flowbias.utils.flow import compute_color, make_color_wheel
from flowbias.utils.meta_infrastructure import get_available_dataset... |
import os
import time
import datetime
import random
from tqdm.auto import tqdm
import pandas as pd
import numpy as np
from scipy.special import softmax
from nltk.tokenize import sent_tokenize
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report,precision_recall_fscore_... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obt... |
# -*- coding: utf-8 -*-
"""
Pitch Spelling using the ps13 algorithm.
References
----------
"""
import numpy as np
from collections import namedtuple
__all__ = ['estimate_spelling']
ChromamorpheticPitch = namedtuple('ChromamorpheticPitch', 'chromatic_pitch morphetic_pitch')
STEPS = np.array(['A', 'B', 'C', 'D', 'E... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# :author: <NAME>
# :email: <EMAIL>
# :copyright: (c) 2014-2022, <NAME>
#
# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License.
#
# The full... |
#!/usr/bin/python
# -- ; {{{1
#
# File : netcat.py
# Maintainer : <NAME> <<EMAIL>>
# Date : 2015-09-12
#
# Copyright : Copyright (C) 2015 <NAME>
# Version : v0.1.0
# License : GPLv3+
#
# -- ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from utils.centroidtracker import CentroidTracker
from utils.trackableobject import TrackableObject
from imutils.video import WebcamVideoStream
from imutils.video import FPS
import numpy as np
import imutils
import dlib
import cv2
import time
import logging
import pymongo... |
import datetime
import calendar
import pandas as pd
from telegram.ext import (Updater, ConversationHandler, CommandHandler, MessageHandler, Filters, CallbackQueryHandler)
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardRemove
data = pd.read_csv('data.csv')
data.tanggal = pd.to_da... |
from esilsolve import ESILSolver, ESILSim
import r2pipe
import z3
import binascii
import time
def test_sym():
esilsolver = ESILSolver(debug=True)
state = esilsolver.states[0]
state.set_symbolic_register("rax")
esilsolver.parse_expression("1,rax,+,rbx,=,2,bx,<<,rbx,=", state)
#esilsolver.constrainRe... |
import socket
import sys
import logging
import atexit
import platform
from logging import handlers
from multiprocessing import Queue as mpQueue, current_process
from queue import Queue as thQueue
from threading import Thread, main_thread
import pickle
import socketserver
import struct
import select
from .capture impo... |
import torch
import numpy as np
from config import *
import gurobipy as gp
from gurobipy import GRB
import matplotlib.pyplot as plt
import math
des=open("results/log.txt","w")
def is_spd(Q):
return np.all(np.linalg.eigvals(Q) >= 0)
lst_gradnorm, lst_projgradnorm, lst_xmae, lst_Rmae, lst_betamae = [], [], [], [], [... |
import os
import shlex
from time import sleep
import click
import requests
from pyretry import retry
from kubetools.exceptions import KubeDevError
from kubetools.log import logger
from kubetools.settings import get_settings
from .config import (
get_all_containers,
get_all_containers_by_name,
)
from .docke... |
"""
Copyright (c) 2016 Duolingo Inc. MIT Licence.
Python script that implements spaced repetition models from Settles & Meeder (2016).
Recommended to run with pypy for efficiency. See README.
"""
import argparse
import csv
import math
import os
import random
import sys
from collections import defaultdict, namedtuple... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Red Hat, 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 applicab... |
#! /usr/bin/python3
from datetime import datetime
from PIL import Image, ImageFilter, ImageDraw, ImageFont, ImageColor
import json
import math
import subprocess
import time
outputFile = "/home/bitcoin/images/f2pool.png"
account = "--your-account-name-here--"
accountlabel = ""
hashratelowthreshold = 60000000000000
col... |
__source__ = 'https://leetcode.com/problems/number-of-corner-rectangles/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 750. Number Of Corner Rectangles
#
# Given a grid where each entry is only 0 or 1, find the number of corner rectangles.
#
# A corner rectangle is 4 distinct 1s on the grid that form an axis-a... |
# Copyright (c) 2019 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 agr... |
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
from pathlib import Path
from moviepy.editor import VideoFileClip
from line_class import Line
def test_functions(path,foo=None,cmap=None):
"""
Function to test a function (foo) with a folder of imgs (path)
All im... |
# Paste your version of blockchain.py from the client_mining_p
# folder here
# Paste your version of blockchain.py from the basic_block_gp
# folder here
import hashlib
import json
import requests
from time import time
from uuid import uuid4
import sys
from flask import Flask, jsonify, request
class Blockchain(objec... |
# -*- coding: utf-8 -*-
"""
Monte Carlo Tree Search in AlphaGo Zero style, which uses a policy-value
network to guide the tree search and evaluate the leaf nodes
@author: <NAME>
"""
import numpy as np
import copy
from renju import RenjuBoard
def softmax(x):
probs = np.exp(x - np.max(x))
probs /= np.sum(prob... |
from typing import Tuple, Dict, Callable, Iterator, Union, Optional, List
from abc import ABC, abstractmethod
from time import time
import glfw
import torch
import gym
from gym import wrappers
class EnvironmentObjective:
"""API for translating an OpenAI gym environment into a black-box objective
function f... |
#!/usr/bin/env python
""" patrol_smach_concurrence.py - Version 1.0 2013-04-12
Control a robot using SMACH to patrol around a square a specified number of times
while monitoring battery levels using the Concurrence container.
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2013... |
import torch
from django.http import HttpResponseRedirect
from django.shortcuts import render, reverse, redirect, get_object_or_404
from django.views import View
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib.auth.models import User
from .models import BookDatabase, BookRa... |
# ============================================================================
#
# Copyright (C) 2007-2016 Conceptive Engineering bvba.
# www.conceptive.be / <EMAIL>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
... |
import logging
from pathlib import Path
import pygame as pg
import numpy as np
import chess.settings as s
from chess.utils.coords import Coords
from chess.pieces import PieceFactory, PieceId, PieceType, Color
logger = logging.getLogger(Path(__file__).stem)
class NoPieceAtIndex(Exception):
""" Tried to get a n... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.contrib import admin
from django.contrib.admin.widgets import FilteredSelectMultiple
from Sporter.models import SporterBoog
from Wedstrijden.models import ... |
# Copyright 2004-2008 <NAME>.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
import sys
import ctypes
import shutil
import unittest
import autoconfig
from pyplusplus.module_builder import ctypes_module_b... |
#import numpy as np
from pmd_beamphysics.units import write_dataset_and_unit_h5, read_dataset_and_unit_h5
from pmd_beamphysics import ParticleGroup
from .parsers import header_lines
from .lattice import lattice_lines
from .fieldmaps import read_fieldmap_h5
from .tools import fstr, isotime, native_type
from .control i... |
"""
lipydomics/identification/mz_generation.py
<NAME>
2019/10/04
description:
utilities to generate predicted m/z data for lipids
"""
from .LipidMass.lipids.glycerolipids import DG, TG
from .LipidMass.lipids.glycolipids import DGDG, GlcADG, MGDG
from .LipidMass.lipids.glycerophospholipids imp... |
"""
Color playground.
Any fenced code blocks with `playground` as the language will be converted to interactive playgrounds that
are initialized with the results of the initial contents.
Any inline code blocks with `color` as the language will be evaluated as a simple color swatch.
"""
import coloraide
from coloraide... |
#!/usr/bin/env python
import argparse
import sys
from es_backup.repository import *
from es_backup.snapshot import *
from es_backup.backup import *
from jinja2 import Environment, PackageLoader
def render_template(template, **variables):
env = Environment(loader=PackageLoader('es_backup', 'templates'))
templ... |
#!/usr/bin/env python
"""
Utility to generate predictions on new data
from existing RSMTool models.
:author: <NAME> (<EMAIL>)
:author: <NAME> (<EMAIL>)
:author: <NAME> (<EMAIL>)
:organization: ETS
"""
import glob
import logging
import os
import sys
from os.path import (abspath,
basename,
... |
from totallib import *
class Getbasket:
def __init__(self, market,first,second):
self.file = FileMethods()
self.indicators = Indicators()
self.codelist = self.file.GetStockList(market)
self.marketbasket = self.file.MarketDayList(market)
self.codedaybasket = {}
self.p... |
import bpy
from typing import List, Dict
import math
import shutil
import os
import logging
import re
from . import SimpleMaterialDefinition
from PIL import Image
log = logging.getLogger("DustyAtlas")
def get_texture_from_normal_node(node: bpy.types.ShaderNodeNormalMap):
if node.type != "NORMAL_MAP":
ra... |
""" Functions for analyzing openmc tally results
This scripts contains functions for analyzing the tallies
from the openmc statepoint file and manipulate the data
into what is required in the criticality
part (phase1a) of the FHR benchmark.
"""
import numpy as np
import pylab as pl
import matplotlib.colorbar as cba... |
#!/usr/bin/env python
import os
import math
import datetime
from contextlib import contextmanager
import smtplib
from email.mime.text import MIMEText
from threading import Thread
from optparse import OptionParser
import requests
import dateutil
from dateutil.parser import parse as parse_date
from db import DB
from mode... |
import numpy as np, pandas as pd
import torch, dataclasses, warnings, operator, builtins, numbers, os
from typing import List
from torch.utils.data import DataLoader
import scipy.sparse as sps
def get_batch_size(shape, frac=float(os.environ.get("BATCH_SIZE_FRAC", 0.1))):
""" round to similar batch sizes """
n... |
import abc
import torch
import torch.nn as nn
from torch import Tensor
import numpy as np
from mgplvm.utils import softplus, inv_softplus
from .base import Module
from .kernels import Kernel, Combination
from .inducing_variables import InducingPoints
from typing import Tuple, List, Optional, Union
jitter: float = 1E-6... |
"""
This module will provide a factory to create and
train Neural Networks with TensorFlow
"""
import numpy as np
import trainer
import tensorflow as tf
class NNLayer(object):
"""Trainable Neural Network Layer"""
def __init__(self, _input_connections, _neurons, _layer_type='hidden'):
"""
Ini... |
#!/usr/bin/env python3
"""Main-level command handling for running on the command line."""
# Future imports
from __future__ import (
annotations,
)
# Standard library imports
import argparse
import sys
from pathlib import (
Path,
)
from typing import (
Any,
Callable,
Sequence,
)
# Local imports
im... |
import numpy as np
from matplotlib import pyplot as plt
def scatterFactual(args, objs, factual_instance, ax):
assert len(objs.dataset_obj.getInputAttributeNames()) == 3
ax.scatter(
factual_instance['x1'],
factual_instance['x2'],
factual_instance['x3'],
marker='P',
color='black',
s=70
)
... |
import torch
import numpy as np
import pandas as pd
import os
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
matplotlib.style.use('ggplot')
import seaborn as sns
sns.set(
font_scale=1.5,
style="whitegrid",
rc={
'text.usetex' : False,
'lines.linewidth': 3
}... |
import json
from wq.io import JsonParser, BaseIO, TupleMapper, TimeSeriesMapper
from climata.base import (
WebserviceLoader, FilterOpt, DateOpt, ChoiceOpt,
parse_date, fill_date_range,
)
from .constants import (
ELEMENT_BY_ID,
ELEMENT_BY_NAME,
ALL_META_FIELDS,
DEFAULT_META_FIELDS,
AUTHORITY_... |
import abc
from dataclasses import dataclass, field
from typing import Optional, Tuple
import jax
import jax.flatten_util as fu
import jax.lax as lax
import jax.numpy as jnp
import numpy as np
from ..custom_types import Bool, DenseInfo, PyTree, Scalar
from ..misc import ω
from ..solution import RESULTS
from ..term im... |
import wx
import six
contrastColour = wx.Colour( 255, 130, 0 )
def GetScaleRatio( wBitmap, hBitmap, width, height ):
return min( float(width) / float(wBitmap), float(height) / float(hBitmap) )
def intervalsOverlap( a0, a1, b0, b1 ):
return a0 <= b1 and b0 <= a1
class ScaledBitmap( wx.Panel ):
def __init__( self,... |
"""Like most recent post of users in the input file"""
import json
import codecs
import datetime
import time
import os.path
import tenacity
import http
from instagram_private_api import (
Client, ClientError, ClientLoginError,
ClientCookieExpiredError, ClientLoginRequiredError,
__version__ as client_versio... |
#!/usr/bin/env python
#
# Copyright (C) 2018 <NAME> <<EMAIL>>
# Copyright (C) 2019-2021 <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 restriction, including witho... |
from bisect import bisect_left
import os
from functools import reduce
import pytest
from hypothesis import assume, given
from hypothesis.strategies import integers, composite
from algorithms.number_theory import (
Ballie_PSW_test,
binomial,
binpow,
euler_phi,
even,
extended_euclidian,
fact... |
#!/usr/bin/env python3
import board
import busio
from adafruit_apds9960.apds9960 import APDS9960
from adafruit_apds9960 import colorutility
from datetime import datetime
import dill
import multiprocessing
import signal
from six.moves import queue
import sys
import time
from bedclock import const
from bedclock import ... |
# GridGain Community Edition Licensing
# Copyright 2019 GridGain Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License") modified with Commons Clause
# Restriction; you may not use this file except in compliance with the License. You may obtain a
# copy of th... |
# Import libraries
import xml.etree.ElementTree as ET
from lxml import etree as ETL
import xml.dom.minidom as MD
import os
import numpy as np
import random
WIDTH_MIN = 0
WIDTH_MAX = 8.5
HEIGHT_MIN = -3.5
HEIGHT_MAX = 5.0
TRAIN_SCALE_WIDTH = 128
TRAIN_SCALE_HEIGHT = 128
# From level_io
# https://github.com/fang2hou/S... |
import date
import sklearn.model_selection as skms
import numpy as np
import pandas as pd
import matrix_builder
import prediction_method
import error
def get_number_of_weeks(start: str, end: str):
"""
Get the number of weeks between start en end dates
:param start: str representing a date, something like"... |
import requests
from flask import Flask, request
from flask_restful import Resource, Api, abort
import werkzeug.exceptions as HTTPStatus
import os.path
import time
import json
import threading
app = Flask(__name__)
api = Api(app)
files = {}
# files = {'amazon_reviews_us_Electronics_v1_00.tsv.gz' : { 'block-0': ['Node... |
# -*- coding: utf-8 -*-
"""
A utility for running Esri's "CRA" tools (Compress, Re-index, Analyze) on a database connection.
This tool is based on our understanding of Esri's recommendations and tailored to suit our needs,
so use at your own risk. We still hope it might be helpful to others.
The basic function... |
import os
import json
import time
import random
import numpy as np
import mxnet as mx
from mxnet import autograd, gluon
import subprocess
subprocess.run(["pip", "install", "gluoncv==0.8.0"])
import gluoncv as gcv
from gluoncv.data.batchify import Tuple, Stack, Pad
from gluoncv.data.transforms.presets.ssd import SSDD... |
import os, sys
current_dir = os.path.dirname(os.path.realpath(__file__))
parent_dir = os.path.dirname(current_dir)
sys.path.append(parent_dir + '/sim_common')
sys.path.append(parent_dir)
import simpy, json
import numpy as np
import client
import sim_config
import sim_utils
from plot_utils import *
from file_utils im... |
__author__ = 'byt3smith'
#
# Generates a dir for carbonblack feeds
# Can also stand up a SimpleHTTPServer to host the feeds
#
#stdlib
from os import chdir, listdir, mkdir, getcwd, path
import http.server
import socketserver
from re import sub, search
from json import dump, loads
from socket import gethostname
#pypi
fr... |
import math
import numpy as np
import torch
def cubic(x):
"""cubic function used for calculate_weights_indices."""
absx = torch.abs(x)
absx2 = absx**2
absx3 = absx**3
return (1.5 * absx3 - 2.5 * absx2 + 1) * (
(absx <= 1).type_as(absx)) + (-0.5 * absx3 + 2.5 * absx2 - 4 * absx + 2) * (((ab... |
from django.core.exceptions import ValidationError
from django.db.models.fields import CharField as ModelCharField
from django.forms.fields import CharField as FormsCharField
from django.utils.encoding import smart_unicode
from django import forms
from django.utils.safestring import SafeData
from django.contrib.admin.... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import pprint
from typing import Iterator
from pymongo.operations import UpdateOne
from pymongo.errors import BulkWriteError
from base import BaseObject
from base import MandatoryParamError
from dataingest.core.dmo import ManifestConnectorForMongo
from datamon... |
import codecs
import numpy as np
import random
import tensorflow as tf
import os
from keras import backend as k
from optparse import OptionParser
import time
import sys
import json
import tools
from collections import Counter
from collections import OrderedDict
from nn_models import *
from keras.models import load_mod... |
import pandas as pd
from bs4 import BeautifulSoup
import re
import numpy as np
import os
from urllib.request import urlopen, Request
import requests
import pickle
from tqdm.notebook import tqdm
import time as tm
from urllib.error import HTTPError
def accept_cookies(year, league, round=None):
'''
Starts the dr... |
import unittest
from postgres_ext import *
test_db = PostgresqlExtDatabase('peewee_test', user='postgres')
class BaseModel(Model):
class Meta:
database = test_db
class Testing(BaseModel):
name = CharField()
data = HStoreField()
class Meta:
ordering = ('name',)
class Testing2(Base... |
import cv2
from mss import mss
import imutils
import numpy as np
from . import color
from .draw_lib import draw_text, blit_alpha_img
from .dnn import 深度學習人臉模型
__all__ = [
'讀取影像灰階', '讀取影像彩色', '顯示影像', '等待按鍵',
'關閉所有影像', '儲存影像', '設置影像擷取', '擷取影像',
'彩色轉灰階', '灰階轉彩色', '左右翻轉', '上下翻轉', '上下... |
# BSD 3-Clause License
#
# Copyright (c) 2021, <NAME>
# 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 o... |
# Data header - UserID (f.key to User) | ItemID (f.key to Item) | Rating | TimeStamp
# Item Header: movie id | movie title | release date | video release date |
# IMDb URL | unknown | Action | Adventure | Animation |
# Children's | Comedy | Crime | Documentary | Drama | Fa... |
from __future__ import absolute_import
from __future__ import division
import collections
import math
import os
import sys
import random
import numpy as np
from six.moves import urllib
from six.moves import xrange
import tensorflow as tf
from timeit import default_timer as timer
import pandas as pd
impor... |
'''
Author: <NAME>
Date: 2022-01-19 09:17:53
LastEditTime: 2022-01-28 20:02:15
LastEditors: Please set LastEditors
Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
FilePath: /RAFT/demo.py
'''
import sys
sys.path.append('core')
import argparse
import os
import c... |
""" Optimize the logP of a molecule
Starting point: methane (C)
- actions: add a bond or an atom
- state: molecule state
- reward: 0, unless a terminal state is reached, then the penalized logp estimate of the molecule
"""
import argparse
import logging
import math
import multiprocessing
import os
import sys
imp... |
import argparse
import paddle
import paddle.nn.functional as F
import paddle.fluid as fluid
from paddle.io import DataLoader
import numpy as np
import os
import glob
import math
import time
from models.models import LWSNet
from dataloader import sceneflow as sf
from dataloader import dataloader
import utils.logger as... |
import time
import os
import hashlib
import sys
from shutil import move
import site
from PyQt5 import QtCore, QtGui, QtWidgets
shouldSortOtherFolders=False
shouldSortIntoOSDirectory=0
original_directory=''
#The first element of each of these lists is the name of the folder
folderNames = [ 'Other Folders',... |
import glob
import os
import sys
import shutil
import logging
from contextlib import contextmanager
import json
import fiona
import geopandas
import tempfile
from dask.config import config
from dask.base import tokenize
from dask_geomodeling import utils
from .base import BaseSingle
from .parallelize import GeometryT... |
"""
Top-level analysis code, and functions that are generic enough to not belong
in any class.
"""
__author__ = '<NAME>'
__copyright__ = 'Copyright 2020 <NAME>'
__credits__ = ['<NAME>', '<NAME>', '<NAME>']
__license__ = 'Apache License 2.0'
__version__ = '0.0.1'
__maintainer__ = '<NAME>'
__email__ = '<EMAIL>'
__status... |
# Imports
import time
from tkinter import *
import cv2
from PIL import Image, ImageTk
from PyQt5.QtMultimedia import QMediaPlayer, QMediaContent
from PyQt5.QtCore import QUrl
import hand_tracking_module as htm
import os
import numpy as np
class App:
def __init__(self, video_source=0):
self.p... |
import argparse
import json
import os
import h5py
from tqdm import tqdm
import numpy as np
import scipy.sparse as sp
from mips import MIPS
from mips_sparse import MIPSSparse
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('data_path')
parser.add_argument('dump_dir')
parser.add... |
import pylab
import glob
import numpy as np
import pylab
import time
from PIL import Image
import os
from scipy.ndimage import gaussian_filter
#14.01.13-22.52: started a class for projection (and depth coding) of Zseries folders.
def debug(msg):
print(msg)
stopwatch=0
def timeThis():
global stopwatch
stopwatch=... |
# (C) Copyright 2020- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernme... |
from git import Repo
import os, stat, shutil
import re
from .skillet import *
import oyaml
from colorama import Fore, Back, Style
import requests
def on_rm_error( func, path, exc_info):
# path contains the path of the file that couldn't be removed
# let's just assume that it's read-only and unlink it.
os.c... |
"""
Copyright 2021 Johns Hopkins University (Author: <NAME>, <NAME>)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import logging
from jsonargparse import ArgumentParser, ActionParser
import torch
import torch.nn as nn
import torch.nn.functional as nnf
count = 0
class AxisMasker(nn.Module):
""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.