/.../
: Start and end regex delimiters|
: Alternation()
: Grouping
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 torch | |
print(torch.cuda.current_device()) #to check current device id | |
print(torch.cuda.device_count()) #to check number of devices | |
print(torch.cuda.get_device_name(0)) #to find device name |
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 datetime | |
import logging | |
import os | |
import re | |
import constants | |
log_separator = "\n====================================================================================================" | |
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 | |
from pandas import DataFrame | |
# Prints a single line, It's same as println() in other languages, by default print single empty line or "\n" | |
printline = lambda times=1 : print("\n" * times) | |
# function that counts NaN values for whole dataframe | |
__checkAllNaNs = lambda dataframe: dataframe.isnull().sum() |
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 | |
def test_patterns(text, patterns): | |
"""Given source text and a list of patterns, look for | |
matches for each pattern within the text and print | |
them to stdout. | |
""" | |
# Look for each pattern in the text and print the results | |
for pattern, desc in patterns: |
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
# not 6 + 5 **(3//2) - 5 > 5 | |
# (6 * 3 > 5) and ((6//3) + 5 - 9 * 2 **3 < 56) | |
# ((6//3) + 5 - 9 * 2 **3 > 56) or 18 * 2 + 9//2 *(4-5) > 56 |