repo_name
stringclasses
400 values
branch_name
stringclasses
4 values
file_content
stringlengths
16
72.5k
language
stringclasses
1 value
num_lines
int64
1
1.66k
avg_line_length
float64
6
85
max_line_length
int64
9
949
path
stringlengths
5
103
alphanum_fraction
float64
0.29
0.89
alpha_fraction
float64
0.27
0.89
Jmitch13/Senior-Honors-Project
refs/heads/main
import requests import sqlite3 from sqlite3 import Error from bs4 import BeautifulSoup # Create the top 100 database Top100 = sqlite3.connect('Top100Prospects.db') #Year list for the top 100 prospects yearList = ['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019'] #Function to create the table...
Python
68
38.205883
194
/Top100prospects.py
0.626189
0.578639
Jmitch13/Senior-Honors-Project
refs/heads/main
import requests import sqlite3 from sqlite3 import Error from bs4 import BeautifulSoup # Create the free agency database International = sqlite3.connect('InternationalProspects.db') # List for the Free Agency Pool yearList = ['2015', '2016', '2017', '2018', '2019'] #Create the International Table from 2...
Python
52
40.096153
169
/InternationalProspects.py
0.674897
0.652949
Jmitch13/Senior-Honors-Project
refs/heads/main
import requests import sqlite3 from sqlite3 import Error from bs4 import BeautifulSoup #Creates the player draft database PlayerDraft = sqlite3.connect('PlayerDraft.db') yearList = ['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019'] #Function to create the player draft tables def player_draft...
Python
56
35.75
117
/PlayerDraftProspects.py
0.637181
0.610691
Jmitch13/Senior-Honors-Project
refs/heads/main
import requests import sqlite3 from sqlite3 import Error from bs4 import BeautifulSoup # Create the Cumulative database CTeamStats = sqlite3.connect('CumulativeTeamStats.db') # This vector will be used to collect every team from 2012 to 2019 yearList = ['2012', '2013', '2014', '2015', '2016', '2017', '2018',...
Python
84
65.023811
949
/CumulativeTeamStats.py
0.623268
0.566963
Jmitch13/Senior-Honors-Project
refs/heads/main
import requests import sqlite3 from sqlite3 import Error from bs4 import BeautifulSoup # Create the free agency database FreeAgency = sqlite3.connect('FreeAgency.db') # List to gather every year from 2012 to 2019 yearList = ['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019'] #Create the Fre...
Python
88
39.477272
171
/FreeAgent.py
0.61863
0.586849
pyfaddist/yafcorse
refs/heads/main
from flask import Flask, Response from flask.testing import FlaskClient def test_simple_request(client: FlaskClient): response: Response = client.get('/some-request', headers={ 'Origin': 'https://test.org' }) assert response.status_code == 404 assert 'Access-Control-Allow-Origin'.lower...
Python
13
42.923077
84
/tests/test_simple_request.py
0.709282
0.704028
pyfaddist/yafcorse
refs/heads/main
from flask.app import Flask from yafcorse import Yafcorse def test_extension(app: Flask): assert app.extensions.get('yafcorse') is not None assert isinstance(app.extensions.get('yafcorse'), Yafcorse)
Python
8
25.375
63
/tests/test_ceate_extensions.py
0.758294
0.758294
pyfaddist/yafcorse
refs/heads/main
from flask import Response from flask.testing import FlaskClient # def test_with_origin(client: FlaskClient): # response: Response = client.options('/some-request', headers={ # 'Access-Control-Request-Method': 'POST', # 'Access-Control-Request-Headers': 'Content-Type, X-Custom', # ...
Python
87
46.804596
91
/tests/test_preflight_request.py
0.687906
0.682856
pyfaddist/yafcorse
refs/heads/main
import pytest from flask import Flask, Response from flask.testing import FlaskClient from yafcorse import Yafcorse @pytest.fixture() def local_app(): app = Flask(__name__) cors = Yafcorse({ 'allowed_methods': ['GET', 'POST', 'PUT'], 'allowed_headers': ['Content-Type', 'X-Test-Header'], ...
Python
46
32.586956
87
/tests/test_origins_function.py
0.678317
0.674434
pyfaddist/yafcorse
refs/heads/main
# def test_no_cors_enabled(): # assert False
Python
2
23.5
29
/tests/test_default_configuration.py
0.645833
0.645833
pyfaddist/yafcorse
refs/heads/main
import re from typing import Callable, Iterable from flask import Flask, Response, request # Yet Another Flask CORS Extension # -------------------------------- # Based on https://developer.mozilla.org/de/docs/Web/HTTP/CORS # DEFAULT_CONFIGURATION = { # 'origins': '*', # 'allowed_methods': ['GET', 'HEAD', 'PO...
Python
129
38.906979
122
/src/yafcorse/__init__.py
0.633256
0.632673
pyfaddist/yafcorse
refs/heads/main
import pytest from flask import Flask from yafcorse import Yafcorse @pytest.fixture() def app(): app = Flask(__name__) cors = Yafcorse({ 'origins': '*', 'allowed_methods': ['GET', 'POST', 'PUT'], 'allowed_headers': ['Content-Type', 'X-Test-Header'], 'allow_credentials': True,...
Python
25
18.08
61
/tests/conftest.py
0.580713
0.574423
hjnewman3/PDF-Text-Extractor
refs/heads/master
''' PDF Text Extractor Module This module will extract the text from a .pdf file and return the contents as a string. ''' from io import StringIO from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter from pdfminer.converter import TextConverter from pdfminer.layout import LAParams from pdfminer.pdfpa...
Python
44
28.84091
73
/src/extractor.py
0.671494
0.671494
hjnewman3/PDF-Text-Extractor
refs/heads/master
''' PDF Text Extractor Main Module This module will read every .pdf file within a directory. It will use the PDFExtractor to extract its contents to a string. That string will then be passed to TextFormatter where it will be properly formatted to the desired format. The module will ask the user for a desired outpu...
Python
69
28.144928
105
/src/main.py
0.669816
0.668821
hjnewman3/PDF-Text-Extractor
refs/heads/master
''' Text Formatter Module This module will format the string input to match the desired output. ''' class TextFormatter(object): # takes in a string parameter # returns the string formatted as: 'name TAB title' def name_tab_title(self, text): # stores contents of the input text into a list ...
Python
34
27.352942
69
/src/formatter.py
0.608921
0.608921
janetyc/JaneDiary
refs/heads/master
# -*- coding: utf-8 -*- from datetime import datetime #from googletrans import Translator from translate import Translator from TwitterSearch import * import configparser import random import re import io weather = [u"Sunny", u"Rainy", u"Cloudy"] weather_tw = [u"晴天",u"雨天", u"陰天"] translator= Translator(to_lang='zh-T...
Python
120
29.808332
110
/get_twitter_story.py
0.615468
0.60411
ritikrath/NLP
refs/heads/master
import numpy as pd import matplotlib.pyplot as plt import pandas as pd dataset=pd.read_csv('music.csv')
Python
5
20
32
/temp.py
0.788462
0.788462
harshagr18/Gesture-Cursor
refs/heads/master
import mediapipe as mp import numpy as np import cv2 cap = cv2.VideoCapture(0) facmesh = mp.solutions.face_mesh face = facmesh.FaceMesh(static_image_mode=True, min_tracking_confidence=0.6, min_detection_confidence=0.6) draw = mp.solutions.drawing_utils while True: _, frm = cap.read() print(frm.shape) break rgb ...
Python
30
23
134
/mesh.py
0.725
0.686111
tattle-made/archive-telegram-bot
refs/heads/master
import os import json import boto3 import requests from logger import log, logError from dotenv import load_dotenv load_dotenv() s3 = boto3.client("s3",aws_access_key_id=os.environ.get('S3_ACCESS_KEY'),aws_secret_access_key=os.environ.get('S3_SECRET_ACCESS_KEY')) API_BASE_URL = "https://archive-server.tattle.co.in" #...
Python
60
30.15
134
/tattle_helper.py
0.688437
0.672912
tattle-made/archive-telegram-bot
refs/heads/master
token = "78a6fc20-fa83-11e9-a4ad-d1866a9a3c7b" # add your token here url = "<base-api-url>/api/posts" try: payload = d payload = json.dumps(payload) headers = { 'token': token, 'Content-Type': "application/json", 'cache-control': "no-cache", } r = requests.post(url, data=...
Python
26
26.461538
79
/post_request.py
0.56662
0.530154
tattle-made/archive-telegram-bot
refs/heads/master
from tattle_helper import register_post, upload_file data = { "type" : "image", "data" : "", "filename": "asdf", "userId" : 169 } response = upload_file(file_name='denny.txt') print(response) # register_post(data)
Python
13
16.923077
52
/test.py
0.625
0.612069
tattle-made/archive-telegram-bot
refs/heads/master
import os import sys import json import requests import telegram import logging import re from threading import Thread from telegram.ext import CommandHandler, MessageHandler, Updater, Filters, InlineQueryHandler from telegram import InlineQueryResultArticle, InputTextMessageContent from telegram.ext.dispatcher import ...
Python
354
40.141243
756
/prototype.py
0.654285
0.652362
tattle-made/archive-telegram-bot
refs/heads/master
from datetime import datetime def log(data): print('----', datetime.now(), '----') print(data) def logError(error): print('****', datetime.now(), '****') print(error)
Python
10
17.6
41
/logger.py
0.556757
0.556757
madjar/blog
refs/heads/master
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = 'Georges Dubus' SITENAME = 'Compile-toi toi même' SITESUBTITLE = u'(Georges Dubus)' # TODO: remove in next version ? SITEURL = '' ABSOLUTE_SITEURL = SITEURL # TODO: remove TIMEZONE = 'Europe/Paris' ...
Python
48
27.125
96
/pelicanconf.py
0.648148
0.628148
ericfourrier/auto-clean
refs/heads/develop
import seaborn as sns import matplotlib.pyplot as plt def plot_corrmatrix(df, square=True, linewidths=0.1, annot=True, size=None, figsize=(12, 9), *args, **kwargs): """ Plot correlation matrix of the dataset see doc at https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.he...
Python
15
38.333332
108
/autoc/utils/corrplot.py
0.662712
0.652542
ericfourrier/auto-clean
refs/heads/develop
from setuptools import setup, find_packages def readme(): with open('README.md') as f: return f.read() setup(name='autoc', version="0.1", description='autoc is a package for data cleaning exploration and modelling in pandas', long_description=readme(), author=['Eric Fourrier'], ...
Python
24
26.75
93
/setup.py
0.572072
0.551051
ericfourrier/auto-clean
refs/heads/develop
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: efourrier Purpose : Get data from https://github.com/ericfourrier/autoc-datasets """ import pandas as pd def get_dataset(name, *args, **kwargs): """Get a dataset from the online repo https://github.com/ericfourrier/autoc-datasets (requires internet...
Python
22
24.636364
102
/autoc/utils/getdata.py
0.654255
0.650709
ericfourrier/auto-clean
refs/heads/develop
# -*- coding: utf-8 -*- """ @author: efourrier Purpose : Automated test suites with unittest run "python -m unittest -v test" in the module directory to run the tests The clock decorator in utils will measure the run time of the test """ ######################################################### # Import Packages an...
Python
364
37.843407
106
/test.py
0.6173
0.600255
ericfourrier/auto-clean
refs/heads/develop
from autoc.explorer import DataExploration, pd from autoc.utils.helpers import cserie import seaborn as sns import matplotlib.pyplot as plt #from autoc.utils.helpers import cached_property from autoc.utils.corrplot import plot_corrmatrix import numpy as np from scipy.stats import ttest_ind from scipy.stats.mstats impor...
Python
227
41.766521
112
/autoc/naimputer.py
0.607025
0.603008
ericfourrier/auto-clean
refs/heads/develop
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: efourrier Purpose : File with all custom exceptions """ class NotNumericColumn(Exception): """ The column should be numeric """ pass class NumericError(Exception): """ The column should not be numeric """ pass # class NotFactor
Python
17
17.17647
45
/autoc/exceptions.py
0.656958
0.653722
ericfourrier/auto-clean
refs/heads/develop
__all__ = ["explorer", "naimputer"] from .explorer import DataExploration from .naimputer import NaImputer from .preprocess import PreProcessor from .utils.getdata import get_dataset # from .preprocess import PreProcessor
Python
6
36
38
/autoc/__init__.py
0.797297
0.797297
ericfourrier/auto-clean
refs/heads/develop
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: efourrier Purpose : This is a framework for Modeling with pandas, numpy and skicit-learn. The Goal of this module is to rely on a dataframe structure for modelling g """ ######################################################### # Import modules and global h...
Python
678
42.346607
152
/autoc/explorer.py
0.567423
0.561673
ericfourrier/auto-clean
refs/heads/develop
""" @author: efourrier Purpose : This is a simple experimental class to detect outliers. This class can be used to detect missing values encoded as outlier (-999, -1, ...) """ from autoc.explorer import DataExploration, pd import numpy as np #from autoc.utils.helpers import cserie from exceptions import NotNumericC...
Python
106
35.339622
107
/autoc/outliersdetection.py
0.606438
0.59891
ericfourrier/auto-clean
refs/heads/develop
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: efourrier Purpose : The purpose of this class is too automaticely transfrom a DataFrame into a numpy ndarray in order to use an aglorithm """ ######################################################### # Import modules and global helpers #####################...
Python
177
38.785309
131
/autoc/preprocess.py
0.590741
0.587049
ericfourrier/auto-clean
refs/heads/develop
# -*- coding: utf-8 -*- """ @author: efourrier Purpose : Create toolbox functions to use for the different pieces of code ot the package """ from numpy.random import normal from numpy.random import choice import time import pandas as pd import numpy as np import functools def print_section(section_name, width=120):...
Python
338
33.760357
104
/autoc/utils/helpers.py
0.605498
0.582858
Csingh1s/TwitterProject
refs/heads/master
# -*- coding: utf-8 -*- import requests import json import urllib from datetime import datetime from flask import Flask, render_template, request from flask import session from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, BooleanField, PasswordField from wtforms.validators import DataRequ...
Python
215
31.920931
133
/examples/app.py
0.526702
0.513704
anglipku/Udacity-course-final-project_Intro-to-Hadoop-and-MapReduce
refs/heads/master
#!/usr/bin/python import sys oldAuthor = None # save the old author's id hourList = [] # save the list of hours that an author makes posts for line in sys.stdin: data = line.strip().split("\t") author, hour = data if oldAuthor and author!=oldAuthor: # if the author changes to a new author, deter...
Python
28
34.607143
119
/student_times_reducer.py
0.668657
0.668657
anglipku/Udacity-course-final-project_Intro-to-Hadoop-and-MapReduce
refs/heads/master
#!/usr/bin/python import sys import csv reader = csv.reader(sys.stdin, delimiter='\t') for line in reader: post_id = line[0] post_type = line[5] abs_parent_id = line[7] post_length = len(line[4]) if post_id == "id": continue if post_type[0] == "q": # i.e. if the post is a "questio...
Python
22
29.727272
148
/average_length_mapper.py
0.591716
0.573964
anglipku/Udacity-course-final-project_Intro-to-Hadoop-and-MapReduce
refs/heads/master
#!/usr/bin/python import sys oldQuestionNode = None # save the old question's node id Student_IDs = [] # the list of question/answers/comment id's for a forum thread for line in sys.stdin: data = line.strip().split("\t") question_id, author_id = data if oldQuestionNode and oldQuestionNode != question_...
Python
29
28.620689
87
/study_groups_reducer.py
0.681024
0.681024
anglipku/Udacity-course-final-project_Intro-to-Hadoop-and-MapReduce
refs/heads/master
#!/usr/bin/python import sys import csv reader = csv.reader(sys.stdin, delimiter='\t') for line in reader: post_id = line[0] post_type = line[5] author_id = line[3] abs_parent_id = line[7] if post_id == "id": continue if post_type[0] == "q": # i.e. if the post is a "question" ...
Python
21
21.523809
74
/study_groups_mapper.py
0.56962
0.556962
anglipku/Udacity-course-final-project_Intro-to-Hadoop-and-MapReduce
refs/heads/master
#!/usr/bin/python import sys oldQuestionNode = None # save the old question's node id oldQuestionLength = 0 # save the old question's length AnsLengthList = [] # the list of the length of answers for a question for line in sys.stdin: data = line.strip().split("\t") question_id, post_type, post_length = data...
Python
37
34.945946
98
/average_length_reducer.py
0.679699
0.677444
anglipku/Udacity-course-final-project_Intro-to-Hadoop-and-MapReduce
refs/heads/master
#!/usr/bin/python import sys import csv reader = csv.reader(sys.stdin, delimiter='\t') for line in reader: author_id = line[3] added_at = line[8] if len(added_at) > 11: hour = int(added_at[11] + added_at[12]) print author_id,"\t", hour
Python
13
19.384615
46
/student_times_mapper.py
0.603774
0.573585
anglipku/Udacity-course-final-project_Intro-to-Hadoop-and-MapReduce
refs/heads/master
#!/usr/bin/python import sys import csv reader = csv.reader(sys.stdin, delimiter='\t') for line in reader: tag = line[2] tag_list = tag.strip().split(' ') for A_tag in tag_list: print A_tag
Python
13
15.846154
46
/popular_tags_mapper.py
0.598173
0.593607
anglipku/Udacity-course-final-project_Intro-to-Hadoop-and-MapReduce
refs/heads/master
#!/usr/bin/python import sys oldTag = None # save the oldTag oldTagCount = 0 # save the oldTag's Count Top10Tag = [] # the list of top 10 tags Top10TagCount = [] # the list of top 1 tags' counts for line in sys.stdin: tag = line if oldTag and oldTag != tag: # check if the old tag's count beats the cu...
Python
46
32.95652
87
/popular_tags_reducer.py
0.682458
0.632522
DJAxel/ChargetripApiEtl
refs/heads/main
import os import json path = r"/home/axel/Documents/electralign-data/" stations = [] for filename in sorted(os.listdir(path)): filepath = os.path.join(path, filename) if os.path.isfile(filepath): print(filename) with open(filepath, 'r') as file: data = json.load(file) s...
Python
19
23.736841
50
/merge.py
0.631915
0.631915
DJAxel/ChargetripApiEtl
refs/heads/main
import sys import traceback from python_graphql_client import GraphqlClient import json API_KEY = '5e8c22366f9c5f23ab0eff39' # This is the public key, replace with your own to access all data client = GraphqlClient(endpoint="https://staging-api.chargetrip.io/graphql") client.headers = { 'x-client-id': API_KEY } ...
Python
246
17.861788
129
/index.py
0.562406
0.554645
DJAxel/ChargetripApiEtl
refs/heads/main
from python_graphql_client import GraphqlClient API_KEY = '5f8fbc2aa23e93716e7c621b' client = GraphqlClient(endpoint="https://staging-api.chargetrip.io/graphql") client.headers = { 'x-client-id': API_KEY } query = """ query stationListAll ($page: Int!) { stationList(size: 100, page: $page) { id external...
Python
182
14.318682
76
/test.py
0.507356
0.505562
DJAxel/ChargetripApiEtl
refs/heads/main
import os import json filepath = r"/home/axel/Documents/electralign-data/stations-all.json" newData = {"data": {"stationList": []}} if os.path.isfile(filepath): with open(filepath, 'r') as file: print("File opened") data = json.load(file) print("Data loaded") newData["data"]["stati...
Python
19
28.736841
75
/mutate.py
0.651327
0.651327
kairotavares/tutorials
refs/heads/master
# Copyright 2017-present Open Networking Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
135
36.740742
88
/P4D2_2017_Fall/exercises/p4runtime/p4info/p4browser.py
0.607185
0.594621
kairotavares/tutorials
refs/heads/master
# Copyright 2017-present Open Networking Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
130
39.061539
105
/P4D2_2017_Fall/exercises/p4runtime/switches/switch.py
0.651882
0.636905
tony2037/K-means-Machine-Learning
refs/heads/master
import tensorflow as tf import numpy as np import time #help us to graph import matplotlib import matplotlib.pyplot as plt #import datasets we need by scikit-learn from sklearn.datasets.samples_generator import make_blobs from sklearn.datasets.samples_generator import make_circles #fuck Here I install scipy a matheri...
Python
130
37.153847
147
/k-means/k-means.py
0.69268
0.664448
tony2037/K-means-Machine-Learning
refs/heads/master
from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier iris = datasets.load_iris() iris_X = iris.data iris_y = iris.target print("=====data=====") print(iris_X) print("===============") print("data length : " + str(len(iris_X))) print("===...
Python
27
22.703703
82
/KNN/sk4_learning_pattern.py
0.643192
0.640063
biswasalex410/Python
refs/heads/master
students = ( ("Alex Biswas",21,3.46), ("Sabuj Chandra Das",22,3.69), ("Ahad Islam Moeen",22,3.46), ) print(students[0:])
Python
8
12.625
23
/Tuples.py
0.453704
0.305556
biswasalex410/Python
refs/heads/master
def divisible(numl): print("Given List is ",numl) print("Divisible of 5 in a list ") for num in numl : if (num % 5 == 0): print(num) numl = [10, 15, 12, 17, 20] divisible(numl)
Python
9
22.333334
38
/Basic Exercise for Beginners6.py
0.545455
0.483254
biswasalex410/Python
refs/heads/master
#Parents class , Super class, Base class class Phone: def call(self): print("You can Call") def message(self): print("You can Message") #Child class, Sub class, Derived class class Samsung(Phone): def photo(self): print("You can Take Photo") s = Samsung() s.call() s.message() s.ph...
Python
19
17.947369
40
/OOP Inheritance.py
0.64624
0.64624
biswasalex410/Python
refs/heads/master
import random for x in range(1,6): guessNumber = int(input("Enter your guess between 1 to 5 : ")) randomNumber = random.randint(1,5) if guessNumber == randomNumber: print("You have won") else: print("You have loss", randomNumber)
Python
10
25.4
66
/Guessing Game.py
0.638783
0.61597
biswasalex410/Python
refs/heads/master
def char(str): for i in range(0, len(str), 1): print("index[",i,"]", str[i]) str = input("Enter any name: ") print("Print Single Charecter: ") char(str) """ def printEveIndexChar(str): for i in range(0, len(str)-1, 2): print("index[",i,"]", str[i] ) inputStr = "pynative" print("Orginal String is ...
Python
21
18.333334
39
/Basic Exercise for Beginners3.py
0.625616
0.613301
biswasalex410/Python
refs/heads/master
number = 7536 print("Given number", number) while (number > 0): digit = number % 10 number = number // 10 print(digit, end = " ")
Python
6
22.666666
29
/Basic Exercise for Beginners11.py
0.595745
0.531915
biswasalex410/Python
refs/heads/master
def removeChars(str, n): return str[n:] print("pynative") n = int(input("Enter the removing number: ")) print(removeChars("pynative", n))
Python
6
22.5
45
/Basic Exercise for Beginners4.py
0.687943
0.687943
biswasalex410/Python
refs/heads/master
""" def calculate(a,b): return a*a + 2*a*b + b*b lambda parameter : a*a + 2*a*b + b*b print(calculate(2,3)) """ a = (lambda a,b : a*a + 2*a*b + b*b) (2,3) print(a) #another def cube(x): return x*x*x a = (lambda x : x*x*x) (3) print(a)
Python
13
17.615385
42
/Lambda Functions.py
0.543568
0.510373
biswasalex410/Python
refs/heads/master
""" num2 = int(input("Enter a number: ")) result = 20 / num2 print(result) print("Done") """ """ text = "Alex" print(text) print("Done") """ """ try: list = [20,0,32] result = list[0] / list[3] print(result) print("Done") except ZeroDivisionError: print("Dividing by zero is not possible ") except In...
Python
44
18.863636
50
/Exception Handling.py
0.617411
0.595647
biswasalex410/Python
refs/heads/master
num1 = {1,2,3,4,5} num2 = set([4,5,6]) num2.add(7) num2.remove(4) print(num1 | num2) print(num1 & num2) print(num1 - num2)
Python
7
16.571428
19
/Set.py
0.631148
0.467213
biswasalex410/Python
refs/heads/master
n = 3 for i in range(n + 1): print((2 * i - 1) * " *")
Python
3
18.666666
29
/Pattern.py
0.383333
0.316667
biswasalex410/Python
refs/heads/master
file = open("Hello.html","w") file.write("<h1> This is a text</h1>") file.close()
Python
5
15.8
38
/Writing file.py
0.614458
0.590361
biswasalex410/Python
refs/heads/master
def multiplication_or_sum(num1,num2): product = num1 * num2 if product <= 1000: return product else: return num1 + num2 num1 = int(input("Enter 1st integer number: ")) num2 = int(input("Enter 2nd integer number: ")) print("\n") result = multiplication_or_sum(num1, num2) print("The result is...
Python
12
26.666666
47
/Basic Exercise for Beginners 1.py
0.650602
0.60241
biswasalex410/Python
refs/heads/master
#Multi level inheritance """ class A: def display1(self): print("I am inside A class") class B(A): def display2(self): print("I am inside B class") class C(B): def display3(self): super().display1() super().display2() print("I am inside C class") ob1 = C()...
Python
36
14.555555
36
/OOP Types Of Inheritance.py
0.557143
0.539286
biswasalex410/Python
refs/heads/master
num = list(range(10)) print(num) num = list(range(10)) j
Python
5
10.6
21
/Range.py
0.587302
0.52381
biswasalex410/Python
refs/heads/master
#Map Function def square(a): return a*a num = [1,2,3,4,5] result = list(map(square,num)) print(result) # Filter function num = [1,2,3,4,5] result = list(filter(lambda x: x%2==0,num)) print(result)
Python
15
12.733334
43
/map and filter function.py
0.640777
0.582524
biswasalex410/Python
refs/heads/master
def add(a,b): sum = a+b return sum result = add(20,30) print("Result = ",result)
Python
5
16.799999
25
/Returning Value from function.py
0.590909
0.545455
biswasalex410/Python
refs/heads/master
import pyttsx3 friend = pyttsx3.init() friend.say('I can speak now') friend.runAndWait()
Python
4
21.25
29
/Audio Book.py
0.761364
0.738636
biswasalex410/Python
refs/heads/master
import pyautogui import time message = 100 while message > 0: time.sleep(0) pyautogui.typewrite('Hi BC!!!') pyautogui.press('enter') message = message - 1
Python
8
20.375
35
/Send Message.py
0.670588
0.635294
biswasalex410/Python
refs/heads/master
class Student: roll = " " gpa = " " rahim = Student() print(isinstance(rahim,Student)) rahim.roll = 101 rahim.gpa = 3.95 print(f"Roll: {rahim.roll}, GPA: {rahim.gpa}") karim = Student() print(isinstance(karim,Student)) karim.roll = 102 karim.gpa = 4.85 print(f"Roll: {karim.roll}, GPA: {karim.gpa}")
Python
15
19.666666
46
/OOP Class and Object.py
0.656958
0.618123
biswasalex410/Python
refs/heads/master
#xargs """ def student(id,name): print(id,name) student(191,"Alex Biswas") """ """ def student(*details): print(details) student(191,"Alex",3.46) student(192,"Alex",3.46) """ """ def add(*numbers): sum = 0 for num in numbers: sum = sum + num print(sum) add(10,15) add(10,15,20) add(10,15,20,25...
Python
29
12.827586
27
/xargs and xxargs.py
0.6
0.5075
biswasalex410/Python
refs/heads/master
file = open("student.txt","r") #print(file.readable()) #text = file.read() #print(text) #size = len(text) #print(size) #text = file.readlines() for line in file: print(line) #print(text) file.close()
Python
11
17.545454
30
/Reading file.py
0.660098
0.660098
biswasalex410/Python
refs/heads/master
studentid = { 464 : "Alex Biswas", 525 : "Sabuj Chandra Das", 957 : "Sonia Akter", 770 : "Tasni Tasnim Nilima", } print(studentid.get(525,"Not a valid key"))
Python
8
16.625
43
/Dictionary.py
0.489362
0.382979
biswasalex410/Python
refs/heads/master
roll = [101,102,103,104,105,106] name = ["Alex Biswas", "Sabuj Chandra Das", "Ahad Islam Moeen", "Sonia Akter", "Mariam Akter", "Sajib Das"] print(list(zip(roll,name))) print(list(zip(roll,name,"ABCDEF")))
Python
5
32.400002
67
/Zip function.py
0.578313
0.46988
biswasalex410/Python
refs/heads/master
num = [1,2,3,4,5] #[expression for item in list] result = [x for x in num if x%2==0] print(result)
Python
6
15.833333
35
/List Comprehensions.py
0.623762
0.554455
biswasalex410/Python
refs/heads/master
# Using string Function """ sampleStr = "Emma is good developer. Emma is a writer" cnt = sampleStr.count("Emma") print("Emma appeared",cnt,"times") """ #Without Using String function def count_emma(str): print("Given String : ",str) count = 0 for i in range(len(str) -1): count += str[i: i+4] == 'E...
Python
17
25.117647
63
/Basic Exercise for Beginners7.py
0.654628
0.647856
biswasalex410/Python
refs/heads/master
num = [10,20,30,40,50] print(num) """ index = 0 n = len(num) while index<n: print(num[index]) index = index+1 """ sum = 0 for x in num: sum = sum+x print(sum)
Python
13
12.153846
22
/for loop.py
0.527174
0.456522
biswasalex410/Python
refs/heads/master
class Student: roll = "" gpa = "" def __init__(self,roll,gpa): self.roll = roll self.gpa = gpa def display(self): print(f"Roll: {self.roll}, GPA: {self.gpa}") rahim = Student(464,4.50) rahim.display() karim = Student(525,4.98) karim.display()
Python
14
19.357143
52
/OOP Constructor.py
0.566901
0.524648
biswasalex410/Python
refs/heads/master
def isFirstLastsame(numl): print("Given List is ",numl) firstElement = numl[0] lastElement = numl[-1] if (firstElement == lastElement): return True else: return False numl = [10,15,12,17,19] print("Result is ",isFirstLastsame(numl))
Python
10
25.9
41
/Basic Exercise for Beginners5.py
0.63806
0.593284
biswasalex410/Python
refs/heads/master
def mergeList(list1, list2): print("First List ", list1) print("Second List ", list2) thirdList = [] for num in list1: if (num % 2 != 0): thirdList.append(num) for num in list2: if (num % 2 == 0): thirdList.append(num) return thirdList list1 = [10, 20, 35,...
Python
15
26.266666
49
/Basic Exercise for Beginners10.py
0.556373
0.473039
biswasalex410/Python
refs/heads/master
""" import re pattern = r"colour" text = r"My favourite colour is Red" match = re.search(pattern,text) if match: print(match.start()) print(match.end()) print(match.span()) """ #Search And Replace """ import re pattern = r"colour" text = r"My favourite colour is Red. I love blue colour...
Python
29
15.586206
64
/Regular expression.py
0.622047
0.610236
biswasalex410/Python
refs/heads/master
num = list(range(10)) print(num) print(num[2]) num = list(range(2,5)) print(num) num = list(range(2,101,2)) print(num)
Python
9
12.444445
26
/programme.py
0.609375
0.53125
biswasalex410/Python
refs/heads/master
class Trinangle: def __init__(self,base,height): self.base = base self.height = height def calculate_area(self): area = 0.5 * self.base * self.height print(f"Base: {self.base}, Height: {self.height}","Area = ",area) t1 = Trinangle(10,20) t1.calculate_area() t2 = Trinangle(20,30)...
Python
12
27.416666
73
/OOP Exercise1.py
0.614706
0.573529
biswasalex410/Python
refs/heads/master
n = int(input("Enter the last number: ")) sum = 0 for x in range(2,n+2,2): sum = sum+x*x print(sum)
Python
5
19.799999
41
/Series.py
0.558559
0.522523
biswasalex410/Python
refs/heads/master
from area import * rectangle_area(25,6) triangle_area(10,15)
Python
4
14.5
20
/OOP Creating youe own Module.py
0.754098
0.639344
biswasalex410/Python
refs/heads/master
# 2 kinds of funmctions """ Library -> print(), input() userdefine -> make your own need """ def add(a,b): sum = a+b print(sum) def sub(x,y): sub = x-y print(sub) add(10,15) sub(15,7) def message(): print("No parameter") message()
Python
17
13.823529
32
/Function.py
0.587302
0.555556
biswasalex410/Python
refs/heads/master
#Regular method """ a = 20 b = 15 print("a = ",a) print("b = ",b) temp = a #temp = 20 a = b #a = 15 b = temp # b = 15 print("After Swapping") print("a = ",a) print("b = ",b) """ #Python Special Method a = 20 b = 15 print("a = ",a) print("b = ",b) a, b = b, a print("After Swapping") print("a = ",a) print("b = ",b)
Python
23
12.73913
23
/Swapping.py
0.520635
0.47619
biswasalex410/Python
refs/heads/master
#Stack """ books = [] books.append("Learn C") books.append("Learn C++") books.append("Learn Java") print(books) books.pop() print("Now the top book is :",books[-1]) print(books) books.pop() print("Now the top book is :",books[-1]) print(books) books.pop() if not books: print("No books left") """ #Queue from collec...
Python
29
16.620689
46
/Stack and Queue.py
0.672549
0.668627
igoryuha/wct
refs/heads/master
import torch from models import NormalisedVGG, Decoder from utils import load_image, preprocess, deprocess, extract_image_names from ops import style_decorator, wct import argparse import os parser = argparse.ArgumentParser(description='WCT') parser.add_argument('--content-path', type=str, help='path to the content ...
Python
151
41.788078
109
/eval.py
0.63597
0.609039
igoryuha/wct
refs/heads/master
import torch import torch.nn as nn import copy normalised_vgg_relu5_1 = nn.Sequential( nn.Conv2d(3, 3, 1), nn.ReflectionPad2d((1, 1, 1, 1)), nn.Conv2d(3, 64, 3), nn.ReLU(), nn.ReflectionPad2d((1, 1, 1, 1)), nn.Conv2d(64, 64, 3), nn.ReLU(), nn.MaxPool2d(2, ceil_mode=True), nn.Reflec...
Python
139
28.978416
111
/models.py
0.555796
0.461723
igoryuha/wct
refs/heads/master
import torch import torch.nn.functional as F def extract_image_patches_(image, kernel_size, strides): kh, kw = kernel_size sh, sw = strides patches = image.unfold(2, kh, sh).unfold(3, kw, sw) patches = patches.permute(0, 2, 3, 1, 4, 5) patches = patches.reshape(-1, *patches.shape[-3:]) # (patch_nu...
Python
127
31.692913
108
/ops.py
0.65342
0.642582
igoryuha/wct
refs/heads/master
import torch from torchvision import transforms from ops import relu_x_1_style_decorator_transform, relu_x_1_transform from PIL import Image import os def eval_transform(size): return transforms.Compose([ transforms.Resize(size), transforms.ToTensor() ]) def load_image(path): return Imag...
Python
46
19.413044
70
/utils.py
0.643237
0.636848
ajbonkoski/zcomm
refs/heads/master
#!/usr/bin/env python import itertools import sys import time from zcomm import zcomm HZ = 1 def main(argv): z = zcomm() msg_counter = itertools.count() while True: msg = str(msg_counter.next()) z.publish('FROB_DATA', msg); time.sleep(1/float(HZ)) if __name__ == "__main__": t...
Python
22
16.727272
37
/py/pub.py
0.587179
0.582051
ajbonkoski/zcomm
refs/heads/master
#!/usr/bin/env python import sys import time from zcomm import zcomm def handle_msg(channel, data): print ' channel:%s, data:%s' % (channel, data) def main(argv): z = zcomm() z.subscribe('', handle_msg) z.run() if __name__ == "__main__": try: main(sys.argv) except KeyboardInterrupt:...
Python
18
17.555555
52
/py/spy.py
0.58982
0.58982
ajbonkoski/zcomm
refs/heads/master
import zmq PUB_ADDR = 'ipc:///tmp/pub'; SUB_ADDR = 'ipc:///tmp/sub'; class zcomm: def __init__(self): self.ctx = zmq.Context() self.pub = self.ctx.socket(zmq.PUB) self.pub.connect(PUB_ADDR) self.sub = self.ctx.socket(zmq.SUB) self.sub.connect(SUB_ADDR) self.callbac...
Python
32
26.84375
56
/py/zcomm.py
0.590348
0.590348
ajbonkoski/zcomm
refs/heads/master
#!/usr/bin/env python import zmq SUB_ADDR = 'ipc:///tmp/sub' PUB_ADDR = 'ipc:///tmp/pub' def main(): try: context = zmq.Context(1) userpub = context.socket(zmq.SUB) userpub.bind(PUB_ADDR) userpub.setsockopt(zmq.SUBSCRIBE, "") usersub = context.socket(zmq.PUB) use...
Python
32
19.4375
51
/crossbar.py
0.567278
0.565749
Ignorance-of-Dong/Algorithm
refs/heads/master
# AC: # from others' solution # class Solution(object): def distinctEchoSubstrings(self, S): N = len(S) P, MOD = 37, 344555666677777 # MOD is prime Pinv = pow(P, MOD - 2, MOD) prefix = [0] pwr = 1 ha = 0 for x in map(ord, S): ha ...
Python
28
33.82143
109
/contest/leetcode_biweek_17/[refered]leetcode_5146_Distinct_Echo_Substrings.py
0.456879
0.427105
RoelVanderPaal/javacpp-cuda-math
refs/heads/master
#!/usr/bin/python from bs4 import BeautifulSoup from string import Template docDir = '/Developer/NVIDIA/CUDA-7.0/doc/html/cuda-math-api/' one_template = """extern "C" __global__ void math_${f}(size_t n, $t *result, $t *x) { int id = blockIdx.x * blockDim.x + threadIdx.x; if (id < n) { result[id] ...
Python
231
31.290043
118
/generate.py
0.57434
0.568843