text stringlengths 3.07k 22.1k |
|---|
"""
Utilities to instantiate and configure a Duckietown environment, including the addition of wrappers.
"""
__license__ = "MIT"
__copyright__ = "Copyright (c) 2020 <NAME>"
import logging
from gym_duckietown.simulator import Simulator, DEFAULT_ROBOT_SPEED, DEFAULT_CAMERA_WIDTH, DEFAULT_CAMERA_HEIGHT
from gym_duckietow... |
# -*- coding: utf-8; -*-
from django import forms
from django.contrib.auth.forms import PasswordChangeForm
from django.utils.translation import ugettext_lazy as _
from django.forms.models import modelformset_factory
from django.contrib.auth import get_user_model
from django.contrib.auth import authenticate
from django.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import smbus
import math
# define BMP388 Device I2C address
I2C_ADD_BMP388_AD0_LOW = 0x76
I2C_ADD_BMP388_AD0_HIGH = 0x77
I2C_ADD_BMP388 = I2C_ADD_BMP388_AD0_HIGH
BMP388_REG_ADD_WIA = 0x00
BMP388_REG_VAL_WIA = 0x50
BMP388_REG_ADD_ERR = 0x02
BMP388_REG_VAL_FATAL_E... |
import collections
from enum import Enum
import numpy as np
import pandas as pd
import matplotlib as mpl
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from dragonradio.tools.colosseum import ReservationLog
from dragonradio.tools.plot.util import addCheckboxWidget
from dragonradio.tools.plot.u... |
import abc
from dbac_lib import dbac_util
import numpy as np
import pandas as pd
import os
import logging
import json
logger = logging.getLogger(__name__)
DB_NAMES = ['cub200', 'awa2']
_DB_SPLIT_KEYS = ['train_exps', 'test_exps', 'train_imgs', 'val_imgs', 'test_imgs', 'valid_prims',
'train_combs', 't... |
# Copyright (c) OpenMMLab. All rights reserved.
import matplotlib.pyplot as plt
import mmcv
import numpy as np
from matplotlib.collections import PatchCollection
from matplotlib.patches import Polygon
EPS = 1e-2
def color_val_matplotlib(color):
"""Convert various input in BGR order to normalized RGB matplotlib c... |
from rpython.rlib.parsing.regexparse import make_runner
def test_simple():
r = make_runner("a*")
assert r.recognize("aaaaa")
assert r.recognize("")
assert not r.recognize("aaaaaaaaaaaaaaaaaaaaaaaaaa ")
r = make_runner("a*bc|d")
assert r.recognize("aaaaabc")
assert r.recognize("bc")
as... |
"""
``revscoring extract -h``
::
Extracts a list of `dependent` for a set of revisions.
Reads file containing revision observations, extracts dependents
(Features and Datasources), and writes extended observations out for future
use.
Usage:
extract -h | --help
extract <dependent>.... |
#!/usr/bin/env python3
# Descrição: Gerador De ScriptS Deface.
# Para Ataque [mass Deface]
# Autor: <NAME> do YouTube [Tio olive].
# Modulos Importados
import subprocess
import sys
import time
import os
def Sfront():
print('Gerador De ScriptS DefAce, Para Ataque [mass Deface]\n')
def bn():
clear('clear')
... |
import gym
import numpy as np
import tensorflow as tf
import random
class Env(object):
def __init__(self, bits):
self.bits = bits
def reset(self):
self.state = np.random.randint(0, 2, size=self.bits)
self.goal_state = np.random.randint(0, 2, size=self.bits)
while (self.state =... |
import argparse
import json
import math
import os
import random as rn
import shutil
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from sklearn.metrics import accuracy_score
from torch.autograd import V... |
# 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 applicable law or agreed to in... |
from datetime import date
from helper import should_review_coverage_note, save_delimited_data
from settings import get_config
import re
import xml.etree.ElementTree as ET
CITATION_SUBSETS = [
'AIM',
'B',
'C',
'D',
'E',
'F',
'H',
'IM',
'J',
'K',
'N',
'OM',
... |
'''
SOI Proprietorship Tax Data (pull_soi_proprietorship.py):
-------------------------------------------------------------------------------
Last updated: 6/29/2015.
This module creates functions for pulling the proprietorship soi tax data into
NAICS trees.
'''
# Packages:
import os.path
import numpy as np
import pan... |
import macc_models
import argparse
import os
from os.path import abspath, dirname, join
import google.protobuf.text_format as txtf
import lbann.contrib.launcher
import lbann.contrib.args
from lbann.util import str_list
import datetime
# ==============================================
# Setup and launch experiment
# ===... |
import sys
import os
import os.path as osp
import argparse
import numpy as np
import cv2
import colorsys
import json
import random
import torch
import torchvision.transforms as transforms
from torch.nn.parallel.data_parallel import DataParallel
import torch.backends.cudnn as cudnn
import matplotlib.pyplot as plt
sys.... |
import collections
import io
import ipaddress
import json
import logging
import pathlib
import time
from typing import Any, List, Mapping, Optional, Tuple, cast
from eth_utils import ValidationError, to_int, decode_hex, encode_hex
from mypy_extensions import TypedDict
import trio
from async_service import Service
fr... |
from logging import getLogger
from argparse import Namespace
from itertools import chain
from pathlib import Path
from sys import exit
from typing import List, Dict, Optional, Tuple, Any
from eduvpn.i18n import extract_translation
from eduvpn.nm import nm_available, save_connection_with_mainloop
from eduvpn.remote imp... |
# -*- coding: utf-8 -*-
"""Generalized Linear Models for large datasets."""
import textwrap
from dask_glm import algorithms, families
from dask_glm.utils import (
accuracy_score,
add_intercept,
dot,
exp,
poisson_deviance,
sigmoid,
)
from sklearn.base import BaseEstimator
from ..metrics import ... |
import argparse
import constants
import csv
import os
import pickle
import pdf_reader
from random import shuffle
import re
import utils
from sklearn.model_selection import train_test_split, KFold
def read_self_annot(self_annot, start_row=1, verbose=True):
if verbose:
print("Reading self annotation", self_annot)
... |
from pathlib import Path
from dateutil.parser import parse
import xarray
import numpy as np
#
import iri16 # fortran
proot = Path(__file__).parent
simout = ['ne', 'Tn', 'Ti', 'Te', 'nO+', 'nH+', 'nHe+', 'nO2+', 'nNO+',
'nCI', 'nN+']
def Switches():
"""
IRI switches to turn on/off several options
... |
"""Method for sharing global sensor and port configuration values between
modules.
"""
import serial
portdefaults = {
"port_baud": 9600,
"port_stopbits": serial.STOPBITS_ONE,
"port_parity": serial.PARITY_NONE,
"port_timeout": 0.01,
"virtual": False,
"delimiter": r"\s",
"encoding": "UTF-8"
... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
import os
from os.path import expandvars
from datetime import timedelta, datetime
from warcio.timeutils import datetime_to_http_date
import base64
import pickle
import redis
from time import strftime, gmtime
from webrecorder.cookieguard import CookieGuard
from webrecorder.utils import redis_pipeline
from itsdangerou... |
#-*- coding:utf-8 -*-#
# author: Qian | <EMAIL>
import sys
import ctypes
import random
import time
import os
import unicodedata
poster = ' Merry Christmas! '
star_density = 16
snow_density = 12 # 数字越小雪越密集
min_density = 1
max_density = 32
speed = 4
min_speed = 1
max_speed = 10
gap = ' '
snows = ['❄❆', '❅✲']
wood =... |
from __future__ import print_function
import os
import pprint
from collections import namedtuple
import requests
from .printer import IndentingBufferPrinter
SCALAR_TYPES = {
'string': 'String',
'boolean': 'Bool',
'number': 'Int',
'enumeration': 'String',
'integer': 'Int',
}
class List(object):... |
import board
import piece_check as pc
import re
#Variable which is 1 when it is whites move and -1 when it is blacks move.
#Keeps track of whose move it is and gets multiplied by the move value when checking if the move is valid.
#This is so pawn moves are properly tested.
whos_move = 1
move = ""
board_history = [... |
import numpy as np
from PuzzleLib.Backend import gpuarray
from PuzzleLib.Containers.Container import ContainerError, Container
from PuzzleLib.Containers.Node import Node
class Graph(Container):
def __init__(self, inputs, outputs, unsafe=False, nodesOnly=False, name=None):
super().__init__(name)
self.unsafe = u... |
from posix import times_result
import matplotlib.pyplot as plt
from matplotlib.ticker import EngFormatter
from ds1054z import DS1054Z
import sys
import os
import datetime
import time
import csv
import json
import configparser
# Simple Util-Functions
def throw_error(E: Exception, msg: str):
sys.stderr.write(f"... |
import inspect
import warnings
from collections import defaultdict, namedtuple
from typing import Any, Callable, Dict, Generator, List, Tuple, Union
import pydantic
from ninja import UploadedFile, params
from ninja.compatibility.util import get_args, get_origin as get_collection_origin
from ninja.errors import Config... |
import os
import csv
import json
import stringcase
from banal import ensure_list
from followthemoney.types import registry
from followthemoney.export.csv import CSVExporter
from followthemoney.export.graph import GraphExporter, DEFAULT_EDGE_TYPES
NEO4J_ADMIN_PATH = os.environ.get('NEO4J_ADMIN_PATH', 'bin/neo4j-admin'... |
# Copyright (c) <NAME> <_<EMAIL>>
# See COPYING for details.
"""SOCKS4/4a and SOCKS5 client endpoints.
"""
import socket
import struct
from parsley import stack
from twisted.internet import protocol, defer, interfaces
from zope.interface import implementer
import txsocksx.constants as c, txsocksx.errors as e
from... |
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA... |
#!/usr/bin/env python
# coding: utf-8
# # Machine Scheduling
#
# "Which job should be done next?" is a questiona one face in modern life, whetherfor a busy student working on course assignments, a courier delivering packages, a server waiting on tables in a busy restaurant, a computer processing threads, or a machine... |
import pygame
from pygame.locals import *
import random
pygame.init()
GAME_RES = WIDTH, HEIGHT = 800, 600
FPS = 200
GAME_TITLE = 'PlayerMovement - MarconiGames'
window = pygame.display.set_mode(GAME_RES, HWACCEL|HWSURFACE|DOUBLEBUF)
pygame.display.set_caption(GAME_TITLE)
clock = pygame.time.Clock()
# Game Values
d... |
from typing import TYPE_CHECKING, Any, Callable, Generator, List, Optional, Union
import os
import re
import sqlite3
import sys
import traceback
from vcd import VCDWriter
import simpy
from .pool import Pool
from .probe import ProbeCallback, ProbeTarget
from .probe import attach as probe_attach
from .queue import Queu... |
import os
from flask import Flask, request, jsonify, Response
import requests
import json
from loguru import logger
import yaml
from public_cache import PublicCache
from regularize import regularize
from sheet_parser import SheetParser
app = Flask(__name__)
mimetypes = {
'.html': 'text/html',
'.xhtm... |
import argparse
import json
import os
import time
import numpy as np
from sklearn import svm
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import FunctionTransformer, StandardScaler
from config import CONFIG_BY_KEY
from text_d... |
"""
Determines if a contraction can use BLAS or not
"""
from typing import List, Sequence, Tuple, Union
import numpy as np
from . import helpers
from .typing import TensorIndexType
__all__ = ["can_blas", "tensor_blas"]
def can_blas(inputs: List[str],
result: str,
idx_removed: TensorIndex... |
from tkinter import *
import tkinter.messagebox
import tkinter.filedialog
import app
import app_report
import os
fields = ('Kode voucher', 'Deskripsi', 'Jumlah')
def pengaturan_event(e):
newwin = Toplevel(root)
newwin.title("Pengaturan")
img = tkinter.PhotoImage(file="setting.png")
newwin.tk.call('wm'... |
from abc import ABCMeta, abstractmethod
from collections import namedtuple
import sys
import warnings
import torch
from torch import nn
from .shims import no_grad_variable
from .utils import default, product
ModelInfo = namedtuple(
'ModelInfo',
['input_space', 'input_size', 'input_range', 'mean', 'std']
)
... |
import random
from abc import ABCMeta
from pathlib import Path
from torch.utils.data import Dataset
from lasaft.utils.fourier import get_trim_length
import musdb
import numpy as np
import soundfile
import torch
from hydra.utils import to_absolute_path
def check_musdb_valid(musdb_train):
if len(musdb_train) > 0:... |
"""postprocessing.py -- perform postprocessing and observable calculation tasks
<NAME>
University of Notre Dame
- 10/25/17 (pjf): Created.
- 05/30/19 (pjf): Move obscalc-ob.res out to results subdirectory.
- 09/04/19 (pjf): Update for new em-gen, using l and s one-body RMEs.
- 09/11/19 (pjf): Update for new obscalc-o... |
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.data.datasets.coco import load_coco_json
import os
import cv2
import logging
from collections import OrderedDict
import detectron2.utils.comm as comm
from detectron2.utils.visualizer import Visualizer
from detectron2.checkpoint impo... |
# -*- coding: utf-8 -*-
""""""
import numpy as np
from .bpy_helper import needs_bpy_bmesh
from .material_shader import create_vertex_color_material
@needs_bpy_bmesh(run_anyway=True)
def create_mesh(
vertices: np.ndarray,
triangles: np.ndarray,
vertex_colors: {str: np.ndarray} = None,
face_colors: {st... |
import csv
import re
from collections import namedtuple
from datetime import datetime
from decimal import Decimal
from enum import unique
from functools import reduce
from pathlib import Path
from typing import (
Dict,
Iterable,
List,
Mapping,
NamedTuple,
Optional,
Sequence,
Set,
Tup... |
#!/usr/bin/python
# SPDX-License-Identifier: LGPL-2.1-or-later
from __future__ import print_function
import argparse
import dbus
import dbus.exceptions
import dbus.mainloop.glib
import dbus.service
import time
import threading
try:
from gi.repository import GLib # python3
from gi.repository import GObject #... |
# Princeton University licenses this file to You 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 writin... |
# Copyright (c) 2013-2019, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions an... |
import torch
import torch.nn as nn
from tensorboardX import SummaryWriter
import os
import time
import datetime
import yaml
import argparse
import pandas as pd
import numpy as np
from tqdm import tqdm
from IPython import embed
import models
from dataset import HFDataset, transform, data_prefetcher
from data_preparing... |
import json
import frappe
from frappe import _
from frappe.utils import flt, today, add_days
from erpnext.accounts.report.general_ledger.general_ledger import execute
@frappe.whitelist()
def get_pending_so(**kwargs):
try:
data = {"items": [], "customer": "", "pending_bal": 0, "closing_bal": 0}
sa_data = {}
cust... |
# !/usr/bin/python2
# Preliminary experiments on MNIST
# Reference: Distilling the Knowledge in a Neural Network
from __future__ import print_function
from __future__ import absolute_import
import numpy as np
import matplotlib
matplotlib.use('Agg')
import tensorflow as tf
from tensorflow.python.ops.nn_grad import _Sof... |
from flask import Flask, jsonify, request
from kernns.dataset import read_dataset_csv, load_dataset, add_vector, remove_vector, get_vector_by_key, reindex_vectors, get_vector_keys, clean_old_versions
from kernns.index import load_index, build_index, find_nns, save_metadata
import argparse
import os
import threading
imp... |
import importlib
import json
import os
import sys
from importlib import util
from pathlib import Path
import gensim.corpora as corpora
import numpy as np
from skopt.space.space import Real, Categorical, Integer
import octis.configuration.defaults as defaults
from octis.models.model import load_model_output
path = Pa... |
"""
BSD 3-Clause License
Copyright (c) 2018, <NAME>, Aalto University, Finland
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, t... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import uuid
from numbers import Number
from typing import Dict, List, Union
import numpy
from pathlib import Path
from pyutils.list_utils import _
from terminaltables import AsciiTable
from semantic_modeling.config import config
from semantic_modeling.data_io import get_seman... |
# import matplotlib
# matplotlib.use('Agg')
import sys
import os
import numpy as np
# import matplotlib.pylab as plt
# import seaborn as sns
import torch
from sim_model import fit_cv
from pyhrt.hrt import hrt
from pyhrt.utils import bh_predictions, tpr, fdr, pretty_str
def load_or_create(path, P, intervals):
if os... |
import datetime
from decimal import Decimal
from django.conf import settings
from django.core.validators import MinValueValidator
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.html import mark_safe
from django.utils import timezone
def get_upload_path(instance, fil... |
# -*- coding: utf-8 -*-
#
# AUTHOR = <NAME>
# STUDENT ID = G00364787
# DATE = 2018-04-27
# Written using: SPYDER v3.2.4 part of Anaconda package.
#
# PROJECT
# A script to...
# Analyse the IRIS.CSV file known as FISHER's IRIS data file.
#
# all own work and with help from references
# - see supporting... |
import pyglet, random, math, time
from pyglet.window import key, mouse
from random import randint
# Resources
pyglet.resource.path = ['./resources']
pyglet.resource.reindex()
pen_image = pyglet.resource.image('stylos.png')
ink_image = pyglet.resource.image('ink.png')
game_objects = []
# Define variables
window_heig... |
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec
from .cooccur import cooccur_binary, cooccur_logratio
from .util import argsort_arrays
def plot_joint_scatter(x, y, cutoff=0, xlabel='x', ylabel='y',
ra... |
def incidence_matrix(edges, excpt=[]):
"""Return an incidence matrix as dict where 1 indicates
a relationship between two nodes in a directed graph.
Parameters
----------
edges: list
Set of graph's edges
excpt: list
Set of nodes to exclude from matrix construction
(d... |
from collections import defaultdict
from .record import Record
from .check import assert_type
from .token import get_tokens_span
from .span import resolve_spans
from .tree import (
Node,
Leaf,
Tree
)
from .tokenizer import (
Tokenizer,
MorphTokenizer
)
from .tagger import (
Tagger,
PassTa... |
"""
Dice - rolls dice for roleplaying, in-game gambling or GM:ing
Evennia contribution - Griatch 2012
This module implements a full-fledged dice-roller and a 'dice' command to
go with it. It uses standard RPG 'd'-syntax (e.g. 2d6 to roll two
six-sided die) and also supports modifiers such as 3d6 + 5.
One can also s... |
import gym
import numpy as np
from scipy.linalg import circulant
from gym.spaces import Tuple, Box, Dict
from copy import deepcopy
class SplitMultiAgentActions(gym.ActionWrapper):
'''
Splits mujoco generated actions into a dict of tuple actions.
'''
def __init__(self, env):
super().__init_... |
import os
import random
import string
import sys
import time
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
import torch.nn.init as init
import torch.optim as optim
import yaml
from torch.utils.data import DataLoader
from ocr.model import CRNNet
from ocr.tools imp... |
#
# 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, software
# ... |
import collections
import json
import re
import sys
import typing
from datetime import datetime
from enum import Enum
import pytest
from django import __version__ as DJANGO_VERSION
from django.conf.urls import include
from django.db import models
from django.urls import re_path
from rest_framework import generics, ser... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import libs.boxes.cython_bbox as cython_bbox
import libs.configs.config_v1 as cfg
from libs.boxes.bbox_transform import bbox_transform, bbox_transform_inv, clip_boxes
from libs.logs.log impo... |
import numpy as np
import tensorflow as tf
import tensorflow_io.kafka as kafka_io
kafka_config = [
"broker.version.fallback=0.10.0.0",
"security.protocol=sasl_plaintext",
"sasl.username=test",
"sasl.password=<PASSWORD>",
"sasl.mechanisms=PLAIN"
# Tried to force kafka library to use the correct ... |
#!/usr/bin/env python
# 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, software... |
from __future__ import absolute_import
from keras_unet_collection.layer_utils import *
from keras_unet_collection.activations import GELU, Snake
from keras_unet_collection._model_unet_2d import UNET_left, UNET_right
from keras_unet_collection._backbone_zoo import backbone_zoo, bach_norm_checker
from tensorflow.keras... |
# Copyright 2015 Google Inc. 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 applicable law or a... |
import tkinter as tk
from tkinter import ttk
from tkinter import TclError
from highlight import Highlighter
import traceback
def index_to_line(index):
""" convert a tkinter index to the matching line number """
return int(float(index))
def classify_whitespaces(string, tabwidth):
""" calcula... |
# -*- coding: utf-8 -*-
from copy import deepcopy
import logging
import re
from prtg.models import INHERITED_PROPS, LIST_TYPE_PROPS
def _subtract_set_from_list(a_list, a_set_of_removals):
return list(filter(lambda element: element not in a_set_of_removals, a_list))
def _get_entity_value(entity, prop, parent_v... |
import copy
import numpy as np
from .util import is_ccw
from .. import util
from .. import grouping
from .. import constants
try:
import networkx as nx
except BaseException as E:
# create a dummy module which will raise the ImportError
# or other exception only when someone tries to use networkx
from... |
# -*- coding: utf-8 -*-
import collections
import datetime
import json
import logging
import os
import platform
import socket
import marshmallow as ma
import werkzeug.routing
from flask import request, current_app, g
from flask import url_for
from flask.views import MethodView
from flask_smorest import Blueprint
from... |
# Copyright Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompan... |
# coding=utf-8
# Copyright 2019 The Google AI Language Team 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 ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 <NAME> and <NAME>
# Copyright (C) 2012-2014 <NAME>
# Copyright (C) 2015-2017 <NAME>
from __future__ import absolute_import, division, print_function
from re import compile, escape, MULTILINE
from ..util import tagre
from ..scraper import _BasicScraper, _ParserScraper... |
"""
coupled symmetric model with from-below coupling
--top-down is freely parameterized num-channels but from-below and top-down have same spatial extent
--top-down and bottom-up are combined via convolution to the correct num-channel shape:
I = ReluConv(concat(top_down, bottom_up))
--error is c... |
# -*- coding: utf-8 -*-
import json
import json.decoder
import datetime
import warnings
from pathlib import Path
from typing import Optional, List, Any, Dict, Union, Tuple, Callable
from dgp.core import DataType
from dgp.core.types.reference import Reference
from dgp.core.oid import OID
from .flight import Flight
from... |
import os
import frontmatter
from app import db
from app.config import BLOG_PATH
from app.tables import LocalArticlesTable, LocalArticlesComment
from app.tables import CsdnArticlesTable, CsdnCount
from app.tables import JuejinArticlesTable, JuejinCount
from app.utils.database import get_page_view_count_by_path
def g... |
"""
Experimemtal code for trimming primers & polyA tails from high error rate long reads
"""
import os, sys, pdb
from csv import DictWriter
from collections import namedtuple
from multiprocessing import Process
from Bio.Seq import Seq
from Bio import SeqIO
import parasail
ScoreTuple = namedtuple('ScoreTuple', ['score5... |
""" Generates a Paths_libname module instead of cabal.
We modify the getDataFileName and getDataDir functions to use bazel's runfile library.
And we try to keep the same behavior as before for the others functions
(getBinDir getLibDir getDynLibDir getLibexecDir getSysconfDir).
These functions are defined by cabal thr... |
import sublime, sublime_plugin, io, cgi, ssl, json, os
from subprocess import call
import subprocess
from http.server import BaseHTTPRequestHandler
from urllib import parse
class ServerHandler(BaseHTTPRequestHandler):
def do_GET(self):
parsed_path = parse.urlparse(self.path)
message_parts = [
'CL... |
import pymongo
from tqdm import tqdm
from local_settings import DB_USERNAME, DB_PASSWORD, DB_ROOT
from process_data import create_df
from os import listdir
from math import isnan
def getClient():
client = pymongo.MongoClient(
'mongodb+srv://%s:%s@restaurant-<EMAIL>.mongodb.net/%s?retryWrites=true&w... |
import matplotlib.pyplot as plt
from matplotlib import patches
import numpy as np
import numpy.random as rd
import json
class NumpyAwareEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
elif isinstance(obj, np.floating):
retur... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
"""Look up an item on P99's wiki"""
#---------------------------------------
# Libraries and references
#---------------------------------------
import codecs
import json
import os
import re
from bs4 import BeautifulSoup
#-------------------------... |
import logging
import os.path
import pathlib
from abc import ABC, abstractmethod
from copy import deepcopy
import random
from PIL import Image
from tqdm import tqdm
from .base_dataset import BaseDataset
from .constants import DatasetTypes
from .dataset_info import BaseDatasetInfo
from .data_manifest import DatasetMani... |
"""Main Filter class."""
import enum
from dataclasses import dataclass, field
from typing import Iterable, NamedTuple
import numpy as np
import xarray as xr
from scipy import interpolate
from .gpu_compat import get_array_module
from .kernels import ALL_KERNELS, BaseLaplacian, GridType
FilterShape = enum.Enum("Fil... |
import abc
from hail.utils.java import Env
from .renderer import Renderer, PlainRenderer, Renderable
def _env_bind(env, bindings):
if bindings:
if env:
res = env.copy()
res.update(bindings)
return res
else:
return dict(bindings)
else:
re... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import gzip
import os
import random
import time
import numpy as np
import torch
from sklearn.metrics import roc_auc_score
from tqdm import tqdm
from torch import softmax
from torch.optim import Adam
from torch.optim.lr_scheduler import StepLR
from torch.uti... |
import os
import shutil
import re
import math
def createStartFolderStructure(path):
if os.path.isdir(path+'/Iwen Colours'):
shutil.rmtree(path+'/Iwen Colours')
os.mkdir(path+'/Iwen Colours')
os.mkdir(path+'/Iwen Colours/IOS')
os.mkdir(path+'/Iwen Colours/IOS/Colours.xcassets')
os.mkdir(p... |
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.distributed import DistributedSampler
from torchvision.transforms import functional as F
import pandas as pd
from utils import DataWrap
import numpy as np
from pathlib import Path
import torch
from tqdm import tqdm
import re
import PIL
import json
f... |
#!/usr/bin/env python3
import os
import sys
import argparse
import cadquery as cq
from cadquery import cqgi
import fileinput
import traceback
from cqcodecs import loader
def build_and_parse(script_str, params, errfile):
"""
Uses CQGI to parse and build a script, substituting in parameters if any were supplied.... |
import os, sys
from Bio.Seq import Seq
from csv import DictReader, DictWriter
import pysam
import pdb
def find_Aend(seq, min_a_len=8):
"""
Given a sequence, find the likely beginning and end of polyA tail
"""
Aseq = 'A'*min_a_len
# will search for only the last 200 bp of the sequence
x = seq[-2... |
"""Admin module."""
from urllib.parse import urljoin
import textwrap
from flask import request, url_for
from flask_admin.contrib.sqla import ModelView
from jinja2 import Markup
import humanize
import structlog
from . import models
log = structlog.getLogger(__name__)
def date_formatter(_, __, model, name):
dat... |
import json, os, random
def jsPath(path):
'''Returns a relative path without \, -, and . so that
the string will play nicely with javascript.'''
shortPath=path.replace(
"C:\\Users\\scheinerbock\\Desktop\\"+
"ideogram\\scrapeSource\\test\\","")
noDash = shortPath.replace("-","_d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.