text stringlengths 3.07k 12.6k |
|---|
#!/usr/bin/env python3 -m pytest -s
# The shebang runs the test with stdout enabled and must be invoked from
# the repo root.
import snowy
import numpy as np
import pytest
import timeit
w, h = 1920 / 4, 1080 / 4
def smoothstep(edge0, edge1, x):
t = np.clip((x - edge0) / (edge1 - edge0), 0.0, 1.0)
return t *... |
import matplotlib.pyplot as plt
import numpy as np
import json
import math
from jason.rl_ctrnn import RL_CTRNN
"""
Generating similar plots from the paper:
A Bio-inspired Reinforcement Learning Rule to Optimise Dynamical Neural Networks for Robot Control
<NAME> and <NAME> (2018)
2018 IEEE/RSJ International Conference... |
import os
from astropy.io import fits
import numpy as np
from calcos import ccos
from six.moves.urllib.request import urlopen
import re
#-------------------------------------------------------------------------------
def remove_if_there(filename):
if os.path.exists(filename):
os.remove(filename)
#------... |
import json
from threading import Thread
from multiprocessing import Process, Queue
from pypykatz import logger
from pypykatz.commons.winapi.local.function_defs.netapi32 import NetLocalGroupGetMembers
from pypykatz.remote.live.common.common import is_port_up
from pypykatz.commons.common import UniversalEncoder
class... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 6 21:09:26 2021
@author: zongx
"""
# Import necessary packages
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn import linear_model
from sklearn.preprocessing import StandardScaler
from sklearn.metr... |
# syntax.py
import sys
from PyQt4.QtCore import QRegExp
from PyQt4.QtGui import QColor, QTextCharFormat, QFont, QSyntaxHighlighter
def format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
"""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCharFormat()
... |
from ._base import *
from .models import component_name, rename_if_scope_child_component
from fastapi import status
class BaseError(Exception):
CODE = None
MESSAGE = None
ErrorModel = None
DataModel = None
data_required = False
errors_required = False
error_model = None
data_model = ... |
import asyncio
import aiosqlite
from aiohttp import web
from db_utils import db_get_one, insert_one, db_get_first
from tg_utils import post_message
BOT_TOKEN = "<PASSWORD>"
async def get_player_id(db, user_id):
select_player = "SELECT * FROM player WHERE telegram_id = :telegram_id"
insert_player = "INSERT ... |
"""Use Stanford Parser to analyse English text.
Requires Stanford CoreNLP version 4.0.0 (https://stanfordnlp.github.io/CoreNLP/history.html).
May work with newer versions.
Please download, unzip and place contents inside sparv-pipeline/bin/stanford_parser.
License for Stanford CoreNLP: GPL2 https://www.gnu.org/license... |
import maya.cmds as mc
window_name = 'AnimFixes'
def createUI():
if mc.window(window_name, exists=True):
mc.deleteUI(window_name)
window = mc.window(window_name, title="LS Animation Fixes", w=330, h=450, rtf=True, mnb=False, mxb=False,
sizeable=False)
# Creem una columna ... |
import json
import numpy as np
import os
import tensorflow as tf
FLAGS = tf.flags.FLAGS
def sample(query_id, query_gt, query_label, query_loc, all_ids, all_gts,
all_labels, all_locs, is_training):
"""For each query video, random sample a reference video.
Args:
query_id: Query video id.
quer... |
# -*- coding: utf-8 -*-
from django.contrib.admin import ModelAdmin, StackedInline, TabularInline
from ..compat import ADMIN_QUERYSET_METHOD_NAME, admin_validation, chain_queryset
from ..exceptions import QueryablePropertyError
from ..managers import QueryablePropertiesQuerySetMixin
from ..utils.internal import Query... |
'''
Match and split the 14A M31 HI data.
'''
import numpy as np
import sys
import os
from tasks import mstransform, partition, split
# Use astropy's spectral conversion
# Needs to be installed separately
from astropy import units as u
use_parallel = True
use_contsub = True if sys.argv[-5] == "True" else False
#... |
import math
import random
import pygame
import pygame_menu
from pygame import mixer
#initializes the game using pygame
pygame.init()
#screen size
screen = pygame.display.set_mode((800, 600))
#background image and menu bar
background = pygame.image.load("./images/Very_Black_screen.png")
#game audio
m... |
import fault
import aetherling.helpers.fault_helpers as fault_helpers
from aetherling.space_time import *
from aetherling.space_time.reshape_st import DefineReshape_ST
@cache_definition
def Module_0() -> DefineCircuitKind:
class _Module_0(Circuit):
name = "Module_0"
IO = ['f_in1', In(ST_Int().magm... |
## Automatically adapted for numpy.oldnumeric Jun 27, 2008 by -c
#
# Copyright (C) 2002-2008 <NAME> and Rational Discovery LLC
#
""" unit tests for the model and descriptor packager """
from rdkit import RDConfig
from rdkit.ML.Data import DataUtils
import unittest, os, sys
import io
from rdkit.six.moves import cPick... |
#!/usr/bin/env python
"""
data.py
Desc: Computes minimum volume ellipsoid
@author <NAME>, Cornell University
@date (2017)
@version 1.0
"""
import os
import numpy as np
PATH = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'data'
)
if not os.path.isdir(PATH):
os.mkdir(PATH)... |
from configparser import ConfigParser
from contextlib import contextmanager
import csv as csv_
import io
import json as json_
import jsonpath_rw
import os
import pytimeparse
import re
import stat
import time
import urllib.request
def flip_flop(re_on, re_off, include_on, include_off, lines):
on = False
for l in... |
import json
import textwrap
from collections import defaultdict, Counter, namedtuple
import argparse
import itertools
from csv import DictReader
from time import sleep
import os
kBIGNUMBERS = {
-1: """
88888888
88888888
""",
0: """
.n~~%x.
x88X 888.
X888X 8888L
X8888X 88888
88888X ... |
"""
Proximal operators / mappings
"""
import numpy as np
from abc import ABCMeta, abstractmethod
from functools import wraps
from scipy.optimize import minimize as scipy_minimize
from scipy.sparse import spdiags
from scipy.sparse.linalg import spsolve
try:
from skimage.restoration import denoise_tv_bregman
except... |
from __future__ import annotations
import argparse
import socket
import time
import _thread
from typing import Union
import coregent.net.struct as sn
from coregent.net.client import Client
from coregent.net.core import get_server_socket
M_CONNECT = sn.Message(
1, 'Connect',
user=sn.P_UNICODE8
)
M_WELCOME = ... |
from io import StringIO
import re, sys
import numpy as np
import itertools
import string
import time
from collections import defaultdict
from functools import partial
inputs="""position=< 9, 1> velocity=< 0, 2>
position=< 7, 0> velocity=<-1, 0>
position=< 3, -2> velocity=<-1, 1>
position=< 6, 10> velocity=<-2, -... |
import json
import re
import charset_normalizer
import pyjq
from lxml import etree
from .. import errors
class Handler:
_format = {}
_match_attrs = {}
_severities = []
def __init__(self, format):
self._format = format
severities = self._format["severities"]
self._match_at... |
import struct
import db
from eoslib import N
import eoslib
_code = N('eosio.token')
#_code = N('mytoken')
def to_symbol_name(s):
n = int.from_bytes(s, 'little')
return n>>8
class Asset(object):
def __init__(self, amount=0, symbol=None):
self.amount = amount
self.symbol = symbol
def ... |
# ----------------------------------------------------------------------------------------------------------------------
# Name: Composite
# Purpose: CLI for the generation of temporal composite based on WIM WAM CLT
#
# Author: Eligio
#
# Created: 31/10/2020
# Copyright: (c) Eligio 2020
# Licence:... |
# Priority dictionary using binary heaps
# <NAME>, UC Irvine, 8 Mar 2002
# Implements a data structure that acts almost like a dictionary, with two modifications:
# (1) D.smallest() returns the value x minimizing D[x].
# For this to work correctly, all values D[x] stored in the
# dictionary must be comparable.... |
from io import BytesIO
from django.http import HttpResponse
from django.template.loader import get_template
from xhtml2pdf import pisa
import re
def valida_cnpj(cnpj):
"""
Valida CNPJs, retornando apenas a string de números válida.
# CNPJs errados
>>> validar_cnpj('abcdefghijklmn')
False
>>... |
# Filename: sen_analysis
# Main function
# Created: November/09/2017
# Last modified: November/09/2017
# Author: Prof. <NAME>
# PhD student: <NAME>
import numpy as npy
import prob_distrs
import random
import func_data
import pyPCE
import pyKriging
import pyPCKriging
def exp_mix(a, x_prob, *args):
x_exp1... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Pocket PiAP (Modifications)
# ......................................................................
# Copyright (c) 2017-2020, <NAME>
# ......................................................................
# Licensed under MIT (the "License");
# you may not use this f... |
import os
baseLoc = os.path.dirname(os.path.realpath(__file__)) + '/'
from gimpfu import *
import sys
sys.path.extend([baseLoc + 'gimpenv/lib/python2.7', baseLoc + 'gimpenv/lib/python2.7/site-packages',
baseLoc + 'gimpenv/lib/python2.7/site-packages/setuptools', baseLoc + 'PD-Denoising-pytorch'])
... |
import tensorflow as tf
import scipy.signal
import scipy.io.wavfile
import random
import cv2
import os
import logging
import numpy as np
class DataGenerator:
def __init__(self, csv_file, video_dir, audio_dir, pid, pcnt, seed):
with open(csv_file) as f:
self.segments = f.readlines()
... |
# TODO: properly handle enumerated nodes
import json
import os.path
import sys
import re
from props.node import PropertyNode, root
if (sys.version_info > (3, 0)):
# dummy unicode type (never used in python3) to make the code
# happy in both python 2 and 3 environments.
class unicode():
pass
... |
class List:
def __init__(self, db, key):
self.db = db
self.key = key
def all(self):
return self.db.lrange(self.key, 0, -1)
def append(self, value):
return self.db.rpush(self.key, value)
def pop(self):
return self.db.rpop(self.key)
def shift(self):
... |
from __future__ import annotations
import itertools
from copy import deepcopy
from typing import Any, Callable, Dict, List, NoReturn, Optional, Tuple
from collections import defaultdict
class CPU:
def __init__(self, vm: VM) -> None:
self.vm = vm
self.mem = vm.mem
self.operations = {
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 30 2017
@author: <NAME>
"""
import sys, getopt
import sympy as sp
import numpy as np
import scipy.odr as odr
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
x, y, Xi, Yi = sp.symbols("x, y, Xi, Yi")
""" ---------------------... |
# -*- coding: utf-8 -*-
import os
import re
import select
import subprocess
import traceback
import xbmc
import xbmcaddon
import xbmcgui
import xbmcvfs
# Import the common settings
from resources.lib.settings import Settings
from resources.lib.settings import log
ADDON = xbmcaddon.Addon(id='service.cec')
CWD = ADDON... |
import numpy as np
from matplotlib.figure import Figure
from matplotlib.artist import setp
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib import colors, cm
from matplotlib.backends.backend_pdf import PdfPages
def plot... |
#!/usr/bin/env python
# -*- coding: utf-8
# Functions to get distance from PMJ for processing segmentation data
# Author: <NAME>
import logging
import numpy as np
from spinalcordtoolbox.image import Image
from spinalcordtoolbox.centerline.core import get_centerline
logger = logging.getLogger(__name__)
NEAR_ZERO_THRE... |
import lcd
import image
import time
lcd.init(type = 2, freq=15000000, width=240, height=240, color=(0, 0, 0))
lcd.rotation(1)
lcd.clear(lcd.BLACK)
canvas = image.Image(size=(240, 240))
from cocorobo import display_font
# Uncomment below to use font from SD card.
# font_path = "/sd/user/Dinkie9px-16pt_24w-24h-hoff-1... |
import matplotlib.pyplot as plt
from matplotlib import rcParams
import matplotlib as mpl
mpl.use('Agg')
plt.style.use(['seaborn-whitegrid', 'seaborn-ticks'])
import matplotlib.ticker as plticker
rcParams['figure.figsize'] = 12, 8
rcParams['axes.facecolor'] = 'FFFFFF'
rcParams['savefig.facecolor'] = 'FFFFFF'
rcParams[... |
#!/usr/bin/env python3
'''
getAssemblySummary.py -- get summary information of assemblies by accession_id, tax_name, tax_id
AUTHOR: <NAME>
DATE : 2020-11-05
BUGS : Any bugs should be reported to <EMAIL>
'''
import sys
import argparse
try:
import ncbi.datasets
except ImportError:
print('ERROR: ncbi.dataset... |
#!/usr/bin/env python3
"""
Created on Tue Apr 23 21:58:12 2019.
@author: <NAME>
"""
# =============================================================================
# Libraries
# =============================================================================
from typing import List, Iterable, Callable
from typing import... |
# -*- coding: utf-8 -*-
import numpy as np
def relu(x):
return np.maximum(0, x)
def relu_back(x,dout):
dx = np.array(dout, copy=True)
dx[x <= 0] = 0
return dx
def conv_forward_naive(_input,_filter,b,pad,stride):
(m, n_h, n_w, n_C_prev) = _input.shape
(f,f, n_C_prev, n_C) = _filter.sha... |
import textwrap
from xarray import Dataset
from .mapping import map_over_subtree
"""
Module which specifies the subset of xarray.Dataset's API which we wish to copy onto DataTree.
Structured to mirror the way xarray defines Dataset's various operations internally, but does not actually import from
xarray's internal... |
#!/usr/bin/env python3
from urllib.request import urlopen
from urllib.request import HTTPError
from urllib.request import Request
from bs4 import BeautifulSoup
import pandas as pd
import html5lib
import pdb
import json
import csv
from collections import OrderedDict
import contextlib
import os, sys, stat
import dateti... |
import ptn_data
from typing import List
from typing import Dict
from core.model.ptn import Stop, Link
class LinePool:
def __init__(self) -> None:
self.pool = []
self.max_id = 0
def get_lines(self) -> List["Line"]:
return self.pool
def get_original_lines(self) -> List["Line"]:
... |
import argparse
import os
from functools import lru_cache
import spacy
import numpy as np
from nltk import edit_distance
from datasets import load_dataset
from tqdm import tqdm
from scipy import sparse
from scipy.sparse.csgraph import maximum_bipartite_matching
from summarus.util.spacy import spacy_deserialize, norma... |
# coding=utf-8
from win32com import client as wc
from docx import Document
import xlwt
import re
import os
def docx_to_dict(path):
print("提取文档中景区信息...{}".format(path))
document = Document(path)
l = [paragraph.text for paragraph in document.paragraphs]
scenic = {
'name': '',
'level': '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# conv_json2table.txt
# made by <NAME>
# 2020-01-29 09:15:52
#########################
import sys
import os
import json
SVRNAME = os.uname()[1]
if "MBI" in SVRNAME.upper():
sys_path = "/Users/pcaso/bin/python_lib"
elif SVRNAME == "T7":
sys_path = "/ms1/bin/python_li... |
import pandas as pd
from collections import Counter
import sklearn.preprocessing as preprocessing
import numpy as np
import os
from pandas import Series
import seaborn as sns
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
from sklearn.feature_selection import SelectKBest
column_names = ['age','workclass... |
# PyCParser - C wrapper
# by <NAME>, 2011
# code under BSD 2-Clause License
import ctypes
from . import cparser
from .cparser_utils import *
class CStateDictWrapper:
"""
generic dict wrapper
This is a generic dict wrapper to merge multiple dicts to a single one.
It is intended mostly to merge differe... |
from typing import List
import subprocess
from pathlib import WindowsPath
import os.path
from datetime import datetime
import math
import unittest
from buph.logger import buph_logger
from buph.scheduler import BackupType, BackupRequest
from buph.config import Config
from buph.drives import DestinationDrive... |
import P4J
import time
import pandas as pd
import numpy as np
import tqdm
def get_period(method, mjd, mag, error, fids=None):
"""
Computes the period from the periodogram created with the
input data using one of the methods from P4J
Parameters
---------
method: {'PDM1', 'LKSL', 'AOV', 'M... |
# Copyright 2009-2021, <NAME>, <EMAIL>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
import torch
import os
import subprocess
def disparity_normalization_vis(disparity):
"""
:param disparity: Bx1xHxW, pytorch tensor of float32
:return:
"""
assert len(disparity.size()) == 4 and disparity.size(1) == 1
disp_min = torch.amin(disparity, (1, 2, 3), keepdim=True)
di... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
FISCO BCOS/Python-SDK is a python client for FISCO BCOS2.0 (https://github.com/FISCO-BCOS/)
FISCO BCOS/Python-SDK is free software: you can redistribute it and/or modify it under the
terms of the MIT License as published by the Free Software Foundation. This proje... |
import multiprocessing
import time
import sys
import datetime
import os
import csv
import json
# Directory where the original .csv files were downloaded to, using downloadTaxisCSVs.py:
CSV_DIR = '/lucenedata/nyc-taxi-data'
normalize = {
'vendorid': 'vendor_id',
'vendor_id': 'vendor_id',
'vendor_name': 'vendor_n... |
import torch
from torch.autograd import Function
from torch.nn.modules.module import Module
from torch.autograd import Variable
import os
from torch.autograd.function import once_differentiable
torch_ver = torch.__version__[:3]
if torch_ver=="0.4":
from torch.utils.cpp_extension import load
build_path = o... |
from pathlib import Path
import os
import typing
from . import common
def get_exe_suffix(platform: common.Platform) -> str:
if platform == common.Platform.WINDOWS:
return '.exe'
if platform == common.Platform.DARWIN:
return ''
if platform == common.Platform.LINUX:
return ''
... |
import os
import numpy as np
import cv2
import json
import sys
import random
sys.path.insert(1, '/codehub/external/detectron2')
from detectron2.engine import DefaultTrainer
from detectron2.engine import DefaultPredictor
from detectron2.config import get_cfg
from detectron2 import model_zoo
from detectron2.structures i... |
from StocktonBotPackage.DevUtilities import configutil, utils
import discord
import asyncio
# ---------------------------------------#
config = configutil.get_parsed_config() #
# ---------------------------------------#
async def find_reaction_function(emoji, channel, member, message, is_add=True):
"""
:pa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-3-Clause
# Copyright © 2017-2019, GoodData Corporation. All rights reserved.
"""
FreeIPA Manager - GitHub forwarding tool
Tool for committing changes pulled from FreeIPA
and forwarding them to a GitHub repository via a pull request.
"""
imp... |
#!/usr/bin/env python
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope th... |
"""GO-DAG tasks."""
__copyright__ = "Copyright (C) 2010-2018, <NAME>, <NAME>, All rights reserved."
__author__ = "<NAME>"
# ------------------------------------------------------------------------------------
def get_go2parents(goterms):
"""Get all parent GO IDs for each GO in dict keys."""
go2parents = {}
... |
# Note: this file is derived from:
# https://github.com/guillaume-chevalier/HAR-stacked-residual-bidir-LSTMs
# (Apache 2.0 License, Copyright 2017, <NAME> and <NAME>)
# There is also some code derived from:
# https://github.com/guillaume-chevalier/LSTM-Human-Activity-Recognition
# (MIT License, Copyrig... |
from typing import Optional
from numpy import dtype
import geopandas as gpd
import h3
import pandas as pd
import libpysal as lps
from esda.moran import Moran
from esda.moran import Moran_Local
from shapely.geometry import box, mapping, Point
def fill_hex_grid(
gdf: gpd.GeoDataFrame, geom_column: str = "geometry... |
import argparse
import numpy as np
import pydigree as pyd
from pydigree.stats import MixedModel
from pydigree.common import table
from pydigree.stats.stattests import LikelihoodRatioTest
parser = argparse.ArgumentParser()
parser.add_argument('--ped', required=True,
help='LINKAGE formatted 5/6 colum... |
from bw2data.backends import ActivityDataset as AD, ExchangeDataset as ED
from fs.zipfs import ZipFS
from pathlib import Path
import bw2data as bd
import bw_processing as bwp
import math
import numpy as np
import stats_arrays as sa
from tqdm import tqdm
DATA_DIR = Path(__file__).parent.resolve() / "data"
def carbon... |
"""n8pushover.py
A quick implementation of the Pushover API in Python, using an envvar or the
keyring module (desktop) or Pythonista's keychain module (iOS) to store
credentials.
Usage:
from n8scripts.n8pushover import push
push("It's alive!")
push("This one has a title.", title="My awesome title.")
"""
i... |
#!/usr/bin/env python3
# Copyright 2021 Google 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 o... |
import json
import logging
import logging.config
import random
import re
from collections import Counter
from typing import Dict, List, Set
from urllib.parse import urlencode
from bs4 import BeautifulSoup
from flashtext import KeywordProcessor
from selenium import webdriver
from selenium.common.exceptions import MoveT... |
#!/usr/bin/env python
# coding: utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils, models
from torch.autograd import Variable
import os
import warnings
import time
import sys
... |
import os
import numpy as np
import warnings
import SimpleITK as sitk
import cv2
from utils.imageutils import pad_resize, resize_by_spacing
__author__ = '<NAME>'
def read_dicom_series(dicom_folder, correct_ct_val=0):
"""Read a DICOM series from a folder as a volume.
:param dicom_folder: a folder containing... |
import azure as azure
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.network import NetworkManagementClient
from azure.mgmt.network.v2017_03_01.models import NetworkSecurityG... |
"""
Bipartite graph community utility functions.
"""
import networkx as nx
import numpy as np
from itertools import product
from copy import deepcopy
import pandas as pd
from mvmm.multi_view.block_diag.graph.linalg import get_adjmat_bp
def get_nonzero_block_mask(X, tol=1e-6):
"""
Returns the True/False mask ... |
import os
import os.path
import shutil
import inspect
from re import search
from datetime import datetime
# 같은 이름의 폴더가 없으면 폴더 생성
def create_folder(args):
try:
if not os.path.exists(args):
os.makedirs(args)
except OSError:
pass
# 확장자가 없는 파일 , 폴더 제외
def files_filter(x):
if x.f... |
import json
import uuid
import traceback
from pathlib import Path
""" Base directory for saved games, races, etc """
__www_dir = Path(__file__).parent.parent / 'www'
__game_dir = Path(__file__).parent.parent / 'data'
__user_dir = Path.home() / 'Inherit!'
""" Autosave object """
__root = None
""" Registry of all r... |
"""Main module for mp3toimage."""
import os
import sys
import pkgutil
import argparse
import importlib
from typing import List
from PIL import Image
import mp3toimage.algorithms
from mp3toimage.song import NotEnoughSong, SongImage
from mp3toimage.util import generate_pixels, Point, Color
VALID_SONG_EXT... |
#!/usr/bin/env python
#
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
# -*- coding: utf-8 -*-
# This code is a part of sunshine package: https://github.com/letuananh/sunshine
# :copyright: (c) 2013-2021 <NAME> <<EMAIL>>
# :license: MIT, see LICENSE for more details.
import os
import sys
import logging
from pathlib import Path
from django import get_version as django_version
from djang... |
import logging
import logging.config
from invoke import task, Collection
from dotenv import find_dotenv, set_key
from invoke.exceptions import Failure
from config import load_config
import os
from invoke.executor import Executor
import storage
import helm
import kubectl
import json
logging.config.fileConfig(os.getenv... |
import torch.optim
from Load_Dataset import ValGenerator, ImageToImage2D
from torch.utils.data import DataLoader
import warnings
warnings.filterwarnings("ignore")
import Config as config
import matplotlib.pyplot as plt
from tqdm import tqdm
import os
from nets.LSUnetMix import LSUnetMix
from utils import *
import cv2
... |
"""Submodule with methods to parse and standardize STRING graphs."""
import pandas as pd
import os
def parse_string_fasta(path: str) -> pd.DataFrame:
"""Return dataframe with aminoacid fasta sequences from given path.
Parameters
-----------------------
path: str
Path to the fasta file to load... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import getdate, get_last_day, add_months, flt, rounded, cint
from functools import partial
from loan_management.loan_management... |
import numpy as np
def intcode_comp(puzzle_input):
"""Compute based on the intcode instructions below
# position mode:
# 1: positional add
# 2: positional multiply
# 3: get input and save it at location of parameter
# 4: output value located at parameter
# immediate mode:
... |
"""Query module."""
import logging
import os
from annuaire.annuaire.exception import AnnuaireException
from annuaire.annuaire.parser import parse_detail, parse_result
from config import settings
from lxml import html
import requests
base_url = settings.BASE_URL
log = logging.getLogger(__name__)
def get_form_pag... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
get_ipython().system('pip install h5py pyyaml ')
get_ipython().system('pip install -U -q PyDrive')
get_ipython().system('mkdir ./chkpt/')
get_ipython().system('mkdir ./log/')
# In[2]:
get_ipython().system('wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linu... |
# MIT License
#
# Copyright (c) 2017 <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, pub... |
"""Tests for RamlWrap"""
import json
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../")))
from ramlwrap.views import RamlDoc
from django.test import TestCase, Client
class RamlApiDocsTestCase(TestCase):
def setUp(self):
doc = RamlDoc()
d... |
#hot_air_balloon.py
import maya.cmds as cmds
import functools
import math
def UI(pWindowTitle, makeMushroom):
"""
Creating the user Interface to input various paramters to create a hot air balloon
"""
windowID = 'Hot Air Balloon'
if cmds.window(windowID, exists=True):
cmds.deleteUI(win... |
import pickle
import numpy as np
import pickle
# Joints in H3.6M -- data has 32 joints,
# but only 17 that move; these are the indices.
H36M_NAMES = [''] * 32
H36M_NAMES[0] = 'Hip'
H36M_NAMES[1] = 'RHip'
H36M_NAMES[2] = 'RKnee'
H36M_NAMES[3] = 'RFoot'
H36M_NAMES[6] = 'LHip'
H36M_NAMES[7] = 'LKnee'
H36M_NAMES[8] = '... |
"""Athena ascii file reader"""
from __future__ import print_function
import os
import re
from itertools import takewhile, count
import numpy as np
from viscid.readers.vfile_bucket import ContainerFile
from viscid.readers import athena
from viscid.readers import vfile
from viscid import coordinate
class AthenaTabFi... |
#!/usr/bin/env python
# =============================================================================
# <NAME>
# 2018-10
# Updated 2021-02-26
# =============================================================================
import numpy as np
class quadrature_encoder:
def __init__(self, serial_string_identifier,... |
#!/usr/bin/python
"""A small set of functions for converting a Pandora file to a dataframe.
The main function in this module is read_pandora: ::
from uptrop.read_pandora import read_pandora
location, pandora_df = read_pandora("pandora_file", "Tot")
pandora_df.plot('day', 'no2col')
The rest are ancillary... |
import re
import pysvd
# Note construtors: First class specific code is executed than parent constructor
# called, so that on last constructor of Base parser() can be called also hierachical
# on every parent object automatically.
class Base(object):
"""Base class for all SVD elements"""
def __init__(self, ... |
import pathlib, json
import pickle
import re
import numpy as np
import os.path as osp
from IPython import embed
from collections import OrderedDict
from pathlib import Path
from skimage import io
from tqdm import tqdm
from det3d.core import box_np_ops
def create_kitti_info_file(data_path, save_path=None, relative_pa... |
#!/usr/bin/python
import os
import re
import json
import praw
import tqdm
import time
import colors
import random
import datetime
from tqdm import tqdm
from colors import color
from datetime import datetime
from dotenv import load_dotenv
from praw.models import Redditor, Subreddit
# Enter your correct Reddit informati... |
import imp # Standard module to do such things you want to.
# from .st_commons import _maybe_promote_st, unique_variable
import xarray as xr
# We can import any module including standard ones:...this makes sure they are different copies of the normal xarray module
# xr2 = imp.load_module('xr2', *imp.find_module('xarra... |
import maskgen.algorithms.optical_flow
import argparse
import os
from maskgen.tool_set import getMilliSecondsAndFrameCount, getDurationStringFromMilliseconds
from maskgen.algorithms.optical_flow import smartDropFrames,get_best_frame_pairs
import maskgen.algorithms.drop_strategy as dropStrats
def main():
parser = ... |
"""
QA files for Landsat 8 OLI/TIRS Collection 1 Quality Band
https://landsat.usgs.gov/sites/default/files/images/C1-L4-5-7-8_QA_attributeTables.JPG
***********
* WARNING *
***********
This will not work with the previous L8 pre-Collection qa bands. See qa_L8.py instead.
"""
import os
import numpy as np
import raster... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.