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
7b536c74a499700274615fbbe02eea4fcc503cc5
Python
CelsoAntunesNogueira/Phyton3
/ex030 - descobrindo o numero par.py
UTF-8
205
4.03125
4
[ "MIT" ]
permissive
a = int(input('Digite um número que irei dizer se é par ou não!')) b = a % 2 print('O número foi {}'.format(a)) if b == 0: print('Esse número é par!') else: print('Esse número é ímpar!')
true
596d2eea5906d536011f76be3696e8e66eb2241a
Python
Buzonxxxx/python-learning
/lecture4/hw4.py
UTF-8
1,970
4.3125
4
[]
no_license
# -*-coding:UTF-8 -*- # 試以 EX02_07.py 的程式碼為基礎,撰寫三個函數 # list_zip(city) # 傳入值為城市名稱可列出所有某城市裡面所有區域的郵遞區號 # ex. 呼叫 list_zip("台北市"),則列出所有台北市內所有區域的郵遞區號 # area_to_zip(area) # 傳入值為區域名稱回傳此區域的郵遞區號 # ex. 呼叫 area_to_zip("信義區") ,回傳 (‘台北市’,110) , (‘基隆市’,201) # zip_to_area(zip) # 傳入值為郵遞區號回傳區域名稱 # ex. 呼叫 area_to_zip(106) ,回傳...
true
ff7762f7b516eb3ede0dd6b3ad0578858fba8808
Python
Aasthaengg/IBMdataset
/Python_codes/p03265/s385452962.py
UTF-8
722
2.546875
3
[]
no_license
import bisect, collections, copy, heapq, itertools, math, string, sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = float('inf') def I(): return int(input()) def F(): return float(input()) def SS(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [...
true
46314c4b81231c9bf12d6031a878af28b1bf5cd0
Python
caige13/Integral-Calculator
/Integral Calculator/DoubleIntegralOptions.py
UTF-8
2,262
2.84375
3
[]
no_license
import DOUBLEINTEGRALCLASS def evaluateDoubleIntegral(m,n,a,b,c,d,function): FunctionOf = False m = int(m) n = int(n) checkx = [] checky = [] checky = a.split("y") checky.append(b.split("y")) checkx = c.split("x") checkx.append(d.split("x")) if len(checky)...
true
98de1696a788a984093c0a8d70bf38e613eabc7e
Python
gerardcl/renfe-cli
/src/renfe/utils.py
UTF-8
4,869
2.65625
3
[ "BSD-3-Clause" ]
permissive
import sys import os import json import logging import optparse from pathlib import Path class RenfeException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class ConfigurationMgmt(): _config_location = '.renfe_default_stations.json' _logging_levels = ...
true
476b5dab13b1e1ba7a1104325a9ad86a52b6234a
Python
FanWu-fan/Cs_231n
/chapter2/前向传播代码.py
UTF-8
999
3.140625
3
[]
no_license
import math x =3 y = -4 #前向传播 sigy = 1.0 / (1 + math.exp(-y)) #(1) num = x+sigy #(2) sigx = 1.0 / (1 + math.exp(-x)) #(3) xpy = x+y #(4) xpysqr = xpy**2 #(5) den = sigx + xpysqr #(6) invden = 1.0/den #(7) f = num*invden ...
true
1c4fba16206de578a64c5bb0947dd1749fe8bd37
Python
elarbee/euler
/11/11.py
UTF-8
1,740
3.28125
3
[]
no_license
grid_file = file("./grid.txt") # Create 2D Grid grid_matrix = [] for line in grid_file: line_list = str(line).replace('\n','').split(" ") grid_matrix.append(map(int,line_list)) max_product = 0 def vertical_pairs(): m = 0 for x in range(0,20): for y in range(0,17): a = grid_matri...
true
446707b14a019744fb79a3a20e1e803e9fa800b5
Python
Snehal-610/Python_Set
/CalenderMethod.py
UTF-8
859
3.53125
4
[]
no_license
# Calender Methods import calendar year = 2012 month = 11 # print(calendar.month(year, month)) # print(calendar.calendar(2021,0.5,1,6)) # weekdays = calendar.Calendar(firstweekday = 2) # # for day in obj.iterweekdays(): # print(day) MonthDate1 = calendar.Calendar() # for dates in MonthDate1.itermonthdates(2021...
true
5e367ff2249ad0560f0d5cbfd20f7e354e45a650
Python
BarbarianElf/cnn_speech_recognition
/main.py
UTF-8
6,471
2.53125
3
[]
no_license
""" main file for CNN Speech Recognition project Created on January 12th 2021 @authors: Niv Ben Ami & Ziv Zango """ from keras.models import load_model import os import numpy import data_utils import config import cnn def get_data(feature_type=None): try: x_data = numpy.load("saved_data/x_data_" + feat...
true
834633e62ba9da9bcfa768d3a27fa9a07f9d0d9d
Python
i-aditya-kaushik/geeksforgeeks_DSA
/Hashing/sort_by_freq.py
UTF-8
143
3.265625
3
[]
no_license
def sortByFreq(a,n): a.sort() a = sorted(a,key = lambda x:a.count(x),reverse=True) for x in a: print(x,end=" ") print()
true
b597ad298175da1c8abae5d636905602405e0634
Python
aman212yadav/COMPUTER_NETWORK
/ERROR_DETECTION_AND_CORRECTION/checksum.py
UTF-8
441
3.21875
3
[]
no_license
def getOnesComplement(n): n=list(bin(n)[2:]) for i in range(len(n)): if n[i]=='0': n[i]='1' else: n[i]='0' return "".join(n) print("Enter data received : ",end=" ") data_received=list(map(int,input().split())) if int(getOnesComplement(su...
true
7b739c80f8421322cc01470a3c6b4ebd3e932f24
Python
jaebee94/TIL
/SWEA/SWEA_D1/SWEA_D1_2063.py
UTF-8
593
3.421875
3
[]
no_license
# 2063. 중간값 찾기 # 중간값은 통계 집단의 수치를 크기 순으로 배열 했을 때 전체의 중앙에 위치하는 수치를 뜻한다. # 입력으로 N 개의 점수가 주어졌을 때, 중간값을 출력하라 def median(N, score): idx = len(score) // 2 for i in range(len(score)-1, 0, -1): for j in range(0, i): if score[j] > score[j+1]: score[j], score[j+1] = score[j+1], score...
true
a6659f812f853fcfe36844d7eb31162aa6494fa6
Python
alwin1031/UV-Vis
/conc.py
UTF-8
1,931
3.171875
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter def pre_read(pre_df): for i in range(len(pre_df.iloc[:,0])): if pre_df.iloc[i,0] == 'Data Points': skip_line = i+2 break return skip_line def Abs280(df): for i i...
true
6c0fcecc3465f2e05a0b829024805c8e3c2b1714
Python
sourcebots/zone-script
/main.py
UTF-8
2,038
2.828125
3
[]
no_license
import glob import json import re import socket import time from enum import Enum from pathlib import Path from threading import Event sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) class State(Enum): CONNECT = 1 MESSAGE = 2 DONE = 3 def poll(robot_root_path: str, zone_id: int, stop_event: Ev...
true
bcd811e4a5122eb4d8d145b61694754815c32a64
Python
k19421/MatplotlibClass
/Python数据可视化利器Matplotlib,绘图入门篇,布局自动调整命令/3.py
UTF-8
615
3.203125
3
[]
no_license
# 多绘图区不规则布局 import matplotlib.pyplot as plt def example_plot(ax, fontsize=12): ax.plot([1, 2]) ax.locator_params(nbins=3) ax.set_xlabel('x-label', fontsize=fontsize) ax.set_ylabel('y-label', fontsize=fontsize) ax.set_title('Title', fontsize=fontsize) fig1 = plt.figure() ax1 = plt.subplot(221)...
true
6c55f15bb75e1cca779204f1302da1946f6775f6
Python
zc-cris/python_demo01
/进阶07_模块/demo03_practice.py
UTF-8
666
3.59375
4
[]
no_license
# zc-cris ''' 给标签进行分组匹配: 可以在分组中利用(?P<name>正则表达式)的方式来给分组规则进行别名,获取到的匹配结果可以直接使用group(’name‘)的方式来获取 复合分组规则的匹配内容,我们称之为命名分组和引用分组;如果不想起名,可以使用序号的方式来引用分组规则(不推荐,示例:<(\w+)>\w+</\1>) ''' import re search = re.search('<(?P<name>\w+)>\w+</(?P=name)>', '<h2>cris</h2>') print(search) # <_sre.SRE_Match object; sp...
true
21327236681470f37e276cded5c36cc7c945a01d
Python
py-graphit/py-graphit
/graphit/graph_io/io_cwl_format.py
UTF-8
2,341
2.53125
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- # # Copyright (C) 2016-2018 # Author: Marc van Dijk (marcvdijk@gmail.com) # file: io_cwl_format.py """ Functions for importing data structures in Common Workflow Language format. The Common Workflow Language (CWL) is a specification for describing analysis workflows and tools in a way that ma...
true
df39dd464eb13f9f059a3e1cd9b63e96822cf85b
Python
jswelling/TweetHandling
/TweetHandling/src/Decoder.py
UTF-8
6,405
2.59375
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Created on Thu Feb 12 11:54:12 2015 @author: ColdJB """ import sys import cPickle as pickle import re import os.path import datetime import types from collections import defaultdict # directory = '\\Primack\\Primack Projects\\01 Projects\\2015_hpi_twitter\\World Vap...
true
89cb6c488487d228f0636d1488adceb20a12d339
Python
forchain/GANshion
/homework/HW2/Q3_2.py
UTF-8
12,212
2.5625
3
[]
no_license
# %% # -*- coding: utf-8 -*- # Author : Ali Mirzaei # Date : 19/09/2017 from tensorflow.keras.models import Sequential, Model from tensorflow.keras.layers import Dense, Input, Flatten, Reshape, Conv2DTranspose, concatenate from tensorflow.keras.datasets import mnist from tensorflow.keras.optimizers import Adam, SGD ...
true
140d3eea61536ebba9df8a90731436929fbb74fe
Python
mahendra-ramajayam/megnet
/megnet/data/local_env.py
UTF-8
1,597
2.984375
3
[ "BSD-3-Clause" ]
permissive
from pymatgen.analysis.local_env import * class MinimumDistanceNNAll(MinimumDistanceNN): """ Determine bonded sites by fixed cutoff Args:. cutoff (float): cutoff radius in Angstrom to look for trial near-neighbor sites (default: 4.0). """ def __init__(self, cutoff=4.0): ...
true
1fb541911a546b8cf06dfe41abb3cc06654c1c6e
Python
messi-wpy/CCNU-CS-lab
/python_learn/exercise2/exercise2-2.py
UTF-8
293
3.625
4
[]
no_license
num_1 = int (input("请输入数字:")) num_2 = int (input("请在输入一个数字")) a=num_1*num_2 if num_1>=num_2: b=num_1 c=num_2 else: b=num_2 c=num_1 while b % c != 0: temp = c c = b % c b = temp print("最大公约数:", c) print("最小公倍数:", a/c)
true
cb6426171f608e3c8cfc664372b6b8028c99b972
Python
avanish-patel/Python_Data_Science
/string.py
UTF-8
198
3.78125
4
[]
no_license
fname = "Avanish" lname = "Patel" fullName = fname + " " + lname print(fullName) sentence = "Hi, I'm Avanish Patel" print(sentence) # \ is ommiting letter sentence = 'Hi, I\'m Avanish Patel' print(sentence)
true
ba432bbac8a37602cae74b2c43cde05a0ff87d5a
Python
erikvansebille/STAMM
/LIB/turtle_lib.py
UTF-8
10,452
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 18 10:46:43 2019 @author: tcandela """ # ============================================================================= # IMPORTS # ============================================================================= import numpy as np import netCDF_lib as ...
true
81bc1bfc73c946ecd118a33240f163c9d07ab74f
Python
daniel-zeng/Tic-Tac-Toe
/board.py
UTF-8
4,388
2.953125
3
[]
no_license
symbols = {0: "-", 1: "O", 2: "X"} NOUG = 1 CROSS = 2 TIE = 3 width = 3 endGame = {NOUG: 1, CROSS: 0, TIE: 0.5} class Board: def __init__(self, case): self.board = [0] * 9 self.case = case global endGame if case == 1: self.memo = self.loadMemo("win_state.txt") ...
true
8b73994eeae155bf5354ac306613936f51546bcc
Python
benjspriggs/grading
/lint/test/test_static_member.py
UTF-8
756
2.703125
3
[]
no_license
#!/usr/bin/env python # test_static_member.py # Test for Static Member linter from unittest import TestCase, main from lint.lib import StaticMemberLinter class StaticMemberLinterTest(TestCase): has_static = "test/fixtures/has-static.cpp" well_formatted = "test/fixtures/well-formatted.cpp" def test_lint(s...
true
0c59286c827f69dc5fbf3caf8071dd8893fa1ae2
Python
dan99925/HomeWorkHilel
/HomeWork/HW7.py
UTF-8
322
3.65625
4
[]
no_license
x1 = int(input("First_coordinate")) y1 = int(input("Second_coordinate")) x2 = int(input("coordinate of movement_1")) y2 = int(input("coordinate of movement_2")) dx = x1 - x2 dy = y1 - y2 if dx < 0: dx *= -1 if dy < 0: dy *= -1 if dx == 1 and dy == 2 or dx == 2 and dy == 1: print(True) else: print(False...
true
4412d475bf336d19daa5dda576ce4584b7c9c599
Python
wong2/memobird.py
/memobird.py
UTF-8
2,556
2.578125
3
[ "MIT" ]
permissive
#-*-coding:utf-8-*- import requests from base64 import b64encode from cStringIO import StringIO from datetime import datetime from PIL import Image, ImageOps class ApiError(Exception): pass class Paper(object): def __init__(self): self.contents = [] @staticmethod def _ensure_gbk(text): ...
true
1c60b2495572da7fa97afc01e1aad4793cb265f7
Python
Wifi-cable/Robotic_AI_student_project
/otherScripts/doubleMyData.py
UTF-8
1,089
3.21875
3
[]
no_license
#!/usr/bin/env python3 import cv2 import datetime import os import time import glob ''' @param: string, folder with images. Takes all images in "imageFolder" and mirrors them. The flipped images are saved into the same folder. No immage name can be exidentally used twice because the name is tied to the unix time st...
true
fabbfd7a36f3539a5b8b3875bd0268684e51d085
Python
HuyaneMatsu/hata
/hata/discord/message/message_call/tests/test__put_ended_at_into.py
UTF-8
626
2.59375
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
permissive
from datetime import datetime as DateTime import vampytest from ....utils import datetime_to_timestamp from ..fields import put_ended_at_into def test__put_ended_at_into(): """ Tests whether ``put_ended_at_into`` works as intended. """ ended_at = DateTime(2016, 5, 14) for input_value, defa...
true
4e7e4c065eb30aa007afd051badd760e10244d60
Python
ttecles/weather_backend
/tests/test_tu_tiempo_api.py
UTF-8
3,747
2.578125
3
[]
no_license
import copy from unittest import TestCase import httpx import respx as respx from httpx import Response from app.weather import TuTiempoAPI from tests.base import api_response, day_s, hour_s class TestTuTiempoAPI(TestCase): def setUp(self) -> None: self.api = TuTiempoAPI("api_key", locations=[1]) ...
true
e278b033d9aed39ad7461679ccebb7a87f290e42
Python
fennisreed/WorldPop-to-USNG
/WP_to_USNG.py
UTF-8
2,188
2.53125
3
[]
no_license
# WORLDPOP TO USNG CONVERSION # --------------------------------------------------------------------------- # DESCRIPTION: A brief script that converts WorldPop gridded population # estimates to USNG grid cells. Centroids of each intersecting cell from the # WP estimate are summed for each input geography and joine...
true
2f2ad5bd43b54b6a5d51ef2fb2530c74158ac99c
Python
bijay007/Python
/fibonacci.py
UTF-8
298
3.234375
3
[]
no_license
first = 0; next = 1; sum = 0 ask = input ('Enter a limit to calculate its Fibonacci sequence : ') if ask > 50: print 'Too large. Enter smaller than 50' else: for i in range (0,ask): sum = first + next first = next next = sum print sum sum = 0
true
12a910e3d80376901b09ef362234da7d853a313b
Python
jmwright/cqparts
/tests/partslib/basic.py
UTF-8
2,510
3.046875
3
[ "Apache-2.0" ]
permissive
import cadquery import cqparts from cqparts.params import * from cqparts.constraint import Mate from cqparts.constraint import Fixed, Coincident from cqparts.utils import CoordSystem # --------------- Basic Parts ---------------- # Parts with the express intent of being concise, and quick to process class Box(cqpa...
true
cdac4fb99bc96b9deb41eb26b476f94b66b41af5
Python
bennullgraham/letterburb
/route.py
UTF-8
16,413
2.78125
3
[]
no_license
import heapq import itertools as it import math import operator import subprocess import sys from collections import defaultdict from functools import lru_cache from functools import reduce from pathlib import Path from random import choice from random import sample from typing import Dict from typing import Iterable f...
true
ccb7cc38d99d17fc5a2ebe115bd580dc6453c691
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_209/255.py
UTF-8
900
3.140625
3
[]
no_license
import operator import math class Pancake: def __init__(self, r, h): self.r = r self.h = h self.vert = 2 * math.pi * r * h self.tot = math.pi * r * r + self.vert T = int(input()) for t in range(1, T+1): N, K = [int(_) for _ in input().split(" ")] pancakes = [] for n in...
true
9b415a3cc07b1771a8b520af1451b4cfef21a3c8
Python
givenone/lightstage
/generate_pointcloud_ns.py
UTF-8
4,469
2.5625
3
[]
no_license
# the resulting .ply file can be viewed for example with meshlab # sudo apt-get install meshlab # # revised by junwon """ This script reads a registered pair of color and depth images and generates a colored 3D point cloud in the PLY format. """ from plyfile import PlyData, PlyElement, PlyProperty, PlyListProperty imp...
true
8d08837326b98593204d464958437dcbb6bf87e1
Python
adinosaur/Interns
/Interns.py
UTF-8
855
2.90625
3
[]
no_license
# -*- coding: UTF-8 –*- PyIntInterns = {} PyStrInterns = {} PyTupleInterns = {} def obj_intern(o): obj_type = type(o) if obj_type is int: return int_intern(o) elif obj_type is str: return str_intern(o) elif obj_type is tuple: return tuple_intern(o) assert False def int_int...
true
26c9711dd485a0ed855399472bf04980be1f30bb
Python
guptaShantanu/Python-Programs
/adobe.py
UTF-8
419
2.875
3
[]
no_license
n=int(input()) m=int(input()) dept=[] for i in range(n): temp = list(map(int,input().split())) dept.append(temp) i=0 connection=0 ladyCount1=0 ladyCount2 = 0 while i<n: for k in range(m): ladyCount2+=dept[i][k] if ladyCount2==0: pass else: connection+=ladyCount2*ladyCount1 ...
true
8ff834b5e1ab894134f6d2e9c052d243b6326cd6
Python
zhjr2019/PythonWork
/01_Python_Basis/Python_Karon/05_高级数据类型/jr_08_格式化字符串.py
UTF-8
273
4.09375
4
[]
no_license
info_tuple = ("小明", 18, 1.75) # 格式化字符串后面的()本质上就是元组 print("%s 年龄是 %d 身高是 %.2f" % info_tuple) info_str = "%s 年龄是 %d 身高是 %.2f" % info_tuple # 元组拼接字符串 生成 一个新的字符串 print(info_str)
true
983083f283f3db5777303d6c8b30e4b16487ceae
Python
ginny100/Social-Awareness-2
/Dijkstra_version2.py
UTF-8
1,129
3.796875
4
[]
no_license
''' Dijkstra's algorithm for undirected weighted graph Version 2 Source: protonx.ai ''' # Create a graph N = 7 edges = [ [0, 2, 1], [0, 1, 2], [0, 6, 3], [1, 5, 10], [1, 4, 15], [2, 1, 4], [2, 3, 2], [3, 4, 3], [4, 5, 5], [6, 1, ...
true
9f337eba06c7af6b9c5e514cb18aebc527575e77
Python
Sunny4552/wave-splash-projects
/AdventureGame.py
UTF-8
3,235
3.453125
3
[]
no_license
import time import random boss = ["Alien", "Predator", "Hydra"] def print_pause(string): print(string) time.sleep(1) def valid_input(prompt, option1, option2): while True: print_pause(prompt) response = input() if option1 == response: break e...
true
4a882cc673f867ff563619a2afb5db8481784cc5
Python
ab-gh/cs50ai
/projects/wk4/shopping/shopping.py
UTF-8
6,361
3.296875
3
[]
no_license
import csv import sys <<<<<<< HEAD ======= import datetime >>>>>>> 8878b8963063bf4207d52ab25b1a365dc6f7e2dc from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier TEST_SIZE = 0.4 def main(): # Check command-line arguments if len(sys.argv) != 2: sys.e...
true
f6e5857ed30231b7b464bd96c8bfd292c32f32d9
Python
antocaroca/ejercicios-usm-python
/ejercicios_parte_1/diseno_de_algoritmos/suma_de_digitos_al_cubo.py
UTF-8
346
3.8125
4
[]
no_license
# Entre todos los enteros mayores a 1 hay solamente cuatro que pueden ser representados por la suma de los cubos de sus dígitos. # FALTA! start= 149 end = 410 count = 0 lista = [] while start < end: start += 1 count+=1 lista.append(start) print(lista) cubos = [] for cubo in range(1,10): cubos.appen...
true
c39d094d51b13d4e60192866aaaf6b165dda299b
Python
izzrak/numpy_cnn
/data_utils.py
UTF-8
1,032
2.53125
3
[ "MIT" ]
permissive
import numpy as np import struct from glob import glob def load_mnist(path, kind='train'): """Load MNIST data from `path`""" images_path = glob('./%s/%s*3-ubyte' % (path, kind))[0] labels_path = glob('./%s/%s*1-ubyte' % (path, kind))[0] with open(labels_path, 'rb') as lbpath: magic, n = struct.unpack('>I...
true
fde4a313106110ebb4b7784cd01aa79439269ebb
Python
Equidamoid/freecaddy
/freecaddy/bearings.py
UTF-8
1,082
2.6875
3
[]
no_license
from dataclasses import dataclass import Part from FreeCAD import Base v = Base.Vector @dataclass class BearingDimensions: d_in: float d_out: float h: float inner_ring: float = None def hole_shape(self, z_clearance, xy_clearance=0): """ Shape of the hole where the bearing is to ...
true
0e8ea3dd74a243e14411b1bda33b777e9effa050
Python
vladnire/PythonProjects
/ChatBot/chatbot_functions.py
UTF-8
3,264
3.0625
3
[]
no_license
from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer from chatterbot.trainers import ListTrainer from chatterbot.response_selection import get_most_frequent_response def create_bot(name): """ We have read_only to false so the chatbot learns from the user input Args: ...
true
11f79c30a3f16375aec7d92998dc385f392f50b6
Python
whisper0077/programming-contests
/atcoder/ABC/175/B.py
UTF-8
260
2.796875
3
[]
no_license
import itertools N = int(input()) *L, = map(int, input().split()) ans = 0 for l in itertools.combinations(L, 3): l = list(l) l.sort() if l[0] != l[1] and l[1] != l[2] and l[0] != l[2]: if l[2] < (l[0]+l[1]): ans += 1 print(ans)
true
c87412fd49b0290a358f816d60f6c7535841a994
Python
vishnumenon/SleepTopology
/zerodpersistence.py
UTF-8
2,234
2.796875
3
[]
no_license
import numpy as np class Vertex(object): def __init__(self, x, y, isMax, componentBirths, currComponent=-1): self.x = x self.y = y self.isMax = isMax self.component = currComponent if not isMax: componentBirths[currComponent] = y self.children = [] d...
true
87e1384478205b00d05d88055eb998fbd9895ed6
Python
williamdemeo/Aljebra
/Aljebra/src/closure/OldClosure.py
UTF-8
16,891
3.03125
3
[]
no_license
''' Utilities for finding congruence lattice representations of small lattices. Created on Jun 12, 2013 @author: williamdemeo at gmail @see: Itertools documentation at http://docs.python.org/2/library/itertools.html ''' from org.uacalc.alg.conlat import BasicPartition from org.uacalc.lat import BasicLattice from org.ua...
true
f2bbe391b591f58d735e0b9a5d7460150439dbad
Python
wzdnzd/leetcode
/python3/0023.合并k个排序链表.py
UTF-8
2,015
3.234375
3
[ "Apache-2.0" ]
permissive
# # @lc app=leetcode.cn id=23 lang=python3 # # [23] 合并K个排序链表 # # https://leetcode-cn.com/problems/merge-k-sorted-lists/description/ # # algorithms # Hard (42.88%) # Likes: 235 # Dislikes: 0 # Total Accepted: 23.8K # Total Submissions: 51.9K # Testcase Example: '[[1,4,5],[1,3,4],[2,6]]' # # 合并 k 个排序链表,返回合并后的排序链表。...
true
582ff6e9f961cd9ad80074decb937bc146e4ef20
Python
nyetwurk/mumble
/scripts/transtate.py
UTF-8
1,997
2.609375
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # # Copyright 2005-2017 The Mumble Developers. All rights reserved. # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file at the root of the # Mumble source tree or at <https://www.mumble.info/LICENSE>. # Extracts the progress of translations from th...
true
be8ee938ca6287ab0fe30611fcd4e797f320ce8c
Python
ItManHarry/Pandas
/data/chapter5/SortByIndex.py
UTF-8
1,827
3.625
4
[]
no_license
import pandas as pd import random as rd #创建数据 data = [['N%s' %i,'jack%s@163.com' %i, rd.randint(20, 45), '1%s%s%s%s' %(rd.choice([3,5]), rd.randint(0,9), rd.randint(1000,9999), rd.randint(1000,9999)), rd.choice(['F','M']), rd.choice(['山东','河南','山西','河北','湖南','湖北','北京','上海','广州'])] for i in range(5000)] columns = ['职号',...
true
33fc12ec1d256bf8c7da807da5d403a47b5e654e
Python
tlaehdtlr/Go-Algorithm
/삼성/청소년상어(하다맘).py
UTF-8
1,908
2.65625
3
[]
no_license
dr = [-1, -1, 0, 1, 1, 1, 0, -1] dc = [0, -1, -1, -1, 0, 1, 1, 1] def move_shark(sea, fishes): r, c = fishes[0] return attack def move_fish(sea, fishes): for num in range(1, 17): if fishes[num]: r, c = fishes[num] _, direc = sea[r][c] for d in range(8): ...
true
21f4397700cf977e11306f00af527a569159f0ff
Python
jabe1204/test
/hola.py
UTF-8
157
3.546875
4
[]
no_license
print("Hola Mundo") print("") print("Contador normal") for i in range(10): print(i) print("") print("Contador invertido") for i in range(10): print(9-i)
true
0b426fdcf8159c9529f29482984386b281b20f82
Python
Pravin2796/python-practice-
/chapter 10/instanceattribute.py
UTF-8
230
3.265625
3
[]
no_license
class Employee: company = "google" salary = 100 harry = Employee() rajni = Employee() # creating instance attribute salary for both objects harry.salary = 300 # rajni.salary = 400 print(harry.salary) print(rajni.salary)
true
ee78118916b96fb5283bd2aec051903680327275
Python
594billy/reviews-analytics
/read.py
UTF-8
258
3.578125
4
[]
no_license
data = [] with open('reviews.txt', 'r') as f: for line in f: data.append(line) print ('總共有', len(data), '筆留言') sum_len = 0 for comment in data: sum_len += len(comment) print('平均留言長度為', sum_len / len(data), '個字')
true
36976107aaadff337071498e80b8ca2c43a574e2
Python
Dip-Xd/pokurt
/blog.py
UTF-8
726
2.84375
3
[]
no_license
from feedparser import parse from html2markdown import convert url = "https://blog.pokurt.me/rss/" def func(url): feed = parse(url).entries latest = [ f"""[📝 {feed[i].title}]({feed[i].link}) \n{feed[i].description} - {feed[i].published}\n\n---------------------""" for i in range(3) ] ...
true
875744a00d6067f04e53cdd87dd00a7f139096b8
Python
yooyep/tensorflows-
/204_saver_reload.py
UTF-8
2,039
2.734375
3
[]
no_license
#%% # -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import pickle tf.reset_default_graph() #--------------- 导入数据 --------------- x_data = np.linspace(-2,2,100)[:,np.newaxis] noise = np.random.normal(0,0.1,size=x_data.shape).astype(np.float32) y_data = x_data**2+noise ...
true
cfa9678e7b93b1ecee1332da1236d27bf22cdf89
Python
SantoroPablo/tesis_maestria_dm
/src/vae_esferas/py_classes/CSVSphDataset.py
UTF-8
845
2.9375
3
[]
no_license
# Clase para cargar el dataset de esferas a partir de # la lectura de una lista de archivos en un CSV. # Es una subclase de la clase 'Dataset' de pytorch import torch import torchvision import numpy as np import pandas as pd import trimesh import os class CSVSphDataset(torch.utils.data.Dataset): """ Dataset de...
true
e5db935263e1624c7a4aa3904b5df2fe18752222
Python
atshaya-anand/LeetCode-programs
/Easy/nAndDouble-exists.py
UTF-8
447
2.96875
3
[]
no_license
# https://leetcode.com/problems/check-if-n-and-its-double-exist/ class Solution: def checkIfExist(self, arr: List[int]) -> bool: a = set(arr) count = 0 for i in range(len(arr)): c = 2*arr[i] if c == 0: count +=1 if c...
true
74fe21e77f500a6a8701a9416515a67c09fabc7a
Python
bmolina-nyc/ByteAcademyWork
/Assessment_1_Practice_2/fake_app/data/schema.py
UTF-8
948
2.53125
3
[]
no_license
import os import sqlite3 DIR = os.path.dirname(__file__) DB = 'practice_db.db' DBPATH = os.path.join(DIR, DB) def schema(dbpath = DBPATH): with sqlite3.connect(dbpath) as conn: cursor = conn.cursor() DROPSQL = "DROP TABLE IF EXISTS {tablename};" cursor.execute(DROPSQL.format(tablename="ts...
true
6d849d1dd6763943523e1af953ede6c61400d786
Python
liwangzhi/Classification
/train_labels_csv.py
UTF-8
2,305
2.765625
3
[]
no_license
""" describe: @project: 智能广告项目 @author: Jony @create_time: 2019-07-09 12:21:10 @file: dd.py """ import re from glob import glob from itertools import chain import os import math import numpy as np import pandas as pd import os.path as osp from tqdm import tqdm def read_data_path(data_path,hidename):...
true
0f23433cb58700c040108312999be8527700c174
Python
mjota/telephone_analyzer
/telephone_analyzer.pyw
UTF-8
6,972
2.578125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Telephone Analyzer # Copyright (c) 2012 - Manuel Joaquin Díaz Pol # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public Licens...
true
dbd26034c587b200fe6701aa122df6226a492fa3
Python
xeddmc/AI-bitcoin
/cs221-stuff/util.py
UTF-8
2,417
3.09375
3
[]
no_license
import time, datetime, copy from datetime import date from datetime import timedelta from datetime import datetime time_format = '%d/%m/%Y %H:%M:%S' def time_to_date(t): return datetime.date(datetime.fromtimestamp(time.mktime(t))) # return 2d array of data in file # first index of each row is a Time, second index i...
true
35eba0435e4816f30291fdae7a46237531694236
Python
yijaein/cnn_classification
/Tools/mask_dataset_patient_info.py
UTF-8
4,220
2.625
3
[]
no_license
import csv import os import cv2 from Tools.dicom_physical_size import read_diagnosis_csv, read_dicom_pixel_size_csv, object_wh from Tools import csv_search def norm_path(path): path = os.path.normcase(path) path = os.path.normpath(path) path = os.path.expanduser(path) path = os.path.abspath(path) r...
true
d67936bf74e5c4feb0fd8ac641926f45f93b52a2
Python
Wedge-Dev/IT-Automation-with-Python
/1. Crash Course on Python/Week 2 Basic Python Syntax/Expressions and Variables/Expressions, Numbers, and Type Conversions.py
UTF-8
559
4.46875
4
[]
no_license
#In this scenario, we have a directory with 5 files in it. Each file has a different size: 2048, 4357, 97658, 125, and 8. Fill in the blanks to calculate the average file size by having Python add all the values for you, and then set the files variable to the number of files. Finally, output a message saying "The avera...
true
e2dd92a1f1ade33509b9ade084fea5163d835346
Python
Omega094/lc_practice
/serilize_binary_tree/Serilizer.py
UTF-8
3,190
3.609375
4
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None import sys sys.path.append("/Users/jinzhao/leetcode/") from leetcode.common import * class Codec: def serialize(self, root): """Encodes...
true
8be35e4d68d5458fa03c375d73b05eb47e1848d9
Python
Sampada7K/Programming_Questions
/Regex/findall_emails.py
UTF-8
386
3
3
[]
no_license
import re pattern = r'([\w+.-]+)@([\w.]+)' emails = [] with open('text.txt', 'r') as f: lines = f.readlines() for line in lines: email = re.findall(pattern, line) emails.append(email[0]) if emails: print(emails) with open('emails.txt', 'w') as f: for email in emails: f.write(...
true
04304e071b213ef354a9f240f1e8d523811bd906
Python
azrael11/kalliope
/Tests/test_dynamic_loading.py
UTF-8
4,458
3.109375
3
[ "MIT" ]
permissive
import inspect import os import unittest class TestDynamicLoading(unittest.TestCase): """ Test case for dynamic loading of python class This is used to test we can successfully import: - STT engine - TTS engine - Trigger engine - All core neurons """ def setUp(self): # ge...
true
d991d295ca5398a0e14445e9a8af33cb7e3aa2a0
Python
GonzaloGNogales/RoadClassifierVA
/Euclidean_LDA_Classifier/euclidean_lda.py
UTF-8
3,170
3.453125
3
[]
no_license
import numpy as np from sklearn.discriminant_analysis import LinearDiscriminantAnalysis class Euclidean_LDA: def __init__(self): # Instantiate a linear discriminant analysis object (LDA) for reducing the data dimensionality self.lda = LinearDiscriminantAnalysis() self.centroids = list() ...
true
e08078831439f6aa071eee3bd302d07c71dd8bd8
Python
arturoalviar/project-euler-python
/python/problem_25_thousand_digit_fibo_num.py
UTF-8
401
3.734375
4
[]
no_license
############################################################ #Problem 25 def thousand_digit_fibo_num(index = 0): '''Finds the index of the first term in the Fibonacci sequence to contain 1000 digits?''' a , b = 0 , 1 limit = 100000 while limit > 0: a , b = b , b + a index += 1 ...
true
3325686183c831bcd182ec1fd7f014ec20bd3961
Python
MatthewFletcher/ENG101Python
/HW10P1.py
UTF-8
2,504
3.328125
3
[]
no_license
# _ _ _ _ _ _ _ _ _ _ _ _ # (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) # / ._. \ / ._. \ / ._. \ / ._. \ / ._. \ / ._. \ # __\( Y )/__ __\( Y )/__ __\( Y )/__ __\( Y )/__ __\( Y )/__ __\( Y )/__ # (_....
true
e3b445263cacce5e32b206c66090017617afc249
Python
ninilo97/CodeWithGoogle-2019
/Kick Start 2019/Practice Round/mural.py
UTF-8
812
2.921875
3
[]
no_license
def simple_beauty(mural): mural_size_to_check = int((len(mural)+1)/2) lst = [] for i in range(mural_size_to_check): lst.append(sum(mural[i:i+mural_size_to_check])) return max(lst) def complex_beauty(): mural_size = int(input()) mural = [int(num) for num in str(input())] mural_size_t...
true
921f286e45034a68394ddb3c483bb950b6324f0e
Python
shuxiangguo/Python
/Learn/spider/21DaysOfDistributedSpider/ch04/csv_demo/csv_writer_test.py
UTF-8
962
3.25
3
[]
no_license
# encoding: utf-8 """ @author: shuxiangguo @file: csv_writer_test.py @time: 2018-11-03 01:16:32 """ import csv def csv_writer(): headers = ['Username', 'age', 'heigth'] students = [ ('zhangsan', 20, 180), ('lisi', 21, 187), ('王五', 22, 178) ] with open('./studnents.csv', 'w', encoding='utf-8', newline='') as...
true
26e33398fc17892b63afed5331f4fafed3e1091b
Python
Wizmann/ACM-ICPC
/Leetcode/Algorithm/python/2000/01872-Stone Game VIII.py
UTF-8
300
2.65625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
INF = 10 ** 10 class Solution(object): def stoneGameVIII(self, stones): n = len(stones) pre = sum(stones) maxi = -INF for i in xrange(n - 1, 0, -1): maxi = max(maxi, pre - (0 if i + 1 == n else maxi)) pre -= stones[i] return maxi
true
3c13524027c3beb3a2bb73bbb8473b9d2666fb46
Python
infinite-Joy/programming-languages
/python-projects/algo_and_ds/merge_intervals_using_stacks.py
UTF-8
972
3.6875
4
[]
no_license
""" merge intervals bringing in an n2 solution which is the brute force so you check each and every and then merge them if fall within the same range Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]. [[1,3]...
true
fa2d74433cce7811f2848d3124931f0b71ca1c17
Python
JoshCoop1089/Private-Projects
/Python/2018/HackerRank/HackerRank Challenge 'miniMaxSum'.py
UTF-8
235
3.265625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Apr 6 22:39:05 2018 @author: joshc """ def miniMaxSum(arr): arr.sort() arrmin=sum(arr[:-1]) arrmax=sum(arr[1:]) print(arrmin,arrmax) arr=[1, 2, 3, 4, 5] miniMaxSum(arr)
true
8a58d6292eaf188f229139a6d533687028fadfec
Python
rileonard15/offline-insta-slides
/main.py
UTF-8
3,887
2.53125
3
[]
no_license
import web import os import time import requests import urllib import urllib2 import json as simplejson import dl_image as IMAGES urls = ( '/', 'IndexHandler', '/login', 'LoginHandler', '/filenames', 'FilenameHandler', ) CLIENT_ID = "" # client ID goes here CLIENT_SECRET = "" # client SECRET goes here HAS...
true
286469f715bf374a8f898bc98b1fd1e90cc2afb7
Python
vraj152/projectcs520
/featureExtraction.py
UTF-8
2,324
3.671875
4
[]
no_license
import numpy as np """ Feature of particular image of particular position & index starts from (0,0) e.g.: Let's say matrices[5] (from driverFile.py) Extract feature from 2nd row and 3rd column ; i=1, j=2 i being row number and j being column number params: test = input image in Numpy array object i ...
true
344b4b5d06c3125f8dfb75894f99dcf1573dc85b
Python
DeanHe/Practice
/LeetCodePython/LargestPalindromicNumber.py
UTF-8
1,148
4.1875
4
[]
no_license
""" You are given a string num consisting of digits only. Return the largest palindromic integer (in the form of a string) that can be formed using digits taken from num. It should not contain leading zeroes. Notes: You do not need to use all the digits of num, but you must use at least one digit. The digits can be ...
true
e1625d7c3ffe17d4805ddf049732f8e650dcaa7c
Python
marko-knoebl/courses-code
/python/2019-05/reading_writing_files/analyze_todos.py
UTF-8
908
3.546875
4
[]
no_license
# manually downloaded data from jsonplaceholder.typicode.com # - json file of 200 todos import json with open('reading_writing_files/todos.json', encoding='utf-8') as todofile: todostring = todofile.read() tododata = json.loads(todostring) num_todos = len(tododata) print(f"{num_todos} todos") num_completed = 0...
true
a97f66da1a1ce5535d55b1e573f94135e8ee11f8
Python
lbertoncello/BT-kNN
/sklearn_knn.py
UTF-8
1,742
2.765625
3
[]
no_license
import numpy as np from sklearn import neighbors, datasets, model_selection from sklearn.metrics.pairwise import cosine_similarity def write_results(results, dataset_dirname): with open('%s/classifieds.txt' % dataset_dirname, 'w') as f: for result in results: f.write("%s\n" % str("".join...
true
317e1bf5315ec955dc7ae4eede8cac4f9cdf2328
Python
CPMcshane/DinoLand
/analysis.py
UTF-8
4,845
4.375
4
[]
no_license
""" This is a python file that uses the sqlite module to perform sql commands. The purpose of this program is to find which dinosaurs can be placed safely together in habitats based on each dinosaur's characteristics. Herbavores, carnivores, and flying dinosaurs must be kept seprate. Territorial creatures cannot be pl...
true
dde4e7857bd4b5dd7fa4d8e5cace0be4dc40140b
Python
spratapa/arc_sent_project
/app1.py
UTF-8
1,190
2.578125
3
[]
no_license
import sys import numpy as np import tensorflow as tf from keras.models import Model,Sequential from keras.layers import Dense, Input, Dropout, LSTM, Activation from keras.layers.embeddings import Embedding from keras.preprocessing import sequence,text from matplotlib import pyplot from keras.datasets import imdb from...
true
98425dc9e1d51b07a02699e009c26464332dd457
Python
mcstitzer/dawe_ab10_kindr
/identify_haplotypes/pars_inf_snps.py
UTF-8
1,476
2.65625
3
[]
no_license
## find parsimony informative sites in multifasta alignment, output csv file of position and snp. ## relies on aligned fasta, only characters as ACTG- ## prints csv to STDOUT import sys from Bio import SeqIO from Bio.SeqRecord import SeqRecord from collections import Counter seqs=list(SeqIO.parse(open('ALL_KINDR_TE_...
true
7ef602728d013dc381d01c62b8aa6ad310783fdd
Python
OkayHughes/iros2017_pedestrian_forecasting
/code/scene.py
UTF-8
9,013
3.21875
3
[]
no_license
"""Scene module Module contains the scene class, whose initializer will train a scene from a given set of training data. """ import pickle import numpy as np import process_data class Scene(): """ A class which learns stuff from a list of trajectories. attributes: num_nl_classes: This is the number ...
true
745dbe68ea5ba1ef509ebee9f007db14c1ebaf85
Python
pfig9141/Metody-Numeryczne
/aproksymacja_danych2.py
UTF-8
672
2.609375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import scipy.signal as scp import scipy.io from scipy.interpolate import interp1d # dane data13 = list(scipy.io.loadmat('G:/Dane do Stacjonarny WAT/dysk H/Dane/Dane energetyczne/data_98.mat', squeeze_me=True).values())[3] # (dysk WAT) # o...
true
6fd9692fb41d45ffeb6d0c46031c37368333a99f
Python
alexlikova/Python-Basics-SoftUni
/7. Python Basics - More Exercises/2. Conditional Statements - More Exercises/07. Flower Shop.py
UTF-8
682
3.78125
4
[]
no_license
import math number_magnolii = int(input()) number_zumbuli = int(input()) number_roses = int(input()) number_cactus = int(input()) price_present = float(input()) magnolii = 3.25 zumbuli = 4.0 roses = 3.5 cactus = 8.0 price_magnolii = magnolii * number_magnolii price_zumbuli = zumbuli * number_zumbuli price_roses = ro...
true
2909685d07b4df7f713f7940fa408749d72a9a65
Python
zzuse/fluentPythonLearning
/coroutineUsage.py
UTF-8
6,058
3.390625
3
[]
no_license
import inspect def simple_coroutine(): print('-> coroutine started') x = yield print('-> coroutine received:', x) my_coro = simple_coroutine() print("linspect.getgeneratorstate(my_coro) {}\n----------".format(inspect.getgeneratorstate(my_coro))) print("my_coro {}\n----------".format(my_coro)) print("lin...
true
2c01dcc86e41a4a7f8f7e11a3f3c43aed697869c
Python
ProjectsWithPython/FileHandling
/src/EasyFileHandling/tests/test_filehandler.py
UTF-8
1,160
3.15625
3
[ "MIT" ]
permissive
import unittest import os import sys import io from EasyFileHandling.main import FileHandler class FileHandlerTests(unittest.TestCase): test_filename = 'test.txt' def setUp(self): try: with open(self.test_filename, 'w') as f: f.write('This is a test file.\nThis is the seco...
true
0a6e225409e54166075d191a46c6012899175b3f
Python
alaamarashdeh92/CA05---Introduction-to-Functions
/Q7.py
UTF-8
213
3.671875
4
[]
no_license
# Q 7 # ****** def sum_or_max(my_list): if len(my_list) %2 == 0 : return sum(my_list) if len(my_list) != 0 : return max(my_list) list1 = [1,2,3,4,5] print(sum_or_max(list1))
true
7b2e545878985ba30f1abf370c06a0b4aefd36e9
Python
alexa984/python101
/week5/MusicLibrary/playlist.py
UTF-8
4,141
3.4375
3
[]
no_license
import json import numpy as numpy import matplotlib.pyplot as plt from random import shuffle from song import Song class Playlist: def __init__(self, name, repeat=False, shuffle=False): #everything in song_list should be of class Song self.name = name self.song_list = [] self.repeat ...
true
a1840821ed886302176410f6d95d0e7f1c5f1a57
Python
DatGuy1/pajbot
/pajbot/utils/find.py
UTF-8
328
2.90625
3
[ "MIT" ]
permissive
from typing import Callable, Iterable, Optional, TypeVar T = TypeVar("T") def find(predicate: Callable[[T], bool], seq: Iterable[T]) -> Optional[T]: """Method shamelessly taken from https://github.com/Rapptz/discord.py""" for element in seq: if predicate(element): return element retu...
true
db5d9a78128f75b7571359bffb88b34e7f1eb5e9
Python
dougalferg/OpenVibSpec
/scr/openvibspec/preprocessing.py
UTF-8
2,157
3.546875
4
[]
no_license
''' This submodule provides basic preprocessing functionality to work with hyperspectral data/images. E.g. - Normalization - Baseline Correction/Removal - RGB-Image standardization - Scatter correction (especially RMieS-correction) - Data transformations from 3D to 2D and reverse - ... @JoshuaButke github.com/butkej ...
true
bd75eb24527bf7e4fe9e7e1028e564ac6a5f1adf
Python
KathyCriollo/Deber-Semana_nueve
/Reloj.py
UTF-8
267
3.25
3
[]
no_license
# -*- coding: utf-8 -*- import time fecha_hora = time.strftime("%c") print ("Fecha y hora " + time.strftime("%c")) #Fecha y hora print ("Fecha " + time.strftime("%x")) #tiempo print ("Hora " + time.strftime("%X")) #hora print ("Fecha y hora son: %s" % fecha_hora )
true
cf548c69e9ce4c2451abc433c8c06fe65772587f
Python
MaxwellHsiaotw/projects
/NBA bet program/prediction%.py
UTF-8
1,359
2.5625
3
[]
no_license
import csv import datetime fh = open('C:\\Users\\Maxwell\\Documents\\Python file\\NBA\\file\\betdata.csv', 'r', newline='', encoding = 'utf-8') fh1 = open('C:\\Users\\Maxwell\\Documents\\Python file\\NBA\\file\\result.csv', 'w', newline='', encoding = 'utf-8') aa = fh.readline() reader = csv.reader(fh) writer = c...
true
29213ae3eb6fcaaedaa4632e6afc1fb4fbed36b3
Python
tdb-alcorn/q2
/q2/config/__init__.py
UTF-8
1,544
2.59375
3
[ "MIT" ]
permissive
import os import yaml import importlib.util from typing import Dict, List, Any cwd = os.getcwd() objects_file = os.path.join(cwd, 'objects.yaml') object_types = [ 'agent', 'environment', 'objective', 'regimen', ] default_objects = dict() for ot in object_types: default_objects[ot] = dict() def p...
true
21875b26b0babfe5cae46756257c0c4e0d5a36f4
Python
liuchenghao2000/1807
/1807-1/13day/00-拳头.py
UTF-8
261
3.171875
3
[]
no_license
import random pc = random.randint(1,100) for i in range(10): player = int(input('请输入数字:')) if player > pc: print('太大了') elif player < pc: print('太小了') else: print('答对了') break
true
04be02ac6596fa27b56c0dfc46e27de96d565724
Python
jpark712/large_pal_prod
/large_pal_prod.py
UTF-8
540
3.390625
3
[]
no_license
def largest_palindrome(n): upper_limit = 10**n - 1 lower_limit = 10**(n-1) - 1 largest = 0 for a in range(upper_limit, lower_limit, -1): for b in range(upper_limit, lower_limit, -1): prod = a*b if prod < largest: break if (is_palindrome(prod)):...
true
d2914044d18b97aece908b80cd2fb40f62dd9f61
Python
dschweim/WeakSupervisionForPopulismDetection
/util.py
UTF-8
15,519
2.78125
3
[]
no_license
import os import numpy as np import re import pandas as pd from datetime import datetime from sklearn.model_selection import train_test_split from sklearn.metrics import f1_score, precision_score, recall_score, accuracy_score def generate_train_dev_test_split(df): """ Generate train dev test split :param ...
true