blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
e08d08ef9a7e359125d35fb6f6c72e05b7f0e529
yuancf1024/Python-cf
/Python_dive_to_understand.py
UTF-8
762
3.078125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : Python_dive_to_understand.py @Time : 2021/06/19 11:19:02 @Author : Chenfeng Yuan @Address : Shapingba district, Chongqing, China @Version : 1.0 @Contact : chenfengyuan@cqu.edu.cn @License : (C)Copyright 2021-2022, Chengroup-CQU-Structural...
true
7a00b7b5e1d9fe973dc6a4ba7322323173e5caa0
kunlay/Training
/Exercise.py
UTF-8
543
3.703125
4
[]
no_license
# name = input("what is your name? \n") # age = int(input("how old are you? \n")) # year = str((2017 - age)+100) # print(name + " you will be 100 in " + year + " years") # new_number = int(input("enter a new number? \n")) # year = str((2017 - new_number)+100) # print((name + " you will be 100 in " + year + " years" '\n...
true
6dbca0f1f45efe5be450a99021648a973d6b8a75
AvinashSubhash/NeuralNetwork-from-scratch
/custom-modules/BackPropagation.py
UTF-8
824
2.796875
3
[]
no_license
import numpy as np def BackwardPropagation(data,no_of_layers,debug=False): m = data['Y'].shape[1] for i in range(no_of_layers,0,-1): if i == no_of_layers: dz = data['a'+str(no_of_layers)] - data['Y'] else: dz = np.dot(np.transpose(dat...
true
93f74db330e41bf5d0550c5e1f7da5d49d101f68
ahribori/pypypypypypypy
/문자열.py
UTF-8
724
4.5
4
[]
no_license
print('Hello, world') print("Hello, world") print(''' Hello, world ''' ) print(""" Hello, world """ ) text = 'python' print(text) # 문자열 반복 print('twice' * 2) # twicetwice # 문자열 길이 print(len('hello world')) # 11 # 문자열 인덱스 print('abcde'[3]) # d # 문자열 슬라이스 ([인덱스 i: 인덱스 k+1]) pri...
true
8b78b7693a9df295379cbaae1dbdf4b46d409af6
WalkerDoesCode/Walker-Project-Euler
/PE90.py
UTF-8
1,743
3.625
4
[]
no_license
''' Author: Walker Kroubalkian Brute Force Approach to Project Euler Problem #90 ''' import time def subset(myList,n): l = len(myList) if(l==0): if(n==0): return [[]] return [] if(l<n): return [] if(l==n): return [sorted(myList)] a = myList[0] total ...
true
dc9ac66a9544246f87b5a6646de4e0a56b42dce3
DevRaphael7/exercercios-Python
/Exercício12.py
UTF-8
215
3.546875
4
[]
no_license
#Exercício 11 do livro de Algoritmo num1, num2 = float(input()), float(input()) print('%.2f elevado ao %.2f = %.3f' % (num1, num2, num1 ** num2)) print('%.2f elevado ao %.2f = %.3f' % (num2, num1, num2 ** num1))
true
f245f3ccc15c5b258bd9b2007d6402bc5a7d61de
xiangsisi-1/python
/p-2019.9.25/name.py
UTF-8
90
3.078125
3
[]
no_license
names=['张三','李四','王二'] #问候语 for name in names: print("Hello,"+name)
true
b770e56bd4c6d7c2e8cc0ab1dbc21c86ad0a2d63
vision72/MachineLearning_Space
/Work_Space/Tour_on_Kaggle/Project1_Interview/predict.py
UTF-8
703
2.96875
3
[]
no_license
from sklearn.tree import DecisionTreeRegressor import pandas as pd interview_dataset = pd.read_csv('C:\Users\Admin\Desktop\~Vision\Vision\Machine Learning\~vision_datasets\dataset1.csv') prediction_target = interview_dataset.Pass sel_data = ['Age','Skills','Marks'] training_data = interview_dataset[sel_data] tree...
true
73eef9acc6cd233d4ee69cc09acbe686478eba75
QiZhan/Project
/SRC/main.py
UTF-8
1,373
2.859375
3
[]
no_license
from utilities.wordFrequency import Words from utilities.tools import printLine from utilities.genderProbList import GenderProbList, ENUM_M, ENUM_F from utilities.classifer import Classifer import sys import getopt sufData = "_suffix_data.txt" symData = "_symbol_data.txt" wordData = "_word_data.txt" def input_n(messa...
true
144ded103c2c609731386fd48a125da0b3196d0e
FelixWindisch/PyRayT
/meshImport.py
UTF-8
1,232
2.546875
3
[]
no_license
import pywavefront import os import Objects import Color from Vector import* def import_mesh(path): scene = pywavefront.Wavefront(path, strict=True) triangles = [] for name, material in scene.materials.items(): for i in range(0, int(len(material.vertices) / 24)): y = i * 24 ...
true
172883f037261373f4bca47f75d33cbdb25a87e7
tanzhuqing/ForDemo
/pythonPracticeOfDataAnalysisAndMining/com/tzq/learning/demo/ch5/discrete_point_test.py
UTF-8
1,268
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- ''' Created on 2016��11��28�� @author: Tan Zhuqing ''' import numpy as np import pandas as pd inputfilepath = 'E:\\pythonDataSet\\chapter5\\demo\\data\\consumption_data.xls' k = 3 therashold = 2 iteration = 500 data = pd.read_excel(inputfilepath,index_col='Id') data_zs = 1.0*(data-data.mean())...
true
a7c391ae7a6399c0e295198e7dedae24093bc8f7
Celtoys/PiB
/Python/ComputeBridgePlatform.py
UTF-8
4,387
2.515625
3
[ "MIT" ]
permissive
# # Uses ComputeBridge (https://github.com/Celtoys/ComputeBridge) to unify compute code for OpenCL/CUDA # import os import Utils import Process import BuildSystem # Require user to set the installation directory _InstallPath = None def SetInstallPath(path): global _InstallPath _InstallPath = ...
true
203dda89aa0adcbd93da46f216208ed821dcaea9
josephxsxn/alchemists_notepad
/Object/Potion.py
UTF-8
734
3.078125
3
[ "Apache-2.0" ]
permissive
from Object.Ingredient import Ingredient class Potion: def __init__(self, ingredient_one, ingredient_two, potion_color, potion_sign): self.ingredients = [ingredient_one, ingredient_two] self.color = potion_color self.sign = potion_sign def get_ingredients(self): return self.ingredients def get_color(self):...
true
de8e3a9c52ffed5c1ec08313ac3c30cb0653c7e8
amplify-education/rover
/rover/config.py
UTF-8
4,140
2.515625
3
[ "MIT" ]
permissive
# # Copyright (c) 2009 Wireless Generation, Inc. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, ...
true
22ae87727868ae56725a6a6f2ba76b1b5c33443e
1tracy/uw-bot
/dates.py
UTF-8
1,902
3.3125
3
[]
no_license
import datetime from web_scrape import * raw = formatted('https://uwaterloo.ca/registrar/important-dates/list?academic_year=229&date=All&page=1') def format_time(time): ''' formats time into datetime parsable object ''' time = time[:12] year = time[-4:] time_a = time.split(',')[0].split(' ') day =...
true
6d9443e71b9407ef48db261e21b63e1b81bb3595
SirVer/edu_trees
/red_black_tree.py
UTF-8
5,938
3.1875
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 import pydot from bin_search_tree import Node, BinarySearchTree RED, BLACK = 0,1 class RedBlackNode(Node): def __init__(self, key, parent = None, l = None, r = None): Node.__init__(self, key, parent, l, r) self.color = BLACK @property def pydot_nod...
true
97d885c6945196bc43419a6aa2288853e163526a
BFriedland/data-structures
/test_validate_parenthetics.py
UTF-8
1,839
3.078125
3
[ "MIT" ]
permissive
''' Test suite for validate_parenthetics.py Usefully informed about the way unit tests look by: https://github.com/linsomniac/python-unittest-skeleton/ blob/master/tests/test_skeleton.py ''' import unittest import validate_parenthetics as vp # So the unit test class is called test_file_name class test_validate_pa...
true
e4d8651b0956be8cb46da6746eb2c825d90e7354
Blank-09/12-Python
/Patterns/simple/rhombus.py
UTF-8
790
4.09375
4
[]
no_license
# Using and operator for i in range(9): for j in range(9): if not (j < (13 - i) and j >= (i - 4) and j >= (4 - i) and j <= (4 + i)): j = ' ' print(j, end=' ') print() # Separator print('\n') # ignore this line: this line prints two new lines # Separator # Using or operator for i i...
true
779d7e6ece2f55c893336c2eb21f8477d69b407f
frank-carnovale/trains
/trains/__main__.py
UTF-8
2,370
3.234375
3
[ "LicenseRef-scancode-public-domain" ]
permissive
""" "Trains" Main Program. See full documentation at http://octalfutures.com/trains (authorisation needed) """ import sys from core import Network, LoadError ############################ def _oops(exception_class, value, traceback): """Global Exception handler""" # notify sysops here! include 'traceback' in t...
true
41b82638043be150eead3a258b9511d0fcdfe2a5
joancafom/carrot
/arduino/PC/ElegooBoard.py
UTF-8
2,380
3.453125
3
[]
no_license
import serial ''' Class that handles communications with the board ''' class ElegooBoard: ''' By default, port and frequencies are hardcoded to match our own ElegooBoard and VM configuration. You may change this parameters as required. ''' def __init__(self): self.board ...
true
893a4d6529ff40d0446c61423f13e87041675c1a
imosafi/Prob_Smoothers
/ex2.py
UTF-8
6,246
3.453125
3
[]
no_license
import sys from Utils import * from LidstoneSmoother import LidstoneSmoother import math from HeldoutSmoother import HeldoutSmoother VOCAB_SIZE = 300000 # Calculate the perplexity of a given estimator on the validation data. def calculate_perplexity(estimator, validation): log_likelihood = 0.0 for word in ...
true
750f026abbac0923cdf24701696b6e151334e908
seoyj0330/Moocl_gurumi
/test01.py
UTF-8
3,340
2.96875
3
[]
no_license
#의미 있는 단어들 리스트를 합쳐서 한 단어로 만들기 #-*- coding:utf-8 -*- from __future__ import unicode_literals import re import unicodedata import hgtk make = [[('좋', 'VA'), ('은', 'ETM'), ('영화', 'NNG')], [('마지막', 'NNG'), ('대결', 'NNG')], [('만화', 'NNG'), ('원작', 'NNG')], [('뻔하', 'VA'), ('ㄴ', 'ETM'), ('스토리', 'NNG')]] # for makings in mak...
true
0a1721899f6cbc321ca12380c37eb52abc66e533
bhrigu123/interview_prep_python
/missing_no.py
UTF-8
364
3.390625
3
[]
no_license
# 1 - > n-1A ''' This algo can also be used to sort nos in linear time O(n)''' def missing_no(num): #O(n) i=0 size = len(num) while i < size: if num[i] -1 != i and num[i] < size-1 and num[i] > 0: num[num[i]-1], num[i] = num[i], num[num[i]-1] i-=1 i+=1 for i,each in enumerate(num): if i != each-1: ...
true
191480d0cced295017290d08e6205707fd23d36a
dudeArt/flask
/app/views.py
UTF-8
1,512
2.609375
3
[]
no_license
from app import app, db, models from flask import render_template, flash, redirect from forms import LoginForm @app.route('/') @app.route('/index') def index(): return render_template('index.html', title = 'Main Page') @app.route('/profile/<int:id>') def profile(id): user = models.User.query.filter_by(id = id)...
true
439b104393d3a39315d74923815eb2e3a733fb44
aspencerpsu/Tkinter
/packingorder.py
UTF-8
322
3.609375
4
[]
no_license
from Tkinter import * def result(): print "The sum of 2+2 is %.2f"%(2+2) win = Frame() win.pack() Button(win, text='Add', command=result()).pack(side="left") Label(win, text="Click 'Add' to get the sum or 'Quit' to exit").pack(side="top") Button(win, text='Quit', command=win.quit).pack(side="right") win.mainloop(...
true
f9e20c544cc72592e53a2b1ed4033d1d1fc8f5a3
asomu/wc_study
/Source/day5_3/numpyPart/numpyEx4.py
UTF-8
347
3.390625
3
[]
no_license
import numpy as np arr1 = np.array([5,2,6,3,9,8]) print(arr1) print(arr1[2]) print(arr1[:4]) arr1[2] = 100 print(arr1) arr2 = np.array([[2, 4, 5, 9], [10, 60, 70, 80], [500,700,400,100]]) print() print(arr2) print() print(arr2[1][1]) print(arr2[1, 1]) print() print(arr2[1:, 2:]) p...
true
5fd71a416d04e2efd3e2347563ac2a948718ca8b
lifelmy/pythonLearning
/HomeWork/2017-11-21-process.py
UTF-8
1,400
3.296875
3
[]
no_license
''' #Process类来代表一个进程对象,使用Process创建一个进程 from multiprocessing import Process import os def doSome(p): print('子进程总要输出点什么',p) print(os.getpid()) if __name__=='__main__': print(os.getpid()) p=Process(target=doSome,args=('hello',)) p.start() #join()方法可以等待子进程结束后再继续往下运行,通常用于进程间的同步 p.join() prin...
true
6ec76acdb9ac07e078a9c3c6f0e66de46323b319
worthurlove/python-data-analysis-practice
/shuyuzaixian_spider.py
UTF-8
3,676
2.921875
3
[]
no_license
''' Description:对术语在线网站(http://www.termonline.cn)中查询结果的分页表格数据进行爬取 Author:worthurlove Date:2019.7.1 ''' import time import re import pandas as pd from urllib import request #去除数据里的<span></span>标识符 def deleteSpan(s): clean_s = '' i = 0 while i < len(s): if s[i] == '<': i += 1 ...
true
874108ac45ce84b0a75b080f1f61402fee217a6f
retsepile/python-tuples-list
/task2.py
UTF-8
291
3.3125
3
[]
no_license
# Exercise 2 def common_member(ages, ages1): for x in ages: for y in ages1: if x == y: result = True return result print(common_member([2, 12, 12, 14, 15, 16, 16, 17, 18, 14, 20, 20], [2, 4, 12, 14, 15, 16, 16, 17, 18, 14, 20, 20]))
true
d56828be4cf984bcf6f220b7003c786955581fa5
MHalamu/Pycharm
/DesignPatterns/ObserverPattern/WindowDisplay.py
UTF-8
339
2.671875
3
[]
no_license
from DesignPatterns.ObserverPattern.IObserver import IObserver class WindowDisplay(IObserver): def __init__(self, observable): self.observable = observable self.temperature = None def update(self): print "Executing update on WindowsDisplay" self.temperature = self.observable....
true
5a35887219fbaa01ca58e9c7b9ea0be1c3b1bb1e
SeppPenner/ChatterBot
/tests/storage_adapter_tests/integration_tests/mongo_integration_tests.py
UTF-8
573
2.578125
3
[ "BSD-3-Clause" ]
permissive
from tests.base_case import ChatBotMongoTestCase class MongoStorageIntegrationTests(ChatBotMongoTestCase): def test_database_is_updated(self): """ Test that the database is updated when read_only is set to false. """ input_text = 'What is the airspeed velocity of an unladen swallo...
true
cf0b999436e041f2a1889afb388c5cd5be50d614
ibtidah/factcheckers
/scrappers/spiders/gScholar.py
UTF-8
1,267
2.734375
3
[]
no_license
import scrapy import requests import mimetypes class ArticleItem(scrapy.Item): title = scrapy.Field() abstract = scrapy.Field() class QuotesSpider(scrapy.Spider): name = "gScholar" def start_requests(self): urls = ['https://scholar.google.com/scholar?start=20&hl=en&as_sdt=2005&sciodt=0,5&cite...
true
ee930074bedb205eacf1165a2445c1f2d66243c6
AsifZaman777/Python
/Python Tutorial/Py4/List/Nested List.py
UTF-8
220
2.90625
3
[]
no_license
nested=[['e','r','a','m'],['s','a','r','a']] print(nested) print(nested[-1]) print(nested[0][1]) print(nested[-1][2]) if (nested[0][1])==(nested[-1][2]): print("Kismat Connection") else: print("Chill ")
true
9a65b47bf8f1fcc8690bc7d0a7bccf4a48f4722e
hongyusu/AaltoHackathon2015
/RouteEngine/route_base.py
UTF-8
5,442
3.1875
3
[]
no_license
import numpy as np import copy class Node: def __init__(self, nid, par, dis): self.nid = nid # node id self.par = par # parent reference self.dis = dis # distance up to this node def __repr__(self): return "%d<-%d, dis:%.3f" % (self.nid, self.par.nid, self.dis) def readGra...
true
efa2c51fa9bff8ca74b5b7e0ee19bd4b7e7214ba
blhwong/algos_py
/leet/longest_repeating_character_replacement/main.py
UTF-8
680
3.265625
3
[]
no_license
class Solution: def characterReplacement(self, s: str, k: int) -> int: ans = 0 start = 0 tracker = {} curr_longest = 0 for end in range(len(s)): letter = s[end] if letter not in tracker: tracker[letter] = 0 tracker[letter] ...
true
1516e77a2720e3a2cd8da39decb0d456479d2d16
anandaman43/time_series
/different_models/freq.py
UTF-8
2,230
2.625
3
[]
no_license
import pandas as pd from datetime import datetime from transformation import remove_negative import transformation def frequency(input_df): """ returns number of datapoints in last year :param input_df: :return: """ input_df = transformation.remove_negative(input_df) latest_date = input_d...
true
57d369986b632a82fab6ce086d3982ed3d98c787
bbriano/cs50
/introduction/6-python/wall.py
UTF-8
38
2.5625
3
[]
no_license
for _ in range(3): print('#' * 3)
true
1c0055219c427036bd21a4d3ffe756681c607fca
lindaludovisi/anomalydetection
/main_rectangles.py
UTF-8
6,962
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Feb 16 12:39:14 2021 @author: Linda.LUDOVISI @since: Tue Feb 16 12:39:14 2021 @version: 1.0.0 History: 1.0.0 - Main program for hough transform and shape detector For transparent products use: L-H 0-180 ...
true
e4803ae6ce6fb3e4f442aa8c9f168ac5dd333f88
markfmccormick/ChessBaxter
/detect_chessboard.py
UTF-8
4,051
3
3
[]
no_license
import numpy as np import cv2 from matplotlib import pyplot as plt """ Used to detect where in the given image path the chessboard is Returns two sets of keypoints, the corners and centers of each square, as pixel coordinates of their locations in the new image. Requires opencv to be compiled with extr...
true
083bc91754921c12940c0eda669c2aa446ced809
kkahloots/Autoencoders-tensorflow-datesets
/utils/plots.py
UTF-8
6,714
2.671875
3
[ "MIT" ]
permissive
import gc import random import numpy as np from tqdm import tqdm from PIL import Image from skimage.transform import resize import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D #---------------------------------------------------------------------- # Scale and visualize the latent vect...
true
c57f6c3b0fd265c14637cf08bb2c6886ea5f566c
joshUNIperu/python-pi-example
/main.py
UTF-8
145
3.203125
3
[]
no_license
#first code in ubuntu def main (msg): #Adding the second comment to this file. // Print a message print(msg) main("Hello People")
true
539410ed67e1298d42bb3f4f8b32c0f4287bd2a0
sudhanshupatra/hcsp-chc
/AE/ProblemInstances/HCSP-3O-MPE/generador_priorities.py
UTF-8
980
2.859375
3
[]
no_license
#encoding: utf-8 ''' Created on Oct 3, 2011 @author: santiago ''' import sys import random AO_lo = (1,10) AO_med = (1,20) AO_hi = (1,30) if __name__ == '__main__': argc = len(sys.argv) if argc != 4: print "Modo de uso: python %s <cant_tareas> <heterogeneidad> <seed>" % sys.argv[0] print...
true
631cd6ee13ffd4bd434c0877b9dda3aa112a6b18
bkuzmic/mobilecloud-14-python
/python2.7/src/example3/video_svc_server.py
UTF-8
1,913
2.703125
3
[]
no_license
''' Created on Jul 30, 2014 @author: bkuzmic ''' import BaseHTTPServer import json import http_config from video import Video HOST_NAME = http_config.HOST PORT_NUMBER = int(http_config.PORT) videoList = [] class WebHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): if not self.path....
true
f73670f93088ef0889cdec5ab988e88b68485288
LostKe/python-study
/demo/Person.py
UTF-8
737
3.953125
4
[]
no_license
# coding=utf-8 ''' 定义类 ''' class Person(object): location = 'futian sz zh' def __init__(self, name, age): self.name = name self.age = age def __len__(self): return 100 def print_info(self): print("name==>%s,age==>%s" % (self.name, self.age)) p = Person("zs", 20) ...
true
57ad3ed5e579f3138ebb0b9e02e65682e9c1b131
Devaria-Oficial/gerenciador-tarefas-python
/utils/Validacao.py
UTF-8
205
2.828125
3
[]
no_license
from datetime import datetime def validar_data(data, formato_data='%Y-%m-%d'): try: data = datetime.strptime(data, formato_data) return data except Exception: return None
true
5abc59b5857f55dda92b402424bf80ad48b83a16
Chameleon-Coder/Jetpack-Man
/src/main/Entity.py
UTF-8
3,412
3.265625
3
[]
no_license
""" An Entity is an Object that moves and can collide It can have velocity, acceleration, and several other properties """ from Object import Object from Vector import Vector import math class Entity(Object): Entities = [] def getNextFrame(self): """ Calculates the current animation. ...
true
eeef38d82151fda933f529ed5d1476c9d66d7569
python-ops-org/python-ops
/dates/25-09-2020/pr.py
UTF-8
1,005
2.578125
3
[]
no_license
import re import subprocess from re import findall def port(portn): try: cmd='netstat -ntlp | grep "%s"'%portn p=subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) out, _=p.communicate() q=str(out) port_num = findall(':([^ ]+)', q)[0] #print(port_num) ...
true
1adf07128c7c37431ee12748752730270ea17b26
SeadexGmbH/essentials
/cfg/jenkins/linux/clang_set_compiler.py
UTF-8
748
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import subprocess def main(): # Get the available options for c++ cmd = "sudo update-alternatives --list c++" output = subprocess.check_output(cmd.split()).decode().strip() print(output) options = output.split('\n') # Find the index of the option for clang++ clang_i...
true
fa640b593699c4fc4edb6024799adecd2c3a6c46
CosmicQubit/type-2
/gui_txt_text.py
UTF-8
3,659
3.828125
4
[ "Unlicense" ]
permissive
txt_help_text = """ This app will predict the probability of you developing type-2 diabetes. In order to use it, fill in all the fields and press send. To make sure everything runs smoothly, there are some restrictions: 1) Negative numbers cannot be given. 2) The correct type of information must be entered e.g no ...
true
9cb509c840bf730b533a0d0ccb61c6c62fd474a0
DaHuO/Supergraph
/codes/BuildLinks1.10/test_input/CJ/16_3_1_ayatuki_solv.py
UTF-8
1,259
2.84375
3
[]
no_license
import sys import sys data = [v.rstrip() for v in open(sys.argv[1])] T = data[0] dataset = data[1:] def ToRoom(line): rs = [int(v) for v in line.split()] result = [] sum = 0 for i, r in enumerate(rs): sum += r result.append([chr(ord('A')+i), r]) return result, sum ...
true
c443afacb65f2fd34cfa3c45be8420f0de3b2377
yankuang608/hamsterTornado
/sklearnhandlers.py
UTF-8
4,418
2.515625
3
[]
no_license
#!/usr/bin/python from pymongo import MongoClient import tornado.web from tornado.web import HTTPError from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop from tornado.options import define, options from basehandler import BaseHandler from sklearn.neighbors import KNeighborsClassifier from s...
true
f1b40d2847d5741f4e139122d75f8e9d71b7f8c0
danubio1982/520
/Aula2/condicionais.py
UTF-8
1,606
4.125
4
[]
no_license
#!/usr/bin/python3 # carro = input('Digite qual o caminho a ser seguido: ') # a = 'engarrafado' # b = 'livre' # if a == 'engarrafado': # print('Melhor ir pela b') # else: # print('Indo pelo camiho a') ### ## Estrutura de condicional simples ## # nome = input('Digite seu nome: ') # # if nome == 'Danubio':...
true
e36a6c34789eace99b70f0010e9e320b2f3bc038
sparkle6596/python-base
/pythonProject/function/demo1.py
UTF-8
236
3.265625
3
[]
no_license
#def fname(arg1,arg2) #fn definition #call()(using fname) #1 fn without argument and no return type #add 2 number def add(): num1=int(input("enter num1")) num2= int(input("enter num2")) sum=num1+num2 print(sum) add()
true
84e2368d7102c3cc727801d5d0bf7c90f2f8b536
PacktPublishing/Getting-Started-with-Python
/Chapter21/xfs_error_log.py
UTF-8
790
2.84375
3
[ "MIT" ]
permissive
import re def match_regex(filename, regex): with open(filename) as file: lines = file.readlines() for line in reversed(lines): match = re.match(regex, line) if match: regex = yield match.groups()[0] def get_serials(filename): ERROR_RE = "XFS ERROR (\[sd[a-z]\])" m...
true
b51d0652e710ec6fa3ac0324f19d7f90d10a8904
chhandita/Tic-Tac-Toe-Q-Learning
/TCGame_Env.py
UTF-8
3,222
3.34375
3
[]
no_license
from gym import spaces import numpy as np import random from itertools import groupby from itertools import product class TicTacToe(): def __init__(self): # initialising the board # initialise state as an array self.state = [np.nan for _ in range(9)] # initialises board pos...
true
2a331ee4a9b54aa5dea18da35a0d9500f4a1d339
Shubh1815/Chess
/client.py
UTF-8
1,325
2.921875
3
[]
no_license
import pickle import socket class Network: def __init__(self): self.client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.host = 'localhost' self.port = 5555 self.addr = (self.host, self.port) def send_board(self, board): board = pickle.dumps(board) s...
true
9b724c866e62bcebd86b0ef02ae88ad7a33a14e8
roholazandie/ParlAI
/parlai/agents/programr/parser/pattern/nodes/bot.py
UTF-8
2,343
2.640625
3
[ "MIT" ]
permissive
from parlai.agents.programr.parser.exceptions import ParserException from parlai.agents.programr.parser.pattern.matcher import EqualsMatch from parlai.agents.programr.parser.pattern.nodes.base import PatternNode # from parlai.agents.programr.utils.logging.ylogger import YLogger import parlai.utils.logging as logging D...
true
76816580f2c27cf995e2a78ade7a1cfe00899b11
dxcv/recommend
/python/practice/web_crawler.py
UTF-8
640
2.546875
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2018/2/22 13:46 # @Author : xuq # @Site : # @File : web_crawler.py # @Software: PyCharm import requests from bs4 import BeautifulSoup def vid_spider(max_page): page=1; while page < max_page: url= 'http://fund.eastmoney.com/fund.html#os_0...
true
a49c88c9ffddb278f0dd60238711b580ba4dddac
rickyjreyes/Python_Tutorial
/4Strings.py
UTF-8
478
3.46875
3
[]
no_license
string = "I am a string" print(string) apostrophe = "don\'t won\'t I\'m" print(apostrophe) minecraft = "MINECRAFT"[0] print(minecraft) #Access Strings access = 'Access!' print(access) print(access[0]) print(access[2:5]) print(access[2:]) print(access * 4) print(access + "TEST") # Library Calls ...
true
f27bf0e46e5526229de012dc8ce5dbbda6b3d642
creoin/tensorflow_cnn_fine-tuning
/data/download_data.py
UTF-8
1,585
2.71875
3
[ "Apache-2.0" ]
permissive
import sys import os.path import tarfile from six.moves import urllib import re def maybe_download_and_extract(data_url, dest_directory): """Download and extract data tar file. Args: data_url: Web location of the tar file containing the data. dest_directory: destination to download to. """ if not os....
true
3e2b064d34f21e745ff8be5a004b3b816162ff49
Lchika/iraira_bo_print
/kivy/inspng.py
UTF-8
722
2.625
3
[]
no_license
# coding:utf-8 from PIL import Image, ImageDraw, ImageFont import datetime import random def make_png(time, miss, path): image_num = random.randint(1,4) im = Image.open("/home/pi/work/iraira/iraira_bo_print/kivy/game_result_label" + str(image_num) + ".png") draw = ImageDraw.Draw(im) font = ImageFont.t...
true
0924212ade34e7b2cef75a84eec91c30c6c34495
LynnChen-whu/computationalphysics_N2013301020022
/有阻尼非線性擺.py
UTF-8
2,736
2.953125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 擺 Created on Wed May 11 09:46:29 2016 @author: 冥凝 """ import math import matplotlib.pyplot as mp import easygui as eg from mpl_toolkits.mplot3d import Axes3D as axes3d import numpy as np from matplotlib import animation class Pendulum(object): de...
true
b29c870918b53d932015bc9e101717ee5bab4357
DivyanshuTak/peer_to_peer
/HOST.PY
UTF-8
2,506
3.125
3
[]
no_license
import socket import string #==================================================================================================== # POINTS TO REMEMBER # 1: python 3 sends a unicode string so bytes string use (b'given string') # # #=====================================================================...
true
954587ed1f9a96689d814f65c14d99d46bdcf948
slyons777/Digital-Crafts-Classes
/Python102/Small-Exercises/ex1.py
UTF-8
65
3.09375
3
[]
no_license
##declare list nums = [1, 2, 3, 4] ##print sum print(sum(nums))
true
20c8c5ec570ce68407ba50dbb225950a7acac3c5
Lanlanluuu/python
/4_dict/dict_3.py
UTF-8
368
3.390625
3
[]
no_license
import sys birthdays = {} def test(): for line in sys.stdin: line = line.strip() # print(line) tokens = line.split() # print(tokens) m = int(tokens[1]) if birthdays.get(m): birthdays[m] += 1 else: birthdays[m] = 1 for i in range(...
true
f3a7116f908005874f8115b7476d32d1c295adfa
aswinichejarla/pythonprogramm
/pl55.py
UTF-8
116
3.1875
3
[]
no_license
s1,s2=map(str,raw_input().split()) s11=s1.lower() s12=s2.lower() if(s11==s12): print "yes" else: print "no"
true
2806818f185d6dcf3c086852de65d0a31744f0c8
scheidguy/Advent_of_Code
/2018/day7-1.py
UTF-8
758
3.09375
3
[]
no_license
f = open('day7_input.txt') text = f.readlines() f.close() prereqs = {} for line in text: line = line.strip().split() first = line[1] then = line[-3] if then in prereqs.keys(): prereqs[then].append(first) else: prereqs[then] = [first] # prereqs['C'] = [] prereqs['O'] = [] prereqs['...
true
bb5c28645cb1c6546eb1a832bc9c8ed3516fae47
lwaekfjlk/Light-the-Torch
/basic_models/GAT.py
UTF-8
3,924
2.578125
3
[ "MIT" ]
permissive
import numpy as np import time import torch import torch.nn as nn import torch.nn.functional as F from dgl import DGLGraph from dgl.data import citation_graph as citegrh import networkx as nx class GATLayer(nn.Module): def __init__(self, g, in_dim, out_dim): super(GATLayer, self).__init__() self.g ...
true
c089fc47d7d8e99b2ecae758da18332fe89726c8
lulle2007200/EasyClangComplete
/tests/test_thread_pool.py
UTF-8
3,608
2.671875
3
[ "MIT" ]
permissive
"""Test delayed thread pool.""" import time from unittest import TestCase import EasyClangComplete.plugin.utils.singleton_thread_pool import EasyClangComplete.plugin.utils.thread_job ThreadPool = EasyClangComplete.plugin.utils.singleton_thread_pool.ThreadPool ThreadJob = EasyClangComplete.plugin.utils.thread_job.Thre...
true
bb95b362bd03277998a8a105e07056577906c030
emma-metodieva/SoftUni_Python_Advanced_202106
/01. Lists as Stacks and Queues/01-02-05. Truck Tour.py
UTF-8
822
3.8125
4
[]
no_license
# 01-02. Lists as Stacks and Queues - Exercise # 05. Truck Tour from collections import deque n = int(input()) start_index = 0 petrol = [] distance = [] for pumps in range(n): data = input().split() petrol.append(int(data[0])) distance.append(int(data[1])) while True: successful = True petrol_t...
true
9fad3e1c88b0462f147fc7c26f4bf47e9af207ba
pogromcykodu/PogromcyPythona
/struktury_danych/listy/Zadanie1_Batony 💡/tresc_zadania.py
UTF-8
852
3.328125
3
[]
no_license
""" Jesteś ankieterem, Twoim zadaniem jest zebrać informację o ulubionych batonikach. Każdy ankietowany podaje swój ulubiony baton. Zebrane dane: "Snikers", "Bounty", "Mars", "WW", "Bounty", "Duplo", "Prince Polo", "Twix", "Snikers", "WW", "Duplo", "Bounty" a) Stwórz listę batoników z zebranych danych b) Do listy do...
true
e7026db1059f9a9eb682c53c553e5c14e235e06d
ljrdemail/AID1810
/OOP/Day04/MyList2.py
UTF-8
864
3.578125
4
[]
no_license
# -*- coding:utf-8 -*- class MyList: def __init__(self, iterable=()): self.data = [x for x in iterable] def __repr__(self): # return "MyList(%s)" % self.data return repr(self.data) def __mul__(self, other): L=MyList(self.data * other) print("mul中的ID为", id(L)) ...
true
1a06c45135bdc33d5c7c268d2cc3568ba6a771a2
ziejaCode/Exercises
/BegginerPractice/3.py
UTF-8
322
3.078125
3
[]
no_license
''' Created on 30 May 2020 @author: czarn ''' import random l1, l2 = [],[] for e in range(random.randrange(9)): l1.append(e) for i in range(random.randrange(9)): l2.append(i) print(l1) print(l2) l3 = set() for e in l2: for a in l1: if e == a: l3.add(e) print(l3...
true
d86180ddceb6aa65ced6626b8acc2069e6e3443d
Menci/TuringAdvancedProgramming19A
/Task 2/evaluator-checker/__main__.py
UTF-8
4,782
3.125
3
[]
no_license
from argparse import ArgumentParser from random import randint from math import isnan, isinf from tempfile import NamedTemporaryFile import subprocess from generator import ExpressionGenerator from terminalcolor import colorize from utils import float_to_string def check_relative_error(value, output_value): MAX_R...
true
90390ca828f0eb5309cd8c4c4af89225f28c47ab
lijianmin01/Third_college_grade
/视觉/老师课件/数字图像处理-01-code- 绪论/codes/10_OPENCV.py
UTF-8
913
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- # 基于python-opencv的图像读取、可视化 # 注意:这里用到了基于opencv、plt两种方式的显示化 # 导入opencv包 import cv2 import matplotlib.pyplot as plt #imagepath='flowers.png' imagepath='flowers1.bmp' image = cv2.imread(imagepath) print(type(image)) #结果为<class 'numpy.ndarray'> print(image.shape) #结果为(2304, 4096, 3) cv2.imshow('...
true
d57be9d9ada72e093587a9a03ef9ef90576cff10
jjoosshhuuaabb/march_madness
/pull_data.py
UTF-8
1,030
2.65625
3
[]
no_license
import mysql.connector mydb = mysql.connector.connect ( host = "localhost", user = "root", password = "CarletonU16", database = "team_stats" ) """ mycursor = mydb.cursor() sql = "SELECT ft, pts FROM stats WHERE team = 'VCU' OR team = 'Duke'" mycursor.execute(sql) result = mycursor.fetchall() for x i...
true
0f461aec4a974f0d6b4ca470156e8703edcd11be
MirzaRaiyan/Pygame-Car-Racing-Game
/utils.py
UTF-8
167
2.890625
3
[]
no_license
import pygame def scale_image(img, factor): size = round(img.get_width() * factor), round(img.get_height() * factor) return pygame.transform.scale(img, size)
true
9bf4ea0cc8daec843d698c9001eda2ccedad7bbf
HydrogenHaus/abslabs
/code/runPSine.py
UTF-8
988
2.78125
3
[]
no_license
#!/usr/bin/python from lightUtil import lights, powerSine from time import sleep import sys, math def runPSine(inst,freq=100): """runPSine( inst, freq(as-a-percent| default=100), )""" time = 0 speed = 100. if freq <= 0: freq = 100 try: while True: for light in range(0,48,6): p...
true
892dbd7ea0d42acf51ebc1b79c5bb95acd9fc8d9
hhzou/python-science
/examples/machine-learning/character_recognition/nn_training_size.py
UTF-8
465
2.71875
3
[]
no_license
import matplotlib.pyplot as plt import char_recognition as cr fraction = [] training_size = [1875, 3750, 7500, 15000, 30000, 60000] for t in training_size: f = cr.main(do_plots=False, num_training_unique=t) fraction.append(f) plt.plot(training_size, fraction) plt.xlabel("training sample size") plt.ylabel("s...
true
96105f4fc0ad06737aa3f9f99ba43b7e21282332
Aasthaengg/IBMdataset
/Python_codes/p03292/s535044890.py
UTF-8
131
3.46875
3
[]
no_license
ar = [int(i) for i in input().strip().split(" ")] ar.sort() s = 0 for i in range(1, len(ar)): s += (ar[i] - ar[i - 1]) print(s)
true
3ba2d8dc8739906b249266bcbad03de459ca45d6
ProfessorAtomicManiac/Webscraping-Projects
/Lesson 8/HW_8.py
UTF-8
1,030
3.015625
3
[ "MIT" ]
permissive
import pandas from bs4 import BeautifulSoup import requests from flask import Flask page = requests.get('https://indianapolis.craigslist.org/search/sss?query=computer&sort=rel&search_distance=10&postal=46033') soup = BeautifulSoup(page.text, "html.parser") productLn=[] priceLn=[] items = soup.find_all('li...
true
a4ded33b9927095ab6f688cc73f2d9722315fab9
mdickinson/quadfloat
/quadfloat/tests/parse_test_data.py
UTF-8
19,127
2.625
3
[]
no_license
""" Helper class for representing a single test. """ import json from quadfloat.api import BinaryInterchangeFormat from quadfloat.attributes import ( Attributes, temporary_attributes, ) from quadfloat.bit_string import ( BitString, ) from quadfloat.exceptions import ( UnderflowException, ) from quadfl...
true
8449cfba0f1b5cb2c676e59a815d55e56ce3f378
KateShen/test1
/untitled folder/hello.py
UTF-8
338
2.984375
3
[]
no_license
from flask import Flask app = Flask(__name__) from datetime import datetime now = datetime.now() import time @app.route('/') def hello_world(): return 'Hello, World!' @app.route('/currentTime') def hello1(): return now.strftime("%Y-%m-%d") @app.route('/currentTime/timeZone') def hello2(): return time.tzn...
true
d6c76c3b0a6bdd0503c5d9382fa8e67877d0a83e
haiiliin/pyabaqus
/src/abaqus/BoundaryCondition/RetainedNodalDofsBC.py
UTF-8
7,008
3.078125
3
[ "MIT" ]
permissive
from abaqusConstants import * from .BoundaryCondition import BoundaryCondition from ..Region.Region import Region class RetainedNodalDofsBC(BoundaryCondition): """The RetainedNodalDofsBC object stores the data for a retained nodal dofs boundary condition. The RetainedNodalDofsBC object is derived from the...
true
30c8ddbd8c6476858a02ac949ccc09acc4241961
karthikrbabu/data_speaks_e2e
/src/eda/t5_exploration.py
UTF-8
5,834
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.10.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- ...
true
9aba5abe6085169aafac268125ae7ec19a257494
alx42195/Homework_PyAdvanced
/2/task_2.py
UTF-8
2,139
3.390625
3
[]
no_license
""" Задание 2 Создайте XML файл с вложенными элементами и воспользуйтесь языком поиска XPATH. Попробуйте осуществить поиск содержимого по созданному документу XML, усложняя свои запросы и добавляя новые элементы, если потребуется. """ import os.path from xml.etree import ElementTree as ET """ Скачал тестовый заказ в...
true
72c187595d651863a9eb62fc6164e4c1d8e06d92
greghull/advent-of-code-2020
/day10.py
UTF-8
2,292
3.5
4
[]
no_license
# To solve part 2: # Based on the constraints of the puzzle: # Any edge length of 3 must be included in all paths # We can split a large graph into independent graphs at those edges # # Given array of independent graphs [G_1, G_2, ..., G_n] # Then the total number of paths from start to finish is: # n_paths(G_1) * n_pa...
true
02fa34ba68e959fc4a45d4bc973b07971d875780
b-it-bots/mas_navigation_tools
/ros/scripts/save_base_map_poses_to_file
UTF-8
2,415
2.546875
3
[]
no_license
#!/usr/bin/env python import signal import sys import argparse import rospy import tf def main(node_name, robot_frame, map_frame, file_name): rospy.init_node(node_name) tf_listener = tf.TransformListener() tf_received = False while(not rospy.is_shutdown()): # get pose name from user ...
true
9757f78a077e6250a1ed6e6396ec4e6984bc71a7
thirionjl/chains
/chains/core/ops_arithmetic.py
UTF-8
2,106
3.4375
3
[ "MIT" ]
permissive
"""Common arithmetic operations""" import numpy as np from .ops import ElementWiseBinaryOp, ElementWiseUnaryOp from .tensor import Tensor from ..utils import validate __all__ = ["Add", "Negate", "ConstMul", "Mul", "Pow", "IsGreaterThan"] class Add(ElementWiseBinaryOp): def compute(self, x, y): super()....
true
f3a069cfaacacbd70045642f73d3fb5e03d7dc0c
familykt/Selenium
/test_sample.py
UTF-8
734
2.890625
3
[]
no_license
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% import pytest from selenium import webdriver from selenium.webdriver.common.keys import Keys import pytest import time # %% @pytest.mark.parametrize( ("input","expected"),[ ("red", "<em>RED</em>/レッド - Wikipedia"...
true
446fef3421af7153e28395d95573c4abbb7b30c2
mitchellflax/lpsr-samples
/Unit1-2Unordered/debugTester.py
UTF-8
57
2.84375
3
[]
no_license
var = "hello" var2 = "world" print(var + "1" + var2)
true
16d43bfec71323448f49b0b445f0f6db4fe12461
onederey/super-chess-ai
/ai.py
UTF-8
10,999
2.53125
3
[]
no_license
import os import re import time import asyncio import chess import chess.engine import random from chessboard import display PP = 100 NN = 320 BB = 330 RR = 500 QQ = 900 KK = 20000 pawn = [[0, 0, 0, 0, 0, 0, 0, 0], [50, 50, 50, 50, 50, 50, 50, 50], [10, 10, 20, 30, 30, 20, 10, 10], [5, 5, 10, ...
true
60afeb1987f2d1c8d8022337fa60ebd147025534
around-star/TrainYourOwnYOLO
/2_Training/make_anchors.py
UTF-8
4,579
2.78125
3
[ "MIT", "CC-BY-4.0" ]
permissive
""" Python script to generate custom anchors for your dataset """ import os import sys import argparse import numpy as np import matplotlib.pyplot as plt def get_parent_dir(n=1): """ returns the n-th parent dicrectory of the current working directory """ current_path = os.path.dirname(os.path.abspath(__fi...
true
aebfb35a7c5ffdca09a122f249b612ac0a7a2adc
tdammers/papi
/papi/resource.py
UTF-8
1,959
3.15625
3
[ "MIT" ]
permissive
# A resource can be any object that implements the following protocol: # # PROPERTIES # # name # """ The machine-readable name for the resource. This should be a valid # URI path element, and by convention, should only use alphanumeric ASCII # characters and/or - and _. Other characters will probably also work but # pr...
true
d0a55074bcc5b76de66b72768478b1fbd7455780
renataalbq/sis-contabilidade
/fcritica.py
UTF-8
2,734
3.15625
3
[]
no_license
# Função da crítica do movimento def critica_movimento(registro,Contas,saldo_mov,conta_deb,conta_cred,digito_mov_deb,digito_mov_cred): """ Realiza a crítica do movimento a partir das movimentações que foram armazenadas no dicionário de movimentacao e checa se existem erros. A funcao retorna uma tupla nesse...
true
4664d11d11dcfdd9a52868c6f9afaaee7721f3bd
kaiocp/uri-challenges
/python/1037.py
UTF-8
322
3.96875
4
[]
no_license
ent = float(input()) if ((ent >= 0) and (ent <= 25)): print("Intervalo [0,25]") elif ((ent > 25) and (ent <= 50)): print("Intervalo (25,50]") elif ((ent > 50) and (ent <= 75)): print("Intervalo (50,75]") elif ((ent > 75) and (ent <= 100)): print("Intervalo (75,100]") else: print("Fora de intervalo"...
true
cf7715edf4eb1f4ae67d2da51c5ed375f490d420
espdev/scikit-mpe
/skmpe/_api.py
UTF-8
2,776
2.9375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from typing import Optional, Union, overload import numpy as np from ._base import mpe_module, singledispatch, PointType, PointSequenceType, InitialInfo, PathInfoResult from ._parameters import Parameters from ._mpe import extract_path @overload def mpe(speed_data: np.ndarray, start...
true
85cb13527633f6bbfe132ae01027f388f85bf18d
nutcheer/pythonlearning
/pr4_8.py
UTF-8
80
3.34375
3
[]
no_license
number = [value**3 for value in range(1,11)] for value in number: print(value)
true
966fc74819b8b823690f8746b2df559010af9aab
yangyutu/keras-lipschitz-networks
/arch/lipschitz.py
UTF-8
6,841
2.5625
3
[]
no_license
import keras from keras.datasets import cifar10 from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.callbacks import LearningRateScheduler from keras.layers import Dense, BatchNormalization, Activation, Flatten, Conv2D, MaxPooling2D, InputSpec from keras.constraints i...
true
acbdfdb36bdd78b939061e3602eb6a401d3b97ec
rbenet71/Sharing_Little_Things
/Python/General/OCR/Investigation/Ocr_Garmin_DashCam_V1.py
UTF-8
9,417
2.625
3
[]
no_license
# # Little Script for Geotag Pictures of a Garmin DashCam # Robert Benet - 30/08/2020 # # Information extract from: # How to configur Tesseract # https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i/53672281 # Install Teseract for windows # https://git...
true