This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity 0.6.12; | |
pragma experimental ABIEncoderV2; | |
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; | |
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; | |
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | |
import "./external/compound/Comptroller.sol"; | |
import "./external/compound/PriceOracle.sol"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from types import ModuleType, FunctionType | |
from gc import get_referents | |
# Custom objects know their class. | |
# Function objects seem to know way too much, including modules. | |
# Exclude modules as well. | |
BLACKLIST = type, ModuleType, FunctionType | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fbprophet import Prophet | |
import io | |
import requests | |
url = "https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv" | |
s = requests.get(url).content | |
df = pandas.read_csv(io.StringIO(s.decode('utf-8'))) | |
m = Prophet() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is particularly useful when using sphinx autodoc, when you have functions that share the same functionality | |
(say a cli command that wraps a function) and you don't want to rewrite the docstrings for each of them. | |
""" | |
def register_docstrings(parent=None): | |
def doc_decorator(func): | |
func.__doc__ = parent.__doc__ + func.__doc__ | |
return func | |
return doc_decorator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
class Perceptron(object): | |
def __init__(self, train, labels, learning_rate, iterations): | |
self.train = train | |
self.labels = labels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_separate_lists(fasta_file): | |
""" | |
Creates 2 lists from a fasta file | |
:param fasta_file: file | |
:return: one list for the IDs in the file and one list for the proteins/peptides in it | |
""" | |
with open(fasta_file) as infile: | |
all_list = [] | |
peptide = "" | |
lines = infile.readlines() |