index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
39,473 | bosefalk/WFB-simulation | refs/heads/master | /flask_main.py | from flask import render_template, request, Flask, send_file
app = Flask(__name__)
app.config.from_object('config')
from forms import UnitForm
from unit_class import Unit
from wfb_simulation import wfb_simulation
from read_csv import win_percent
@app.route('/', methods=['GET', 'POST'])
@app.route('/index', methods=[... | {"/wfb_simulation.py": ["/unit_class.py", "/cc_round.py"], "/cc_round.py": ["/roll_dice.py", "/compare_characteristics.py"], "/unit_test.py": ["/roll_dice.py", "/compare_characteristics.py"], "/run.py": ["/unit_class.py", "/wfb_simulation.py"], "/flask_main.py": ["/forms.py", "/unit_class.py", "/wfb_simulation.py", "/r... |
39,474 | bosefalk/WFB-simulation | refs/heads/master | /sandbox.py | from unit_class import Unit
from wfb_simulation import *
#cont = cc_round(orc, dwarf)
#print(cont)
orc = Unit(name="Orc", models=20, WS=3, S=4, T=2, I=2, Sv=6, Ld=7)
dwarf = Unit(name="Dwarf", models=20, WS=3, S=3, T=2, I=2, Sv=4, Ld=8)
wfb_simulation(orc, dwarf, 10000) | {"/wfb_simulation.py": ["/unit_class.py", "/cc_round.py"], "/cc_round.py": ["/roll_dice.py", "/compare_characteristics.py"], "/unit_test.py": ["/roll_dice.py", "/compare_characteristics.py"], "/run.py": ["/unit_class.py", "/wfb_simulation.py"], "/flask_main.py": ["/forms.py", "/unit_class.py", "/wfb_simulation.py", "/r... |
39,475 | bosefalk/WFB-simulation | refs/heads/master | /forms.py | from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField, BooleanField
from wtforms.validators import DataRequired
class UnitForm(FlaskForm):
name1 = StringField('name1', validators = [DataRequired()])
models1 = IntegerField('models1', validators = [DataRequired()])
WS1 = IntegerField(... | {"/wfb_simulation.py": ["/unit_class.py", "/cc_round.py"], "/cc_round.py": ["/roll_dice.py", "/compare_characteristics.py"], "/unit_test.py": ["/roll_dice.py", "/compare_characteristics.py"], "/run.py": ["/unit_class.py", "/wfb_simulation.py"], "/flask_main.py": ["/forms.py", "/unit_class.py", "/wfb_simulation.py", "/r... |
39,476 | bosefalk/WFB-simulation | refs/heads/master | /roll_dice.py | # Library import
import random
# Given the number of rolls and the value to roll equal to or above (i.e. 4+), returns number of successes
def roll_dice(n_rolls, success_plus):
# Create empty list
roll_results = []
# Roll n_roll dice
for i in range(0, n_rolls):
# Add roll result to list
... | {"/wfb_simulation.py": ["/unit_class.py", "/cc_round.py"], "/cc_round.py": ["/roll_dice.py", "/compare_characteristics.py"], "/unit_test.py": ["/roll_dice.py", "/compare_characteristics.py"], "/run.py": ["/unit_class.py", "/wfb_simulation.py"], "/flask_main.py": ["/forms.py", "/unit_class.py", "/wfb_simulation.py", "/r... |
39,495 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /build_idc_dataset.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 19 20:29:51 2021
@author: femiogundare
"""
# Import the required libraries
import os
from os import listdir
import json
import cv2
import pickle
import progressbar
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.model_se... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,496 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/preprocessing/normal_aug.py | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 25 23:30:50 2021
@author: femiogundare
"""
import albumentations as A
normal_aug = A.Compose([
A.RandomRotate90(p=0.7),
A.OneOf([
A.HorizontalFlip(p=1),
A.VerticalFlip(p=1)]
)
]) | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,497 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/build/build_dataset.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 19 21:13:16 2021
@author: femiogundare
"""
def extract_coords(df):
"""
Returns the coordinates (x, y) where each patch is found in the whole mount sample.
Args:
df: dataframe
"""
coord = df.path.str.rsplit("_", n=4, expand=True)
... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,498 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /predict.py | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 22:17:08 2021
@author: femiogundare
"""
# Import the required packages
import matplotlib
#matplotlib.use('Agg')
from matplotlib import pyplot as plt
import os
import h5py
import progressbar
import json
import numpy as np
import pandas as pd
from imutils import paths
... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,499 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /ensemble.py | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 20 00:27:33 2021
@author: femiogundare
"""
import os
import json
import itertools
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn.metrics import roc_auc_score, roc_curve, confusion_matrix
from utilities.othe... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,500 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/metrics/metrics_for_scoring.py | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 5 21:35:47 2021
@author: femiogundare
"""
# Performance metrics
import numpy as np
from sklearn.metrics import confusion_matrix, roc_curve, roc_auc_score
"""
def optimal_threshold(y_true, y_prob):
# Returns the optimal threshold based on the false positive rate, tr... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,501 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/nn/neural_network.py | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 5 21:03:04 2021
@author: femiogundare
"""
import efficientnet.tfkeras as efn
from tensorflow.keras import backend as K
from tensorflow.keras.applications import ResNet50, DenseNet121
from tensorflow.keras.models import Model
from tensorflow.keras.regularizers import l2
... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,502 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/preprocessing/stain_normalization.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 19 21:52:54 2021
@author: femiogundare
"""
import numpy as np
class StainNormalization:
"""
Adopted and modified from "Classification of breast cancer histology images using Convolutional Neural Networks",
Teresa Araújo , Guilherme Aresta, Eduardo Castro, ... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,503 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/preprocessing/hematoxylin_eosin_aug.py | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 20 01:51:20 2021
@author: femiogundare
"""
import numpy as np
def hematoxylin_eosin_aug(img, low=0.7, high=1.3, seed=None):
"""
"Quantification of histochemical staining by color deconvolution"
Arnout C. Ruifrok, Ph.D. and Dennis A. Johnston, Ph.D.
htt... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,504 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /train_model.py | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 18:34:39 2021
@author: femiogundare
"""
# Import the required libraries and packages
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import warnings
warnings.filterwarnings('ignore')
import os
import sys
import h5py
import json
import n... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,505 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/callbacks/poly_decay.py | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 20:03:24 2021
@author: femiogundare
"""
from config import idc_config as config
configs = config.Config()
configs_dict = configs.get_config()
NUM_EPOCHS = configs_dict['n_epochs']
INIT_LR = configs_dict['max_lr']
def poly_decay(epoch):
"""Polynomial Learning Ra... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,506 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /config/idc_config.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 19 20:06:04 2021
@author: femiogundare
"""
import sys
import argparse
class Config:
"""Config
Attributes:
parser: to read all config
args: argument from argument parser
config: save config in pairs like key:value
"""
def __init__... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,507 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/preprocessing/meanpreprocessor.py | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 30 22:30:36 2020
@author: femiogundare
"""
import cv2
class MeanPreprocessor:
def __init__(self, rMean, gMean, bMean):
#store the R, G, B means across the training set
self.rMean = rMean
self.gMean = gMean
self.bMean = bMean
... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,508 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/io/hdf5datasetgenerator.py | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 28 10:40:06 2020
@author: femiogundare
"""
import h5py
import numpy as np
from tensorflow.keras.utils import to_categorical
class HDF5DatasetGenerator:
def __init__(self, dbPath, batchSize, preprocessors=None, aug=None, binarize=True, n_classes=2):
#store t... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,509 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/preprocessing/zoom_aug.py | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 20 01:53:05 2021
@author: femiogundare
"""
import numpy as np
import cv2
def zoom_aug(img, zoom_var=1.5, seed=None):
"""Performs a random spatial zoom of a Numpy image array.
# Arguments
img: Numpy image array.
zoom_var: zoom range multiplier f... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,510 | femiogundare/invasive-ductal-carcinoma-diagnosis | refs/heads/main | /utilities/metrics/metrics_for_compiling.py | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 5 21:31:40 2021
@author: femiogundare
"""
from tensorflow.keras import backend as K
def sensitivity(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
return true_positi... | {"/build_idc_dataset.py": ["/utilities/build/build_dataset.py"], "/predict.py": ["/utilities/preprocessing/stain_normalization.py", "/utilities/preprocessing/meanpreprocessor.py", "/utilities/preprocessing/hematoxylin_eosin_aug.py", "/utilities/preprocessing/zoom_aug.py", "/utilities/preprocessing/normal_aug.py", "/uti... |
39,512 | blavad/soccer | refs/heads/master | /soccer/discrete_soccer/discrete_soccer_env.py | """
Discret soccer game.
"""
import soccer
import math
import os
import gym
from gym import spaces, logger
from gym.utils import seeding
import numpy as np
import cv2
from soccer.core import Team1, Team2
class DiscreteSoccerEnv(gym.Env):
"""
Description:
Soccer game.
Observation:
Type: Dis... | {"/soccer/discrete_soccer/discrete_soccer_env.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/continuous_soccer/continuous_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/base_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/__init__.py": ["/soccer/base_soccer.py", "/soccer/di... |
39,513 | blavad/soccer | refs/heads/master | /soccer/core.py |
class Team(object):
def __init__(self, nb_players=1):
self.player = [Player(self) for i in range(nb_players)]
def __len__(self):
return len(self.player)
def init_config(self, w, h, size_pl=20, type_config="discrete"):
for i, pl in enumerate(self.player):
... | {"/soccer/discrete_soccer/discrete_soccer_env.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/continuous_soccer/continuous_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/base_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/__init__.py": ["/soccer/base_soccer.py", "/soccer/di... |
39,514 | blavad/soccer | refs/heads/master | /soccer/continuous_soccer/continuous_soccer.py | """
Discret soccer game.
"""
import os
import cv2
import math
import numpy as np
import gym
from gym import spaces, logger
from gym.utils import seeding
import soccer
from soccer import BaseSoccerEnv
from soccer.core import Team1, Team2
class ContinuousSoccerEnv(BaseSoccerEnv):
"""
Description:
Cont... | {"/soccer/discrete_soccer/discrete_soccer_env.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/continuous_soccer/continuous_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/base_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/__init__.py": ["/soccer/base_soccer.py", "/soccer/di... |
39,515 | blavad/soccer | refs/heads/master | /soccer/base_soccer.py | """
Base class of soccer games.
"""
import os
import cv2
import math
import numpy as np
import gym
from gym import spaces, logger
from gym.utils import seeding
import soccer
from soccer.core import Team1, Team2
class BaseSoccerEnv(gym.Env):
def __init__(self, width=300, height=200, height_goal=None, nb_pl_tea... | {"/soccer/discrete_soccer/discrete_soccer_env.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/continuous_soccer/continuous_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/base_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/__init__.py": ["/soccer/base_soccer.py", "/soccer/di... |
39,516 | blavad/soccer | refs/heads/master | /setup.py | #!/usr/bin/env python
import imp
from setuptools import setup, find_packages
setup(
name='soccer',
version='0.1.0',
packages=find_packages(),
install_requires=['pyglet', 'gym'],
)
| {"/soccer/discrete_soccer/discrete_soccer_env.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/continuous_soccer/continuous_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/base_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/__init__.py": ["/soccer/base_soccer.py", "/soccer/di... |
39,517 | blavad/soccer | refs/heads/master | /soccer/__init__.py | from soccer.base_soccer import BaseSoccerEnv
from soccer.discrete_soccer import DiscreteSoccerEnv
from soccer.continuous_soccer import ContinuousSoccerEnv
| {"/soccer/discrete_soccer/discrete_soccer_env.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/continuous_soccer/continuous_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/base_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/__init__.py": ["/soccer/base_soccer.py", "/soccer/di... |
39,518 | blavad/soccer | refs/heads/master | /soccer/discrete_soccer/__init__.py | from soccer.discrete_soccer.discrete_soccer_env import DiscreteSoccerEnv | {"/soccer/discrete_soccer/discrete_soccer_env.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/continuous_soccer/continuous_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/base_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/__init__.py": ["/soccer/base_soccer.py", "/soccer/di... |
39,519 | blavad/soccer | refs/heads/master | /soccer/continuous_soccer/__init__.py | from soccer.continuous_soccer.continuous_soccer import ContinuousSoccerEnv
| {"/soccer/discrete_soccer/discrete_soccer_env.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/continuous_soccer/continuous_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/base_soccer.py": ["/soccer/__init__.py", "/soccer/core.py"], "/soccer/__init__.py": ["/soccer/base_soccer.py", "/soccer/di... |
39,520 | JHuenerberg/rpz-light-control | refs/heads/master | /app.py | from flask import Flask, render_template, request
import rf_send
app = Flask(__name__)
@app.route('/', methods=["GET", "POST"])
def index():
if request.method == "POST":
if request.form.get("lighton"):
rf_send.control_light("on")
elif request.form.get("lightoff"):
rf_send.... | {"/app.py": ["/rf_send.py"]} |
39,521 | JHuenerberg/rpz-light-control | refs/heads/master | /rf_send.py | import logging
from rpi_rf import RFDevice
logging.basicConfig(level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S',
format='%(asctime)-15s - [%(levelname)s] %(module)s: %(message)s',)
codes = {"on": 1052693, "off": 1052692}
def control_light(code):
rfdevice = RFDevice(17)
rfdevice.enable_tx(... | {"/app.py": ["/rf_send.py"]} |
39,524 | jyotiyadav99111/clickbait_identification | refs/heads/main | /preprocessing.py | import csv
import pickle
import random
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from nltk.corpus import stopwords
random.seed(0)
#STOPWORDS = set(s... | {"/predict.py": ["/preprocessing.py"]} |
39,525 | jyotiyadav99111/clickbait_identification | refs/heads/main | /predict.py | import pickle
import tensorflow as tf
from preprocessing import apply_tokenizer, text_for_pred
# loading model
model = tf.keras.models.load_model('best_model.h5')
# loading tokenizer
with open('tokenizer.pickle', 'rb') as handle:
tokenizer = pickle.load(handle)
# text to predict for
txt = []
headin... | {"/predict.py": ["/preprocessing.py"]} |
39,528 | niEmerance/PythonWeek2IP | refs/heads/master | /instance/config.py | SOURCE_API_KEY='ca646ffdcd7c47028f4fd29cd28644da'
SECRET_KEY='12345' | {"/app/requests.py": ["/app/models.py"], "/app/main/views.py": ["/app/requests.py"]} |
39,529 | niEmerance/PythonWeek2IP | refs/heads/master | /app/models.py | class Source:
'''
Sources class to define Source Objects
'''
def __init__(self,id,name,description,url,category,language,country):
self.id =id
self.name = name
self.description = description
self.url=url
# self.poster = "https://image.tmdb.org/t/p/w500/" + poster... | {"/app/requests.py": ["/app/models.py"], "/app/main/views.py": ["/app/requests.py"]} |
39,530 | niEmerance/PythonWeek2IP | refs/heads/master | /app/requests.py | import urllib.request,json
from .models import Source,Articles
# Source=source.Source
# Getting api key
api_key = None
base_url = None
articles_url=None
def configure_request(app):
global api_key,base_url,articles_url
api_key = app.config['SOURCE_API_KEY']
base_url = app.config['SOURCE_API_BASE_URL']
... | {"/app/requests.py": ["/app/models.py"], "/app/main/views.py": ["/app/requests.py"]} |
39,531 | niEmerance/PythonWeek2IP | refs/heads/master | /app/main/views.py | from flask import render_template,request,redirect,url_for
from . import main
from ..requests import get_sources, get_articles
# Views
@main.route('/')
def index():
sources=get_sources('general')
title='Welcome to our articles'
return render_template('index.html', title=title, general=sources)
@main.route... | {"/app/requests.py": ["/app/models.py"], "/app/main/views.py": ["/app/requests.py"]} |
39,532 | niEmerance/PythonWeek2IP | refs/heads/master | /config.py | import os
class Config:
SOURCE_API_BASE_URL='https://newsapi.org/v2/sources?category={}&apiKey=ca646ffdcd7c47028f4fd29cd28644da'
ARTICLE_API_BASE_URL='https://newsapi.org/v2/everything?language=en&sources={}&apiKey={}'
SOURCE_API_KEY=os.environ.get('SOURCE_API_KEY')
SECRET_KEY = os.environ.get('SECRET... | {"/app/requests.py": ["/app/models.py"], "/app/main/views.py": ["/app/requests.py"]} |
39,615 | BrionGahl/Aeth-Bot | refs/heads/main | /config/example_config.py | #!/usr/bin/python3
TOKEN = "TOKEN GOES HERE"
PREFIX = "$"
| {"/main.py": ["/loader.py"]} |
39,616 | BrionGahl/Aeth-Bot | refs/heads/main | /main.py | #!/usr/bin/python3
import logging
import discord
from discord.ext import commands
import loader
VERSION = '0.1'
DESCRIPTION = 'AETH-BOT\nAuthor: Brion Gahl\n'
bot = commands.Bot(command_prefix=loader.PREFIX, description=DESCRIPTION)
@bot.event
async def on_ready():
print("LOGGED IN AS {0.user}".format(bot))
bot.... | {"/main.py": ["/loader.py"]} |
39,617 | BrionGahl/Aeth-Bot | refs/heads/main | /cogs/raider.py | #!/usr/bin/python3
import discord
from discord.ext import commands
import requests
import json
DEFAULT_REGION = 'us'
DEFAULT_LOCALE = 'en'
RAIDER_IMG = "https://cdnassets.raider.io/images/brand/Icon_FullColor_Square.png"
RAIDER_API = "https://raider.io/api/v1/"
class Raider(commands.Cog):
def __init__(self, bot):
... | {"/main.py": ["/loader.py"]} |
39,618 | BrionGahl/Aeth-Bot | refs/heads/main | /loader.py | #!/usr/bin/python3
import os
config = os.path.join('.', 'config', 'config.py')
if os.path.isfile(config):
try:
from config.config import TOKEN
except:
raise Exception('Cannot find TOKEN variable, is it set?')
try:
from config.config import PREFIX
except:
raise Exception('Cannot find PREFIX variable, is it ... | {"/main.py": ["/loader.py"]} |
39,637 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/is-cantor-number-fast.py | def main( n ):
if n < 3:
return n < 2
else:
return main( n // 3) and main(MOD(n , 3))
def MOD( m , n ):
return m - m // n * n
| {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,638 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/palindrome.py | def MOD( m , n ):
return m - n*( m // n )
def reverse(n ):
return reverseL( n , 0 )
def reverseL( n , nR ):
if n == 0:
return nR
else:
return reverseL( n // 10 , 10 * nR + MOD(n, 10) )
def isPalindrome( n ):
return 0 == ( n - reverse(n) )
def main( number ):
p... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,639 | alanmmckay/KLEINcompiler | refs/heads/master | /src/k_token.py | from enum import Enum
class TokenType(Enum):
NUMBER = 1
KEYWORD = 2
WORD = 3
OPERATORS = 4
DELIMETER = 5
BOOLEAN = 6
PRIMITIVE = 7
EOF = 8
class Token:
def __init__(self, token_type, token_value=None):
self.token_type = token_type
self.token_value =... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,640 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/Euclid.py | def remainder ( a, b ):
if a < b:
return a
else:
return remainder( a - b , b)
def gcd( a , b ):
if b == 0:
return a
else:
return gcd( b , remainder ( a , b ))
def main ( a , b ):
print (gcd ( a , b ))
| {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,641 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/is-cantor-number-bool.py | def main ( n ):
return (n < 2) or ((2 < n) and main(n / 3) and main(MOD(n, 3)))
def MOD( m , n ):
return m - m // n * n
| {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,642 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/sum-factors.py | def loopToN( n , current , sum ):
if n == current:
return n - sum
else:
return testAndLoop( n , current , sum )
def testAndLoop( n , current , sum ):
if divides( current , n ):
return printCurrentAndLoop( n , current , sum + current )
else:
return loopToN( n , ... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,643 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/lib.py | def main( testArgument):
print(SQRT(testArgument) )
return ODD( testArgument )
def MAXINT():
return 2147483647
def MININT():
return -2147483647 - 1
def LT ( p , q ):
return p < q
def EQ( p , q ):
return p == q
def NE( p , q ):
return not EQ( p , q )
def LE( p , q ):... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,644 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/factors.py | def main( n ):
loopToN ( n , 1)
def loopToN( n , current ):
if n == current:
return n
else:
return testAndLoop( n , current )
def testAndLoop( n , current ):
if divides( current , n ):
return printAndLoop( n , current)
else:
return loopToN( n , current ... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,645 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/is-special.py | def MOD( m , n ):
return m - m // n * n
def divides( x , n ):
return MOD ( n , x ) == 0
def count( x , n ):
if n < 10:
if x == n:
return 1
else:
return 0
else:
if x == MOD( n , 10 ):
return 1 + count(x, n // 10)
else:
... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,646 | alanmmckay/KLEINcompiler | refs/heads/master | /src/AST_node.py | import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from src.errors import SemanticError
from src.stack_operations import top, pop, push, push_rule
function_record = []
# used to keep track of the function definition
# that is currently being processed
function_table = {}
#function_ta... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,647 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/print-one.py | def main():
print(1)
return 1
print( main( ))
| {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,648 | alanmmckay/KLEINcompiler | refs/heads/master | /src/scanner.py | from src.k_token import Token, TokenType
from src.errors import LexicalError
keywords = ["function", "boolean", "if", "then", "else", "not", "and", "or", "integer", "print"]
boolean = ["true", "false"]
# take print out of keywords if we implement this:
# primitive = ["main", "print"]
class Scanner:
"""... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,649 | alanmmckay/KLEINcompiler | refs/heads/master | /src/code_generator.py | class Generator:
def __init__(self, ast):
self.ast = ast
def generate(self):
line = 0
program = self.ast.code_gen(line)
program_str = ''
for line_num, stmt in enumerate(program):
program_str += str(line_num) + ': ' + stmt + '\n'
return p... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,650 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/circular-prime.py | # maximum recursion depth exceeded in comparison
import math
def main(x):
return circularPrimesTo(x)
def circularPrimesTo(x):
return circularPrimesToHelper(x+1,2,0)
def circularPrimesToHelper(top,x,count):
if x<top:
if isCircularPrime(x):
return circularPrimesToHelper(... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,651 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/divide.py | def main ( a , b , n ):
if n == 0:
return a
else:
printAndDivide( a , b, n )
def printAndDivide( a , b , n ):
print(( 10 * a ) // b )
return main (MOD(a*10, b), b, n-1)
def MOD( m , n ):
return m - m // n * n
| {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,652 | alanmmckay/KLEINcompiler | refs/heads/master | /src/drivers/code_gen_validate.py | from sys import argv, path
import os
path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)) + '/../../'))
path.insert(0, os.getcwd())
from src.parser import Parser
from src.scanner import Scanner
# have to import some sort of sem analyzer how ever we decide to do that
from src.code_generator import G... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,653 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/is-tanton-pal.py | #MOD is undefined
def main( x ):
return is_tanton_pal_bin(binary_for(x))
def is_tanton_pal_bin( x ):
if is_palindrome( x ):
return True
else:
return is_tanton_pal_bin( add_boolean( x , reverse( x )) )
def binary_for( n ):
if n < 2:
return n
else:
ret... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,654 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/fibonacci.py | def main ( elementWanted):
if elementWanted < 1 :
return 0
else:
return addNext( 1 , elementWanted , 0 , 1 )
def addNext( currentElement, elementWanted , previousSum , currentSum):
if elementWanted == currentElement:
return currentSum
else:
return addNext ( cur... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,655 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/is-excellent.py | def MOD( m , n ):
return m - n * (m//n)
def EXP( m , n ):
if n == 0:
return 1
else:
return m * EXP( m , n-1 )
def ODD( n ):
if 0 < n:
return ( 2 * (n//2) ) < n
else:
return ODD( -n )
def length( n ):
if n < 10:
return 1
else:
... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,656 | alanmmckay/KLEINcompiler | refs/heads/master | /src/parser.py | from src.scanner import Scanner
from src.errors import ParseError
from src.parse_table import *
from src.k_token import Token, TokenType
from src.AST_node import *
from src.stack_operations import *
class Parser:
def __init__(self, scanner):
self.scanner = scanner
self.debug_stack_strin... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,657 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/is-cantor-number-v4.py | def main( n ):
return (n < 2) or ((2 < n) and main(n / 3) and ((n - n/3 * 3) < 2))
| {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,658 | alanmmckay/KLEINcompiler | refs/heads/master | /src/drivers/parse_validate.py | from sys import argv, path
import os
path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)) + '/../../'))
path.insert(0, os.getcwd())
from src.parser import Parser
from src.scanner import Scanner
# define file path
FILE_PATH = argv[1]
# turn prgm into a string and strip return off FILE_PATH
FILE_PA... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,659 | alanmmckay/KLEINcompiler | refs/heads/master | /src/errors.py | import sys
sys.tracebacklimit=0
class Error():
def __init__(self, program):
#Every error will need to be passed the program:
#-this is accessed by the scanner's get_program_string method
self.program_string = program
self.error_message = "\n--\n"
self.erro... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,660 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/square-root.py | def ABS( n ):
if n < 0:
return -n
else:
return n
def f( x , n ):
return x * x - n
def df( x ):
return 2 * x
def newtonAux( guess , previous, epsilon , n ):
if epsilon < ABS(previous - guess):
return newtonAux( guess - f(guess,n)/df(guess), guess, epsilon, n )... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,661 | alanmmckay/KLEINcompiler | refs/heads/master | /src/parse_table.py | from enum import Enum
from src.k_token import Token, TokenType
from src.AST_node import *
class NonTerminal(Enum):
Program = 0
Definitions = 1
Def = 2
Formals = 3
Nonempty_Formals = 4
Nonempty_Formals_t = 5
Formal = 6
Body = 7
Type = 8
Expr = 9
Expr_p = 10
... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,662 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/printAndDivide.py | import sys
def printAndDivide ( a, b, n ):
print( 10 * a // b)
return main ( MOD(a*10, b), b, n-1)
def MOD ( m, n):
return m - m//n * n
sys.argv = ['printAndDivide', '1' , '2', '3' ]
def main ( a, b, n ):
if n == 0 :
return a
else:
return printAndDivide( a, b, n ... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,663 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/horner-param.py | def main( coeff3, coeff2 , coeff1 , coeff0 , x ):
return horner( x, 3, 0, coeff3, coeff2, coeff1, coeff0 )
def horner( x , n , value , coeff3 , coeff2 , coeff1 , coeff0 ):
if n < 0:
return value
else:
return horner( x , n - 1 , (value * x) + coefficient(n, coeff3, coeff2, coeff1, coe... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,664 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/divisibleByParts.py | import math
def MOD(m,n):
return m-(m/n)*n
def divisibleByParts(left, right):
print("n/10=",left,"MOD(n,10)",right)
return divisibleByDifference((left-right)*2)
def divisibleByDifference(diff):
print("diff=", diff)
if((diff == 7) or (diff == 0) or (diff == -7) or (diff == -14)):
... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,665 | alanmmckay/KLEINcompiler | refs/heads/master | /src/tests.py | import unittest
from src.scanner import Scanner
class ScannerTestCases(unittest.TestCase):
def test_peek_past_whitespace(self):
'''Find literal past whitespace.'''
s = Scanner(' += ')
self.assertTrue(s.peek().is_operator(), 'whitespace before ...')
def test_literal_tok... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,666 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/divisible-By-Seven.py | import math
def main ( n ):
return divisibleByParts ( n // 10 , MOD (n, 10 ))
def divisibleByParts ( left , right ):
return divisibleByDifference ( left - right * 2)
def divisibleByDifference ( diff ):
if ((diff == 7) or (diff == 0) or (diff == -7) or (diff == -14)):
return True
e... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,667 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/horner.py | def main ( x ):
return horner ( x , 3 , 0 )
def horner( x , n , value ):
if n < 0:
return value
else:
return horner( x , n - 1 , (value * x) + coefficient(n) )
def coefficient( i ):
if i < 1:
return 9
elif i < 2:
return 2
elif i < 3:
retur... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,668 | alanmmckay/KLEINcompiler | refs/heads/master | /doc/parser/factoryConcept.py | ##This is the basic rundown of how the semantic action
##portion of the parse algorithm will create the node objects.
class anASTNode():
def __init__(self, stack):
self.test = stack.pop()
def get_test(self):
return self.test
factory = {
1 : anASTNode
}
stack = [1,2,"three",4,(4+1... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,669 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/sieve.py | def main( n ):
return sieveAt( 2 , n )
def sieveAt( current , max ):
if max < current:
return True
else:
return doSieveAt( current , max )
def doSieveAt( current , max ):
if isPrime(current):
print (current)
else:
print ("0")
return sieveAt(cur... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,670 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/modulus-by-hand.py | def MOD( m, n):
if m < n:
return m
else:
MOD(m-n, n)
def main( m, n):
print(m / n)
return MOD(m,n)
| {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,671 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/is-cantor-number.py | def main ( n ):
return has_no_2s(to_base3(n))
def to_base3( n ):
if n < 3:
return n
else:
return 10 * to_base3(n / 3) + MOD(n, 3)
def has_no_2s( n ):
if n < 10:
return n < 2
else:
return has_no_2s(n / 10) and has_no_2s(MOD(n, 10)... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,672 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/farey.py | def main( xNum , xDen , N ):
print( fareyNum( xNum , xDen , N ) )
print (fareyDen( xNum , xDen , N ))
def fareyNum( xNum , xDen , N ):
return fareySelectNum(N,whileLoopFor(1, xNum, xDen, N, 0, 1, 1, 1),
whileLoopFor(2, xNum, xDen, N, 0, 1, 1, 1),
whileLoopFor(3,... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,673 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/public-private.py | def main ( publicKey , privateKey ):
if publicKey == 0:
return factor( 2147481647 , 2047483747 )
else:
return factor( publicKey , privateKey )
def factor( publicKey , privateKey ):
return displayAndPrint( publicKey , privateKey , gcd( publicKey , privateKey) )
def displayAndPrint(... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,674 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/generate-excellent.py | # bad if
def MOD( m , n ):
return m - n *( m// n )
def EXP( m , n ):
if n == 0:
return 1
else:
return m * EXP( m , n-1 )
def ODD( n ):
if 0 < n:
return (2 * ( n // 2 )) < n
else:
return ODD( -n )
def LE( p , q ):
return ( p < q ) or ( p == q... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,675 | alanmmckay/KLEINcompiler | refs/heads/master | /src/stack_operations.py | def top(stack):
return stack[-1]
def pop(stack):
stack.pop()
def push_rule(lst, stack):
for element in reversed(lst):
stack.append(element)
def push(lst, stack):
stack.append(lst)
| {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,676 | alanmmckay/KLEINcompiler | refs/heads/master | /programs/class-programs/python-equivalents/russian-peasant.py | def MOD(m,n):
return(m%n)
def multWithAccum(m,n,accum):
if n==0:
return(accum)
elif MOD(n,2)==1:
return(multWithAccum(m*2,n//2,accum+m))
else:
return(multWithAccum(m*2,n//2,accum))
def mult(m,n):
return(multWithAccum(m,n,0))
def main(m,n):
print(m)
... | {"/src/AST_node.py": ["/src/errors.py", "/src/stack_operations.py"], "/src/scanner.py": ["/src/k_token.py", "/src/errors.py"], "/src/drivers/code_gen_validate.py": ["/src/parser.py", "/src/scanner.py", "/src/code_generator.py"], "/src/parser.py": ["/src/scanner.py", "/src/errors.py", "/src/parse_table.py", "/src/k_toke... |
39,698 | hairtonvanda18/ChessEngineAI | refs/heads/main | /ChessMain.py | import pygame as p
import ChessEngine
import ChessAi
import time
WIDTH = HEIGHT = 400
DIMENSION = 5
SQ_SIZE = HEIGHT // DIMENSION
MAX_FPS = 15
IMAGES = {}
def loadImages():
pieces = ["bR","bN","bB","bQ","bK",
"bp","wp","wR","wN","wB","wQ","wK"]
for piece in pieces:
IMAGES[piece] =p.t... | {"/ChessMain.py": ["/ChessEngine.py", "/ChessAi.py"]} |
39,699 | hairtonvanda18/ChessEngineAI | refs/heads/main | /ChessAi.py | import random
pieceScore = {"K": 0,"Q": 10,"R": 5, "B": 3, "N" :3, "p": 1}
CHECKMATE = 1000
STALEMATE = 0
DEPTH = 2
def findRandomMove(validmoves):
return validmoves[random.randint(0,len(validmoves)-1)]
def findBestMove(gs,validmoves):
turnMultiplier = 1 if gs.whiteToMove else -1
oppMinMaxScore = CHECKMATE... | {"/ChessMain.py": ["/ChessEngine.py", "/ChessAi.py"]} |
39,700 | hairtonvanda18/ChessEngineAI | refs/heads/main | /ChessEngine.py | import time
class GameState():
def __init__(self):
self.board=[
["bR","bN","bB","bQ","bK"],
["bp","bp","bp","bp","bp"],
["--","--","--","--","--"],
["wp","wp","wp","wp","wp"],
["wR","wN","wB","wQ","wK"]
]
self.moveFunctions = {... | {"/ChessMain.py": ["/ChessEngine.py", "/ChessAi.py"]} |
39,703 | Rallstad/adventofcode_2020 | refs/heads/main | /6.py | from utils import readFile
import bisect
lines = readFile('inputs/inputTask6.txt')
def listDistinctGroupChars(group):
joined = ''.join(group)
distinct = list(set(joined))
return distinct
def findCommonGroupAnswers(group):
listList = []
for elem in group:
distinct = list(set(elem))
... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,704 | Rallstad/adventofcode_2020 | refs/heads/main | /16.py | from utils import readFile
import re
lines = readFile('inputs/inputTask16.txt')
def GetValidRanges(lines):
valids = []
rangeMinMax = []
for line in lines:
if re.findall('your ticket', line):
break
elif line == '':
continue
else:
line = line.split... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,705 | Rallstad/adventofcode_2020 | refs/heads/main | /13.py | from utils import readFile
departures = readFile('inputs/inputTask13.txt')
def GetEarliestDeparture(departures):
currentTimestamp = departures[0]
departures = departures[1].split(',')
earliestDeparture = float('inf')
afterCurrentTimestamp = 0
for departure in departures:
if departure !=... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,706 | Rallstad/adventofcode_2020 | refs/heads/main | /5.py | from utils import readFile
import bisect
lines = readFile('inputs/inputTask5.txt')
def getSeatBinary(line):
seatsInBinary = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
index = 0
for letter in line:
if letter == 'B' and index <= 6:
seatsInBinary[index] = 1
elif letter == 'R'... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,707 | Rallstad/adventofcode_2020 | refs/heads/main | /10.py | from utils import readFile
import math
lines = readFile('inputs/inputTask10.txt')
lines = [int(line) for line in lines]
print(lines)
#for line in lines:
#print(line)
def FindChain(lines):
singleHop = 1
doubleHop = 2
tripleHop = 3
numSingleHop = 0
numDoubleHop = 0
numTripleHop = 0
device... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,708 | Rallstad/adventofcode_2020 | refs/heads/main | /12.py | from utils import readFile
import re
instructions = readFile('inputs/inputTask12.txt')
#I must say, this way of writing function and variable names, I do not like
def RotateShip(pos, command, magnitude, newDirection):
if command == 'L':
magnitude = -magnitude
newDirection = (newDirection + magni... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,709 | Rallstad/adventofcode_2020 | refs/heads/main | /15.py | from utils import readFile
import re
line = readFile('inputs/inputTask15.txt')
def GetLastTwoInstances(refNumber, prevNumbers):
lastTwoSpoken = []
count = 0
for num in prevNumbers:
if num == refNumber:
lastTwoSpoken.append(count)
if len(lastTwoSpoken) > 2:
l... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,710 | Rallstad/adventofcode_2020 | refs/heads/main | /3.py | from utils import readFile
lineArr = readFile('inputs/inputTask3.txt')
def task3a(lineArr):
treeCount = 0
elem = 0
for line in lineArr:
if line[elem] == "#":
treeCount = treeCount + 1
elem = (elem + 3) % 31
return treeCount
def task3b(lineArr):
vStepSize = [1, 1... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,711 | Rallstad/adventofcode_2020 | refs/heads/main | /2.py | from utils import readFile
passwords = readFile('inputs/inputTask2.txt')
def Task2a(passwords):
count = 0
for p in passwords:
limitLow = p.split("-")[0]
limitHigh = p.split('-')[1].split(' ')[0]
reqChar = p.split(' ')[1].split(':')[0]
passString = p.split(' ')[2]
passStr... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,712 | Rallstad/adventofcode_2020 | refs/heads/main | /11.py | from utils import readFile
import copy
lines = readFile('inputs/inputTask11.txt')
def convert2Array(lines):
lineCount = 0
for line in lines:
for spot in line:
splitted = [spot for spot in line]
lines[lineCount] = splitted
lineCount += 1
return lines
def PadLines(l... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,713 | Rallstad/adventofcode_2020 | refs/heads/main | /4.py | from utils import readFile
import re
lines = readFile('inputs/inputTask4.txt')
def getPassportsWithCorrectElements(lines):
values = ['byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid']
passport = []
count = 0
validPassports = 0
for line in lines:
if line:
for word in line.split()... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,714 | Rallstad/adventofcode_2020 | refs/heads/main | /9.py | from utils import readFile
import math
lines = readFile('inputs/inputTask9.txt')
def populatePreamble(lines):
preamble = []
count = 0
for line in lines:
if count == 25:
break
preamble.append(lines[count])
count = count + 1
return preamble
def moveList(count, lines, preamble):
preamble.remove(pream... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,715 | Rallstad/adventofcode_2020 | refs/heads/main | /utils.py | def readFile(input_file):
with open(input_file) as f:
lines = f.read().splitlines()
numArr = [line for line in lines]
return numArr | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,716 | Rallstad/adventofcode_2020 | refs/heads/main | /14.py | from utils import readFile
import re
lines = readFile('inputs/inputTask14.txt')
def GetMemAddress(l):
print((l[0].split('['))[1].split(']')[0])
return int((l[0].split('['))[1].split(']')[0])
def GetMemBinaryValue(l, bit):
binaryValueList = []
value = int(l[1].strip())
binaryValue = "{0:b}".forma... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,717 | Rallstad/adventofcode_2020 | refs/heads/main | /7.py | from utils import readFile
import re
lines = readFile('inputs/inputTask7.txt')
def DigDeep(line, lines):
splitLine = SplitLine(line)
for bag in splitLine[1:]:
if "o other" in splitLine[1]:
continue
if "shiny gold" in bag:
return True
child = SearchChild(bag, lines)
shiny = DigDeep(child, lines)
i... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
39,718 | Rallstad/adventofcode_2020 | refs/heads/main | /8.py | from utils import readFile
import operator
ops = { "+": operator.add, "-": operator.sub } # legger til string operators som operators
lines = readFile('inputs/inputTask8.txt')
def accumulateAcc(lines):
acc = 0
jmp = 1
been = []
index = 0
repeated = False
while not repeated:
if index in been:
repeated = 1... | {"/6.py": ["/utils.py"], "/16.py": ["/utils.py"], "/13.py": ["/utils.py"], "/5.py": ["/utils.py"], "/10.py": ["/utils.py"], "/12.py": ["/utils.py"], "/15.py": ["/utils.py"], "/3.py": ["/utils.py"], "/2.py": ["/utils.py"], "/11.py": ["/utils.py"], "/4.py": ["/utils.py"], "/9.py": ["/utils.py"], "/14.py": ["/utils.py"], ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.