index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
12,828 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/AccessModifiers/protected.py | # if you want make a method or variable private, use _ before the name
# PROTECTED : protected member is (in C++ and Java) accessible only from within the class and it’s subclasses
class Jar:
def __init__(self):
# protected variable prefixed with _
self._content = None
def fill(self, content)... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,829 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/modules_and_packages/carsPackage/bmw.py | class Bmw:
def __init__(self):
self.models = ['320d', '330d', 'bikes']
def out_models(self):
print("Existing models are: ")
for model in self.models:
print(model) | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,830 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/numberGuessingGame.py | import random
def guessing_game():
num = random.randint(1, 10)
guess = int(input('Guess a number between 1 and 10'))
times = 1
while guess != num:
guess = int(input('Guess again'))
times += 1
if times == 3:
break
if guess == num:
print('You win!')
... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,831 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/modules_import_weather_data/weather.py | import requests
def current_weather():
url = "https://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=f2e9b3d28adf99c7d56b98d9044e6173"
r = requests.get(url)
print(r)
weather_json = r.json()
print(weather_json)
min = weather_json['main']['temp_min']
max = weather_json['main']... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,832 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/datatype_conversions.py | # Dynamic Type Casting
print('--------Dynamic type casting----------')
i=100
j='Hello World'
print(j)
print(type(j))
j=99.5
print(j)
print(type(j))
j=i
print(j)
print(type(j))
# Static type casting
print('-----------Static Type Conversions--------')
num=100
dec=5.6
word='Hello'
print(num, dec, word)
print(type(num)... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,833 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/yieldReturn.py | # def colors():
# yield "red"
# yield "blue"
# yield "yellow"
#
# next_color = colors()
# print(type(next_color)) # <class 'generator'>
#
# print(next(next_color))
# print(next(next_color))
# print(next(next_color))
def something():
for i in range(1, 10):
yield i
next_number = something()
p... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,834 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/sendEmail.py | import smtplib
try:
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login("user@gmail.com", "password")
message = "This message is from python"
s.sendmail("user@gmail.com", "user@yahoo.com", message)
s.quit()
except Exception as e:
print(e)
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,835 | sanneabhilash/python_learning | refs/heads/master | /File_Actions_Automation/ReadWriteIntoFiles.py | import os
def readcfg(config):
items = []
if os.path.isfile(config):
cfile = open(config, 'r')
for line in cfile.readlines():
items.append(parsecfgline(line))
cfile.close()
return items
def parsecfgline(line):
option = {}
if '|' in line:
opts = line.sp... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,836 | sanneabhilash/python_learning | refs/heads/master | /pandas_practice/readExcelToDataFrame.py | import pandas as pd
data = pd.read_csv("D:\pythonTraining\Day6\emp_data.csv")
print(data)
print(type(data)) | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,837 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/modules_and_packages/import_custom_module.py | # importing module: (.py file code)
import Concepts_with_examples.modules_and_packages.CalcModule as Calc
print(Calc.add(1, 3))
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,838 | sanneabhilash/python_learning | refs/heads/master | /unit_testing_examples/unitTestExample.py | import unittest
def add(x, y):
return x + y
def div(x, y):
return x / y
def sub(x, y):
return x - y
def fact(n):
if n == 0:
return 1
return n * fact(n - 1)
# MyTest inherits TestCase class from unittest
class MyTest(unittest.TestCase):
def setUp(self):
print("IN SET UP... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,839 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/lambdas/lambda.py | add_l = lambda x, y: y / x
result = add_l(2, 4)
print(result)
print(add_l)
print(type(add_l))
# lambda function to determine max of two numbers
maximum = lambda x, y: x if x > y else y
# lambda function to determine min of two numbers
minimum = lambda x, y: x if x < y else y
max3 = lambda x, y, z: z if z > (x if x >... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,840 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/FileHandling.py | import os
# os.makedirs('D:/pythonProgramCreatedDirectory') # In case you want to create directory
f = open('D:/TestDigitalAssets/sample.txt', 'w') # File opened in write mode
# if specified file does not exist, then it creates a new file
print("Write using 'w' mode:")
f.write('This is a test file')
f.write('\nThis... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,841 | sanneabhilash/python_learning | refs/heads/master | /File_Actions_Automation/walkdir.py | import os
for fn, sflds, fnames in os.walk('C:\\Personal'):
print('Current folder is ' + fn)
for sf in sflds:
print(sf + ' is a subfolder of ' + fn)
for fname in fnames:
print(fname + ' is a file of ' + fn)
print('') | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,842 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/lambdas/map.py | # map() function takes in lambda function and a list.
# program with map function : a new list is returned which contains all the lambda modified items
my_list = [1, 2, 3, 4, 5, 6]
my_list = list(map(lambda x: (x**2), my_list))
print(my_list)
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,843 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Operators/identity.py | # Identity operator, compares if the address location is same
# is - Evaluates to true if the variables on either side of the operator point to the same object and false otherwise.
# is not - Evaluates to false if the variables on either side of the operator point to the same object
# and true otherwise.
i ... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,844 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/functions.py | # Basic python methods Example
def add(i, j):
return i + j
def empty_method(i, j):
pass
def return_none():
return None
def add_return_none2(i, j):
print('Sum=', i + j)
return
print(add(10, 1))
print(empty_method(10, 1))
print(return_none())
print(add_return_none2(11, 2))
# parameter j is o... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,845 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Operators/logical.py | # and or operators
print('----------Logical-------')
print(True and False)
print(True or False)
i = 10
j = 11
if i and j > 0:
print('i and j are greater than 0')
k = False
# not operator
if not k:
print('K is false')
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,846 | sanneabhilash/python_learning | refs/heads/master | /DataBaseInteractions/SQLiteDemo.py | import sqlite3 as lite
import sys
# We are suing SQLite package to connect to DB and run commands
# Data files are created under folder: ..\Day5\DataBaseInteractions
# Demo code for connect to db and do CURD operations
# Install SQL community edition to view files created - commondb, database.db
con = None
try:
# ... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,847 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/static_variables.py | class Jar:
my_static_variable = 'Hello World'
def __init__(self):
self.content = None
def fill(self, content):
self.content = content
def empty(self):
print('Empty the jar...')
self.content = None
myJar = Jar()
myJar.content = 'sugar'
print(Jar.my_static_variable) #... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,848 | sanneabhilash/python_learning | refs/heads/master | /pandas_practice/sqlDataToDataFrame.py | import pandas as pd
import mysql.connector
# load data from mysql database
con = mysql.connector.connect(host="localhost", user='root', passwd='root', auth_plugin='mysql_native_password', database = 'univdb')
emp_data=pd.read_sql('select d.dept_id, d.dept_code from department d', con)
print(emp_data)
print(type(emp_d... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,849 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/conditional_statements.py | # IF Else condition
i, j = 10, 15
if i > j:
print('i is greater than j')
elif j == i:
print('i is equal to j')
else:
print('i is not greater than j')
# Python does not support switch statements, instead we are provided with switcher
# The Pythonic way to implement switch statement is to use the powerful... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,850 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Generators.py | from typing import Any, Generator
new_list = (x ** 2 for x in [1, 2, 3, 4, 5, 6])
# new_list: Generator[Any, Any, None] = (x ** 2 for x in [1, 2, 3, 4, 5, 6])
print(type(new_list)) # <class 'generator'>
for item in new_list:
print(item) | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,851 | sanneabhilash/python_learning | refs/heads/master | /File_Actions_Automation/basics.py | import os
# File path handling
os.chdir("C:/Users") # Changes the current folder
print(os.path.dirname("C:/Users")) # returns the path's directory name
print(os.path.split("C:/Users/asanne")) # returns tuple
print(os.path.join("foo", "panda")) # returns concatenated path
calc = "C:\\Windows\\System32\\calc.exe" # pa... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,852 | sanneabhilash/python_learning | refs/heads/master | /pandas_practice/pandasDemo.py | import pandas as pd
data = pd.Series([1,2.5, "Hello", [1,2,4]])
print(data)
print(type(data))
df = pd.DataFrame({'name': ['anil', 'sunil', 'ramesh', 'suresh'], 'score':[56,45, 87, 89]})
print(df)
print("_______________________________")
print(df["name"])
print("_______________________________")
print(df["score"]) | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,853 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/factorial.py | def factorial(number: int):
fact: int = 1
while number > 1:
fact *= number
number = number - 1
return fact
def recursive_factorial(number: int):
fact: int = number;
if number <= 1:
return 1
else:
fact = fact * recursive_factorial(number - 1)
return fact
a... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,854 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/palindromic_triangle.py | """
You are given a positive integer .
Your task is to print a palindromic triangle of size .
For example, a palindromic triangle of size is:
1
121
12321
1234321
123454321
You can't take more than two lines. The first line (a for-statement) is already written for you.
You have to complete the code using exactly one... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,855 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/inbuild_methods_on_lists.py | my_list = [2, 1, 3, 6, 5, 4]
print(my_list)
my_list.append(7)
my_list.append(8)
my_list.append("HelloWorld")
print(my_list)
my_list.remove("HelloWorld") # sorting of mixed list throws error, so removing string
my_list.sort() # The original object is modified
print(my_list) # sort by default ascending
my_list.sort... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,856 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/listOperations.py | # List is an ordered sequence of items. List is mutable
# List once created can be modified.
my_list = ["apples", "bananas", "oranges", "kiwis"]
print("--------------")
print(my_list)
print("--------------")
# accessing list using index
print(my_list[0])
print(my_list[3])
# slicing list
print(my_list[1:4])
print(my_... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,859 | lukejuusola/AoCMM2016-Traffic | refs/heads/master | /MaxValue.py | import numpy as np
import math
def MaxValue(f, X, Y):
Xl, Yl = np.meshgrid(X, Y)
vf = np.vectorize(f)
Z = vf(Xl, Yl)
index = np.argmax(Z)
x_in = math.floor(index/50)
y_in = index%50
return (X[x_in], Y[y_in], Z[x_in][y_in])
if __name__ == '__main__':
x_mean = .84
y_mean = .12
f = lambda x,y: 1 - math.sqrt((... | {"/PointPicker.py": ["/CrashMap.py", "/MaxValue.py", "/Plot.py"], "/Plot.py": ["/CrashMap.py"], "/NaiveContinuousComplete.py": ["/PointPicker.py", "/CrashMap.py", "/readin.py"]} |
12,860 | lukejuusola/AoCMM2016-Traffic | refs/heads/master | /gradient.py | from CrashMap import CrashMap
import numpy as np
import scipy
from Plot import plot
import random
m_x = (-10,10)
m_y = (-10,10)
stdx = 1
stdy = 1
def fscore(f1, f2):
return lambda x,y: (f1(x,y) - f2(x,y))**2
def calcInt(f):
score, error =scipy.integrate.quadpack.dblquad(f, m_x[0], m_x[1], lambda x: m_y[0], l... | {"/PointPicker.py": ["/CrashMap.py", "/MaxValue.py", "/Plot.py"], "/Plot.py": ["/CrashMap.py"], "/NaiveContinuousComplete.py": ["/PointPicker.py", "/CrashMap.py", "/readin.py"]} |
12,861 | lukejuusola/AoCMM2016-Traffic | refs/heads/master | /readin.py | import numpy
#Finds number of lines in file
def file_len(fname):
with open(fname) as f:
for i, l in enumerate(f):
pass
return i + 1
# Reads the data in "filein" into a matrix. "num" is the number of data points per line.
# For raw output (files of form "out__.txt") num = 4. The coordinates ... | {"/PointPicker.py": ["/CrashMap.py", "/MaxValue.py", "/Plot.py"], "/Plot.py": ["/CrashMap.py"], "/NaiveContinuousComplete.py": ["/PointPicker.py", "/CrashMap.py", "/readin.py"]} |
12,862 | lukejuusola/AoCMM2016-Traffic | refs/heads/master | /PointPicker.py | from CrashMap import CrashMap
from MaxValue import MaxValue
import numpy as np
from Plot import plot
amb_std = 2
crash_std = 1
def MapDifference(f, h):
def difference(x,y):
return f(x,y) - h(x,y)
return difference
def NaiveContinuousSolution(crashes, totalPicked):
picks = []
crashMap = CrashMap(crashes, crash_... | {"/PointPicker.py": ["/CrashMap.py", "/MaxValue.py", "/Plot.py"], "/Plot.py": ["/CrashMap.py"], "/NaiveContinuousComplete.py": ["/PointPicker.py", "/CrashMap.py", "/readin.py"]} |
12,863 | lukejuusola/AoCMM2016-Traffic | refs/heads/master | /Constants.py | stdy = 1.0
stdx = 1.0
safetyWeight = 500.0
ambCost = 5000.0
priceWeight = 100.0
| {"/PointPicker.py": ["/CrashMap.py", "/MaxValue.py", "/Plot.py"], "/Plot.py": ["/CrashMap.py"], "/NaiveContinuousComplete.py": ["/PointPicker.py", "/CrashMap.py", "/readin.py"]} |
12,864 | lukejuusola/AoCMM2016-Traffic | refs/heads/master | /Plot.py | from CrashMap import CrashMap
from matplotlib import cm
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
def plot(f, leftX, rightX, leftY, rightY):
fig = plt.figure()
ax = fig.gca(projection='3d')
vf = np.vectorize(f)
X = np.linspace(leftX, rightX, 100)
Y = np.linspace(le... | {"/PointPicker.py": ["/CrashMap.py", "/MaxValue.py", "/Plot.py"], "/Plot.py": ["/CrashMap.py"], "/NaiveContinuousComplete.py": ["/PointPicker.py", "/CrashMap.py", "/readin.py"]} |
12,865 | lukejuusola/AoCMM2016-Traffic | refs/heads/master | /NaiveContinuousComplete.py | from PointPicker import *
from CrashMap import CrashMap
from readin import *
from scipy.integrate import dblquad
import matplotlib.pyplot as plt
import random
x1 = -5
x2 = 5
y1 = -5
y2 = 5
ambCost = 2
max_n = 20
def Score(crashes, ambulances):
if(len(ambulances) == 0 or len(crashes) == 0):
return
crashMap = Crash... | {"/PointPicker.py": ["/CrashMap.py", "/MaxValue.py", "/Plot.py"], "/Plot.py": ["/CrashMap.py"], "/NaiveContinuousComplete.py": ["/PointPicker.py", "/CrashMap.py", "/readin.py"]} |
12,866 | lukejuusola/AoCMM2016-Traffic | refs/heads/master | /CrashMap.py | import math
from scipy.integrate import dblquad, IntegrationWarning
import numpy as np
import warnings
import copy
warnings.simplefilter("ignore", IntegrationWarning)
warnings.simplefilter("ignore", UserWarning)
manhattan_x = (-10, 10)
manhattan_y = (-10, 10)
#Assume dataset is in form [(x_0, y_0), ..., (x_n, y_n)] w... | {"/PointPicker.py": ["/CrashMap.py", "/MaxValue.py", "/Plot.py"], "/Plot.py": ["/CrashMap.py"], "/NaiveContinuousComplete.py": ["/PointPicker.py", "/CrashMap.py", "/readin.py"]} |
12,937 | modulexcite/tabularize.py | refs/heads/master | /tests.py | import unittest
import tabularize
class TabularizeTestCase(unittest.TestCase):
def test_ignore_headers(self):
self.assertEqual(tabularize.loads('| name | surname |'), [])
def test_whitespace(self):
self.assertEqual(tabularize.loads("""
| name | surname |
| edi | budu |
... | {"/tests.py": ["/tabularize.py"]} |
12,938 | modulexcite/tabularize.py | refs/heads/master | /tabularize.py | """
Tabularize module
Contains the `load` and `loads` methods like json, yaml modules.
"""
def normalize_line(line):
return [piece.strip() for piece in line.split("|")[1:-1]]
def is_valid_line(line):
return "|" in line
def loads(text, return_type=dict):
"""Loads tabular data from provided string"""
l... | {"/tests.py": ["/tabularize.py"]} |
12,974 | cFireworks/kmeans | refs/heads/master | /k_means.py | import numpy as np
def centroids_init(X, n_clusters, mode='random'):
"""
初始化中心点
"""
n_samples, n_features = X.shape
centroids = np.empty((n_clusters, n_features), dtype=X.dtype)
if mode == 'random':
random_state = np.random.mtrand._rand
seeds = random_state.permutation(n_sample... | {"/main.py": ["/k_means.py", "/eval.py"]} |
12,975 | cFireworks/kmeans | refs/heads/master | /main.py | from sklearn.cluster import KMeans
from k_means import k_means
import numpy as np
from keras.datasets import mnist
import time
from eval import ClusterEval
# load data
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
# data dimension
raw_dim = 28 * 28 # raw dimension
low... | {"/main.py": ["/k_means.py", "/eval.py"]} |
12,976 | cFireworks/kmeans | refs/heads/master | /eval.py | # -*- coding : utf-8 -*-
### some methods to evaluate kmeans clustering results
from matplotlib import pyplot as plt
import numpy as np
class ClusterEval():
def __init__(self, data, clu_labels, labels = None):
### init function
### @params data : numpy.array source data
### @params clu_l... | {"/main.py": ["/k_means.py", "/eval.py"]} |
12,980 | naoya0082/-B-class_review | refs/heads/master | /customer.py | class Customer:
def __init__(self, first_name, family_name, age):
self.first_name = first_name
self.family_name = family_name
self.age = age
def full_name(self):
return f"{self.first_name} {self.family_name}"
def entry_fee(self):
if self.age < 20:
self.e... | {"/customer2.py": ["/customer.py"]} |
12,981 | naoya0082/-B-class_review | refs/heads/master | /customer2.py | from customer import Customer
if __name__ == "__main__":
ken = Customer(first_name="Ken", family_name="Tanaka", age=15)
ken.age # 15 という値を返す
print(ken.age)
tom = Customer(first_name="Tom", family_name="Ford", age=57)
tom.age # 57 という値を返す
print(tom.age)
ieyasu = Customer(first_name="Iey... | {"/customer2.py": ["/customer.py"]} |
12,993 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/pyez_get_config.py | import copy
from typing import Any, Dict, List, Optional
from nornir.core.task import Result, Task
from nornir_pyez.plugins.connections import CONNECTION_NAME
from lxml import etree
import xmltodict
import json
def pyez_get_config(
task: Task,
database: str = None,
filter_xml: str = None
) -> Result:
... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
12,994 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/__init__.py | from .pyez_facts import pyez_facts
from .pyez_config import pyez_config
from .pyez_get_config import pyez_get_config
from .pyez_commit import pyez_commit
from .pyez_diff import pyez_diff
from .pyez_int_terse import pyez_int_terse
from .pyez_route_info import pyez_route_info
from .pyez_rpc import pyez_rpc
from .pyez_sec... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
12,995 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/pyez_rpc.py | from typing import Dict
from nornir.core.task import Result, Task
from nornir_pyez.plugins.connections import CONNECTION_NAME
def pyez_rpc(
task: Task,
func: str,
extras: Dict = None,
) -> Result:
device = task.host.get_connection(CONNECTION_NAME, task.nornir.config)
function = getattr(device.rpc... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
12,996 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/pyez_config.py | import copy
from typing import Any, Dict, List, Optional
from jnpr.junos.utils.config import Config
from nornir.core.task import Result, Task
from nornir_pyez.plugins.connections import CONNECTION_NAME
def pyez_config(
task: Task,
payload: str = None,
update: bool = False,
data_format: str = 'text',
... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
12,997 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/pyez_route_info.py | import copy
from typing import Any, Dict, List, Optional
from nornir.core.task import Result, Task
from nornir_pyez.plugins.connections import CONNECTION_NAME
from lxml import etree
import xmltodict
import json
def pyez_route_info(
task: Task,
) -> Result:
device = task.host.get_connection(CONNECTION_NAME, t... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
12,998 | johnrdowson/nornir_pyez | refs/heads/main | /Tests/replace_config.py | from nornir_pyez.plugins.tasks import pyez_config
import os
from nornir import InitNornir
from nornir_utils.plugins.functions import print_result
from rich import print
from nornir.core.plugins.connections import ConnectionPluginRegister
from nornir_pyez.plugins.connections import Pyez
ConnectionPluginRegister.regist... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
12,999 | johnrdowson/nornir_pyez | refs/heads/main | /Tests/config_tester.py | from nornir_pyez.plugins.tasks import pyez_config
import os
from nornir import InitNornir
from nornir_utils.plugins.functions import print_result
from rich import print
from nornir.core.plugins.connections import ConnectionPluginRegister
from nornir_pyez.plugins.connections import Pyez
ConnectionPluginRegister.regist... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,000 | johnrdowson/nornir_pyez | refs/heads/main | /Tests/rpc_test.py | from nornir_pyez.plugins.tasks import pyez_rpc
import os
from nornir import InitNornir
from nornir_utils.plugins.functions import print_result
from rich import print
from nornir.core.plugins.connections import ConnectionPluginRegister
from nornir_pyez.plugins.connections import Pyez
ConnectionPluginRegister.register(... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,001 | johnrdowson/nornir_pyez | refs/heads/main | /Tests/template_config.py | from nornir_pyez.plugins.tasks import pyez_config, pyez_diff, pyez_commit
import os
from nornir import InitNornir
from nornir.core.task import Task, Result
from nornir_utils.plugins.functions import print_result
from nornir_utils.plugins.tasks.data import load_yaml
from rich import print
from nornir.core.plugins.connec... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,002 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/pyez_commit.py | from jnpr.junos.utils.config import Config
from nornir.core.task import Result, Task
from nornir_pyez.plugins.connections import CONNECTION_NAME
def pyez_commit(
task: Task,
) -> Result:
device = task.host.get_connection(CONNECTION_NAME, task.nornir.config)
device.timeout = 300
config = Config(device... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,003 | johnrdowson/nornir_pyez | refs/heads/main | /setup.py | import setuptools
with open('README.md', 'r') as file:
long_description = file.read()
with open("requirements.txt", "r") as f:
INSTALL_REQUIRES = f.read().splitlines()
setuptools.setup(name='nornir_pyez',
version='0.0.10',
description='PyEZs library and plugins for Nornir',
... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,004 | johnrdowson/nornir_pyez | refs/heads/main | /Tests/fulltest.py | from nornir_pyez.plugins.tasks import pyez_config, pyez_diff, pyez_commit
import os
from nornir import InitNornir
from nornir_utils.plugins.functions import print_result
from rich import print
from nornir.core.plugins.connections import ConnectionPluginRegister
from nornir_pyez.plugins.connections import Pyez
Connect... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,005 | johnrdowson/nornir_pyez | refs/heads/main | /Tests/getconfig.py | from nornir_pyez.plugins.tasks import pyez_get_config
import os
from nornir import InitNornir
from nornir_utils.plugins.functions import print_result
from rich import print
from nornir.core.plugins.connections import ConnectionPluginRegister
from nornir_pyez.plugins.connections import Pyez
ConnectionPluginRegister.re... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,006 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/connections/__init__.py | from typing import Any, Dict, Optional
from jnpr.junos import Device
from nornir.core.configuration import Config
CONNECTION_NAME = "pyez"
class Pyez:
def open(
self,
hostname: Optional[str],
username: Optional[str],
password: Optional[str],
port: Optional[int],
... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,007 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/pyez_facts.py | import copy
from typing import Any, Dict, List, Optional
from nornir.core.task import Result, Task
from nornir_pyez.plugins.connections import CONNECTION_NAME
def pyez_facts(
task: Task,
) -> Result:
device = task.host.get_connection(CONNECTION_NAME, task.nornir.config)
result = device.facts
return ... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,008 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/pyez_sec_nat.py | import copy
from typing import Any, Dict, List, Optional
from nornir.core.task import Result, Task
from nornir_pyez.plugins.connections import CONNECTION_NAME
from lxml import etree
import xmltodict
import json
def pyez_sec_nat_dest(
task: Task,
rule: str = None
) -> Result:
device = task.host.get_connec... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,009 | johnrdowson/nornir_pyez | refs/heads/main | /nornir_pyez/plugins/tasks/pyez_diff.py | import copy
from typing import Any, Dict, List, Optional
from jnpr.junos.utils.config import Config
from nornir.core.task import Result, Task
from nornir_pyez.plugins.connections import CONNECTION_NAME
def pyez_diff(
task: Task
) -> Result:
device = task.host.get_connection(CONNECTION_NAME, task.nornir.conf... | {"/nornir_pyez/plugins/tasks/pyez_get_config.py": ["/nornir_pyez/plugins/connections/__init__.py"], "/nornir_pyez/plugins/tasks/__init__.py": ["/nornir_pyez/plugins/tasks/pyez_facts.py", "/nornir_pyez/plugins/tasks/pyez_config.py", "/nornir_pyez/plugins/tasks/pyez_get_config.py", "/nornir_pyez/plugins/tasks/pyez_commit... |
13,017 | pinaki-das-sage/assignments | refs/heads/main | /assignment9.py | import pandas as pd
from flask import render_template
import numpy as np
import plotly.express as px
import plotly
import json
from sklearn.model_selection import train_test_split
from customutils import CustomUtils
class Assignment9:
@staticmethod
def binary_map(x):
return x.map({'Yes': 1, "No": 0})... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,018 | pinaki-das-sage/assignments | refs/heads/main | /customutils.py | from sklearn import tree
import pydotplus
import base64
from IPython.display import Image
import os
from pathlib import Path
import pandas as pd
class CustomUtils:
@staticmethod
def get_base64_encoded_image(decision_tree, columns):
dot_data = tree.export_graphviz(decision_tree, out_file=None, feature_... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,019 | pinaki-das-sage/assignments | refs/heads/main | /assignment10.py | from flask import render_template
from flask import request
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn import metrics
from customutils import CustomUtils
class Assignment10:
@staticmethod
def gender_map(x):
... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,020 | pinaki-das-sage/assignments | refs/heads/main | /assignment16.py | from flask import render_template
import pandas as pd
import numpy as np
from ast import literal_eval
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import linear_kernel
from customutils import CustomUtils
import warnings; warnings.simplefilter('ignore')
class Assignment16:
... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,021 | pinaki-das-sage/assignments | refs/heads/main | /assignment17.py | from flask import render_template
import numpy as np
import pandas as pd
import statsmodels.api as sm
import plotly.express as px
import plotly
import json
from customutils import CustomUtils
import warnings; warnings.simplefilter('ignore')
class Assignment17:
@staticmethod
def process():
df = Custom... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,022 | pinaki-das-sage/assignments | refs/heads/main | /assignment12.py | from flask import render_template
import plotly.express as px
import plotly
import json
from sklearn.model_selection import train_test_split
from sklearn import tree
from customutils import CustomUtils
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import accuracy_score, confusion_matrix, classific... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,023 | pinaki-das-sage/assignments | refs/heads/main | /assignment11.py | from flask import render_template
import plotly.express as px
import plotly
import pandas as pd
import json
from sklearn.model_selection import train_test_split
from sklearn import tree
from customutils import CustomUtils
class Assignment11:
@staticmethod
def process():
bank = CustomUtils.read_file_an... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,024 | pinaki-das-sage/assignments | refs/heads/main | /assignment5.py | import os
from pathlib import Path
import pandas as pd
from flask import render_template
import plotly.express as px
import plotly
import json
class Assignment5:
movies = None
def __init__(self):
filename = os.path.join(Path(__file__).parent, 'data', '5_imdb_top_1000.csv')
self.movies = pd.r... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,025 | pinaki-das-sage/assignments | refs/heads/main | /app.py | import os
from flask import Flask, render_template
import pandas as pd
from assignment5 import Assignment5
from assignment9 import Assignment9
from assignment10 import Assignment10
from assignment11 import Assignment11
from assignment12 import Assignment12
from assignment16 import Assignment16
from assignment17 impor... | {"/assignment9.py": ["/customutils.py"], "/assignment10.py": ["/customutils.py"], "/assignment16.py": ["/customutils.py"], "/assignment17.py": ["/customutils.py"], "/assignment12.py": ["/customutils.py"], "/assignment11.py": ["/customutils.py"], "/app.py": ["/assignment5.py", "/assignment9.py", "/assignment10.py", "/as... |
13,033 | gouemoolaf28/growth_agency_articles | refs/heads/master | /maddyness/spiders/articles.py | import scrapy
from scrapy.loader import ItemLoader
from ..items import MaddynessItem
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class ArticlesSpider(CrawlSpider):
name = 'articles'
allowed_domains = ['maddyness.com']
start_urls = ['http://www.maddyness.com... | {"/maddyness/spiders/articles.py": ["/maddyness/items.py"]} |
13,034 | gouemoolaf28/growth_agency_articles | refs/heads/master | /maddyness/items.py | # Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy.loader.processors import TakeFirst
class MaddynessItem(scrapy.Item):
company_name = scrapy.Field(
output_processor=TakeFirst()
)
site_url = scr... | {"/maddyness/spiders/articles.py": ["/maddyness/items.py"]} |
13,035 | gouemoolaf28/growth_agency_articles | refs/heads/master | /maddyness/pipelines.py | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
# from itemadapter import ItemAdapter
# import logging
# import gspread
# import s... | {"/maddyness/spiders/articles.py": ["/maddyness/items.py"]} |
13,036 | gyan42/pyspark-learning-ground | refs/heads/master | /test_driven_developement/src/solved.py | class MovingAverage:
spark = None
stockPriceInputDir = None
size = 0
def __init__(self, spark, stockPriceInputDir, size):
self.spark = spark
self.stockPriceInputDir = stockPriceInputDir
self.size = size
def calculate(self):
pass
class MovingAverageWithStockInfo:
... | {"/test_driven_developement/src/__init__.py": ["/test_driven_developement/src/solved.py"]} |
13,037 | gyan42/pyspark-learning-ground | refs/heads/master | /test_driven_developement/src/__init__.py | from .solved import MovingAverage,MovingAverageWithStockInfo | {"/test_driven_developement/src/__init__.py": ["/test_driven_developement/src/solved.py"]} |
13,069 | KirtishS/MySustainableEarth | refs/heads/main | /graphs/glaciers_oil_areas.py | from plotly.subplots import make_subplots
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from data.source import clean_greenhouse, clean_surface_area, clean_agriculture_area, \
clean_oil_production, clean_glaciers, clean_forest_area, temperature_glaciers
def... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,070 | KirtishS/MySustainableEarth | refs/heads/main | /dashboard_components/glaciers_oil_areas_dash.py | from pathlib import Path
from typing import Tuple
import dash
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from dash.dependencies import Output, Input, State
from matplotlib.widgets import Button, Slider
import dash_core_components... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,071 | KirtishS/MySustainableEarth | refs/heads/main | /dashboard_components/emissions.py | from pathlib import Path
from typing import Tuple
import dash
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from dash.dependencies import Output, Input, State
from matplotlib.widgets import Button, Slider
import dash_core_components... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,072 | KirtishS/MySustainableEarth | refs/heads/main | /ml_models/prediction.py | from ml_models.glacier_model import Glacier_Models
from ml_models.sea_level_model import Sea_Level_Models
from ml_models.temperature_model import Temperature_Models
def sea_level_prediction(temperature):
# print(temperature, "sea_level_prediction")
poly_linear_regressor = Sea_Level_Models.get_sea_level_model(... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,073 | KirtishS/MySustainableEarth | refs/heads/main | /renewable.py | from dash import html
import dash_bootstrap_components as dbc
def renewables_tab(app):
tab1 = dbc.Card(
dbc.CardBody([
dbc.Row(
dbc.Card(
[
html.Iframe(src="https://www.youtube.com/embed/lNQmwWFwiiQ",title="YouTube video playe... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,074 | KirtishS/MySustainableEarth | refs/heads/main | /data/source.py | from pathlib import Path
import pandas as pd
def read_dataset(path: Path) -> pd.DataFrame:
if path.exists():
df = pd.read_csv(path)
return df
def get_electricity_and_population_info():
df = read_dataset(Path('.', 'data', 'csv_files', 'electricity_and_population_info.csv'))
return df
de... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,075 | KirtishS/MySustainableEarth | refs/heads/main | /ml_models/sea_level_model.py | from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from data.source import sea_level_vs_temperature
class Sea_Level_Models:
__sea_level_model = None
__sea_level_poly_regressor = None
@staticmethod
def get_sea_level_model():
if Sea_Level_Mod... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,076 | KirtishS/MySustainableEarth | refs/heads/main | /ml_models/glacier_model.py | from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from data.source import glaciers_vs_temperature
class Glacier_Models:
__glaciers_model = None
__glaciers_poly_regressor = None
@staticmethod
def get_glaciers_model():
if Glacier_Models.__gl... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,077 | KirtishS/MySustainableEarth | refs/heads/main | /graphs/sea_level_model.py | import plotly.graph_objects as go
from data.source import sea_level_vs_temperature
from ml_models.prediction import sea_level_prediction
def sea_level_vs_temperature_model_info():
df = sea_level_vs_temperature()
temperatures_list = df.iloc[:, :-1].values
fig = go.Figure()
fig.add_trace(go.Scatter(x=... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,078 | KirtishS/MySustainableEarth | refs/heads/main | /graphs/emissions.py | from pathlib import Path
from typing import Tuple
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from plotly.subplots import make_subplots
from matplotlib.widgets import Button, Slider
from data.source import *
def emissions_chart(country_name):
df = get_all... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,079 | KirtishS/MySustainableEarth | refs/heads/main | /main.py | import dash
from dash.dependencies import Output, Input
from dash import dcc
from dash import html
import dash_bootstrap_components as dbc
from dashboard_components.population_vs_electricity_section import population_vs_electricity_section
from dashboard_components.glaciers_oil_areas_dash import glacier_and_oil_impac... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,080 | KirtishS/MySustainableEarth | refs/heads/main | /graphs/sea_level_vs_glacier_melt.py | import plotly.graph_objects as go
from data.source import *
# Sea level vs Glacier melt ( 1. Options button, 2. year_range )
def plot_sea_level_vs_glacier_temp(option, start_year, end_year):
df_sea = get_sea_level()
years = []
f_year = start_year
years.append(f_year)
while f_year != end_year:
... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,081 | KirtishS/MySustainableEarth | refs/heads/main | /graphs/glaciers_model.py | import plotly.graph_objects as go
from data.source import glaciers_vs_temperature
from ml_models.prediction import glacier_prediction
def glacier_vs_temperature_model_info():
df = glaciers_vs_temperature()
temperatures_list = df.iloc[:, :-1].values
# print(df)
fig = go.Figure()
fig.add_trace(go.S... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,082 | KirtishS/MySustainableEarth | refs/heads/main | /non_renewable.py | from dash import html
import dash_bootstrap_components as dbc
def coal_tab(app):
tab1 = dbc.Card(
dbc.CardBody([
dbc.Row(
dbc.Card(
[
html.Iframe(src="https://www.youtube.com/embed/JONcq3KPsQo",title="YouTube video player",hei... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,083 | KirtishS/MySustainableEarth | refs/heads/main | /dashboard_components/catastrophe_section.py | from dash.dependencies import Output, Input, State
from matplotlib.widgets import Button, Slider
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import numpy as np
from data.source import get_temperature, get_glaciers, get_drought, get_deforestation, get_fl... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,084 | KirtishS/MySustainableEarth | refs/heads/main | /dashboard_components/machine_learning_section.py | from pathlib import Path
from typing import Tuple
import dash
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from dash.dependencies import Output, Input, State
from matplotlib.widgets import Button, Slider
import dash_core_components... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,085 | KirtishS/MySustainableEarth | refs/heads/main | /ml_models/temperature_model.py | from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from data.source import get_temp_greenhouse_carbon_forest
class Temperature_Models:
__temperature_model = None
@staticmethod
def get_temperature_model():
if Temperature_Models.__temperature_mod... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,086 | KirtishS/MySustainableEarth | refs/heads/main | /dashboard_components/population_vs_electricity_section.py | from pathlib import Path
from typing import Tuple
import dash
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from dash.dependencies import Output, Input, State
from matplotlib.widgets import Button, Slider
import dash_core_components... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,087 | KirtishS/MySustainableEarth | refs/heads/main | /graphs/flood_drought_storm_vs_temp_deforest_greenhouse.py | import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from plotly.subplots import make_subplots
from data.source import *
# Option:1 Map Structure
def plot_map_for_drought_storm_flood(type_of_catastrophe, country):
if type_of_catastrophe == 'Drought':
df_drought = get_drought... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,088 | KirtishS/MySustainableEarth | refs/heads/main | /graphs/population_vs_electricity_graphs.py | from pathlib import Path
from typing import Tuple
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from matplotlib.widgets import Button, Slider
from data.source import get_electricity_and_population_info
def renewable_vs_non_renewable_electricity(co... | {"/graphs/glaciers_oil_areas.py": ["/data/source.py"], "/dashboard_components/glaciers_oil_areas_dash.py": ["/graphs/population_vs_electricity_graphs.py", "/graphs/glaciers_oil_areas.py"], "/dashboard_components/emissions.py": ["/graphs/emissions.py"], "/ml_models/prediction.py": ["/ml_models/glacier_model.py", "/ml_mo... |
13,090 | rti/poodle-backend-django | refs/heads/main | /app/models.py | from django.db import models
class Query(models.Model):
name = models.CharField(max_length=512)
def __str__(self):
return self.name
def choices(self):
return [choice for option in self.options.all()
for choice in option.choices.all()]
class Meta:
verbose_name... | {"/app/tests.py": ["/app/models.py"], "/app/views.py": ["/app/serializers.py", "/app/models.py"], "/app/admin.py": ["/app/models.py"], "/app/serializers.py": ["/app/models.py"]} |
13,091 | rti/poodle-backend-django | refs/heads/main | /app/tests.py | from datetime import date, time
from django.contrib.auth.models import User
from django.db import utils
from django.test import TestCase
from re import match
from rest_framework import status
from rest_framework.test import APITestCase
from app.models import Query, Option, Attendee, Choice
class ModelRelationsTest(T... | {"/app/tests.py": ["/app/models.py"], "/app/views.py": ["/app/serializers.py", "/app/models.py"], "/app/admin.py": ["/app/models.py"], "/app/serializers.py": ["/app/models.py"]} |
13,092 | rti/poodle-backend-django | refs/heads/main | /app/views.py | from rest_framework import viewsets, mixins # , permissions
from .serializers import QuerySerializer, OptionSerializer, ChoiceSerializer, AttendeeSerializer
from .models import Query, Option, Choice, Attendee
class QueryViewSet(mixins.CreateModelMixin,
mixins.RetrieveModelMixin,
... | {"/app/tests.py": ["/app/models.py"], "/app/views.py": ["/app/serializers.py", "/app/models.py"], "/app/admin.py": ["/app/models.py"], "/app/serializers.py": ["/app/models.py"]} |
13,093 | rti/poodle-backend-django | refs/heads/main | /app/admin.py | from django.contrib import admin
from .models import Query, Option, Attendee, Choice
class OptionInline(admin.StackedInline):
model = Option
extra = 1
@admin.register(Query)
class QueryAdmin(admin.ModelAdmin):
search_fields = ['title']
inlines = [OptionInline]
@admin.register(Attendee)
class Atte... | {"/app/tests.py": ["/app/models.py"], "/app/views.py": ["/app/serializers.py", "/app/models.py"], "/app/admin.py": ["/app/models.py"], "/app/serializers.py": ["/app/models.py"]} |
13,094 | rti/poodle-backend-django | refs/heads/main | /app/urls.py | from django.urls import include, path
from rest_framework import routers
from rest_framework.authtoken import views as authtoken_views
from . import views as app_views
router = routers.DefaultRouter()
router.register('queries', app_views.QueryViewSet)
router.register('options', app_views.OptionViewSet)
router.register... | {"/app/tests.py": ["/app/models.py"], "/app/views.py": ["/app/serializers.py", "/app/models.py"], "/app/admin.py": ["/app/models.py"], "/app/serializers.py": ["/app/models.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.