blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
78e5ca4dc317674f8e130449847dce75b6f54a53 | Python | edwinvarghese4442/Gradient-Descent | /classification.py | UTF-8 | 3,150 | 3.578125 | 4 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import pandas as pd
import math
import numpy as np
table = pd.read_csv('./data_logistic.csv')
# dataset has 2 independent variables and one target variable ie. stroke
x1 = table['age']
x2 = table['cholestrol']
y1 = table['stroke']
#===========... | true |
1e1a9e32c5bd42df4554ceccf233d0b66a046482 | Python | jinlukang1/issue-Notebook | /AirSimScript/processscripy/getpath.py | UTF-8 | 1,874 | 2.5625 | 3 | [] | no_license | import os
import glob
CarType_Select = ['BigFront_dataset', 'BigNewEnergy_dataset', 'Car_dataset', 'NewEnergy_dataset', 'Bus_dataset', 'Truck_dataset']
LightType_Select = ['daytime', 'night', 'noontime']
WeatherType_Select = ['heavysnow', 'heavyrain', 'foggy', 'lightsnow', 'lightrain', 'sunny', 'cloudy'... | true |
e0f3bfd913367b75dd8915e8101605aad27822e7 | Python | Voldet/news-robots | /main/pagerank.py | UTF-8 | 5,224 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*
import numpy as np
import networkx as nx
from textrank4zh import TextRank4Sentence
from json import *
'''*************************更改编码方式*******************************'''
def input(path):
import codecs
text = codecs.open(path, 'r', 'gbk').read()
# text = codecs.open(path, 'r', '... | true |
a438fc9d66f8f78684cdeae4b2c130e9c3b33f97 | Python | 1abner1/SimuRLacra | /Pyrado/pyrado/utils/data_sets.py | UTF-8 | 9,190 | 2.671875 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | # Copyright (c) 2020, Fabio Muratore, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source ... | true |
46ba97d468053f120e9c2ddd35cd16dad49ae4ef | Python | jaykava/Adventure-Game-Udacity-Project-2 | /adventure_game.py | UTF-8 | 5,339 | 3.59375 | 4 | [] | no_license | import time
import random
def playadventure():
i = []
v = random.choice(["Shark", "Fish", "Hippo"])
inn(i, v)
forward(i, v)
num = 8
for iss in range(num):
for j in range((num - iss) - 1):
print(end=" ")
for j in range(iss + 1):
print("*", end=" ")
print(... | true |
0012bc0df31543f6d7ebe3daae1b0cf504accd13 | Python | maitek/ml-experimental | /texture2pbr/imread_speadtest.py | UTF-8 | 1,046 | 2.625 | 3 | [] | no_license | import cv2
from time import time
import scipy.misc
import skimage.io
import PIL
import numpy as np
import asyncio
import multiprocessing
from multiprocessing import Process, Queue
print("cv2.misc.imread:")
tic = time()
for i in range(10):
im = cv2.imread("test2.png")
im = cv2.resize(im, (100,100))
print(time(... | true |
739cb682ca030a1a7076a084b07c0f043ef5d225 | Python | nagi930/web_crawl | /youtube.py | UTF-8 | 2,073 | 2.609375 | 3 | [] | no_license | from urllib.parse import quote
from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd
pd.options.display.max_rows = 1000
pd.options.display.max_columns = 1000
search = input('search\n')
_quote = quote(search)
url = f'https://www.youtube.com/results?search_query={_quote}'
options = webdrive... | true |
7bd896d89dd76e6d031fb8aee640837df1fb94d5 | Python | wbaizer/DragEncrypt | /dragencrypt/encryption/dragencrypt_aes256.py | UTF-8 | 2,766 | 3.015625 | 3 | [] | no_license | import base64
import functools
import getpass
import json
import sys
# Borrowed from https://bitbucket.org/brendanlong/python-encryption/src/1737e959fa307d84a5dcf96c4139b1d91a08b2e9/encryption.py?fileviewer=file-view-default
try:
import Crypto
except ImportError:
print " --- Please run pip install pycrypto"... | true |
e518e0e6bbeaeaf24940f35f0d955ce317309641 | Python | hyeonmin97/project | /study/.history/db_20210509165410.py | UTF-8 | 691 | 2.9375 | 3 | [] | no_license | #import pymysql # pymysql 임포트
#
## 전역변수 선언부
#conn = None
#cur = None
#
#sql = ""
#
## 메인 코드
#conn = pymysql.connect(host='192.168.0.24', user='admin',
# password='gusals97', db='sensor', charset='utf8') # 접속정보
#cur = conn.cursor() # 커서생성
#
## 실행할 sql문
#sql = "select * from test"
#cur.execute(sq... | true |
992f3f41bd303be6a82d1c54a18cd9445cf28104 | Python | devin-efendy/track-me-py | /track_me.py | UTF-8 | 3,039 | 2.53125 | 3 | [] | no_license | import string
import os
import sys
import re
import datetime
import numpy as np
import pandas as pd
from termcolor import colored, cprint
from colorama import Fore, Back, Style
import TrackMeConstant as TmConst
class TrackMe:
YEAR_INDEX = 0
MONTH_INDEX = 1
DAY_INDEX = 2
HEADER = '\033[95m'
OKBL... | true |
4ae16244cd948c415a50d8b6152f763226a206e7 | Python | P3926-2021/1D-TDSE_solver | /TISE_solver.py | UTF-8 | 2,055 | 2.875 | 3 | [] | no_license | from potential import *
'''=========================================================================='''
'''defining the function to carry out Numerov method'''
def Numerov(x,y1,y2,E):
'''returns y[i+1] value'''
u = 1 - (1/6.)*(h**2)*(V(x,t)-E)
return ((12-10*u)*y1-u*y2)/u
'''====================... | true |
e9bdfb3e37b53beecd633bda3f5719c300538cc1 | Python | bob-skowron/golf-scraper | /Scraper.py | UTF-8 | 3,444 | 2.53125 | 3 | [] | no_license | import bs4 as bs
import requests as req
import pandas as pd
import datetime
import urllib
espn_url = 'http://espn.go.com/golf/leaderboard'
response = req.get(espn_url)
html = response.content
soup = bs.BeautifulSoup(html, 'lxml')
#datagolf_url = 'http://datagolf.ca/live-predictive-model'
#datagolf_response... | true |
10ed5ac8bf2fd22c53b337c49d2d7cc330fb40a3 | Python | lahloug/pinger | /lib/lib.py | UTF-8 | 287 | 3.25 | 3 | [] | no_license | from time import time, sleep
def pinger(func, *args, **kwargs):
def wrapper(*args, **kwargs):
t1 = time()
func(*args, **kwargs)
print("execution time : {}".format(time() - t1))
return wrapper
@pinger
def sleep_some(n):
sleep(n)
sleep_some(3)
| true |
af1d98cebf86a8cb5c4a00a80dd336b009c1382d | Python | nuekodory/AtCoder | /ABC/ABC168/double_dots.py | UTF-8 | 689 | 2.984375 | 3 | [] | no_license | from collections import defaultdict
num_room, num_path = map(int, input().split(' '))
paths = defaultdict(set)
for i in range(0, num_path):
src, dest = map(int, input().split(' '))
paths[src].add(dest)
paths[dest].add(src)
rooms = {1}
route = {}
while rooms:
new_rooms = set()
for src in rooms:
... | true |
9917a4755dc361970b93fabb61e37e5219838616 | Python | tisaire/subversion | /python/TCP/tcp_client.py | UTF-8 | 234 | 2.96875 | 3 | [] | no_license | import socket
s=socket.socket()
s.connect(("localhost",9999))
while True:
message=raw_input("Mensaje a enviar: ")
s.send(message)
if message=="bye":
break
rcv=s.recv(1024)
print rcv
print "bye"
s.close | true |
8130c4565d5a581164d9aea1a2608028e5b9e6d4 | Python | Blitzdude/advent-of-code-2020 | /tutorials/python_fsm.py | UTF-8 | 404 | 3.25 | 3 | [] | no_license | # https://pythonspot.com/python-finite-state-machine/
from fysom import *
fsm = Fysom({"initial": "awake",
"final": "red",
"events": [
{"name": "wakeup", "src": "sleeping", "dst": "awake"},
{"name": "sleep", "src": "awake", "dst": "sleeping"},
]... | true |
9f97f3fd14ed351f59686d901e36a8899eb34a41 | Python | UsmanMahmood330/Python-Practice | /python-if-else.py | UTF-8 | 337 | 2.765625 | 3 | [] | no_license | import math
import os
import random
import re
import sys
if __name__ == '__main__':
#Adding Comments
print(sys.argv[0])
n = int(sys.argv[1])
l = n % 2
if (l == 1) or (n % 2 == 0 and n>= 6 and n<= 20):
print("Weird")
elif (l == 0) and ((n >= 2 and n <= 5) or (n>20) ):
print("N... | true |
a9cb21f9162abdf57a731281bea29d522eec2ba1 | Python | jkoser/euler | /solved/p37.py | UTF-8 | 443 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python3
from euler3 import *
limit = 1000000
primes = set(primes_below(limit))
def is_truncatable(p):
ds = list(digits(p))
nd = len(ds)
for i in range(1, nd):
if from_digits(ds[0:i]) not in primes:
return False
if from_digits(ds[i:nd+1]) not in primes:
... | true |
b410fa888354af9bdbcac879b0d2011df289f80b | Python | nk900600/Bridge-Labz1 | /Week1/funtions/harmonic_values.py | UTF-8 | 774 | 3.71875 | 4 | [] | no_license | """
******************************************************************************
* Purpose: calculate HarmonicValue
*
* @author Nikhil Kumar
* @version 3.7
* @since 24/08/2019
******************************************************************************
"""
from Week1.Utility.utility import HarmonicVal... | true |
9f023ab4d4a81012a4deac16595af80709a6a903 | Python | akashp1997/interview_prep | /algorithms/search/questions/10_missing_and_repeating.py | UTF-8 | 364 | 3.3125 | 3 | [] | no_license | #TODO
arr = [1,3,4,5,5,6,2]
xor = arr[0] ^ 1
elements = set()
for i in range(1, len(arr)):
xor = (xor ^ arr[i]) ^ (i+1)
set_bit = xor & (~xor-1)
print(set_bit)
x = 0
y = 0
for i in range(len(arr)):
if set_bit & arr[i]:
x = x^arr[i]
else:
y = y^arr[i]
if (i+1) & set_bit:
x = x... | true |
b9332de488b609f28e2dd71883f2bf2f7241eb73 | Python | Ridhwanluthra/chat_analysis_tool | /get_pos_tags.py | UTF-8 | 649 | 2.984375 | 3 | [] | no_license | import requests
# from BeautifulSoup import BeautifulSoup
from bs4 import BeautifulSoup
url = 'https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html'
response = requests.get(url)
html = response.content
soup = BeautifulSoup(html, 'lxml')
# print soup.prettify()
table = soup.find('table')
# prin... | true |
6ac200efa8d390cb169f177f35cc3f1871c56fc5 | Python | ShrayaniMondal/ImageProcessing | /Prog27/prg27.py | UTF-8 | 939 | 3.03125 | 3 | [] | no_license | '''
Take an image, convert to grayscale.
Perform Segmentation.
'''
import numpy as np
import cv2
################## SEGMENTATION #############################
img = cv2.imread('scene.jpg',0)
#cv2.imshow('img',img)
#cv2.waitKey(0)
cloud = img
water = img
trees = img
## showing cloud ##
row,col = cloud.shape
for i i... | true |
0175615b98cfa9dd87eeae889c29c93a32ff71af | Python | be2dt9/First_project | /1.py | UTF-8 | 3,036 | 2.96875 | 3 | [] | no_license | import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from matplotlib.animation import ArtistAnimation
#переменные велечины
seconds_in_year = 365 * 24 *60 * 60
seconds_in_day = 24 * 60 * 60
years = 3
t = np.arange(0,years*seconds_in_year,seconds_in_day)
#опреде функцию для си-... | true |
a2623b0c4709ef56013c813fad03b6eb38e18a30 | Python | realzhengyiming/scrapy-django-Template | /myscrapy/myscrapy/pipelines.py | UTF-8 | 2,386 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
from myapp.models import Meiju # settings中设置好了路径,这儿可以直接app导入django模型
from myapp.models import Classification # 这个和上一个是多对多的操... | true |
c33d0f7be67abe94e5db337efd1d4c1acda12d68 | Python | Centauria/Classifier | /qtutils/PlotQt.py | UTF-8 | 1,826 | 2.75 | 3 | [] | no_license | import pandas as pd
import os
import random
import string
import plotly.offline as pl
import plotly.graph_objs as go
from tempfile import TemporaryDirectory
class PlotQt:
def __init__(self):
self.html_directory = TemporaryDirectory('tmp')
def __del__(self):
self.html_directory.cleanup()
... | true |
958be6fb910cc925822eecd41a16de1c150dd4aa | Python | eriq-augustine/242-2016 | /code/learnWeights.py | UTF-8 | 4,843 | 2.75 | 3 | [] | no_license | import clustering
import data
import distance
import featureDistanceMap
import features
import metrics
import random
import sys
# We will hold weights constant and modify one at a time.
# Then we will make up to MAX_ITERATIONS passes or until the weights remain unchanged.
# The order we probe the weights will be rand... | true |
79461957aedb32c1c9f9597cad8fa0ba42cac8fd | Python | Jiliac/SublimePackages | /View In Browser/ViewInBrowserCommand.py | UTF-8 | 6,908 | 2.546875 | 3 | [
"MIT"
] | permissive | #
# History:
#
# 05/15/2014:
# - Current view only saves if there are modifications
#
# 07/03/2013:
# - Changes to support Sublime Text 3 and Python 3
#
# 06/15/2013:
# - Forward slashes in paths on Windows are now converted prior to opening using local server path
#
# 03/07/2013:
# - C... | true |
20883f5e6beb209b0044bedc1c56154a36c28f86 | Python | afcarl/quant-1 | /portfolio/factors/FinancialData.py | UTF-8 | 1,847 | 2.734375 | 3 | [] | no_license | # FinancialData.read_stock_names(STOCKS_FILE)
import pandas as pd
import quandl as Quandl
from yahoo_finance import Share
class FinancialData(object):
"""
Read financial data
"""
@staticmethod
def read_stock_names(STOCKS_FILE):
"""Read stock names from input file (S&P500 stocks)"""
... | true |
4fdea963d3c9cbcb426c5130985ebc2eece14677 | Python | PeeyushaRathi/Final_Year_Project | /Codes/test_kmeans.py | UTF-8 | 3,109 | 2.90625 | 3 | [] | no_license | from PyPDF2 import PdfFileReader
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.stem import PorterStemmer
import numpy as np
import sys
import os
import matplotlib.pyplot as plt
from nltk.corpus import stopwords
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.cluster impor... | true |
58e52e45557ae102e698b7769c70bf9201acf6ef | Python | Tharun1850/iris_knn | /iris_knn.py | UTF-8 | 1,644 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[13]:
import sklearn
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# In[33]:
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
# In[4]:
iris=load_i... | true |
3878afb9bfedaf0d4450b6d5cfa111fe813ad8d9 | Python | isaac-altair/CSC108-Introduction-to-Computer-Programming | /whiles_and_str.py | UTF-8 | 3,303 | 4.5 | 4 | [] | no_license | SEKRET = "password"
def check_password():
'''() -> bool
Return True iff the correct password is entered.
'''
tries = 0
# Try this at home! See what happens when you move "tries < 2" after
# the call to input.
while tries < 2 and not input("Enter your password: ") == SEKRET:
pr... | true |
86fd33d71818147089210c4b410c9dc5af98fedb | Python | rg3915/tcmrj-challenge | /backend/utils/read_csv.py | UTF-8 | 269 | 3.5 | 4 | [] | no_license | import csv
def csv_to_list(filename: str) -> list:
'''
Lê um csv e retorna um OrderedDict.
'''
with open(filename) as csv_file:
reader = csv.DictReader(csv_file, delimiter=',')
csv_data = [line for line in reader]
return csv_data
| true |
e299e418b323f81fb0791e8c56bfbd0afca742f1 | Python | iKeliven/Cadastro-pessoas-Covid-19 | /Funcoes.py | UTF-8 | 5,704 | 3.6875 | 4 | [] | no_license | def cabecalho():
print('*' * 40)
print("***********Faculdade Cesusc*************")
print("Curso: Análise e Desenvolvimento de Sistemas")
print("Disciplina: Lógica Computacional e Algoritmos")
print("Prof: Roberto Fabiano Fernandes")
print("Aluna: Keliven Bordin Demarchi")
print("Turma: ADS 1... | true |
7fbbb37277887ebe0817c12b60116f611b2cd30f | Python | shilad/macademia | /Macademia/scripts/semantic/mk_r_input_file.py | UTF-8 | 4,334 | 2.6875 | 3 | [] | no_license | import logging
import collections
import gzip
import string
import sys
import utils
LOGGER = logging.getLogger(__name__)
class ResultFile:
def __init__(self, name, path):
self.name = name
self.path = path
self.file = gzip.GzipFile(path, 'r')
self.retained_ids = set() # ids that s... | true |
4e8b7f2f42f16dd328bd46f067b6492ce1a92c2b | Python | dslsyeoh/python-examples | /beginner/loop_samples.py | UTF-8 | 3,893 | 4.03125 | 4 | [] | no_license | import random
sample_num_list = [1, 30, 12, 50, 100]
sample_str_list = ["Hello", "World", "How are you?"]
def generate_number_list(size):
number_list = []
for x in range(size):
number_list.append(x)
return number_list
def random_list_generator():
number_list = []
for _ in range(10):
... | true |
aa2080510fe5c9eeaaa2c4ee2291631f3440eff3 | Python | CaiqueSobral/PyLearning | /Code Day 1 - 10/Code Day 1 and 2 Data types and variables/Sum2DigitNumber.py | UTF-8 | 219 | 3.96875 | 4 | [] | no_license | two_digit_number = input("Type a two digit number: ")
first_digit = int(two_digit_number[0])
second_digit = int(two_digit_number[1])
result = first_digit + second_digit
print("A soma dos números é: " + str(result)) | true |
3a46ca6627652deea28845993fd415794aa5bfb5 | Python | lgbouma/astrobase | /astrobase/services/identifiers.py | UTF-8 | 13,671 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# convert_identifiers.py - Luke Bouma (bouma.luke@gmail.com) - Oct 2019
# License: MIT - see the LICENSE file for the full text.
'''
Easy conversion between survey identifiers. Works best on bright and/or famous
objects, particularly when SIMBAD is involved.
``simbad_to_... | true |
5d177afa799200fd1a36d91bc8da910a990c09ab | Python | qiancheng1/untitled | /day34/生产者消费者_2.py | UTF-8 | 799 | 3.234375 | 3 | [] | no_license | import queue
import threading
import random
import time
mqueue = queue.Queue()
def product(name):
n = 0
while n < 10:
print('%s zhengzai zhengchan baozi %s' %(name,n))
mqueue.put(n)
n += 1
time.sleep(random.randrange(3))
def consumer(name):
n = 0
while n < 10:
... | true |
24d43209a30a90c89eb289c5625ff3e13a6cc15b | Python | sunamya/Data-Structures-in-Python | /Queue/ImplementationUsingList.py | UTF-8 | 818 | 3.859375 | 4 | [] | no_license | class Queue:
def __init__(self):
self.queue=[]
def Enqueue(self,data):
self.queue.append(data)
def dequeue(self):
if self.isEmpty():
print("Queue is empty. Can not delete")
return
self.queue.pop(0)
def isEmpty(self):
... | true |
cef5c05cd1b24301e1ce8d97b6cd18d8220b5040 | Python | lbjhuang/pystudy | /socket/shili1/c4.py | UTF-8 | 339 | 2.625 | 3 | [] | no_license | import socket
sk = socket.socket()
sk.connect(('127.0.0.1', 8888))
while True:
accept_data = str(sk.recv(1024), encoding="utf8")
print("".join(('接收到内容', accept_data)))
send_data = input('输入发送的内容:')
sk.sendall(bytes(send_data, encoding='utf8'))
if send_data == 'bye':
break
sk.close() | true |
1c360e711e6ac630d5d5c01c35a90e5c4c178817 | Python | transifex/totem | /totem/main.py | UTF-8 | 13,293 | 2.578125 | 3 | [
"MIT"
] | permissive | """This is where the check suite is created and executed.
Any client that wants to be an entry point should use this module.
For example, a client could be a CLI.
If more Git services need to be supported in the future (other than Github),
this needs to be refactored.
"""
from typing import List
from totem.checks.ch... | true |
28fd163ec96191f9cb0c3c8b8a2fcad460a21144 | Python | martin-weber/visu_namen | /database.py | UTF-8 | 5,170 | 2.859375 | 3 | [] | no_license | import sys
import helper
import json
import sqlite3
class NamesUnitOfWork:
def __init__(self):
self.conn = None
def __enter__(self):
self.open()
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
def open(self):
if (self.conn is None):
... | true |
47a62a03dd6a864f440e02e63ad4e31446a214cb | Python | smarulan613/fundamentos_prog_20211_sebasmc | /TALLERES/TAL3_while_for_20210217_cur/25_for_edadestudiaturnos.py | UTF-8 | 1,684 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 22 20:33:04 2021
@author: R005
Se cuenta con la siguiente información:
Las edades de 5 estudiantes del turno mañana.
Las edades de 6 estudiantes del turno tarde.
Las edades de 11 estudiantes del turno noche.
Las edades de cada estudiante deben ingresarse por te... | true |
a6f67a2a29c2e2c6c4c0f33b18d44a6a1e35dec7 | Python | fabiolab/the-joker | /joker/adapter/joke_file_adapter.py | UTF-8 | 974 | 2.828125 | 3 | [] | no_license | import csv
from typing import List
from pendulum import now
from joker.domain.joke import Joke
from joker.port.joke_provider import JokeProvider
JOKES_FILEPATH = "data/jokes.csv"
class JokeFileAdapter(JokeProvider):
def __init__(self):
with open(JOKES_FILEPATH, encoding="utf-8") as joke_file:
... | true |
2323c7958b67e062f02148f1027c59778d762d37 | Python | wawawawawawawawawawa/My_Python_Practise | /processing/5.多进程不共享全局变量.py | UTF-8 | 309 | 2.625 | 3 | [] | no_license | import time
import multiprocessing
arg = [1, 2, 3]
def test1():
arg.append(22)
print(arg)
def test2():
print(arg)
def main():
p1 = multiprocessing.Process(target=test1)
p2 = multiprocessing.Process(target=test2)
p1.start()
p2.start()
if __name__ == "__main__":
main()
| true |
07e07c5b0410311d4013a8b82c4aeffa72533c38 | Python | ThibautBernard/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/6-print_comb3.py | UTF-8 | 267 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python3
for x in range(0, 10):
for i in range(0, 10):
if i > x:
print("{:d}".format(x), end="")
if x + i != 17:
print("{:d}".format(i), end=", ")
else:
print("{:d}".format(i))
| true |
1d7b5c1de2f21acea11c1a3e04ab7f483e35a7ae | Python | Shailesh-Tripathi/ComputerVisionAlgorithms | /PCA/tripathi-52_HW4.py | UTF-8 | 2,730 | 3.140625 | 3 | [] | no_license | import numpy as np
from skimage import io
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
## Q1
# Function to compute mean. Inputs:( image, xOrder(column), yOrder(row))
def computeSpatialMoment(img, p, q):
moment = 0.0
for r in range(0, len(img)):
for c in range(0, len(img[0])):
moment +... | true |
9b8f2a9c54f31d2334838b64fe40f716f12b017d | Python | seharkansal/pythonexamples | /fibonacci.py | UTF-8 | 700 | 4.3125 | 4 | [] | no_license | def fib(num):
'''recursive functionn for generating
fibonacci sequence
@pramas num: position till which series is printed
@return recursivley calling previous values
and calculating fibonacci number at that position'''
if(num==0)or(num==1):
#base case
return num;
... | true |
0ea1e234fe8a778bfddff998febfa0056f9fe62c | Python | tavy14t/AI_OntologyMerge | /Limbaj/relation_detector.py | UTF-8 | 3,703 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
# import unicodedata
def get_propozitii(text):
text = text.decode('UTF-8')
list_of_prop = re.split(";|\\.|\\!|\\?|\\n", text)
return list_of_prop
# -------------------------------------------------
def get_good_prop(propozitii, termeni_1, termeni_2... | true |
d4c834ff1f05144e0779935e8e510b52a14ab070 | Python | infrasparker/Rendering | /p2a_object/p2a_object.pyde | UTF-8 | 6,486 | 3.09375 | 3 | [] | no_license | # Devin Wu
time = 0 # use time to move objects from one frame to the next
def setup():
size (800, 800, P3D)
perspective (60 * PI / 180, 1, 0.1, 1000) # 60 degree field of view
def draw():
global time
time += 0.01
# camera (0, 0, 100, 0, 0, 0, 0, 1, 0)
if time > 11:
exit()
... | true |
b702aca08d555bfcf98aebc5b9ed3b9665ce4c8a | Python | r4k0nb4k0n/Wargame-Challenges | /SuNiNaTaS/WEB/23/chal23_blind_sqli.py | UTF-8 | 2,670 | 2.828125 | 3 | [] | no_license | import requests
url = 'http://suninatas.com/Part_one/web23/web23.asp'
cookies = {
'ASPSESSIONIDSCCTQBTQ': ''
}
payloads = {
'id': '',
'pw': ''
}
len_of_pw = 0
for i in range(100):
sqli = 'ad\'+\'min\' and len(pw)=%d--' % i
payloads['id'] = sqli
payloads['pw'] = '1234'
res = requests.get(ur... | true |
ce867ae60a8587126db821c6b38724ecce7d9007 | Python | Avery1493/Expense-Tracker | /main.py | UTF-8 | 2,786 | 4.125 | 4 | [] | no_license |
# Readlines
def read_lines():
'''Opens and reads expense.txt file and prints each line.'''
file_1 = open("expense.txt", "r")
Lines = file_1.readlines()
for line in Lines:
print(line)
# Add Expense (append)
def add_expense(new_expense):
'''Takes in a new expense as a parameter.
Adds ex... | true |
72218949042f8f6e1028478106087053b03cc80d | Python | willtuna/enc_practice | /Dev_Python/ext_euclid.py | UTF-8 | 3,563 | 2.9375 | 3 | [] | no_license | import numpy as np
from numpy.polynomial import Polynomial as P
def inv_mod_N(a,N):
vec1 = np.asarray([1,0])
vec2 = np.asarray([0,1])
rem1 = a
rem2 = N
while True:
quo1,rem1 = divmod(rem1,rem2)
vec1 = vec1 - quo1*vec2
if(rem1 == 0 ):
return vec2[0]
... | true |
7aaaf56cfe51d1acae95490ce66107b2ddf4b42c | Python | xndong1020/python3-deep-dive-02 | /4. Iterables and Iterators/6.check_if_iterable.py | UTF-8 | 343 | 3.6875 | 4 | [] | no_license | class SimpleIterable:
def __iter__(self):
return "Nope"
print("__iter__" in dir(SimpleIterable)) # True
for i in SimpleIterable: # TypeError: 'type' object is not iterable
print(i)
try:
for i in SimpleIterable: # TypeError: 'type' object is not iterable
print(i)
except TypeError:
... | true |
75d158f7d796b11b91da36b700511ad30d298edd | Python | nnyong/algorithm_ssafy | /D32/최소비용.py | UTF-8 | 1,310 | 2.703125 | 3 | [] | no_license | import sys
sys.stdin=open('최소비용','r')
T=int(input())
for tc in range(1,T+1):
n=int(input())
data=[list(map(int,input().split())) for _ in range(n)]
mymap=[[987654321]*n for _ in range(n)]
dy=[1,0,-1,0]
dx=[0,1,0,-1]
# 하우상좌
def isSafe(y,x):
if y<n and y>=0 and x<n and x>=0:
... | true |
d960faa38faff342c13ecd659e04838b7d5c9ecc | Python | liuluyang/spider_test | /wordcloud_jieba/test_2.py | UTF-8 | 398 | 2.515625 | 3 | [] | no_license | import jieba
string = '这个把手该换了,我不喜欢日本和服,别把手放在我的肩膀上,' \
'工信处女干事每月经过下属科室都要亲口交代24口交换机等技术性器件的安装工作'
string = 'python小号'
string = '有的人生来彷徨'
result = jieba.lcut(string)
print(len(result), '/'.join(result))
r = jieba.lcut_for_search(string)
print(r) | true |
95eae03268e956020f4b04e353f2ed2e8bb6e4b7 | Python | CodeHemP/CAREER-TRACK-Data-Scientist-with-Python | /02_Intermediate Python/2-dictionaries-and-pandas/03_access-dictionary.py | UTF-8 | 712 | 4.625 | 5 | [
"MIT"
] | permissive | '''
03 - Access dictionary
If the keys of a dictionary are chosen wisely, accessing the values in a dictionary
is easy and intuitive. For example, to get the capital for France from europe you can use:
europe['france']
Here, 'france' is the key and 'paris' the value is returned.
Instructions:
- Check out which key... | true |
5457c617fb6c24917fab797193052f93fded5a51 | Python | anhnguyendepocen/python-notes | /_build/jupyter_execute/nlp/language-model.py | UTF-8 | 2,551 | 3.65625 | 4 | [] | no_license | # Language Model
- Create the traditinal ngram-based language model
- Codes from [A comprehensive guide to build your own language model in python](https://medium.com/analytics-vidhya/a-comprehensive-guide-to-build-your-own-language-model-in-python-5141b3917d6d)
## Training a Trigram Language Model using Reuters
%%t... | true |
287e80370e7c87b6b0e4a5e47af5d713ab1d51e8 | Python | mohamedelfeky09/MummyIsland | /libs/vector.py | UTF-8 | 5,601 | 3.5 | 4 | [] | no_license | # made by mohamed nagy 2nd comp
from math import sqrt, acos, tan, degrees, atan2, sin, cos, pi
import sys
class Vec3:
x = 0
y = 0
z = 0
def __init__(self, x, y, z):
self.x = float(x)
self.y = float(y)
self.z = float(z)
def __pow__(self, Vec):
return Vec3(self.y * ... | true |
1e9a5b4c33505097b956a85fbb73f60596f1bab2 | Python | Aasthaengg/IBMdataset | /Python_codes/p03075/s926506491.py | UTF-8 | 110 | 2.703125 | 3 | [] | no_license | l=[]
for _ in range(5):
l.append(int(input()))
k = int(input())
print('Yay!' if l[-1] - l[0]<=k else ':(') | true |
cb1361ba9ea116b3fb76be10384bc98a1f6343d9 | Python | PrabhuSM16/darkCycleGAN | /split_data.py | UTF-8 | 1,061 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Split data into training and testing sets for rain and clear
from os import listdir, makedirs
from os.path import join, exists
from shutil import copyfile
src = 'JPG_RAIN2CLEAR'
dst = 'data'
subf = ['REAL_DROPLETS','CLEAN']
set_ = ['train', 'test']
type_ = ['rain', 'clear']
split = .8
for s ... | true |
a0437c5163d3fcbafea6cd8fc32d249e069f7823 | Python | dawn1666/pythonstudy | /Sep/week1/3menu.py | UTF-8 | 1,658 | 2.875 | 3 | [] | no_license | #!/usr/bin env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Author: Dawn Yan
Email: 402184660@qq.com
date: 2017/9/18
-------------------------------------------------
"""
__author__ = 'Dawn Yan'
menu={
'深圳':{
"宝安":{
'西乡':{
... | true |
578abfc4c9d12dd7c92b5c193032540be840d2f2 | Python | pks3kor/For_GitHub | /Learn_Python/002_scientific_computing/03_numpy_pandas_comparison/np/007.py | UTF-8 | 261 | 3.546875 | 4 | [] | no_license | import numpy as np
# Iteratign over array
tmp = np.arange(20).reshape(5,4)
print tmp
print "*"*100
print tmp.T
print "*"*100
for i,v in enumerate(tmp): # usign enumerate method
print i,v
for x in np.nditer(tmp): # using np.nditer method
print x, | true |
8c2736464b2b666eb3dbf0ee47808b1ad2bad1ee | Python | tswicegood/maxixe | /maxixe/tests/loader.py | UTF-8 | 2,137 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import os
import unittest
class FeatureFinderTestCase(unittest.TestCase):
def setUp(self):
import maxixe
maxixe.init()
def test_loads_name_from_file(self):
from maxixe.features import basics
self.assertEqual(basics.name, "Importable features")
def test_loads_description_f... | true |
f84a93a6de64a4603a6a7ca6cbf3a145b6f395ea | Python | minghuascode/pyj | /examples/clickoverride/Override.py | UTF-8 | 2,066 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | """ This example shows how to check in onBrowserEvent whether the
event targets a child, and if so refuse to handle it, so that
the child widget will be the only widget dealing with it.
see _event_targets_title() for details.
"""
import pyjd # dummy in pyjs
from pyjamas.ui.VerticalPanel import VerticalPa... | true |
2594373863afe66f0a270cc70a31adeb85c155e7 | Python | jjct1994/Python-Works-2017 | /Class Inharetance/Car.py | UTF-8 | 514 | 3.734375 | 4 | [] | no_license | #Jossue Cervantes Torres, Stephen Owiti
#Homework 4 Question 1
#Car.py
class Car:
def __init__(self, year, make):
self.__yearModel = year
self.__make = make
self.__speed = 0
#accessors
def getSpeed(self):
return self.__speed
def getYear(self):
return self.__yearModel
def getMake(self):
return... | true |
0a928fcc3d2a5930a89e20da4e298d3c721ca259 | Python | AlbinAndersson/algorithms | /exercises/sort.py | UTF-8 | 3,315 | 3.921875 | 4 | [] | no_license | """Implementation av sorteringsalgoritmer.
Fler alternativ finns beskrivna på Wikipedia_.
.. _Wikipedia: https://en.wikipedia.org/wiki/Sorting_algorithm#Popular_sorting_algorithms
"""
import logging
logger = logging.getLogger(__name__)
def binary_search(l1, value):
""" Binary search for lists.
WARNING: Do... | true |
22235cc5513840f0b38edcf63bba904a0d9d8bc2 | Python | scikit-learn/scikit-learn | /sklearn/feature_selection/tests/test_chi2.py | UTF-8 | 2,902 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | """
Tests for chi2, currently the only feature selection function designed
specifically to work with sparse matrices.
"""
import warnings
import numpy as np
import pytest
import scipy.stats
from scipy.sparse import coo_matrix, csr_matrix
from sklearn.feature_selection import SelectKBest, chi2
from sklearn.feature_se... | true |
f3dc88b8910d012f1482b071bf8637742b0d4bbd | Python | jiinmoon/Algorithms_Review | /Archives/Cracking_Code_Interview/Old/04_Trees_and_Graphs/4.11_randomNode.py | UTF-8 | 2,972 | 4.28125 | 4 | [] | no_license | """ 4.11 Random Node
Question:
You are implementing a binary searc htree class from scratch, which, in
addition to insert, find, and delete, has a method getRandomNode() which
returns a random node from the tree. All nodes should be equally likely to
be chosen. Design and implement an algorithm for g... | true |
ce96bfb34082f190827e246a6c6ae6417f3e7fc5 | Python | poku18/CE_III_06_Lab2 | /timeinssort.py | UTF-8 | 641 | 3.375 | 3 | [] | no_license | from lab2 import insertionSort
import random
from time import time
import matplotlib.pyplot as plt
n = 1000
i = 0
time_insertion_sort = []
sizeArray = []
#timing insertion sort
for i in range(n, n * 11, n):
sizeArray.append(i)
randomvalues = random.sample(range(i), i)
startTime = time()
insertionSort(randomvalues... | true |
8b68dafd7cea763f6dbc4e3d543261a655a45625 | Python | y0hk/pythonsandbox | /decowraps.py | UTF-8 | 511 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def swap(func):
"""中身をすり替えるだけで何もしないデコレータ"""
def _swap(*args, **kwargs):
"""さようなら!"""
return func(*args, **kwargs)
return _swap
def greet1():
"""こんにちは!"""
print('Hello, World!')
@swap
def greet2():
"""こんにちは"""
print('Hello, W... | true |
c06828d0c6e79347391a60edde7c70f74d204d26 | Python | Jinsongl/GPdoemd | /tests/test_models/test_sparse_gp_model.py | UTF-8 | 1,935 | 2.625 | 3 | [
"MIT"
] | permissive |
import pytest
import numpy as np
import warnings
from GPy.models import SparseGPRegression
from GPy.kern import RBF
from GPdoemd.models import SparseGPModel
"""
SET UP MODEL ONCE
"""
x_bounds = np.array([[10., 20.], [5., 8.]])
p_bounds = np.array([[ 2., 4.], [3., 5.]])
def f (x, p):
return x * p
ymin = np.arr... | true |
9f24c30c33f380ce4a0f95bc1c513466cccfd9f3 | Python | DongHyukShin93/BigData | /pandas/pandas02/Pandas02_01_FunEx06_신동혁.py | UTF-8 | 574 | 4.3125 | 4 | [] | no_license | #Pandas02_01_FunEx06_신동혁
# return문을 2번 사용하면,
# 두 번째 return문인 return a*b는 실행되지 않는다.
def add_and_mul(a, b) :
return a+b
return a*b # 두 번째 return문인 return a*b는 실행되지 않는다.
result = add_and_mul(3, 4)
print(result)
print("-"*20)
# return의 또 다른 쓰임새
# return을 단독으로 써서 함수를 즉시 빠져나갈 수 있다.
def say_nick(nick) :
if ... | true |
a9410c1f52f2b6e3869f54264804e8ae2edcf6ee | Python | BenjaminSchubert/web-polls | /backend/errors/http.py | UTF-8 | 1,709 | 3.203125 | 3 | [
"MIT"
] | permissive | """
This module contains a collection of commonly encountered HTTP exceptions.
This allows all these http exceptions to be treated in the same way and simplifies the return of errors to the user.
"""
from errors import ErrorMessage
__author__ = "Benjamin Schubert <ben.c.schubert@gmail.com>"
class BaseHTTPExceptio... | true |
a24b9cf824f95bb954a9faca7e684df9c7bf86e4 | Python | wwwdavid34/vms_char_match | /vms_visualize.py | UTF-8 | 7,168 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import os,sys,math,sqlite3
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
import simplekml
def plot_track(trk,hdr,lllat=None,urlat=None,
lllon=None,urlon=None,marker=None,
color='m',basemap=None,plot=True):
'''
T... | true |
5fc9a5acbf1ed346b183f6c7470a915b383340c3 | Python | PhilBeaudoin/misc | /math/equiv/equiv.py | UTF-8 | 1,202 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python
# Used to generate some sequences on OEIS.
input = [0,1,3,1,0,2,4,2,0]
def calcActives(input):
actives = []
line = 0
while True:
active = [i == line for i in input]
if not True in active:
return actives
actives += [active]
line += 1
def calcRanges(actives):
ranges = []
for a in act... | true |
9132f1053469808b104c3da88150815188e6c53e | Python | ssoso27/Smoothie2 | /pythAlgo/kakao/2021blind/03-2.py | UTF-8 | 1,206 | 3.140625 | 3 | [] | no_license | def solution(info, query):
answer = []
people = []
# 지원자 정보 저장
for row in info:
people.append([n.strip() for n in row.split(" ")])
people[-1][4] = int(people[-1][4])
# 질의
for row in query:
l, j, c, f, s = [n.strip() for n in row.split(" ") if n.strip() != "and"]
... | true |
ef9360654fac6ec04abce7e2b5409c78a5510b05 | Python | shhuan/algorithms | /py/google/cj2014/round1C/Enclosure.py | UTF-8 | 6,186 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
created by huash06 at 2015-04-10 11:21
"""
__author__ = 'huash06'
import sys
import os
sys.stdin = open('input/sample.txt', 'r')
# sys.stdin = open('input/B-small-practice.in', 'r')
sys.stdout = open('output/C-small-practice.out', 'w')
# sys.stdin = open('input/A-large-practice.in', 'r'... | true |
2d1865b668855a2c4955bb2d5461b8c9d7e62231 | Python | rishyjee/Pythonwithrishyjee | /printing.py | UTF-8 | 161 | 2.828125 | 3 | [] | no_license | print("Hello")
print("Monkeys eat banana all the times")
print(5*25)
#Over here you are writing something like a novel on this page
print("Hello world!")
| true |
e141cf2ee97937d95d134434698a6c2888774066 | Python | mhorn11/deepclr | /deepclr/engine/loss.py | UTF-8 | 1,646 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | from typing import Any, Callable, Optional, Tuple
from ignite.exceptions import NotComputableError
from ignite.metrics import Metric
import torch
from ..utils.metrics import MetricFunction
def _no_transform(x: Any) -> Any:
"""Default output transform."""
return x
class LossFn(Metric):
def __init__(sel... | true |
028bde61d801a9b1089c1c96607fa618fff5f24a | Python | salwan221/diabetic-retinopathy-detection | /classification_algorithm/inception_model/categorise_data.py | UTF-8 | 988 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import os.path
from shutil import copy
def categorise_data():
data=[]
labels=[]
PAR_DIR_PATH=os.path.abspath(os.path.join('./',os.pardir))
CSV_PATH=PAR_DIR_PATH+'/previous_model/trainLabels.csv';
TRAIN_PATH=PAR_DIR_PATH+'/previous_model/train';
DATASET_PATH=PAR_DIR_PATH+... | true |
b3b52740c2a614735af789fdd887ffc5feb816e8 | Python | loushingba/loushingbaPyRepo | /infinite.py | UTF-8 | 184 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 15 14:29:53 2020
@author: sanathoi
"""
# infinite loop
a=2
while True:
a*=2
print(a)
if a>100:
break
| true |
4a42131da59773558c5915b6e9985240d941c517 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2250/60839/291178.py | UTF-8 | 227 | 2.953125 | 3 | [] | no_license | x=int(input())
a=input()
b=input()
c=input()
if x==3 and a=="1,1" and b=="2,2" and c=="3,3":
print(3)
elif x==6 and a=="1,1" and b=="3,2" and c=="5,3":
print(4)
else:
print(x)
print(a)
print(b)
print(c) | true |
8591b425f0fcc53d40617a3e4b1562ca7d2ff561 | Python | pandapranav2k20/Python-Programs | /Lab 7b/ENGR102_504_pveerubhotla_lab7b_#4.py | UTF-8 | 1,056 | 3.90625 | 4 | [] | no_license | # By submitting this assignment, I agree to the following:
# "Aggies do not lie, cheat, or steal, or tolerate those who do."
# "I have not given or received any unauthorized aid on this assignment."
#
# Name: PRANAV VEERUBHOTLA
# Section: 540
# Assignment: lab 7b-4
# Date: 12 OCTOBER 2019
#
'... | true |
ef0d936c42ad13bf69f3bc5d73d55d5140f54a7d | Python | c3subtitles/subtitleStatus | /www/transforms.py | UTF-8 | 8,378 | 2.640625 | 3 | [] | no_license | import re
import logging
import textwrap
LOGGER = logging.getLogger(__name__)
BOMS = ['\ufeff',
'\uffef',
'\xef\xbb\xbf',
]
def strip_bom(text):
for bom in BOMS:
text = text.replace(bom, '')
return text
def normalise(text):
return strip_bom(text).replace('\r\n', '\n')
d... | true |
9a1e183d670774e9e8504a5b118d2bc04c6bb07e | Python | Nikkuniku/AtcoderProgramming | /ABC/ABC001~ABC099/ABC034/c.py | UTF-8 | 281 | 2.921875 | 3 | [] | no_license | W, H = map(int, input().split())
ans = 1
MOD = 10**9 + 7
def inv(k):
return pow(k, MOD-2, MOD)
for i in range(1, H+W-2+1):
ans *= i
ans %= MOD
for i in range(1, H):
ans *= inv(i)
ans %= MOD
for i in range(1, W):
ans *= inv(i)
ans %= MOD
print(ans)
| true |
7450356f2ab98676e19fbc77525584e308fccfec | Python | HelloJeong/bojCode | /17000/17294(귀여운수).py | UTF-8 | 346 | 3.046875 | 3 | [] | no_license | k = list(map(int, list(input())))
if len(k) == 1:
print('◝(⑅•ᴗ•⑅)◜..°♡ 뀌요미!!')
else:
v = k[0]-k[1]
for i in range(len(k)-1):
if k[i]-k[i+1] != v:
print('흥칫뿡!! <( ̄ ﹌  ̄)>')
break
else:
print('◝(⑅•ᴗ•⑅)◜..°♡ 뀌요미!!')
| true |
36fae0c7f647b262ed307e55924650724a40344e | Python | jaredvann/euler-python | /019.py | UTF-8 | 1,354 | 3.890625 | 4 | [] | no_license | '''
Project Euler Problem 19:
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twent... | true |
741ab0203e4f267b2a4da39a2912abbd356f8129 | Python | pablodarius/mod02_pyhton_course | /Python Exercises/3_question3.py | UTF-8 | 765 | 3.96875 | 4 | [] | no_license | import unittest
# Given 2 strings, s1, and s2 return a new string made of the first, middle and last char each input string
def add_ini_middle_fin(s1, s2):
result = ""
result += s1[0] + s2[0]
result += s1[len(s1) // 2] + s2[len(s2) // 2]
result += s1[-1] + s2[-1]
return result
class testing(unit... | true |
5a8abdd6f1670699d739634d1a4d0e69fffbf630 | Python | tensa2205/Tasks_Manager-Flask_React | /serverSide/models/ToDoItem.py | UTF-8 | 1,116 | 3 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
from db_sqlalchemy import db_sqlalchemy
db = db_sqlalchemy
class ToDoItem(db.Model):
id = db.Column(db.Integer, primary_key = True)
title = db.Column(db.String(90), unique=True)
completed = db.Column(db.Integer)
def updateTitle(self, newTitle, newCompleted... | true |
ec5b6d2e49db22119c55f581fafd14dea175bb21 | Python | Sukhorskyy/Map-of-friends | /main.py | UTF-8 | 586 | 2.6875 | 3 | [
"MIT"
] | permissive | from flask import Flask, request, render_template
import friends_map
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def friend():
# handle the POST request
if request.method == 'POST':
name = request.form.get('user_name')
friends_map.main(name)
return render_template('i... | true |
17ea9fa377a4d91668083a5dc415fe293add2448 | Python | phoxelua/matcha | /matcha/lib/plaid/plaid.py | UTF-8 | 3,882 | 2.796875 | 3 | [] | no_license | import datetime
from plaid import Client
from flask import current_app
from titlecase import titlecase
from werkzeug import exceptions
class PlaidClient:
"""
A wrapper class around the Plaid API client.
"""
def __init__(self, access_token=None):
"""
Initializes an instance.
... | true |
4d45d11199633521ae563ec5b154bd74aa84773e | Python | astronomeme/ciera-storage | /hc-code-spyder.py | UTF-8 | 4,387 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 13 12:08:47 2021
@author: naomi
"""
#imports -------------------------------------------------------
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from astropy.io import ascii
from astropy import constants as const
#setting up ------... | true |
f3ae7c24498e24a6be363b396c583e3d972799ad | Python | TimothyHelton/write-pythonic-code-demos | /code/ch_02_foundations/_06_state_your_state.py | UTF-8 | 414 | 3.234375 | 3 | [
"MIT"
] | permissive | import time
import sys
def main():
confirm = input("Are you sure you want to format drive C: [yes, NO]? ")
if not confirm or confirm.lower() != 'yes':
print("Format cancelled!")
sys.exit(1)
for _ in range(40):
time.sleep(.15)
print('.', end='')
sys.stdout.flush()
... | true |
0b425372ba2a79ae04d0a01eb691c78e9ecbda46 | Python | guzzt/Knight-s-tour | /src/Board.py | UTF-8 | 1,836 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame as pg
import numpy as np
class ChessBoard():
def __init__(self,dimensao,title):
"""Classe responsavel pela interface grafica"""
self.__bknight = pg.image.load('../img/bknight.png')
self.__wknight = pg.image.load('../img/wknight.png')
se... | true |
e39e2682772eca6a0db68cb157ca2e2fd4707543 | Python | andrewkim101/Selenium_practice | /SampleProjects/NavigationTest.py | UTF-8 | 818 | 2.890625 | 3 | [] | no_license | from selenium import webdriver
from BrowserFactory import BrowserFactory
from StringUtility import StringUtility
class NavigationTest():
""""""
def __init__(self, browser):
""""""
self.browser=browser
def test(self):
self.driver=BrowserFactory.getDriver(self,self.browser)
... | true |
91e1ded669c3753bb6c70bb64b4eebc4744b28a7 | Python | csaling/cpsc430_game_engine | /behavior_delete_object_location.py | UTF-8 | 694 | 2.5625 | 3 | [] | no_license | from behavior import Behavior
from game_logic import GameLogic
from sounds import Sounds
from pubsub import pub
class DeleteAtLocation(Behavior):
def __init__(self, event, sound = None):
super(DeleteAtLocation, self).__init__()
self.event = event
self.sound = sound
self.rea... | true |
e57337167a4d5f74b71716a94ce7fc4e8266a3b0 | Python | mere-human/core-python-ex | /11/grabWeb.py | UTF-8 | 549 | 2.953125 | 3 | [
"MIT"
] | permissive | from urllib.request import urlretrieve
def firstNonBlank(lines):
for eachLine in lines:
if not eachLine.strip():
continue
else:
return eachLine
def firstLast(webpage):
f = open(webpage, 'r', encoding='utf-8')
lines = f.readlines()
f.close()
print(firstNonBlank(lines), end='')
print(firstNonBlank(rever... | true |
f8647ab8ba83685ddb691a2c755dca5bf75e19f0 | Python | DJRumble/PHD | /Analysis/rumble_mass.py | UTF-8 | 598 | 3.28125 | 3 | [] | no_license | """Script for calculating the Mass using Rumble's method at 850microns at 250pc at kappa = 0.012"""
import numpy as np
#####################################################
#Function to deffine Mass - Kirk06 (850 only)
def djr(S,T,kappa,d):
"""Takes inputs of; Flux (S in Jk), Temperature (T in Kelvin), oppacity (... | true |
460a54ca1f934e3318b5d20cb741fe14700d8506 | Python | tumkir/pokemon_map | /pokemon_entities/models.py | UTF-8 | 1,767 | 2.515625 | 3 | [] | no_license | from django.db import models
class Pokemon(models.Model):
"""Покемон"""
title_ru = models.CharField(max_length=200, verbose_name='название')
title_en = models.CharField(max_length=200, blank=True, verbose_name='название на английском')
title_jp = models.CharField(max_length=200, blank=True, verbose_na... | true |