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
420017350dfe01e8c225c7cd42e70a1a06b357d2
yyyuaaaan/python7th
/Leat/N-queens.py
UTF-8
841
2.921875
3
[]
no_license
""" // solution 1: recursion int totalNQueens_1(int n) { int board[n]; memset(board, -1, sizeof(board)); int res = 0; totalNQueensRe(n, 0, board, res); return res; } void totalNQueensRe(int n, int row, int board[], int &res) { if (row == n) {...
true
992b273d27ecc9af159b34c20a3934e5453572dd
yuinfolab/courses
/webscrap/test.py
UTF-8
316
2.578125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Dec 1 11:08:29 2019 @author: maliozer @script: informatics workshop """ import pandas as pd df_oscar_man = pd.read_csv("./data.csv", index_col="Index") #%% oscar_ages = df_oscar_man['Age'] mean_age_oscar = sum(oscar_ages) / len(oscar_ages)
true
c7ed42ccb95beb2e01843815df739d8d7a98fec7
hhefzi/CKG
/src/report_manager/utils.py
UTF-8
7,220
2.59375
3
[ "MIT" ]
permissive
import os import dash_html_components as html import dash_core_components as dcc from datetime import datetime import bs4 as bs import random import numpy as np import chart_studio.plotly as py import base64 from xhtml2pdf import pisa import json from urllib import request import shutil import smtplib from email.messag...
true
7ae3fe62105e06a7d3370e92b6e65d6fd1c0cf46
mattphillipsphd/samsi_wg
/caus_inf/gen/pt_starts.py
UTF-8
1,467
2.625
3
[]
no_license
""" This script generates a 3-column data file with patient id, offset of first medication, and offset of first treatment, left blank if there wasn't any. """ import argparse import os import pandas as pd pe = os.path.exists pj = os.path.join HOME = os.path.expanduser("~") def get_patients(data_supdir): pts = [...
true
9771e26b2f757326b17e4b86e6c0af6c78d143f1
ankita2308/gittest
/howtocreatethread.py
UTF-8
171
2.78125
3
[]
no_license
import threading import time def demo(): print("threading started \n") time.sleep(2) print("threading stopped \n") t1=threading.Thread(target=demo) t1.start()
true
4bcbe89ca13a53cb68167326a48c52fe8e1f4f3c
GolDOragon/Some-tasks-on-Python
/books/Курс/наиболее встречаемое слово.py
UTF-8
2,180
3.484375
3
[]
no_license
'''Недавно мы считали для каждого слова количество его вхождений в строку. Но на все слова может быть не так интересно смотреть, как, например, на наиболее часто используемые. Напишите программу, которая считывает текст из файла (в файле может быть больше одной строки) и выводит самое частое слово в этом тексте и чере...
true
80059476e9433f78238a3d1fa2e363920ddb5402
michalstejskal/chobot-log-classification
/log_classification/network_model.py
UTF-8
11,481
2.703125
3
[]
no_license
import tensorflow as tf import numpy as np import pandas as pd import pickle import math from data_preparator import prepare_data, prepare_log_row from bo.models import NetworkParameter from bo.network_dao import add_network_parameter # save_path = './models/' save_path = '../data/model/' class SOM: """ 2-D ...
true
eac3937d5bbb617117f46b143c95c4547414caeb
Himture/DevsnestWebDevRepo
/All THA/run.py
UTF-8
582
3.625
4
[]
no_license
import test class car(): # init method or constructor def __init__(ourself, model, color): ourself.model = model ourself.color = color def show(ourself): print("Model is", ourself.model ) print("color is", ourself.color ) print(test.__name...
true
9f2082fd0ab7d8bf5a6556b9d64fc37aa52fd13f
abhinavsingh21/codingclubiitgproject
/CODE.py
UTF-8
426
2.5625
3
[]
no_license
import urllib2 from bs4 import BeautifulSoup date=raw_input('Enter date in ddmmyy format.\n') url='http://www.rediff.com/issues/'+date+'hl.html' page=urllib2.urlopen(url) soup=BeautifulSoup(page,'html.parser') div=soup.find('div',attrs={'id':"hdtab1"}) itag=div.find_all('a',attrs={'target':'_new'}) ...
true
b357a798a12c0b5e5366d813882f66749b0755a1
richardjharris/adventofcode-2019
/2018/q03.py
UTF-8
2,239
3.40625
3
[]
no_license
import numpy as np import re import unittest import util def parse_claims(lines): """ Generator that accepts lines and returns MatchObjects with info for each claim. """ for line in lines: m = re.fullmatch(r"#(\d+) @ (\d+),(\d+): (\d+)x(\d+)", line) assert m yield tuple(map(...
true
f4bf8ac10ddcbdec14c10da2fb14b43cc10c5cee
ZAM-code/chatbot
/chitchat.py
UTF-8
5,720
2.828125
3
[]
no_license
import json import random from nltk_utils import tokenize,stem def network(leng , sentence , bot_name): # varibles tags = [] xy = [] ab = [] chat_history = [] given_ans = [] #Json FIle with open('intents.json', 'r') as f: intents = json.load(f) # st...
true
b1f9c27d46516a4d74f76af199240440822fd6fb
rjpawar/Emotion-Recognition
/EmoDetect.py
UTF-8
1,572
2.5625
3
[]
no_license
import cv2 import numpy as np from keras.models import model_from_json from keras.preprocessing.image import img_to_array model = model_from_json(open("model.json", "r").read()) model.load_weights('model.h5') face_haar_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') emo_detect = ('angry'...
true
fe349f09711f325430f21ad16e9f485087384882
chj1330/EVC_mel
/model.py
UTF-8
2,768
2.546875
3
[]
no_license
from torch import nn from modules import Conv1d, Conv1dGLU from torch.nn import functional as F import math class ConvBlock(nn.Module): def __init__(self, in_dim=80, preattention=((128, 5, 1),) * 4, convolutions=((128, 5, 1),) * 4, dropout=0.1): super(ConvBlock, self).__init__() self.dropout = drop...
true
7e5f48c6f80f9159b354732ce6f59fbb3e555abe
jiumx60rus/kosh
/polar_kosh.py
UTF-8
2,006
2.71875
3
[]
no_license
from PIL import Image, ImageDraw from scipy.ndimage import geometric_transform from pylab import subplot, imshow, show import math import cmath back_image = Image.new("RGBA", (640, 480), color=(127, 0, 255)) init_image = Image.open("kosh_2.png") init_image_pixels_per_unit = init_image.size[0] init_image_width = init_i...
true
f4dc9b12a91bf67f6318d86444b09c42e14e2a06
rmalhotra-dmacc/module8
/test/test_datetime_assignment.py
UTF-8
448
2.953125
3
[]
no_license
import unittest from more_fun_with_collections import datetime_assignment class MyTestCase(unittest.TestCase): def test_datetime(self): self.assertEqual("07/01/2020", datetime_assignment.half_birthday("01/01/2020")) def test_datetime_incorrect(self): self.assertEqual("Please enter a valid dat...
true
7a1e003f17f6f9cfb484709aed52c648917bc8ab
r-bhikhie/AdventOfCode
/2021/day01/puzzle_01.py
UTF-8
581
3.6875
4
[ "Unlicense" ]
permissive
# Puzzle 01 for AOC 2021 # # Q: How many measurements are larger than the previous measurement? # Input file: "input_01_01.txt" inputs = [] with open("input_01_01.txt", 'r') as f: for line in f: line = line.strip() inputs.append(int(line)) def main(): answer = 0 while len(inputs) > 3: ...
true
9a4dbb8cbad4802c11faa837343b6fad0e95d3c1
POSOCO/pmu_modes_analysis
/Substation_Mods_count_in_month.py
UTF-8
3,130
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jan 16 19:36:27 2018 @author: Nagasudhir """ # get the list of all csv files -- done # read each one into a dataframe and remove rows with Nan values -- done # attach all the csv dataframes -- done # get the unique ss_ids -- done # for each ss_id plot time vs freq in a subpl...
true
ce1af9df563d10cff69577daa2382ba4be992c93
hqadeer/reddit-bots
/statbot/statbot.py
UTF-8
8,320
2.953125
3
[ "MIT" ]
permissive
import praw import sqlite3 import time import traceback from nba_scrape import NBA PREVIOUS_SEASON = '2017-18' ACTIVE_SUB = 'nba+experimental120394' class StatBot: '''Reddit bot to provide NBA stats upon request. Usage: !STAT player_name stat1/stat2/.../statn [season_range] [-flag] Season Range (optiona...
true
1984db29ad5aa00a5d6bd5bbc31180d110eba96b
dlont/FourTops2016
/rootplot/futuretest/betterhelp.py
UTF-8
7,219
2.78125
3
[ "MIT" ]
permissive
## IDEAS ## The split canvas should allow ratios, efficiencies, or differences import argparse import sys import textwrap class CustomHelpAction(argparse.Action): """ Action that mimics argparse._HelpAction. If *dest* is 'help', it gives a general help message, showing a basic set of the most useful ...
true
ad70071ad6b26d735fbf0fc87a7fe7d032cf29c0
jacquerie/leetcode
/leetcode/0916_word_subsets.py
UTF-8
1,662
3.28125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from collections import Counter class Solution: def wordSubsets(self, A, B): result = [] b_universal_counter = Counter() for b in B: b_counter = Counter(b) self.toUniversal(b_counter, b_universal_counter) for a in A: a_...
true
8e28dee9e3a6bc77c6aafa840b671dd270464445
yuanwenbin5521/pygame
/alien_invasion.py
UTF-8
593
2.921875
3
[]
no_license
import pygame from settings import Settings from ship import Ship import games_functions as gf def run_game(): #初始化游戏并创建一个屏幕对象 pygame.init() settins=Settings() screen=pygame.display.set_mode((settins.screen_width,settins.screen_height)) ship=Ship(screen,settins) pygame.display.set_caption("Alien...
true
b196a934d394043fc76de62421f9712f7d869dde
BrianSandberg/Semester_projekt4
/network.py
UTF-8
1,127
3.359375
3
[]
no_license
import socket #Class responsible for connecting to the server and sending/recieving data class Network: def __init__(self): self.client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Has to be the same IP as in the server class self.server = "192.168.0.42" #Same port as in the...
true
23662cb5678b84e18d738d769f20ee34ec00afde
tharun-d/flask_rest_api
/1. Basic/app.py
UTF-8
1,582
3.09375
3
[]
no_license
from flask import Flask, jsonify, request app = Flask(__name__) stores = [ { "name":"My store", "items":[ { "name":"My item", "price":10 } ] } ] @app.route('/store', methods = ['POST']) def create_store(): request_data = req...
true
18b1f87e5593b45442479e335848f5b9b5cf351d
tranquilshore/Daily-Coding-Problems
/largest_number_possible.py
UTF-8
864
4.28125
4
[]
no_license
''' How to find the largest number with given digit sum s and number of digits d? Examples: Input : s = 9, d = 2 Output : 90 Input : s = 20, d = 3 Output : 992 Greedy approach to solve the problem. The idea is to one by one fill all digits from leftmost to rightmost (or from most significant digit to least signif...
true
b62a14affdc591a382be9d4e122948b803052100
ulikoehler/UliEngineering
/UliEngineering/SignalProcessing/Chunks.py
UTF-8
8,963
3.28125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Utilities for generating chunks from datasets """ import numpy as np import functools from toolz import functoolz import random import concurrent.futures __all__ = ["ChunkGenerator", "overlapping_chunks", "reshaped_chunks", "random_sample_chunks", "random_s...
true
daf7fd13ccae4dfae46601894e484228eb3053fe
kzaw/kz_python_basic
/ex13_comb.py
UTF-8
258
3.203125
3
[]
no_license
from sys import argv script, first, second = argv print "The script is called:", script print "Your first variable is:", first print "Your second variable is:", second fourth = raw_input("What is the third input? ") print "The third input is %s." % fourth
true
da018e5a857a0a0b03943a74333ab1015ebf5e69
yyq1994/git
/def_network.py
UTF-8
3,734
2.765625
3
[]
no_license
import matplotlib.pyplot as plt import pandas as pd import tensorflow as tf import tensorflow.keras as keras import numpy as np # 下载数据----------加利福尼亚房价 from sklearn.datasets import fetch_california_housing housing = fetch_california_housing() # 分割数据 from sklearn.model_selection import train_test_split x_train_all,x_t...
true
8c61d4f50a0de6e9ae43b5f7ddc1de4e233938f2
jovillarroelb/FSND_Capstone_Project
/backend/database/models.py
UTF-8
3,485
2.875
3
[]
no_license
import os from sqlalchemy import Column, String, Integer from flask_sqlalchemy import SQLAlchemy import json # Environment variable method to connect to the database DB_HOST = os.getenv("DB_HOST", "127.0.0.1:5432") DB_USER = os.getenv("DB_USER", "postgres") DB_PASSWORD = os.getenv("DB_PASSWORD", "postgres") DB_NAME = ...
true
34fc87138fd006fc36829272642b7d2f8355d0dc
5l1v3r1/DeepLearning-LANA
/ComputerVision/MachineLearning/LogisticRegression/regressao_logistica.py
UTF-8
2,073
3.21875
3
[]
no_license
# Classificação de Imagens com Regressão Logística # Dataset: http://vis-www.cs.umass.edu/lfw/ # Faces # Imports import cv2 import numpy as np import imutils import sklearn from sklearn import datasets from sklearn.metrics import classification_report from sklearn.linear_model import LogisticRegression from sklearn....
true
082a9e9ca0e71e45ef8708719dc9dc6d0991c64f
HanxianshengGame/EffectivePython
/2.1_ 尽量用异常来表示特殊情况,而不要返回None.py
UTF-8
976
3.703125
4
[]
no_license
#!/usr/bin/env python27 # -*- coding: utf-8 -*- # @Time : 2021/6/1 14:28 # @Author : handling # @File : 2.1_ 尽量用异常来表示特殊情况,而不要返回None.py # @Software: PyCharm # None 有着特殊的含义, 若是作为在异常内的返回值是不合理的 # 异常不应该被隐藏,而是应该抛出 def divide(a,b): try: return a/b except ZeroDivisionError as e: ...
true
b0e9f298cb561c3d413d186c2a5525fb62619b59
TeamAwesomeTOJam/soithascometothis
/src/component.py
UTF-8
19,218
2.796875
3
[]
no_license
from abc import ABCMeta, abstractmethod import pygame from math import * import game import mode from vec2d import Vec2d from util import * FACING = ['right', 'down', 'left', 'up'] class Component: __metaclass__ = ABCMeta @abstractmethod def add(self, entity): pass @abstractmethod...
true
9444038791f436ddd8bc540e68e08c686db0274f
pjgeorge09/CMSC-435-Project
/features.py
UTF-8
1,162
2.921875
3
[]
no_license
import pandas as pd from PyBioMed.PyProtein import AAComposition from PyBioMed.PyProtein import CTD '''Generates features for the training dataset''' def generate_features(df): aac_keys = [] aac_values = [] ctd_keys = [] ctd_values = [] for row in df.itertuples(index=False): my_seq = row[0...
true
3db8deeb5b21211920e8ec42eba74f83afbe9542
darszam/Python-Projects
/DL/LearningDeepLearningImages.py
UTF-8
511
3.3125
3
[]
no_license
from exercise_1 import load_my_image, apply_conv_to_image, show, print_hints # Detects bright pixels over dark pixels. horizontal_line_conv = [[1, 1], [-1, -1]] vertical_line_conv = [[1,-1], [1,1]] conv_list = [horizontal_line_conv,vertical_line_conv] original_image = lo...
true
093edd7ff0e7924b9b14e7a64f706e187da8793e
SergeyBel/science
/Sbox-Analyzer/SymbolPolynom/symbol_monom.py
UTF-8
943
3.234375
3
[]
no_license
class SMonom: def __init__(self, coeff): if isinstance(coeff, str): coeff = [coeff] self.coeffs = set(coeff) self.hash = hash(self.toString()) def toString(self): return ''.join(self.coeffs) def __mul__(self, other): zero = SMonom('0') if (self == zero or other == zer...
true
e2d32039113093e35e60508f32055e68ab5a30ff
cschubiner/hearthstone-auto-draft
/addManualHash.py
UTF-8
730
2.578125
3
[]
no_license
cardNum = 1 cardName = 'zombie chow' import json hsh = None with open("output_hashes.txt", "r") as myfile: hsh = myfile.readlines()[-(4-cardNum)].strip() manualHashes = None with open('manual_hashes.json','r') as j: manualHashes = json.load(j) cardNames = list() cardsJson = None with open('cardsWithHashes.j...
true
472aa07ed5d2d06a2551c5c203876b94a9a70263
DainDwarf/AdventOfCode
/2019/Day13/day13.py
UTF-8
3,386
3.21875
3
[]
no_license
import pytest from enum import IntEnum, unique import progressbar from intcode.simulator import Simulator, ParamMode def sign(x): if x < 0: return -1 elif x > 0: return 1 else: return 0 @unique class Tile(IntEnum): EMPTY = 0, WALL = 1, BLOCK = 2, PADDLE = 3, ...
true
3fd0a37b2038c86d9d8cc6ba875a4c995e2bf0b5
KevinBruce2018/PAT_Basic_Level
/1054.py
UTF-8
782
3.34375
3
[]
no_license
n = eval(input()) data = input().split() result = [] for i in data: try: value = eval(i) flag = i.find('.')==-1 or (i.find('.')!=-1 and len(i)-i.find('.')-1<=2 and i.find('.')!=0) if value>=-1000 and value <=1000 and flag: result.append(value) else: print('ERR...
true
1d5b2b6d717386947b6a0007a55a47c747359db9
yooneunji/bibiBig
/team_homework/movie_info.py
UTF-8
2,197
2.734375
3
[]
no_license
# %% from bs4 import BeautifulSoup import urllib.request from urllib.parse import quote import pandas as pd import flask import pymysql def get_movie_info(mcode): """영화코드를 받아서 영화 정보를 받아오는 함수 정의 완전자동화를 하기위해서는 더 수정이 필요함 각 영화 마다 정보의 항목 마다 뒷부분 수정 필요""" url = "https://movie.naver.com/movie/bi/mi/basic.nhn?code=" +...
true
40a456477de1c42b009afcf07cfd526ba83bdf7b
valeriapontillo/radon-ansible-metrics
/ansiblemetrics/playbook/num_lookups.py
UTF-8
1,362
3.25
3
[ "Apache-2.0" ]
permissive
import re from ansiblemetrics.ansible_metric import AnsibleMetric from ansiblemetrics.utils import key_value_list class NumLookups(AnsibleMetric): """ This class measures the number of lookups in a playbook. Lookups are evaluated when the task referencing them is executed, which allows for dynamic data disc...
true
d4dbafbb5c4730103aad41095ba705df8e033e1b
BonHyuck/Python
/Baekjoon/1167.py
UTF-8
821
3.0625
3
[]
no_license
def find_path(start, arr): for next, dist in box[start]: if arr[next] == -1: arr[next] = arr[start] + dist find_path(next, arr) V = int(input()) # 1부터 시작하니까 V+1 box = [[] for _ in range(V+1)] for v in range(V): input_list = list(map(int, input().split())) start = input_list....
true
5ca0693918c0345d0a0704f042d4df14a646f6b5
brionwolf/applecard_to_csv
/applecard_pdf_to_csv.py
UTF-8
2,389
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- # Imports import PyPDF2 import csv import logging from datetime import datetime from os import path logging.basicConfig(level=logging.INFO, format="%(message)s") logging.info("Start: Apple Card Statements to CSV") logging.info("-----------------------------------") # Import AppleCard pdf stat...
true
533d0ae20d9ce9c90a1456c69e3cffd7e147de9d
msutic/space_invaders
/Space Invaders/client/TournamentWinner.py
UTF-8
2,673
2.734375
3
[ "MIT" ]
permissive
import sys from PyQt5 import QtCore from PyQt5.QtGui import QPixmap, QIcon from PyQt5.QtWidgets import QMainWindow, QLabel, QApplication class DisplayWinner(QMainWindow): def __init__(self, winner: str, spacecraft: str): super().__init__() self.winner = winner self.spacecraft = spacecraf...
true
193536a872cda88c0981e2fbfb2cea6bc1845451
XlmkVal/Python
/AirbnbInterview.py
UTF-8
316
3.625
4
[]
no_license
def find_missing(a, b): missing = [] for i in a: t = 0 for i2 in b: if i2 == i: t = 1 break if t == 0: missing.append(i) print(f"The missing number is {missing}") find_missing([4,12,9,5,6,13,16],[4,9,12,6])
true
15223724d454ec690c51d653a8bc8908ea2e39ab
aidy80/seqStruct
/main.py
UTF-8
9,079
2.53125
3
[]
no_license
#Aidan Fike #June 12, 2019 # Main program. Has options to test the accuracy of a given set of # hyperparameters of a convolution neural network. It also has the capability # of predict what sequences will yield well structured cyclic proteins from cnn import Cnn from nnUser import nnUser import parseData import helpe...
true
bb1d8c4f25dab09868ae1fa550cdc3928677de10
lff1988/day12
/common/mylogger.py
UTF-8
1,635
3.171875
3
[]
no_license
# -*- coding:utf-8 -*- """ -------------------------------------- @Author :慕凡 @Date :2021/4/20 16:09 @Project: py37-学习 --------------------------------------- """ import logging from logging import Logger from common.my_path import conf_path from common.myConf import MyConf """ 1、设置日志的收集级别 2、可以将日志输出到文件...
true
8c63f1e10e58bd0a598718ba291ecb942c9092d8
bboczeng/MusicML
/DataScraping/billboard/billboard.py
UTF-8
8,696
3.234375
3
[ "MIT" ]
permissive
#!/usr/bin/env python import json import requests from bs4 import BeautifulSoup """billboard.py: Unofficial Python API for accessing ranking charts from Billboard.com.""" __author__ = "Allen Guo" __license__ = "MIT" __maintainer__ = "Allen Guo" __email__ = "guoguo12@gmail.com" HEADERS = {'User-Agent': 'billboard.py...
true
61b499dd4dd7fdbb1a05386721a031307a2732fa
FireinDark/leetcode_practice
/977_sort_squres.py
UTF-8
420
3.640625
4
[ "MIT" ]
permissive
def sortedSquares(nums): resp = list() left = 0 right = len(nums) - 1 while left <= right: l = nums[left] ** 2 r = nums[right] ** 2 if l > r: resp.append(l) left += 1 else: resp.append(r) right -= 1 return resp[::-1] ...
true
991fe0a598e961ffa2ce6260e527713401bfccdc
serhey-svintsitskiy/python-learning
/stepik/3/3.7.5.py
UTF-8
824
3.453125
3
[]
no_license
def parse_user(dataline): return { 'class': int(dataline[0]), 'name': dataline[1], 'length': int(dataline[2]), } def get_input_data(): d = {} with open('3.7.5.txt', 'r') as inf: for line in inf: u = parse_user(line.strip().split()) if u['class'] ...
true
1085da7510f08426a2b1db7a96604a9019bb7064
nbvc1003/AI
/ch08/interactive1.py
UTF-8
314
2.875
3
[]
no_license
import tensorflow as tf tf.compat.v1.disable_eager_execution() # session을 실행 시키는 다른 방법 sess = tf.compat.v1.InteractiveSession() x = [[0,1,2],[2,1,0]] # InteractiveSession을 사용시 실행은 .eval()을 사용한다. print(tf.ones_like(x).eval()) print(tf.zeros_like(x).eval()) sess.close()
true
a633cbefe316f6b4be7f673cd3e0e1be03f0add7
hi3d/hi
/hi.py
UTF-8
53
3.296875
3
[]
no_license
name=input('請輸入你的姓名') print('嗨',name)
true
298bf8578f5be63127361d3c3ca6b638ee41753b
jesliwang/ProjectEuler
/93/main.py
UTF-8
2,503
3.234375
3
[]
no_license
import sys import copy class Solution: def GenerateAllSeq(self, nums:list): cur = [] for i in range(len(nums)): if len(cur) == 0: cur.append([nums[i]]) else: nt = [] for j in range(len(cur)): item = cur[j] ...
true
33144f5001a6f0c3654a58c891283c6fc280701b
mybirth0407/elice2016
/pandas_exercise.py
UTF-8
584
3.125
3
[]
no_license
import numpy as np import pandas as pd def main(): do_exercise() def do_exercise(): # 1 aapl_bars = pd.read_csv("./AAPL.csv") # 2 date_index = aapl_bars["Date"] # 3 aapl_bars.index = pd.to_datetime(date_index) # 4 open_column = aapl_bars["Open"] close_column = aa...
true
73164cb59c6e11178dfaccbe2c1a422c90e83fa5
fernandojampa/web-scraping-climate
/climate.py
UTF-8
454
2.9375
3
[]
no_license
from bs4 import BeautifulSoup import requests html = requests.get( "https://www.climatempo.com.br/previsao-do-tempo/cidade/256/joaopessoa-pb").content soup = BeautifulSoup(html, 'html.parser') resume = soup.find(class_='-gray -line-height-24 _center') tempMin = soup.find(id='min-temp-1') tempMax = soup.find(id='...
true
608c144b392bd5d6e45ca30a86e032cecee4db51
201807066/-IPC2__Proyecto1__201807066
/matriz/cabecera.py
UTF-8
1,131
2.984375
3
[]
no_license
from matriz.nodoMatriz import * class listaEncabezado(): def __init__(self, head = None): self.head = head def agregarEncabezado(self, nuevoNodo): if self.head == None: self.head = nuevoNodo elif nuevoNodo.id < self.head.id: nuevoNodo.siguiente = self.h...
true
7fb3757f154073639420f4c6a991e10565782b44
BiteKirby3/Database-management---Spectacle-
/code_source_python/association.py
UTF-8
11,098
3.34375
3
[]
no_license
import psycopg2 from datetime import date def menu(conn): print("\n*Page - Gestion des associations*") action = '-1' while action != '0': print("\nVous pouvez effectuer les actions suivantes :") action = input("Entrez 1 pour afficher toutes les associations,\n 2 pour rechercher (voir les d...
true
857fa01a856ebcff018d172af8472da788d45393
Jong-suk/FaceRecognition-Assignment-Submission
/Day-3.py
UTF-8
754
3.078125
3
[]
no_license
import cv2 import numpy as np cap = cv2.VideoCapture(0) image_dict={1:"Beach.jpg",2:'Cherry Blossom.jpg',3:'Ring.jpg',4:'Library.jpg',5:'power up.jpg',6:'Horror.jpg'} print("Filters(Keys:Values):", image_dict.items()) n=int(input("Enter your choice using keys:")) image = cv2.imread(image_dict[n]) print(image.s...
true
5bbb4d525cfee97c9a125bf02a8580cda5bfc5db
grodrigues3/InterviewPrep
/Leetcode/swapPairs.py
UTF-8
671
3.4375
3
[]
no_license
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def swapPairs(self, head): """ :type head: ListNode :rtype: ListNode """ if head is None or head.next is Non...
true
b3bffffc9d54ac1da0fe3be0328a1587de9e1cce
ApexTone/Learn-Python
/PythonBasic/4Number.py
UTF-8
474
3.890625
4
[]
no_license
# "include" everything from math module from math import * print(-2.020) print(3+4*5) print((3+4)*5) aNumber = -10.23 print(aNumber) # Convert number to string print(str(aNumber) + " is a number") # Get absolute value print(abs(aNumber) ) # Exponent print(str(pow(aNumber,6)) + " random exponent") # Max/Min print(max...
true
124f491f49c4552169e5bde8d4d720d7057eb886
Waldo97Ag/Modos_de_Operacion
/modos_de_operacion.py
UTF-8
15,066
2.703125
3
[]
no_license
from tkinter import * from tkinter import messagebox, filedialog from tkinter import ttk from Crypto.Cipher import DES from PIL import Image import tkinter as tk import random import string import os filename = None def abrirArchivo_a_Usar(): global filename filename = filedialog.askopenfilename(initialdir="C...
true
48f61eb10b801ea0f9d0b34a1d23fbd7f013fb2d
roongtarohit/PandemicDashboard
/scripts/preprocessing/mongo_dump.py
UTF-8
4,866
2.8125
3
[]
no_license
""" Dump data from VAST 2010 MC2 Data files to MongoDB Prerequisites: ========================= * VAST 2010 MC2 Data files * Symptom Mappings Mongo Document Format: ========================= { "patient_id": 23686, "age": 45, "gender": "F", "symptom_text": "ABD PAIN,VOMITING", ...
true
067e56cbfe3c4b973dfefd7dd8c6890cc827972d
Supadhyay/python-ml-basic
/Variance & SD.py
UTF-8
315
3.640625
4
[]
no_license
import numpy as np import matplotlib.pyplot as plt import math incomes = np.random.normal(100, 20, 10000) plt.hist(incomes, 50) plt.show() print("Standard Deviation : {}".format(incomes.std())) print("Standard Deviation^2 : {}".format(math.pow(incomes.std(), 2))) print("Variance : {}".format(incomes.var()))
true
e3a8dd366011d735b4b9631dcdccb6639e2ad34b
DATALOVERVISUALIZER/MACHINE_LEARNING_PYTHON
/CODES/RandArray.py
UTF-8
2,094
3.40625
3
[]
no_license
####Task 1 from pip._vendor.distlib.compat import raw_input def factorial(x): i = 0 v_total = 1 while i <= x: v_total *= x x = x-1 i += 1 return v_total #Test Task 1 print (factorial(4)); ####Task 2 def permutation(x,y): return factorial(x)/factorial(x-y) print(permutati...
true
7888d350f6c4386291fa6a3cf8420c26166b47be
liqi629/py_study
/pytest_demo/tasks/test_three.py
UTF-8
546
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2019/5/26 18:22 # @Author : l7 # @Email :liqi_629@163.com # @File : test_three.py # @Software : PyCharm from collections import namedtuple Task = namedtuple('Task',['summary','owner','done','id']) Task.__new__.__defaults__ = (None,None,False,None) def test_defaultes(): ...
true
9c822811b388200b4196a3ba0f14e23a15afd3b5
Suryamadhan/9thGradeProgramming
/Quiz23EXFiles/Question_4.py
UTF-8
327
3.140625
3
[]
no_license
class NumberMult: def __init__(self, n1, n2): self.one = n1 self.two = n2 self.sum = 0 def setNums(self, n1, n2): self.one = n1 self.two = n2 self.sum = 0 def addNums(self): self.sum = self.one * self.two def __str__(self): return str(se...
true
142b5d3dc1b4acf85c6d29b638be8de954defdcf
VTIvanovIII/PythonIntegration
/Main.py
UTF-8
21,736
3.734375
4
[]
no_license
"""This is a demo of a basic adventure game to show off my Python skills.""" __author__ = "Vasil Ivanov III" import random def main(): print_intro() valid_character = False while not valid_character: name_first = input("Please tell me your first name. ") while name_first == "": ...
true
71f288c8274bc1bd3701e1d3071d6b68af2c83e8
sarahannali/pythoncourse
/Challenges/reverse_string.py
UTF-8
257
3.9375
4
[]
no_license
# add whatever parameters you deem necessary - good luck! def reverse_string(string): reversed = string[::-1] return reversed print(reverse_string('awesome')) # 'emosewa' print(reverse_string('Colt')) # 'tloC' print(reverse_string('Elie')) # 'eilE'
true
abfb9717d747a3178557acc158b71188cda88632
armen-h/wildlife_classification
/Transforms.py
UTF-8
321
2.65625
3
[]
no_license
import torch class HorizontalFlip(object): def __call__(self, sample): image = sample['image'] image_class = sample['class'] image_name = sample['image_name'] image = torch.flip(image, 1) return {'image': image, 'class': image_class, 'image_name': 'flipped_' + image_name}...
true
c723f5d62917070cc5de2e57accb4fcf506a848a
carlosmanri/Logic-Thinking
/Carlos/Ejercicios-1/nombre.py
UTF-8
220
3.78125
4
[]
no_license
import time nombre = input("Introduzca su nombre: ") time.sleep(1) contador = 0 for contador in range(1, len(nombre)): print(nombre[:contador]) for contador in range(len(nombre), 0, -1): print(nombre[:contador])
true
bb55608b6dc1e1ade3909c7a64f9974667395507
ThetHlaing/padc9-foundation-day-22
/1.ML intro/4.mnist-with-tf/mnist.py
UTF-8
1,011
2.78125
3
[]
no_license
import tensorflow as tf import matplotlib.pyplot as plt mnist = tf.keras.datasets.mnist (x_train, y_train),(x_test, y_test) = mnist.load_data() # Reshaping the array to 4-dims so that it can work with the Keras API x_train = x_train.reshape(x_train.shape[0], 28, 28, 1) x_test = x_test.reshape(x_test.shape[0], 28, 28...
true
7be791278a64f977317f5880ff26fdca72637337
jlynnvaccaro/balanced_ideals_scripts
/python/length_spread/txt_to_json.py
UTF-8
807
2.8125
3
[]
no_license
import utils import sys import os def write_ideals_to_json(infile, outfile): basename = os.path.basename(infile) name = os.path.splitext(basename) d = {"name":name,"summands":[],"ideals":[]} with open(infile, "rt") as f: summands = f.readline().strip().split("x") d["summands"] = [s.stri...
true
6ba91a03ff7b17a3afebee029d6be645013cb5dd
danielwardega141196/introduction-to-numpy
/short_tasks/exercises.py
UTF-8
7,027
3.640625
4
[ "MIT" ]
permissive
import numpy as np import inspect # 1) Stwórz wektor zer o rozmiarze 10 v = np.zeros((10,), dtype=int) assert v.sum() == 0 assert v.shape == (10,) # --------------------------------------------------- # 2) Napisz funkcję zwracającą ilość danych jaką zajmuje tablica numpy def memof(a): return a.nbytes assert m...
true
4a347306254d7a2eaa6a601b46bf832e4b93606c
thouis/pyfuego
/player.py
UTF-8
2,234
2.71875
3
[]
no_license
import pyximport pyximport.install() from sgf_to_hdf5 import get_current_features, NUM_FEATURES import go import numpy as np from predictor import Predictor # gtp coords are letters *** except I ***, number (from lower left) board_letters = "abcdefghjklmnopqrstuvwxyz" class Player(object): def __init__(self, fi...
true
2b77c8a5a3a1f117daa2ac6737f099ee28609c8c
oscarlwz/astro610
/rec.py
UTF-8
246
2.6875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt def recen(x,y): x=np.array(x) y=np.array(y) n=np.size(x) kk=np.arange(n)-n/2 xx=x/np.abs(x[1]-x[0]) x2=xx-n/2 xnew=x2*(x[1]-x[0]) ynew=y[kk] return xnew,ynew
true
7fe905b9ae485310ca5fe6b9756ad1c1a4267442
gmrukwa/divik
/test/score/test_dunn.py
UTF-8
2,678
2.765625
3
[ "Apache-2.0" ]
permissive
import unittest import numpy as np from sklearn.datasets import make_blobs import divik.cluster as km from divik.score._dunn import ( _inter_centroid, _inter_closest, _intra_avg, _intra_furthest, dunn, sampled_dunn, ) class DummyKMeans: n_clusters = 2 cluster_centers_ = np.array([[2]...
true
55c64acbac1e0aa06c97f57fcfe2813b2d0e4098
XinZhaoFu/leetcode_moyu
/504七进制数.py
UTF-8
583
3.6875
4
[]
no_license
""" 给定一个整数,将其转化为7进制,并以字符串形式输出。 示例 1: 输入: 100 输出: "202" 示例 2: 输入: -7 输出: "-10" """ class Solution(object): def convertToBase7(self, num): """ :type num: int :rtype: str """ if abs(num) < 7: return str(num) flag = 0 if num < 0: flag = ...
true
8a4a047f5efafae866989c4e1a4e3dfd4bb89119
demetriuz/sr_test_project
/aligment_tags_domain/importer.py
UTF-8
2,826
2.546875
3
[]
no_license
import logging from typing import List, Tuple from . import models as m, errors from .iservice import IAlignmentTagsService logger = logging.getLogger(__name__) class Importer: def __init__(self, service: IAlignmentTagsService, tag_definition_headers: Tuple[str, str]): self.service = service se...
true
ca1eb73dbd8c5cde112808c0f2205b60d8a5d721
Rickyaffo/Xlib
/src/algorithms/Properties.py
UTF-8
5,024
2.59375
3
[]
no_license
import cv2 from matplotlib import pylab as P, pyplot import numpy as np from skimage.segmentation import mark_boundaries import matplotlib.pyplot as plt from skimage import feature, transform from utility.Utility import ShowImage, ShowGrayScaleImage class Properties: def __getattr__(self, attr): # print("V...
true
824f16f1e1b705f15dc5a38394d4a10e983ec80c
ccubc/DS_self_learning
/leetcode_algorithm/leetcode_easy_961.py
UTF-8
440
3.390625
3
[]
no_license
""" In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated N times. Return the element repeated N times. Example 1: Input: [1,2,3,3] Output: 3 Example 2: Input: [2,1,2,5,3,2] Output: 2 """ class Solution: def repeatedNTimes(self, A: List[int]) -> int: d...
true
fb8b71d911807927b87823516e4d3dbf4f7b390f
atulRanaa/problem-solving-directory
/programming/Python/printingVariable.py
UTF-8
187
3.140625
3
[]
no_license
my_name ="Atul Singh Rana" my_age = 18 my_height = 130 my_weight = 50 print "Hi my name is %s and my age is %d" % (my_name , my_age) print "Height: %r" % my_height print "Weight: %r" % my_weight
true
c29f6a0c4a2e92b54ab063aee7a1161f4c47ab7e
muttlake/RadonProjectFinal
/Scanner2DSKI.py
UTF-8
3,074
3.125
3
[]
no_license
import numpy as np import matplotlib matplotlib.use("TkAgg") from matplotlib import pyplot as plt from skimage.transform import radon from skimage.transform import iradon class Scanner2DSKI: inputImage = None radonOutput = None iRadonOutput = None anglesArray = [] fig = None ax1 = None de...
true
e2927d1e70993ce36200665721890bdd4cbe4fcf
holmes0101/myDenseNet
/loadData.py
UTF-8
7,497
2.84375
3
[]
no_license
#!/usr/bin/env python # _*_ coding:utf-8 _*_ import numpy as np from PIL import Image import os import copy import tensorflow as tf def preprocess_for_train(image, height, width, bbox=None): # 如果没有提供标注框,则认为整个图像就是需要关注的部分 if bbox is None: bbox = tf.constant([0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape...
true
3eee05fc1b65bf0c705551557f422d850b45b529
zsofii/kiscica
/osztalyok/ember.py
UTF-8
1,948
3.09375
3
[]
no_license
# -*- coding: utf-8 -*- from datetime import datetime class Ember: def __init__(self, nev, szuletesi_datum, anyja_neve, hazi_allatok=None): if nev is not None and szuletesi_datum is not None and anyja_neve is not None: self.nev = nev self.szuletesi_datum = datetime.strptime(szulete...
true
3e88c891a566225d5c0b954c237d139ab2cb6b3b
hwanginbeom/TIL
/algorithms/source/web.py
UTF-8
624
3.25
3
[]
no_license
S= 'ababababababa' pattern = 'aabba' count = 0 for i in range(0, len(S) - len(pattern) +1): true_code = 0 code = S[i:i + len(pattern)] for j in range(0,len(pattern)): value = code.find(pattern[j]) if value != -1: true_code +=1 code = code[0:value] +code[value+1:] ...
true
42219afe98d9ef5fb8a19d1ad636f93b29599b7b
HackBulgaria/Programming101-3
/week1-Python-Problems/2-The-Real-Deal/solutions.py
UTF-8
3,102
3.75
4
[]
no_license
import copy import pprint def sum_of_divisors(n): return sum([x for x in range(1, n + 1) if n % x == 0]) def count_of_divisors(n): return sum([1 for x in range(1, n + 1) if n % x == 0]) def is_prime(n): return n + 1 == sum_of_divisors(n) def prime_number_of_divisors(n): is_prime(count_of_divisor...
true
09147eb3fc926b138351ee3de5899708c631b256
mansijain014/Emoji-Converter
/main.py
UTF-8
242
3.375
3
[]
no_license
#Emoji Cnverter message = input(">") words = message.split(' ') emojis = { ":)": "😊", "<3": "💖", ";)": "😉", ":D": "😃", ":/": "😕" } op = "" for word in words: op += emojis.get(word, word) + " " print(op)
true
604b320b1b232ddfd0e1c008b7690941ab37d3f5
AntonC1/Python-Exes
/zad3.py
UTF-8
1,187
3.59375
4
[]
no_license
""" Ćwiczenie: Napisać program, który: 1. Na podstawie: - roku urodenia, - miesiąca urodzenia - dnia urodzenia - nr kolejnego - określenia płci True == mężczyzna wygeneruje pesel w następującego schematu: - 2 ostatnie cyfry roku - 2 cyfrowy miesiąc uzupełniony od lewej zerem (jeżeli rok >= 2000 to do miesiąca...
true
355a218ad11c1ac3cb38bbf7f249729a820d8158
peetdenny/N-Queens-Genetic
/graphics/render.py
UTF-8
171
2.796875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np nrows, ncols = 9,9 image = np.zeros(nrows*ncols) image = image.reshape((nrows, ncols)) plt.matshow(image) plt.show()
true
6ce9cfa4653bc7d514102c4c971f54004cd332f6
leopd/timebudget
/demo3.py
UTF-8
533
3.015625
3
[ "Apache-2.0" ]
permissive
import random import time from timebudget import timebudget # More or less what's in the README for loops # but 10x faster so we can test it 100x and get the averages about right. @timebudget def possibly_slow(): time.sleep(0.03) def sometimes(): return random.random() < 0.6 @timebudget def should_be_fast()...
true
6e73894831ec57bd8595c57bd751ddae5c62f0d2
tanyaschlusser/15-years-pycon
/acquisition/get_pycon_us_2008.py
UTF-8
4,868
2.609375
3
[ "BSD-3-Clause", "MIT" ]
permissive
import datetime import re import requests from lxml import html from data import database as db from data.database import Conference, Talk, Human, Organization, Topic # helpers org_matcher = re.compile("(?<=\().+(?=\))") separators = re.compile('[,|/;]') # Add this conference YEAR = 2008 wayback = 'https://web.ar...
true
cbdeca6311803f848f3935b4a838765878fc2a1f
buzmakov/experiment_monitoring
/experiment_monitoring.py
UTF-8
3,236
2.578125
3
[]
no_license
from flask import Flask, render_template import os import numpy as np import fnmatch import datetime import warnings import pyfits import cPickle as pickle warnings.filterwarnings("ignore", category=Warning) app = Flask(__name__) app.config['ROOT_DIR'] = r'/home/makov/tmp/tomo_root/Raw/2012_10_22/bone_Cu15x10_30x1sec...
true
29e236b8b69b4114184423a9423b2b0cf807683e
yuto-moriizumi/AtCoder
/ABC004/ABC004c.py
UTF-8
247
3.21875
3
[ "Unlicense" ]
permissive
# ABC004c import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) n = int(input()) card = [i for i in range(1, 7)] for i in range(n % 30): t = card[i % 5] card[i % 5] = card[i % 5+1] card[i % 5+1] = t print(*card, sep='')
true
5fa57139bb05b902ed3aa7119342f845c50ee99e
usc-isi-i2/dig-sparkutil
/digSparkUtil/convertToSeq.py
UTF-8
839
2.53125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python from pyspark import SparkContext from optparse import OptionParser from fileUtil import FileUtil if __name__ == "__main__": sc = SparkContext(appName="DIG-TEXT-TO-SEQ") usage = "usage: %prog [options] inputDataset outputFilename" parser = OptionParser() parser.add_option("-r", ...
true
2abf551db5f271764bfb7bd9e9146038a7d8d38a
NJT145/my_github_repository_Python
/PyCharm_Projects/Yeni klasör/ENGR 212 01/PracticeSessions-codes/Week 10/test_practice_week10.py
UTF-8
1,265
2.609375
3
[]
no_license
import clusters import mysearchengine #step1 # -loosely speaking; this step is required to create two methods: getWordFrequency and createWordFrequencyMatrix_perUrl # -and as being the result of the modification done into addtoindex method, just added a return statement to the end # so by getting the result of it for...
true
05b07398bfac60f61de03df9cb7044556a4d6f3b
stfortner93/cfb.gui
/tkinter4.py
UTF-8
5,882
2.578125
3
[]
no_license
import tkinter as tk from tkinter import ttk as tkk import sqlite3 class MainApplication: def __init__(self, master): self.master = master self. dimensions() self.drop_menu(self.master) def dimensions(self): w = 800 # width for the Tk root h = 650 # heig...
true
45a4db1f0571d1fdab583634a5dff234afe28023
lgwauter/benchmarking
/tracking_dataset.py
UTF-8
4,351
2.640625
3
[]
no_license
import os from matplotlib import pyplot as plt import numpy as np from pathlib import Path import cv2 from PIL import Image as PILImage from rvai.types import BoundingBox, Point, Integer, String, Image, Class MOT_CLASS_MAPPING = [ "Pedestrian", # 1 "Person on vehicle", # 2 "Car", # 3 "Bicycle", # ...
true
7112da260ac89abc70be0568a4daf76b1033e93f
joanillo/CNED
/T1/splines7.py
UTF-8
1,230
2.71875
3
[]
no_license
# Joan Quintana Compte-joanillo. Assignatura CNED (UPC-EEBE) ''' # https://wwwstaff.ari.uni-heidelberg.de/mitarbeiter/rschmidt/pycourse/html/15.html cd /home/joan/UPC_2021/CNED/apunts/python/T1/ PS1="$ " python3 splines7.py ''' import numpy as np import matplotlib.pyplot as plt import scipy.interpolate as interpolate...
true
a8b4e11644934a9bf70cbe05727b0770dc782087
Aasthaengg/IBMdataset
/Python_codes/p02410/s436587937.py
UTF-8
364
2.75
3
[]
no_license
n, m = map(int, input().split(' ')) A = [] i = 0 while i < n: a = list(map(int, input().split(' '))) A.append(a) i += 1 x = [] j = 0 while j < m: x.append(int(input())) j += 1 ans = '' p = 0 while p < n: q = 0 a0 = 0 while q < m: a0 += A[p][q] * x[q] q += 1 ans += str...
true
03140f5b0530258fe9eb344bb0d7a2dcf14852b6
GSingh2014/TensorflowML
/src/main.py
UTF-8
3,055
2.59375
3
[]
no_license
from base.base_model import BaseModel from data_loader.data_generator import DataGenerator import json import numpy as np import matplotlib.pyplot as plt import sklearn from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import LabelEncoder from skle...
true
32de7153faba634f8194e54f986f76f072271f8e
Wangsteris/wangsteris.github.io
/Part4FunTime.py
UTF-8
1,305
3.234375
3
[]
no_license
import turtle from random import randint a=turtle.Turtle() t=turtle.Turtle() z=turtle.Screen() window = turtle.Screen() window.colormode(255) a.speed(0) t.speed(0) z.bgcolor(255,255,255) def spiral_b(acc): while acc<=1000: r=randint(0,255) g=randint(0,255) b=randint(0,255) ...
true
1474f16bd0be19f4e5729480358eaa900daceef3
comRamona/Honours-Project-NLP-for-Gender
/_name_classification/old_names_classifier.py
UTF-8
6,602
2.6875
3
[]
no_license
import os from enum import Enum import pandas as pd import re from collections import Counter import html import re from _name_classification.nametools import process_str class Gender(Enum): male = 0 female = 1 unknown = 2 class NameClassifier(): def __init__(self): female_path = os.path.join...
true