text stringlengths 3.07k 22.1k |
|---|
#region imports
from enum import Enum, Flag
from structs import *
from globalvars import *
#endregion
#region Comparing Expressions
def Identical(subA, subB):
"""Compares two expressions to see if they are identical in value.
Arguments:
subA: Sub
subB: Sub
Returns:
bool - true if subA is identical in value... |
#Copyright 2016 <NAME>.
#Distributed under the MIT License. See LICENSE in root of project.
"""
When Kervi starts it scans for installed Kervi platform drivers and loads the GPIO driver.
In your application you access GPIO via:
.. code:: python
import kervi.hal.GPIO as GPIO
#define channel 23 as input
G... |
import numpy as np
from numpy.linalg import svd
from math import log
from scipy.optimize import leastsq
from skcv.multiview.util import normalize_points
def fundamental_matrix_from_two_cameras(camera1, camera2):
""" Computes the fundamental matrix from two projection
matrices
Parameters
----------
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.keras import regularizers, optimizers
from tensorflow.keras.models import Sequential, Model, load_model
from tensorflow.keras.layers import (
Dense,
Conv2D,
B... |
"""
Moire markup extension for Map Machine.
"""
import argparse
from abc import ABC
from pathlib import Path
from typing import Any, Union
from moire.default import Default, DefaultHTML, DefaultMarkdown, DefaultWiki
from moire.moire import Tag
from map_machine.pictogram.icon import ShapeExtractor
from map_machine.ui ... |
import pandas as pd
import os
import matplotlib.pyplot as plt
import numpy as np
dates = [
"2019-01-01",
"2019-02-01",
"2019-03-01",
"2019-04-01",
"2019-05-01",
"2019-06-01",
"2019-07-01",
"2019-08-01",
"2019-09-01",
"2019-10-01",
"2019-11-01",
"2019-12-01",
"2020-01... |
#-- coding:utf-8 --
# python 3.7.1
# NOTE:
# 1. You need to finish function `recognizeCaptcha` yourself, or invalid after several POSTs
# 2. Every N times script pretends to relogin. Using `/%` in vim to find N
# 3. Other settings (like id number, password or something) are edited in `conf.toml`
# 4. Script is friend... |
# -*- coding: utf-8 -*-
"""
Azure Resource Manager (ARM) Container Registry State Module
.. versionadded:: 3.0.0
.. versionchanged:: 4.0.0
:maintainer: <<EMAIL>>
:configuration: This module requires Azure Resource Manager credentials to be passed via acct. Note that the
authentication parameters are case sensiti... |
import math
import random
import pygame
from pygame import mixer
# Intialize the pygame
pygame.init()
# create the screen
screen = pygame.display.set_mode((800, 600))
# Background
background = pygame.image.load('background.png')
# Sound
#mixer.music.load("background.wav")
#mixer.music.play(-1)
# Caption and Icon... |
import logging
import shutil
from pathlib import Path
import cobra.util.array
import numpy as np
import pandas as pd
import pytest
import scipy
from cobra.util.array import create_stoichiometric_matrix
from src.dgf_estimation import calc_model_dgfs_with_prediction_error
from src.fitting import generate_samples, stan_... |
import tensorflow as tf
import argparse, os, sys
sys.path.insert(0, './train-procgen/')
from baselines.common.models import build_impala_cnn, build_conv_ae
import procgen
from procgen import ProcgenEnv
from baselines.common.vec_env import (
VecExtractDictObs,
VecMonitor,
VecNormalize
)
from baselines.commo... |
"""
Parallel model computation and evaluation using the `Gensim package <https://radimrehurek.com/gensim/>`_.
Available evaluation metrics for this module are listed in :data:`~tmtoolkit.topicmod.tm_gensim.AVAILABLE_METRICS`.
See :mod:`tmtoolkit.topicmod.evaluate` for references and implementations of those evaluation... |
from sqlalchemy.sql import func
from . import db, id_column, to_dict, SnapshotMothods
class Owner(db.Model):
"""Storage Account/Owner"""
id = id_column()
name = db.Column(db.String(64), unique=True, nullable=False)
virtual_volume_usage = db.relationship("VirtualVolumeUsage",
... |
from __future__ import print_function
from abc import ABCMeta, abstractproperty, abstractmethod
from enum import Enum
from file_utils import write_out_iterable, find_files, line_separator_generator
from shutil import copyfile
import os
import pickle
import subprocess
import zipfile
try:
import urllib.request as ... |
# Copyright (c) 2021 - present / Neuralmagic, 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 b... |
import argparse
import math
from datetime import datetime
import h5py
import numpy as np
import tensorflow as tf
import socket
import importlib
import os
import sys
import provider
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = BASE_DIR
sys.path.append(BASE_DIR) # model
sys.path.append(os.path.join(RO... |
import subprocess
import sys
import click
from click._compat import term_len
from click.formatting import HelpFormatter, iter_rows, measure_table, wrap_text
from pdm.cli import actions
from pdm.cli.cache import cache_cmd
from pdm.cli.config import config_cmd
from pdm.cli.options import (
dry_run_option,
pass_... |
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "3"
import pandas as pd
import numpy as np
from tqdm import tqdm
import time
import logging
from sklearn.model_selection import StratifiedKFold
from keras_bert import load_trained_model_from_checkpoint, Tokenizer
from keras.optimizers import Adam
import pandas as pd
from s... |
"""
IRIG 106 Data DLL - This module provides an interface to the IRIG 106 data DLL.
The IRIG 106 DLL irig106.dll must be present somewhere in the system where
Windows can find it.
Message data structures are based on the ctypes module. The main implication of
this is that to use data first the data buffer nee... |
"""Tests for API endpoints that performs component analysis."""
import requests
import time
from behave import then, when
from urllib.parse import urljoin
from src.parsing import parse_token_clause
from src.utils import split_comma_separated_list
from src.json_utils import get_value_using_path
from src.authorization... |
####################################################
# Problem 4, chapter 1, Bioinformatics VI finding
# mutations.
# Multiple pattern matching, using suffix tree,
# and Longest Repeat Problem
# Input: ATATCGTTTTATCGTT
# Output: TATCGTT
# ---------------------------------------------
#
# Use t... |
from json import dumps, loads
from django.utils.decorators import method_decorator
from rest_framework import serializers
from django_elasticsearch_dsl_drf.constants import LOOKUP_FILTER_RANGE, LOOKUP_QUERY_IN
from django_elasticsearch_dsl_drf.filter_backends import (
CompoundSearchFilterBackend,
DefaultOrder... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import annotations
from collections import defaultdict
import numpy as np
class Category(object):
'''the basis of evaluation per category id
Attributes:
category_id (int): category id of detected object
n_true (int): the number of g... |
from flask import Flask, request
import sys
import dict_digger
import backoff
import requests
import json
import time
import random
import os
from seldon_core.utils import json_to_seldon_message, extract_request_parts, array_to_grpc_datadef, seldon_message_to_json
from seldon_core.proto import prediction_pb2
import num... |
# MIT License
#
# Copyright (c) 2018-2019 <NAME>
#
# Portions copyright (c) 2018 <NAME>
# (See at https://github.com/RutledgePaulV/sudoku-generator)
#
# 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 S... |
# -*- coding: ISO-8859-1 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2014, HFTools Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------------------... |
"""
Author : <NAME> and <NAME>
Class : HMC CS 158
Date : 2018 Mar 05
Description : Multiclass Classification on Soybean Dataset
This code was adapted from course material by <NAME> (MIT)
"""
# scikit-learn libraries
from sklearn.svm import SVC
from sklearn import metrics
# utilities
# ... |
#!/usr/bin/python
import sys
import time
import pickle
import os
from amr_graph import *
from amr_utils import *
import logger
import argparse
from re_utils import *
from collections import defaultdict
from amr_stats import AMR_stats
def build_bimap(tok2frags):
frag2map = defaultdict(set)
index2frags = defaultd... |
import numpy as np
import pytest
from pandas.testing import assert_frame_equal
import dask
import dask.dataframe
from dask.dataframe.shuffle import shuffle_group
from distributed import Client
import dask_cuda
import dask_cuda.proxify_device_objects
import dask_cuda.proxy_object
from dask_cuda.get_device_memory_objec... |
# by <NAME>
from __future__ import generators
import urllib
import logging
from BTL.DictWithLists import OrderedDict
from BitTorrent.Connector import Connector
from bisect import bisect_right
from urlparse import urlparse
from BitTorrent.HTTPDownloader import parseContentRange
noisy = False
#if noisy:
connection_l... |
from abc import abstractmethod
import numpy as np
import pandas as pd
from mizarlabs.static import EVENT_END_TIME
from mizarlabs.transformers.utils import check_missing_columns
from mizarlabs.transformers.utils import convert_to_timestamp
from numba import jit
from numba import prange
from scipy.stats import norm
from... |
"""Submodule for `Block` objects."""
from ..config import MetadataConfig
from .mixins import Named, Unique, Accessed
from .address import AddressSignalMap
class FieldMapping(Unique):
"""Represents a field mapping within a `Block`."""
def __init__(self, block, field, high, low, offset):
super().__init... |
import numpy as np
import random
import matplotlib.pyplot as plt
import matplotlib.animation as animation
np.set_printoptions(suppress=True)
#Costos asociados al arco <ij> .\Original Graph.png
city = np.array([
(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0),
(1, 0, 2, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,... |
"""
This module contains functions that are used to check whether certain calls
are permitted.
Permissions are based on the roles assigned to the user making the request,
which maps to permissions on resources.
"""
import json
import logging
import typing
from uuid import UUID
from aiohttp.web import Request
from ma... |
"""
A module which simulates the market prices played by the
agents starting from the states of convergence with and
without a deviation.
"""
import json
import pickle
import sys
import numpy as np
from bld.project_paths import project_paths as pp
from bld.project_paths import project_paths_join as ppj
from src.anal... |
"""
Copyright © 2020 Johnson & Johnson
"""
import pytest
import pandas as pd
import numpy as np
from nlprov.preprocessing import preprocess_text
from conftest import sents_chars_expected, sents_nums_expected, \
sents_all_expected
# Creating data for the whitespace removal test
@pytest.fixture
def whitespace_remo... |
# Collection of map plotting functions
import numpy as np
import xarray as xr
import pandas as pd
import cartopy.crs as ccrs
import cartopy.feature as cf
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from cartopy.io import shapereader
from shapely.geometry import LinearRing
def global_map(uib... |
import tensorflow as tf
import numpy as np
import math
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(BASE_DIR, 'utils'))
from utils.pointnet_util import *
from lib.decodeModel import DecodeModel, read_sp_matrix
BN_INIT_DECAY = 0.5
BN_DECAY_DECAY_RATE = 0.5
BN_... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import os
import unittest
try:
from table import *
except:
_src_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
print('src_path', _src_path)
sys.path.append(_src_path)
class TestTable(unittest.TestCase):
def test_insert... |
import numpy
from django.template import Context, Template
from django.utils.safestring import mark_safe
from leslie_probit import leslie_probit_model, leslie_probit_parameters
import logging
import time
import datetime
def getheaderpvu():
headings = ["Parameter", "Value", "Units"]
return headings
def getheaderpva(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
from typing import Dict, List, Tuple, Optional, Generator
import os
from abc import ABC
import subprocess
import simplejson as json
import numpy as np
from sklearn.preprocessing import LabelEncoder
from MeCab import Tagger
from gensim.mode... |
from collections import defaultdict
import os
import requests
from django.contrib.auth.decorators import permission_required
from django.http.response import HttpResponseBadRequest
from django.core.files import File
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render, redirec... |
__author__ = "<NAME>"
__copyright__ = "Copyright 2020"
__version__ = "1.2" # Now opens lists of integers; nextsp() and help() functions added
__email__ = "<EMAIL>"
__status__ = "Prototype"
import glob
import os
import time
print(f'NMR Sample List v.{__version__}')
# Created by <NAME> 2020
# Updated 2020-Jul-07 10:44
... |
import netifaces as _netifaces
import struct as _struct
import random as _random
from re import findall as _findall
from zlib import crc32
import ipaddress as _ipaddress
def chksum16bit(packet):
total = 0
# Add up 16-bit words
num_words = len(packet) // 2
for chunk in _struct.unpack("!%sH" % num_words... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Appier Framework
# Copyright (c) 2008-2016 Hive Solutions Lda.
#
# This file is part of Hive Appier Framework.
#
# Hive Appier Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... |
import os
import urllib.request
import librosa
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchlibrosa.augmentation import SpecAugmentation
from torchlibrosa.stft import Spectrogram, LogmelFilterBank
from rainforest.config import SAMPLE_RATE, N_FFT, ... |
# -- coding: utf-8 --
import cfapi
import dateutil.parser
import json
import logging
import urllib
from . import brigade as app
from datetime import datetime
from flask import render_template, request, redirect, url_for
from flask.helpers import safe_join
from operator import itemgetter
from requests import get
# Logg... |
#!/usr/bin/env python3
"""
Handles interactive prompts, part of the Old Spice Voicemail Generator.
Each function prompts the user for a different piece of information.
Functions: gender, phone, reason, ending, filename, show_settings, confirm
"""
import sys
__author__ = '<NAME>'
__copyright__ = "Copyright 2015, <N... |
# -*- coding: utf-8 -*-
from beemgraphenebase.py23 import py23_bytes, bytes_types
import ecdsa
import hashlib
from binascii import hexlify, unhexlify
from collections import OrderedDict
from asn1crypto.core import OctetString
import struct
from collections import OrderedDict
import json
from .py23 import py23_bytes, b... |
"""
scaling.py
A collection of functions used to manipulate and analyze IGS data primarily
with respect to their scaling properties (e.g. genomic vs. spatial distance).
"""
import warnings
import numpy as np
import source.const as const
import matplotlib.pyplot as plt
from scipy.spatial import distance
from scipy.st... |
import asyncio
import discord
import string
import os
import re
from prettytable import PrettyTable
from datetime import datetime
from discord.ext import commands
from Cogs import Settings
from Cogs import Message
from Cogs import Nullify
from Cogs import PCPP
from beem import Steem
from beem.account import... |
import numpy as np
import pylab as pl
def dot_prod(x,y):
# the lenght of arrays must be same.
assert(len(x) == len(y))
# get corresponding values from x and y
# for v in zip(x,y)
# find their product and put the result in a list, list comprehension.
# sum over the list
return np.sum([v[0]*... |
import torch
import torch.nn as nn
"""
@article{vandeven2019three,
title={Three scenarios for continual learning},
author={<NAME>, <NAME> and <NAME>},
journal={arXiv preprint arXiv:1904.07734},
year={2019}
}
@article{vandeven2018generative,
title={Generative replay with feedback connections as a general str... |
# -*- coding: utf-8 -*-
#Created on Fri Apr 27 12:37:56 2018
#@author: ryanday
#MIT License
#Copyright (c) 2018 <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 restri... |
#!python
import string
import math
# Hint: Use these string constants to encode/decode hexadecimal digits and more
# string.digits is '0123456789'
# string.hexdigits is '0123456789abcdefABCDEF'
# string.ascii_lowercase is 'abcdefghijklmnopqrstuvwxyz'
# string.ascii_uppercase is 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# string.as... |
from datetime import datetime, timedelta
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
from django.utils.timezone import utc, localtime
# Transactions prior to 1901 are ignored
MIN_DATE = datetime(1901, 1, 1).replace(tzinfo=timezone.utc)
class Currency(mod... |
import numpy as np
import matplotlib.pyplot as plt
import time
import h5py
from ..doublyPeriodic import doublyPeriodicModel
from numpy import pi
class model(doublyPeriodicModel):
def __init__(self, name = None,
# Grid parameters
nx = 128, ny = None, Lx = 2.0*pi, Ly = None,
# ... |
import types
from collections import defaultdict
from copy import deepcopy
from datetime import datetime
from typing import Callable, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import prospr.utils as utils
__all__ = ["prune"]
def functional_sgd(
params: List[torch.... |
import os
from argparse import Namespace
import collections
import copy
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import re
import torch
import urllib
from collections import Counter
import string
from torch.utils.data import Dataset, DataLoader
import torch.nn as nn
import tor... |
#!/usr/bin/python3
# ====== Parameters ======
user_name = 'admin'
user_password = '<PASSWORD>'
# ====================================================================
# write logs to log files (False/True)
write_logs = True
path_to_media_archive = 'media/'
base_path_to_log_file = 'media/'
MAX_BYTES_LOG_FILE_SIZE = 10... |
#
# 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 "License"); you may not us... |
"""MCMC diagnostics."""
import jax
import jax.numpy as jnp
import numpy as np
from scipy.fftpack import next_fast_len # type: ignore
from blackjax.types import Array
__all__ = ["potential_scale_reduction", "effective_sample_size"]
def potential_scale_reduction(
input_array: Array, chain_axis: int = 0, sample_a... |
"""This script generates a HTML file with a table containing information about the
composition and lineage of each sample.
"""
import re
import sys
from itertools import takewhile
sys.stderr = open(snakemake.log[0], "w")
import subprocess
from collections import defaultdict
from pathlib import Path
from typing import ... |
#!/usr/bin/env python
"""
--------------------------------------------------------------------
gictools.efield
Tools for handling geoelectric field modelling.
Created 2020-2021 by <NAME>, ZAMG Conrad Observatory (Vienna).
Some functions taken or adapted from <NAME> (USGS):
https://github.com/greglucas/bezpy/blob/mas... |
from itertools import filterfalse
from typing import Optional, Union
from nbmanips.cell import Cell
from nbmanips.utils import partial
class Selector:
default_selectors = {}
def __init__(self, selector, *args, **kwargs):
self._selector = self._get_selector(selector, *args, **kwargs)
def iter_ce... |
# Copyright (C) 2020 <NAME>.
# All rights reserved.
"""
Heroku manager for your userbot
"""
import math
import os
import aiohttp
import heroku3
from userbot import BOTLOG, BOTLOG_CHATID, CMD_HELP, HEROKU_API_KEY, HEROKU_APP_NAME
from userbot.events import register
heroku_api = "https://api.heroku.com"
if HEROKU_... |
from gzip import READ
import os
import pygame
import pygame.sprite as sprite
import space_invaders.Entities as Entities
def load_asset(asset):
return os.path.join('space_invaders', 'assets', asset)
# colors
WHITE = (255, 255, 255)
LIGHT_GRAY = (150, 150, 150)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLACK = (0, 0,... |
from __future__ import division
import re
from collections import Counter
import math
import heapq
import sys
from collections import OrderedDict
from hanziconv import HanziConv
CH_PUNCTUATION = u"[',\\\\n!#$%&\'()*+-/:;<=>.?@[\\]^_`{|}~'"#$%&',:;@[\]^_`{|}~⦅⦆「」、 、〃〈〉《》「」『』【】〔〕〖〗〘〙〚〛〜〝〞〟〰〾〿–—‘’‛“”„‟…‧﹏﹑﹔·!?。。]"
# EN_P... |
""" Exemplu de cod pentru tema 1.
"""
import matplotlib.pyplot as plt
import numpy as np
import gym
import time
from constants import Constants
from state import State
import random
import math
import gym_minigrid
def ucb(q, state, actions, N, constants):
max_action = None
max_value = float('-inf')
logN... |
from io import StringIO
from OpenGL.GL import *
import gl
import gx
MATRIX_INDEX_ATTRIBUTE_LOCATION = 0
POSITION_ATTRIBUTE_LOCATION = 1
NORMAL_ATTRIBUTE_LOCATION = 2
BINORMAL_ATTRIBUTE_LOCATION = 3
TANGENT_ATTRIBUTE_LOCATION = 4
COLOR_ATTRIBUTE_LOCATION = 5
TEXCOORD_ATTRIBUTE_LOCATIONS = [6,7,8,9,10,11,12,13]
ATTRIB... |
import sys as _sys
import warnings
from functools import partial
from scipy import sparse
from sklearn.utils.metaestimators import available_if
from sklearn.utils.validation import (
_make_indexable,
_num_features,
)
import numpy as np
from typing import Dict, Any
from . import __version__
try:
import pand... |
#!/usr/bin/env python3
# Copyright (C) Alibaba Group Holding Limited.
"""
Miscellaneous.
Modifed from https://github.com/facebookresearch/SlowFast/blob/master/slowfast/utils/misc.py.
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""
import json
import logging
import math
import numpy as np
im... |
import sys
import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
import pickle
import pylab
import torch
from PIL import Image
from sklearn.metrics import roc_curve, auc
from torch.nn import DataParallel
from torch.utils.data import DataLoader
from torchvision.transforms import transforms
sys.path... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os,sys,sqlite3,traceback
largv = []
g_dbpath = None
k_vt_col_map = { '':'\x1b[0m', 'default':'\x1b[0m', 'black':'\x1b[30m', 'red':'\x1b[31m', 'green':'\x1b[32m', 'yellow':'\x1b[33m',
'blue':'\x1b[34m', 'magenta':'\x1b[35m', 'cyan':'\x1b[36m', 'white':'\x1b[37m',
... |
# Base class for all 'Slicer' objects.
#
import inspect
from io import StringIO
import json
import warnings
import numpy as np
import numpy.ma as ma
from rubin_sim.maf.utils import getDateVersion
from six import with_metaclass
__all__ = ['SlicerRegistry', 'BaseSlicer']
class SlicerRegistry(type):
"""
Meta cla... |
import collections
import logging
import multiprocessing
import time
from abc import abstractmethod
from dataclasses import dataclass
from pathlib import Path
from queue import Queue
from random import choices
from typing import Dict, List, Union, OrderedDict, Optional
import numpy as np
from fltk.util.config.definit... |
# -*- coding: utf-8 -*-
from dateutil.tz import tzlocal
from django.template import Library
from django.db.models import Q
from django.utils.safestring import mark_safe
from django.utils.text import normalize_newlines
# from autenticar.models import Gauser_extra, Permiso
from autenticar.models import Permiso
from cale... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# coding: utf-8
#
# Copyright 2021 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
#!/usr/bin/env python
"""
Abstract Base Class for Estimating Synthesizer Parameters using TensorFlow.
Wraps TensorFlow library calls and provides functionality for training and making
synthesizer parameter predictions. Inheriting classes must implement the ``build_model()``
method, which is automatically called upon c... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import mbuild as mb
import builtins as __builtin__
import numpy as np
from foyer import Forcefield
#All the old import from compound
import collections
from collections import OrderedDict, defaultdict
from copy import deepcopy
import itertool... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 16 17:16:56 2018
@author: SaintlyVi
"""
import os
import pandas as pd
import numpy as np
from sklearn.cluster import MiniBatchKMeans
from sklearn.metrics import silhouette_score
from sklearn.preprocessing import normalize
import f... |
"""Defines an enumeration factor"""
import functools
from dataclasses import dataclass
from typing import List, Mapping, Sequence, Tuple, Union
import jax
import jax.numpy as jnp
import numba as nb
import numpy as np
from pgmax.utils import NEG_INF
from . import factor
@jax.tree_util.register_pytree_node_class
@d... |
# compatibility with Python 2.6, for that we need unittest2 package,
# which is not available on 3.3 or 3.4
try:
import unittest2 as unittest
except ImportError:
import unittest
from .der import remove_integer, UnexpectedDER, read_length, encode_bitstring,\
remove_bitstring
from six import b
import pyt... |
import numpy as np
import pandas as pd
from tqdm import tqdm
tqdm.pandas()
from keras.models import Model
from keras.layers import Input, Dense, Embedding, SpatialDropout1D, Dropout, add, concatenate
from keras.layers import CuDNNLSTM, Bidirectional, GlobalMaxPooling1D, GlobalAveragePooling1D
from keras.optimizers imp... |
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.conf import settings
from django.db import connection
import datetime
import logging
from optparse import make_option
import os
import shutil
import xlrd
import yaml
from collections import Ord... |
"""
This code is inspired by https://github.com/nikhilbarhate99/PPO-PyTorch
"""
import torch
import torch.nn as nn
from torch.distributions import MultivariateNormal
import torch.nn.functional as F
import numpy as np
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
def init_weights(m, gain):... |
import xml.etree.ElementTree as ET
import py7zr
import json
import os
import glob
import re
import argparse
from pathlib import Path
from bs4 import BeautifulSoup
from multiprocessing import Pool, cpu_count
from tqdm import tqdm
XML_SUFFIX = '<?xml version="1.0" encoding="utf-8"?>\n<posts>\n'
XML_PREFIX = '\n</posts>'... |
from classes import Map
import os
import numpy as np
from pprint import pprint
from simulation import get_p_moves, draw_lognormal
# Parameters calibrated for transitions
pdict_trans = {'n_moves_per_period': 3,
'avg_p_move': 0.0028464294165809713,
'dscale': 1,
'density_factor': 6.90075775185... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 9 09:54:50 2019
@author: <NAME>
"""
import keras
from keras.models import Model
from keras.layers import *
from keras.activations import *
from keras.layers.advanced_activations import LeakyReLU
from keras.utils import plot_model
import matplotlib.pyplot a... |
# Copyright 2015 The Switch Authors. All rights reserved.
# Licensed under the Apache License, Version 2, which is in the LICENSE file.
"""
Defines model components to describe generation projects build-outs for
the SWITCH-Pyomo model. This module requires either project.unitcommit or
project.no_commit to constrain p... |
""" Project initialization and common objects. """
import logging
import os
from pathlib import Path
import re
import sys
import pickle
from sklearn.externals import joblib
import numpy as np
logging.basicConfig(
stream=sys.stdout,
format='[%(levelname)s][%(module)s] %(message)s',
level=os.getenv('LOGLEVE... |
from mp.core.error import ConstError, NotDataError, RequiredError, TooMuchOrLessArguments
from mp.core.error import TypeError as _TypeError
from mp.core.event import Event
from mp.core.expression import Expression as Exp
class Attr:
def __init__(self, name: str, toward=None):
self.name = name
self... |
import matplotlib.pyplot as plt
import numpy as np
from multicell.multicell_constants import VALID_EXOSOME_STRINGS, EXOSTRING
from singlecell.singlecell_functions import state_subsample, state_only_on, state_only_off
def lattice_square_loc_to_int(loc, sidelength):
# maps a two-tuple, for the location of a cell o... |
import argparse
import re
import string
import pyspark.sql.functions as F
from pyspark.sql import Row, SparkSession
from pygtrie import StringTrie
PUNCT = "".join(x for x in string.punctuation if x not in "[]")
TARGET_QUOTE_TOKEN = "[TARGET_QUOTE]"
QUOTE_TOKEN = "[QUOTE]"
MASK_TOKEN = "[MASK]"
BLACK_LIST = {"preside... |
from tkinter import *
from tkinter import filedialog
from PIL import Image, ImageTk, ImageOps, ImageEnhance
import matplotlib.pyplot as plt
import os
from tkinter import messagebox
pic = ''
img_alterada = ''
'''FUNÇÕES DOS BOTÕES'''
# PROCURAR IMAGEM NO DIRETÓRIO
def browse_img():
global pic
file_path = fi... |
'''
all file downloading and channels extracting is done here
'''
# external imports
import sys, os
import requests
import xbmc, xbmcplugin, xbmcaddon, xbmcgui
from bs4 import BeautifulSoup
from flixtor.javascript import translate, getKey
# addon variables
__addon__ = xbmcaddon.Addon()
__addonname__ = __addon__.getAdd... |
import os, os.path as osp
import json
import time
import argparse
import numpy as np
from torchvision import transforms
import torch
import torch.nn.functional as F
import shutil
import torchvision
import dnnlib
import pickle
from tqdm import tqdm
import PIL.Image
from glob import glob
import torch.distributed
from tr... |
# Python Standard Library Imports
import json
# Third Party (PyPI) Imports
import requests
import rollbar
# HTK Imports
from htk.lib.redfin.constants import *
from htk.utils.urls import build_url_with_query_params
class RedfinAPI(object):
def __init__(self):
pass
def _get_api_request(self, endpoint... |
from amuse.support.interface import InCodeComponentImplementation
from amuse.test.amusetest import TestWithMPI
from amuse.test import compile_tools
import os
import time
import shlex
from amuse.units import nbody_system
from amuse.units import units
from amuse import datamodel
from amuse.rfi import channel
from amuse... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.