text stringlengths 3.07k 22.1k |
|---|
#Simulates a given individual and saves his replay
from graphics import *
import random
import Tkinter
import pickle
import time
#dna properties
actions = 3
gScale = (5, 5, 5, 5, 5)
testX = 10
#global properties
playSpeed = .03
gravity = 1
jumpV = 10
draw = True
jumpHeight = 20
speed = 3
playerSize = 20
treatSize = ... |
"""
my NN library
(based on Yoav's)
"""
import _dynet as dynet
import numpy as np
import array
from bilstm_aux.lib.constants import START_TAG, END_TAG
from scipy import linalg
def init_dynet(seed):
"""initialize DyNet"""
dyparams = dynet.DynetParams()
# Fetch the command line arguments (optional)
dypa... |
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import argparse
#import io
from skimage.feature import hog
from functools import reduce
import requests
import time
import cv2
import numpy as np
import time
import dlib
import sys
import os
from skimage import io
from skimage import... |
# Copyright 2018-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from contextlib import contextmanager, nullcontext
from os import remove as remove_... |
import logging
import sys
import os
import vcf
from sv_interval import SVInterval
logger = logging.getLogger(__name__)
mydir = os.path.dirname(os.path.realpath(__file__))
'''
From https://github.com/genome/breakdancer, the format is described as
1. Chromosome 1
2. Position 1
3. Orientation 1
4. Chromosome 2
5. Po... |
import numpy as np
import pandas as pd
import warnings
import statsmodels.api as sm
from statsmodels.stats.outliers_influence import variance_inflation_factor
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
from sklearn.metrics impo... |
#!/usr/bin/env python3
#
# Takes a masscan report and
# grabs banners from open services
# using nmap. Then produces a report
# of services. The report is stored
# in CSV format and placed in the
# output directory.
#
# Usage:
# verify_and_report.py [OPTIONS] <scan file> <num concurrent scans> <max packets per second... |
# --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
import os
import torch
import torch.distributed as dist
try:
# noin... |
"""
CC_cycle.py
Functions and outputs for constant-current cycling
Function definitions in this file:
- 'run' runs the model.
- 'calc_current' calculates the external current density (A/m2) from user inputs.
- 'setup_cycles' Creates two python tuples. One lists the sequence of char... |
# Generated by h2py from /usr/include/netinet/in.h
# Included from net/nh.h
# Included from sys/machine.h
LITTLE_ENDIAN = 1234
BIG_ENDIAN = 4321
PDP_ENDIAN = 3412
BYTE_ORDER = BIG_ENDIAN
DEFAULT_GPR = 0xDEADBEEF
MSR_EE = 0x8000
MSR_PR = 0x4000
MSR_FP = 0x2000
MSR_ME = 0x1000
MSR_FE = 0x0800
MSR_FE0 = 0x0800
MSR_SE = ... |
#!/usr/bin/env python3
import os
import sys
import asyncio
from gql import gql, Client, WebsocketsTransport
import requests
from abc import ABC, abstractmethod
from typing import Dict
from pprint import pprint
# NB: this is hackish but seems necessary when downloaded from pypi
main_path = os.path.dirname(os.path.r... |
# -*- coding: utf-8 -*-
# Copyright 2012 Fanficdownloader team, 2020 FanFicFare team
#
# 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
#
# Un... |
##################################################################################
# This work is an extension of LoDE code developed by <NAME>
# (Email: <EMAIL>)
# Author: <NAME>
# Email: <EMAIL>
# Date: 2020/09/03
# Centre for Intelligent Sensing, Queen Mary University of London, UK
#
#########... |
import torch
from torch import nn
from torch.nn import CrossEntropyLoss
from transformers import BertPreTrainedModel
from transformers.modeling_bert import (
BertLayerNorm,
BertEncoder,
BertPooler,
BertPredictionHeadTransform,
)
from losses import SmoothCrossEntropyLoss
from config import HuggingFaceCo... |
"""
This file contains methods which calculate passive membrane properties from
voltage-clamp sweeps. These methods are not optimized for speed or accuracy
and are only provided for backwards compatibility. pyabf is intended to be
used just for reading ABF files, and users are encouraged to write their own
python code ... |
"""
High-level description of the refactoring process
Given some notebook:
```python
# H1 header
# H2 header
x = 1 + 1
# H2 header
y = x + 1
# H3 header
z = x + 1
```
Step 1. Section splitting.
We split it into sections using H2 markdown headers (H1 goes into the first
task), we call this a proto-task:
```pyth... |
import pygame
from SudokuSolver import *
import SudokuSquare
from tkinter import *
from tkinter import messagebox
# colors and consts
grey = (128, 128, 128)
white = (255, 255, 255)
light_green = (0, 200, 0)
black = (0, 0, 0) # 1
yellow = (255, 255, 0) # 2
green = (127, 255, 0) # 3
blue = (0, 0, 255) # 4
pink = (23... |
#!/usr/bin/env python
from bs4 import BeautifulSoup
import codecs
import copy
import csv
from collections import defaultdict, OrderedDict
import copy
import glob
from le_utils.constants import licenses, content_kinds, file_formats
import hashlib
import json
import logging
from moviepy.config import change_settings
fro... |
#!/usr/bin/env python
"""HTTP API logic that ties API call renderers with HTTP routes."""
import json
# pylint: disable=g-bad-import-order,unused-import
from grr.gui import django_lib
# pylint: enable=g-bad-import-order,unused-import
from django import http
from werkzeug import exceptions as werkzeug_exceptions
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import deque
import cv2
import gym
import gym.spaces as spaces
import retro
import numpy as np
import time
import os
import csv
class LazyFrames(object):
def __init__(self, frames):
... |
import math
import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
from .base import BaseController
from .gnn import EdgeGraphSAGE, NoEdgeGraph
from codebase.core.arch_representation.ofa import N_LAYERS_PER_UNIT, N_AVAILABLE_RESOLUTIONS
from codebase.core.dynamic_graph import DynamicGrap... |
import os
import sys
import subprocess
import re
from collections import namedtuple
from fabric.api import run, local, sudo
from fabric.api import task, hide
from fabric.api import quiet
from fabric.api import execute
from fabric.utils import puts
from fabric.api import env, cd
from fabric.context_managers import sett... |
from django.shortcuts import render, redirect, get_object_or_404
from .models import Question, Answer, Reply
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
from django.contrib.au... |
#!/bin/env python3
# -*- coding: utf-8 -*-
#- needed import ----------------------------------------------------
#import $PYTHON_LIB$
import os
import sys
import time
import datetime
import signal
import select
import configparser as ConfigParser
import socket
#import $MOBIGEN_LIB$
import Mobigen.Common.Log_PY3 as Lo... |
"""
Superuser in Sentry works differently than the native Django implementation.
In Sentry a user must achieve the following to be treated as a superuser:
- ``User.is_superuser`` must be True
- If configured, the user must be accessing Sentry from a privileged IP (``SUPERUSER_ALLOWED_IPS``)
- The user must have a val... |
#!/usr/bin/env python
## @file
#
# Run the SP2 algorithm on a Fockian matrix.
#
# @author <NAME> <<EMAIL>>
# @author <NAME> <<EMAIL>>
import argparse
import math
import numpy as np
import re
import sys
from spectral_bounds import *
from matrix_market import *
## Calculate the product complexity.
#
# @param P The ma... |
import os
import numpy as np
import matplotlib.pyplot as plt
import pretty_midi as pm
import mir_eval
import peamt.features.utils as utils
from peamt.features.rhythm import rhythm_histogram, rhythm_dispersion
from peamt.features.utils import get_time, str_to_bar_beat
import warnings
warnings.filterwarnings("ignore")
... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyri... |
# Copyright 2015 Ufora Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
# This is a prototype task designed to follow a parametric equation. It uses
# an optimizer to find the closest "t" to the current location, then computes
# curvature at that point and updates the circle hold parameters to match. So
# in the end it's the circle hold controller that is active, but this module
# is con... |
import os
from turtle import forward
import torch
from torch import nn, tensor
import torch.nn.functional
import numpy as np
from matplotlib import pyplot as plt
import torchvision.transforms as transforms
from PIL import Image
'''
In my Own under standing of the SRM layer, with input chanel 3 and output chanle3, b... |
import copy
import pickle
from random import shuffle
import unittest
from collections import OrderedDict
from collections import MutableMapping
from test import mapping_tests, test_support
class TestOrderedDict(unittest.TestCase):
def test_init(self):
with self.assertRaises(TypeError):
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cloudpickle as pickle
import hashlib
import inspect
import json
import numpy as np
import redis
import traceback
import ray.local_scheduler
import ray.signature as signature
import ray.worker
from ray.u... |
# ==================================================================================================
# Copyright (c) 2021, <NAME> and Yamagishi Laboratory, National Institute of Informatics
# Author: <NAME> (<EMAIL>)
# All rights reserved.
# ==============================================================================... |
# -*- coding: utf-8 -*-
import biosppy
import matplotlib.pyplot as plt
import numpy as np
import neurokit2 as nk
def test_rsp_simulate():
rsp1 = nk.rsp_simulate(duration=20, length=3000, random_state=42)
assert len(rsp1) == 3000
rsp2 = nk.rsp_simulate(duration=20, length=3000, respiratory_rate=80,
... |
"""
A new pure functional language built on the top of Python3.
"""
__version__ = '0.1.3 alpha'
# -*- coding: utf-8 -*-
import ast, re
class DuplicateDeclarationError(Exception):
pass
class CircularReferenceError(Exception):
pass
def __ast_check_tail_recursive__(node, symbol):
# count all references of ... |
# -*- coding: utf-8 -*-
from copy import deepcopy
import numpy as np
from mrinversion.linear_model._base_l1l2 import _get_augmented_data
from mrinversion.linear_model._base_l1l2 import _get_cv_indexes
def test01():
K = np.empty((8, 16))
indexes = _get_cv_indexes(K, 4, "lasso", f_shape=(4, 4))
index_tes... |
#! /usr/bin/env python3
"""
Convert MIT Press XML files for TACL to Anthology XML.
Author: <NAME>
"""
import logging
import shutil
import xml.etree.ElementTree as etree
from pathlib import Path
from typing import List, Optional, Tuple
__version__ = "0.1"
log = logging.getLogger(__name__ if __name__ != "__main__ " e... |
import statistics
import string
import umpy_utils as utl
def is_temp_extreme(max_min_temps, max=70, min=50):
"""Return list of daily temperatures that falls between the specified
< min > and < max > temperature range (inclusive).
Parameters:
max_min_temps (list): daily max and min temperatures
... |
from functools import reduce
from itertools import chain, repeat
import operator
import pytest
import bourbaki.regex.base as bre
from bourbaki.regex import *
@pytest.fixture
def require_fixlen_lookbehinds():
old = bre.REQUIRE_FIX_LEN_LOOKBEHIND
bre.REQUIRE_FIX_LEN_LOOKBEHIND = True
yield True
bre.RE... |
import logging
import torch
import torch.nn as nn
import torch.nn.functional as torch_functional
from collections import OrderedDict
from typing import List, Dict
from dataclasses import field
from sonosco.serialization import serializable
from sonosco.blocks.modules import SubsampleBlock, TDSBlock, Linear, BatchRNN, ... |
#!/usr/bin/env python
"""
Creates a table of mean OH taken from GEOS-Chem "Classic" 1-year
FullChemBenchmark log files.
NOTE: At present, GCHP cannot write mean OH to the log files, and
so this module can only be used with GEOS-Chem "Classic".
"""
# ===================================================================... |
# PyDia SVG Renderer
# Copyright (c) 2003, 2004 <NAME> <<EMAIL>>
#
# A full blown SVG(Z) renderer. As of this writing less bugs in the output
# than the Dia SVG renderer written in C
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... |
from itertools import product
import frappe
import erpnext
from frappe import _
from frappe.utils import cint, comma_or, cstr, flt, format_time, formatdate, getdate, nowdate
from erpnext.stock.get_item_details import (
get_conversion_factor,
get_default_cost_center,
)
from erpnext.stock.utils import (get_incoming_rat... |
# For PyLint users:
# I'll get back to you to the recommeneded command.
r"""This is a WIP, unofficial SDK for accessing
the FamilySearch API.
Currently designed to support Python 3.2+ and 2.6+.
Example usage:
from familysearch import FamilySearch
# Log in with Basic Authentication
fs = FamilySearch('Clien... |
# -*- coding: utf-8 -*-
'''
Catch-up TV & More
Copyright (C) 2017 SylvainCecchetto
This file is part of Catch-up TV & More.
Catch-up TV & More 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 Foundat... |
import copy
import math
import sys
import os
from lxml import etree
import lxml.builder
import gym
import numpy as np
from gym import spaces
from gym import utils
from gym.utils import seeding
from gym.envs.mujoco import mujoco_env
from rl.envs.multi_walker import AbstractMAEnv, Agent, EzPickle
class AntLeg(Agent):... |
from PIL import Image
import requests
from io import BytesIO
import math
import os
import shutil
import datetime
import matplotlib.pyplot as plt
from matplotlib import rc
import cv2
from IPython.display import display
import os
import ktrain
import numpy as np
from .PythiaDemo import PythiaDemo
from google.colab.patche... |
#!/usr/bin/python3
import h5py
import click
import re
import numpy as np
import sys
TEXT_ENCODING = 'utf-8'
def make_rectangular(ll, fill):
maxlength = max([len(l) for l in ll])
for l in ll:
while(len(l) < maxlength):
l.append(fill)
def encode_ll(ll):
nll = []
for l in ll:
... |
from copy import deepcopy
from itertools import product
import numpy as np
import matplotlib.pyplot as plt
from deep_rlsp.envs.gridworlds.env import (
DeterministicEnv,
Direction,
get_grid_representation,
)
class BatteriesState:
"""State of the environment that describes the positions of all objects... |
# -*- coding: utf-8 -*-
"""
apigen
~~~~~~
This is a hacked up and heavily modified copy of sphinx.apidoc, which is
copyright the Sphinx team.
Unfortunately, sphinx.apidoc hardcodes most of its output and has an
opinionated output structure that doesn't match our needs.
We use a similar me... |
from __future__ import annotations
import json
import logging
import re
import sys
from datetime import datetime
from functools import wraps
from typing import TYPE_CHECKING
from urllib.parse import quote, unquote, urlencode, urlparse
from uuid import uuid4
from plop.collector import Collector
from tornado.concurrent... |
import json
import mock
from nose.tools import eq_
from pyquery import PyQuery as pq
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.amo.urlresolvers import reverse
from olympia.addons.models import Addon
from olympia.compat.models import CompatReport, CompatTotals
# This is the structur... |
from absl import app, flags, logging
import pandas as pd
import numpy as np
import scipy.io
import networkx
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric
from torch_geometric.data import DataLoader
from sklearn.model_selection import train_test_split, RepeatedStratifiedKFol... |
# Copyright (c) 2020 ING Bank N.V.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distr... |
# Copyright 2020 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import logging
import os
import pickle
import sys
from pathlib import Path
import click
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import zsampler
from dotenv import load_dotenv, find_dotenv
from src.inference.context_geo import GridContextGeo
from src.inference.hmc i... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-07-05 20:28
import logging
from typing import Union, List, Callable, Dict, Any, Tuple
import torch
from hanlp.layers.transformers.utils import get_optimizers
from alnlp.metrics.conll_coref_scores import ConllCorefScores
from alnlp.metrics.mention_recall import Menti... |
import sys, subprocess
from pathlib import Path
import logging; module_logger = logging.getLogger(__name__)
from .merge import merge_finder
# ======================================================================
class maker:
def __init__(self, subtype, infix, **options):
self.subtype = subtype
s... |
"""
author: <NAME>
created: 11/13/2016
execution.py is concerned with the compilation and execution of C++ and Java files on the fly (the output of the program is returned as a string, but compiled and/or object files are deleted upon completion). Since using VMs would be too slow for our purposes, the code is execute... |
import copy
import functools
import json
import re
import logging
import os.path
import cookies
import py.path
import requests
import responses
import six
_logger = logging.getLogger(__name__)
class InvalidCassetteLocation(Exception):
pass
class RequestBodyDoesntMatchTrack(Exception):
pass
def function... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
# Copyright (c) 2003-2010, Berend-Jan "SkyLined" Wever <<EMAIL>>
# Project homepage: http://code.google.com/p/alpha3/
# All rights reserved. See COPYRIGHT.txt for details.
import charsets, encode, io
import x86, x64, test
import os, re, sys
#______________________________________________________________________... |
###############################################################################
# Copyright (c) 2019, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by the Merlin dev team, listed in the CONTRIBUTORS file.
# <<EMAIL>>
#
# LLNL-CODE-797170
# All rights reser... |
# Copyright 2021 Dynatrace LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
import numpy as np
import random as rnd
import logging
from math import sqrt, floor
from ftsc.cluster_problem import ClusterProblem
logger = logging.getLogger("ftsc")
def aca_symm(cp: ClusterProblem, tolerance=0.05, max_rank=None, start_index=None, seed=None, zero_diagonal=True):
"""
Adaptive Cross Approxim... |
# tagmerge.py - merge .hgtags files
#
# Copyright 2014 <NAME> <<EMAIL>>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
# This module implements an automatic merge algorithm for mercurial's tag files
#
# The tagmerge algorithm imp... |
import yaml
import os
from six import string_types
from nose.tools import *
from scruffy import *
YAML = """
thing: 123
another:
- 666
- 777
- 888
thang:
a: 1
b: 2
c: 3
d: {a: 1, b: 2, c: 3}
derp:
- {a: 1}
- {a: 2}
- {a: 3}
- {a: 4}
"""
# config object
def test_config_object():
d = yaml.load(YAML... |
"""
A version of the code on which we ran SLAM performance test.
"""
import re
import json
import fnmatch
import subprocess
from hashlib import md5
from pathlib import Path
from requests.utils import quote
from sqlalchemy import Column, Boolean, Integer, String, DateTime, JSON, ForeignKey
from sqlalchemy import or_, U... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2019 <NAME>
MIT License
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... |
import os
import math, sys, time, shutil, imageio, copy
import numpy as np
import itertools
from itertools import permutations
from time import perf_counter
import matplotlib.pyplot as plt
def get_rand_loc(box_length, n_dim=2):
"""
Returns a random x/y/z coordinate
"""
x = np.random.rand() * box_length... |
import itertools
import logging
import os
from functools import partial
from multiprocessing.pool import Pool
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas
from PIL import Image
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import normalize
"""
>>... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import timedelta
from odoo import api, fields, models
from odoo.tools.float_utils import float_round, float_is_zero
class ProductTemplate(models.Model):
_inherit = "product.template"
bom_line_ids... |
"""Module provided by <NAME>."""
#%%
from typing import List
import torch
import torch.nn as nn
class CustomLayer(nn.Module):
"""Layer which automatically moves to cuda if available and not specified otherwise."""
def __init__(self, device: str = None, *args, **kwargs) -> None:
super().__init__()
... |
# Copyright 2022 The Scenic 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 in w... |
# Copyright 2018 The TensorFlow Probability 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 o... |
import random
import string
from collections import defaultdict
from datetime import datetime
from flask import current_app, jsonify, request
from itsdangerous import TimedJSONWebSignatureSerializer as JWT
from actor_libs.database.orm import db
from actor_libs.errors import (
AuthFailed, DataNotFound, FormInvalid... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import model.resnet as models
from model.memory import Memory
import model.mobilenet as model_MV2
__all__ = ['DANet', 'PAM_Module', 'CAM_Module']
class PAM_Module(nn.Module):
""" Position attention module"""
# Ref from SAGAN
def __init_... |
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from Plate_detect_and_recognize.local_utils import detect_lp
from os.path import splitext
from keras.models import model_from_json
from sklearn.preprocessing import LabelEncoder
# pip install tensorflow
import tkinter a... |
from argparse import ArgumentParser
from aseprite import extract_frame, extract_images, dump_file
from pathlib import Path
import PIL
import sys
import re
import easygui
from PIL import Image
from typing import Any, List, Tuple, NamedTuple, Optional
def cmd_split(ns: Any) -> int:
input_filenames = ns.input_filena... |
"""
Color utils, including color conversion and color sampling from an image
Author: <NAME>
Email: <EMAIL>
GitHub: https://github.com/ArianOmidi
Date: 2021-06-01
"""
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import numpy as np
import cv2
from collections import Counter
# Ubuntu default ANSI c... |
from thimblesgui.active_collections import ItemMappedColumn, repr_column
from thimbles.contexts import model_spines
import thimbles as tmb
from . import object_creation_dialogs
namec = ItemMappedColumn(
"name",
getter=lambda x: x.name,
setter=lambda x, y: setattr(x, "name", y),
string_converter = lamb... |
#!/usr/bin/env python
#
# Author: <NAME> [tg (at) isi (dot) edu]
# Created: 2020-01-23
import torch
from torch import nn
import torch.nn.functional as F
import abc
#from rtg.registry import CRITERION, register
class Criterion(nn.Module, abc.ABC):
"""Base class for Criterion functions"""
def __init__(self, ... |
from __future__ import print_function
import json
import urllib
from datetime import timedelta, datetime
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.shortcuts import render, redirect
from django.utils import timezone
from django.conf import settings
from pages... |
"""Implements the Satellite extension.
https://github.com/stac-extensions/sat
"""
from datetime import datetime as Datetime
from pystac.summaries import RangeSummary
from typing import Dict, Any, List, Iterable, Generic, Optional, TypeVar, Union, cast
import pystac
from pystac.extensions.base import (
ExtensionM... |
import cupy as cp
import numpy as np
import pytest
from cupyx.scipy.ndimage import fourier_shift
from numpy.testing import assert_almost_equal
from skimage.data import camera, stereo_motorcycle
from skimage.io import imread
from cucim.skimage._shared.fft import fftmodule as fft
from cucim.skimage._shared.testing impor... |
# coding: utf-8
from __future__ import print_function
import os
import logging
from PySide2.QtCore import QSortFilterProxyModel, Qt, QRegExp
from PySide2.QtGui import QIcon, QRegExpValidator, QStandardItemModel
from PySide2.QtWidgets import (
QAction,
QCheckBox,
QComboBox,
QFileDialog,
QFormLayo... |
import numpy as np
import sympy as sp
from functools import singledispatch
import FIAT
from FIAT.polynomial_set import mis, form_matrix_product
import gem
from finat.finiteelementbase import FiniteElementBase
from finat.sympy2gem import sympy2gem
class FiatElement(FiniteElementBase):
"""Base class for finite e... |
import pandas as pd
import numpy as np
import argparse
from pathlib import Path
import json
from sklearn.preprocessing import RobustScaler
from flaml.default import greedy
from flaml.default.regret import load_result, build_regret
regret_bound = 0.01
def config_predictor_tuple(tasks, configs, meta_features, regret_m... |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
import sys
import os
import argparse
import pickle
import subprocess
import platform
import time
from multiprocessing import Pool as ProcessPool
from PIL import Image
from isc.io import write_hdf5_descriptors
import faiss
import tempfile
import num... |
import os
import argparse
import numpy as np
import torch
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
from modules.utils import Piper
from modules.models import DFC_LeNet_5, DFC_RetiNet, Deep_RetiNet
#----------------------------------------|
# AUXILIARY METHODS ... |
# simple model with gain method for separating 2 people speech
import numpy as np
import librosa
from sklearn.model_selection import train_test_split
import os
import scipy.io.wavfile as wavfile
# OPTION
TRAIN = 1
TEST = 0
INVERSE_CHECK = 0
# read the data in time domain and its sample rate
# path1 = '../../data/aud... |
import os
import gpu_utils
gpu_utils.setup_one_gpu()
import tensorflow as tf
from datetime import datetime
from data_reader import DataReader
from data_preprocess import cities
from model import VistaNet
from model_utils import count_parameters
# Parameters
# ==================================================
FLAG... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 et tw=80 :
#
# First crack at a wavelength solution system.
#
# <NAME>
# Created: 2019-02-12
# Last modified: 2019-03-06
#--------------------------------------------------------------------------
#************************************************... |
"""
PyCK Admin Extension
====================
Admin extension that automtically creates CRUD interfaces for all database models
(or a selected list of models)
"""
import os.path
from pyramid.response import Response
from pyramid.httpexceptions import HTTPFound
import pyck
from pyck.forms import model_form
from pyc... |
from typing import Optional, List
from telegram import Message, Update, Bot, User
from telegram import ParseMode, InlineKeyboardMarkup, InlineKeyboardButton
from telegram.error import BadRequest
from telegram.ext import CommandHandler, run_async, Filters
from telegram.utils.helpers import escape_markdown
import emili... |
# -*- coding: utf8 -*-
"""Termshape
Termshape is a minimalistic Python package, that only prints basic
shapes on terminal. It does not have any dependencies.
"""
__author__ = "zvibazak"
__version__ = "1.1.0"
__license__ = "MIT"
DEFAULT_FGCHARACTER = '*'
DEFAULT_BGCHARACTER = ' '
#Importing a module using 'import... |
"""
Windows used with the roster (window displaying the contacts, and the
one showing detailed info on the current selection)
"""
import logging
log = logging.getLogger(__name__)
from datetime import datetime
from . import Win
import common
from config import config
from contact import Contact, Resource
from roster ... |
"""Synchronous Worker node for training.
Written by: <NAME> (zmk5)
"""
import sys
from typing import Dict
import numpy as np
import rclpy
from rclpy.callback_groups import ReentrantCallbackGroup
from rclpy.client import Client
from rclpy.executors import Executor
from rclpy.executors import MultiThreadedExecutor
fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.