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 re | |
import typing | |
from time import time | |
names = ['Biotechnologia', 'Kynologia', 'Zootechnika', 'Architektura i Urbanistyka', 'Budownictwo', | |
'Budownictwo - Inżynier Europejski', 'Inżynieria Środowiska', 'Projektowanie Architektury Wnętrz i Otoczenia', | |
'Ekonomia', 'Zarządzanie', 'Automatyka i Robotyka', 'Elektrotechnika', 'Teleinformatyka', 'Informatyka', | |
'Energetyka', 'Inżynieria Produkcji w Przemyśle 4.0', 'Mechanika i Budowa Maszyn', 'Mechatronika', | |
'Zarządzanie i Inżynieria Produkcji', 'Architektura Krajobrazu', 'Ochrona Środowiska', | |
'Odnawialne Źródła Energii', 'Rolnictwo', 'Mikrobiologia', 'Ichtiologia i Akwakultura', |
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 collections | |
import typing | |
from django.conf import settings | |
from django.db.models import ProtectedError | |
from django.db.models import RestrictedError | |
from rest_framework.response import Response | |
from rest_framework.views import exception_handler | |
from rollbar.contrib.django_rest_framework import post_exception_handler |
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 random | |
import time | |
def if1(value): | |
if value == 0: | |
return 0 | |
if value == 1: | |
return 1 | |
if value == 2: |
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 boto3 | |
from botocore.client import Config | |
sts_client = boto3.client('sts') | |
assumed_role_object = sts_client.assume_role( | |
RoleArn="arn:aws:iam::111111111111:role/Administrator", | |
RoleSessionName="testing-assume-role", | |
) | |
credentials = assumed_role_object['Credentials'] |
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 os | |
import tempfile | |
class Fifo: | |
def __init__(self, name=None, delete=True): | |
self.delete = delete | |
self.name = name if name else tempfile.mktemp() | |
os.mkfifo(self.name) | |
self._file = None |
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 requests | |
def check_wheel(package: str, version: str) -> bool: | |
response = requests.get(f'https://pypi.org/pypi/{package}/json') | |
for release in response.json()['releases'][version]: | |
if release['packagetype'] == 'bdist_wheel': | |
return True | |
return False |
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 return_exceptions(*exception: Exception): | |
def decorator(function): | |
def wrapper(*args, **kwargs): | |
try: | |
return function(*args, **kwargs) | |
except exception as e: | |
return e | |
return wrapper |
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 collections | |
import csv | |
import random | |
Reaction = collections.namedtuple('Reaction', ('reaction_rate', 'reaction')) | |
def get_probability_of_reaction(reaction: Reaction, substrates: dict) -> float: | |
probability = reaction.reaction_rate | |
for element_name, element_value in reaction.reaction.items(): |
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 smith_waterman(seq1, seq2): | |
"""Algorym podobny do algorytmu Smitha-Watermana dla naszych celów | |
:rtype : float | |
:return: wynik porównania dwóch sekwencji binarnych rozszerzonych o tolerancję (podobieństwo w %) | |
:param seq1: sekawencja binarna z dodaną tolerancją | |
:param seq2: sekwencja binarna z dodaną tolerancją | |
""" | |
m = len(seq1) | |
n = len(seq2) |