index
int64
repo_name
string
branch_name
string
path
string
content
string
import_graph
string
95,596
WHILL/pywhill
refs/heads/master
/whill/whill_packet.py
#!/usr/bin/env python3 # whill_packet # Copyright (c) 2018 WHILL, Inc. # This software is released under the MIT License. def calc_time_diff(past, current): diff = current - past if abs(diff) >= 100: diff = (201 - past) + current return diff def s8(value): return -(value & 0b10000000) | (va...
{"/whill/__init__.py": ["/whill/whill.py"], "/example/cr_example5_hold_joy.py": ["/whill/__init__.py"], "/example/cr_example1_joy.py": ["/whill/__init__.py"], "/example/cr_example6_copy_speed_profile.py": ["/whill/__init__.py"], "/example/cr_example4_blink_power.py": ["/whill/__init__.py"], "/example/cr_example3_callba...
95,597
WHILL/pywhill
refs/heads/master
/example/cr_example1_joy.py
#!/usr/bin/env python3 # whill module example package # Copyright (c) 2018 WHILL, Inc. # This software is released under the MIT License. import time from whill import ComWHILL whill = ComWHILL(port='COM4') while True: whill.send_joystick(int(10), int(0)) time.sleep(1)
{"/whill/__init__.py": ["/whill/whill.py"], "/example/cr_example5_hold_joy.py": ["/whill/__init__.py"], "/example/cr_example1_joy.py": ["/whill/__init__.py"], "/example/cr_example6_copy_speed_profile.py": ["/whill/__init__.py"], "/example/cr_example4_blink_power.py": ["/whill/__init__.py"], "/example/cr_example3_callba...
95,598
WHILL/pywhill
refs/heads/master
/example/cr_example6_copy_speed_profile.py
#!/usr/bin/env python3 # whill module example package # Copyright (c) 2018 WHILL, Inc. # This software is released under the MIT License. import time from whill import ComWHILL whill = ComWHILL(port='COM6') request_speed_mode = 0 while True: for request_speed_mode in range(6): whill.start_data_stream(750...
{"/whill/__init__.py": ["/whill/whill.py"], "/example/cr_example5_hold_joy.py": ["/whill/__init__.py"], "/example/cr_example1_joy.py": ["/whill/__init__.py"], "/example/cr_example6_copy_speed_profile.py": ["/whill/__init__.py"], "/example/cr_example4_blink_power.py": ["/whill/__init__.py"], "/example/cr_example3_callba...
95,599
WHILL/pywhill
refs/heads/master
/example/cr_example4_blink_power.py
#!/usr/bin/env python3 # whill module example package # Copyright (c) 2018 WHILL, Inc. # This software is released under the MIT License. import time from whill import ComWHILL def power_on_callback(): print('WHILL wakes up') def main(): whill = ComWHILL(port='/dev/ttyUSB0') whill.register_callback('pow...
{"/whill/__init__.py": ["/whill/whill.py"], "/example/cr_example5_hold_joy.py": ["/whill/__init__.py"], "/example/cr_example1_joy.py": ["/whill/__init__.py"], "/example/cr_example6_copy_speed_profile.py": ["/whill/__init__.py"], "/example/cr_example4_blink_power.py": ["/whill/__init__.py"], "/example/cr_example3_callba...
95,600
WHILL/pywhill
refs/heads/master
/example/cr_example3_callback.py
#!/usr/bin/env python3 # whill module example package # Copyright (c) 2018 WHILL, Inc. # This software is released under the MIT License. import time from whill import ComWHILL request_speed_mode = 0 whill = ComWHILL(port='COM4') def callback0(): global request_speed_mode, whill print('callback 0') pri...
{"/whill/__init__.py": ["/whill/whill.py"], "/example/cr_example5_hold_joy.py": ["/whill/__init__.py"], "/example/cr_example1_joy.py": ["/whill/__init__.py"], "/example/cr_example6_copy_speed_profile.py": ["/whill/__init__.py"], "/example/cr_example4_blink_power.py": ["/whill/__init__.py"], "/example/cr_example3_callba...
95,601
WHILL/pywhill
refs/heads/master
/example/cr_example2_data.py
#!/usr/bin/env python3 # whill module example package # Copyright (c) 2018 WHILL, Inc. # This software is released under the MIT License. import time from whill import ComWHILL whill = ComWHILL(port='COM4') request_speed_mode = 0 whill.start_data_stream(1000, 0, request_speed_mode) while True: time.sleep(1) ...
{"/whill/__init__.py": ["/whill/whill.py"], "/example/cr_example5_hold_joy.py": ["/whill/__init__.py"], "/example/cr_example1_joy.py": ["/whill/__init__.py"], "/example/cr_example6_copy_speed_profile.py": ["/whill/__init__.py"], "/example/cr_example4_blink_power.py": ["/whill/__init__.py"], "/example/cr_example3_callba...
95,602
WHILL/pywhill
refs/heads/master
/whill/whill.py
#!/usr/bin/env python3 # whill # Copyright (c) 2018 WHILL, Inc. # This software is released under the MIT License. import serial import threading import time from enum import IntEnum, auto from . import whill_data as wd from . import whill_packet as wp class ComWHILL(): class CommandID(IntEnum): START ...
{"/whill/__init__.py": ["/whill/whill.py"], "/example/cr_example5_hold_joy.py": ["/whill/__init__.py"], "/example/cr_example1_joy.py": ["/whill/__init__.py"], "/example/cr_example6_copy_speed_profile.py": ["/whill/__init__.py"], "/example/cr_example4_blink_power.py": ["/whill/__init__.py"], "/example/cr_example3_callba...
95,685
tanishq1010/learn
refs/heads/main
/practice2/check_grade_by_video_id.py
import os import csv import json import string import random import requests import sys import ast import pandas as pd class Source(object): def __init__(self): super(Source, self).__init__() self.headers = { 'Connection': 'keep-alive', 'Accept': '*/*', 'Authori...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,686
tanishq1010/learn
refs/heads/main
/miscellaneous.py
import pandas as pd from check_grade_by_video_id import check_grade_by_video_id # import pandas as pd from check_grade_by_book_id import check_grade_by_book_id from check_chapter_by_chapter_id import chapter_correctly_present def comparator(name1, name2): df1 = pd.read_csv(name1) # df1=df[df['Grades'].str.con...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,687
tanishq1010/learn
refs/heads/main
/home_data_continue_learning.py
import requests import pandas as pd import json class Source(object): def __init__(self): super(Source, self).__init__() self.headers = { 'Connection': 'keep-alive', 'Accept': '*/*', 'Content-Type': 'application/json; charset=UTF-8', } self.host...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,688
tanishq1010/learn
refs/heads/main
/check_chapter_by_chapter_id.py
import pandas as pd def get_chapter_of_exam(exam,df1): return df1[df1['Exam'].str.contains(exam)] def chapter_correctly_present(exam,id): df=pd.read_csv("chapter_data.csv") df = df.loc[df["Chapter Id"] == id] # print(df) if len(df) == 0: return "NA" else: df = get_chapter...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,689
tanishq1010/learn
refs/heads/main
/check_grade_by_book_id.py
import os import csv import json import string import random import requests import sys import pandas as pd from openpyxl import Workbook, load_workbook import ast class Source(object): def __init__(self): super(Source, self).__init__() self.headers = { 'Connection': 'keep-alive', ...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,690
tanishq1010/learn
refs/heads/main
/master.py
from goal_exam_extractor import goal_exam_grade_extractor from home_data_extractor import home_data import pandas as pd from login_sign_up import * from miscellaneous import * from hero_banner_repetition_check import main # from home_data_continue_learning import home_data def for_all_exam_goal(goal_exam_grade): ...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,691
tanishq1010/learn
refs/heads/main
/learn2/home_data_extractor.py
import requests import pandas as pd import json import random from openpyxl import Workbook, load_workbook from miscellaneous import * from subject_data_extractor import subject_data_extractor class Source(object): def __init__(self): super(Source, self).__init__() self.headers = { 'C...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,692
tanishq1010/learn
refs/heads/main
/learn2/master.py
from goal_exam_extractor import goal_exam_grade_extractor from home_data_extractor import home_data import pandas as pd from login_sign_up import * from miscellaneous import * from hero_banner_repetition_check import main from home_data_extractor_video_sequence import home_data1 # from home_data_continue_learning imp...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,693
tanishq1010/learn
refs/heads/main
/learn2/subject_data_extractor_video_sequence.py
import requests import pandas as pd import json from openpyxl import Workbook, load_workbook # from miscellaneous import * class Source(object): def __init__(self): super(Source, self).__init__() self.headers = { 'Connection': 'keep-alive', 'Accept': '*/*', 'Con...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,694
tanishq1010/learn
refs/heads/main
/master_continue_learning.py
from home_data_continue_learning import home_data import pandas as pd if __name__ == '__main__': df = pd.DataFrame(columns=['Child_ID', 'Exam', 'Goal', "Grade",'Type', 'Id', "Title", "Subject", "Subject_tagged"]) df.to_csv("continue_learning.csv") df1=pd.read_csv("actual_continue_learning.csv") hom...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,695
tanishq1010/learn
refs/heads/main
/hero_banner_repetition_check.py
import os import csv import json import string import random import requests import sys import traceback import multiprocessing import pandas as pd import ast class Source(object): def __init__(self): super(Source, self).__init__() self.headers = { 'Connection': 'keep-alive', ...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,696
tanishq1010/learn
refs/heads/main
/learn2/subject_data_extractor.py
import requests import pandas as pd import json from openpyxl import Workbook, load_workbook from miscellaneous import * import random class Source(object): def __init__(self): super(Source, self).__init__() self.headers = { 'Connection': 'keep-alive', 'Accept': '*/*', ...
{"/miscellaneous.py": ["/check_grade_by_book_id.py", "/check_chapter_by_chapter_id.py"], "/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/learn2/home_data_extractor.py": ["/miscellaneous.py"], "/learn2/master.py": ["/miscellaneous.py", "/hero_banner_repetition_check.py"], "/master_continue_lea...
95,706
hazel-nut-old/euler-python
refs/heads/master
/helper.py
from math import sqrt def gcd(a, b): return a if b == 0 else gcd(b, a % b) def lcm(a, b): return (a * b) / gcd(a, b) def is_palindrome(num): digits = str(num) for i in range(len(digits) / 2): if digits[i] != digits[len(digits) - 1 - i]: return False return True def get_factor...
{"/p1to10.py": ["/helper.py"], "/euler.py": ["/helper.py"]}
95,707
hazel-nut-old/euler-python
refs/heads/master
/p1to10.py
from math import log import constants import helper def problem_1(): """Find the sum of all the multiples of 3 or 5 below 1000.""" return sum([i for i in range(1000) if i % 3 == 0 or i % 5 == 0]) def problem_2(): """By considering the terms in the Fibonacci sequence whose values do not exceed four mi...
{"/p1to10.py": ["/helper.py"], "/euler.py": ["/helper.py"]}
95,708
hazel-nut-old/euler-python
refs/heads/master
/euler.py
import math import constants import helper # TODO: Figure out a less gross way of doing problem 11. def get_coords_11(row, col, d): c = [(row, col)] if d == 'up': c += [(row - 1, col), (row - 2, col), (row - 3, col)] elif d == 'down': c += [(row + 1, col), (row + 2, col), (row + 3, col)] ...
{"/p1to10.py": ["/helper.py"], "/euler.py": ["/helper.py"]}
95,791
Rida97/PythonCode
refs/heads/master
/geekforgeeks2.py
from __future__ import print_function # id() function is used to return the identity of an object. # Python3 program to show that # both string hold same identity # string1 and string2 both point to same object or same location ''' string1 = "Hello" string2 = "Hello" print(id(string1)) print(id(string2)) ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,792
Rida97/PythonCode
refs/heads/master
/user.py
# EX 9.3 & 9.5 class user(): def __init__(self, name, *user): self.name = name self.user = user self.login_attempts = 0 def print_loginAttempts(self): print(str(self.login_attempts) , ' Login Attempts were made') def increment_loginAtempts(self): self.l...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,793
Rida97/PythonCode
refs/heads/master
/DictKeySort.py
from operator import itemgetter users = [ {'f_name': 'Tom', 'l_name': 'Roberts'}, {'f_name': 'Tom', 'l_name': 'William'}, {'f_name': 'Tom', 'l_name': 'Jones'}, ] for user in sorted(users,key=itemgetter('f_name')): print(user) print('+++++++++++++++++++++++++++++++++++++++++++++++++++...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,794
Rida97/PythonCode
refs/heads/master
/mysirg.py
# program to print N prime numbers. # 2,3,5,7,11,...12/(2) = 6 def prime_no(Num): list_num = [] n = 3 for i in range(2,Num): # 2,3,4,5 if n % (i - 1) == 0: print('non prime no: ', i) n += 1 else: print('prime no :', i) list_num.appen...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,795
Rida97/PythonCode
refs/heads/master
/pract.py
from collections import Counter,OrderedDict def QuestionsMarks(s): a, b = 0, 0 for i in range(len(s)-1): for j in range(i, len(s)): if s[i].isdigit() and s[j].isdigit() and int(s[i]) + int(s[j]) == 10: a, b = i, j new = s[a+1:b+1] if new.count('?') == 3: ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,796
Rida97/PythonCode
refs/heads/master
/pract2.py
def solve(numheads,numlegs): ns='No solutions!' for i in range(numheads+1): j=numheads-i print(i, j) if 2*i + 4*j == numlegs: print(i, j) return i, j return ns,ns numheads=35 numlegs=94 solutions=solve(numheads,numlegs) print(solutions)
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,797
Rida97/PythonCode
refs/heads/master
/UseModules.py
from modules import * # from modules import print_name - you can do this too for all the fumctions you want ot include name = input(' Enter name: ') #print(print_name(name)) -- this was returning none ! print_name(name) # print name ka kaam hi print karna hai idiot !!! List_passed = make_a...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,798
Rida97/PythonCode
refs/heads/master
/break.py
# print all the multiples of 6 or the table of 6 ! # break is used when we want to exit the loop as soon as the desired condition is met and we dont want # to loop through all the other items for num in range(6,43): if num % 6 == 0: print(num) break # printing only 6 ! ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,799
Rida97/PythonCode
refs/heads/master
/questionClass.py
# by creating a class we are creating a data type # A Questons CLASS TELLS YOU What a Question is, what it is consist of ! class Questions: def __init__(self, ques, ans): # here we are passing the attributes of the OBJECT through an initialize function self.ques = ques # self is referr...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,800
Rida97/PythonCode
refs/heads/master
/ex_7_8.py
# For a program that should run only as long as many conditions are true, # you can define one variable that determines whether or not the entire program # is active. # A loop that starts with while True u will run forever unless it reaches a # break statement. active = True lives = 2 # This prog will keep ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,801
Rida97/PythonCode
refs/heads/master
/tk_tut.py
"""" Street Fighter: Ryu punches Ken. By David, 2017 Rafeh Qazi made it work ;) """ import tkinter as tk class Fighter: def __init__(self, name): self.name = name self.health = 100 self.damage = 10 # function for one fighter to attack another def attack(self, othe...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,802
Rida97/PythonCode
refs/heads/master
/Dictionaries.py
import json # To execlude repition in ditionaries use set(), to sort the list alphabetically use sorted(): # set(stones.keys()) , sorted(stones.values) stones = { 'Ruby' : 'red', 'Emerald': 'green', 'Topaz' : 'yellow', } print('Stones: ') for eachKey, eachValue in stones.items(): print(e...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,803
Rida97/PythonCode
refs/heads/master
/ex_9.py
# from the (name of the file) import the (class) you want from resturant import Resturant, IceCreamStand from user import user, Admin my_resturant = Resturant('Kababjees', 'Continental') print(' Name of My Resturant is : ' + my_resturant.name.title()) print(' Cuisine type of my Resturant is : ' + my_restu...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,804
Rida97/PythonCode
refs/heads/master
/buckytt.py
# lambda # they are one time use small functions # they are used in tkinter. for ex with buttons to give special functionality to it. every button would a specific task # to be done (not over and over again) so for 1 time use you must use lambda & for over and over again use,use functions # in ans we return the v...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,805
Rida97/PythonCode
refs/heads/master
/PersonTeacher.py
# this example is to show that how we can create a Child class that is exactly same as its parent class. # if a child does not have any of the SPECIFICATIONS of its own then we csn use "pass" inside the child class # that will create child class object with all the attributes/methods of parent class from PersonC...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,806
Rida97/PythonCode
refs/heads/master
/file_4.py
# List Slicing # Reverse a string string = "araS adiR" string = string[::-1] # [start : stop : step ] [::] -> by default start at 0 go till the end , then step -1 print(string) my_name = string[0:4] print(my_name) greet = 'Hello' # 5 digits print(greet[0:4]) # Hell 0,1,2,3 (4-1 = 3) print(gre...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,807
Rida97/PythonCode
refs/heads/master
/ex_8.py
# Functions : def book(title): print(' My favourite book is : ', title) book('Harry Potter') book('Charlie and the Chocolate Factory') book('Angels and Demons') def make_shirts(size = 'large',msg=' I love PYTHON !'): print(' Size of your shirt is: ' + size + ' and msg to be printed is : ' + msg) m...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,808
Rida97/PythonCode
refs/heads/master
/resturant.py
class Resturant(): def __init__(self,name, cuisineType): # note that number_served is not passed in the parameters b/c it is set by default self.name = name self.cuisineType = cuisineType self.number_served = 0 # Default Value def open_restut...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,809
Rida97/PythonCode
refs/heads/master
/PersonClass.py
from StudentClass import student class Person(): def __init__(self,name,age,city,gender='Female'): self.Name = name self.Age = age self.City = city self.Gender = gender def getPerson(self): print('Name: ', self.Name + '\nAge: ', self.Age + '\nCity: '...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,810
Rida97/PythonCode
refs/heads/master
/exception.py
# print(result) it will return this : ZeroDivisionError: division by zero , ZeroDivisionError is an object num = input(' Enter any number : ') try: result = 5/int(num) # I csn enter 2,3 or 0 ! On entering any no EXCEPT zero then this try block will print(result) # ex...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,811
Rida97/PythonCode
refs/heads/master
/ex_4_5.py
# CREATING LISTS THROUGH RANGE FUNCTIONS - list_num = range(2,7) for item in list_num: print(item) numbers = list(range(1, 6)) # starts from 1 go till 6 but NOT including 6 !!! print(numbers) even = list(range(2, 9, 2)) # go from 2 till 9 , add 2 after every iteration print(ev...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,812
Rida97/PythonCode
refs/heads/master
/test_cities.py
import unittest from city_functions import City_Country class CityCountryTestCase(unittest.TestCase): def test_names_city_country(self): formatted_name = City_Country('Chicago','USA') self.assertEqual(formatted_name,'Chicago USA') unittest.main()
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,813
Rida97/PythonCode
refs/heads/master
/Privileges.py
class Privileges(): def __init__(self, List_Privileges): self.List_Privileges = List_Privileges def show_privileges(self , List_Privileges): for self.privilege in List_Privileges: print(self.privilege)
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,814
Rida97/PythonCode
refs/heads/master
/ex_1_2_3.py
from math import * names = ["ada", "Ada", "ADA", "adA", "aDA","ADa","AdA" ] for name in names: print(name.title()) # .title will make all the possibilites of the input to a standard naming convention i.e : Rida , John # now a/f using this method you dont have to wor...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,815
Rida97/PythonCode
refs/heads/master
/classes.py
from modules import print_name # classes , difference between CLASS Variables and INSTANCE variables : class Student: Class_of_Student = 5 # Class var, common att shared by all the objects def __init__(self, name, gender): # name, gender are unique attributes of all students self.nam...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,816
Rida97/PythonCode
refs/heads/master
/dgag.py
prompt = "\nEnter your age: " Active = True Exit = ' Press e for exit ' while Active: age = input(prompt) age = int(age) if age < 3: print(' You are free to go !') elif age > 12: print(' 15$ for the ticket, please ') else: print(' 10$ for the ticket, please '...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,817
Rida97/PythonCode
refs/heads/master
/Student.py
from StudentClass import Student student_1 = Student('Raju', section = 'C', grade = '6', Rollno = '45')
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,818
Rida97/PythonCode
refs/heads/master
/file_2.py
def sayhi(name,Age): # remember, def of a func is never EXECUTED untill it is CALLED ! print("hi, " + name ) x = 18 - Age; if Age > 18: print(name + " you are eligible for this test as you're" + str(Age) + " y/o" ) else: print(" Sorry, " + name + " you ar...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,819
Rida97/PythonCode
refs/heads/master
/buckyt.py
# UNpacking of a list ! # school = ['Rida Fatima',12,'C'] name, Class,section = ['Rida Fatima', 12, 'C'] # while assign variables to EACH item of the list else an error will occur print(name, Class , section) def drop_first_last(grades): first,*middle,last = grades avg = sum(middle)/len(middle) ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,820
Rida97/PythonCode
refs/heads/master
/modules.py
def print_name(name): print(name, end=' ') def make_a_list(*no): list_no = [] for n in no: list_no.append(n) return list_no def print_list(list_passed): for n in list_passed: print(n, end=' ')
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,821
Rida97/PythonCode
refs/heads/master
/user_profile.py
# There are2 ways to print the data that is passed in the ARGUMENTS : # 1st way is to just saved the data inside a dictonary and then return # the dictionary, which willbe printed out just as done on page 152 (book) # 2nd way is to saved the data inside a dic then loop through that dic instead # of RETURNING that d...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,822
Rida97/PythonCode
refs/heads/master
/StudentClass.py
class Student(): def __init__(self, name, **student_info): self.name = name # we need to unpack this invisible dict into our own handmade dict ! Info = {} Info['name'] = name for eachKey, eachValue in student_info.items(): Info[eachKey] = eachValue ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,823
Rida97/PythonCode
refs/heads/master
/geekforgeeks.py
# how to handle missing keys in a dictionary ? # way 01 : Use the get method to retrieve user inputs and put default in it # way 02: Use try except method import collections dict_name = { 'name1' : 'rida', 'name2' : 'Sara', } try: print(dict_name['name1']) # it prints rida print(dict_n...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,824
Rida97/PythonCode
refs/heads/master
/SortingObjects.py
from operator import attrgetter class User: def __init__(self, name, id): self.name = name self.userid = id def __repr__(self): # string representation of the obj --- # return a string containing a printable representa...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,825
Rida97/PythonCode
refs/heads/master
/file_3.py
iphone = True if iphone: # this condition will only execute if the cond is true print(" Expensive ") iphone_8_is_expensive = False if iphone_8_is_expensive != True: print(" expensive") motorolla = True if motorolla: print("Cheap") for index in range(3,10): pri...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,826
Rida97/PythonCode
refs/heads/master
/map.py
# from operator import add # map function # we used list and perform and task on each item of the list. and for that we used loops # for ex i have students with their total exmaination marks nd i want to calculate their percentages: # WAY 01 : using loop to get each item, more lines of code, xtra things: list,app...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,827
Rida97/PythonCode
refs/heads/master
/class.py
from questionClass import Questions from questionClass import Student Question = [ "Who is the author of ANGELS AND DEMONS ? \na) Mike Dane\nb) David CopperField\n c) Dan Brown\n\n", "What is the National Flower of Pakistan ? \na) rose \nb) jasmeen \nc) cauliflower\n\n", "How many PSLs have bee...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,828
Rida97/PythonCode
refs/heads/master
/city_input.py
from city_functions import City_Country city_name= input( ' enter city; ') country_name = input(' enter country name: ') formatted_name= City_Country(city_name, country_name) print(formatted_name)
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,829
Rida97/PythonCode
refs/heads/master
/mainProgram.py
from AdminClass import Admin, Privileges #from Privileges import Privileges from user import User #UserProfile_1 = User('Rida Fatima', 'CIS', 90, 'female') #UserProfile_2 = User('Sara Ahmed', 'BCIT', 'female', 'sara_ahmed96@gmail.com') List_Privileges = ['can do this', 'can do that'] privilege_1 = Privile...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,830
Rida97/PythonCode
refs/heads/master
/tipsAndtricksss.py
x, y = 10, 20 # 1 In-Place Swapping Of Two Numbers. x, y = y, x print(x, y) a ="GeeksForGeeks" # 02 print("Reverse is", a[::-1]) a = ["Geeks", "For", "Geeks"] # 03 print(" ".join(a)) import os; ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,831
Rida97/PythonCode
refs/heads/master
/ex_6.py
# DICTIONARIES : # dic can be used to represent an alien which is of color green, occurs at level 1 etc.. alien_o = {'color': 'green', 'position': 'north-west', 'level': 1} person = { 'first_name': 'Smith', 'last_name': 'Gold', 'age': '27', 'city': 'California', } print(person['first_na...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,832
Rida97/PythonCode
refs/heads/master
/Arguments.py
gender = "" def get_gender(gender = 'unknown'): if gender is 'm': gender= 'male' elif gender is 'f': gender = 'female' print(gender) get_gender('m') get_gender('f') get_gender() def work(noun = 'sara', verb='jumps on', item = 'bed'): print(noun, " " , verb, " ", item) ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,833
Rida97/PythonCode
refs/heads/master
/collectionClass.py
from collections import Counter # this Counter is a Class nos = [1,2,3,7,7,4,5,5,6,7,7,6,7,6,7] count = Counter(nos) # this Counter is an instance of the Counter class print(str(count) + ' : ') three_most_common = count.most_common(3) print(three_most_common)
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,834
Rida97/PythonCode
refs/heads/master
/city_functions.py
# make a function City_Country in this module def City_Country(city_name, country_name): formated_name = city_name + ' ' + country_name return formated_name
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,835
Rida97/PythonCode
refs/heads/master
/prime_num.py
for i in range(2,7): if i % 2 ==0: print(i) def is_the_no_prime(num): # 25 for i in range(2,num): # 2--24 # print('i: ', i) print(str(num) + '% ' + str(i),' = ', num % i) if num % i == 0: print(num, ' -> non prime') break else: ...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,836
Rida97/PythonCode
refs/heads/master
/signin.py
import json print(' Sign In') Filename = 'user_account.json' username = input(' Username: ') password = input(' Password: ') with open(Filename) as F_obj: for username in
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,837
Rida97/PythonCode
refs/heads/master
/jsonPractice.py
import json numbers_list = [1,2,3,4,5,6,7] # list : Temporary data structure filename = 'numberSaved.json' # EMPTY file created to save the data structure contents # using with will ensure to close the file when its not being used so we dont have wit...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,838
Rida97/PythonCode
refs/heads/master
/AdminClass.py
from user import User from Privileges import Privileges ## Here we use AN INSTANCE AS AN ATTRIBUE IN A DIFFERENT CLASS W/O INHERITANCE ! class Admin(User): def __init__(self, name, *User): # it will make an object of user class ! super().__init__(name, *User) # This line tells Pytho...
{"/UseModules.py": ["/modules.py"], "/ex_9.py": ["/resturant.py", "/user.py"], "/PersonTeacher.py": ["/PersonClass.py", "/StudentClass.py"], "/PersonClass.py": ["/StudentClass.py"], "/test_cities.py": ["/city_functions.py"], "/classes.py": ["/modules.py"], "/Student.py": ["/StudentClass.py"], "/class.py": ["/questionCl...
95,843
averdier/enigma_findmypet_backend
refs/heads/master
/app/api/serializers/subscription.py
# coding: utf-8 from flask_restplus import fields from .. import api class NullableInteger(fields.Integer): __schema_type__ = ['integer', 'null'] __schema_example__ = 'nullable integer' subscription_keys_model = api.model('Subscription keys', { 'p256dh': fields.String(required=True, description='p256dh...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,844
averdier/enigma_findmypet_backend
refs/heads/master
/app/api/parsers.py
# coding: utf-8 from flask_restplus import reqparse pet_parser = reqparse.RequestParser() pet_parser.add_argument('key', help='Start key') pet_parser.add_argument('limit', type=int, help='Items per page')
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,845
averdier/enigma_findmypet_backend
refs/heads/master
/app/api/endpoints/pet.py
# codign: utf-8 import uuid from datetime import datetime from flask import request, current_app, g from flask_restplus import Namespace, Resource, abort from pynamodb.exceptions import DoesNotExist from ..security import auth from ..serializers.pet import pet_model, pet_resource, pet_paginated_model from ..parsers im...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,846
averdier/enigma_findmypet_backend
refs/heads/master
/config.py
# coding: utf-8 import os import secrets class Config: SECRET_KEY = os.environ.get('APP_SECRET', secrets.token_urlsafe(16)) NAME = os.environ.get('APP_NAME', 'findmypet') PROVIDER_REGION = os.environ.get('PROVIDER_REGION', 'eu-central-1') AUTH_POOL = os.environ.get('AUTH_POOL', '') AUTH_CLIENT_...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,847
averdier/enigma_findmypet_backend
refs/heads/master
/app/api/endpoints/subscription.py
# coding utf-8 from flask import request, current_app, g from flask_restplus import Namespace, Resource, abort from pynamodb.exceptions import DoesNotExist, DeleteError from ..security import auth from ..serializers.subscription import subscription_item_model, subscription_model, subscription_endpoint_model from ...mo...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,848
averdier/enigma_findmypet_backend
refs/heads/master
/app/models.py
# coding: utf-8 import os from datetime import datetime from pynamodb.attributes import UnicodeAttribute, MapAttribute, NumberAttribute, UTCDateTimeAttribute from pynamodb.models import Model class Position(MapAttribute): lat = NumberAttribute(null=False) lng = NumberAttribute(null=False) class Zone(MapAttr...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,849
averdier/enigma_findmypet_backend
refs/heads/master
/app/__init__.py
# coding: utf-8 from flask import Flask from flask_cors import CORS from config import config def create_app(config_name='default'): app = Flask(__name__) CORS(app) app.config.from_object(config.get(config_name, config['default'])) config.get(config_name, config['default']).init_app(app) f...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,850
averdier/enigma_findmypet_backend
refs/heads/master
/services.py
# coding: utf-8 import os import boto3 import json from random import randint from datetime import datetime from pywebpush import webpush, WebPushException from app.models import Pet, PetLocation, Position, PushSubscription def is_in_zone(zone, position): return zone.position.lat - zone.radius < position['lat'] ...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,851
averdier/enigma_findmypet_backend
refs/heads/master
/app/api/__init__.py
# coding: utf-8 import os from flask import Blueprint from flask_restplus import Api blueprint = Blueprint('api', __name__, url_prefix='/api') api = Api( blueprint, title='FindMyPet Backend', description='Swagger documentation of FindMyPet backend (only for local purpose)', doc='/' if os.environ.get(...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,852
averdier/enigma_findmypet_backend
refs/heads/master
/app/api/serializers/pet.py
# coding: utf-8 from datetime import datetime from flask_restplus import fields from .import pagination_model, position_model, api pet_location = api.model('Pet location', { 'at': fields.DateTime(required=True, description='Pet creation datetime', attribute=lambda x: datetime.fromtimestamp(x.at).isoformat()), ...
{"/app/api/serializers/subscription.py": ["/app/api/__init__.py"], "/app/api/endpoints/pet.py": ["/app/api/serializers/pet.py", "/app/api/parsers.py", "/app/models.py"], "/app/api/endpoints/subscription.py": ["/app/api/serializers/subscription.py", "/app/models.py"], "/app/__init__.py": ["/config.py", "/app/api/__init_...
95,860
apple-han/love
refs/heads/master
/fake.py
# -*- coding: utf-8 -*- __author__ = 'Apple' from app import create_app from app.models.base import db from app.models.user import User app = create_app() with app.app_context(): with db.auto_commit(): # 创建一个超级管理员 user = User() user.pid = 'ob1vz0HeRNjQYO8D5Z4ALcJ80pw' user.auth = 2...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,861
apple-han/love
refs/heads/master
/app/api/v1/user.py
# -*- coding: utf-8 -*- from flask import Blueprint, jsonify, g from app.libs.error_code import DeleteSuccess from app.libs.redprint import Redprint from app.libs.token_auth import auth from app.models.base import db from app.models.user import User __author__ = 'Apple' api = Redprint('user') @api.route('/<int:uid>...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,862
apple-han/love
refs/heads/master
/app/api/v1/__init__.py
# -*- coding: utf-8 -*- from flask import Blueprint from app.api.v1 import user, client, token, identity, dynamic __author__ = 'Apple' def create_blueprint_v1(): bp_v1 = Blueprint('v1', __name__) user.api.register(bp_v1) client.api.register(bp_v1) token.api.register(bp_v1) identity.api.register(b...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,863
apple-han/love
refs/heads/master
/app/api/v1/token.py
# -*- coding: utf-8 -*- import json import requests from flask import current_app, jsonify from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from app.libs.enums import ClientTypeEnum from app.libs.error_code import ServerError from app.libs.redprint import Redprint from app.models.user import Us...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,864
apple-han/love
refs/heads/master
/app/models/dynamic.py
# -*- coding: utf-8 -*- from sqlalchemy import ForeignKey, Column, String, Integer from sqlalchemy.orm import relationship, backref from app.models.base import Base from app.models.user import User __author__ = 'Apple' # 用户动态信息表 class Dynamic(Base): __tablename__ = 'dynamic' id = Column(Integer, primary_ke...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,865
apple-han/love
refs/heads/master
/app/validators/forms.py
# -*- coding: utf-8 -*- from wtforms import IntegerField, StringField from wtforms.validators import DataRequired, length, ValidationError from app.libs.enums import ClientTypeEnum from app.models.user import User from app.validators.base import BaseForm as Form __author__ = 'Apple' class ClientForm(Form): secre...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,866
apple-han/love
refs/heads/master
/app/models/user.py
# -*- coding: utf-8 -*- from sqlalchemy import Column, String, SmallInteger, Integer, ForeignKey from sqlalchemy.orm import relationship, backref from app.api.v1 import user from app.libs.error_code import NotFound, AuthFailed from app.models.base import Base, db __author__ = 'Apple' class User(Base): __tablenam...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,867
apple-han/love
refs/heads/master
/app/config/secure.py
# -*- coding: utf-8 -*- __author__ = 'Apple' # 数据库相关配置 SQLALCHEMY_DATABASE_URI = 'mysql+cymysql://root:123456@localhost:3306/love_arrive' SECRET_KEY = 'jfoiqwkmjdslvnfsdajasdjfklqwjifekm' SQLALCHEMY_TRACK_MODIFICATIONS = True DEBUG = True # 微信配置 APPID = "wx7fffe0ad6255bb0d" APPSECRET = "eed1ffe3f0b3d9e7d59583fdfd6fb3...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,868
apple-han/love
refs/heads/master
/text.py
# # # -*- coding: utf-8 -*- # __author__ = 'Apple' # # def rebuild_area(item): # data = item.json # data["member"] = [require_member(ap, ac, am) for (ap, ac, am, ad) in query_data if ad == item.id] # member_data = [i for i in query_data if i[3] == item.id] # data['total_amount'] = float(sum([i[0] for i ...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,869
apple-han/love
refs/heads/master
/app/libs/error_code.py
# -*- coding: utf-8 -*- from werkzeug.exceptions import HTTPException from app.libs.error import APIException __author__ = 'Apple' # 400 参数错误 # 401 未授权 # 403 禁止访问 # 404 没有找到资源 # 500 服务器错误 # 200 查询成功 # 201 创建 更新成功 # 204 删除成功 # 301 302 重定向 class Success(APIException): code = 201 msg = "ok" error_code = 0 ...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,870
apple-han/love
refs/heads/master
/app/api/v1/dynamic.py
# -*- coding: utf-8 -*- from app.libs.redprint import Redprint __author__ = 'Apple' api = Redprint('identity') @api.route('/get') def get_book(): return 'get book'
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,871
apple-han/love
refs/heads/master
/app/config/setting.py
# -*- coding: utf-8 -*- __author__ = 'Apple' # token 过期时间 TOKEN_EXPIRATION = 36000 * 2
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,872
apple-han/love
refs/heads/master
/app/models/identity.py
# -*- coding: utf-8 -*- from sqlalchemy import Column, String, SmallInteger, Integer, ForeignKey from sqlalchemy.orm import relationship, backref from app.api.v1 import user from app.libs.error_code import NotFound, AuthFailed from app.models.base import Base, db __author__ = 'Apple' # 身份证信息的验证 class CertificateIden...
{"/fake.py": ["/app/models/user.py"], "/app/api/v1/user.py": ["/app/libs/error_code.py", "/app/models/user.py"], "/app/api/v1/token.py": ["/app/libs/error_code.py", "/app/models/user.py", "/app/validators/forms.py"], "/app/models/dynamic.py": ["/app/models/user.py"], "/app/validators/forms.py": ["/app/models/user.py"],...
95,876
DreamSoft-LLC/peggy
refs/heads/main
/reg/time.py
import re from helpers.time_helper import today , yesterday,current_time BOT_NAME = "peggy" TIME_DATE_REG = { re.compile(f"{BOT_NAME}+ [\w\s] + today's date"):today, re.compile(f"{BOT_NAME}+ [\w\s] + the time"):current_time, re.compile(f"{BOT_NAME}+ [\w\s] + today's date"):yesterday, }
{"/reg/time.py": ["/helpers/time_helper.py"], "/peggy.py": ["/helpers/alarms.py", "/helpers/time_helper.py", "/helpers/weather.py", "/subs/limeplayer.py", "/config.py", "/reg/boot.py"], "/main.py": ["/peggy.py"]}
95,877
DreamSoft-LLC/peggy
refs/heads/main
/helpers/weather.py
import requests import geocoder import json class Weather(): """docstring for Weather""" def __init__(self, api_key="cb261bd63a067e90ebce0fe0c36b4c4a"): self.api_key = api_key self.latlon = ['lat','lon'] #self.get_latlon() self.url = f"api.openweathermap.org/data/2.5/weather?lat={self.latlon[0]}&lon={self.latl...
{"/reg/time.py": ["/helpers/time_helper.py"], "/peggy.py": ["/helpers/alarms.py", "/helpers/time_helper.py", "/helpers/weather.py", "/subs/limeplayer.py", "/config.py", "/reg/boot.py"], "/main.py": ["/peggy.py"]}
95,878
DreamSoft-LLC/peggy
refs/heads/main
/helpers/time_helper.py
from datetime import datetime, timedelta import time as t class Time(): """docstring for Time""" def __init__(self,speek): self.now = datetime.utcnow self.speek = speek def today(self): self.speek(self.now().date()) def yesterday(self): self.speek(elf.now().date() - timedelta(days=1)) def current_time(se...
{"/reg/time.py": ["/helpers/time_helper.py"], "/peggy.py": ["/helpers/alarms.py", "/helpers/time_helper.py", "/helpers/weather.py", "/subs/limeplayer.py", "/config.py", "/reg/boot.py"], "/main.py": ["/peggy.py"]}
95,879
DreamSoft-LLC/peggy
refs/heads/main
/peggy.py
import os import sys import random import threading import re import requests import pyttsx3 from datetime import datetime import speech_recognition as sr from word2number import w2n from helpers.alarms import Alarm from helpers.time_helper import Time as TimeHelper from helpers.weather import Weather from subs.limep...
{"/reg/time.py": ["/helpers/time_helper.py"], "/peggy.py": ["/helpers/alarms.py", "/helpers/time_helper.py", "/helpers/weather.py", "/subs/limeplayer.py", "/config.py", "/reg/boot.py"], "/main.py": ["/peggy.py"]}
95,880
DreamSoft-LLC/peggy
refs/heads/main
/helpers/reminder.py
import time from datetime import datetime , timedelta class Reminders(): """docstring for Reminders""" def __init__(self, reminders=[]): self.reminders = reminders self.mute = False def set_reminder(self): pass def show_reminders(self): pass def show_reminder(self,index): pass def mute_reminder(sel...
{"/reg/time.py": ["/helpers/time_helper.py"], "/peggy.py": ["/helpers/alarms.py", "/helpers/time_helper.py", "/helpers/weather.py", "/subs/limeplayer.py", "/config.py", "/reg/boot.py"], "/main.py": ["/peggy.py"]}
95,881
DreamSoft-LLC/peggy
refs/heads/main
/helpers/alarms.py
from datetime import datetime ,timedelta import time from playsound import playsound import threading class Alarm(): """docstring for Alarm""" def __init__(self, alarms=[],mute=False): self.alarms = alarms self.mute=mute def set_alarm(self,time,date_=datetime.utcnow().date()): response = "" if(len(self.alar...
{"/reg/time.py": ["/helpers/time_helper.py"], "/peggy.py": ["/helpers/alarms.py", "/helpers/time_helper.py", "/helpers/weather.py", "/subs/limeplayer.py", "/config.py", "/reg/boot.py"], "/main.py": ["/peggy.py"]}
95,882
DreamSoft-LLC/peggy
refs/heads/main
/reg/boot.py
import re CALL_REG = ["hey peggy" , "hello peggy", "peggy" ] CALL_RESPONSE = [ "how can i help" , "do you need something" , "what do you need" ,"am here","yes","am listening" ] TAGS = {"alarm" : 0 , "date":1 , "time":1 , "weather":2} BASIC_COMMAND = [ { re.compile("[\w\s]+ set alarm"):lambda alarmModule:alarmMo...
{"/reg/time.py": ["/helpers/time_helper.py"], "/peggy.py": ["/helpers/alarms.py", "/helpers/time_helper.py", "/helpers/weather.py", "/subs/limeplayer.py", "/config.py", "/reg/boot.py"], "/main.py": ["/peggy.py"]}